//registercommand("hud_configure");
//registercommand("hud_save");
//registercommand("menu_action");
-
+
ConsoleCommand_macro_init();
registercvar("hud_usecsqc", "1");
turrets_precache();
Tuba_Precache();
CSQCPlayer_Precache();
-
+
if(autocvar_cl_reticle)
{
if(autocvar_cl_reticle_item_normal) { precache_pic("gfx/reticle_normal"); }
if(autocvar_cl_reticle_item_nex) { precache_pic("gfx/reticle_nex"); }
}
-
+
get_mi_min_max_texcoords(1); // try the CLEVER way first
minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
shortmapname = mi_shortname;
spn_origin_x = ReadShort();
spn_origin_y = ReadShort();
spn_origin_z = ReadShort();
-
+
if(is_new)
{
self.origin = spn_origin;
}
}
else { self.cnt = particleeffectnum("spawn_point_neutral"); }
-
+
self.draw = Spawn_Draw;
}
}
// this way the server can disable the sending of
// spawn origin or such to clients if wanted.
float entnum = ReadByte();
-
+
if(entnum)
{
self.origin_x = ReadShort();
}
}
}
-
+
// local spawn actions
if(is_new && (!entnum || (entnum == player_localentnum)))
{
button_zoom = FALSE;
}
}
-
+
//print(sprintf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d, localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum));
}
case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
- case ENT_CLIENT_TURRET: ent_turret(); break;
+ case ENT_CLIENT_TURRET: ent_turret(); break;
case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
- case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
+ case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
case ENT_CLIENT_SPAWNPOINT: Ent_ReadSpawnPoint(bIsNewEntity); break;
case ENT_CLIENT_SPAWNEVENT: Ent_ReadSpawnEvent(bIsNewEntity); break;
else if(autocvar_cl_spawnzoom && zoomin_effect)
{
float spawnzoomfactor = bound(1, autocvar_cl_spawnzoom_factor, 16);
-
- current_viewzoom += (autocvar_cl_spawnzoom_speed * (spawnzoomfactor - current_viewzoom) * drawframetime);
+
+ current_viewzoom += (autocvar_cl_spawnzoom_speed * (spawnzoomfactor - current_viewzoom) * drawframetime);
current_viewzoom = bound(1 / spawnzoomfactor, current_viewzoom, 1);
if(current_viewzoom == 1) { zoomin_effect = 0; }
}
setsensitivityscale(pow(current_viewzoom, 1 - zoomsensitivity));
else
setsensitivityscale(1);
-
+
makevectors(view_angles);
if(autocvar_cl_velocityzoom && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too
case 1: default: curspeed = vlen(v); break;
}
}
-
+
velocityzoom = bound(0, drawframetime / max(0.000000001, autocvar_cl_velocityzoom_time), 1); // speed at which the zoom adapts to player velocity
avgspeed = avgspeed * (1 - velocityzoom) + (curspeed / autocvar_cl_velocityzoom_speed) * velocityzoom;
velocityzoom = exp(float2range11(avgspeed * -autocvar_cl_velocityzoom / 1) * 1);
-
+
//print(ftos(avgspeed), " avgspeed, ", ftos(curspeed), " curspeed, ", ftos(velocityzoom), " return\n"); // for debugging
}
else
R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
R_EndPolygon();
}
-
+
// Draw the aiming reticle for weapons that use it
// reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
// It must be a persisted float for fading out to work properly (you let go of the zoom button for
reticle_type = 1; // normal zoom
else if((activeweapon == WEP_NEX) && button_attack2)
reticle_type = 2; // nex zoom
-
+
if(reticle_type && autocvar_cl_reticle)
{
if(autocvar_cl_reticle_stretch)
old_bluralpha = 0;
}
- // edge detection postprocess handling done second (used by hud_powerup)
+ // edge detection postprocess handling done second (used by hud_powerup)
float sharpen_intensity = 0, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED);
if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
-
+
sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
-
+
if(autocvar_hud_powerup && sharpen_intensity > 0)
{
if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
{
if(time - hit_time < MAX_TIME_DIFF) // don't play the sound if it's too old.
sound(world, CH_INFO, "misc/hit.wav", VOL_BASE, ATTEN_NONE);
-
+
nextsound_hit_time = time + autocvar_cl_hitsound_antispam_time;
}
typehit_time = getstatf(STAT_TYPEHIT_TIME);
- if(typehit_time > nextsound_typehit_time)
+ if(typehit_time > nextsound_typehit_time)
{
if(time - typehit_time < MAX_TIME_DIFF) // don't play the sound if it's too old.
sound(world, CH_INFO, "misc/typehit.wav", VOL_BASE, ATTEN_NONE);
-
+
nextsound_typehit_time = time + autocvar_cl_hitsound_antispam_time;
}
CSQC_common_hud();
// crosshair goes VERY LAST
- if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL)
+ if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL)
{
if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
return;
-
+
string wcross_style;
float wcross_alpha, wcross_resolution;
wcross_style = autocvar_crosshair;
if(autocvar_crosshair_pickup)
{
float stat_pickup_time = getstatf(STAT_LAST_PICKUP);
-
+
if(pickup_crosshair_time < stat_pickup_time)
{
if(time - stat_pickup_time < MAX_TIME_DIFF) // don't trigger the animation if it's too old
pickup_crosshair_size = 1;
-
+
pickup_crosshair_time = stat_pickup_time;
}
if(autocvar_crosshair_hitindication)
{
vector hitindication_color = ((autocvar_crosshair_color_special == 1) ? stov(autocvar_crosshair_hitindication_per_weapon_color) : stov(autocvar_crosshair_hitindication_color));
-
+
if(hitindication_crosshair_time < hit_time)
{
if(time - hit_time < MAX_TIME_DIFF) // don't trigger the animation if it's too old
hitindication_crosshair_size = 1;
-
+
hitindication_crosshair_time = hit_time;
}
// handle the values
if (autocvar_crosshair_ring && activeweapon == WEP_NEX && nex_charge && autocvar_crosshair_ring_nex) // ring around crosshair representing velocity-dependent damage for the nex
{
- if (nex_chargepool || use_nex_chargepool) {
- use_nex_chargepool = 1;
+ if (nex_chargepool || use_nex_chargepool) {
+ use_nex_chargepool = 1;
ring_inner_value = nex_chargepool;
- } else {
+ } else {
nex_charge_movingavg = (1 - autocvar_crosshair_ring_nex_currentcharge_movingavg_rate) * nex_charge_movingavg + autocvar_crosshair_ring_nex_currentcharge_movingavg_rate * nex_charge;
- ring_inner_value = bound(0, autocvar_crosshair_ring_nex_currentcharge_scale * (nex_charge - nex_charge_movingavg), 1);
+ ring_inner_value = bound(0, autocvar_crosshair_ring_nex_currentcharge_scale * (nex_charge - nex_charge_movingavg), 1);
}
ring_inner_alpha = autocvar_crosshair_ring_nex_inner_alpha;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring_nexgun.tga";
}
- else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
+ else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
{
ring_value = bound(0, getstati(STAT_LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
ring_image = "gfx/crosshair_ring.tga";
}
- if(autocvar_crosshair_ring_reload && weapon_clipsize) // forces there to be only an ammo ring
+ if(autocvar_crosshair_ring_reload && weapon_clipsize) // forces there to be only an ammo ring
{
ring_value = bound(0, weapon_clipload / weapon_clipsize, 1);
ring_scale = autocvar_crosshair_ring_reload_size;
{
wcross_ring_prev = ((ring_image) ? TRUE : FALSE);
}
-
+
if(wcross_ring_prev)
{
if(f < 1)
{
vector wcross_color_old;
wcross_color_old = wcross_color;
-
+
if((autocvar_crosshair_dot_color_custom) && (autocvar_crosshair_dot_color != "0"))
wcross_color = stov(autocvar_crosshair_dot_color);
-
+
CROSSHAIR_DRAW(wcross_resolution * autocvar_crosshair_dot_size, "gfx/crosshairdot.tga", f * autocvar_crosshair_dot_alpha);
// FIXME why don't we use wcross_alpha here?cl_notice_run();
wcross_color = wcross_color_old;
if(autocvar__hud_configure)
HUD_Panel_Mouse();
-
+
if(hud && !intermission)
- {
+ {
if(hud == HUD_SPIDERBOT)
CSQC_SPIDER_HUD();
else if(hud == HUD_WAKIZASHI)
else if(hud == HUD_BUMBLEBEE_GUN)
CSQC_BUMBLE_GUN_HUD();
}
-
+
cl_notice_run();
-
+
// let's reset the view back to normal for the end
setproperty(VF_MIN, '0 0 0');
setproperty(VF_SIZE, '1 0 0' * w + '0 1 0' * h);
float announcer_1min;
float announcer_5min;
-void Announcer_Countdown()
+void Announcer_Countdown()
{
float starttime = getstatf(STAT_GAMESTARTTIME);
float roundstarttime = getstatf(STAT_ROUNDSTARTTIME);
if(countdown <= 0) // countdown has finished, starttime is now
{
- Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN);
- Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN);
+ Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN);
+ Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN);
remove(self);
return;
}
* and STAT_FRAGLIMIT to be auto-sent)
*/
float previous_game_starttime;
-void Announcer_Gamestart()
+void Announcer_Gamestart()
{
float startTime = getstatf(STAT_GAMESTARTTIME);
float roundstarttime = getstatf(STAT_ROUNDSTARTTIME);
if(roundstarttime > startTime)
startTime = roundstarttime;
- if(previous_game_starttime != startTime)
+ if(previous_game_starttime != startTime)
{
if((time + 5.0) < startTime) // if connecting to server while restart was active don't always play prepareforbattle
Local_Notification(MSG_ANNCE, ANNCE_PREPARE);
- if(time < startTime)
+ if(time < startTime)
{
entity e = find(world, classname, "announcer_countdown");
if (!e)
e.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime
}
}
-
+
previous_game_starttime = startTime;
}
// Plays the 1 minute or 5 minutes (of maptime) remaining sound, if client wants it
-void Announcer_Time()
+void Announcer_Time()
{
float timelimit = getstatf(STAT_TIMELIMIT);
float timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time);
float warmup_timeleft = 0;
-
- if(warmup_stage)
+
+ if(warmup_stage)
if(autocvar_g_warmup_limit > 0)
- warmup_timeleft = max(0, autocvar_g_warmup_limit + getstatf(STAT_GAMESTARTTIME) - time);
+ warmup_timeleft = max(0, autocvar_g_warmup_limit + getstatf(STAT_GAMESTARTTIME) - time);
// 5 minute check
- if(autocvar_cl_announcer_maptime >= 2)
+ if(autocvar_cl_announcer_maptime >= 2)
{
// make sure that after connect (and e.g. 4 minutes left) we will not get a wrong sound
if(announcer_5min)
{
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 300)
+ if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 300)
|| (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 300))
announcer_5min = FALSE;
}
- else
+ else
{
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 300 && timeleft > 299)
+ if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 300 && timeleft > 299)
|| (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 300 && warmup_timeleft > 299))
{
//if we're in warmup mode, check whether there's a warmup timelimit
{
if (announcer_1min)
{
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 60)
+ if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 60)
|| (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 60))
announcer_1min = FALSE;
}
- else if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 60)
+ else if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 60)
|| (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 60))
{
// if we're in warmup mode, check whether there's a warmup timelimit
float autocvar_hud_panel_weapons_timeout_effect;
float autocvar_hud_panel_weapons_timeout_fadebgmin;
float autocvar_hud_panel_weapons_timeout_fadefgmin;
-var float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
+var float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
var float autocvar_hud_panel_weapons_timeout_speed_out = 0.75;
float autocvar_hud_progressbar_alpha;
float autocvar_hud_showbinds;
// attack: from 0 to 1, in time a for a full length
// decay: from 1 to s, in time d
// sustain: s
-
+
if(t < 0)
return 0;
-
+
if(a)
if(t <= a)
return t / a;
if(!r)
return 0;
-
+
if(t > r)
return 0;
-
+
releaseval = s * (1 - t / r);
if(t < -d)
if(!s)
return 0;
-
+
// if amp > s, we may be in the attack or in the prolonged decay curve
releasetime = (1 - amp / s) * r;
if(e.bgmscript == "")
return 1;
-
+
if(autocvar_bgmvolume <= 0)
return -1;
blurtest_radius = stof(argv(2));
blurtest_power = stof(argv(3));
print("Enabled blurtest\n");
- return;
+ return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
float fh;
string filename = strcat(MapInfo_Map_bspname, "_scrshot_ent.txt");
fh = fopen(filename, FILE_WRITE);
-
+
if(fh >= 0)
{
fputs(fh, "{\n");
fputs(fh, strcat("\"origin\" \"", strcat(ftos(view_origin_x), " ", ftos(view_origin_y), " ", ftos(view_origin_z)), "\"\n"));
fputs(fh, strcat("\"angles\" \"", strcat(ftos(view_angles_x), " ", ftos(view_angles_y), " ", ftos(view_angles_z)), "\"\n"));
fputs(fh, "}\n");
-
+
print("Completed screenshot entity dump in ^2data/data/", MapInfo_Map_bspname, "_scrshot_ent.txt^7.\n");
-
+
fclose(fh);
}
else
}
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
string modelname = argv(1);
entity debugmodel_entity;
-
+
debugmodel_entity = spawn();
precache_model(modelname);
setmodel(debugmodel_entity, modelname);
debugmodel_entity.angles = view_angles;
debugmodel_entity.draw = DrawDebugModel;
debugmodel_entity.classname = "debugmodel";
-
- return;
+
+ return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
float vote_selection;
string vote_string;
-
+
if(InterpretBoolean(argv(1)))
{
- vote_selection = 2;
+ vote_selection = 2;
vote_string = "yes";
}
else
{
- vote_selection = 1;
- vote_string = "no";
+ vote_selection = 1;
+ vote_string = "no";
}
-
+
if(vote_selection)
{
if(uid2name_dialog) // handled by "uid2name" option
uid2name_dialog = 0;
}
else { localcmd(strcat("cmd vote ", vote_string, "\n")); }
-
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2handlevote^7\n");
case CMD_REQUEST_USAGE:
cvar_set("_hud_configure", ftos(!autocvar__hud_configure));
return;
}
-
+
case "save":
{
if(argv(2))
break; // go to usage, we're missing the paramater needed here.
}
}
-
+
case "scoreboard_columns_set":
{
- Cmd_HUD_SetFields(argc);
+ Cmd_HUD_SetFields(argc);
return;
}
Cmd_HUD_Help();
return;
}
-
+
case "radar":
{
if(argv(2))
}
}
}
-
+
default:
print("Incorrect parameters for ^2hud^7\n");
case CMD_REQUEST_USAGE:
if(argv(1))
{
centerprint_hud(argv(1));
- return;
+ return;
}
}
-
+
default:
print("Incorrect parameters for ^2localprint^7\n");
case CMD_REQUEST_USAGE:
if(argv(1))
{
Cmd_MapVote_MapDownload(argc);
- return;
+ return;
}
}
-
+
default:
print("Incorrect parameters for ^2mv_download^7\n");
case CMD_REQUEST_USAGE:
// W_FixWeaponOrder will trash argv, so save what we need.
string thiscvar = strzone(argv(1));
string s = cvar_string(thiscvar);
-
+
if(thiscvar == "cl_weaponpriority")
s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 1);
else if(substring(thiscvar, 0, 17) == "cl_weaponpriority" && strlen(thiscvar) == 18)
s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 0);
-
+
localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n");
strunzone(thiscvar);
- return;
+ return;
}
}
-
+
default:
print("Incorrect parameters for ^2sendcvar^7\n");
case CMD_REQUEST_USAGE:
{
case CMD_REQUEST_COMMAND:
{
-
- return;
+
+ return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
CLIENT_COMMAND("mv_download", LocalCommand_mv_download(request, arguments), "Retrieve mapshot picture from the server") \
CLIENT_COMMAND("sendcvar", LocalCommand_sendcvar(request, arguments), "Send a cvar to the server (like weaponpriority)") \
/* nothing */
-
+
void LocalCommand_macro_help()
{
#define CLIENT_COMMAND(name,function,description) \
{ if(strtolower(description) != "") { print(" ^2", name, "^7: ", description, "\n"); } }
-
+
CLIENT_COMMANDS(0, 0)
#undef CLIENT_COMMAND
-
+
return;
}
{
#define CLIENT_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
-
+
CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc)
#undef CLIENT_COMMAND
-
+
return FALSE;
}
{
#define CLIENT_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
-
+
CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc)
#undef CLIENT_COMMAND
-
+
return FALSE;
}
{
#define CLIENT_COMMAND(name,function,description) \
{ if(strtolower(description) != "") { CMD_Write_Alias("qc_cmd_cl", name, description); } }
-
+
CLIENT_COMMANDS(0, 0)
#undef CLIENT_COMMAND
-
+
return;
}
// Guide for working with argc arguments by example:
// argc: 1 - 2 - 3 - 4
- // argv: 0 - 1 - 2 - 3
+ // argv: 0 - 1 - 2 - 3
// cmd vote - master - login - password
- if(strtolower(argv(0)) == "help")
+ if(strtolower(argv(0)) == "help")
{
- if(argc == 1)
+ if(argc == 1)
{
print("\nClient console commands:\n");
LocalCommand_macro_help();
print("\nGeneric commands shared by all programs:\n");
GenericCommand_macro_help();
-
+
print("\nUsage:^3 cl_cmd COMMAND...^7, where possible commands are listed above.\n");
print("For help about a specific command, type cl_cmd help COMMAND\n");
-
+
return;
- }
+ }
else if(GenericCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it
{
return;
{
return;
}
- }
- else if(GenericCommand(command))
+ }
+ else if(GenericCommand(command))
{
return; // handled by common/command/generic.qc
}
{
return; // handled by one of the above LocalCommand_* functions
}
-
+
// nothing above caught the command, must be invalid
print(((command != "") ? strcat("Unknown client command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try cl_cmd help.\n");
-
+
return;
}
CONSOLE_COMMAND("+showaccuracy", { scoreboard_showaccuracy = TRUE; }) \
CONSOLE_COMMAND("-showaccuracy", { scoreboard_showaccuracy = FALSE; }) \
/* nothing */
-
+
#define CONSOLE_COMMANDS_MOVEMENT \
CONSOLE_COMMAND("+forward", { ++camera_direction_x; }) \
CONSOLE_COMMAND("-forward", { --camera_direction_x; }) \
CONSOLE_COMMANDS_NORMAL
#undef CONSOLE_COMMAND
-
+
// then init movement commands
#ifndef CAMERATEST
if(isdemo())
#ifndef CAMERATEST
}
#endif
-
+
return;
}
{
#define CONSOLE_COMMAND(name,execution) \
{ if(name == strtolower(argv(0))) { { execution } return TRUE; } }
-
+
CONSOLE_COMMANDS_NORMAL
#undef CONSOLE_COMMAND
-
+
return FALSE;
}
CONSOLE_COMMANDS_MOVEMENT
#undef CONSOLE_COMMAND
}
-
+
return FALSE;
}
{
return TRUE;
}
-
+
// Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
return FALSE;
const float VF_CL_VIEWANGLES = 33; //(vector)
const float VF_CL_VIEWANGLES_X = 34; //(float)
const float VF_CL_VIEWANGLES_Y = 35; //(float)
-const float VF_CL_VIEWANGLES_Z = 36; //(float)
+const float VF_CL_VIEWANGLES_Z = 36; //(float)
// Server Autosent Stat Constants
const float STAT_HEALTH = 0;
float forceplayermodels_goodmodelindex;
.vector glowmod;
-.vector old_glowmod;
+.vector old_glowmod;
void CSQCPlayer_ModelAppearance_PreUpdate(void)
{
// Fade out to black now...
if(self.old_glowmod == '0 0 0') { self.old_glowmod = self.glowmod; }
self.colormap = 0;
-
+
self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
self.glowmod_x = max(self.glowmod_x, 0.0001);
self.glowmod_y = max(self.glowmod_y, 0.0001);
self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
self.effects = 0;
self.traileffect = 0;
-
+
if(eff & EF_BRIGHTFIELD)
self.traileffect = particleeffectnum("TR_NEXUIZPLASMA");
// ignoring EF_MUZZLEFLASH
e = get_weaponinfo(type);
effectname = strcat("damage_", e.netname);
-
+
// if damage was dealt with a bullet weapon, our effect is blood
// since blood is species dependent, include the species tag
if(type == WEP_SHOTGUN || type == WEP_UZI || type == WEP_RIFLE)
}
else
forcemul = 1;
-
+
for(self = findradius(w_org, rad + MAX_DAMAGEEXTRARADIUS); self; self = self.chain)
{
// attached ents suck
}
self = oldself;
-
+
if(DEATH_ISVEHICLE(w_deathtype))
{
traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world);
w_backoff = trace_plane_normal;
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
-
+
setorigin(self, w_org + w_backoff * 2); // for sound() calls
-
+
switch(w_deathtype)
{
case DEATH_VH_CRUSH:
break;
-
+
// spiderbot
case DEATH_VH_SPID_MINIGUN:
string _snd;
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_MIN);
pointparticles(particleeffectnum("explosion_big"), self.origin, w_backoff * 1000, 1);
break;
-
+
case DEATH_VH_WAKI_GUN:
sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum("wakizashi_gun_impact"), self.origin, w_backoff * 1000, 1);
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_MIN);
pointparticles(particleeffectnum("explosion_big"), self.origin, w_backoff * 1000, 1);
break;
-
+
case DEATH_VH_RAPT_CANNON:
sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum("raptor_cannon_impact"), self.origin, w_backoff * 1000, 1);
break;
}
}
-
-
+
+
if(DEATH_ISTURRET(w_deathtype))
{
string _snd;
w_backoff = trace_plane_normal;
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
-
+
setorigin(self, w_org + w_backoff * 2); // for sound() calls
-
+
switch(w_deathtype)
- {
+ {
case DEATH_TURRET_EWHEEL:
sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTEN_MIN);
pointparticles(particleeffectnum("laser_impact"), self.origin, w_backoff * 1000, 1);
break;
-
+
case DEATH_TURRET_FLAC:
pointparticles(particleeffectnum("hagar_explode"), w_org, '0 0 0', 1);
_snd = strcat("weapons/hagexp", ftos(1 + rint(random() * 2)), ".waw");
sound(self, CH_SHOTS, _snd, VOL_BASE, ATTEN_NORM);
break;
-
+
case DEATH_TURRET_MLRS:
case DEATH_TURRET_HK:
case DEATH_TURRET_WALK_ROCKET:
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_MIN);
pointparticles(particleeffectnum("rocket_explode"), self.origin, w_backoff * 1000, 1);
break;
-
+
case DEATH_TURRET_MACHINEGUN:
case DEATH_TURRET_WALK_GUN:
_snd = strcat("weapons/ric", ftos(1 + rint(random() * 2)), ".waw");
sound(self, CH_SHOTS, _snd, VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum("machinegun_impact"), self.origin, w_backoff * 1000, 1);
break;
-
+
case DEATH_TURRET_PLASMA:
sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTEN_MIN);
pointparticles(particleeffectnum("electro_impact"), self.origin, w_backoff * 1000, 1);
break;
-
+
case DEATH_TURRET_WALK_MEELE:
sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTEN_MIN);
pointparticles(particleeffectnum("TE_SPARK"), self.origin, w_backoff * 1000, 1);
case DEATH_TURRET_PHASER:
break;
-
+
case DEATH_TURRET_TESLA:
te_smallflash(self.origin);
break;
}
}
-
+
// TODO spawn particle effects and sounds based on w_deathtype
if(!DEATH_ISSPECIAL(w_deathtype))
if(!hitplayer || rad) // don't show ground impacts for hitscan weapons if a player was hit
{
if(cl_gentle_gibs == 2)
gentle_prefix = "";
- else if(cl_gentle_gibs == 3)
+ else if(cl_gentle_gibs == 3)
gentle_prefix = "happy_";
}
else if(autocvar_cl_particlegibs)
{
// I want to draw a quad...
// from and to are MIDPOINTS.
-
+
vector axis, thickdir, A, B, C, D;
float length_tex;
continue;
// figure out the drawing position of weapon
- weapon_pos = (panel_pos
- + eX * column * weapon_size_x
+ weapon_pos = (panel_pos
+ + eX * column * weapon_size_x
+ eY * row * weapon_size_y);
// draw background behind currently selected weapon
{
float BLINK_FACTOR = 0.15;
float BLINK_BASE = 0.85;
- float BLINK_FREQ = 9;
+ float BLINK_FREQ = 9;
pain_health_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
}
}
float entries, height;
entries = bound(1, floor(KN_MAX_ENTRIES * mySize_y/mySize_x), KN_MAX_ENTRIES);
height = mySize_y/entries;
-
+
vector fontsize;
float fontheight = height * autocvar_hud_panel_notify_fontsize;
fontsize = '0.5 0.5 0' * fontheight;
{
break;
}
-
+
attacker = notify_attackers[j];
victim = notify_victims[j];
icon = notify_icon[j];
panel_size_y = bound(0.2, panel_size_y, 1) * vid_conheight;
panel_pos_x = (vid_conwidth - panel_size_x) / 2;
panel_pos_y = (vid_conheight - panel_size_y) / 2;
-
+
panel_bg = strcat(hud_skin_path, "/border_default"); // always use the default border when maximized
if(precache_pic(panel_bg) == "") { panel_bg = "gfx/hud/default/border_default"; } // fallback
-
+
switch(hud_panel_radar_maximized_zoommode)
{
default:
f = 1;
break;
}
-
+
switch(hud_panel_radar_maximized_rotation)
{
case 0:
f = 1;
break;
}
-
+
switch(hud_panel_radar_rotation)
{
case 0:
score = tm.(teamscores[ts_primary]);
if(autocvar__hud_configure)
score = 123;
-
+
if (score > max_fragcount)
max_fragcount = score;
stat_items = getstati(STAT_ITEMS, 0, 24);
redflag = (stat_items/IT_RED_FLAG_TAKEN) & 3;
blueflag = (stat_items/IT_BLUE_FLAG_TAKEN) & 3;
-
+
if(redflag || blueflag)
mod_active = 1;
else
float kaball_prevstatus; // last remembered status
float kaball_statuschange_time; // time when the status changed
-// we don't need to reset for keepaway since it immediately
+// we don't need to reset for keepaway since it immediately
// autocorrects prevstatus as to if the player has the ball or not
void HUD_Mod_Keepaway(vector pos, vector mySize)
{
mod_active = 1; // keepaway should always show the mod HUD
-
+
float BLINK_FACTOR = 0.15;
float BLINK_BASE = 0.85;
- float BLINK_FREQ = 5;
+ float BLINK_FREQ = 5;
float kaball_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
-
+
float stat_items = getstati(STAT_ITEMS, 0, 24);
float kaball = (stat_items/IT_KEY1) & 1;
-
+
if(kaball != kaball_prevstatus)
{
kaball_statuschange_time = time;
kaball_prevstatus = kaball;
}
-
+
vector kaball_pos, kaball_size;
-
+
if(mySize_x > mySize_y) {
kaball_pos = pos + eX * 0.25 * mySize_x;
kaball_size = eX * 0.5 * mySize_x + eY * mySize_y;
kaball_pos = pos + eY * 0.25 * mySize_y;
kaball_size = eY * 0.5 * mySize_y + eX * mySize_x;
}
-
+
float kaball_statuschange_elapsedtime = time - kaball_statuschange_time;
float f = bound(0, kaball_statuschange_elapsedtime*2, 1);
-
+
if(kaball_prevstatus && f < 1)
drawpic_aspect_skin_expanding(kaball_pos, "keepawayball_carrying", kaball_size, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f);
-
+
if(kaball)
drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
}
frametimeavg = (frametimeavg + frametimeavg1 + frametimeavg2 + currentframetime)/4; // average three frametimes into framecounter for slightly more stable fps readings :P
frametimeavg2 = frametimeavg1;
frametimeavg1 = frametimeavg;
-
+
float weight;
weight = cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight");
if(currentframetime > 0.0001) // filter out insane values which sometimes seem to occur and throw off the average? If you are getting 10,000 fps or more, then you don't need a framerate counter.
vector fontsize;
fontsize = '0.20 0.20 0' * mySize_y;
-
+
float a;
a = panel_fg_alpha;
}
}
}
- else
+ else
{
s = _("^7Press ^3ESC ^7to show HUD options.");
drawInfoMessage(s)
conversion_factor = 0.0254 * 1.943844492; // 1 m/s = 1.943844492 knots, because 1 knot = 1.852 km/h
break;
}
-
+
vector vel = (csqcplayer ? csqcplayer.velocity : pmove_vel);
float max_speed = floor( autocvar_hud_panel_physics_speed_max * conversion_factor + 0.5 );
acceleration = (vlen(vel) - vlen(acc_prevspeed));
else
acceleration = (vlen(vel - '0 0 1' * vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z));
-
+
acceleration = acceleration * (1 / max(0.0001, f)) * (0.0254 / 9.80665);
-
+
acc_prevspeed = vel;
acc_prevtime = time;
if (scoreboard_bottom >= 0.96 * vid_conheight)
return;
vector target_pos;
-
+
target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size_x);
-
+
if(target_pos_y > panel_pos_y)
{
panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
}
- // fade the centerprint_hud in/out
+ // fade the centerprint_hud in/out
if(centerprint_time[j] < 0)
a = bound(0, (time - centerprint_expire_time[j]) / max(0.0001, autocvar_hud_panel_centerprint_fade_in), 1);
else if(centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time)
a = (centerprint_expire_time[j] - time) / max(0.0001, autocvar_hud_panel_centerprint_fade_out);
else
a = 0;
-
+
// set the size from fading in/out before subsequent fading
- sz = autocvar_hud_panel_centerprint_fade_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_minfontsize);
-
+ sz = autocvar_hud_panel_centerprint_fade_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_minfontsize);
+
// also fade it based on positioning
if(autocvar_hud_panel_centerprint_fade_subsequent)
{
a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha, (1 - (g / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passone))), 1); // pass one: all messages after the first have half theAlpha
a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha, (1 - (g / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passtwo))), 1); // pass two: after that, gradually lower theAlpha even more for each message
}
-
+
// finally set the size based on the new theAlpha from subsequent fading
- sz = sz * (autocvar_hud_panel_centerprint_fade_subsequent_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_subsequent_minfontsize));
+ sz = sz * (autocvar_hud_panel_centerprint_fade_subsequent_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_subsequent_minfontsize));
drawfontscale = sz * '1 1 0';
-
+
if (centerprint_countdown_num[j])
n = tokenizebyseparator(strreplace("^COUNT", count_seconds(centerprint_countdown_num[j]), centerprint_messages[j]), "\n");
else
}
}
- ++g; // move next position number up
-
+ ++g; // move next position number up
+
msg_size = pos_y - msg_size;
if (autocvar_hud_panel_centerprint_flip)
{
pos_y = current_msg_pos_y - CENTERPRINT_SPACING * fontsize_y;
if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
pos_y += (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
-
+
if (pos_y < panel_pos_y) // check if the next message can be shown
{
drawfontscale = '1 1 0';
pos_y += CENTERPRINT_SPACING * fontsize_y;
if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
pos_y -= (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
-
+
if(pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next message can be shown
{
drawfontscale = '1 1 0';
HUD_Write_PanelCvar_q("_maximized_scale");
HUD_Write_PanelCvar_q("_maximized_size");
HUD_Write_PanelCvar_q("_maximized_rotation");
- HUD_Write_PanelCvar_q("_maximized_zoommode");
+ HUD_Write_PanelCvar_q("_maximized_zoommode");
break;
case HUD_PANEL_SCORE:
HUD_Write_PanelCvar_q("_rankings");
}
// now save the new top id
panel_order[0] = id;
-
+
// let's save them into the cvar by some strcat trickery
string s = "";
for(i = 0; i < HUD_PANEL_NUM; ++i)
if (!autocvar_hud_cursormode)
{
mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
-
+
mousepos_x = bound(0, mousepos_x, vid_conwidth);
mousepos_y = bound(0, mousepos_y, vid_conheight);
}
vector rgb;
string label;
float text_size;
-
+
isize -= hud_fontsize_y; // respect the text when calculating the image size
rgb = MapVote_RGB(id, count);
-
+
img_size_y = isize;
img_size_x = isize / 0.75; // 4:3 x can be stretched easily, height is defined in isize
pos_y = pos_y + img_size_y;
-
+
label = MapVote_FormatMapItem(id, map, count, tsize, hud_fontsize);
text_size = stringwidth(label, false, hud_fontsize);
pos_x -= text_size*0.5;
drawstring(pos, label, hud_fontsize, rgb, theAlpha, DRAWFLAG_NORMAL);
-
+
pos_x = pos_x + text_size*0.5 - img_size_x*0.5;
pos_y = pos_y - img_size_y;
vector rgb;
float text_size;
string label;
-
+
rgb = MapVote_RGB(id, count);
pos_y = pos_y + hud_fontsize_y;
-
+
label = MapVote_FormatMapItem(id, _("Don't care"), count, tsize, hud_fontsize);
text_size = stringwidth(label, false, hud_fontsize);
-
+
pos_x -= text_size*0.5;
drawstring(pos, label, hud_fontsize, rgb, 1, DRAWFLAG_NORMAL);
}
if (!autocvar_hud_cursormode)
{
mv_mousepos = mv_mousepos + getmousepos();
-
+
mv_mousepos_x = bound(0, mv_mousepos_x, vid_conwidth);
mv_mousepos_y = bound(0, mv_mousepos_y, vid_conheight);
}
print(_("mv_mapdownload: ^3You're not supposed to use this command on your own!\n"));
return;
}
-
+
id = stof(argv(1));
for(pak = mv_pk3list; pak; pak = pak.chain)
if(pak.sv_entnum == id)
break;
-
+
if(!pak || pak.sv_entnum != id) {
print(_("^1Error:^7 Couldn't find pak index.\n"));
return;
pak.netname = pk3;
pak.message = pic;
pak.sv_entnum = id;
-
+
pak.chain = mv_pk3list;
mv_pk3list = pak;
-
+
if(pk3 != "")
{
localcmd(strcat("\ncurl --pak ", pk3, "; wait; cl_cmd mv_download ", ftos(id), "\n"));
mv_maps_mask = ReadByte();
else
mv_maps_mask = ReadShort();
-
+
// Assume mv_pk3list is world, there should only be 1 mapvote per round
mv_pk3list = world; // I'm still paranoid!
-
+
for(i = 0, power = 1; i < mv_num_maps; ++i, power *= 2)
{
mv_votes[i] = 0;
map = strzone(ReadString());
pk3 = strzone(ReadString());
j = bound(0, ReadByte(), n_ssdirs - 1);
-
+
mv_maps[i] = map;
mv_pk3[i] = pk3;
map = strzone(strcat(ssdirs[j], "/", map));
float getplayerisdead(float pl)
{
entity e;
-
+
e = CSQCModel_server2csqc(pl + 1);
if(e)
return e.csqcmodel_isdead;
-
+
return FALSE;
}
vector org;
float cont;
org = self.move_origin + ofs;
-
+
cont = self.dphitcontentsmask;
self.dphitcontentsmask = DPCONTENTS_SOLID;
tracebox(self.move_origin, self.mins, self.maxs, self.move_origin, MOVE_NOMONSTERS, self);
_Movetype_PushEntity(move, TRUE);
if(wasfreed(self))
return;
-
+
if(trace_startsolid)
{
_Movetype_UnstickEntity();
shotorg_x = ReadCoord(); shotorg_y = ReadCoord(); shotorg_z = ReadCoord();
endpos_x = ReadCoord(); endpos_y = ReadCoord(); endpos_z = ReadCoord();
charge = ReadByte() / 255.0;
-
+
pointparticles(particleeffectnum("nex_muzzleflash"), shotorg, normalize(endpos - shotorg) * 1000, 1);
-
+
//draw either the old v2.3 beam or the new beam
charge = sqrt(charge); // divide evenly among trail spacing and alpha
particles_alphamin = particles_alphamax = particles_fade = charge;
case PROJECTILE_NADE_PINK:
case PROJECTILE_NADE_BURN:
case PROJECTILE_NADE:
- rot = self.avelocity;
+ rot = self.avelocity;
break;
case PROJECTILE_HOOKBOMB:
rot = '1000 0 0'; // forward
case PROJECTILE_BUMBLE_GUN: setmodel(self, "models/elaser.mdl");self.traileffect = particleeffectnum("TR_NEXUIZPLASMA"); break;
case PROJECTILE_BUMBLE_BEAM: setmodel(self, "models/elaser.mdl");self.traileffect = particleeffectnum("TR_NEXUIZPLASMA"); break;
-
+
case PROJECTILE_NADE_RED: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_red"); break;
case PROJECTILE_NADE_RED_BURN: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_red_burn"); break;
case PROJECTILE_NADE_BLUE: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_blue"); break;
break;
case PROJECTILE_WAKIROCKET:
loopsound(self, CH_SHOTS_SINGLE, "weapons/tag_rocket_fly.wav", VOL_BASE, ATTEN_NORM);
- break;
+ break;
/*
case PROJECTILE_WAKICANNON:
break;
precache_model("models/rocket.md3");
precache_model("models/tagrocket.md3");
precache_model("models/tracer.mdl");
-
+
precache_model("models/weapons/v_ok_grenade.md3");
precache_sound("weapons/electro_fly.wav");
} else
str = sprintf("%.1f", num/denom);
return str;
-
+
case SP_SUM:
f = pl.(scores[SP_KILLS]);
f -= pl.(scores[SP_DEATHS]);
drawstring(pos, value, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
pos_x = px;
pos_y+= hud_fontsize_y;
-
+
return pos;
}
// draw table header
drawstring(pos, _("Map stats:"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness;
-
- // draw table
+
+ // draw table
vector tmp = '0 0 0';
tmp_x = sbwidth;
tmp_y = hud_fontsize_y * rows;
// draw secrets
val = sprintf("%d/%d", stat_secrets_found, stat_secrets_total);
pos = HUD_DrawKeyValue(pos, _("Secrets found:"), val);
-
+
// update position
pos_y += 1.25 * hud_fontsize_y;
return pos;
pos = HUD_DrawScoreboardAccuracyStats(pos, rgb, bg_size);
}
-
+
if(teamplay)
pos = HUD_DrawMapStats(pos, Team_ColorRGB(myteam), bg_size);
else
str = strcat(str, _(" or"));
if(teamplay)
{
- str = strcat(str, sprintf(_(" until ^3%s %s^7"), ScoreString(teamscores_flags[ts_primary], fl),
+ str = strcat(str, sprintf(_(" until ^3%s %s^7"), ScoreString(teamscores_flags[ts_primary], fl),
(teamscores_label[ts_primary] == "score") ? CTX(_("SCO^points")) :
(teamscores_label[ts_primary] == "fastest") ? CTX(_("SCO^is beaten")) :
TranslateScoresLabel(teamscores_label[ts_primary])));
}
else
{
- str = strcat(str, sprintf(_(" until ^3%s %s^7"), ScoreString(scores_flags[ps_primary], fl),
+ str = strcat(str, sprintf(_(" until ^3%s %s^7"), ScoreString(scores_flags[ps_primary], fl),
(scores_label[ps_primary] == "score") ? CTX(_("SCO^points")) :
(scores_label[ps_primary] == "fastest") ? CTX(_("SCO^is beaten")) :
TranslateScoresLabel(scores_label[ps_primary])));
str = strcat(str, _(" or"));
if(teamplay)
{
- str = strcat(str, sprintf(_(" until a lead of ^3%s %s^7"), ScoreString(teamscores_flags[ts_primary], ll),
+ str = strcat(str, sprintf(_(" until a lead of ^3%s %s^7"), ScoreString(teamscores_flags[ts_primary], ll),
(teamscores_label[ts_primary] == "score") ? CTX(_("SCO^points")) :
(teamscores_label[ts_primary] == "fastest") ? CTX(_("SCO^is beaten")) :
TranslateScoresLabel(teamscores_label[ts_primary])));
}
else
{
- str = strcat(str, sprintf(_(" until a lead of ^3%s %s^7"), ScoreString(scores_flags[ps_primary], ll),
+ str = strcat(str, sprintf(_(" until a lead of ^3%s %s^7"), ScoreString(scores_flags[ps_primary], ll),
(scores_label[ps_primary] == "score") ? CTX(_("SCO^points")) :
(scores_label[ps_primary] == "fastest") ? CTX(_("SCO^is beaten")) :
TranslateScoresLabel(scores_label[ps_primary])));
// a negative number means we are awaiting respawn, time value is still the same
respawn_time *= -1; // remove mark now that we checked it
respawn_time = max(time, respawn_time); // don't show a negative value while the server is respawning the player (lag)
-
+
str = sprintf(_("^1Respawning in ^3%s^1..."),
(autocvar_scoreboard_respawntime_decimals ?
count_seconds_decs(respawn_time - time, autocvar_scoreboard_respawntime_decimals)
{
if(!autocvar_hud_shownames)
return;
-
+
#ifdef COMPAT_XON050_ENGINE
if((ent.sv_entnum == player_localentnum) || (ent.sv_entnum == spectatee_status)) // ent is me or person i'm spectating
#else
if(ent.sameteam || (!ent.sameteam && autocvar_hud_shownames_enemies))
{
ent.origin_z += autocvar_hud_shownames_offset;
-
+
float hit;
if(ent.sameteam && !autocvar_hud_shownames_crosshairdistance)
{
// handle tag fading
float overlap = FALSE, onscreen, crosshairdistance;
vector o, eo;
-
+
o = project_3d_to_2d(ent.origin);
-
+
if(autocvar_hud_shownames_antioverlap)
{
// fade tag out if another tag that is closer to you overlaps
onscreen = (o_z >= 0 && o_x >= 0 && o_y >= 0 && o_x <= vid_conwidth && o_y <= vid_conheight);
crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
-
+
if(autocvar_hud_shownames_crosshairdistance)
{
if(autocvar_hud_shownames_crosshairdistance > crosshairdistance)
ent.pointtime = time;
-
+
if (!(ent.pointtime + autocvar_hud_shownames_crosshairdistance_time > time))
overlap = TRUE;
else
overlap = (autocvar_hud_shownames_crosshairdistance_antioverlap ? overlap : FALSE); // override what antioverlap says unless allowed by cvar.
}
-
+
if(!ent.fadedelay)
ent.fadedelay = time + SHOWNAMES_FADEDELAY;
if(!ent.sameteam && (!onscreen || !hit)) // out of view, fade out
- {
- ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
+ {
+ ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
ent.fadedelay = 0; // reset fade in delay, enemy has left the view
}
else if(ent.csqcmodel_isdead) // dead player, fade out slowly
- ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime);
+ ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime);
else if(overlap) // tag overlap detected, fade out
- ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
+ ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
else if(ent.sameteam) // fade in for team mates
ent.alpha = min(1, ent.alpha + SHOWNAMES_FADESPEED * frametime);
else if(time > ent.fadedelay) // fade in for enemies
if(!ent.alpha)
return;
-
+
float dist;
dist = vlen(ent.origin - view_origin);
setorigin(e, getplayerorigin(i));
if(e.origin == GETPLAYERORIGIN_ERROR)
continue;
-
+
e.csqcmodel_isdead = getplayerisdead(i);
Draw_ShowNames(e);
}
void turret_precache(float _tid)
-{
+{
if (!turret_is_precache[TID_COMMON])
{
precache_sound ("weapons/rocket_impact.wav");
{
case TID_EWHEEL:
precache_model ("models/turrets/ewheel-base2.md3");
- precache_model ("models/turrets/ewheel-gun1.md3");
+ precache_model ("models/turrets/ewheel-gun1.md3");
break;
case TID_FLAC:
precache_model ("models/turrets/flac.md3");
break;
case TID_FUSION:
- precache_model ("models/turrets/reactor.md3");
+ precache_model ("models/turrets/reactor.md3");
break;
case TID_HELLION:
precache_model ("models/turrets/hellion.md3");
precache_model ("models/turrets/walker_body.md3");
precache_sound ("weapons/uzi_fire.wav");
break;
- }
+ }
turret_is_precache[_tid] = TRUE;
}
tid2info_min = '-70 -70 0';
tid2info_max = '70 70 95';
break;
- }
+ }
}
void turret_remove()
-{
+{
remove(self.tur_head);
//remove(self.enemy);
- self.tur_head = world;
+ self.tur_head = world;
}
.vector glowmod;
void turret_changeteam()
-{
+{
switch(self.team - 1)
{
case NUM_TEAM_1: // Red
self.teamradar_color = '1 0 1';
break;
}
-
+
if(self.team)
self.colormap = 1024 + (self.team - 1) * 17;
-
+
self.tur_head.colormap = self.colormap;
self.tur_head.glowmod = self.glowmod;
-
+
}
void turret_head_draw()
-{
+{
self.drawmask = MASK_NORMAL;
}
void turret_draw()
-{
+{
float dt;
dt = time - self.move_time;
self.move_time = time;
if(dt <= 0)
return;
-
+
self.tur_head.angles += dt * self.tur_head.move_avelocity;
if (self.health < 127)
{
dt = random();
-
+
if(dt < 0.03)
- te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
+ te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
}
-
+
if(self.health < 85)
if(dt < 0.01)
pointparticles(particleeffectnum("smoke_large"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
-
+
if(self.health < 32)
if(dt < 0.015)
- pointparticles(particleeffectnum("smoke_small"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
+ pointparticles(particleeffectnum("smoke_small"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
}
{
if(self.netname == "")
return;
-
+
if(!autocvar_g_waypointsprite_turrets)
return;
-
+
if(autocvar_cl_hidewaypoints)
- return;
+ return;
float dist = vlen(self.origin - view_origin);
- float t = (GetPlayerColor(player_localnum) + 1);
+ float t = (GetPlayerColor(player_localnum) + 1);
vector o;
string txt;
-
+
if(autocvar_cl_vehicles_hud_tactical)
if(dist < 10240 && t != self.team)
{
// TODO: Vehicle tactical hud
o = project_3d_to_2d(self.origin + '0 0 32');
- if(o_z < 0
- || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
- || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
- || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
+ if(o_z < 0
+ || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
+ || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
+ || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
|| o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
return; // Dont draw wp's for turrets out of view
o_z = 0;
if(hud != HUD_NORMAL)
- {
+ {
switch(hud)
{
case HUD_SPIDERBOT:
txt = "gfx/vehicles/vth-mover.tga";
else
txt = "gfx/vehicles/vth-stationary.tga";
-
+
vector pz = drawgetimagesize(txt) * 0.25;
drawpic(o - pz * 0.5, txt, pz , '1 1 1', 0.75, DRAWFLAG_NORMAL);
break;
}
}
}
-
+
if(dist > self.maxdistance)
return;
float a = self.alpha * autocvar_hud_panel_fg_alpha;
vector rgb = spritelookupcolor(spriteimage, self.teamradar_color);
-
+
if(self.maxdistance > waypointsprite_normdistance)
a *= pow(bound(0, (self.maxdistance - dist) / (self.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent);
else if(self.maxdistance > 0)
if(rgb == '0 0 0')
{
self.teamradar_color = '1 0 1';
- print(sprintf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage));
+ print(sprintf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage));
}
txt = self.netname;
txt = _("Spam");
else
txt = spritelookuptext(spriteimage);
-
+
if(time - floor(time) > 0.5 && t == self.team)
{
if(self.helpme && time < self.helpme)
{
a *= SPRITE_HELPME_BLINK;
txt = sprintf(_("%s under attack!"), txt);
- }
+ }
else
a *= spritelookupblinkvalue(spriteimage);
}
-
+
if(autocvar_g_waypointsprite_uppercase)
txt = strtoupper(txt);
if(a <= 0)
return;
-
+
rgb = fixrgbexcess(rgb);
o = project_3d_to_2d(self.origin + '0 0 64');
- if(o_z < 0
- || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
- || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
- || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
+ if(o_z < 0
+ || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
+ || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
+ || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
|| o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
return; // Dont draw wp's for turrets out of view
o_z = 0;
float edgedistance_min, crosshairdistance;
- edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)),
+ edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)),
(o_x - (vid_conwidth * waypointsprite_edgeoffset_left)),
- (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
+ (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
(vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y);
float vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
t = t * (1 - (1 - waypointsprite_crosshairfadescale) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
}
- o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
+ o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
o = drawspritetext(o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
drawhealthbar(
o,
}
void turret_walker_draw()
-{
+{
float dt;
-
+
dt = time - self.move_time;
self.move_time = time;
if(dt <= 0)
return;
-
+
fixedmakevectors(self.angles);
movelib_groundalign4point(300, 100, 0.25, 45);
setorigin(self, self.origin + self.velocity * dt);
self.tur_head.angles += dt * self.tur_head.move_avelocity;
self.angles_y = self.move_angles_y;
-
+
if (self.health < 127)
if(random() < 0.15)
- te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
+ te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
}
void turret_ewheel_draw()
-{
+{
float dt;
-
+
dt = time - self.move_time;
self.move_time = time;
if(dt <= 0)
return;
-
- fixedmakevectors(self.angles);
+
+ fixedmakevectors(self.angles);
setorigin(self, self.origin + self.velocity * dt);
self.tur_head.angles += dt * self.tur_head.move_avelocity;
self.angles_y = self.move_angles_y;
-
+
if (self.health < 127)
if(random() < 0.05)
- te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
+ te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
}
void(entity e, entity tagentity, string tagname) setattachment = #443;
void turret_construct()
-{
+{
if(self.tur_head == world)
self.tur_head = spawn();
-
+
turret_tid2info(self.turret_type);
self.netname = tid2info_name;
setmodel(self.tur_head, tid2info_head);
setsize(self, tid2info_min, tid2info_max);
setsize(self.tur_head, '0 0 0', '0 0 0');
-
+
if(self.turret_type == TID_EWHEEL)
setattachment(self.tur_head, self, "");
else
setattachment(self.tur_head, self, "tag_head");
-
+
self.tur_head.classname = "turret_head";
self.tur_head.owner = self;
self.tur_head.move_movetype = MOVETYPE_NOCLIP;
self.solid = SOLID_BBOX;
self.tur_head.solid = SOLID_NOT;
self.movetype = MOVETYPE_NOCLIP;
- self.tur_head.movetype = MOVETYPE_NOCLIP;
+ self.tur_head.movetype = MOVETYPE_NOCLIP;
self.draw = turret_draw;
self.entremove = turret_remove;
self.drawmask = MASK_NORMAL;
self.tur_head.drawmask = MASK_NORMAL;
- self.anim_start_time = 0;
+ self.anim_start_time = 0;
self.draw2d = turret_draw2d;
self.maxdistance = autocvar_g_waypointsprite_turrets_maxdist;
self.teamradar_color = '1 0 0';
self.alpha = 1;
-
+
if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
{
self.gravity = 1;
self.movetype = MOVETYPE_BOUNCE;
self.move_movetype = MOVETYPE_BOUNCE;
- self.move_origin = self.origin;
- self.move_time = time;
+ self.move_origin = self.origin;
+ self.move_time = time;
switch(self.turret_type)
{
case TID_EWHEEL:
case TID_WALKER:
self.draw = turret_walker_draw;
break;
-
- }
+
+ }
}
}
void turret_gib_draw()
{
Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
-
+
self.drawmask = MASK_NORMAL;
-
+
if(self.cnt)
{
if(time >= self.nextthink)
{
self.alpha = bound(0, self.nextthink - time, 1);
if(self.alpha < ALPHA_MIN_VISIBLE)
- remove(self);
+ remove(self);
}
}
void turret_gibboom()
{
float i;
-
+
sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
{
entity gib;
-
+
traceline(_from, _to, MOVE_NOMONSTERS, world);
if(trace_startsolid)
return world;
-
+
gib = spawn();
setorigin(gib, _from);
setmodel(gib, _model);
gib.colormod = _cmod;
gib.solid = SOLID_CORPSE;
- gib.draw = turret_gib_draw;
+ gib.draw = turret_gib_draw;
gib.cnt = _explode;
setsize(gib, '-1 -1 -1', '1 1 1');
if(_explode)
{
gib.nextthink = time + 0.2 * (autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15));
gib.effects = EF_FLAME;
- }
+ }
else
gib.nextthink = time + autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15);
-
+
gib.gravity = 1;
gib.move_movetype = MOVETYPE_BOUNCE;
gib.move_origin = _from;
setorigin(gib, _from);
- gib.move_velocity = _to;
+ gib.move_velocity = _to;
gib.move_avelocity = prandomvec() * 32;
gib.move_time = time;
gib.damageforcescale = 1;
gib.classname = "turret_gib";
-
+
return gib;
}
void turret_die()
-{
-
+{
+
sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
turret_tid2info(self.turret_type);
else if (self.turret_type == TID_TESLA)
turret_gibtoss(tid2info_base, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', FALSE);
else
- {
+ {
if (random() > 0.5)
- {
+ {
turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
headgib.angles = headgib.move_angles = self.tur_head.angles;
headgib.avelocity = headgib.move_avelocity = self.tur_head.move_avelocity + randomvec() * 45;
headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity_y * 5;
- headgib.gravity = 0.5;
+ headgib.gravity = 0.5;
}
}
}
-
+
setmodel(self, "null");
setmodel(self.tur_head, "null");
}
sf = ReadByte();
if(sf & TNSF_SETUP)
- {
+ {
self.turret_type = ReadByte();
-
+
self.origin_x = ReadCoord();
self.origin_y = ReadCoord();
self.origin_z = ReadCoord();
setorigin(self, self.origin);
-
+
self.angles_x = ReadAngle();
self.angles_y = ReadAngle();
-
+
turret_precache(self.turret_type);
turret_construct();
self.colormap = 1024;
- self.glowmod = '0 1 1';
+ self.glowmod = '0 1 1';
self.tur_head.colormap = self.colormap;
self.tur_head.glowmod = self.glowmod;
}
-
+
if(sf & TNSF_ANG)
{
if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
self.tur_head = spawn();
-
+
self.tur_head.move_angles_x = ReadShort();
self.tur_head.move_angles_y = ReadShort();
//self.tur_head.angles = self.angles + self.tur_head.move_angles;
self.tur_head.angles = self.tur_head.move_angles;
}
-
+
if(sf & TNSF_AVEL)
{
if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
self.tur_head = spawn();
-
+
self.tur_head.move_avelocity_x = ReadShort();
- self.tur_head.move_avelocity_y = ReadShort();
+ self.tur_head.move_avelocity_y = ReadShort();
}
-
+
if(sf & TNSF_MOVE)
{
self.origin_x = ReadShort();
self.origin_y = ReadShort();
self.origin_z = ReadShort();
setorigin(self, self.origin);
-
+
self.velocity_x = ReadShort();
self.velocity_y = ReadShort();
self.velocity_z = ReadShort();
-
+
self.move_angles_y = ReadShort();
-
+
self.move_time = time;
self.move_velocity = self.velocity;
self.move_origin = self.origin;
}
-
+
if(sf & TNSF_ANIM)
{
self.frame1time = ReadCoord();
float _tmp;
_tmp = ReadByte();
if(_tmp != self.team)
- {
- self.team = _tmp;
+ {
+ self.team = _tmp;
turret_changeteam();
}
-
- _tmp = ReadByte();
+
+ _tmp = ReadByte();
if(_tmp == 0 && self.health != 0)
turret_die();
else if(self.health && self.health != _tmp)
self.helpme = servertime + 10;
self.health = _tmp;
- }
+ }
//self.enemy.health = self.health / 255;
}
axh.alpha = 1;
AuxiliaryXhair[axh_id] = axh;
}
-
+
axh.move_origin_x = ReadCoord();
axh.move_origin_y = ReadCoord();
axh.move_origin_z = ReadCoord();
axh.colormod_y = ReadByte() / 255;
axh.colormod_z = ReadByte() / 255;
axh.cnt = time;
- axh.draw2d = AuxiliaryXhair_Draw2D;
+ axh.draw2d = AuxiliaryXhair_Draw2D;
}
void Net_VehicleSetup()
{
float i;
-
+
float hud_id = ReadByte();
-
+
// Weapon update?
if(hud_id > HUD_VEHICLE_LAST)
{
weapon2mode = hud_id - HUD_VEHICLE_LAST;
return;
}
-
+
// hud_id == 0 means we exited a vehicle, so stop alarm sound/s
if(hud_id == 0)
{
sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
- sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+ sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
return;
}
-
+
hud_id = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
// Init auxiliary crosshairs
// Raygun-locked
AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
AuxiliaryXhair[0].axh_scale = 0.5;
-
+
// Gunner1
AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-target.tga";
AuxiliaryXhair[1].axh_scale = 0.75;
-
+
// Gunner2
AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-target.tga";
AuxiliaryXhair[2].axh_scale = 0.75;
- break;
+ break;
case HUD_BUMBLEBEE_GUN:
// Plasma cannons
AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
picloc = picsize * 0.5 - pic2size * 0.5;
-
+
if(vh_health < 0.25)
drawpic(hudloc + picloc, bumb_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
else
drawpic(hudloc + picloc, bumb_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
-
+
drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
alarm1time = time + 2;
sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
}
-
+
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
- }
+ }
else
{
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
{
sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm1time = 0;
- }
+ }
}
// Shield bar
{
drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
if(alarm2time)
- {
+ {
sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm2time = 0;
}
}
-
+
ammo1 *= 0.01;
ammo2 *= 0.01;
-
+
// Gunner1 bar
picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
// Right gunner slot occupied?
if(!AuxiliaryXhair[1].draw2d)
{
- shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));
+ shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));
drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
}
-
+
// .. and icon
picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
else
drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
+
// Gunner2 bar
picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
// Left gunner slot occupied?
if(!AuxiliaryXhair[2].draw2d)
{
- shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));
+ shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));
drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
}
picsize_y *= 0.5;
drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
}
-
+
}
void CSQC_BUMBLE_GUN_HUD()
pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
picloc = picsize * 0.5 - pic2size * 0.5;
-
+
if(vh_health < 0.25)
drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
else
drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
-
+
drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
alarm1time = time + 2;
sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
}
-
+
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
- }
+ }
else
{
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
{
sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm1time = 0;
- }
+ }
}
// Shield bar
{
drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
if(alarm2time)
- {
+ {
sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm2time = 0;
}
}
-
+
// Gun bar
picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
drawresetcliparea();
-
+
// .. and icon
picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
if(vh_health < 0.25)
drawpic(hudloc + picloc, spider_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
else
- drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
+ drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
drawpic(hudloc + picloc, spider_rkt, pic2size, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
{
alarm1time = time + 2;
sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
- }
+ }
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
- }
+ }
else
{
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
{
sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm1time = 0;
- }
+ }
}
// Shield bar
picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
{
drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
if(alarm2time)
- {
+ {
sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm2time = 0;
}
alarm1time = time + 2;
sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
}
-
+
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
- }
+ }
else
{
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
{
drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
if(alarm2time)
- {
+ {
sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm2time = 0;
}
}
-
+
// Gun bar
picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
else
drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
+
if(weapon2mode == RSM_FLARE)
{
raptor_xhair = "gfx/vehicles/axh-bracket.tga";
else
{
raptor_xhair = "gfx/vehicles/axh-ring.tga";
-
+
// Bombing crosshair
if(!dropmark)
{
}
}
}
-
+
if (scoreboard_showscores)
HUD_DrawScoreboard();
else
alarm1time = time + 2;
sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
}
-
+
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
- }
+ }
else
{
drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
{
sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm1time = 0;
- }
+ }
}
-
+
// Shield bar
picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
{
drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
if(alarm2time)
- {
+ {
sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
alarm2time = 0;
}
}
-
+
// Gun bar
picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
precache_model("models/vehicles/clusterbomb_fragment.md3");
precache_model("models/vehicles/rocket01.md3");
precache_model("models/vehicles/rocket02.md3");
-
+
precache_sound ("vehicles/alarm.wav");
precache_sound ("vehicles/alarm_shield.wav");
}
void RaptorCBShellfragDraw()
{
if(wasfreed(self))
- return;
-
+ return;
+
Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
self.move_avelocity += randomvec() * 15;
self.renderflags = 0;
-
+
if(self.cnt < time)
self.alpha = bound(0, self.nextthink - time, 1);
void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
{
entity sfrag;
-
+
sfrag = spawn();
setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
setorigin(sfrag, _org);
o = hotspot;
ri = '1 0 0';
up = '0 1 0';
-
+
rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed
o = rotate(o, rot) + org;
ri = rotate(ri, rot);
return;
++waypointsprite_newcount;
-
+
float dist;
dist = vlen(self.origin - view_origin);
-
+
float a;
a = self.alpha * autocvar_hud_panel_fg_alpha;
if(rgb == '0 0 0')
{
self.teamradar_color = '1 0 1';
- print(sprintf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage));
+ print(sprintf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage));
}
if(time - floor(time) > 0.5)
float ang;
o = project_3d_to_2d(self.origin);
- if(o_z < 0
- || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
- || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
- || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
+ if(o_z < 0
+ || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
+ || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
+ || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
|| o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
{
// scale it to be just in view
o_z = 0;
float edgedistance_min, crosshairdistance;
- edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)),
+ edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)),
(o_x - (vid_conwidth * waypointsprite_edgeoffset_left)),
- (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
+ (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
(vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y);
float vidscale;
}
o = drawspritearrow(o, ang, rgb, a, SPRITE_ARROW_SCALE * t);
-
+
string txt;
if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
txt = _("Spam");
campaign_entries = campaign_entries + 1;
- if(campaign_entries >= n)
+ if(campaign_entries >= n)
break;
}
lineno = lineno + 1;
case CMD_REQUEST_COMMAND:
{
float i;
-
+
if(argc >= 2)
{
string original_cvar = argv(1);
string tmp_string = argv(2);
-
+
if(cvar_string(original_cvar) == "") // cvar was empty
{
cvar_set(original_cvar, tmp_string);
else // add it to the end of the list if the list doesn't already have it
{
argc = tokenizebyseparator(cvar_string(original_cvar), " ");
-
+
for(i = 0; i < argc; ++i)
if(argv(i) == tmp_string)
return; // already in list
-
+
cvar_set(original_cvar, strcat(tmp_string, " ", cvar_string(original_cvar)));
}
return;
}
}
-
+
default:
print("Incorrect parameters for ^2addtolist^7\n");
case CMD_REQUEST_USAGE:
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
float fh;
string filename = strcat(GetProgramCommandPrefix(), "_dump.txt");
fh = fopen(filename, FILE_WRITE);
-
+
if(fh >= 0)
{
#ifdef SVQC
CMD_Write("dump of server console commands:\n");
GameCommand_macro_write_aliases(fh);
-
+
CMD_Write("\ndump of networked client only commands:\n");
ClientCommand_macro_write_aliases(fh);
-
+
CMD_Write("\ndump of common commands:\n");
CommonCommand_macro_write_aliases(fh);
CMD_Write("\ndump of ban commands:\n");
BanCommand_macro_write_aliases(fh);
#endif
-
+
#ifdef CSQC
CMD_Write("dump of client commands:\n");
LocalCommand_macro_write_aliases(fh);
#endif
-
+
CMD_Write("\ndump of generic commands:\n");
GenericCommand_macro_write_aliases(fh);
-
+
print("Completed dump of aliases in ^2data/data/", GetProgramCommandPrefix(), "_dump.txt^7.\n");
-
+
fclose(fh);
}
else
}
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
#ifndef MENUQC
float fh, alsoprint = FALSE;
string filename = argv(1);
-
+
if(filename == "")
{
filename = "notifications.cfg";
alsoprint = TRUE;
}
fh = fopen(filename, FILE_WRITE);
-
+
if(fh >= 0)
{
Dump_Notifications(fh, alsoprint);
#endif
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
string tmp_string;
float i;
-
+
switch(argv(1))
{
case "add": // appends new maps to the maplist
print("maplist: ERROR: ", argv(2), " does not exist!\n");
break;
}
-
+
if(cvar_string("g_maplist") == "")
cvar_set("g_maplist", argv(2));
else
cvar_set("g_maplist", strcat(argv(2), " ", cvar_string("g_maplist")));
-
+
return;
}
break; // go to usage
}
-
+
case "cleanup": // scans maplist and only adds back the ones which are really usable
{
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
argc = tokenizebyseparator(cvar_string("g_maplist"), " ");
-
+
tmp_string = "";
for(i = 0; i < argc; ++i)
if(MapInfo_CheckMap(argv(i)))
tmp_string = strcat(tmp_string, " ", argv(i));
-
+
tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
cvar_set("g_maplist", tmp_string);
-
+
return;
}
-
+
case "remove": // scans maplist and only adds back whatever maps were not provided in argv(2)
{
if(argc == 3)
{
argc = tokenizebyseparator(cvar_string("g_maplist"), " ");
-
+
tmp_string = "";
for(i = 0; i < argc; ++i)
if(argv(i) != argv(2))
tmp_string = strcat(tmp_string, " ", argv(i));
-
+
tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
cvar_set("g_maplist", tmp_string);
-
+
return;
}
break; // go to usage
}
-
+
case "shuffle": // randomly shuffle the maplist
{
cvar_set("g_maplist", shufflewords(cvar_string("g_maplist")));
return;
}
-
+
default: break;
}
}
-
+
default:
print("Incorrect parameters for ^2maplist^7\n");
case CMD_REQUEST_USAGE:
queue_to_execute_next_frame(substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
string original_cvar = argv(1);
string removal = argv(2);
string tmp_string;
-
+
argc = tokenizebyseparator(cvar_string(original_cvar), " ");
-
+
tmp_string = "";
for(i = 0; i < argc; ++i)
if(argv(i) != removal)
tmp_string = strcat(tmp_string, " ", argv(i));
-
+
tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
cvar_set(original_cvar, tmp_string);
-
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2removefromlist^7\n");
case CMD_REQUEST_USAGE:
NOTIF_CENTER_COUNT,
NOTIF_MULTI_COUNT,
NOTIF_CHOICE_COUNT
- ));
+ ));
Destroy_All_Notifications();
CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
#else
#endif
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
float f = cvar_settemp(argv(1), argv(2));
if(f == 1)
- dprint("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n");
+ dprint("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n");
else if(f == -1)
dprint("Already had a tracker for ", argv(1), ", updating it to \"", argv(2), "\".\n");
// else cvar_settemp itself errors out
case CMD_REQUEST_COMMAND:
{
float i = cvar_settemp_restore();
-
+
if(i)
dprint("Restored ", ftos(i), " temporary cvar settings to their original values.\n");
else
dprint("Nothing to restore.\n");
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
TEST_RunAll();
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
case CMD_REQUEST_COMMAND:
{
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
#define GENERIC_COMMAND(name,function,description) \
{ print(" ^2", name, "^7: ", description, "\n"); }
-
+
GENERIC_COMMANDS(0, 0, "")
#undef GENERIC_COMMAND
-
+
return;
}
{
#define GENERIC_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
-
+
GENERIC_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
#undef GENERIC_COMMAND
-
+
return FALSE;
}
{
#define GENERIC_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
-
+
GENERIC_COMMANDS(CMD_REQUEST_USAGE, argc, "")
#undef GENERIC_COMMAND
-
+
return FALSE;
}
{
#define GENERIC_COMMAND(name,function,description) \
{ CMD_Write_Alias("qc_cmd_svmenu", name, description); }
-
+
GENERIC_COMMANDS(0, 0, "")
#undef GENERIC_COMMAND
-
+
return;
}
-
+
// ===========================================
// Main Common Function For Generic Commands
// ===========================================
-// Commands spread out among all programs (menu, client, and server)
+// Commands spread out among all programs (menu, client, and server)
float GenericCommand(string command)
{
// Guide for working with argc arguments by example:
// argc: 1 - 2 - 3 - 4
- // argv: 0 - 1 - 2 - 3
+ // argv: 0 - 1 - 2 - 3
// cmd vote - master - login - password
-
+
if(GenericCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
{
return TRUE; // handled by one of the above GenericCommand_* functions
// test case for terencehill's color codes
s = strdecolorize(substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
s2 = "";
-
+
n = strlen(s);
j = ((6 * max(1, floor(strlen(s)/32 + random() * 2 - 1))) / n) * (1 - 2 * (random() > 0.5));
f = random() * 6;
// =========================================================
// Used by other game command systems for common commands,
-// and it returns true if handled, false if not.
+// and it returns true if handled, false if not.
// Note: It tokenizes its input, so be careful!
float GenericCommand(string command);
// Returns command prefix specific for whatever program it is compiled in
-string GetProgramCommandPrefix(void);
+string GetProgramCommandPrefix(void);
// used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
#define CMD_Write(s) fputs(fh, s)
// Last updated: December 28th, 2011
// ========================================
-string rpn_pop()
+string rpn_pop()
{
if(rpn_sp > 0) {
--rpn_sp;
return "";
}
}
-void rpn_push(string s)
+void rpn_push(string s)
{
if(rpn_sp < MAX_RPN_STACK) {
rpn_stack[rpn_sp] = s;
rpn_error = TRUE;
}
}
-string rpn_get()
+string rpn_get()
{
if(rpn_sp > 0) {
return rpn_stack[rpn_sp - 1];
return "";
}
}
-void rpn_set(string s)
+void rpn_set(string s)
{
if(rpn_sp > 0) {
rpn_stack[rpn_sp - 1] = s;
float i, j, f, f2, f3, rpnpos;
//vector rgb;
string s, s2, rpncmd;
-
+
if(!rpn_db)
{
rpn_db = db_create();
db_put(rpn_db, "stack.pointer", "0");
db_put(rpn_db, "stack.pos", "-1");
}
-
+
if(argc >= 2)
{
rpn_sp = 0;
print("rpn: database underflow\n");
}
} else if(rpncmd == "dbget") {
-
+
i = stof(db_get(rpn_db, "stack.pointer"));
if(i)
{
{
j = stof(db_get(rpn_db, "stack.pointer"));
i = stof(db_get(rpn_db, "stack.pos"));
-
+
if(i < 0)
{
i = 0;
db_put(rpn_db, "stack.pos", "0");
}
-
+
db_put(rpn_db, "stack.pointer", ftos(j+1));
for(--j; j >= i; --j)
{
i = 0;
else
i = stof(s);
-
+
j = stof(db_get(rpn_db, "stack.pointer"));
if(i < 0 || i >= j)
{
// tokens f..f2 represent s2
// UNION: add all tokens to s that are in s2 but not in s
s = "";
- for(i = 0; i < f; ++i)
+ for(i = 0; i < f; ++i)
s = strcat(s, " ", argv(i));
for(i = f; i < f2; ++i) {
for(j = 0; j < f; ++j)
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
ZCTX(_("CI_SEC^%d seconds")), /* second */ \
ZCTX(_("CI_THI^%d seconds")), /* third */ \
ZCTX(_("CI_MUL^%d seconds"))) /* multi */
-
+
string count_ordinal(float interval)
{
// This function is designed primarily for the English language, it's impossible
}
}
else { return sprintf(_("%dth"), interval); }
-
+
return "";
}
// 1 second
// 2 seconds
// 3 seconds
- // etc... minutes, hours, days, etc.
+ // etc... minutes, hours, days, etc.
switch(floor(interval))
{
{
float tmp_hours = 0, tmp_minutes = 0, tmp_seconds = 0;
float tmp_years = 0, tmp_weeks = 0, tmp_days = 0;
-
+
tmp_seconds = floor(seconds);
if(tmp_seconds)
{
tmp_minutes = floor(tmp_seconds / 60);
-
+
if(tmp_minutes)
{
tmp_seconds -= (tmp_minutes * 60);
tmp_hours = floor(tmp_minutes / 60);
-
+
if(tmp_hours)
{
tmp_minutes -= (tmp_hours * 60);
tmp_days = floor(tmp_hours / 24);
-
+
if(tmp_days)
{
tmp_hours -= (tmp_days * 24);
tmp_weeks = floor(tmp_days / 7);
-
+
if(tmp_weeks)
{
tmp_days -= (tmp_weeks * 7);
// GLOB HANDLING (for all BSP files)
float _MapInfo_globopen;
-float _MapInfo_globcount;
+float _MapInfo_globcount;
float _MapInfo_globhandle;
string _MapInfo_GlobItem(float i)
{
}
MapInfo_count = j + 1;
MapInfo_ClearTemps();
-
+
// sometimes the glob isn't sorted nicely, so fix it here...
heapsort(MapInfo_count, _MapInfo_FilterList_swap, _MapInfo_FilterList_cmp, world);
if(load_default)
_MapInfo_Map_ApplyGametype(_MapInfo_GetDefault(pThisType), pWantedType, pThisType, FALSE);
-
+
if(pWantedType == MAPINFO_TYPE_ASSAULT || pWantedType == MAPINFO_TYPE_ONSLAUGHT || pWantedType == MAPINFO_TYPE_RACE || pWantedType == MAPINFO_TYPE_CTS) // these modes don't use fraglimit
{
cvar_set("fraglimit", "0");
s = cdr(s);
}
*/
-
+
// rc = timelimit timelimit_qualification laps laps_teamplay
if(pWantedType == MAPINFO_TYPE_RACE)
{
string MapInfo_Type_ToString(float t)
{
entity e;
- if(t == MAPINFO_TYPE_ALL)
+ if(t == MAPINFO_TYPE_ALL)
return "all";
for(e = MapInfo_Type_first; e; e = e.enemy)
if(t == e.items)
o = strstrofs(s, "\"", 0);
if(o >= 0)
s = substring(s, 0, o);
-
+
// remove // comments
o = strstrofs(s, "//", 0);
if(o >= 0)
s = substring(s, 0, o);
-
+
// remove trailing spaces
while(substring(s, -1, 1) == " ")
s = substring(s, 0, -2);
// print("EMERGENCY: can't play the selected map in the given game mode. Falling back to DM.\n");
// MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH);
//}
-
+
cvar_settemp_restore();
if(reinit)
localcmd(strcat("\nmap ", s, "\n"));
float argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
if(argc > 0)
{
- float i;
- for(i = argc - 1; i >= 0; --i)
+ float i;
+ for(i = argc - 1; i >= 0; --i)
sv_notice_to(self.owner, argv(i), autocvar_sv_join_notices_time, FALSE);
- }
+ }
remove(self);
}
entity n = spawn();
n.owner = self;
n.think = sv_notice_join_think;
- n.nextthink = time + 1;
+ n.nextthink = time + 1;
}
void sv_notice_to(entity _to, string _notice, float _howlong, float _modal)
entity _head;
FOR_EACH_REALCLIENT(_head)
sv_notice_to(_head, _notice, _howlong, _modal);
-
+
}
#endif // SVQC
entity _notes;
string _notice;
float m = FALSE;
-
+
_notes = findchain(classname, "sv_notice");
if(!_notes)
return FALSE;
#define M1 30
#define M2 10
-
+
vector v1, v2 = '0 0 0', v3;
v1 = '1 1 0' * M1;
v2_x = vid_conwidth - (2 * M1);
v2_y = vid_conheight - (2 * M1);
-
+
drawfill(v1, v2, '0 0 0', 0.5, DRAWFLAG_NORMAL);
v1 = '1 1 0' * (M1 + M2);
v2_x = vid_conwidth - (2 * (M1 + M2));
v2_y = vid_conheight - (2 * (M1 + M2));
drawfill(v1, v2, '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
v3 = v1 + '10 10 0';
-
+
#define OUT(s,z) drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3_y += z + 4
-
+
OUT(_("^1Server notices:"), 32);
-
+
//drawcolorcodedstring(v1 + '5 5 0', "^1Server notices:", '32 32 0', 1, DRAWFLAG_NORMAL);
while(_notes)
{
-
+
_notice = sprintf(_("^7%s (^3%d sec left)"), _notes.netname , rint(_notes.alpha - time));
OUT(_notice, 16);
- if(_notes.skin)
+ if(_notes.skin)
m = TRUE;
-
+
if(_notes.alpha <= time)
{
_notes.think = SUB_Remove;
_notes.nextthink = time;
}
-
- _notes = _notes.chain;
+
+ _notes = _notes.chain;
}
-
+
#undef OUT
#undef M1
#undef M2
-
+
return m;
}
{ checkargs = sprintf("%sNo client provided!", checkargs); }
break;
}
-
+
case NOTIF_ALL_EXCEPT:
{
if(IS_NOT_A_CLIENT(client))
{ checkargs = sprintf("%sException can't be a non-client!", checkargs); }
break;
}
-
+
case NOTIF_ALL:
{
if(client)
{ checkargs = sprintf("%sEntity provided when world was required!", checkargs); }
break;
}
-
+
case NOTIF_TEAM:
{
if (!teamplay)
//else if (!client.team) { checkargs = sprintf("%sNo team provided!", checkargs); }
break;
}
-
+
case NOTIF_TEAM_EXCEPT:
{
if (!teamplay)
{ checkargs = sprintf("%sException can't be a non-client!", checkargs); }
break;
}
-
+
default: { checkargs = sprintf("%sImproper broadcast: %d!", checkargs, broadcast); break; }
}
return checkargs;
{
entity notif;
float i;
-
+
#define DESTROY_LOOP(type,count) \
for(i = 1; i <= count; ++i) \
{ \
}
break;
}
- case 3: // durcnt
+ case 3: // durcnt
{
if(sel_num == NOTIF_MAX_DURCNT)
{
float strnum,
float flnum,
/* MSG_ANNCE */
- float channel,
+ float channel,
string snd,
float vol,
float position,
notif.nent_type = typeid;
notif.nent_id = nameid;
notif.nent_name = strzone(namestring);
-
+
string typestring = Get_Notif_TypeName(typeid);
// Other pre-notif-setup requisites
break;
}
-
+
case MSG_INFO:
case MSG_CENTER:
{
{
notif.nent_hudargs = strzone(
Process_Notif_Args(2, hudargs, typestring, namestring));
-
+
if(icon != "") { notif.nent_icon = strzone(icon); }
else
{
{
notif.nent_durcnt = strzone(
Process_Notif_Args(3, durcnt, typestring, namestring));
-
+
if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
else
{
));
notif_error = TRUE;
}
- }
+ }
else if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
#endif
else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL") }
}
else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL") }
-
+
#undef SET_NOTIF_STRING
// Check to make sure a string was chosen
{
// announcements don't actually need any arguments, so lets not even count them.
if(anncename != NO_MSG) { notif.nent_msgannce = msg_annce_notifs[anncename - 1]; }
-
+
float infoname_stringcount = 0, infoname_floatcount = 0;
float centername_stringcount = 0, centername_floatcount = 0;
-
+
if(infoname != NO_MSG)
{
notif.nent_msginfo = msg_info_notifs[infoname - 1];
infoname_stringcount = notif.nent_msginfo.nent_stringcount;
infoname_floatcount = notif.nent_msginfo.nent_floatcount;
}
-
+
if(centername != NO_MSG)
{
notif.nent_msgcenter = msg_center_notifs[centername - 1];
centername_stringcount = notif.nent_msgcenter.nent_stringcount;
centername_floatcount = notif.nent_msgcenter.nent_floatcount;
}
-
+
// set the requirements of THIS notification to the totals of its subcalls
notif.nent_stringcount = max(infoname_stringcount, centername_stringcount);
notif.nent_floatcount = max(infoname_floatcount, centername_floatcount);
}
-
+
break;
}
notif.nent_optionb = msg_multi_notifs[optionb - 1];
break;
}
- case MSG_CHOICE: // should we REALLY allow nested options?...
+ case MSG_CHOICE: // should we REALLY allow nested options?...
{
notif.nent_optiona = msg_choice_notifs[optiona - 1];
notif.nent_optionb = msg_choice_notifs[optionb - 1];
notif.nent_challow_var = challow_var; // 0: never allowed, 1: allowed in warmup, 2: always allowed
notif.nent_stringcount = max(notif.nent_optiona.nent_stringcount, notif.nent_optionb.nent_stringcount);
notif.nent_floatcount = max(notif.nent_optiona.nent_floatcount, notif.nent_optionb.nent_floatcount);
-
+
/*#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
"Create_Notification_Entity(...): MSG_CHOICE: %s\n%s\n%s\n",
}
break;
}
-
+
default:
{
print(sprintf(
}
}
- // now check to see if any errors happened
+ // now check to see if any errors happened
if(notif_error)
{
notif.nent_enabled = FALSE; // disable the notification so it can't cause trouble
{
e = Get_Notif_Ent(MSG_ANNCE, i);
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
-
+
NOTIF_WRITE_ENTITY(
"Notification control cvar: 0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled)"
);
{
e = Get_Notif_Ent(MSG_INFO, i);
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
-
+
NOTIF_WRITE_ENTITY(
"Notification control cvar: 0 = off, 1 = print to console, "
"2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
{
e = Get_Notif_Ent(MSG_CENTER, i);
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
-
+
NOTIF_WRITE_ENTITY(
"Notification control cvar: 0 = off, 1 = centerprint"
);
{
e = Get_Notif_Ent(MSG_MULTI, i);
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
-
+
NOTIF_WRITE_ENTITY(
"Notification control cvar: 0 = off, 1 = trigger subcalls"
);
{
e = Get_Notif_Ent(MSG_CHOICE, i);
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
-
+
NOTIF_WRITE_ENTITY_CHOICE(
"Notification control cvar: 0 = off, 1 = trigger option A subcall, 2 = trigger option B subcall",
"Notification control cvar: 0 = off, 1 = allowed in warmup mode, 2 = always allowed"
// edit these to match whichever cvars are used for specific notification options
NOTIF_WRITE("\n// HARD CODED notification variables:\n");
-
+
NOTIF_WRITE_HARDCODED(
"allow_chatboxprint", "1",
"Allow notifications to be printed to chat box by setting notification cvar to 2 "
"(You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)"
);
-
+
NOTIF_WRITE_HARDCODED(
"debug", "0",
"Print extra debug information on all notification function calls "
"(Requires -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation)... "
"0 = disabled, 1 = dprint, 2 = print"
);
-
+
NOTIF_WRITE_HARDCODED(
"errors_are_fatal", "1",
"If a notification fails upon initialization, cause a Host_Error to stop the program"
);
-
+
NOTIF_WRITE_HARDCODED(
"item_centerprinttime", "1.5",
"How long to show item information centerprint messages (like 'You got the Electro' or such)"
);
-
+
NOTIF_WRITE_HARDCODED(
"lifetime_mapload", "10",
"Amount of time that notification entities last immediately at mapload (in seconds) "
"to help prevent notifications from being lost on early init (like gamestart countdown)"
);
-
+
NOTIF_WRITE_HARDCODED(
"lifetime_runtime", "0.5",
"Amount of time that notification entities last on the server during runtime (In seconds)"
);
-
+
NOTIF_WRITE_HARDCODED(
"server_allows_location", "1",
"Server side cvar for allowing death messages to show location information too"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_location", "0",
"Append location information to MSG_INFO death/kill messages"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_location_string", "",
"Replacement string piped into sprintf, "
"so you can do different messages like this: ' at the %s' or ' (near %s)'"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_sprees", "1",
"Print information about sprees in death/kill messages"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_sprees_center", "1",
"Show spree information in MSG_CENTER messages... "
"0 = off, 1 = target (but only for first victim) and attacker"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_sprees_center_specialonly", "1",
"Don't show spree information in MSG_CENTER messages if it isn't an achievement"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_sprees_info", "3",
"Show spree information in MSG_INFO messages... "
"0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_sprees_info_newline", "1",
"Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
);
-
+
NOTIF_WRITE_HARDCODED(
"show_sprees_info_specialonly", "1",
"Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
NOTIF_MULTI_COUNT,
NOTIF_CHOICE_COUNT
));
-
+
return;
#undef NOTIF_WRITE_HARDCODED
#undef NOTIF_WRITE_ENTITY
#endif
string Local_Notification_sprintf(
- string input, string args,
+ string input, string args,
string s1, string s2, string s3, string s4,
float f1, float f2, float f3, float f4)
{
sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
));
#endif
-
+
string selected;
float sel_num;
for(sel_num = 0; sel_num < NOTIF_MAX_ARGS; ++sel_num) { arg_slot[sel_num] = ""; }
soundposition
));
#endif
-
+
sound(
world,
soundchannel,
soundvolume,
soundposition
);
-
+
if(prev_soundfile) { strunzone(prev_soundfile); }
prev_soundfile = strzone(soundfile);
prev_soundtime = time;
#endif
return;
}
-
+
// check supplied type and name for errors
string checkargs = Notification_CheckArgs_TypeName(net_type, net_name);
if(checkargs != "")
sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
));
#endif
-
+
if((notif.nent_stringcount + notif.nent_floatcount) > count)
{
backtrace(sprintf(
strcat(
"Not enough arguments for Local_Notification(%s, %s, ...)! ",
- "stringcount(%d) + floatcount(%d) > count(%d)\n",
+ "stringcount(%d) + floatcount(%d) > count(%d)\n",
"Check the definition and function call for accuracy...?\n"
),
Get_Notif_TypeName(net_type),
));
return;
}
-
+
switch(net_type)
{
case MSG_ANNCE:
#endif
break;
}
-
+
case MSG_INFO:
{
print(
Local_Notification_sprintf(
notif.nent_string,
- notif.nent_args,
+ notif.nent_args,
s1, s2, s3, s4,
f1, f2, f3, f4)
);
- #ifdef CSQC
+ #ifdef CSQC
if(notif.nent_icon != "")
{
Local_Notification_HUD_Notify_Push(
notif.nent_icon,
notif.nent_hudargs,
s1, s2, s3, s4);
- }
- #endif
+ }
+ #endif
break;
}
-
+
#ifdef CSQC
case MSG_CENTER:
{
Local_Notification_centerprint_generic(
Local_Notification_sprintf(
notif.nent_string,
- notif.nent_args,
+ notif.nent_args,
s1, s2, s3, s4,
f1, f2, f3, f4),
notif.nent_durcnt,
break;
}
#endif
-
+
case MSG_MULTI:
{
if(notif.nent_msginfo)
{
Local_Notification_WOVA(
MSG_INFO,
- notif.nent_msginfo.nent_id,
- notif.nent_msginfo.nent_stringcount,
- notif.nent_msginfo.nent_floatcount,
+ notif.nent_msginfo.nent_id,
+ notif.nent_msginfo.nent_stringcount,
+ notif.nent_msginfo.nent_floatcount,
s1, s2, s3, s4,
f1, f2, f3, f4);
}
{
Local_Notification_WOVA(
MSG_ANNCE,
- notif.nent_msgannce.nent_id,
- 0, 0,
+ notif.nent_msgannce.nent_id,
+ 0, 0,
"", "", "", "",
0, 0, 0, 0);
}
{
Local_Notification_WOVA(
MSG_CENTER,
- notif.nent_msgcenter.nent_id,
- notif.nent_msgcenter.nent_stringcount,
- notif.nent_msgcenter.nent_floatcount,
+ notif.nent_msgcenter.nent_id,
+ notif.nent_msgcenter.nent_stringcount,
+ notif.nent_msgcenter.nent_floatcount,
s1, s2, s3, s4,
- f1, f2, f3, f4);
+ f1, f2, f3, f4);
}
#endif
break;
case MSG_CHOICE:
{
entity found_choice;
-
+
if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2)))
{
switch(cvar_string(sprintf("notification_%s", notif.nent_name)))
}
}
else { found_choice = notif.nent_optiona; }
-
+
Local_Notification_WOVA(
found_choice.nent_type,
- found_choice.nent_id,
- found_choice.nent_stringcount,
- found_choice.nent_floatcount,
+ found_choice.nent_id,
+ found_choice.nent_stringcount,
+ found_choice.nent_floatcount,
s1, s2, s3, s4,
- f1, f2, f3, f4);
+ f1, f2, f3, f4);
}
}
}
-// WOVA = Without Variable Arguments
+// WOVA = Without Variable Arguments
void Local_Notification_WOVA(
float net_type, float net_name,
float stringcount, float floatcount,
net_name
));
#endif
-
+
if(is_new)
{
if(net_name == 0) { reset_centerprint_messages(); }
is_new,
time
));
- }
+ }
}
}
else
float f2 = ((1 < notif.nent_floatcount) ? ReadLong() : 0);
float f3 = ((2 < notif.nent_floatcount) ? ReadLong() : 0);
float f4 = ((3 < notif.nent_floatcount) ? ReadLong() : 0);
-
+
if(is_new)
{
Local_Notification_WOVA(
void Net_Notification_Remove()
{
if (!self) { backtrace(sprintf("Net_Notification_Remove() at %f: Missing self!?\n", time)); return; }
-
+
#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
"Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
self.owner.nent_name
));
#endif
-
+
float i;
for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } }
remove(self);
WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
WriteByte(MSG_ENTITY, self.nent_net_type);
WriteShort(MSG_ENTITY, self.nent_net_name);
- for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); }
+ for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); }
for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); }
return TRUE;
}
net_name
));
#endif
-
+
string checkargs = Notification_CheckArgs(broadcast, client, 1, 1);
if(checkargs != "") { backtrace(sprintf("Incorrect usage of Kill_Notification: %s\n", checkargs)); return; }
entity notif, net_notif;
float killed_cpid = NO_CPID;
-
+
switch(net_type)
{
case 0:
killed_cpid = 0; // kill ALL centerprints
break;
}
-
+
case MSG_CENTER:
{
if(net_name)
{
entity notif = Get_Notif_Ent(net_type, net_name);
if (!notif) { backtrace("Kill_Notification: Could not find notification entity!\n"); return; }
-
+
if(notif.nent_cpid)
killed_cpid = notif.nent_cpid;
else
#endif
return;
}
-
+
// check supplied broadcast, target, type, and name for errors
string checkargs = Notification_CheckArgs(broadcast, client, net_type, net_name);
if(checkargs != "")
backtrace(sprintf(
strcat(
"Not enough arguments for Send_Notification(%s, ...)! ",
- "stringcount(%d) + floatcount(%d) > count(%d)\n",
+ "stringcount(%d) + floatcount(%d) > count(%d)\n",
"Check the definition and function call for accuracy...?\n"
),
sprintf(
// It's slow, but it's better than the alternatives:
// 1. Constantly networking all info and letting client decide
// 2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
- entity found_choice;
+ entity found_choice;
#define RECURSE_FROM_CHOICE(ent,action) \
if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) \
net_notif.nent_net_name = net_name;
net_notif.nent_stringcount = notif.nent_stringcount;
net_notif.nent_floatcount = notif.nent_floatcount;
-
+
float i;
for(i = 0; i < net_notif.nent_stringcount; ++i)
{ net_notif.nent_strings[i] = strzone(...(i, string)); }
(time + autocvar_notification_lifetime_runtime)
:
autocvar_notification_lifetime_mapload
- );
+ );
Net_LinkEntity(net_notif, FALSE, 0, Net_Write_Notification);
}
}
-// WOVA = Without Variable Arguments
+// WOVA = Without Variable Arguments
void Send_Notification_WOVA(
float broadcast, entity client,
float net_type, float net_name,
sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
));
#endif
-
+
#define VARITEM(stringc,floatc,args) \
if((stringcount == stringc) && (floatcount == floatc)) \
{ Send_Notification(broadcast, client, net_type, net_name, args); return; }
Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
}
-// WOCOVA = Without Counts Or Variable Arguments
+// WOCOVA = Without Counts Or Variable Arguments
void Send_Notification_WOCOVA(
float broadcast, entity client,
float net_type, float net_name,
float f1, float f2, float f3, float f4)
{
entity notif = Get_Notif_Ent(net_type, net_name);
-
+
#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
"Send_Notification_WOCOVA(%s, %s, %s);\n",
sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
));
#endif
-
+
#define VARITEM(stringc,floatc,args) \
if((notif.nent_stringcount == stringc) && (notif.nent_floatcount == floatc)) \
{ Send_Notification(broadcast, client, net_type, net_name, args); return; }
// main types/groups of notifications
#define MSG_ANNCE 1 // "Global" AND "personal" announcer messages
-#define MSG_INFO 2 // "Global" information messages
+#define MSG_INFO 2 // "Global" information messages
#define MSG_CENTER 3 // "Personal" centerprint messages
#define MSG_CENTER_CPID 4 // Kill centerprint message
#define MSG_MULTI 5 // Subcall MSG_INFO and/or MSG_CENTER notifications
float strnum,
float flnum,
/* MSG_ANNCE */
- float channel,
+ float channel,
string snd,
float vol,
float position,
Check out the definitions in util.qc/util.qh/teams.qh for string CCR(...) and
string TCR(...) to better understand how these code replacements work.
-
+
Additionally, you can find all the definitions and explanations for
the argument values and what they return down below in this file.
MSG_INFO_NOTIF(1, INFO_WEAPON_TUBA_MURDER, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "weapontuba", _("^BG%s%s^K1 died of ^BG%s^K1's great playing on the @!#%%'n Tuba%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_WEAPON_TUBA_SUICIDE, 2, 1, "s1 s2loc spree_lost", "s1", "weapontuba", _("^BG%s^K1 hurt their own ears with the @!#%%'n Tuba%s%s"), "") \
MSG_INFO_NOTIF(1, INFO_WEAPON_UZI_MURDER_SNIPE, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "weaponuzi", _("^BG%s%s^K1 was sniped by ^BG%s^K1's Machine Gun%s%s"), "") \
- MSG_INFO_NOTIF(1, INFO_WEAPON_UZI_MURDER_SPRAY, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "weaponuzi", _("^BG%s%s^K1 was riddled full of holes by ^BG%s^K1's Machine Gun%s%s"), "")
+ MSG_INFO_NOTIF(1, INFO_WEAPON_UZI_MURDER_SPRAY, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "weaponuzi", _("^BG%s%s^K1 was riddled full of holes by ^BG%s^K1's Machine Gun%s%s"), "")
#define MULTITEAM_CENTER2(default,prefix,strnum,flnum,args,cpid,durcnt,normal,gentle) \
MSG_CENTER_NOTIF(default, prefix##RED, strnum, flnum, args, cpid, durcnt, TCR(normal, COL_TEAM_1, strtoupper(NAME_TEAM_1)), TCR(gentle, COL_TEAM_1, strtoupper(NAME_TEAM_1))) \
// 0 = no, 1 = yes, 2 = forced on for all MSG_INFO notifs
// DISABLED IN CODE, BUT ENABLED IN CONFIG FOR COMPATIBILITY WITH OLD CLIENTS
-var float autocvar_notification_allow_chatboxprint = 0;
+var float autocvar_notification_allow_chatboxprint = 0;
var float autocvar_notification_show_sprees_center = TRUE;
var float autocvar_notification_show_sprees_center_specialonly = TRUE;
allows for more dynamic data to be inferred by the local
notification parser, so that the server does not have to network
anything too crazy on a per-client/per-situation basis.
-
+
Pay attention to the CSQC/SVQC relations, some of these are redefined
in slightly different ways for different programs, this is because the
server does a more conservative approach to the notifs than the client.
-
+
All arguments are swapped into strings, so be sure that your
sprintf usage matches with proper %s placement.
-
+
Argument descriptions:
s1-s4: string arguments to be literally swapped into sprintf
s2loc: s2 string of locations of deaths or other events
string notif_arg_spree_cen(float spree)
{
// 0 = off, 1 = target (but only for first victim) and attacker
- if(autocvar_notification_show_sprees_center)
+ if(autocvar_notification_show_sprees_center)
{
if(spree > 1)
{
#define SPREE_ITEM(counta,countb,center,normal,gentle) \
case counta: { return normal_or_gentle(center, sprintf(_("%d score spree! "), spree)); }
-
+
switch(spree)
{
KILL_SPREE_LIST
),
spree);
}
- else { return ""; } // don't show spree information if it isn't an achievement
+ else { return ""; } // don't show spree information if it isn't an achievement
}
}
{
// 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker
// this conditional (& 2) is true for 2 and 3
- if(autocvar_notification_show_sprees_info & 2)
+ if(autocvar_notification_show_sprees_info & 2)
{
#ifdef CSQC
string spree_newline =
string spree_newline =
(autocvar_notification_show_sprees_info_newline ? "\n" : "");
#endif
-
+
if(spree > 1)
{
#define SPREE_ITEM(counta,countb,center,normal,gentle) \
case counta: { return sprintf(CCR(normal_or_gentle(normal, gentle)), player, spree_newline); }
-
+
switch(spree)
{
KILL_SPREE_LIST
spree_newline
);
}
- else { return ""; } // don't show spree information if it isn't an achievement
+ else { return ""; } // don't show spree information if it isn't an achievement
}
}
#else
#define dedi ""
#endif
-
+
print(sprintf("Beginning notification initialization on %s%s program...\n", dedi, PROGNAME));
-
+
// maybe do another implementation of this with checksums? for now, we don't need versioning
/*if(autocvar_notification_version != NOTIF_VERSION)
{
case NUM_TEAM_3: return COL_TEAM_3;
case NUM_TEAM_4: return COL_TEAM_4;
}
-
+
return "^7";
}
case NUM_TEAM_3: return NAME_TEAM_3;
case NUM_TEAM_4: return NAME_TEAM_4;
}
-
+
return NAME_NEUTRAL;
}
case NUM_TEAM_3: return STATIC_NAME_TEAM_3;
case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
}
-
+
return NAME_NEUTRAL;
}
case "pink": return NUM_TEAM_4;
case "auto": return 0;
}
-
+
return -1;
}
case 3: return NUM_TEAM_3;
case 4: return NUM_TEAM_4;
}
-
+
return -1;
}
case NUM_TEAM_3: return 3;
case NUM_TEAM_4: return 4;
}
-
+
return -1;
}
float dist_point_line(vector p, vector l0, vector ldir)
{
ldir = normalize(ldir);
-
+
// remove the component in line direction
p = p - (p * ldir) * ldir;
{
float fh, i, n;
fh = fopen(pFilename, FILE_WRITE);
- if(fh < 0)
+ if(fh < 0)
{
print(strcat("^1Can't write DB to ", pFilename));
return;
valstr = TIME_ENCODED_TOSTRING(pValue);
else
valstr = ftos(pValue);
-
+
return valstr;
}
neworder = strcat(neworder, ftos(w), " ");
}
}
-
+
return substring(neworder, 0, strlen(neworder) - 1);
}
neworder = "";
for(i = 0; i < n; ++i)
neworder = strcat(neworder, mapfunc(argv(i)), " ");
-
+
return substring(neworder, 0, strlen(neworder) - 1);
}
}
return substring(s, 0, strlen(s) - 1);
}
-
+
return order;
}
hsv_y = 0;
else
hsv_y = 1 - mi/ma;
-
+
return hsv;
}
ma = max(rgb_x, rgb_y, rgb_z);
hsl_x = rgb_mi_ma_to_hue(rgb, mi, ma);
-
+
hsl_z = 0.5 * (mi + ma);
if(mi == ma)
hsl_y = 0;
hsl_y = (ma - mi) / (2*hsl_z);
else // if(hsl_z > 0.5)
hsl_y = (ma - mi) / (2 - 2*hsl_z);
-
+
return hsl;
}
maminusmi = hsl_y * 2 * hsl_z;
else
maminusmi = hsl_y * (2 - 2 * hsl_z);
-
+
// hsl_z = 0.5 * mi + 0.5 * ma
// maminusmi = - mi + ma
mi = hsl_z - 0.5 * maminusmi;
// terminate, as the range still halves each time - but nevertheless, it is
// guaranteed that it finds ONE valid cutoff place (where "left" is in
// range, and "right" is outside).
-
+
// terencehill: the following code detects truncated ^xrgb tags (e.g. ^x or ^x4)
// and decrease left on the basis of the chars detected of the truncated tag
// Even if the ^xrgb tag is not complete/correct, left is decreased
}
}
}
-
+
return left;
}
// terminate, as the range still halves each time - but nevertheless, it is
// guaranteed that it finds ONE valid cutoff place (where "left" is in
// range, and "right" is outside).
-
+
// terencehill: the following code detects truncated ^xrgb tags (e.g. ^x or ^x4)
// and decrease left on the basis of the chars detected of the truncated tag
// Even if the ^xrgb tag is not complete/correct, left is decreased
}
}
}
-
+
return left;
}
string s;
s = getWrappedLine_remaining;
-
+
if(w <= 0)
{
getWrappedLine_remaining = string_null;
string s;
s = getWrappedLine_remaining;
-
+
if(w <= 0)
{
getWrappedLine_remaining = string_null;
case "true":
case "on":
return TRUE;
-
+
case "no":
case "false":
case "off":
return FALSE;
-
+
default: return stof(input);
}
}
/*
// if this is the case, the possible zeros of the first derivative are outside
// 0..1
- We can calculate this condition as condition
+ We can calculate this condition as condition
if(se <= 3)
return TRUE;
*/
Therefore: there is an inflection point iff:
e outside (3 - s)/2 .. 3 - s*2
-
+
in other words, if (s,e) in triangle (1,1)(0,3)(0,1.5) or in triangle (1,1)(3,0)(1.5,0)
*/
}
string CCR(string input)
{
// See the autocvar declarations in util.qh for default values
-
+
// foreground/normal colors
- input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), input);
- input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input);
- input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input);
- input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input);
+ input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), input);
+ input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input);
+ input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input);
+ input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input);
// "kill" colors
input = strreplace("^K1", strcat("^", autocvar_hud_colorset_kill_1), input);
switch(num)
{
case 10: return ANNCE_NUM_GAMESTART_10;
- case 9: return ANNCE_NUM_GAMESTART_9;
- case 8: return ANNCE_NUM_GAMESTART_8;
- case 7: return ANNCE_NUM_GAMESTART_7;
- case 6: return ANNCE_NUM_GAMESTART_6;
- case 5: return ANNCE_NUM_GAMESTART_5;
- case 4: return ANNCE_NUM_GAMESTART_4;
- case 3: return ANNCE_NUM_GAMESTART_3;
- case 2: return ANNCE_NUM_GAMESTART_2;
- case 1: return ANNCE_NUM_GAMESTART_1;
+ case 9: return ANNCE_NUM_GAMESTART_9;
+ case 8: return ANNCE_NUM_GAMESTART_8;
+ case 7: return ANNCE_NUM_GAMESTART_7;
+ case 6: return ANNCE_NUM_GAMESTART_6;
+ case 5: return ANNCE_NUM_GAMESTART_5;
+ case 4: return ANNCE_NUM_GAMESTART_4;
+ case 3: return ANNCE_NUM_GAMESTART_3;
+ case 2: return ANNCE_NUM_GAMESTART_2;
+ case 1: return ANNCE_NUM_GAMESTART_1;
}
break;
}
switch(num)
{
case 10: return ANNCE_NUM_IDLE_10;
- case 9: return ANNCE_NUM_IDLE_9;
- case 8: return ANNCE_NUM_IDLE_8;
- case 7: return ANNCE_NUM_IDLE_7;
- case 6: return ANNCE_NUM_IDLE_6;
- case 5: return ANNCE_NUM_IDLE_5;
- case 4: return ANNCE_NUM_IDLE_4;
- case 3: return ANNCE_NUM_IDLE_3;
- case 2: return ANNCE_NUM_IDLE_2;
- case 1: return ANNCE_NUM_IDLE_1;
+ case 9: return ANNCE_NUM_IDLE_9;
+ case 8: return ANNCE_NUM_IDLE_8;
+ case 7: return ANNCE_NUM_IDLE_7;
+ case 6: return ANNCE_NUM_IDLE_6;
+ case 5: return ANNCE_NUM_IDLE_5;
+ case 4: return ANNCE_NUM_IDLE_4;
+ case 3: return ANNCE_NUM_IDLE_3;
+ case 2: return ANNCE_NUM_IDLE_2;
+ case 1: return ANNCE_NUM_IDLE_1;
}
break;
}
switch(num)
{
case 10: return ANNCE_NUM_KILL_10;
- case 9: return ANNCE_NUM_KILL_9;
- case 8: return ANNCE_NUM_KILL_8;
- case 7: return ANNCE_NUM_KILL_7;
- case 6: return ANNCE_NUM_KILL_6;
- case 5: return ANNCE_NUM_KILL_5;
- case 4: return ANNCE_NUM_KILL_4;
- case 3: return ANNCE_NUM_KILL_3;
- case 2: return ANNCE_NUM_KILL_2;
- case 1: return ANNCE_NUM_KILL_1;
+ case 9: return ANNCE_NUM_KILL_9;
+ case 8: return ANNCE_NUM_KILL_8;
+ case 7: return ANNCE_NUM_KILL_7;
+ case 6: return ANNCE_NUM_KILL_6;
+ case 5: return ANNCE_NUM_KILL_5;
+ case 4: return ANNCE_NUM_KILL_4;
+ case 3: return ANNCE_NUM_KILL_3;
+ case 2: return ANNCE_NUM_KILL_2;
+ case 1: return ANNCE_NUM_KILL_1;
}
break;
}
switch(num)
{
case 10: return ANNCE_NUM_RESPAWN_10;
- case 9: return ANNCE_NUM_RESPAWN_9;
- case 8: return ANNCE_NUM_RESPAWN_8;
- case 7: return ANNCE_NUM_RESPAWN_7;
- case 6: return ANNCE_NUM_RESPAWN_6;
- case 5: return ANNCE_NUM_RESPAWN_5;
- case 4: return ANNCE_NUM_RESPAWN_4;
- case 3: return ANNCE_NUM_RESPAWN_3;
- case 2: return ANNCE_NUM_RESPAWN_2;
- case 1: return ANNCE_NUM_RESPAWN_1;
+ case 9: return ANNCE_NUM_RESPAWN_9;
+ case 8: return ANNCE_NUM_RESPAWN_8;
+ case 7: return ANNCE_NUM_RESPAWN_7;
+ case 6: return ANNCE_NUM_RESPAWN_6;
+ case 5: return ANNCE_NUM_RESPAWN_5;
+ case 4: return ANNCE_NUM_RESPAWN_4;
+ case 3: return ANNCE_NUM_RESPAWN_3;
+ case 2: return ANNCE_NUM_RESPAWN_2;
+ case 1: return ANNCE_NUM_RESPAWN_1;
}
break;
}
switch(num)
{
case 10: return ANNCE_NUM_ROUNDSTART_10;
- case 9: return ANNCE_NUM_ROUNDSTART_9;
- case 8: return ANNCE_NUM_ROUNDSTART_8;
- case 7: return ANNCE_NUM_ROUNDSTART_7;
- case 6: return ANNCE_NUM_ROUNDSTART_6;
- case 5: return ANNCE_NUM_ROUNDSTART_5;
- case 4: return ANNCE_NUM_ROUNDSTART_4;
- case 3: return ANNCE_NUM_ROUNDSTART_3;
- case 2: return ANNCE_NUM_ROUNDSTART_2;
- case 1: return ANNCE_NUM_ROUNDSTART_1;
+ case 9: return ANNCE_NUM_ROUNDSTART_9;
+ case 8: return ANNCE_NUM_ROUNDSTART_8;
+ case 7: return ANNCE_NUM_ROUNDSTART_7;
+ case 6: return ANNCE_NUM_ROUNDSTART_6;
+ case 5: return ANNCE_NUM_ROUNDSTART_5;
+ case 4: return ANNCE_NUM_ROUNDSTART_4;
+ case 3: return ANNCE_NUM_ROUNDSTART_3;
+ case 2: return ANNCE_NUM_ROUNDSTART_2;
+ case 1: return ANNCE_NUM_ROUNDSTART_1;
}
break;
}
switch(num)
{
case 10: return ANNCE_NUM_10;
- case 9: return ANNCE_NUM_9;
- case 8: return ANNCE_NUM_8;
- case 7: return ANNCE_NUM_7;
- case 6: return ANNCE_NUM_6;
- case 5: return ANNCE_NUM_5;
- case 4: return ANNCE_NUM_4;
- case 3: return ANNCE_NUM_3;
- case 2: return ANNCE_NUM_2;
- case 1: return ANNCE_NUM_1;
+ case 9: return ANNCE_NUM_9;
+ case 8: return ANNCE_NUM_8;
+ case 7: return ANNCE_NUM_7;
+ case 6: return ANNCE_NUM_6;
+ case 5: return ANNCE_NUM_5;
+ case 4: return ANNCE_NUM_4;
+ case 3: return ANNCE_NUM_3;
+ case 2: return ANNCE_NUM_2;
+ case 1: return ANNCE_NUM_1;
}
break;
}
// modulo function
#ifndef MENUQC
-float mod(float a, float b) { return a - (floor(a / b) * b); }
+float mod(float a, float b) { return a - (floor(a / b) * b); }
#endif
#define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4)
self.iflags |= IFLAG_TELEPORTED;
self.csqcmodel_teleported = 1;
}
-
+
CSQCModel_InterpolateAnimation_Note(sf);
InterpolateOrigin_Note();
CSQCPlayer_PostUpdate();
const float VF_CL_VIEWANGLES = 33; //(vector)
const float VF_CL_VIEWANGLES_X = 34; //(float)
const float VF_CL_VIEWANGLES_Y = 35; //(float)
-const float VF_CL_VIEWANGLES_Z = 36; //(float)
+const float VF_CL_VIEWANGLES_Z = 36; //(float)
const float VF_PERSPECTIVE = 200;
const float TE_EXPLOSIONQUAD = 70;
const float TE_SPIKEQUAD = 58;
const float TE_SUPERSPIKEQUAD = 59;
-
+
// PFlags for Dynamic Lights
const float PFLAGS_NOSHADOW = 1;
const float PFLAGS_CORONA = 2;
float particle_type; // one of PT_
float particle_blendmode; // one of PBLEND_ values
float particle_orientation; // one of PARTICLE_ values
-vector particle_color1;
+vector particle_color1;
vector particle_color2;
float particle_tex; // number of chunk in particlefont
float particle_size;
-float particle_sizeincrease;
+float particle_sizeincrease;
float particle_alpha;
float particle_alphafade;
float particle_time;
float(vector org, vector vel, float theme) quickparticle = #527; // not reading globals, just theme, returns 0 when failed, 1 when spawned
float(vector org, vector vel, float delay, float collisiondelay) delayedparticle = #528;
float(vector org, vector vel, float delay, float collisiondelay, float theme) quickdelayedparticle = #528;
-// description: this builtin provides an easy and flexible way to spawn particles,
-// it is not created as replace for DP_SV_POINTPARTICLES but as an addition to it.
+// description: this builtin provides an easy and flexible way to spawn particles,
+// it is not created as replace for DP_SV_POINTPARTICLES but as an addition to it.
// With this extension you can create a specific particles like rain particles, or entity particles
-// notes:
+// notes:
// 1) 0 is default particle template, it could be changed
// 2) color vectors could have value 0-255 of each component
// restrictions: max themes could be between 4 and 2048
//darkplaces implementation: Blub\0
//console commands:
// loadfont fontname fontmaps size1 size2 ...
-// A font can simply be gfx/tgafile (freetype fonts doent need extension),
+// A font can simply be gfx/tgafile (freetype fonts doent need extension),
// or alternatively you can specify multiple fonts and faces
// Like this: gfx/vera-sans:2,gfx/fallback:1
// to load face 2 of the font gfx/vera-sans and use face 1
float FONT_USER7 = 15; // 'user7' slot, userdefined fonts
//builtin definitions:
float findfont(string s) = #356; // find font by fontname and return it's index
-float loadfont(string fontname, string fontmaps, string sizes, float slot, float fix_scale, float fix_voffset) = #357;
+float loadfont(string fontname, string fontmaps, string sizes, float slot, float fix_scale, float fix_voffset) = #357;
// loads font immediately so stringwidth() function can be used just after builtin call
// returns a font slotnum (which is used to set drawfont to)
// first 3 parms are identical to "loadfont" console command ones
// r_font_postprocess_shadow_y X : font outline shadow y shift amount, applied during outlining
// r_font_postprocess_shadow_z X : font outline shadow z shift amount, applied during blurring
//description: engine support for truetype/freetype fonts
-//so .AFM+.PFB/.OTF/.TTF files could be stuffed as fontmaps in loadfont()
+//so .AFM+.PFB/.OTF/.TTF files could be stuffed as fontmaps in loadfont()
//(console command version will support them as well)
//DP_CSQC_BINDMAPS
//constant definitions:
const float VF_MAINVIEW = 400;
//use setproperty(VF_MAINVIEW, 1); before calling R_RenderView for the render
-//that shall become the "main" view, which is e.g. used by PRYDON_CLIENTCURSOR
+//that shall become the "main" view, which is e.g. used by PRYDON_CLIENTCURSOR
//this flag is set for the first scene, and not cleared by R_ClearScene
//this flag is automatically cleared by R_RenderView
//so when not using this extension, the first view rendered is the main view
//darkplaces implementation: Blub\0
//cvar definitions:
// utf8_enable: enable utf8 encoding
-//description: utf8 characters are allowed inside cvars, protocol strings, files, progs strings, etc.,
+//description: utf8 characters are allowed inside cvars, protocol strings, files, progs strings, etc.,
//and count as 1 char for string functions like strlen, substring, etc.
// note: utf8_enable is run-time cvar, could be changed during execution
// note: beware that str2chr() could return value bigger than 255 once utf8 is enabled
// description: allows alternative 'static' lightstyle syntax : "=value"
// examples: "=0.5", "=2.0", "=2.75"
// could be used to control switchable lights or making styled lights with brightness > 2
-// Warning: this extension is experimental. It safely works in CSQC, but SVQC use is limited by the fact
+// Warning: this extension is experimental. It safely works in CSQC, but SVQC use is limited by the fact
// that other engines (which do not support this extension) could connect to a game and misunderstand this kind of lightstyle syntax
//DP_LITSPRITES
//syntax of .dpsubs files: each line in .dpsubs file defines 1 subtitle, there are three tokens:
// <start> <end> "string"
// start: subtitle start time in seconds
-// end: subtitle time-to-show in seconds, if 0 - subtitle will be showed until next subtitle is started,
+// end: subtitle time-to-show in seconds, if 0 - subtitle will be showed until next subtitle is started,
// if below 0 - show until next subtitles minus this number of seconds
// text: subtitle text, color codes (Q3-style and ^xRGB) are allowed
//example of subtitle file:
// 3 0 "Vengeance! Vengeance for my eternity of suffering!"
// 9 0 "Whelp! As if you knew what eternity was!"
// 13 0 "Grovel before your true master."
-// 17 0 "Never!"
+// 17 0 "Never!"
// 18 7 "I'll hack you from crotch to gizzard and feed what's left of you to your brides..."
//DP_SOLIDCORPSE
.vector massofs; // offsets a mass center out of object center, if not set a center of model bounds is used
.float friction; // a friction of object, get multiplied by second objects's friction on contact
.float bouncefactor;
-.float bouncestop;
+.float bouncestop;
.float jointtype; // type of joint
.float forcetype; // type of force
-.float erp; // error restitution parameter, makes ODE solver attempt to fix errors in contacts,
- // bringing together 2 joints or fixing object being stuch in other object,
+.float erp; // error restitution parameter, makes ODE solver attempt to fix errors in contacts,
+ // bringing together 2 joints or fixing object being stuch in other object,
// a value of 0.1 will fix slightly, a value of 1.0 attempts to fix whole error in one frame
// use with care as high values makes system unstable and likely to explode
//builtin definitions:
float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
vector drawcolorcodedstring2(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #467;
-
+
float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
n.prevSibling = p;
else
me.lastChild = p;
-
+
// now other got removed. Insert it behind dest now.
other.prevSibling = dest;
if(dest)
// - closable is 0
// - rootDialog is 0
// - title is ""
-// - marginTop is
+// - marginTop is
// - intendedHeight ends up to be the tab's actual height, or at least close
// - titleFontSize is 0
// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
vector p;
vector theTempColor;
float component;
-
+
p = me.realOrigin - eX * me.scrollPos;
theColor = '1 1 1';
theAlpha = 1; //theVariableAlpha = 1; // changes when ^ax found
-
+
n = strlen(me.text);
for(i = 0; i < n; ++i)
{
else if(ch2 == "x") // ^x found
{
theColor = '1 1 1';
-
+
component = HEXDIGIT_TO_DEC(substring(me.text, i+2, 1));
if (component >= 0) // ^xr found
{
theTempColor_x = component/15;
-
+
component = HEXDIGIT_TO_DEC(substring(me.text, i+3, 1));
if (component >= 0) // ^xrg found
{
theTempColor_y = component/15;
-
+
component = HEXDIGIT_TO_DEC(substring(me.text, i+4, 1));
if (component >= 0) // ^xrgb found
{
theTempColor_z = component/15;
theColor = theTempColor;
w = draw_TextWidth(substring(me.text, i, 5), 0, me.realFontSize);
-
+
draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5);
draw_Text(p, substring(me.text, i, 5), me.realFontSize, theColor, 1, 0); // theVariableAlpha instead of 1 using alpha tags ^ax
i += 3;
float scale;
entity e, e2;
vector emins, emaxs, e2mins, e2maxs;
-
+
for(scale = 0.7;; scale *= 0.99)
{
Nexposee_Calc_Scale(me, scale);
ATTRIB(Tab, rootDialog, float, 0)
ATTRIB(Tab, title, string, string_null)
ATTRIB(Tab, titleFontSize, float, 0) // pixels
-
+
// still to be customized
ATTRIB(Tab, intendedWidth, float, 0)
ATTRIB(Tab, rows, float, 3)
v = pos + avoidplus;
if(m_testtooltipbox(v))
return TRUE;
-
+
// bottom center
v_x = pos_x - menuTooltipSize_x * 0.5;
if(m_testtooltipbox(v))
v_x = pos_x - menuTooltipSize_x * 0.5;
if(m_testtooltipbox(v))
return TRUE;
-
+
// top right
v_x = pos_x + avoidplus_x;
if(m_testtooltipbox(v))
return TRUE;
-
+
return FALSE;
}
entity m_findtooltipitem(entity root, vector pos)
for(e = NULL; (e = find(e, name, itemname)); )
if(e.classname != "vtbl")
break;
-
+
if((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))))
{
m_hide();
#endif
#define CLASS(cname) entity spawn##cname(); entity cname##_vtbl;
-#define EXTENDS(base)
+#define EXTENDS(base)
#define METHOD(cname,name,prototype) prototype cname##_##name; .prototype name;
#define ATTRIB(cname,name,type,val) .type name;
#define ATTRIBARRAY(cname,name,type,cnt) .type name[cnt];
if(theControlledSlider.value == median(theControlledSlider.valueMin, theControlledSlider.value, theControlledSlider.valueMax))
me.savedValue = theControlledSlider.value;
else
- me.savedValue = theControlledSlider.valueMin;
+ me.savedValue = theControlledSlider.valueMin;
me.controlledSlider = theControlledSlider;
me.configureCheckBox(me, theText, me.fontSize, me.image);
me.tooltip = theControlledSlider.tooltip;
// for this to work, C/(1-B) must be in 0..1
// B must be < 1
// C must be < 1-B
-
+
B = bound(0, B, 1);
C = bound(0, C, 1-B);
{
if(cvar("crosshair_dot_color_custom") && (cvar_string("crosshair_dot_color") != "0"))
rgb = stov(cvar_string("crosshair_dot_color"));
-
+
draw_Picture('0.5 0.5 0' - 0.5 * sz * cvar("crosshair_dot_size"), me.src4, sz * cvar("crosshair_dot_size"), rgb, a * cvar("crosshair_dot_alpha"));
}
}
SUPER(XonoticCvarList).setSelected(me, i);
if(me.nItems == 0)
return;
-
+
if(me.cvarName)
strunzone(me.cvarName);
if(me.cvarDescription)
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
+
k = bufstr_get(me.handle, i);
v = cvar_string(k);
METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticDemoList, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticDemoList, getDemos, void(entity))
- METHOD(XonoticDemoList, startDemo, void(entity))
+ METHOD(XonoticDemoList, startDemo, void(entity))
METHOD(XonoticDemoList, demoName, string(entity, float))
METHOD(XonoticDemoList, clickListBoxItem, void(entity, float, vector))
METHOD(XonoticDemoList, keyDown, float(entity, float, float, float))
METHOD(XonoticDemoList, destroy, void(entity))
METHOD(XonoticDemoList, showNotify, void(entity))
-
+
ATTRIB(XonoticDemoList, listDemo, float, -1)
ATTRIB(XonoticDemoList, realFontSize, vector, '0 0 0')
ATTRIB(XonoticDemoList, columnNameOrigin, float, 0)
ATTRIB(XonoticDemoList, realUpperMargin, float, 0)
ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
-
+
ATTRIB(XonoticDemoList, lastClickedDemo, float, -1)
ATTRIB(XonoticDemoList, lastClickedTime, float, 0)
- ATTRIB(XonoticDemoList, filterString, string, string_null)
+ ATTRIB(XonoticDemoList, filterString, string, string_null)
ENDCLASS(XonoticDemoList)
entity makeXonoticDemoList();
void XonoticDemoList_configureXonoticDemoList(entity me)
{
me.configureXonoticListBox(me);
- me.getDemos(me);
+ me.getDemos(me);
}
string XonoticDemoList_demoName(entity me, float i )
void XonoticDemoList_getDemos(entity me)
{
string s;
-
+
if(me.filterString)
- //subdirectory in filterString allowed
- s=strcat("demos/*", me.filterString, "*.dem");
+ //subdirectory in filterString allowed
+ s=strcat("demos/*", me.filterString, "*.dem");
else
s="demos/*.dem";
-
- //dprint("Search demos with the pattern ", s, "\n");
+
+ //dprint("Search demos with the pattern ", s, "\n");
if(me.listDemo >= 0)
search_end(me.listDemo);
-
+
me.listDemo = search_begin(s, FALSE, TRUE);
if(me.listDemo < 0)
me.nItems=0;
else
- me.nItems=search_getsize(me.listDemo);
+ me.nItems=search_getsize(me.listDemo);
}
void XonoticDemoList_destroy(entity me)
string s;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
+
s = me.demoName(me,i);
s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
- draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+ draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
}
void XonoticDemoList_showNotify(entity me)
}
void DemoList_Filter_Change(entity box, entity me)
-{
+{
if(me.filterString)
strunzone(me.filterString);
-
+
if(box.text != "")
me.filterString = strzone(box.text);
else
me.filterString = string_null;
-
+
me.getDemos(me);
}
{
string s;
s = me.demoName(me,me.selectedItem);
- localcmd("playdemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
+ localcmd("playdemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
}
void StartDemo_Click(entity btn, entity me)
{
string s;
s = me.demoName(me,me.selectedItem);
- localcmd("timedemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
+ localcmd("timedemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
}
void XonoticDemoList_clickListBoxItem(entity me, float i, vector where)
{
if(cvar_string("_cl_name") != "Player")
return 1;
-
+
if(cvar_string("_menu_prvm_language") != prvm_language)
return 1; // OK will then reopen the dialog in another language
-
+
if(cvar_string("cl_allow_uid2name") != "-1")
- return 1;
-
+ return 1;
+
return 0;
}
me.TR(me);
me.TR(me);
me.TR(me);
-
+
me.gotoRC(me, 3, 4); me.setFirstColumn(me, me.currentColumn);
me.TR(me);
me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Text language:")));
me.gotoRC(me, me.rows - 4, 0);
me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, _("Allow player statistics to use your nickname at stats.xonotic.org?")));
-
+
me.gotoRC(me, me.rows - 3, 0);
me.TDempty(me, 1.5);
me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "1", ZCTX(_("ALWU2N^Yes"))));
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
me.TD(me, 2, 2.6, e = makeXonoticColorpickerString("hud_dock_color", "hud_dock_color"));
me.TR(me);
- me.TR(me);
+ me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock_alpha"));
ATTRIB(XonoticServerCreateTab, title, string, _("Create"))
ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
ATTRIB(XonoticServerCreateTab, rows, float, 22)
- ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
ATTRIB(XonoticDemoBrowserTab, rows, float, 22)
ATTRIB(XonoticDemoBrowserTab, columns, float, 4)
- ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
+ ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
ENDCLASS(XonoticDemoBrowserTab)
entity makeXonoticDemoBrowserTab();
#endif
e.onChange = DemoList_Filter_Change;
e.onChangeEntity = dlist;
dlist.controlledTextbox = e;
-
+
me.TR(me);
me.TD(me, me.rows - 4, me.columns, dlist);
-
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
e.onClick = TimeDemo_Click;
if(me.currentServerName)
strunzone(me.currentServerName);
me.currentServerName = string_null;
-
+
if(me.currentServerCName)
strunzone(me.currentServerCName);
me.currentServerCName = string_null;
-
+
if(me.currentServerType)
strunzone(me.currentServerType);
me.currentServerType = string_null;
-
+
if(me.currentServerMap)
strunzone(me.currentServerMap);
me.currentServerMap = string_null;
-
+
if(me.currentServerPlayers)
strunzone(me.currentServerPlayers);
me.currentServerPlayers = string_null;
-
+
if(me.currentServerNumPlayers)
strunzone(me.currentServerNumPlayers);
me.currentServerNumPlayers = string_null;
-
+
if(me.currentServerNumBots)
strunzone(me.currentServerNumBots);
me.currentServerNumBots = string_null;
-
+
if(me.currentServerNumFreeSlots)
strunzone(me.currentServerNumFreeSlots);
me.currentServerNumFreeSlots = string_null;
-
+
if(me.currentServerMod)
strunzone(me.currentServerMod);
me.currentServerMod = string_null;
-
+
if(me.currentServerVersion)
strunzone(me.currentServerVersion);
me.currentServerVersion = string_null;
-
+
// not zoned!
//if(me.currentServerEncrypt)
// strunzone(me.currentServerEncrypt);
if(me.currentServerPure)
strunzone(me.currentServerPure);
me.currentServerPure = string_null;
-
+
if(me.currentServerKey)
strunzone(me.currentServerKey);
me.currentServerKey = string_null;
-
+
if(me.currentServerID)
strunzone(me.currentServerID);
me.currentServerID = string_null;
j = MapInfo_Type_FromString(typestr); // try and get the real name of the game type
if(j) { typestr = MapInfo_Type_ToText(j); } // only set it if we actually found it
-
+
me.currentServerType = strzone(typestr);
me.typeLabel.setText(me.typeLabel, me.currentServerType);
s = ftos(numb);
me.currentServerNumBots = strzone(s);
me.numBotsLabel.setText(me.numBotsLabel, me.currentServerNumBots);
-
+
if(freeslots < 0) { freeslots = maxp - numh - numb; }
s = ftos(freeslots);
me.currentServerNumFreeSlots = strzone(s);
break;
}
me.encryptLabel.setText(me.encryptLabel, me.currentServerEncrypt);
-
+
s = crypto_getidfp(me.currentServerCName);
if (!s) { s = _("N/A"); }
me.currentServerID = strzone(s);
e.colorL = SKINCOLOR_SERVERINFO_IP;
e.allowCut = 1;
me.cnameLabel = e;
-
+
me.TR(me);
me.TR(me);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Gametype:")));
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
e.allowCut = 1;
me.pureLabel = e;
-
+
me.TR(me);
me.TR(me);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Players:")));
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
e.allowCut = 1;
me.numFreeSlotsLabel = e;
-
+
me.gotoRC(me, me.rows - 5, 0);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Encryption:")));
me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
ATTRIB(XonoticPlayerSettingsTab, title, string, _("Player Setup"))
ATTRIB(XonoticPlayerSettingsTab, intendedWidth, float, 0.9)
ATTRIB(XonoticPlayerSettingsTab, rows, float, 22)
- ATTRIB(XonoticPlayerSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticPlayerSettingsTab, columns, float, 6.2) // added extra .2 for center space
ATTRIB(XonoticPlayerSettingsTab, playerNameLabel, entity, NULL)
ATTRIB(XonoticPlayerSettingsTab, playerNameLabelAlpha, float, 0)
ENDCLASS(XonoticPlayerSettingsTab)
e.onClickEntity = main.weaponsDialog;
// I don't really think this is useful as is, and especially it doesn't look very clean...
// In the future, if ALL of these buttons had some information, then it would be justified/clean
- //me.TD(me, 1, 1, e0 = makeXonoticTextLabel(0, string_null));
+ //me.TD(me, 1, 1, e0 = makeXonoticTextLabel(0, string_null));
// e0.textEntity = main.weaponsDialog;
// e0.allowCut = 1;
me.TR(me);
me.TD(me, 1, 2, e = makeXonoticButton(_("HUD settings"), '0 0 0'));
e.onClick = DialogOpenButton_Click;
e.onClickEntity = main.hudDialog;
- // TODO: show hud config name with text here
+ // TODO: show hud config name with text here
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "color -1 -1;name \"$_cl_name\";sendcvar cl_weaponpriority;sendcvar cl_autoswitch;sendcvar cl_forceplayermodels;sendcvar cl_forceplayermodelsfromxonotic;playermodel $_cl_playermodel;playerskin $_cl_playerskin", COMMANDBUTTON_APPLY));
void XonoticCrosshairDialog_fill(entity me)
{
entity e;
-
+
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_dot", _("Enable center crosshair dot")));
setDependent(e, "crosshair_enabled", 1, 2);
me.TDempty(me, 0.2);
me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate when picking up an item")));
setDependent(e, "crosshair_enabled", 1, 2);
-
+
me.TR(me);
-
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
e.onClick = Dialog_Close;
}
string XonoticHUDDialog_toString(entity me)
{
- return "hi"; // TODO: show hud config name with text here
+ return "hi"; // TODO: show hud config name with text here
}
void XonoticHUDDialog_fill(entity me)
{
entity e;
-
+
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Damage:")));
me.TR(me);
me.TD(me, 1, 2, e = makeXonoticSlider(0.25, 1, 0.05, "hud_damage_fade_rate"));
setDependent(e, "hud_damage", 0.001, 100);
me.TR(me);
-
+
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_hidewaypoints", _("Waypoints")));
me.TR(me);
makeMulti(e, "g_waypointsprite_edgeoffset_top g_waypointsprite_edgeoffset_left g_waypointsprite_edgeoffset_right");
setDependent(e, "cl_hidewaypoints", 0, 0);
me.TR(me);
-
+
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_shownames", _("Show names above players")));
me.TR(me);
me.TD(me, 1, 2, e = makeXonoticButton(_("Enter HUD editor"), '0 0 0'));
e.onClick = HUDSetup_Check_Gamestatus;
e.onClickEntity = me;
- // TODO: show hud config name with text here
-
+ // TODO: show hud config name with text here
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
e.onClick = Dialog_Close;
localcmd("map hudsetup/hudsetup", "\n");
else
localcmd("togglemenu 0\n");
-
+
localcmd("_hud_configure 1", "\n");
}
void XonoticModelDialog_fill(entity me)
{
entity e;
-
+
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Body fading:")));
me.TD(me, 1, 2, e = makeXonoticSlider(0, 2, 0.2, "cl_deathglow"));
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_forceplayercolors", _("Force player colors to mine")));
me.TR(me);
-
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
e.onClick = Dialog_Close;
ATTRIB(XonoticViewDialog, color, vector, SKINCOLOR_DIALOG_VIEW)
ATTRIB(XonoticViewDialog, intendedWidth, float, 0.9)
ATTRIB(XonoticViewDialog, rows, float, 11)
- ATTRIB(XonoticViewDialog, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticViewDialog, columns, float, 6.2) // added extra .2 for center space
ENDCLASS(XonoticViewDialog)
#endif
void XonoticViewDialog_fill(entity me)
{
entity e;
-
+
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Field of view:")));
me.TD(me, 1, 2, e = makeXonoticSlider(60, 130, 5, "fov"));
me.TR(me);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_clippedspectating", _("Allow passing through walls while spectating")));
-
+
me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "0", _("1st person perspective")));
makeMulti(e, "crosshair_hittest_showimpact");
me.TD(me, 1, 2, e = makeXonoticSlider(10, 50, 1, "chase_up"));
setDependent(e, "chase_active", 1, 1);
me.TR(me);
-
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
e.onClick = Dialog_Close;
me.TD(me, 1, 1, e = makeXonoticButton(_("Down"), '0 0 0'));
e.onClick = WeaponsList_MoveDown_Click;
e.onClickEntity = me.weaponsList;
-
+
me.gotoRC(me, 0, 2.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_weaponpriority_useforcycling", _("Use priority list for weapon cycling")));
me.TR(me);
// setDependent(e, "r_drawviewmodel", 1, 1);
// me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 2, 0.1, "cl_viewmodel_scale"));
// setDependent(e, "r_drawviewmodel", 1, 1);
-
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
e.onClick = Dialog_Close;
ATTRIB(XonoticAudioSettingsTab, title, string, _("Audio"))
ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
ATTRIB(XonoticAudioSettingsTab, rows, float, 17)
- ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
ENDCLASS(XonoticAudioSettingsTab)
entity makeXonoticAudioSettingsTab();
#endif
me.TD(me, 1, 3, makeXonoticCheckBox(0, "menu_snd_attenuation_method", _("New style sound attenuation")));
me.TR(me);
me.TD(me, 1, 3, makeXonoticCheckBox(0, "snd_mutewhenidle", _("Mute sounds when not active")));
-
+
me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Frequency:")));
me.TD(me, 1, 2, e = makeXonoticTextSlider("snd_speed"));
ATTRIB(XonoticEffectsSettingsTab, title, string, _("Effects"))
ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
ATTRIB(XonoticEffectsSettingsTab, rows, float, 17)
- ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
ENDCLASS(XonoticEffectsSettingsTab)
entity makeXonoticEffectsSettingsTab();
float updateCompression();
setDependent(e, "cl_decals", 1, 1);
me.TD(me, 1, 2, e = makeXonoticSlider(1, 20, 1, "cl_decals_time"));
setDependent(e, "cl_decals", 1, 1);
-
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_restart", COMMANDBUTTON_APPLY));
}
ATTRIB(XonoticInputSettingsTab, title, string, _("Input"))
ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
ATTRIB(XonoticInputSettingsTab, rows, float, 17)
- ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
ENDCLASS(XonoticInputSettingsTab)
entity makeXonoticInputSettingsTab();
#endif
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "m_accelerate", _("Enable built in mouse acceleration")));
-
-
+
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_movement_track_canjump", COMMANDBUTTON_APPLY));
}
{
loadAllCvars(me);
}
-void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIST_CONTROLS to color ALL controls
+void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIST_CONTROLS to color ALL controls
{
entity e, cvarlist;
cvarlist = makeXonoticCvarList();
- cvarlist.color =
- cvarlist.colorF =
- cvarlist.color2 =
- cvarlist.colorC =
+ cvarlist.color =
+ cvarlist.colorF =
+ cvarlist.color2 =
+ cvarlist.colorC =
SKINCOLOR_CVARLIST_CONTROLS;
me.TR(me);
me.TD(me, 1, 1.5, e = makeXonoticButton(_("Set font"), '0 0 0'));
e.onClick = SetLanguage_Click;
e.onClickEntity = sk;*/
-
+
me.gotoRC(me, 0, 2.85); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Text language:")));
me.TR(me);
me.TD(me, 1, 1.5, e = makeXonoticButton(_("Set language"), '0 0 0'));
e.onClick = SetLanguage_Click;
e.onClickEntity = sk;
-
+
me.gotoRC(me, 9, 2.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_gentle", _("Disable gore effects and harsh language")));
me.TR(me);
me.TR(me);
me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_allow_uid2name", _("Allow player statistics to use your nickname")));
setDependent(e, "cl_allow_uidtracking", 1, 1);
-
+
me.gotoRC(me, me.rows - 3, 2.6);
me.TD(me, 1, 2, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_gentle; sendcvar cl_allow_uidtracking; sendcvar cl_allow_uid2name;", COMMANDBUTTON_APPLY));
ATTRIB(XonoticVideoSettingsTab, title, string, _("Video"))
ATTRIB(XonoticVideoSettingsTab, intendedWidth, float, 0.9)
ATTRIB(XonoticVideoSettingsTab, rows, float, 17)
- ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2) // added extra .2 for center space
ATTRIB(XonoticVideoSettingsTab, name, string, "videosettings")
ENDCLASS(XonoticVideoSettingsTab)
entity makeXonoticVideoSettingsTab();
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "vid_fullscreen", _("Full screen")));
me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "vid_vsync", _("Vertical Synchronization")));
-
+
me.TR(me);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Anisotropy:")));
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "r_viewfbo", _("High-quality frame buffer")));
setDependent(e, "vid_samples", 1, 1);
-
+
me.TR(me);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Depth first:")));
void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
{
string s;
-
+
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
{
me.itemAbsSize = '0 0 0';
SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
+
me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
me.realUpperMargin1 = 0.5 * (1 - me.realFontSize_y);
me.firstRunDialog = i = spawnXonoticFirstRunDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
+
+
// hud_configure dialogs
i = spawnXonoticHUDExitDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDNotificationDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDAmmoDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDHealthArmorDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDChatDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDModIconsDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDPowerupsDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDPressedKeysDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDRaceTimerDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDRadarDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDScoreDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDTimerDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDVoteDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
i = spawnXonoticHUDWeaponsDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
i = spawnXonoticHUDCenterprintDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
+
+
// dialogs used by settings
me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
me.cvarsDialog = i = spawnXonoticCvarsDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
+
+
// dialog used by singleplayer
me.winnerDialog = i = spawnXonoticWinnerDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
+
+
// dialog used by multiplayer/join
me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
+
+
// dialogs used by multiplayer/create
me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
me.advancedDialog = i = spawnXonoticAdvancedDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
// dialogs used by multiplayer/player setup
me.crosshairDialog = i = spawnXonoticCrosshairDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
me.hudDialog = i = spawnXonoticHUDDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
me.modelDialog = i = spawnXonoticModelDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
me.viewDialog = i = spawnXonoticViewDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
me.weaponsDialog = i = spawnXonoticWeaponsDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
+
// mutator dialogs
i = spawnXonoticSandboxToolsDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
-
-
+
+
// miscellaneous dialogs
i = spawnXonoticTeamSelectDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
+
+
// main dialogs/windows
me.mainNexposee = n = spawnXonoticNexposee();
/*
i.configureDialog(i);
n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
-
+
i = spawnXonoticMultiplayerDialog();
i.configureDialog(i);
n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
-
+
me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
me.moveItemAfter(me, n, NULL);
rgb = colormapPaletteColor(9, 0);
else
rgb = '1 1 1';
-
+
s = me.getPlayerList(me, i, PLAYERPARM_NAME);
score = me.getPlayerList(me, i, PLAYERPARM_SCORE);
score = substring(score, 0, t);
if((t = strstrofs(score, ",", 0)) >= 0)
score = substring(score, 0, t);
-
+
if(stof(score) == -666)
score = _("spectator");
}
f = 1;
--i;
}
-
+
if(!f)
{
s1 = "";
void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
{
string s;
-
+
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
+
s = me.skinParameter(me, i, SKINPARM_PREVIEW);
draw_Picture(me.columnPreviewOrigin * eX, s, me.columnPreviewSize * eX + eY, '1 1 1', 1);
-
+
s = me.skinParameter(me, i, SKINPARM_NAME);
s = sprintf(_("%s: %s"), s, me.skinParameter(me, i, SKINPARM_TITLE));
s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
n = 0;
else
n = tokenizebyseparator(data, "\n");
-
+
if(n >= 1)
{
_Nex_ExtResponseSystem_UpdateTo = argv(0);
boxA = '0.05 0.5 0' + 0.25 * sz_y * eY;
boxB = '0.95 0.5 0' + 1.25 * sz_y * eY;
draw_Fill(boxA, boxB - boxA, '1 1 1', 1);
-
+
boxA += sz * 0.1;
boxB -= sz * 0.1;
draw_Fill(boxA, boxB - boxA, '0.1 0.1 0.1', 1);
{
float i;
i = 0;
-
+
#define GAMETYPE(id) if(i++ == cnt) return id;
GAMETYPES
#undef GAMETYPE
unused_float = i;
-
+
return 0;
}
{
float i;
i = 0;
-
+
#define GAMETYPE(id) ++i;
GAMETYPES
#undef GAMETYPE
-
+
return i;
}
string GameType_GetName(float cnt)
{
float i = GameType_GetID(cnt);
-
+
if(i)
return MapInfo_Type_ToText(i);
-
+
return "";
}
string GameType_GetIcon(float cnt)
{
float i = GameType_GetID(cnt);
-
+
if(i)
return strcat("gametype_", MapInfo_Type_ToString(i));
-
+
return "";
}
{
float i = GameType_GetID(cnt);
string s = _MapInfo_GetDefaultEx(i);
-
+
if(i)
{
if(strstrofs(s, "teams", 0) >= 0)
else
return _("free for all");
}
-
+
return _("tuba for all");
}*/
float f, i;
i = me.selectedItem;
f = SUPER(XonoticWeaponsList).mouseDrag(me, pos);
-
+
if(me.pressed != 1) // don't change priority if the person is just scrolling
{
if(me.selectedItem != i)
cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem, i));
}
-
+
return f;
}
string XonoticWeaponsList_toString(entity me)
dprint("TESTCASE: START\n");
r = test();
if(r == 1)
- error("TESTCASE: PASS");
+ error("TESTCASE: PASS");
else if(r == 0)
- error("TESTCASE: FAIL");
+ error("TESTCASE: FAIL");
else
- error("TESTCASE: INVALID");
+ error("TESTCASE: INVALID");
}
{
if (e.vehicle && e.vehicle.vehicle_flags == VHF_PLAYERSLOT)
return;
-
+
if(e.vehicle)
antilag_record(e.vehicle, t);
return FALSE;
if(e.flags & FL_NOTARGET)
return FALSE;
-
+
checkentity = e;
if(MUTATOR_CALLHOOK(BotShouldAttack))
return FALSE;
-
+
return TRUE;
}
t = zdistance / autocvar_g_jetpack_maxspeed_up;
t += xydistance / autocvar_g_jetpack_maxspeed_side;
fuel = t * autocvar_g_jetpack_fuel * 0.8;
-
+
bot_debug(strcat("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel), "\n"));
// enough fuel ?
return 1;
}
-string cvar_campaignwrapper_list; // string of format ; var value; var value; var value;
+string cvar_campaignwrapper_list; // string of format ; var value; var value; var value;
string cvar_string_campaignwrapper(string theCvar)
{
float p, q;
return 0;
if(gamestart_sv_cheats < 2 && !IS_PLAYER(self))
return 0;
-
+
// sv_clones
if(i == CHIMPULSE_CLONE_MOVING || i == CHIMPULSE_CLONE_STANDING)
if(self.lip < sv_clones)
// haha
if(self.maycheat)
return 1;
-
+
// sv_cheats
if(gamestart_sv_cheats && autocvar_sv_cheats)
return 1;
self.oldvelocity = self.velocity = self.personal.velocity;
self.angles = self.personal.v_angle;
self.fixangle = TRUE;
-
+
MUTATOR_CALLHOOK(AbortSpeedrun);
}
MUTATOR_CALLHOOK(MakePlayerObserver);
Portal_ClearAll(self);
-
+
if(self.alivetime)
{
if(!warmup_stage)
}
if(self.vehicle)
- vehicles_exit(VHEF_RELESE);
+ vehicles_exit(VHEF_RELESE);
WaypointSprite_PlayerDead();
accuracy_resend(self);
self.spectatortime = time;
-
+
self.classname = "observer";
self.iscreature = FALSE;
self.teleportable = TELEPORT_SIMPLE;
//stuffcmd(self, "chase_active 0");
//stuffcmd(self, "set viewsize $tmpviewsize \n");
-
+
target_voicescript_clear(self);
// reset fields the weapons may use
if(!self.killindicator_teamchange)
{
self.vehicle_health = -1;
- Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0');
+ Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0');
}
}
if(gameover) return;
if(self.player_blocked) return;
if(self.freezetag_frozen) return;
-
+
ClientKill_TeamChange(0);
}
if(autocvar_sv_eventlog)
GameLogEcho(strcat(":part:", ftos(self.playerid)));
-
+
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, self.netname);
MUTATOR_CALLHOOK(ClientDisconnect);
self.superweapons_finished = 0;
}
}
-
+
if(autocvar_g_nodepthtestplayers)
self.effects = self.effects | EF_NODEPTHTEST;
setorigin(self, spectatee.origin);
setsize(self, spectatee.mins, spectatee.maxs);
SetZoomState(spectatee.zoomstate);
-
+
anticheat_spectatecopy(spectatee);
self.hud = spectatee.hud;
if(spectatee.vehicle)
self.vehicle_reload2 = spectatee.vehicle_reload2;
msg_entity = self;
-
+
WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
WriteAngle(MSG_ONE, spectatee.v_angle_x);
WriteAngle(MSG_ONE, spectatee.v_angle_y);
WriteAngle(MSG_ONE, spectatee.v_angle_z);
//WriteByte (MSG_ONE, SVC_SETVIEW);
- // WriteEntity(MSG_ONE, self);
+ // WriteEntity(MSG_ONE, self);
//makevectors(spectatee.v_angle);
- //setorigin(self, spectatee.origin - v_forward * 400 + v_up * 300);*/
+ //setorigin(self, spectatee.origin - v_forward * 400 + v_up * 300);*/
}
}
float SpectateUpdate() {
if(!self.enemy)
- return 0;
+ return 0;
if (self == self.enemy)
return 0;
if (start.team == self.team) {
return start;
}
-
+
other = start;
// continue from current player
while(other && other.team != self.team) {
other = find(other, classname, "player");
}
-
+
if (!other) {
// restart from begining
other = find(other, classname, "player");
other = find(other, classname, "player");
}
}
-
+
return other;
}
vehicles_exit(VHEF_NORMAL);
return;
}
-
+
// a use key was pressed; call handlers
MUTATOR_CALLHOOK(PlayerUseKey);
}
if(frametime)
player_anim();
button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE);
-
+
if (self.deadflag == DEAD_DYING)
{
if(self.respawn_flags & RESPAWN_FORCE)
if(frametime)
player_anim();
-
+
// secret status
secrets_setstatus();
-
+
self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
//self.angles_y=self.v_angle_y + 90; // temp
return; // intermission or finale
GetPressedKeys();
}
-
+
#ifdef TETRIS
}
#endif
if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
return;
-
+
if(self.vehicle)
if(self.vehicle.deadflag == DEAD_NO)
if(self.vehicle.vehicles_impusle)
if(self.vehicle.vehicles_impusle(imp))
return;
-
+
if(CheatImpulse(imp))
{
}
player_multijump = doublejump;
if(MUTATOR_CALLHOOK(PlayerJump))
return;
-
+
doublejump = player_multijump;
float mjumpheight;
-
+
if (autocvar_sv_doublejump)
{
tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
self.flags &= ~FL_JUMPRELEASED;
animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
-
+
if(autocvar_g_jump_grunt)
PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
}
else
vel_perpend = vel_perpend * max(0, 1 - frametime * wishspeed * sidefric);
-
+
vel_xy = vel_straight * wishdir + vel_perpend;
-
+
if(speedclamp >= 0)
{
float vel_xy_preclamp;
string c;
WarpZone_PlayerPhysics_FixVAngle();
-
+
maxspd_mod = 1;
if(self.ballcarried)
if(g_nexball)
return;
bot_think();
}
-
+
self.items &= ~IT_USING_JETPACK;
if(IS_PLAYER(self))
return 0;
if(w == 0)
return 0;
-
+
wa = W_AmmoItemCode(w);
if(start_weapons & WepSet_FromWeapon(w))
{
W_SwitchWeapon_Force(self, w_getbestweapon(self));
a = W_ThrowNewWeapon(self, w, doreduce, self.origin + delta, velo);
-
+
if (!a) return;
Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w);
}
self.switchingweapon = self.switchweapon;
entity oldwep = get_weaponinfo(self.weapon);
-
+
#ifndef INDEPENDENT_ATTACK_FINISHED
if(ATTACK_FINISHED(self) <= time + self.weapon_frametime * 0.5)
{
}
self.angles = '0 0 0';
-
+
float f = (self.owner.weapon_nextthink - time);
if (self.state == WS_RAISE && !intermission_running)
{
complain = 0;
if(complain)
self.hasweapon_complain_spam = time + 0.2;
-
+
if(wpn == WEP_HOOK && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
complain = 0;
{
W_SwitchToOtherWeapon(self);
}
-
+
return FALSE;
}
return TRUE;
if(spread <= 0)
return forward;
sstyle = autocvar_g_projectiles_spread_style;
-
+
if(sstyle == 0)
{
// this is the baseline for the spread value!
string ip = argv(1);
float reason_arg, bantime;
string reason;
-
- reason_arg = 2;
-
+
+ reason_arg = 2;
+
GET_BAN_ARG(bantime, autocvar_g_ban_default_bantime);
GET_BAN_REASON(reason, "No reason provided");
return;
}
}
-
+
default:
print("Incorrect parameters for ^2ban^7\n");
case CMD_REQUEST_USAGE:
Ban_View();
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
float accepted = VerifyClientEntity(client, TRUE, FALSE);
float reason_arg, bantime, masksize;
string reason;
-
- if(accepted > 0)
+
+ if(accepted > 0)
{
- reason_arg = next_token;
+ reason_arg = next_token;
GET_BAN_ARG(bantime, autocvar_g_ban_default_bantime);
GET_BAN_ARG(masksize, autocvar_g_ban_default_masksize);
GET_BAN_REASON(reason, "No reason provided");
Ban_KickBanClient(client, bantime, masksize, reason);
-
+
return;
}
else
{
- print("kickban: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ print("kickban: ", GetClientErrorString(accepted, argv(1)), ".\n");
}
}
}
-
+
default:
print("Incorrect parameters for ^2kickban^7\n");
case CMD_REQUEST_USAGE:
{
entity client = GetFilteredEntity(argv(1));
float accepted = VerifyClientEntity(client, TRUE, FALSE);
-
- if(accepted > 0)
+
+ if(accepted > 0)
{
client.muted = TRUE;
return;
}
else
{
- print("mute: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ print("mute: ", GetClientErrorString(accepted, argv(1)), ".\n");
}
}
}
-
+
default:
print("Incorrect parameters for ^2mute^7\n");
case CMD_REQUEST_USAGE:
switch(request)
{
case CMD_REQUEST_COMMAND:
- {
+ {
if(argv(1))
{
float tmp_number = -1;
string tmp_string;
-
+
if(substring(argv(1), 0, 1) == "#")
{
tmp_string = substring(argv(1), 1, -1);
-
+
if(tmp_string != "") // is it all one token? like #1
{
tmp_number = stof(tmp_string);
else // maybe it's ONLY a number?
{
tmp_number = stof(argv(1));
-
+
if((tmp_number == 0) && (argv(1) != "0"))
{ tmp_number = -1; }
}
}
}
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
entity client = GetFilteredEntity(argv(1));
float accepted = VerifyClientEntity(client, TRUE, FALSE);
-
- if(accepted > 0)
+
+ if(accepted > 0)
{
client.muted = FALSE;
return;
}
else
{
- print("unmute: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ print("unmute: ", GetClientErrorString(accepted, argv(1)), ".\n");
}
}
}
-
+
default:
print("Incorrect parameters for ^2mute^7\n");
case CMD_REQUEST_USAGE:
{
case CMD_REQUEST_COMMAND:
{
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
#define BAN_COMMAND(name,function,description) \
{ if(strtolower(description) != "") { print(" ^2", name, "^7: ", description, "\n"); } }
-
+
BAN_COMMANDS(0, 0, "")
#undef BAN_COMMAND
-
+
return;
}
{
#define BAN_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
-
+
BAN_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
#undef BAN_COMMAND
-
+
return FALSE;
}
{
#define BAN_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
-
+
BAN_COMMANDS(CMD_REQUEST_USAGE, argc, "")
#undef BAN_COMMAND
-
+
return FALSE;
}
{
#define BAN_COMMAND(name,function,description) \
{ if(strtolower(description) != "") { CMD_Write_Alias("qc_cmd_sv", name, description); } }
-
+
BAN_COMMANDS(0, 0, "")
#undef BAN_COMMAND
-
+
return;
}
float BanCommand(string command)
{
float argc = tokenize_console(command);
-
+
// Guide for working with argc arguments by example:
// argc: 1 - 2 - 3 - 4
- // argv: 0 - 1 - 2 - 3
+ // argv: 0 - 1 - 2 - 3
// cmd vote - master - login - password
if(BanCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
{
return TRUE; // handled by one of the above GenericCommand_* functions
}
-
+
return FALSE;
}
return;
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2autoswitch^7\n");
case CMD_REQUEST_USAGE:
{
sprint(self, "\nUsage:^3 cmd autoswitch selection\n");
- sprint(self, " Where 'selection' controls if autoswitch is on or off.\n");
+ sprint(self, " Where 'selection' controls if autoswitch is on or off.\n");
return;
}
}
self.checkfail = 1;
return; // never fall through to usage
}
-
+
default:
sprint(self, "Incorrect parameters for ^2checkfail^7\n");
case CMD_REQUEST_USAGE:
if(IS_CLIENT(self))
{
self.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
-
+
if(self.version < autocvar_gameversion_min || self.version > autocvar_gameversion_max)
{
self.version_mismatch = 1;
ClientKill_TeamChange(-2); // observe
- }
- else if(autocvar_g_campaign || autocvar_g_balance_teams)
+ }
+ else if(autocvar_g_campaign || autocvar_g_balance_teams)
{
//JoinBestTeam(self, FALSE, TRUE);
- }
- else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0))
+ }
+ else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0))
{
self.classname = "observer"; // really?
stuffcmd(self, "menu_showteamselect\n");
}
}
-
+
return;
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2clientversion^7\n");
case CMD_REQUEST_USAGE:
{
if(argv(1) != "")
{
- if(intermission_running)
+ if(intermission_running)
MapVote_SendPicture(stof(argv(1)));
return;
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2mv_getpicture^7\n");
case CMD_REQUEST_USAGE:
}
}
-void ClientCommand_join(float request)
+void ClientCommand_join(float request)
{
switch(request)
{
{
if(!IS_PLAYER(self) && !lockteams && !g_arena)
{
- if(nJoinAllowed(self))
+ if(nJoinAllowed(self))
{
if(autocvar_g_campaign) { campaign_bots_may_start = 1; }
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_PLAY, self.netname);
PutClientInServer();
}
- else
+ else
{
//player may not join because of g_maxplayers is set
Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT);
}
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
if(argc >= 2) { Say(self, FALSE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
if(argc >= 2) { Say(self, TRUE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
if(teamplay)
if(self.team_forced <= 0)
- if (!lockteams)
+ if (!lockteams)
{
float selection;
-
+
switch(argv(1))
{
case "red": selection = NUM_TEAM_1; break;
case "yellow": selection = NUM_TEAM_3; break;
case "pink": selection = NUM_TEAM_4; break;
case "auto": selection = (-1); break;
-
+
default: selection = 0; break;
}
-
+
if(selection)
{
if(self.team == selection && self.deadflag == DEAD_NO)
else
sprint(self, "^7selectteam can only be used in teamgames\n");
}
- return;
+ return;
}
}
return;
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2selectteam^7\n");
case CMD_REQUEST_USAGE:
{
//float tokens;
string s;
-
+
if(argc == 2) // undefined cvar: use the default value on the server then
{
s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
tokenize_console(s);
}
-
+
GetCvars(1);
-
+
return;
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2sentcvar^7\n");
case CMD_REQUEST_USAGE:
}
}
-void ClientCommand_spectate(float request)
+void ClientCommand_spectate(float request)
{
switch(request)
{
{
if(IS_CLIENT(self))
{
- if(g_arena) { return; }
+ if(g_arena) { return; }
if(g_lms)
{
if(self.lms_spectate_warning)
return;
}
}
-
- if(IS_PLAYER(self) && autocvar_sv_spectate == 1)
+
+ if(IS_PLAYER(self) && autocvar_sv_spectate == 1)
ClientKill_TeamChange(-2); // observe
// in CA, allow a dead player to move to spectators (without that, caplayer!=0 will be moved back to the player list)
}
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
return;
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2suggestmap^7\n");
case CMD_REQUEST_USAGE:
{
entity tell_to = GetIndexedEntity(argc, 1);
float tell_accepted = VerifyClientEntity(tell_to, TRUE, FALSE);
-
+
if(tell_accepted > 0) // the target is a real client
{
if(tell_to != self) // and we're allowed to send to them :D
}
else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
}
- else if(argv(1) == "#0")
- {
+ else if(argv(1) == "#0")
+ {
trigger_magicear_processmessage_forallears(self, -1, world, substring(command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)));
return;
}
else { print_to(self, strcat("tell: ", GetClientErrorString(tell_accepted, argv(1)), ".")); return; }
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2tell^7\n");
case CMD_REQUEST_USAGE:
}
}
-void ClientCommand_voice(float request, float argc, string command)
+void ClientCommand_voice(float request, float argc, string command)
{
switch(request)
{
VoiceMessage(argv(1), substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
else
VoiceMessage(argv(1), "");
-
+
return;
}
}
-
+
default:
sprint(self, "Incorrect parameters for ^2voice^7\n");
case CMD_REQUEST_USAGE:
{
case CMD_REQUEST_COMMAND:
{
-
+
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command), "Send a message directly to a player") \
CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \
/* nothing */
-
+
void ClientCommand_macro_help()
{
#define CLIENT_COMMAND(name,function,description) \
{ sprint(self, " ^2", name, "^7: ", description, "\n"); }
-
+
CLIENT_COMMANDS(0, 0, "")
#undef CLIENT_COMMAND
-
+
return;
}
{
#define CLIENT_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
-
+
CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
#undef CLIENT_COMMAND
-
+
return FALSE;
}
{
#define CLIENT_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
-
+
CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc, "")
#undef CLIENT_COMMAND
-
+
return FALSE;
}
void ClientCommand_macro_write_aliases(float fh)
{
#define CLIENT_COMMAND(name,function,description) \
- { CMD_Write_Alias("qc_cmd_cmd", name, description); }
-
+ { CMD_Write_Alias("qc_cmd_cmd", name, description); }
+
CLIENT_COMMANDS(0, 0, "")
#undef CLIENT_COMMAND
-
+
return;
}
return;
float argc = tokenize_console(command);
-
+
// for the mutator hook system
cmd_name = strtolower(argv(0));
cmd_argc = argc;
cmd_string = command;
-
+
// Guide for working with argc arguments by example:
// argc: 1 - 2 - 3 - 4
- // argv: 0 - 1 - 2 - 3
+ // argv: 0 - 1 - 2 - 3
// cmd vote - master - login - password
-
+
// for floodcheck
switch(strtolower(argv(0)))
{
case "prespawn": break; // handled by engine in host_cmd.c
case "sentcvar": break; // handled by server in this file
case "spawn": break; // handled by engine in host_cmd.c
-
- default:
+
+ default:
if(SV_ParseClientCommand_floodcheck())
break; // "TRUE": continue, as we're not flooding yet
else
return; // "FALSE": not allowed to continue, halt // print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n");
}
-
+
/* NOTE: should this be disabled? It can be spammy perhaps, but hopefully it's okay for now */
- if(argv(0) == "help")
+ if(argv(0) == "help")
{
- if(argc == 1)
+ if(argc == 1)
{
sprint(self, "\nClient networked commands:\n");
ClientCommand_macro_help();
-
+
sprint(self, "\nCommon networked commands:\n");
CommonCommand_macro_help(self);
-
+
sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
sprint(self, "For help about a specific command, type cmd help COMMAND\n");
return;
- }
+ }
else if(CommonCommand_macro_usage(argc, self)) // Instead of trying to call a command, we're going to see detailed information about it
{
return;
{
return;
}
- }
+ }
else if(MUTATOR_CALLHOOK(SV_ParseClientCommand))
{
return; // handled by a mutator
}
- else if(CheatCommand(argc))
+ else if(CheatCommand(argc))
{
return; // handled by server/cheats.qc
}
return CLIENT_NOT_REAL;
else if(must_be_bots && !IS_BOT_CLIENT(client))
return CLIENT_NOT_BOT;
-
+
return CLIENT_ACCEPTABLE;
}
entity tmp_player, selection;
float tmp_number, index;
string tmp_string;
-
+
next_token = -1;
index = start_index;
selection = world;
-
+
if(argc > start_index)
{
if(substring(argv(index), 0, 1) == "#")
{
tmp_string = substring(argv(index), 1, -1);
++index;
-
+
if(tmp_string != "") // is it all one token? like #1
{
tmp_number = stof(tmp_string);
tmp_number = stof(argv(index));
++index;
}
-
+
if(VerifyClientNumber(tmp_number))
{
selection = edict_num(tmp_number); // yes, it was a number
FOR_EACH_CLIENT(tmp_player)
if (strdecolorize(tmp_player.netname) == strdecolorize(argv(start_index)))
selection = tmp_player;
-
+
index = (start_index + 1);
}
}
-
+
next_token = index;
//print(strcat("start_index: ", ftos(start_index), ", next_token: ", ftos(next_token), ", edict: ", ftos(num_for_edict(selection)), ".\n"));
return selection;
{
entity tmp_player, selection;
float tmp_number;
-
+
if(substring(input, 0, 1) == "#")
tmp_number = stof(substring(input, 1, -1));
else
tmp_number = stof(input);
-
+
if(VerifyClientNumber(tmp_number))
{
selection = edict_num(tmp_number);
if (strdecolorize(tmp_player.netname) == strdecolorize(input))
selection = tmp_player;
}
-
+
return selection;
}
{
entity selection = GetFilteredEntity(input);
float output;
-
+
output = num_for_edict(selection);
return output;
timeout_caller = world;
timeout_time = 0;
timeout_leadtime = 0;
-
+
remove(self);
}
-void timeout_handler_think()
+void timeout_handler_think()
{
entity tmp_player;
-
+
switch(timeout_status)
{
case TIMEOUT_ACTIVE:
else // time to end the timeout
{
timeout_status = TIMEOUT_INACTIVE;
-
+
// reset the slowmo value back to normal
cvar_set("slowmo", ftos(orig_slowmo));
-
+
// unlock the view for players so they can move around again
- FOR_EACH_REALPLAYER(tmp_player)
+ FOR_EACH_REALPLAYER(tmp_player)
tmp_player.fixangle = FALSE;
-
+
timeout_handler_reset();
}
-
+
return;
}
-
+
case TIMEOUT_LEADTIME:
{
if(timeout_leadtime > 0) // countdown is still going
{
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_BEGINNING, timeout_leadtime);
-
+
self.nextthink = time + 1; // think again in one second
timeout_leadtime -= 1; // decrease the time counter
}
else // time to begin the timeout
{
timeout_status = TIMEOUT_ACTIVE;
-
+
// set the slowmo value to the timeout default slowmo value
cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
-
+
// reset all the flood variables
FOR_EACH_CLIENT(tmp_player)
tmp_player.nickspamcount = tmp_player.nickspamtime = tmp_player.floodcontrol_chat =
- tmp_player.floodcontrol_chatteam = tmp_player.floodcontrol_chattell =
+ tmp_player.floodcontrol_chatteam = tmp_player.floodcontrol_chattell =
tmp_player.floodcontrol_voice = tmp_player.floodcontrol_voiceteam = 0;
-
+
// copy .v_angle to .lastV_angle for every player in order to fix their view during pause (see PlayerPreThink)
- FOR_EACH_REALPLAYER(tmp_player)
+ FOR_EACH_REALPLAYER(tmp_player)
tmp_player.lastV_angle = tmp_player.v_angle;
-
+
self.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code
}
-
+
return;
}
-
-
+
+
case TIMEOUT_INACTIVE:
default:
{
print_to(caller, cvar_changes);
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, cvar_purechanges);
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
}
-void CommonCommand_info(float request, entity caller, float argc)
-{
+void CommonCommand_info(float request, entity caller, float argc)
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
- string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
-
+ string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
+
if(command)
- wordwrap_sprint(command, 1000);
+ wordwrap_sprint(command, 1000);
else
print_to(caller, "ERROR: unsupported info command");
-
+
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, ladder_reply);
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, lsmaps_reply);
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, maplist_reply);
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, rankings_reply);
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
void CommonCommand_records(float request, entity caller)
-{
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
float i;
-
+
for(i = 0; i < 10; ++i)
if(records_reply[i] != "")
print_to(caller, records_reply[i]);
-
+
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
Score_NicePrint(caller);
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, strcat("gmtime = ", strftime(FALSE, "%a %b %e %H:%M:%S %Z %Y")));
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
if (!timeout_status) { print_to(caller, "^7Error: There is no active timeout called."); }
else if(caller && (caller != timeout_caller)) { print_to(caller, "^7Error: You are not allowed to stop the active timeout."); }
-
+
else // everything should be okay, continue aborting timeout
{
switch(timeout_status)
bprint(strcat("^7The timeout was aborted by ", GetCallerName(caller), " !\n"));
return;
}
-
+
case TIMEOUT_ACTIVE:
{
timeout_time = autocvar_sv_timeout_resumetime;
bprint(strcat("^1Attention: ^7", GetCallerName(caller), " resumed the game! Prepare for battle!\n"));
return;
}
-
+
default: dprint("timeout status was inactive, but this code was executed anyway?"); return;
}
}
}
else { print_to(caller, "^1Timeins are not allowed to be called, enable them with sv_timeout 1.\n"); }
-
+
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
if(!caller || autocvar_sv_timeout)
{
float last_possible_timeout = ((autocvar_timelimit * 60) - autocvar_sv_timeout_leadtime - 1);
-
+
if(timeout_status) { print_to(caller, "^7Error: A timeout is already active."); }
else if(vote_called) { print_to(caller, "^7Error: You can not call a timeout while a vote is active."); }
else if(warmup_stage && !g_warmup_allow_timeout) { print_to(caller, "^7Error: You can not call a timeout in warmup-stage."); }
else if(caller && (caller.allowed_timeouts < 1)) { print_to(caller, "^7Error: You already used all your timeout calls for this map."); }
else if(caller && !IS_PLAYER(caller)) { print_to(caller, "^7Error: You must be a player to call a timeout."); }
else if((autocvar_timelimit) && (last_possible_timeout < time - game_starttime)) { print_to(caller, "^7Error: It is too late to call a timeout now!"); }
-
+
else // everything should be okay, proceed with starting the timeout
- {
+ {
if(caller) { caller.allowed_timeouts -= 1; }
-
+
bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(caller.allowed_timeouts), " timeout(s) left)") : ""), "!\n"); // write a bprint who started the timeout (and how many they have left)
-
+
timeout_status = TIMEOUT_LEADTIME;
timeout_caller = caller;
timeout_time = autocvar_sv_timeout_length;
timeout_leadtime = autocvar_sv_timeout_leadtime;
-
+
timeout_handler = spawn();
timeout_handler.think = timeout_handler_think;
timeout_handler.nextthink = time; // always let the entity think asap
}
}
else { print_to(caller, "^1Timeouts are not allowed to be called, enable them with sv_timeout 1.\n"); }
-
+
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
float total_listed_players, is_bot;
entity tmp_player;
-
+
float privacy = (caller && autocvar_sv_status_privacy);
string separator = strreplace("%", " ", strcat((argv(1) ? argv(1) : " "), "^7"));
string tmp_netaddress, tmp_crypto_idfp;
-
+
print_to(caller, strcat("List of client information", (privacy ? " (some data is hidden for privacy)" : ""), ":"));
- print_to(caller, sprintf(strreplace(" ", separator, " %-4s %-20s %-5s %-3s %-9s %-16s %s "),
+ print_to(caller, sprintf(strreplace(" ", separator, " %-4s %-20s %-5s %-3s %-9s %-16s %s "),
"ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
-
+
total_listed_players = 0;
FOR_EACH_CLIENT(tmp_player)
{
is_bot = (IS_BOT_CLIENT(tmp_player));
-
+
if(is_bot)
{
tmp_netaddress = "null/botclient";
tmp_crypto_idfp = tmp_player.crypto_idfp;
}
- print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "),
- num_for_edict(tmp_player),
+ print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "),
+ num_for_edict(tmp_player),
tmp_player.netname,
- tmp_player.ping,
- tmp_player.ping_packetloss,
+ tmp_player.ping,
+ tmp_player.ping_packetloss,
process_time(1, time - tmp_player.jointime),
tmp_netaddress,
tmp_crypto_idfp));
-
+
++total_listed_players;
}
-
+
print_to(caller, strcat("Finished listing ", ftos(total_listed_players), " client(s) out of ", ftos(maxclients), " slots."));
-
+
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
case CMD_REQUEST_COMMAND:
{
-
+
return; // never fall through to usage
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
#define COMMON_COMMAND(name,function,description) \
{ print_to(caller, strcat(" ^2", name, "^7: ", description)); }
-
+
COMMON_COMMANDS(0, caller, 0, "")
#undef COMMON_COMMAND
-
+
return;
}
{
#define COMMON_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
-
+
COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command)
#undef COMMON_COMMAND
-
+
return FALSE;
}
{
#define COMMON_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
-
+
COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "")
#undef COMMON_COMMAND
-
+
return FALSE;
}
{
#define COMMON_COMMAND(name,function,description) \
{ CMD_Write_Alias("qc_cmd_svcmd", name, description); }
-
+
COMMON_COMMANDS(0, world, 0, "")
#undef COMMON_COMMAND
-
+
return;
}
// without using any extra processing time.
// See common.qc for their proper commands
-
+
string getrecords(float page) // 50 records per page
-{
+{
float rec = 0, r, i;
string h, s;
-
+
s = "";
if (g_ctf)
if (MapInfo_Get_ByID(i))
{
r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time")));
-
+
if (!r)
continue;
-
+
// TODO: uid2name
h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/netname"));
s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-6, ftos_decimals(r, 2)), " ", h, "\n");
if (MapInfo_Get_ByID(i))
{
r = race_readTime(MapInfo_Map_bspname, 1);
-
+
if (!r)
continue;
-
+
h = race_readName(MapInfo_Map_bspname, 1);
s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
++rec;
if (MapInfo_Get_ByID(i))
{
r = race_readTime(MapInfo_Map_bspname, 1);
-
+
if (!r)
continue;
-
+
h = race_readName(MapInfo_Map_bspname, 1);
s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
++rec;
for (i = 1; i <= RANKINGS_CNT; ++i)
{
t = race_readTime(map, i);
-
+
if (t == 0)
continue;
-
+
n = race_readName(map, i);
p = count_ordinal(i);
s = strcat(s, strpad(8, p), " ", strpad(-8, TIME_ENCODED_TOSTRING(t)), " ", n, "\n");
{
float i, j, k, uidcnt = 0, thiscnt;
string s, temp_s, rr, myuid, thisuid;
-
+
if(g_cts)
rr = CTS_RECORD;
else
// LADDER_CNT+1 = total points
temp_s = db_get(TemporaryDB, strcat("ladder", myuid));
-
+
if(temp_s == "")
{
db_put(TemporaryDB, strcat("uid", ftos(uidcnt)), myuid);
++uidcnt;
-
+
for(j = 0; j <= LADDER_CNT + 1; ++j)
{
if(j != LADDER_CNT + 1)
top_uids[k] = top_uids[k-1];
top_scores[k] = top_scores[k-1];
}
-
+
top_uids[j] = thisuid;
top_scores[j] = thiscnt;
break;
}
}
}
-
+
s = "^3-----------------------\n\n";
-
+
s = strcat(s, "Pos ^3|");
s = strcat(s, " ^7Total ^3|");
-
+
for(i = 1; i <= LADDER_CNT; ++i)
{ s = strcat(s, " ^7", count_ordinal(i), " ^3|"); }
-
+
s = strcat(s, " ^7Speed awards ^3| ^7Name");
s = strcat(s, "\n^3----+--------");
-
+
for(i = 1; i <= min(9, LADDER_CNT); ++i)
{ s = strcat(s, "+-----"); }
-
+
#if LADDER_CNT > 9
for(i = 1; i <= LADDER_CNT - 9; ++i)
{ s = strcat(s, "+------"); }
{
temp_s = db_get(TemporaryDB, strcat("ladder", top_uids[i]));
tokenize_console(temp_s);
-
+
if(argv(LADDER_CNT+1) == "") // total is 0, skip
continue;
-
+
s = strcat(s, strpad(4, count_ordinal(i+1)), "^3| ^7"); // pos
s = strcat(s, strpad(7, argv(LADDER_CNT+1)), "^3| ^7"); // total
-
+
for(j = 1; j <= min(9, LADDER_CNT); ++j)
{ s = strcat(s, strpad(4, argv(j)), "^3| ^7"); } // 1st, 2nd, 3rd etc cnt
-
+
#if LADDER_CNT > 9
for(j = 10; j <= LADDER_CNT; ++j)
{ s = strcat(s, strpad(4, argv(j)), " ^3| ^7"); } // 1st, 2nd, 3rd etc cnt
{
string maplist = "", col;
float i, argc;
-
+
argc = tokenize_console(autocvar_g_maplist);
for(i = 0; i < argc; ++i)
{
return sprintf("^7Maps in list: %s\n", maplist);
}
-
+
string getlsmaps()
{
string lsmaps = "", col;
float i, newmaps = 0;
-
+
for(i = 0; i < MapInfo_count; ++i)
{
if((MapInfo_Get_ByID(i)) && !(MapInfo_Map_flags & MapInfo_ForbiddenFlags()))
// size: pixel width/height
// maxs: cell width/height
// frame: counter
-
+
float i, x, l;
string si;
float RadarMap_Make(float argc)
{
float i;
-
+
if(!radarmapper)
{
radarmapper = spawn();
case "--resolution": { ++i; radarmapper.size_x = stof(argv(i)); ++i; radarmapper.size_y = stof(argv(i)); break; }
case "--qual": // minor alias
case "--quality": { ++i; radarmapper.size_z = stof(argv(i)); break; }
-
- default:
- i = argc;
+
+ default:
+ i = argc;
remove(radarmapper);
radarmapper = world;
break;
}
}
-
- if(radarmapper) // after doing the arguments, see if we successfully went forward.
+
+ if(radarmapper) // after doing the arguments, see if we successfully went forward.
{
print("Radarmap entity spawned.\n");
return TRUE; // if so, don't print usage.
}
}
-
+
return FALSE;
}
{
entity client;
float accepted;
-
+
string targets = strreplace(",", " ", argv(1));
string original_targets = strreplace(" ", ", ", targets);
string admin_message = argv(2);
float infobartime = stof(argv(3));
-
+
string successful, t;
successful = string_null;
-
+
if((targets) && (admin_message))
{
for(;targets;)
{
t = car(targets); targets = cdr(targets);
-
+
// Check to see if the player is a valid target
client = GetFilteredEntity(t);
accepted = VerifyClientEntity(client, TRUE, FALSE);
-
- if(accepted <= 0)
+
+ if(accepted <= 0)
{
- print("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
+ print("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
continue;
}
-
+
// send the centerprint/console print or infomessage
if(infobartime)
{
centerprint(client, strcat("^3", admin_name(), ":\n^7", admin_message));
sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", admin_message, "\n"));
}
-
+
successful = strcat(successful, (successful ? ", " : ""), client.netname);
dprint("Message sent to ", client.netname, "\n");
continue;
}
-
+
if(successful)
bprint("Successfully sent message '", admin_message, "' to ", successful, ".\n");
else
print("No players given (", original_targets, ") could receive the message.\n");
-
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2adminmsg^7\n");
case CMD_REQUEST_USAGE:
ReadyRestart();
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
void GameCommand_allspec(float request, float argc)
-{
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
entity client;
string reason = argv(1);
float i = 0;
-
+
FOR_EACH_REALPLAYER(client)
{
self = client;
else { print("No players found to spectate.\n"); }
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
}
-void GameCommand_anticheat(float request, float argc)
+void GameCommand_anticheat(float request, float argc)
{
switch(request)
{
{
entity client = GetIndexedEntity(argc, 1);
float accepted = VerifyClientEntity(client, FALSE, FALSE);
-
- if(accepted > 0)
+
+ if(accepted > 0)
{
self = client;
anticheat_report();
}
else
{
- print("anticheat: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ print("anticheat: ", GetClientErrorString(accepted, argv(1)), ".\n");
}
}
-
+
default:
print("Incorrect parameters for ^2anticheat^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_bbox(float request)
+void GameCommand_bbox(float request)
{
switch(request)
{
print(" ", ftos(world.absmax_z));
else
print(" ", ftos(trace_endpos_z));
-
+
print("\n");
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
case CMD_REQUEST_COMMAND:
{
entity bot;
-
+
if(argv(1) == "reset")
{
bot_resetqueues();
print(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
}
}
-
+
default:
print("Incorrect parameters for ^2bot_cmd^7\n");
case CMD_REQUEST_USAGE:
string result1 = (argv(2) ? strcat("^7", argv(1), "^3!\n") : "^1HEADS^3!\n");
string result2 = (argv(2) ? strcat("^7", argv(2), "^3!\n") : "^4TAILS^3!\n");
string choice = ((random() > 0.5) ? result1 : result2);
-
+
FOR_EACH_CLIENT(client)
centerprint(client, strcat("^3Throwing coin... Result: ", choice));
bprint(strcat("^3Throwing coin... Result: ", choice));
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
}
-void GameCommand_database(float request, float argc)
+void GameCommand_database(float request, float argc)
{
switch(request)
{
}
}
}
-
+
default:
print("Incorrect parameters for ^2database^7\n");
case CMD_REQUEST_USAGE:
}
void GameCommand_defer_clear(float request, float argc)
-{
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
entity client;
float accepted;
-
+
if(argc >= 2)
{
client = GetIndexedEntity(argc, 1);
accepted = VerifyClientEntity(client, TRUE, FALSE);
-
+
if(accepted > 0)
{
stuffcmd(client, "defer clear\n");
print("defer clear stuffed to ", client.netname, "\n");
}
else { print("defer_clear: ", GetClientErrorString(accepted, argv(1)), ".\n"); }
-
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2defer_clear^7\n");
case CMD_REQUEST_USAGE:
}
void GameCommand_defer_clear_all(float request)
-{
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
entity client;
float i = 0;
float argc;
-
+
FOR_EACH_CLIENT(client)
{
argc = tokenize_console(strcat("defer_clear ", ftos(num_for_edict(client))));
- GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc);
+ GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc);
++i;
}
- if(i) { print(strcat("Successfully stuffed defer clear to all clients (", ftos(i), ")\n")); } // should a message be added if no players were found?
+ if(i) { print(strcat("Successfully stuffed defer clear to all clients (", ftos(i), ")\n")); } // should a message be added if no players were found?
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
race_deleteTime(GetMapname(), stof(argv(1)));
return;
}
- }
-
+ }
+
default:
print("Incorrect parameters for ^2delrec^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_effectindexdump(float request)
+void GameCommand_effectindexdump(float request)
{
switch(request)
{
{
float fh, d;
string s;
-
+
d = db_create();
print("begin of effects list\n");
db_put(d, "TE_GUNSHOT", "1"); print("effect TE_GUNSHOT is ", ftos(particleeffectnum("TE_GUNSHOT")), "\n");
db_close(d);
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
}
-void GameCommand_extendmatchtime(float request)
+void GameCommand_extendmatchtime(float request)
{
switch(request)
{
changematchtime(autocvar_timelimit_increment * 60, autocvar_timelimit_min * 60, autocvar_timelimit_max * 60);
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
void GameCommand_find(float request, float argc) // is this even needed? We have prvm_edicts command and such ANYWAY
-{
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
entity client;
-
+
for(client = world; (client = find(client, classname, argv(1))); )
print(etos(client), "\n");
-
+
return;
}
-
+
default:
print("Incorrect parameters for ^2find^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_gametype(float request, float argc)
-{
+void GameCommand_gametype(float request, float argc)
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
string s = argv(1);
float t = MapInfo_Type_FromString(s), tsave = MapInfo_CurrentGametype();
-
+
if(t)
{
MapInfo_SwitchGameType(t);
}
else
bprint("Game type switch to ", s, " failed: this type does not exist!\n");
-
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2gametype^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_gettaginfo(float request, float argc)
-{
+void GameCommand_gettaginfo(float request, float argc)
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
entity tmp_entity;
float i;
vector v;
-
+
if(argc >= 4)
{
tmp_entity = spawn();
}
else
print("bone not found\n");
-
+
remove(tmp_entity);
return;
}
}
-
+
default:
print("Incorrect parameters for ^2gettaginfo^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_animbench(float request, float argc)
+void GameCommand_animbench(float request, float argc)
{
switch(request)
{
return;
}
}
-
+
default:
print("Incorrect parameters for ^2gotomap^7\n");
case CMD_REQUEST_USAGE:
}
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
}
-void GameCommand_make_mapinfo(float request)
+void GameCommand_make_mapinfo(float request)
{
switch(request)
{
case CMD_REQUEST_COMMAND:
- {
+ {
entity tmp_entity;
-
+
tmp_entity = spawn();
tmp_entity.classname = "make_mapinfo";
tmp_entity.think = make_mapinfo_Think;
MapInfo_Enumerate();
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
float accepted;
entity client;
-
+
string targets = strreplace(",", " ", argv(1));
string original_targets = strreplace(" ", ", ", targets);
string destination = argv(2);
-
+
string successful, t;
successful = string_null;
-
+
// lets see if the target(s) even actually exist.
if((targets) && (destination))
- {
+ {
for(;targets;)
{
t = car(targets); targets = cdr(targets);
// Check to see if the player is a valid target
client = GetFilteredEntity(t);
accepted = VerifyClientEntity(client, FALSE, FALSE);
-
- if(accepted <= 0)
+
+ if(accepted <= 0)
{
- print("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
+ print("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
continue;
}
-
+
// Where are we putting this player?
- if(destination == "spec" || destination == "spectator")
+ if(destination == "spec" || destination == "spectator")
{
if(!IS_SPEC(client) && !IS_OBSERVER(client))
{
self = client;
PutObserverInServer();
-
+
successful = strcat(successful, (successful ? ", " : ""), client.netname);
}
else
// keep the forcing undone
print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
continue;
- }
+ }
else if(team_id == 0) // auto team
{
team_id = Team_NumberToTeam(FindSmallestTeam(client, FALSE));
CheckAllowedTeams(client);
}
client.team_forced = save;
-
+
// Check to see if the destination team is even available
- switch(team_id)
+ switch(team_id)
{
case NUM_TEAM_1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
case NUM_TEAM_2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
case NUM_TEAM_3: if(c3 == -1) { print("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
case NUM_TEAM_4: if(c4 == -1) { print("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
-
+
default: print("Sorry, can't move player here if team ", destination, " doesn't exist.\n"); return;
}
-
+
// If so, lets continue and finally move the player
client.team_forced = 0;
MoveToTeam(client, team_id, 6);
}
else
{
- print("Can't change teams if the player isn't in the game.\n"); // well technically we could, but should we allow that? :P
+ print("Can't change teams if the player isn't in the game.\n"); // well technically we could, but should we allow that? :P
return;
}
}
}
-
+
if(successful)
bprint("Successfully moved players ", successful, " to destination ", destination, ".\n");
else
print("No players given (", original_targets, ") are able to move.\n");
-
+
return; // still correct parameters so return to avoid usage print
}
}
-
+
default:
print("Incorrect parameters for ^2moveplayer^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_nospectators(float request)
+void GameCommand_nospectators(float request)
{
switch(request)
{
bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds!\n"));
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
}
void GameCommand_playerdemo(float request, float argc)
-{
+{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
entity client;
float i, n, accepted;
-
+
switch(argv(1))
{
case "read":
{
client = GetIndexedEntity(argc, 2);
accepted = VerifyClientEntity(client, FALSE, TRUE);
-
- if(accepted <= 0)
+
+ if(accepted <= 0)
{
- print("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".\n");
+ print("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".\n");
return;
}
-
+
self = client;
playerdemo_open_read(argv(next_token));
return;
}
-
+
case "write":
{
client = GetIndexedEntity(argc, 2);
accepted = VerifyClientEntity(client, FALSE, FALSE);
-
- if(accepted <= 0)
+
+ if(accepted <= 0)
{
- print("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".\n");
+ print("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".\n");
return;
}
-
+
self = client;
playerdemo_open_write(argv(next_token));
return;
}
-
+
case "auto_read_and_write":
{
n = GetFilteredNumber(argv(3));
cvar_set("bot_number", ftos(n));
-
+
localcmd("wait; wait; wait\n");
for(i = 0; i < n; ++i) { localcmd("sv_cmd playerdemo read ", ftos(i+2), " ", argv(2), ftos(i+1), "\n"); }
-
+
localcmd("sv_cmd playerdemo write 1 ", ftos(n+1), "\n");
return;
}
-
+
case "auto_read":
{
n = GetFilteredNumber(argv(3));
cvar_set("bot_number", ftos(n));
-
+
localcmd("wait; wait; wait\n");
for(i = 0; i < n; ++i) { localcmd("sv_cmd playerdemo read ", ftos(i+2), " ", argv(2), ftos(i+1), "\n"); }
return;
}
}
}
-
+
default:
print("Incorrect parameters for ^2playerdemo^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_printstats(float request)
+void GameCommand_printstats(float request)
{
switch(request)
{
print("stats dumped.\n");
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
if(RadarMap_Make(argc))
return;
}
-
+
default:
print("Incorrect parameters for ^2radarmap^7\n");
case CMD_REQUEST_USAGE:
}
}
-void GameCommand_reducematchtime(float request)
+void GameCommand_reducematchtime(float request)
{
switch(request)
{
changematchtime(autocvar_timelimit_decrement *-60, autocvar_timelimit_min * 60, autocvar_timelimit_max * 60);
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
return;
}
}
-
+
default:
print("Incorrect parameters for ^2setbots^7\n");
case CMD_REQUEST_USAGE:
FOR_EACH_PLAYER(tmp_player)
{
CheckAllowedTeams(tmp_player);
-
+
if(c1 >= 0) t_teams = max(1, t_teams);
if(c2 >= 0) t_teams = max(2, t_teams);
if(c3 >= 0) t_teams = max(3, t_teams);
if(c4 >= 0) t_teams = max(4, t_teams);
-
+
++t_players;
}
-
+
// build a list of the players in a random order
FOR_EACH_PLAYER(tmp_player)
{
for(;;)
{
i = bound(1, floor(random() * maxclients) + 1, maxclients);
-
+
if(shuffleteams_players[i])
{
continue; // a player is already assigned to this slot
}
}
- // finally, from the list made earlier, re-join the players in different order.
+ // finally, from the list made earlier, re-join the players in different order.
for(i = 1; i <= t_teams; ++i)
{
// find out how many players to assign to this team
x = (t_players / t_teams);
x = ((i == 1) ? ceil(x) : floor(x));
-
+
team_color = Team_NumberToTeam(i);
-
- // sort through the random list of players made earlier
+
+ // sort through the random list of players made earlier
for(z = 1; z <= maxclients; ++z)
- {
+ {
if (!(shuffleteams_teams[i] >= x))
{
if (!(shuffleteams_players[z]))
continue; // not a player, move on to next random slot
-
+
if(VerifyClientNumber(shuffleteams_players[z]))
self = edict_num(shuffleteams_players[z]);
- if(self.team != team_color)
+ if(self.team != team_color)
MoveToTeam(self, team_color, 6);
shuffleteams_players[z] = 0;
}
}
}
-
+
bprint("Successfully shuffled the players around randomly.\n");
-
+
// clear the buffers now
for (i=0; i<SHUFFLETEAMS_MAX_PLAYERS; ++i)
shuffleteams_players[i] = 0;
-
+
for (i=0; i<SHUFFLETEAMS_MAX_TEAMS; ++i)
shuffleteams_teams[i] = 0;
}
{
print("Can't shuffle teams when currently not playing a team game.\n");
}
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
entity client = GetIndexedEntity(argc, 1);
float accepted = VerifyClientEntity(client, TRUE, FALSE);
-
+
if(accepted > 0)
{
stuffcmd(client, strcat("\n", argv(next_token), "\n"));
print(strcat("Command: \"", argv(next_token), "\" sent to ", GetCallerName(client), " (", argv(1) ,").\n"));
}
else
- print("stuffto: ", GetClientErrorString(accepted, argv(1)), ".\n");
-
+ print("stuffto: ", GetClientErrorString(accepted, argv(1)), ".\n");
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2stuffto^7\n");
case CMD_REQUEST_USAGE:
entity e;
vector org, delta, start, end, p, q, q0, pos, vv, dv;
float i, f, safe, unsafe, dq, dqf;
-
+
switch(argv(1))
{
case "debug":
}
return;
}
-
+
case "debug2":
{
e = nextent(world);
print("highest possible dist: ", ftos(f), "\n");
return;
}
-
+
case "walk":
{
if(argc == 4)
return;
}
}
-
+
case "showline":
{
if(argc == 4)
return;
}
}
-
+
// no default case, just go straight to invalid
}
}
-
+
default:
print("Incorrect parameters for ^2trace^7\n");
case CMD_REQUEST_USAGE:
}
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
CampaignLevelWarp(stof(argv(1)));
print("Successfully warped to campaign level ", stof(argv(1)), ".\n");
- }
+ }
else
{
CampaignLevelWarp(-1);
print("Not in campaign, can't level warp\n");
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
case CMD_REQUEST_COMMAND:
{
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
#define SERVER_COMMAND(name,function,description) \
{ print(" ^2", name, "^7: ", description, "\n"); }
-
+
SERVER_COMMANDS(0, 0, "")
#undef SERVER_COMMAND
-
+
return;
}
{
#define SERVER_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
-
+
SERVER_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
#undef SERVER_COMMAND
-
+
return FALSE;
}
{
#define SERVER_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
-
+
SERVER_COMMANDS(CMD_REQUEST_USAGE, argc, "")
#undef SERVER_COMMAND
-
+
return FALSE;
}
{
#define SERVER_COMMAND(name,function,description) \
{ CMD_Write_Alias("qc_cmd_sv", name, description); }
-
+
SERVER_COMMANDS(0, 0, "")
#undef SERVER_COMMAND
-
+
return;
}
-
+
// =========================================
// Main Function Called By Engine (sv_cmd)
void GameCommand(string command)
{
float argc = tokenize_console(command);
-
+
// Guide for working with argc arguments by example:
// argc: 1 - 2 - 3 - 4
- // argv: 0 - 1 - 2 - 3
+ // argv: 0 - 1 - 2 - 3
// cmd vote - master - login - password
- if(strtolower(argv(0)) == "help")
+ if(strtolower(argv(0)) == "help")
{
- if(argc == 1)
+ if(argc == 1)
{
print("\nServer console commands:\n");
GameCommand_macro_help();
-
+
print("\nBanning commands:\n");
BanCommand_macro_help();
-
+
print("\nCommon networked commands:\n");
CommonCommand_macro_help(world);
-
+
print("\nGeneric commands shared by all programs:\n");
GenericCommand_macro_help();
-
+
print("\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are listed above.\n");
print("For help about a specific command, type sv_cmd help COMMAND\n");
-
+
return;
- }
+ }
else if(BanCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it
{
return;
{
return;
}
- }
- else if(BanCommand(command))
+ }
+ else if(BanCommand(command))
{
return; // handled by server/command/ipban.qc
}
{
return; // handled by server/command/common.qc
}
- else if(GenericCommand(command))
+ else if(GenericCommand(command))
{
return; // handled by common/command/generic.qc
}
{
return; // handled by one of the above GameCommand_* functions
}
-
+
// nothing above caught the command, must be invalid
print(((command != "") ? strcat("Unknown server command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try sv_cmd help.\n");
-
+
return;
}
// Game logic for voting
// =======================
-void VoteReset()
+void VoteReset()
{
entity tmp_player;
vote_called = VOTE_NULL;
vote_caller = world;
vote_endtime = 0;
-
+
vote_called_command = string_null;
vote_called_display = string_null;
-
+
vote_parsed_command = string_null;
vote_parsed_display = string_null;
Nagger_VoteChanged();
}
-void VoteStop(entity stopper)
+void VoteStop(entity stopper)
{
bprint("\{1}^2* ^3", GetCallerName(stopper), "^2 stopped ^3", GetCallerName(vote_caller), "^2's vote\n");
if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vstop:", ftos(stopper.playerid))); }
-
+
// Don't force them to wait for next vote, this way they can e.g. correct their vote.
if((vote_caller) && (stopper == vote_caller)) { vote_caller.vote_waittime = time + autocvar_sv_vote_stop; }
VoteReset();
}
-void VoteAccept()
+void VoteAccept()
{
bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ^1", vote_called_display, "^2 was accepted\n");
-
+
if((vote_called == VOTE_MASTER) && vote_caller)
vote_caller.vote_master = 1;
else
localcmd(strcat(vote_called_command, "\n"));
-
+
if(vote_caller) { vote_caller.vote_waittime = 0; } // people like your votes, you don't need to wait to vote again
VoteReset();
Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_ACCEPT);
}
-void VoteReject()
+void VoteReject()
{
bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ", vote_called_display, "^2 was rejected\n");
VoteReset();
Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_FAIL);
}
-void VoteTimeout()
+void VoteTimeout()
{
bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ", vote_called_display, "^2 timed out\n");
VoteReset();
((mincount >= 0) ? strcat("^2 (^1", ftos(mincount), "^2 needed)") : "^2"),
strcat(", ^1", ftos(vote_abstain_count), "^2 didn't care"),
strcat(", ^1", ftos(notvoters), strcat("^2 didn't ", ((mincount >= 0) ? "" : "have to "), "vote\n"))));
-
+
if(autocvar_sv_eventlog)
{
GameLogEcho(strcat(
}
}
-void VoteCount(float first_count)
+void VoteCount(float first_count)
{
// declarations
vote_accept_count = vote_reject_count = vote_abstain_count = 0;
-
- float spectators_allowed = ((autocvar_sv_vote_nospectators != 2)
+
+ float spectators_allowed = ((autocvar_sv_vote_nospectators != 2)
|| ((autocvar_sv_vote_nospectators == 1) && (warmup_stage || gameover))
|| (autocvar_sv_vote_nospectators == 0));
-
+
float vote_player_count = 0, notvoters = 0;
float vote_real_player_count = 0, vote_real_accept_count = 0;
float vote_real_reject_count = 0, vote_real_abstain_count = 0;
float vote_needed_of_voted, final_needed_votes;
float vote_factor_overall, vote_factor_of_voted;
-
+
entity tmp_player;
Nagger_VoteCountChanged();
-
+
// add up all the votes from each connected client
FOR_EACH_REALCLIENT(tmp_player)
{
++vote_player_count;
if(IS_PLAYER(tmp_player)) { ++vote_real_player_count; }
-
+
switch(tmp_player.vote_selection)
{
case VOTE_SELECT_REJECT: { ++vote_reject_count; { if(IS_PLAYER(tmp_player)) ++vote_real_reject_count; } break; }
default: break;
}
}
-
+
// Check to see if there are enough players on the server to allow master voting... otherwise, vote master could be used for evil.
- if((vote_called == VOTE_MASTER) && autocvar_sv_vote_master_playerlimit > vote_player_count)
+ if((vote_called == VOTE_MASTER) && autocvar_sv_vote_master_playerlimit > vote_player_count)
{
if(vote_caller) { vote_caller.vote_waittime = 0; }
print_to(vote_caller, "^1There are not enough players on this server to allow you to become vote master.");
VoteReset();
return;
}
-
- // if spectators aren't allowed to vote and there are players in a match, then only count the players in the vote and ignore spectators.
+
+ // if spectators aren't allowed to vote and there are players in a match, then only count the players in the vote and ignore spectators.
if(!spectators_allowed && (vote_real_player_count > 0))
{
vote_accept_count = vote_real_accept_count;
vote_abstain_count = vote_real_abstain_count;
vote_player_count = vote_real_player_count;
}
-
+
// people who have no opinion in any way :D
notvoters = (vote_player_count - vote_accept_count - vote_reject_count - vote_abstain_count);
// determine the goal for the vote to be passed or rejected normally
vote_factor_overall = bound(0.5, autocvar_sv_vote_majority_factor, 0.999);
vote_needed_overall = floor((vote_player_count - vote_abstain_count) * vote_factor_overall) + 1;
-
+
// if the vote times out, determine the amount of votes needed of the people who actually already voted
vote_factor_of_voted = bound(0.5, autocvar_sv_vote_majority_factor_of_voted, 0.999);
vote_needed_of_voted = floor((vote_accept_count + vote_reject_count) * vote_factor_of_voted) + 1;
-
+
// are there any players at all on the server? it could be an admin vote
if(vote_player_count == 0 && first_count)
{
- VoteSpam(0, -1, "yes"); // no players at all, just accept it
+ VoteSpam(0, -1, "yes"); // no players at all, just accept it
VoteAccept();
return;
}
-
- // since there ARE players, finally calculate the result of the vote
+
+ // since there ARE players, finally calculate the result of the vote
if(vote_accept_count >= vote_needed_overall)
{
VoteSpam(notvoters, -1, "yes"); // there is enough acceptions to pass the vote
VoteAccept();
return;
}
-
+
if(vote_reject_count > vote_player_count - vote_abstain_count - vote_needed_overall)
{
VoteSpam(notvoters, -1, "no"); // there is enough rejections to deny the vote
VoteReject();
return;
}
-
+
// there is not enough votes in either direction, now lets just calculate what the voters have said
if(time > vote_endtime)
{
final_needed_votes = vote_needed_overall;
-
+
if(autocvar_sv_vote_majority_factor_of_voted)
{
if(vote_accept_count >= vote_needed_of_voted)
VoteAccept();
return;
}
-
+
if(vote_accept_count + vote_reject_count > 0)
{
VoteSpam(notvoters, min(vote_needed_overall, vote_needed_of_voted), "no");
VoteReject();
return;
}
-
+
final_needed_votes = min(vote_needed_overall, vote_needed_of_voted);
}
- // it didn't pass or fail, so not enough votes to even make a decision.
+ // it didn't pass or fail, so not enough votes to even make a decision.
VoteSpam(notvoters, final_needed_votes, "timeout");
VoteTimeout();
}
}
-void VoteThink()
+void VoteThink()
{
if(vote_endtime > 0) // a vote was called
if(time > vote_endtime) // time is up
{
VoteCount(FALSE);
}
-
+
return;
}
}
// Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown is set)
-void ReadyRestart_think()
+void ReadyRestart_think()
{
restart_mapalreadyrestarted = 1;
reset_map(TRUE);
Score_ClearAll();
remove(self);
-
+
return;
}
if (!autocvar_sv_ready_restart_after_countdown) { Score_ClearAll(); }
ReadyRestart_force();
-
+
return;
}
ready_needed_factor = bound(0.5, cvar("g_warmup_majority_factor"), 0.999);
ready_needed_count = floor(t_players * ready_needed_factor) + 1;
-
+
if(readycount >= ready_needed_count)
{
ReadyRestart();
}
-
+
return;
}
float Votecommand_check_assignment(entity caller, float assignment)
{
float from_server = (!caller);
-
- if((assignment == VC_ASGNMNT_BOTH)
- || ((!from_server && assignment == VC_ASGNMNT_CLIENTONLY)
+
+ if((assignment == VC_ASGNMNT_BOTH)
+ || ((!from_server && assignment == VC_ASGNMNT_CLIENTONLY)
|| (from_server && assignment == VC_ASGNMNT_SERVERONLY)))
{
return TRUE;
return FALSE;
}
-string VoteCommand_extractcommand(string input, float startpos, float argc)
+string VoteCommand_extractcommand(string input, float startpos, float argc)
{
string output;
-
+
if((argc - 1) < startpos)
output = "";
else
output = substring(input, argv_start_index(startpos), argv_end_index(-1) - argv_start_index(startpos));
-
+
return output;
}
|| (strstrofs(vote_command, "\r", 0) >= 0)
|| (strstrofs(vote_command, "$", 0) >= 0))
return FALSE;
-
+
return TRUE;
}
float VoteCommand_checkinlist(string vote_command, string list)
{
string l = strcat(" ", list, " ");
-
+
if(strstrofs(l, strcat(" ", vote_command, " "), 0) >= 0)
return TRUE;
-
+
return FALSE;
}
string ValidateMap(string validated_map, entity caller)
{
validated_map = MapInfo_FixName(validated_map);
-
+
if (!validated_map)
{
print_to(caller, "This map is not available on this server.");
return string_null;
}
-
+
if(!autocvar_sv_vote_override_mostrecent && caller)
{
if(Map_IsRecent(validated_map))
return string_null;
}
}
-
+
if(!MapInfo_CheckMap(validated_map))
{
print_to(caller, strcat("^1Invalid mapname, \"^3", validated_map, "^1\" does not support the current game mode."));
float VoteCommand_parse(entity caller, string vote_command, string vote_list, float startpos, float argc)
{
string first_command;
-
+
first_command = argv(startpos);
/*dprint(sprintf("VoteCommand_parse(): Command: '%s', Length: %f.\n",
{
entity victim = GetIndexedEntity(argc, (startpos + 1));
float accepted = VerifyClientEntity(victim, TRUE, FALSE);
-
+
if(accepted > 0)
{
string reason = ((argc > next_token) ? substring(vote_command, argv_start_index(next_token), strlen(vote_command) - argv_start_index(next_token)) : "No reason provided");
string command_arguments;
-
+
if(first_command == "kickban")
command_arguments = strcat(ftos(autocvar_g_ban_default_bantime), " ", ftos(autocvar_g_ban_default_masksize), " ~");
else
command_arguments = reason;
-
+
vote_parsed_command = strcat(first_command, " # ", ftos(num_for_edict(victim)), " ", command_arguments);
vote_parsed_display = strcat("^1", vote_command, " (^7", victim.netname, "^1): ", reason);
}
else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return FALSE; }
-
+
break;
}
-
+
case "map":
case "chmap":
case "gotomap": // re-direct all map selection commands to gotomap
if (!vote_command) { return FALSE; }
vote_parsed_command = strcat("gotomap ", vote_command);
vote_parsed_display = strzone(strcat("^1", vote_parsed_command));
-
+
break;
}
-
- default:
- {
+
+ default:
+ {
vote_parsed_command = vote_command;
vote_parsed_display = strzone(strcat("^1", vote_command));
-
- break;
+
+ break;
}
}
{
if (!vote_called) { print_to(caller, "^1No vote called."); }
else if(caller.vote_selection != VOTE_SELECT_NULL && !autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); }
-
+
else // everything went okay, continue changing vote
{
print_to(caller, "^1You abstained from your vote.");
msg_entity = caller;
if(!autocvar_sv_vote_singlecount) { VoteCount(FALSE); }
}
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
case CMD_REQUEST_COMMAND:
{
- float spectators_allowed = ((autocvar_sv_vote_nospectators != 2)
- || ((autocvar_sv_vote_nospectators == 1) && warmup_stage)
+ float spectators_allowed = ((autocvar_sv_vote_nospectators != 2)
+ || ((autocvar_sv_vote_nospectators == 1) && warmup_stage)
|| (autocvar_sv_vote_nospectators == 0));
-
+
float tmp_playercount = 0;
entity tmp_player;
-
+
vote_command = VoteCommand_extractcommand(vote_command, 2, argc);
-
+
if(!autocvar_sv_vote_call && caller) { print_to(caller, "^1Vote calling is not allowed."); }
else if(!autocvar_sv_vote_gamestart && time < game_starttime) { print_to(caller, "^1Vote calling is not allowed before the match has started."); }
else if(vote_called) { print_to(caller, "^1There is already a vote called."); }
vote_called_command = strzone(vote_parsed_command);
vote_called_display = strzone(vote_parsed_display);
vote_endtime = time + autocvar_sv_vote_timeout;
-
+
if(caller)
{
caller.vote_selection = VOTE_SELECT_ACCEPT;
caller.vote_waittime = time + autocvar_sv_vote_wait;
msg_entity = caller;
}
-
+
FOR_EACH_REALCLIENT(tmp_player) { ++tmp_playercount; }
if(tmp_playercount > 1) { Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_CALL); } // don't announce a "vote now" sound if player is alone
-
+
bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2 calls a vote for ", vote_called_display, "\n");
if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vcall:", ftos(vote_caller.playerid), ":", vote_called_display)); }
Nagger_VoteChanged();
VoteCount(TRUE); // needed if you are the only one
}
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
case "do":
{
vote_command = VoteCommand_extractcommand(vote_command, 3, argc);
-
+
if (!caller.vote_master) { print_to(caller, "^1You do not have vote master privelages."); }
else if (!VoteCommand_checknasty(vote_command)) { print_to(caller, "^1Syntax error in command, see 'vhelp' for more info."); }
else if (!VoteCommand_parse(caller, vote_command, strcat(autocvar_sv_vote_commands, " ", autocvar_sv_vote_master_commands), 3, argc)) { print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info."); }
-
+
else // everything went okay, proceed with command
{
localcmd(strcat(vote_parsed_command, "\n"));
bprint("\{1}^2* ^3", GetCallerName(caller), "^2 used their ^3master^2 status to do \"^2", vote_parsed_display, "^2\".\n");
if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vdo:", ftos(caller.playerid), ":", vote_parsed_display)); }
}
-
+
return;
}
-
+
case "login":
{
if(autocvar_sv_vote_master_password == "") { print_to(caller, "^1Login to vote master is not allowed."); }
bprint("\{1}^2* ^3", GetCallerName(caller), "^2 logged in as ^3master^2\n");
if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vlogin:", ftos(caller.playerid))); }
}
-
+
return;
}
-
+
default: // calling a vote for master
{
- float spectators_allowed = ((autocvar_sv_vote_nospectators != 2)
- || ((autocvar_sv_vote_nospectators == 1) && warmup_stage)
+ float spectators_allowed = ((autocvar_sv_vote_nospectators != 2)
+ || ((autocvar_sv_vote_nospectators == 1) && warmup_stage)
|| (autocvar_sv_vote_nospectators == 0));
-
+
if (!autocvar_sv_vote_master_callable) { print_to(caller, "^1Vote to become vote master is not allowed."); }
else if(vote_called) { print_to(caller, "^1There is already a vote called."); }
else if(!spectators_allowed && (caller && !IS_PLAYER(caller))) { print_to(caller, "^1Only players can call a vote."); }
else if(timeout_status) { print_to(caller, "^1You can not call a vote while a timeout is active."); }
-
+
else // everything went okay, continue with creating vote
{
vote_caller = caller;
vote_called_command = strzone("XXX");
vote_called_display = strzone("^3master");
vote_endtime = time + autocvar_sv_vote_timeout;
-
+
caller.vote_selection = VOTE_SELECT_ACCEPT;
caller.vote_waittime = time + autocvar_sv_vote_wait;
-
+
bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2 calls a vote to become ^3master^2.\n");
if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vcall:", ftos(vote_caller.playerid), ":", vote_called_display)); }
Nagger_VoteChanged();
VoteCount(TRUE); // needed if you are the only one
}
-
+
return;
}
}
}
else { print_to(caller, "^1Master control of voting is not allowed."); }
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
if (!vote_called) { print_to(caller, "^1No vote called."); }
else if(caller.vote_selection != VOTE_SELECT_NULL && !autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); }
else if(((caller == vote_caller) || caller.vote_master) && autocvar_sv_vote_no_stops_vote) { VoteStop(caller); }
-
+
else // everything went okay, continue changing vote
{
print_to(caller, "^1You rejected the vote.");
msg_entity = caller;
if(!autocvar_sv_vote_singlecount) { VoteCount(FALSE); }
}
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, strcat("^7Vote for ", vote_called_display, "^7 called by ^7", GetCallerName(vote_caller), "^7."));
else
print_to(caller, "^1No vote called.");
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
if (!vote_called) { print_to(caller, "^1No vote called."); }
else if((caller == vote_caller) || !caller || caller.vote_master) { VoteStop(caller); }
else { print_to(caller, "^1You are not allowed to stop that vote."); }
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
if (!vote_called) { print_to(caller, "^1No vote called."); }
else if(caller.vote_selection != VOTE_SELECT_NULL && autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); }
-
+
else // everything went okay, continue changing vote
{
print_to(caller, "^1You accepted the vote.");
msg_entity = caller;
if(!autocvar_sv_vote_singlecount) { VoteCount(FALSE); }
}
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
{
case CMD_REQUEST_COMMAND:
{
-
+
return;
}
-
+
default:
case CMD_REQUEST_USAGE:
{
print_to(caller, "\nVoting commands:\n");
#define VOTE_COMMAND(name,function,description,assignment) \
{ if(Votecommand_check_assignment(caller, assignment)) { print_to(caller, strcat(" ^2", name, "^7: ", description)); } }
-
+
VOTE_COMMANDS(0, caller, 0, "")
#undef VOTE_COMMAND
-
+
print_to(caller, strcat("\nUsage:^3 ", command_origin, " vote COMMAND...^7, where possible commands are listed above.\n"));
print_to(caller, strcat("For help about a specific command, type ", command_origin, " vote help COMMAND"));
print_to(caller, strcat("\n^7You can call a vote for or execute these commands: ^3", autocvar_sv_vote_commands, "^7 and maybe further ^3arguments^7"));
{
#define VOTE_COMMAND(name,function,description,assignment) \
{ if(Votecommand_check_assignment(caller, assignment)) { if(name == strtolower(argv(2))) { function; return; } } }
-
+
VOTE_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "")
#undef VOTE_COMMAND
}
-
+
return;
}
{
#define VOTE_COMMAND(name,function,description,assignment) \
{ if(Votecommand_check_assignment(caller, assignment)) { if(name == strtolower(argv(1))) { function; return TRUE; } } }
-
+
VOTE_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, vote_command)
#undef VOTE_COMMAND
-
+
return FALSE;
}
// Main function handling vote commands
// ======================================
-void VoteCommand(float request, entity caller, float argc, string vote_command)
+void VoteCommand(float request, entity caller, float argc, string vote_command)
{
// Guide for working with argc arguments by example:
// argc: 1 - 2 - 3 - 4
- // argv: 0 - 1 - 2 - 3
+ // argv: 0 - 1 - 2 - 3
// cmd vote - master - login - password
-
+
switch(request)
{
case CMD_REQUEST_COMMAND:
if(VoteCommand_macro_command(caller, argc, vote_command))
return;
}
-
+
default:
print_to(caller, strcat(((argv(1) != "") ? strcat("Unknown vote command \"", argv(1), "\"") : "No command provided"), ". For a list of supported commands, try ", GetCommandPrefix(caller), " vote help.\n"));
case CMD_REQUEST_USAGE:
float vote_reject_count; // same as above, but rejected
float vote_abstain_count; // same as above, but abstained
float vote_needed_overall; // total amount of players NEEDED for a vote to pass (based on sv_vote_majority_factor)
-.float vote_master; // flag for if the player has vote master privelages
+.float vote_master; // flag for if the player has vote master privelages
.float vote_waittime; // flag for how long the player must wait before they can vote again
.float vote_selection; // flag for which vote selection the player has made (See VOTE_SELECT_*)
string vote_called_command; // command sent by client
if(sf & 2)
WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
-
+
return 1;
}
void CSQCProjectile(entity e, float clientanimate, float type, float docull)
{
Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
-
+
e.csqcprojectile_clientanimate = clientanimate;
-
+
if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE)
{
if(e.gravity == 0)
float maxclients;
// flag set on worldspawn so that the code knows if it is dedicated or not
-float server_is_dedicated;
+float server_is_dedicated;
// Fields
.float target_random;
.float trigger_reverse;
-// Nexball
+// Nexball
.entity ballcarried; // Also used for keepaway
.float metertime;
float g_nexball_meter_period;
.float last_pickup;
-.float hit_time;
-.float typehit_time;
+.float hit_time;
+.float typehit_time;
.float stat_leadlimit;
)
);
#endif
-
+
// =======
// SUICIDE
// =======
Obituary_SpecialDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
break;
}
-
+
default:
{
Obituary_SpecialDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
GiveFrags(attacker, targ, -1, deathtype);
attacker.killcount = 0;
-
+
Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAG, targ.netname);
Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAGGED, attacker.netname);
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(targ.team, INFO_DEATH_TEAMKILL_), targ.netname, attacker.netname, deathlocation, targ.killcount);
0);
break;
}
-
+
default:
{
Obituary_SpecialDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
{
float mirrordamage;
float mirrorforce;
- float complainteamdamage = 0;
+ float complainteamdamage = 0;
entity attacker_save;
mirrordamage = 0;
mirrorforce = 0;
// exit the vehicle before killing (fixes a crash)
if(IS_PLAYER(targ) && targ.vehicle)
vehicles_exit(VHEF_RELESE);
-
+
// These are ALWAYS lethal
// No damage modification here
// Instead, prepare the victim for his death...
force = force * g_weaponforcefactor;
mirrorforce *= g_weaponforcefactor;
}
-
+
// should this be changed at all? If so, in what way?
frag_attacker = attacker;
frag_target = targ;
damage = frag_damage;
mirrordamage = frag_mirrordamage;
force = frag_force;
-
+
if (!g_minstagib)
{
// apply strength multiplier
if(maxtime > mintime || maxdps > mindps)
{
// Constraints:
-
+
// damage we have right now
mindamage = mindps * mintime;
{
if(self.health <= 0)
return;
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
return; // g_balance_projectiledamage says to halt
-
+
self.health = self.health - damage;
-
+
if (self.health <= 0)
{
if(attacker != self.realowner)
sf |= 0x40;
if(self.lodmodelindex1)
sf |= 0x80;
-
+
WriteByte(MSG_ENTITY, ENT_CLIENT_WALL);
WriteByte(MSG_ENTITY, sf);
void setanim(entity e, vector anim, float looping, float override, float restart)
{
if (!anim)
- return; // no animation was given to us! We can't use this.
-
+ return; // no animation was given to us! We can't use this.
+
if (anim_x == e.animstate_startframe)
if (anim_y == e.animstate_numframes)
if (anim_z == e.animstate_framerate)
// the thinking is now done by the controller
self.think = SUB_NullThink; // for PushMove
self.nextthink = self.ltime + traveltime;
-
+
// invoke controller
self = controller;
self.think();
.float triggerhurttime;
void trigger_hurt_touch()
{
- if (self.active != ACTIVE_ACTIVE)
+ if (self.active != ACTIVE_ACTIVE)
return;
if(self.team)
.float triggerhealtime;
void trigger_heal_touch()
{
- if (self.active != ACTIVE_ACTIVE)
+ if (self.active != ACTIVE_ACTIVE)
return;
-
+
// only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
if (other.iscreature)
{
{
EXACTTRIGGER_TOUCH;
other.triggerhealtime = time + 1;
-
+
if (other.health < self.max_health)
{
other.health = min(other.health + self.health, self.max_health);
void spawnfunc_trigger_heal()
{
self.active = ACTIVE_ACTIVE;
-
+
EXACTTRIGGER_INIT;
self.touch = trigger_heal_touch;
if (!self.health)
setmodel(self, self.model);
if(self.noise != "")
precache_sound (self.noise);
-
+
if(!self.bgmscriptsustain)
self.bgmscriptsustain = 1;
else if(self.bgmscriptsustain < 0)
float pushdeltatime;
float str;
- if (self.active != ACTIVE_ACTIVE)
+ if (self.active != ACTIVE_ACTIVE)
return;
if (!isPushable(other))
{
float pushdeltatime;
- if (self.active != ACTIVE_ACTIVE)
+ if (self.active != ACTIVE_ACTIVE)
return;
if (!isPushable(other))
float pushdeltatime;
float str;
- if (self.active != ACTIVE_ACTIVE)
+ if (self.active != ACTIVE_ACTIVE)
return;
if (!isPushable(other))
// added after this message
// wait: average time between messages
// delay: initial delay before the first message
-
+
float i, n;
self.use = target_voicescript_use;
if(ear.spawnflags & 8)
return msgin;
}
-
+
matchstart = -1;
l = strlen(ear.message);
void relay_activators_use()
{
entity trg, os;
-
+
os = self;
-
+
for(trg = world; (trg = find(trg, targetname, os.target)); )
{
self = trg;
if(os.cnt == ACTIVE_TOGGLE)
if(trg.active == ACTIVE_ACTIVE)
trg.active = ACTIVE_NOT;
- else
+ else
trg.active = ACTIVE_ACTIVE;
else
trg.active = os.cnt;
- }
+ }
}
self = os;
}
void spawnfunc_relay_deactivate()
{
self.cnt = ACTIVE_NOT;
- self.use = relay_activators_use;
+ self.use = relay_activators_use;
}
void spawnfunc_relay_activatetoggle()
{
self.cnt = ACTIVE_TOGGLE;
- self.use = relay_activators_use;
+ self.use = relay_activators_use;
}
.string chmap, gametype;
BADCVAR("g_nix");
BADCVAR("g_grappling_hook");
BADCVAR("g_jetpack");
-
+
#undef BADPREFIX
#undef BADCVAR
PlayerStats_AddGlobalInfo(e);
PlayerStats_Shutdown();
WeaponStats_Shutdown();
-
+
Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now
if(autocvar_sv_eventlog)
* GET g_ban_sync_uri?action=unban&hostname=...&ip=xxx.xxx.xxx
* - Querying the ban list
* GET g_ban_sync_uri?action=list&hostname=...&servers=xxx.xxx.xxx.xxx;xxx.xxx.xxx.xxx;...
- *
+ *
* shows the bans from the listed servers, and possibly others.
* Format of a ban is ASCII plain text, four lines per ban, delimited by
* newline ONLY (no carriage return):
}
if(syncinterval > 0)
syncinterval *= 60;
-
+
if(status != 0)
{
print("error: status is ", ftos(status), "\n");
float argc;
string uri;
float i, n;
-
+
if(autocvar_g_ban_sync_uri == "")
goto killme;
if(autocvar_g_ban_sync_interval == 0) // < 0 is okay, it means "sync on level start only"
for(i = 1; i < argc; ++i)
OnlineBanList_Servers = strcat(OnlineBanList_Servers, ";", argv(i));
OnlineBanList_Servers = strzone(OnlineBanList_Servers);
-
+
uri = strcat( "action=list&hostname=", uri_escape(autocvar_hostname));
uri = strcat(uri, "&servers=", uri_escape(OnlineBanList_Servers));
else
uri_get(strcat(argv(i), "?", uri), URI_GET_IPBAN + i); // 1000 = "banlist" callback target
}
-
+
if(autocvar_g_ban_sync_interval > 0)
self.nextthink = time + max(60, autocvar_g_ban_sync_interval * 60);
else
{
float i, n;
string msg;
-
+
print("^2Listing all existing active bans:\n");
-
+
n = 0;
for(i = 0; i < ban_count; ++i)
{
if(time > ban_expire[i])
continue;
-
+
++n; // total number of existing bans
-
+
msg = strcat("#", ftos(i), ": ");
msg = strcat(msg, ban_ip[i], " is still banned for ");
msg = strcat(msg, ftos(ban_expire[i] - time), " seconds");
-
+
print(" ", msg, "\n");
}
-
+
print("^2Done listing all active (", ftos(n), ") bans.\n");
}
i4 = strstrofs(s, ".", i3 + 1);
if(i4 >= 0)
s = substring(s, 0, i4);
-
+
ban_ip1 = substring(s, 0, i1); // 8
ban_ip2 = substring(s, 0, i2); // 16
ban_ip3 = substring(s, 0, i3); // 24
float item_keys_usekey(entity l, entity p) {
float valid = l.itemkeys & p.itemkeys;
-
+
if (!valid) {
// other has none of the needed keys
return FALSE;
string item_keys_keylist(float keylist) {
float base, l;
string n;
-
+
// no keys
if (!keylist)
return "";
-
+
// one key
if ((keylist & (keylist-1)) != 0)
return strcat("the ", item_keys_names[lowestbit(keylist)]);
-
+
n = "";
base = 0;
while (keylist) {
n = strcat(n, ", the ", item_keys_names[base + l]);
else
n = strcat("the ", item_keys_names[base + l]);
-
+
keylist = bitshift(keylist, -(l + 1));
base+= l + 1;
}
-
+
return n;
}
void item_key_touch(void) {
if (!IS_PLAYER(other))
return;
-
+
// player already picked up this key
if (other.itemkeys & self.itemkeys)
return;
-
+
other.itemkeys |= self.itemkeys;
play2(other, self.noise);
-
+
centerprint(other, self.message);
};
*/
void spawn_item_key() {
precache_model(self.model);
-
+
if (self.spawnflags & 1) // FLOATING
self.noalign = 1;
-
+
if (self.noalign)
self.movetype = MOVETYPE_NONE;
else
self.movetype = MOVETYPE_TOSS;
-
+
precache_sound(self.noise);
-
+
self.mdl = self.model;
self.effects = EF_LOWPRECISION;
setmodel(self, self.model);
setsize(self, '-16 -16 -56', '16 16 0');
self.modelflags |= MF_ROTATE;
self.solid = SOLID_TRIGGER;
-
+
if (!self.noalign)
{
// first nudge it off the floor a little bit to avoid math errors
/*QUAKED item_key (0 .5 .8) (-16 -16 -24) (16 16 32) FLOATING
A key entity.
The itemkeys should contain one of the following key IDs:
-1 - GOLD key -
+1 - GOLD key -
2 - SILVER key
4 - BRONZE key
8 - RED keycard
void spawnfunc_item_key() {
local string _model, _netname;
local vector _colormod;
-
+
// reject this entity if more than one key was set!
if (self.itemkeys>0 && (self.itemkeys & (self.itemkeys-1)) != 0) {
objerror("item_key.itemkeys must contain only 1 bit set specifying the key it represents!");
_netname = "GOLD key";
_colormod = '1 .9 0';
break;
-
+
case 2:
_netname = "SILVER key";
_colormod = '.9 .9 .9';
break;
-
+
case 4:
_netname = "BRONZE key";
_colormod = '.6 .25 0';
break;
-
+
case 8:
_netname = "RED keycard";
_colormod = '.9 0 0';
break;
-
+
case 16:
_netname = "BLUE keycard";
_colormod = '0 0 .9';
break;
-
+
case 32:
_netname = "GREEN keycard";
_colormod = '0 .9 0';
break;
-
+
default:
_netname = "FLUFFY PINK keycard";
_colormod = '1 1 1';
return;
}
break;
-
+
}
-
+
// find default model
#ifdef GMQCC
_model = string_null;
remove(self);
return;
}
-
+
// set defailt netname
if (self.netname == "")
self.netname = _netname;
-
+
// set default colormod
if (!self.colormod)
self.colormod = _colormod;
-
+
// set default model
if (self.model == "")
self.model = _model;
-
+
// set default pickup message
if (self.message == "")
self.message = strzone(strcat("You've picked up the ", self.netname, "!"));
if (self.noise == "")
self.noise = "misc/itempickup.wav";
-
+
// save the name for later
item_keys_names[lowestbit(self.itemkeys)] = self.netname;
- // put the key on the map
+ // put the key on the map
spawn_item_key();
}
*/
void trigger_keylock_trigger(string s) {
local entity t, stemp, otemp, atemp;
-
+
stemp = self;
otemp = other;
atemp = activator;
-
-
+
+
for(t = world; (t = find(t, targetname, s)); )
if (t.use) {
self = t;
activator = atemp;
self.use();
}
-
+
self = stemp;
other = otemp;
activator = atemp;
void trigger_keylock_touch(void) {
local float key_used, started_delay;
-
+
key_used = FALSE;
started_delay = FALSE;
-
+
// only player may trigger the lock
if (!IS_PLAYER(other))
return;
-
-
+
+
// check silver key
if (self.itemkeys)
key_used = item_keys_usekey(self, other);
-
+
activator = other;
-
+
if (self.itemkeys) {
// at least one of the keys is missing
if (key_used) {
centerprint(other, strcat("You need ", item_keys_keylist(self.itemkeys), "!"));
other.key_door_messagetime = time + 2;
}
-
+
// trigger target2
if (self.delay <= time || started_delay == TRUE)
if (self.target2) {
// all keys were given!
play2(other, self.noise);
centerprint(other, self.message);
-
+
if (self.target)
trigger_keylock_trigger(self.target);
-
+
if (self.killtarget)
trigger_keylock_kill(self.killtarget);
-
+
remove(self);
}
-
+
};
/*QUAKED trigger_keylock (.0 .5 .8) ?
return;
}
- // set unlocked message
+ // set unlocked message
if (self.message == "")
self.message = "Unlocked!";
-
+
// set default unlock noise
if (self.noise == "") {
if (self.sounds == 1)
else //if (self.sounds == 3) {
self.noise = "misc/trigger1.wav";
}
-
+
// set default use key sound
if (self.noise1 == "")
self.noise1 = "misc/decreasevalue.wav";
-
+
// set closed sourd
if (self.noise2 == "")
self.noise2 = "misc/talk.wav";
-
+
// delay between triggering message2 and trigger2
if (!self.wait)
self.wait = 5;
-
+
// precache sounds
precache_sound(self.noise);
precache_sound(self.noise1);
precache_sound(self.noise2);
-
+
EXACTTRIGGER_INIT;
-
+
self.touch = trigger_keylock_touch;
};
d = 0; // weapon is set a few lines later
else
d = (i == WEP_LASER || i == WEP_SHOTGUN);
-
+
if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook
d |= (i == WEP_HOOK);
if(weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED) // never default mutator blocked guns
d = 0;
var float t = cvar(strcat(cvarprefix, weaponinfo.netname));
-
+
//print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n"));
-
+
// bit order in t:
// 1: want or not
// 2: is default?
if(!cvar("g_use_ammunition"))
start_items |= IT_UNLIMITED_AMMO;
-
+
if(start_items & IT_UNLIMITED_WEAPON_AMMO)
{
start_ammo_rockets = 999;
// load mutators
#define CHECK_MUTATOR_ADD(mut_cvar,mut_name,dependence) \
{ if(cvar(mut_cvar) && dependence) { MUTATOR_ADD(mut_name); } }
-
+
CHECK_MUTATOR_ADD("g_dodging", mutator_dodging, 1);
CHECK_MUTATOR_ADD("g_spawn_near_teammate", mutator_spawn_near_teammate, 1);
CHECK_MUTATOR_ADD("g_physical_items", mutator_physical_items, 1);
CHECK_MUTATOR_ADD("g_nades", mutator_nades, 1);
CHECK_MUTATOR_ADD("g_sandbox", sandbox, 1);
CHECK_MUTATOR_ADD("g_campcheck", mutator_campcheck, 1);
-
+
#undef CHECK_MUTATOR_ADD
-
+
if(cvar("sv_allow_fullbright"))
serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
g_bugrigs_speed_ref = cvar("g_bugrigs_speed_ref");
g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
g_bugrigs_steer = cvar("g_bugrigs_steer");
-
+
g_minstagib = cvar("g_minstagib");
sv_clones = cvar("sv_clones");
db_put(ServerProgsDB, strcat("uid2name", myuid), "");
}
}
-
+
if(s == "")
s = "^1Unregistered Player";
return s;
-#ifdef SVQC
+#ifdef SVQC
.vector moveto;
/**
entity frag_attacker;
entity frag_target; // same as self
float frag_deathtype;
-
+
MUTATOR_HOOKABLE(PlayerJump);
// called when a player presses the jump key
// INPUT, OUTPUT:
// appends ", Mutator name" to ret_string for display
// INPUT, OUTPUT:
string ret_string;
-
+
MUTATOR_HOOKABLE(CustomizeWaypoint);
// called every frame
// customizes the waypoint for spectators
MUTATOR_HOOKABLE(TurretSpawn);
// return error to request removal
// INPUT: self - turret
-
+
MUTATOR_HOOKABLE(OnEntityPreSpawn);
// return error to prevent entity spawn, or modify the entity
// INPUT, OUTPUT:
float damage_take;
float damage_save;
-
+
MUTATOR_HOOKABLE(PlayerDamage_Calculate);
// called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
// i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
// called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items.
// INPUT
entity self;
- float olditems; // also technically output, but since it is at the end of the function it's useless for that :P
+ float olditems; // also technically output, but since it is at the end of the function it's useless for that :P
MUTATOR_HOOKABLE(PlayerUseKey);
// called when the use key is pressed
MUTATOR_HOOKABLE(SetModname);
// OUT
string modname; // name of the mutator/mod if it warrants showing as such in the server browser
-
+
MUTATOR_HOOKABLE(Item_Spawn);
// called for each item being spawned on a map, including dropped weapons
// return 1 to remove an item
entity other; // weapon info
// IN+OUT
string ret_string;
-
+
MUTATOR_HOOKABLE(Item_RespawnCountdown);
// called when an item is about to respawn
// INPUT+OUTPUT:
string item_name;
vector item_color;
-
+
MUTATOR_HOOKABLE(BotShouldAttack);
// called when a bot checks a target to attack
// INPUT
// allows you to strip a player of an item if they go through the teleporter to help prevent cheating
// INPUT
entity self;
-
+
MUTATOR_HOOKABLE(HelpMePing);
// called whenever a player uses impulse 33 (help me) in cl_impulse.qc
// normally help me ping uses self.waypointsprite_attachedforcarrier,
// in a special manner using this hook
// INPUT
entity self; // the player who pressed impulse 33
-
+
MUTATOR_HOOKABLE(VehicleSpawn);
// called when a vehicle initializes
// return TRUE to remove the vehicle
-
+
MUTATOR_HOOKABLE(VehicleEnter);
// called when a player enters a vehicle
// allows mutators to set special settings in this event
// INPUT
entity vh_player; // player
entity vh_vehicle; // vehicle
-
+
MUTATOR_HOOKABLE(VehicleTouch);
// called when a player touches a vehicle
// return TRUE to stop player from entering the vehicle
// INPUT
entity self; // vehicle
entity other; // player
-
+
MUTATOR_HOOKABLE(VehicleExit);
// called when a player exits a vehicle
// allows mutators to set special settings in this event
// INPUT
entity vh_player; // player
entity vh_vehicle; // vehicle
-
+
MUTATOR_HOOKABLE(AbortSpeedrun);
// called when a speedrun is aborted and the player is teleported back to start position
// INPUT
if(autocvar_g_powerups <= 0)
if(self.flags & FL_POWERUP)
return TRUE;
-
+
return FALSE;
}
void spawnfunc_info_player_attacker()
{
if (!g_assault) { remove(self); return; }
-
+
self.team = NUM_TEAM_1; // red, gets swapped every round
spawnfunc_info_player_deathmatch();
}
void spawnfunc_info_player_defender()
{
if (!g_assault) { remove(self); return; }
-
+
self.team = NUM_TEAM_2; // blue, gets swapped every round
spawnfunc_info_player_deathmatch();
}
void spawnfunc_target_objective()
{
if (!g_assault) { remove(self); return; }
-
+
self.classname = "target_objective";
self.use = assault_objective_use;
assault_objective_reset();
void spawnfunc_func_assault_destructible()
{
if (!g_assault) { remove(self); return; }
-
+
self.spawnflags = 3;
self.classname = "func_assault_destructible";
-
+
if(assault_attacker_team == NUM_TEAM_1)
self.team = NUM_TEAM_2;
else
void spawnfunc_func_assault_wall()
{
if (!g_assault) { remove(self); return; }
-
+
self.classname = "func_assault_wall";
self.mdl = self.model;
setmodel(self, self.mdl);
void spawnfunc_target_assault_roundstart()
{
if (!g_assault) { remove(self); return; }
-
+
assault_attacker_team = NUM_TEAM_1;
self.classname = "target_assault_roundstart";
self.use = assault_roundstart_use;
centerprint(self, "You are attacking!");
else
centerprint(self, "You are defending!");
-
+
return FALSE;
}
MUTATOR_HOOK(TurretSpawn, assault_TurretSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(VehicleSpawn, assault_VehicleSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(HavocBot_ChooseRule, assault_BotRoles, CBC_ORDER_ANY);
-
+
MUTATOR_ONADD
{
if(time > 1) // game loads at time 1
start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
start_ammo_cells = cvar("g_lms_start_ammo_cells");
start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
-
+
start_items &= ~IT_UNLIMITED_AMMO;
return 0;
if(frag_target.deadflag == DEAD_NO)
if(frag_target == frag_attacker || SAME_TEAM(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL)
frag_damage = 0;
-
+
frag_mirrordamage = 0;
-
+
return FALSE;
}
if(autocvar_g_powerups <= 0)
if(self.flags & FL_POWERUP)
return TRUE;
-
+
if(autocvar_g_pickup_items <= 0)
return TRUE;
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(ca_PlayerDamage_SplitHealthArmor)
{
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);
-
+
return FALSE;
}
float cap_record = ctf_captimerecord;
float cap_time = (time - flag.ctf_pickuptime);
string refername = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"));
-
+
// notify about shit
if(!ctf_captimerecord) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_2(flag, CHOICE_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
else if(cap_time < cap_record) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_2(flag, CHOICE_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
else { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_2(flag, CHOICE_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-
+
// write that shit in the database
if((!ctf_captimerecord) || (cap_time < cap_record))
{
ctf_captimerecord = cap_time;
db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(cap_time));
db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), player.netname);
- write_recordmarker(player, (time - cap_time), cap_time);
- }
+ write_recordmarker(player, (time - cap_time), cap_time);
+ }
}
void ctf_FlagcarrierWaypoints(entity player)
float ang; // angle between shotdir and h
float h; // hypotenuse, which is the distance between attacker to head
float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
-
+
h = vlen(head_center - passer_center);
ang = acos(dotproduct(normalize(head_center - passer_center), v_forward));
a = h * cos(ang);
// =======================
-// CaptureShield Functions
+// CaptureShield Functions
// =======================
-float ctf_CaptureShield_CheckStatus(entity p)
+float ctf_CaptureShield_CheckStatus(entity p)
{
float s, se;
entity e;
// player is in the worse half, if >= half the players are better than him, or consequently, if < half of the players are worse
// use this rule here
-
+
if(players_worseeq >= players_total * ctf_captureshield_max_ratio)
return FALSE;
{
if(!other.ctf_captureshielded) { return FALSE; }
if(SAME_TEAM(self, other)) { return FALSE; }
-
+
return TRUE;
}
{
if(!other.ctf_captureshielded) { return; }
if(SAME_TEAM(self, other)) { return; }
-
+
vector mymid = (self.absmin + self.absmax) * 0.5;
vector othermid = (other.absmin + other.absmax) * 0.5;
void ctf_CaptureShield_Spawn(entity flag)
{
entity shield = spawn();
-
+
shield.enemy = self;
shield.team = self.team;
shield.touch = ctf_CaptureShield_Touch;
shield.solid = SOLID_TRIGGER;
shield.avelocity = '7 0 11';
shield.scale = 0.5;
-
+
setorigin(shield, self.origin);
setmodel(shield, "models/ctf/shield.md3");
setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs);
flag.ctf_droptime = time;
flag.ctf_dropper = player;
flag.ctf_status = FLAG_DROPPED;
-
+
// messages and sounds
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_LOST_), player.netname);
sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE);
ctf_EventLog("dropped", player.team, player);
// scoring
- PlayerTeamScore_AddScore(player, -autocvar_g_ctf_score_penalty_drop);
+ PlayerTeamScore_AddScore(player, -autocvar_g_ctf_score_penalty_drop);
PlayerScore_Add(player, SP_CTF_DROPS, 1);
-
+
// waypoints
if(autocvar_g_ctf_flag_dropped_waypoint)
WaypointSprite_Spawn("flagdropped", 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, TRUE, RADARICON_FLAG, WPCOLOR_DROPPEDFLAG(flag.team));
WaypointSprite_UpdateMaxHealth(flag.wps_flagdropped, flag.max_flag_health);
WaypointSprite_UpdateHealth(flag.wps_flagdropped, flag.health);
}
-
+
player.throw_antispam = time + autocvar_g_ctf_pass_wait;
-
+
if(droptype == DROP_PASS)
{
flag.pass_distance = 0;
{
entity tmp_player; // temporary entity which the FOR_EACH_PLAYER loop uses to scan players
entity sender = flag.pass_sender;
-
+
// transfer flag to player
flag.owner = player;
flag.owner.flagcarried = flag;
-
+
// reset flag
setattachment(flag, player, "");
setorigin(flag, FLAG_CARRY_OFFSET);
// messages and sounds
sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM);
ctf_EventLog("receive", flag.team, player);
-
+
FOR_EACH_REALPLAYER(tmp_player)
{
if(tmp_player == sender)
else if(SAME_TEAM(tmp_player, sender))
Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_OTHER_), sender.netname, player.netname);
}
-
+
// create new waypoint
ctf_FlagcarrierWaypoints(player);
-
+
sender.throw_antispam = time + autocvar_g_ctf_pass_wait;
player.throw_antispam = sender.throw_antispam;
{
entity flag = player.flagcarried;
vector targ_origin, flag_velocity;
-
+
if(!flag) { return; }
if((droptype == DROP_PASS) && !receiver) { return; }
-
+
if(flag.speedrunning) { ctf_RespawnFlag(flag); return; }
-
+
// reset the flag
setattachment(flag, world, "");
setorigin(flag, player.origin + FLAG_DROP_OFFSET);
flag.solid = SOLID_TRIGGER;
flag.ctf_dropper = player;
flag.ctf_droptime = time;
-
+
flag.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND for MOVETYPE_TOSS
-
+
switch(droptype)
{
case DROP_PASS:
flag.pass_sender = player;
flag.pass_target = receiver;
flag.ctf_status = FLAG_PASSING;
-
+
// other
sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTEN_NORM);
WarpZone_TrailParticles(world, particleeffectnum(flag.passeffect), player.origin, targ_origin);
ctf_EventLog("pass", flag.team, player);
break;
}
-
+
case DROP_THROW:
{
makevectors((player.v_angle_y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle_x, autocvar_g_ctf_throw_angle_max) * '1 0 0'));
-
+
flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & IT_STRENGTH) ? autocvar_g_ctf_throw_strengthmultiplier : 1)));
flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, FALSE);
ctf_Handle_Drop(flag, player, droptype);
break;
}
-
+
case DROP_RESET:
{
flag.velocity = '0 0 0'; // do nothing
break;
}
-
+
default:
case DROP_NORMAL:
{
// kill old waypointsprite
WaypointSprite_Ping(player.wps_flagcarrier);
WaypointSprite_Kill(player.wps_flagcarrier);
-
+
if(player.wps_enemyflagcarrier)
WaypointSprite_Kill(player.wps_enemyflagcarrier);
-
+
// captureshield
ctf_CaptureShield_Update(player, 0); // shield player from picking up flag
}
{
entity enemy_flag = ((capturetype == CAPTURE_NORMAL) ? toucher.flagcarried : toucher);
entity player = ((capturetype == CAPTURE_NORMAL) ? toucher : enemy_flag.ctf_dropper);
- float old_time, new_time;
-
+ float old_time, new_time;
+
if (!player) { return; } // without someone to give the reward to, we can't possibly cap
-
+
// messages and sounds
Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_2(enemy_flag, CENTER_CTF_CAPTURE_));
ctf_CaptureRecord(enemy_flag, player);
sound(player, CH_TRIGGER, flag.snd_flag_capture, VOL_BASE, ATTEN_NONE);
-
+
switch(capturetype)
{
case CAPTURE_NORMAL: ctf_EventLog("capture", enemy_flag.team, player); break;
case CAPTURE_DROPPED: ctf_EventLog("droppedcapture", enemy_flag.team, player); break;
default: break;
}
-
+
// scoring
PlayerTeamScore_AddScore(player, autocvar_g_ctf_score_capture);
PlayerTeamScore_Add(player, SP_CTF_CAPS, ST_CTF_CAPS, 1);
{
WaypointSprite_Kill(player.wps_flagcarrier);
if(flag.speedrunning) { ctf_FakeTimeLimit(player, -1); }
-
+
if((enemy_flag.ctf_dropper) && (player != enemy_flag.ctf_dropper))
{ PlayerTeamScore_AddScore(enemy_flag.ctf_dropper, autocvar_g_ctf_score_capture_assist); }
}
-
+
// reset the flag
player.next_take_time = time + autocvar_g_ctf_flag_collect_delay;
ctf_RespawnFlag(enemy_flag);
PlayerScore_Add(player, SP_CTF_RETURNS, 1); // add to count of returns
TeamScore_AddToTeam(flag.team, ST_SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the team who was last carrying it
-
- if(flag.ctf_dropper)
+
+ if(flag.ctf_dropper)
{
PlayerScore_Add(flag.ctf_dropper, SP_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
+ 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
}
-
+
// reset the flag
ctf_RespawnFlag(flag);
}
{
// declarations
float pickup_dropped_score; // used to calculate dropped pickup score
-
+
// attach the flag to the player
flag.owner = player;
player.flagcarried = flag;
setattachment(flag, player, "");
setorigin(flag, FLAG_CARRY_OFFSET);
-
+
// flag setup
flag.movetype = MOVETYPE_NONE;
flag.takedamage = DAMAGE_NO;
flag.solid = SOLID_NOT;
flag.angles = '0 0 0';
flag.ctf_status = FLAG_CARRY;
-
+
switch(pickuptype)
{
case PICKUP_BASE: flag.ctf_pickuptime = time; break; // used for timing runs
}
// messages and sounds
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_PICKUP_), player.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_PICKUP_), player.netname);
Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PICKUP_));
if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
-
+
Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, CHOICE_CTF_PICKUP_TEAM, Team_ColorCode(player.team), player.netname);
Send_Notification(NOTIF_TEAM, flag, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY, Team_ColorCode(player.team), player.netname);
-
+
sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
-
+
// scoring
PlayerScore_Add(player, SP_CTF_PICKUPS, 1);
switch(pickuptype)
- {
+ {
case PICKUP_BASE:
{
PlayerTeamScore_AddScore(player, autocvar_g_ctf_score_pickup_base);
ctf_EventLog("steal", flag.team, player);
break;
}
-
+
case PICKUP_DROPPED:
{
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);
ctf_EventLog("pickup", flag.team, player);
break;
}
-
+
default: break;
}
-
+
// speedrunning
if(pickuptype == PICKUP_BASE)
{
if((player.speedrunning) && (ctf_captimerecord))
ctf_FakeTimeLimit(player, time + ctf_captimerecord);
}
-
+
// effects
pointparticles(particleeffectnum(flag.toucheffect), player.origin, '0 0 0', 1);
-
- // waypoints
+
+ // waypoints
if(pickuptype == PICKUP_DROPPED) { WaypointSprite_Kill(flag.wps_flagdropped); }
ctf_FlagcarrierWaypoints(player);
WaypointSprite_Ping(player.wps_flagcarrier);
if((flag.ctf_status == FLAG_DROPPED) || (flag.ctf_status == FLAG_PASSING))
{
if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, flag.health); }
-
+
if((flag.health <= 0) || (time >= flag.ctf_droptime + autocvar_g_ctf_flag_return_time))
{
switch(returntype)
case RETURN_DAMAGE: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_DAMAGED_)); break;
case RETURN_SPEEDRUN: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_SPEEDRUN_), ctf_captimerecord); break;
case RETURN_NEEDKILL: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_NEEDKILL_)); break;
-
+
default:
case RETURN_TIMEOUT:
{ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_TIMEOUT_)); break; }
{
tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
ctf_staleflaglist = tmp_entity;
-
+
switch(tmp_entity.team)
{
case NUM_TEAM_1: ++stale_red_flags; break;
{ ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
else if((!stale_red_flags || !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 1)
{ ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
-
+
// if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
if(ctf_stalemate)
{
if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier))
WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, tmp_entity.team, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
}
-
+
if (!wpforenemy_announced)
{
FOR_EACH_REALPLAYER(tmp_entity)
Send_Notification(NOTIF_ONE, tmp_entity, MSG_CENTER, ((tmp_entity.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER));
-
+
wpforenemy_announced = TRUE;
}
}
ctf_CheckFlagReturn(self, RETURN_NEEDKILL);
return;
}
- if(autocvar_g_ctf_flag_return_damage)
+ if(autocvar_g_ctf_flag_return_damage)
{
// reduce health and check if it should be returned
self.health = self.health - damage;
tracebox(self.origin, FLAG_MIN, FLAG_MAX, self.origin, MOVE_NOMONSTERS, self);
if(!trace_startsolid) // can we resize it without getting stuck?
setsize(self, FLAG_MIN, FLAG_MAX); }
-
+
switch(self.ctf_status) // reset flag angles in case warpzones adjust it
{
case FLAG_DROPPED:
self.angles = '0 0 0';
break;
}
-
+
default: break;
}
// main think method
switch(self.ctf_status)
- {
+ {
case FLAG_BASE:
{
if(autocvar_g_ctf_dropped_capture_radius)
}
return;
}
-
+
case FLAG_DROPPED:
{
if(autocvar_g_ctf_flag_dropped_floatinwater)
if(pointcontents(midpoint) == CONTENT_WATER)
{
self.velocity = self.velocity * 0.5;
-
+
if(pointcontents(midpoint + FLAG_FLOAT_OFFSET) == CONTENT_WATER)
{ self.velocity_z = autocvar_g_ctf_flag_dropped_floatinwater; }
else
self.health -= ((self.max_flag_health / autocvar_g_ctf_flag_return_time) * FLAG_THINKRATE);
ctf_CheckFlagReturn(self, RETURN_TIMEOUT);
return;
- }
+ }
return;
}
-
+
case FLAG_CARRY:
{
- if(self.speedrunning && ctf_captimerecord && (time >= self.ctf_pickuptime + ctf_captimerecord))
+ if(self.speedrunning && ctf_captimerecord && (time >= self.ctf_pickuptime + ctf_captimerecord))
{
self.health = 0;
ctf_CheckFlagReturn(self, RETURN_SPEEDRUN);
}
return;
}
-
+
case FLAG_PASSING:
{
vector targ_origin = ((self.pass_target.absmin + self.pass_target.absmax) * 0.5);
targ_origin = WarpZone_RefSys_TransformOrigin(self.pass_target, self, targ_origin); // origin of target as seen by the flag (us)
WarpZone_TraceLine(self.origin, targ_origin, MOVE_NOMONSTERS, self);
-
+
if((self.pass_target == world)
|| (self.pass_target.deadflag != DEAD_NO)
|| (vlen(self.origin - targ_origin) > autocvar_g_ctf_pass_radius)
void ctf_FlagTouch()
{
if(gameover) { return; }
-
+
entity toucher = other;
-
+
// automatically kill the flag and return it if it touched lava/slime/nodrop surfaces
if(ITEM_TOUCH_NEEDKILL())
{
ctf_CheckFlagReturn(self, RETURN_NEEDKILL);
return;
}
-
+
// special touch behaviors
if(toucher.vehicle_flags & VHF_ISVEHICLE)
{
}
else if(toucher.deadflag != DEAD_NO) { return; }
- switch(self.ctf_status)
- {
+ switch(self.ctf_status)
+ {
case FLAG_BASE:
{
if(SAME_TEAM(toucher, self) && (toucher.flagcarried) && DIFF_TEAM(toucher.flagcarried, self))
ctf_Handle_Pickup(self, toucher, PICKUP_BASE); // toucher just stole the enemies flag
break;
}
-
+
case FLAG_DROPPED:
{
if(SAME_TEAM(toucher, self))
ctf_Handle_Pickup(self, toucher, PICKUP_DROPPED); // toucher just picked up a dropped enemy flag
break;
}
-
+
case FLAG_CARRY:
{
dprint("Someone touched a flag even though it was being carried?\n");
break;
}
-
+
case FLAG_PASSING:
{
if((IS_PLAYER(toucher)) && (toucher.deadflag == DEAD_NO) && (toucher != self.pass_sender))
{ backtrace("flag respawn called twice quickly! please notify Samual about this..."); }
flag.last_respawn = time;
-
+
// reset the player (if there is one)
if((flag.owner) && (flag.owner.flagcarried == flag))
{
if(flag.owner.wps_enemyflagcarrier)
WaypointSprite_Kill(flag.owner.wps_enemyflagcarrier);
-
+
WaypointSprite_Kill(flag.wps_flagcarrier);
-
+
flag.owner.flagcarried = world;
if(flag.speedrunning)
// reset the flag
setattachment(flag, world, "");
setorigin(flag, flag.ctf_spawnorigin);
-
+
flag.movetype = ((flag.noalign) ? MOVETYPE_NONE : MOVETYPE_TOSS);
flag.takedamage = DAMAGE_NO;
flag.health = flag.max_flag_health;
flag.velocity = '0 0 0';
flag.angles = flag.mangle;
flag.flags = FL_ITEM | FL_NOTARGET;
-
+
flag.ctf_status = FLAG_BASE;
flag.owner = world;
flag.pass_distance = 0;
if(self.owner)
if(IS_PLAYER(self.owner))
ctf_Handle_Throw(self.owner, world, DROP_RESET);
-
+
ctf_RespawnFlag(self);
}
ctf_CaptureShield_Spawn(self);
}
-void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
-{
+void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
+{
// declarations
- teamnumber = fabs(teamnumber - bound(0, autocvar_g_ctf_reverse, 1)); // if we were originally 1, this will become 0. If we were originally 0, this will become 1.
+ teamnumber = fabs(teamnumber - bound(0, autocvar_g_ctf_reverse, 1)); // if we were originally 1, this will become 0. If we were originally 0, this will become 1.
self = flag; // for later usage with droptofloor()
-
+
// main setup
flag.ctf_worldflagnext = ctf_worldflaglist; // link flag into ctf_worldflaglist
ctf_worldflaglist = flag;
flag.flags = FL_ITEM | FL_NOTARGET;
flag.solid = SOLID_TRIGGER;
flag.takedamage = DAMAGE_NO;
- flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale;
+ flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale;
flag.max_flag_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100);
flag.health = flag.max_flag_health;
flag.event_damage = ctf_FlagDamage;
if(flag.toucheffect == "") { flag.toucheffect = ((teamnumber) ? "redflag_touch" : "blueflag_touch"); }
if(flag.passeffect == "") { flag.passeffect = ((teamnumber) ? "red_pass" : "blue_pass"); }
if(flag.capeffect == "") { flag.capeffect = ((teamnumber) ? "red_cap" : "blue_cap"); }
-
- // sound
+
+ // sound
if(flag.snd_flag_taken == "") { flag.snd_flag_taken = ((teamnumber) ? "ctf/red_taken.wav" : "ctf/blue_taken.wav"); }
if(flag.snd_flag_returned == "") { flag.snd_flag_returned = ((teamnumber) ? "ctf/red_returned.wav" : "ctf/blue_returned.wav"); }
if(flag.snd_flag_capture == "") { flag.snd_flag_capture = ((teamnumber) ? "ctf/red_capture.wav" : "ctf/blue_capture.wav"); } // blue team scores by capturing the red flag
if(flag.snd_flag_dropped == "") { flag.snd_flag_dropped = ((teamnumber) ? "ctf/red_dropped.wav" : "ctf/blue_dropped.wav"); }
if(flag.snd_flag_touch == "") { flag.snd_flag_touch = "ctf/touch.wav"; } // again has no team-based sound
if(flag.snd_flag_pass == "") { flag.snd_flag_pass = "ctf/pass.wav"; } // same story here
-
+
// precache
precache_sound(flag.snd_flag_taken);
precache_sound(flag.snd_flag_returned);
setmodel(flag, flag.model); // precision set below
setsize(flag, FLAG_MIN, FLAG_MAX);
setorigin(flag, (flag.origin + FLAG_SPAWN_OFFSET));
-
+
if(autocvar_g_ctf_flag_glowtrails)
{
flag.glow_color = ((teamnumber) ? 251 : 210); // 251: red - 210: blue
flag.glow_size = 25;
flag.glow_trail = 1;
}
-
+
flag.effects |= EF_LOWPRECISION;
if(autocvar_g_ctf_fullbrightflags) { flag.effects |= EF_FULLBRIGHT; }
if(autocvar_g_ctf_dynamiclights) { flag.effects |= ((teamnumber) ? EF_RED : EF_BLUE); }
-
+
// flag placement
if((flag.spawnflags & 1) || flag.noalign) // don't drop to floor, just stay at fixed location
- {
- flag.dropped_origin = flag.origin;
+ {
+ flag.dropped_origin = flag.origin;
flag.noalign = TRUE;
flag.movetype = MOVETYPE_NONE;
}
else // drop to floor, automatically find a platform and set that as spawn origin
- {
+ {
flag.noalign = FALSE;
self = flag;
droptofloor();
- flag.movetype = MOVETYPE_TOSS;
- }
-
+ flag.movetype = MOVETYPE_TOSS;
+ }
+
InitializeEntity(flag, ctf_DelayedFlagSetup, INITPRIO_SETLOCATION);
}
MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink)
{
entity flag;
-
+
// initially clear items so they can be set as necessary later.
self.items &= ~(IT_RED_FLAG_CARRYING | IT_RED_FLAG_TAKEN | IT_RED_FLAG_LOST
| IT_BLUE_FLAG_CARRYING | IT_BLUE_FLAG_TAKEN | IT_BLUE_FLAG_LOST | IT_CTF_SHIELDED);
- // scan through all the flags and notify the client about them
+ // scan through all the flags and notify the client about them
for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
{
switch(flag.ctf_status)
{
if((flag.owner == self) || (flag.pass_sender == self))
self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_CARRYING : IT_BLUE_FLAG_CARRYING); // carrying: self is currently carrying the flag
- else
+ else
self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_TAKEN : IT_BLUE_FLAG_TAKEN); // taken: someone on self's team is carrying the flag
break;
}
}
}
}
-
+
// item for stopping players from capturing the flag too often
if(self.ctf_captureshielded)
self.items |= IT_CTF_SHIELDED;
-
+
// update the health of the flag carrier waypointsprite
- if(self.wps_flagcarrier)
+ if(self.wps_flagcarrier)
WaypointSprite_UpdateHealth(self.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON));
-
+
return FALSE;
}
PlayerTeamScore_AddScore(frag_attacker, autocvar_g_ctf_score_kill);
PlayerScore_Add(frag_attacker, SP_CTF_FCKILLS, 1);
}
-
+
if(frag_target.flagcarried)
{ ctf_Handle_Throw(frag_target, world, DROP_NORMAL); }
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(ctf_RemovePlayer)
{
entity flag; // temporary entity for the search method
-
+
if(self.flagcarried)
{ ctf_Handle_Throw(self, world, DROP_NORMAL); }
-
+
for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
{
if(flag.pass_sender == self) { flag.pass_sender = world; }
if(flag.pass_target == self) { flag.pass_target = world; }
if(flag.ctf_dropper == self) { flag.ctf_dropper = world; }
}
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(ctf_PortalTeleport)
{
- if(self.flagcarried)
+ if(self.flagcarried)
if(!autocvar_g_ctf_portalteleport)
{ ctf_Handle_Throw(self, world, DROP_NORMAL); }
MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
{
if(MUTATOR_RETURNVALUE || gameover) { return FALSE; }
-
+
entity player = self;
if((time > player.throw_antispam) && (player.deadflag == DEAD_NO) && !player.speedrunning && (!player.vehicle || autocvar_g_ctf_allow_vehicle_touch))
{
entity head, closest_target = world;
head = WarpZone_FindRadius(player.origin, autocvar_g_ctf_pass_radius, TRUE);
-
+
while(head) // find the closest acceptable target to pass to
{
if(IS_PLAYER(head) && head.deadflag == DEAD_NO)
if(head != player && SAME_TEAM(head, player))
if(!head.speedrunning && !head.vehicle)
{
- // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
+ // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
vector head_center = WarpZone_UnTransformOrigin(head, CENTER_OR_VIEWOFS(head));
vector passer_center = CENTER_OR_VIEWOFS(player);
-
+
if(ctf_CheckPassDirection(head_center, passer_center, player.v_angle, head.WarpZone_findradius_nearest))
{
- if(autocvar_g_ctf_pass_request && !player.flagcarried && head.flagcarried)
- {
+ if(autocvar_g_ctf_pass_request && !player.flagcarried && head.flagcarried)
+ {
if(IS_BOT_CLIENT(head))
{
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname);
Send_Notification(NOTIF_ONE, head, MSG_CENTER, CENTER_CTF_PASS_REQUESTED, player.netname);
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname);
}
- player.throw_antispam = time + autocvar_g_ctf_pass_wait;
- return TRUE;
+ player.throw_antispam = time + autocvar_g_ctf_pass_wait;
+ return TRUE;
}
else if(player.flagcarried)
{
}
head = head.chain;
}
-
+
if(closest_target) { ctf_Handle_Throw(player, closest_target, DROP_PASS); return TRUE; }
}
-
+
// throw the flag in front of you
if(autocvar_g_ctf_throw && player.flagcarried)
{
if(time > player.throw_prevtime + autocvar_g_ctf_throw_punish_time) { player.throw_count = 1; }
else { player.throw_count += 1; }
if(player.throw_count >= autocvar_g_ctf_throw_punish_count) { player.throw_count = -1; }
-
+
player.throw_prevtime = time;
ctf_Handle_Throw(player, world, DROP_THROW);
return TRUE;
}
}
}
-
+
return FALSE;
}
{
self.wps_helpme_time = time;
WaypointSprite_HelpMePing(self.wps_flagcarrier);
- }
+ }
else // create a normal help me waypointsprite
{
WaypointSprite_Spawn("helpme", waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, FALSE, RADARICON_HELPME, '1 0.5 0');
ctf_Handle_Throw(vh_player, world, DROP_NORMAL);
}
else
- {
- setattachment(vh_player.flagcarried, vh_vehicle, "");
+ {
+ setattachment(vh_player.flagcarried, vh_vehicle, "");
setorigin(vh_player.flagcarried, VEHICLE_FLAG_OFFSET);
vh_player.flagcarried.scale = VEHICLE_FLAG_SCALE;
- //vh_player.flagcarried.angles = '0 0 0';
+ //vh_player.flagcarried.angles = '0 0 0';
}
return TRUE;
}
-
+
return FALSE;
}
{
if(vh_player.flagcarried)
{
- setattachment(vh_player.flagcarried, vh_player, "");
+ setattachment(vh_player.flagcarried, vh_player, "");
setorigin(vh_player.flagcarried, FLAG_CARRY_OFFSET);
vh_player.flagcarried.scale = FLAG_SCALE;
vh_player.flagcarried.angles = '0 0 0';
ctf_RespawnFlag(self.flagcarried);
return TRUE;
}
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(ctf_MatchEnd)
{
entity flag; // temporary entity for the search method
-
+
for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
{
switch(flag.ctf_status)
flag.takedamage = DAMAGE_NO;
flag.solid = SOLID_NOT;
flag.nextthink = FALSE; // stop thinking
-
+
//dprint("stopping the ", flag.netname, " from moving.\n");
break;
}
-
+
default:
case FLAG_BASE:
case FLAG_CARRY:
}
}
}
-
+
return FALSE;
}
void spawnfunc_info_player_team1()
{
if(g_assault) { remove(self); return; }
-
+
self.team = NUM_TEAM_1; // red
spawnfunc_info_player_deathmatch();
}
void spawnfunc_info_player_team2()
{
if(g_assault) { remove(self); return; }
-
+
self.team = NUM_TEAM_2; // blue
spawnfunc_info_player_deathmatch();
}
void spawnfunc_info_player_team3()
{
if(g_assault) { remove(self); return; }
-
+
self.team = NUM_TEAM_3; // yellow
spawnfunc_info_player_deathmatch();
}
void spawnfunc_info_player_team4()
{
if(g_assault) { remove(self); return; }
-
+
self.team = NUM_TEAM_4; // purple
spawnfunc_info_player_deathmatch();
}
/*QUAKED spawnfunc_item_flag_team1 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
CTF flag for team one (Red).
-Keys:
-"angle" Angle the flag will point (minus 90 degrees)...
+Keys:
+"angle" Angle the flag will point (minus 90 degrees)...
"model" model to use, note this needs red and blue as skins 0 and 1...
"noise" sound played when flag is picked up...
"noise1" sound played when flag is returned by a teammate...
"noise2" sound played when flag is captured...
-"noise3" sound played when flag is lost in the field and respawns itself...
+"noise3" sound played when flag is lost in the field and respawns itself...
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
void spawnfunc_item_flag_team1()
/*QUAKED spawnfunc_item_flag_team2 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
CTF flag for team two (Blue).
-Keys:
-"angle" Angle the flag will point (minus 90 degrees)...
+Keys:
+"angle" Angle the flag will point (minus 90 degrees)...
"model" model to use, note this needs red and blue as skins 0 and 1...
"noise" sound played when flag is picked up...
"noise1" sound played when flag is returned by a teammate...
"noise2" sound played when flag is captured...
-"noise3" sound played when flag is lost in the field and respawns itself...
+"noise3" sound played when flag is lost in the field and respawns itself...
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
void spawnfunc_item_flag_team2()
void spawnfunc_ctf_team()
{
if(!g_ctf) { remove(self); return; }
-
+
self.classname = "ctf_team";
self.team = self.cnt + 1;
}
ctf_SpawnTeam("Red", NUM_TEAM_1 - 1);
ctf_SpawnTeam("Blue", NUM_TEAM_2 - 1);
}
-
+
ctf_ScoreRules();
}
ctf_captureshield_min_negscore = autocvar_g_ctf_shield_min_negscore;
ctf_captureshield_max_ratio = autocvar_g_ctf_shield_max_ratio;
ctf_captureshield_force = autocvar_g_ctf_shield_force;
-
+
InitializeEntity(world, ctf_DelayedInit, INITPRIO_GAMETYPE);
}
MUTATOR_HOOK(VehicleExit, ctf_VehicleExit, CBC_ORDER_ANY);
MUTATOR_HOOK(AbortSpeedrun, ctf_AbortSpeedrun, CBC_ORDER_ANY);
MUTATOR_HOOK(HavocBot_ChooseRule, ctf_BotRoles, CBC_ORDER_ANY);
-
+
MUTATOR_ONADD
{
if(time > 1) // game loads at time 1
#define WPCOLOR_FLAGCARRIER(t) ('0.8 0.8 0')
#define WPCOLOR_DROPPEDFLAG(t) (('0.25 0.25 0.25' + colormapPaletteColor(t - 1, FALSE)) * 0.5)
-// sounds
+// sounds
#define snd_flag_taken noise
#define snd_flag_returned noise1
#define snd_flag_capture noise2
// waypoint sprites
.entity bot_basewaypoint; // flag waypointsprite
.entity wps_helpme;
-.entity wps_flagbase;
+.entity wps_flagbase;
.entity wps_flagcarrier;
.entity wps_flagdropped;
.entity wps_enemyflagcarrier;
self.model = head.mdl;
self.modelindex = head.dmg;
self.skin = head.skin;
-
+
float points, wait_time;
if (autocvar_g_domination_point_amt)
points = autocvar_g_domination_point_amt;
SUB_UseTargets ();
self.delay = old_delay;
self.team = old_team;
-
+
switch(self.team)
{
case NUM_TEAM_1: msg = "dom-red"; break;
}
WaypointSprite_UpdateSprites(self.sprite, msg, "", "");
-
+
total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
for(head = world; (head = find(head, classname, "dom_controlpoint")) != world; )
{
print("No ""dom_team"" entities found on this map, creating them anyway.\n");
dom_spawnteams();
}
-
+
ScoreRules_dom();
}
precache_model("models/domination/dom_pink.md3");
precache_model("models/domination/dom_unclaimed.md3");
precache_sound("domination/claim.wav");
-
+
addstat(STAT_DOM_TOTAL_PPS, AS_FLOAT, dom_total_pps);
addstat(STAT_DOM_PPS_RED, AS_FLOAT, dom_pps_red);
addstat(STAT_DOM_PPS_BLUE, AS_FLOAT, dom_pps_blue);
if(c3 >= 0) addstat(STAT_DOM_PPS_YELLOW, AS_FLOAT, dom_pps_yellow);
if(c4 >= 0) addstat(STAT_DOM_PPS_PINK, AS_FLOAT, dom_pps_pink);
-
+
InitializeEntity(world, dom_DelayedInit, INITPRIO_GAMETYPE);
}
{
MUTATOR_HOOK(ClientConnect, dom_ClientConnect, CBC_ORDER_ANY);
MUTATOR_HOOK(HavocBot_ChooseRule, dom_BotRoles, CBC_ORDER_ANY);
-
+
MUTATOR_ONADD
{
if(time > 1) // game loads at time 1
}
else
self.movement = '0 0 0';
-
+
self.disableclientprediction = 1;
}
return 1;
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_FALL, frag_target.netname);
Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_FALL);
}
-
+
frag_damage = 0;
frag_force = frag_force * autocvar_g_freezetag_frozen_force;
}
{
if(self.freezetag_frozen)
return TRUE; // no jumping in freezetag when frozen
-
+
return FALSE;
}
{
if(other.freezetag_frozen)
return TRUE;
-
+
return FALSE;
}
// Last updated: September, 2012
// ===========================================================
-float ka_ballcarrier_waypointsprite_visible_for_player(entity e) // runs on waypoints which are attached to ballcarriers, updates once per frame
+float ka_ballcarrier_waypointsprite_visible_for_player(entity e) // runs on waypoints which are attached to ballcarriers, updates once per frame
{
if(e.ballcarried)
- if(IS_SPEC(other))
+ if(IS_SPEC(other))
return FALSE; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
-
+
// TODO: Make the ballcarrier lack a waypointsprite whenever they have the invisibility powerup
return TRUE;
{
if(gameover) { return; }
vector oldballorigin = self.origin;
-
+
if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
{
makevectors(self.angles);
self.effects = autocvar_g_keepawayball_effects;
self.think = ka_RespawnBall;
self.nextthink = time + autocvar_g_keepawayball_respawntime;
-
+
pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
- WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+ WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
- sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
+ sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
}
else
{
- ka_RespawnBall(); // finding a location failed, retry
+ ka_RespawnBall(); // finding a location failed, retry
}
}
{ // add points for holding the ball after a certain amount of time
if(autocvar_g_keepaway_score_timepoints)
PlayerScore_Add(self.owner, SP_SCORE, autocvar_g_keepaway_score_timepoints);
-
+
PlayerScore_Add(self.owner, SP_KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds"
self.nextthink = time + autocvar_g_keepaway_score_timeinterval;
}
return;
}
if(other.deadflag != DEAD_NO) { return; }
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(other))
{ // The ball just touched an object, most likely the world
pointparticles(particleeffectnum("kaball_sparks"), self.origin, '0 0 0', 1);
sound(self, CH_TRIGGER, "keepaway/touch.wav", VOL_BASE, ATTEN_NORM);
- return;
+ return;
}
else if(self.wait > time) { return; }
other.ballcarried = self;
setattachment(self, other, "");
setorigin(self, '0 0 0');
-
+
// make the ball invisible/unable to do anything/set up time scoring
self.velocity = '0 0 0';
self.movetype = MOVETYPE_NONE;
other.glow_color = autocvar_g_keepawayball_trail_color;
other.glow_trail = TRUE;
other.effects |= autocvar_g_keepaway_ballcarrier_effects;
-
+
// messages and sounds
ka_EventLog("pickup", other);
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_KEEPAWAY_PICKUP, other.netname);
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
- sound(self.owner, CH_TRIGGER, "keepaway/pickedup.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
-
+ sound(self.owner, CH_TRIGGER, "keepaway/pickedup.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
+
// scoring
PlayerScore_Add(other, SP_KEEPAWAY_PICKUPS, 1);
WaypointSprite_AttachCarrier("ka-ballcarrier", other, RADARICON_FLAGCARRIER, '1 0 0');
other.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = ka_ballcarrier_waypointsprite_visible_for_player;
WaypointSprite_UpdateRule(other.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
- WaypointSprite_Ping(other.waypointsprite_attachedforcarrier);
+ WaypointSprite_Ping(other.waypointsprite_attachedforcarrier);
WaypointSprite_Kill(self.waypointsprite_attachedforcarrier);
}
ball = plyr.ballcarried;
if(!ball) { return; }
-
+
// reset the ball
setattachment(ball, world, "");
ball.movetype = MOVETYPE_BOUNCE;
- ball.wait = time + 1;
+ ball.wait = time + 1;
ball.touch = ka_TouchEvent;
ball.think = ka_RespawnBall;
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.takedamage = DAMAGE_YES;
- ball.effects &= ~EF_NODRAW;
+ 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.ballcarried = world; // I hope nothing checks to see if the world has the ball in the rest of my code :P
ball.owner = world;
-
+
// reset the player effects
plyr.glow_trail = FALSE;
plyr.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
ka_EventLog("dropped", plyr);
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_KEEPAWAY_DROPPED, plyr.netname);
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEEPAWAY_DROPPED, plyr.netname);
- sound(other, CH_TRIGGER, "keepaway/dropped.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
-
+ sound(other, CH_TRIGGER, "keepaway/dropped.wav", 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.
-
+
// waypoints
WaypointSprite_Spawn("ka-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
- WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
+ WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
WaypointSprite_Kill(plyr.waypointsprite_attachedforcarrier);
}
MUTATOR_HOOKFUNCTION(ka_GiveFragsForKill)
{
frag_score = 0; // no frags counted in keepaway
- return 1; // you deceptive little bugger ;3 This needs to be true in order for this function to even count.
+ return 1; // you deceptive little bugger ;3 This needs to be true in order for this function to even count.
}
MUTATOR_HOOKFUNCTION(ka_PlayerPreThink)
{
// clear the item used for the ball in keepaway
self.items &= ~IT_KEY1;
-
+
// if the player has the ball, make sure they have the item for it (Used for HUD primarily)
if(self.ballcarried)
self.items |= IT_KEY1;
MUTATOR_HOOKFUNCTION(ka_PlayerPowerups)
{
// In the future this hook is supposed to allow me to do some extra stuff with waypointsprites and invisibility powerup
- // So bare with me until I can fix a certain bug with ka_ballcarrier_waypointsprite_visible_for_player()
-
+ // So bare with me until I can fix a certain bug with ka_ballcarrier_waypointsprite_visible_for_player()
+
self.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
if(self.ballcarried)
self.effects |= autocvar_g_keepaway_ballcarrier_effects;
-
+
return 0;
}
void ka_SpawnBall() // loads various values for the ball, runs only once at start of match
{
if(!g_keepaway) { return; }
-
+
entity e;
e = spawn();
- e.model = "models/orbs/orbblue.md3";
+ e.model = "models/orbs/orbblue.md3";
precache_model(e.model);
setmodel(e, e.model);
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.owner = world;
ka_ball = e;
- InitializeEntity(e, ka_RespawnBall, INITPRIO_SETLOCATION); // is this the right priority? Neh, I have no idea.. Well-- it works! So.
+ InitializeEntity(e, ka_RespawnBall, INITPRIO_SETLOCATION); // is this the right priority? Neh, I have no idea.. Well-- it works! So.
}
void ka_ScoreRules()
{
if(!g_keepaway)
return;
-
+
precache_sound("keepaway/pickedup.wav");
precache_sound("keepaway/dropped.wav");
precache_sound("keepaway/respawn.wav");
--j;
}
}
-
+
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(lostkey, INFO_KEYHUNT_LOST_), lostkey.kh_previous_owner.netname);
-
+
play2all(kh_sound_destroy);
te_tarexplosion(lostkey.origin);
kh_Scores_Event(player, key, "dropkey", 0, 0);
PlayerScore_Add(player, SP_KH_LOSSES, 1);
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(key, INFO_KEYHUNT_DROP_), player.netname);
-
+
kh_Key_AssignTo(key, world);
makevectors(player.v_angle);
key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, FALSE);
if(!tmp_player.BUTTON_CHAT)
if(tmp_player.team == t_team)
++players;
-
+
if (!players) { return t_team; }
}
return 0;
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEYHUNT_WAIT, p1, p2, p3, p4);
return;
}
-
+
Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT);
Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT_OTHER);
{
lms_lowest_lives = 999;
lms_next_place = player_count;
-
+
return FALSE;
}
FOR_EACH_CLIENT(self)
if(IS_PLAYER(self))
PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(lms_PlayerDies)
{
self.respawn_flags |= RESPAWN_FORCE;
-
+
return FALSE;
}
self.frags = FRAGS_SPECTATOR;
else
self.frags = FRAGS_LMS_LOSER;
-
+
if(self.killcount != -666)
if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0 && self.lms_spectate_warning != 2)
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_LMS_NOLIVES, self.netname);
else
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_LMS_FORFEIT, self.netname);
-
+
return FALSE;
}
{
self.classname = "player";
campaign_bots_may_start = 1;
-
+
if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
{
PlayerScore_Add(self, SP_LMS_RANK, 666);
self.frags = FRAGS_SPECTATOR;
}
-
+
return FALSE;
}
{
if(self.deadflag == DEAD_DYING)
self.deadflag = DEAD_RESPAWNING;
-
+
return FALSE;
}
--lms_next_place;
}
frag_score = 0;
-
+
return TRUE;
}
self.max_health = 1;
return FALSE;
}
-
+
return TRUE;
}
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
PlayerScore_Add(other, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
}
-
+
return MUT_ITEMTOUCH_CONTINUE;
}
{
lms_lowest_lives = 9999;
lms_next_place = 0;
-
+
lms_ScoreRules();
}
{
WaypointSprite_Kill(ball.waypointsprite_attachedforcarrier);
}
-
+
//setattachment(ball, plyr, "");
setorigin(ball, plyr.origin + plyr.view_ofs);
ball.think = DropOwner;
ball.nextthink = time + autocvar_g_nexball_basketball_delay_hold;
}
-
+
ownr = self;
- self = plyr;
+ self = plyr;
self.weaponentity.weapons = self.weapons;
self.weaponentity.switchweapon = self.weapon;
self.weapons = WEPSET_PORTO;
//dprint("W_Nexball_Think\n");
//vector new_dir = steerlib_arrive(self.enemy.origin, 2500);
vector new_dir = normalize(self.enemy.origin + '0 0 50' - self.origin);
- vector old_dir = normalize(self.velocity);
- float _speed = vlen(self.velocity);
+ vector old_dir = normalize(self.velocity);
+ float _speed = vlen(self.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
-
+
self.velocity = new_vel;
-
+
self.nextthink = time;
}
attacker = self.owner;
//self.think = func_null;
//self.enemy = world;
-
+
PROJECTILE_TOUCH;
if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
if((ball = other.ballcarried) && (IS_PLAYER(attacker)))
mul = 2 - mul;
mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
}
-
+
DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, FALSE));
-
+
//TODO: use the speed_up cvar too ??
}
_ball.nextthink = time;
return;
}
-
+
if(!autocvar_g_nexball_tackling)
return;
-
+
entity missile;
if(!(balls & BALL_BASKET))
return;
self.scale = 1;
self.customizeentityforclient = func_null;
return TRUE;
- }
-
+ }
+
if(other == self.owner)
{
self.scale = autocvar_g_nexball_viewmodel_scale;
self.effects |= EF_FLAME;
else
self.effects &= ~EF_FLAME;
- }
+ }
else
{
self.effects &= ~EF_FLAME;
self.scale = 1;
}
-
+
return TRUE;
}
{
makevectors(self.v_angle);
if(nexball_mode & NBM_BASKETBALL)
- {
+ {
if(self.ballcarried)
{
// 'view ball'
- self.ballcarried.velocity = self.velocity;
+ self.ballcarried.velocity = self.velocity;
self.ballcarried.customizeentityforclient = ball_customize;
-
- setorigin(self.ballcarried, self.origin + self.view_ofs +
- v_forward * autocvar_g_nexball_viewmodel_offset_x +
- v_right * autocvar_g_nexball_viewmodel_offset_y +
- v_up * autocvar_g_nexball_viewmodel_offset_z);
-
+
+ setorigin(self.ballcarried, self.origin + self.view_ofs +
+ v_forward * autocvar_g_nexball_viewmodel_offset_x +
+ v_right * autocvar_g_nexball_viewmodel_offset_y +
+ v_up * autocvar_g_nexball_viewmodel_offset_z);
+
// 'safe passing'
if(autocvar_g_nexball_safepass_maxdist)
{
//centerprint(self, sprintf("Lost lock on %s", self.ballcarried.enemy.netname));
self.ballcarried.enemy = world;
}
-
-
+
+
//tracebox(self.origin + self.view_ofs, '-2 -2 -2', '2 2 2', self.origin + self.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist);
crosshair_trace(self);
- if( trace_ent &&
+ if( trace_ent &&
IS_CLIENT(trace_ent) &&
trace_ent.deadflag == DEAD_NO &&
trace_ent.team == self.team &&
vlen(trace_ent.origin - self.origin) <= autocvar_g_nexball_safepass_maxdist )
{
-
+
//if(self.ballcarried.enemy != trace_ent)
// centerprint(self, sprintf("Locked to %s", trace_ent.netname));
self.ballcarried.enemy = trace_ent;
self.ballcarried.wait = time + autocvar_g_nexball_safepass_holdtime;
-
-
+
+
}
}
}
else
- {
+ {
if(self.weaponentity.weapons)
{
self.weapons = self.weaponentity.weapons;
weapon_action(WEP_PORTO, WR_RESETPLAYER);
self.switchweapon = self.weaponentity.switchweapon;
W_SwitchWeapon(self.switchweapon);
-
+
self.weaponentity.weapons = '0 0 0';
}
}
-
+
}
-
+
nexball_setstatus();
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
-{
+{
self.weaponentity.weapons = '0 0 0';
-
+
if(nexball_mode & NBM_BASKETBALL)
self.weapons |= WEPSET_PORTO;
else
MUTATOR_HOOKFUNCTION(nexball_SetStartItems)
{
start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
-
+
return FALSE;
}
d = d + 1;
e = e.chain;
}
-
+
if(autocvar_g_campaign && autocvar__campaign_testrun)
d = d * self.max_health;
else
d = d * self.max_health / max(30, 60 * autocvar_timelimit_suddendeath);
-
+
Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0');
}
else if (overtime_msg_time)
precache_sound("onslaught/electricity_explode.wav");
if (!self.team)
objerror("team must be set");
-
+
if(self.team == NUM_TEAM_1)
ons_red_generator = self;
if(self.team == NUM_TEAM_2)
ons_blue_generator = self;
-
+
self.team_saved = self.team;
self.colormap = 1024 + (self.team - 1) * 17;
self.solid = SOLID_BBOX;
waypoint_spawnforitem(self);
onslaught_updatelinks();
-
+
self.reset = onslaught_generator_reset;
}
float _friendly_count = 0;
float _dist;
entity _player;
-
+
FOR_EACH_PLAYER(_player)
{
if(!_player.deadflag)
a = onslaught_controlpoint_can_be_linked(self.owner, self.owner.team);
if(!a)
return;
-
+
self.health = self.health + self.count;
if (self.health >= self.max_health)
MUTATOR_HOOKFUNCTION(ons_Spawn_Score)
{
-
+
/*
float _neer_home = (random() > 0.5 ? TRUE : FALSE);
-
+
RandomSelection_Init();
-
+
if(self.team == NUM_TEAM_1)
RandomSelection_Add(ons_red_generator, 0, string_null, 1, 1);
-
+
if(self.team == NUM_TEAM_2)
RandomSelection_Add(ons_blue_generator, 0, string_null, 1, 1);
-
+
entity _cp = findchain(classname, "onslaught_controlpoint"):
while _cp;
{
- if(_cp.team == self.team)
+ if(_cp.team == self.team)
RandomSelection_Add(_cp, 0, string_null, 1, 1);
-
+
_cp = _cp.chain;
}
}
else if(self.team == spawn_spot.team)
spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
-
+
*/
-
+
return 0;
}
{
if(!autocvar_g_onslaught_spawn_at_controlpoints)
return 0;
-
+
if(random() < 0.5) // 50/50 chane to use default spawnsystem.
return 0;
-
+
float _close_to_home = ((random() > 0.5) ? TRUE : FALSE);
entity _best = world, _trg_gen = world;
float _score, _best_score = MAX_SHOT_DISTANCE;
-
+
RandomSelection_Init();
-
+
if(self.team == NUM_TEAM_1)
{
if(!_close_to_home)
_trg_gen = ons_blue_generator;
- else
- _trg_gen = ons_red_generator;
+ else
+ _trg_gen = ons_red_generator;
}
-
+
if(self.team == NUM_TEAM_2)
{
if(_close_to_home)
_trg_gen = ons_blue_generator;
- else
- _trg_gen = ons_red_generator;
+ else
+ _trg_gen = ons_red_generator;
}
-
+
entity _cp = findchain(classname, "onslaught_controlpoint");
while(_cp)
{
- if(_cp.team == self.team)
- {
+ if(_cp.team == self.team)
+ {
_score = vlen(_trg_gen.origin - _cp.origin);
if(_score < _best_score)
{
_best = _cp;
- _best_score = _score;
+ _best_score = _score;
}
- }
+ }
_cp = _cp.chain;
}
-
- vector _loc;
- float i;
+
+ vector _loc;
+ float i;
if(_best)
{
for(i = 0; i < 10; ++i)
{
_loc = _best.origin + '0 0 96';
- _loc += ('0 1 0' * random()) * 128;
+ _loc += ('0 1 0' * random()) * 128;
tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self);
if(trace_fraction == 1.0 && !trace_startsolid)
{
{
if(!autocvar_g_onslaught_spawn_at_generator)
return 0;
-
+
_trg_gen = ((self.team == NUM_TEAM_1) ? ons_red_generator : ons_blue_generator);
-
+
for(i = 0; i < 10; ++i)
{
_loc = _trg_gen.origin + '0 0 96';
- _loc += ('0 1 0' * random()) * 128;
+ _loc += ('0 1 0' * random()) * 128;
tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self);
if(trace_fraction == 1.0 && !trace_startsolid)
{
}
}
}
-
+
return 0;
}
if(self.health <= autocvar_g_bloodloss && self.deadflag == DEAD_NO)
{
self.BUTTON_CROUCH = TRUE;
-
+
if(time >= self.bloodloss_timer)
{
self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
self.bloodloss_timer = time + 0.5 + random() * 0.5;
}
}
-
+
return FALSE;
}
{
if(self.health <= autocvar_g_bloodloss)
return TRUE;
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(campcheck_PlayerDies)
{
Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_CAMPCHECK);
-
+
return FALSE;
}
frag_target.campcheck_traveled_distance = autocvar_g_campcheck_distance;
frag_attacker.campcheck_traveled_distance = autocvar_g_campcheck_distance;
}
-
+
return FALSE;
}
{
self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
self.campcheck_traveled_distance = 0;
-
+
return FALSE;
}
float velocity_difference;
float clean_up_and_do_nothing;
float horiz_speed = autocvar_sv_dodging_horiz_speed;
-
+
if(self.freezetag_frozen)
horiz_speed = autocvar_sv_dodging_horiz_speed_frozen;
// make sure v_up, v_right and v_forward are sane
makevectors(self.angles);
- // if we have e.g. 0.5 sec ramptime and a frametime of 0.25, then the ramp code
- // will be called ramp_time/frametime times = 2 times. so, we need to
+ // if we have e.g. 0.5 sec ramptime and a frametime of 0.25, then the ramp code
+ // will be called ramp_time/frametime times = 2 times. so, we need to
// add 0.5 * the total speed each frame until the dodge action is done..
common_factor = sys_frametime / autocvar_sv_dodging_ramp_time;
// if ramp time is smaller than frametime we get problems ;D
- if (common_factor > 1)
+ if (common_factor > 1)
common_factor = 1;
new_velocity_gain = self.dodging_velocity_gain - (common_factor * horiz_speed);
//disable jump key during dodge accel phase
if (self.movement_z > 0) self.movement_z = 0;
- self.velocity =
- self.velocity
+ self.velocity =
+ self.velocity
+ ((self.dodging_direction_y * velocity_difference) * v_right)
+ ((self.dodging_direction_x * velocity_difference) * v_forward);
if (self.dodging_single_action == 1) {
self.flags &= ~FL_ONGROUND;
- self.velocity =
- self.velocity
+ self.velocity =
+ self.velocity
+ (autocvar_sv_dodging_up_speed * v_up);
if (autocvar_sv_dodging_sound == 1)
tap_direction_x = 0;
tap_direction_y = 0;
-
+
float frozen_dodging;
frozen_dodging = (self.freezetag_frozen && autocvar_sv_dodging_frozen);
if ((time - self.last_dodging_time) < autocvar_sv_dodging_delay)
return 0;
- if (check_close_to_ground(autocvar_sv_dodging_height_threshold) != 1
+ if (check_close_to_ground(autocvar_sv_dodging_height_threshold) != 1
&& check_close_to_wall(autocvar_sv_dodging_wall_distance_threshold) != 1)
return 0;
if (self.movement_x > 0) {
// is this a state change?
if (!(self.pressedkeys & KEY_FORWARD) || frozen_dodging) {
- if ((time - self.last_FORWARD_KEY_time) < self.cvar_cl_dodging_timeout) {
+ if ((time - self.last_FORWARD_KEY_time) < self.cvar_cl_dodging_timeout) {
tap_direction_x = 1.0;
dodge_detected = 1;
}
// is this a state change?
if (!(self.pressedkeys & KEY_BACKWARD) || frozen_dodging) {
tap_direction_x = -1.0;
- if ((time - self.last_BACKWARD_KEY_time) < self.cvar_cl_dodging_timeout) {
+ if ((time - self.last_BACKWARD_KEY_time) < self.cvar_cl_dodging_timeout) {
dodge_detected = 1;
}
self.last_BACKWARD_KEY_time = time;
// is this a state change?
if (!(self.pressedkeys & KEY_RIGHT) || frozen_dodging) {
tap_direction_y = 1.0;
- if ((time - self.last_RIGHT_KEY_time) < self.cvar_cl_dodging_timeout) {
+ if ((time - self.last_RIGHT_KEY_time) < self.cvar_cl_dodging_timeout) {
dodge_detected = 1;
}
self.last_RIGHT_KEY_time = time;
// is this a state change?
if (!(self.pressedkeys & KEY_LEFT) || frozen_dodging) {
tap_direction_y = -1.0;
- if ((time - self.last_LEFT_KEY_time) < self.cvar_cl_dodging_timeout) {
+ if ((time - self.last_LEFT_KEY_time) < self.cvar_cl_dodging_timeout) {
dodge_detected = 1;
}
self.last_LEFT_KEY_time = time;
{
start_ammo_shells = 0;
warmup_start_ammo_shells = 0;
-
+
start_weapons = WEPSET_SHOTGUN;
warmup_start_weapons = WEPSET_SHOTGUN;
-
+
return FALSE;
}
case IT_ARMOR_SHARD:
return FALSE;
}
-
+
return TRUE;
}
self.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
self.midair_shieldtime = max(self.midair_shieldtime, time + autocvar_g_midair_shieldtime);
}
-
+
return FALSE;
}
-void spawnfunc_item_minst_cells (void)
+void spawnfunc_item_minst_cells (void)
{
if (!g_minstagib) { remove(self); return; }
if (!self.ammo_cells)
self.ammo_cells = autocvar_g_minstagib_ammo_drop;
-
+
StartItem ("models/items/a_cells.md3",
"misc/itempickup.wav", 45, 0,
"MinstaNex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
entity head;
FOR_EACH_PLAYER(head)
minstagib_stop_countdown(head);
-
+
return FALSE;
}
{
if(checkentity.items & IT_STRENGTH)
return TRUE;
-
+
return FALSE;
}
{
if(self.items & IT_INVINCIBLE)
self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_minstagib_speed_highspeed;
-
+
return FALSE;
}
{
damage_save = 0;
damage_take = frag_damage;
-
+
return FALSE;
}
{
if(autocvar_g_friendlyfire == 0 && SAME_TEAM(frag_target, frag_attacker) && IS_PLAYER(frag_target) && IS_PLAYER(frag_attacker))
frag_damage = 0;
-
+
if(IS_PLAYER(frag_target))
{
if ((frag_deathtype == DEATH_FALL) ||
{
frag_damage = 0;
}
-
+
if(IS_PLAYER(frag_attacker))
if(DEATH_ISWEAPON(frag_deathtype, WEP_MINSTANEX))
if(frag_target.armorvalue)
frag_target.hitsound += 1;
frag_attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit
}
-
+
if(IS_PLAYER(frag_attacker))
if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER))
{
}
}
}
-
+
if(IS_PLAYER(frag_attacker))
if(frag_mirrordamage > 0)
{
}
frag_mirrordamage = 0;
}
-
+
if(frag_target.items & IT_STRENGTH)
yoda = 1;
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(minstagib_SetStartItems)
{
start_ammo_cells = cvar("g_minstagib_ammo_start");
-
+
start_health = 100;
start_armorvalue = 0;
start_weapons = WEPSET_MINSTANEX;
warmup_start_weapons = WEPSET_MINSTANEX;
start_items |= IT_UNLIMITED_SUPERWEAPONS;
-
+
return FALSE;
}
{
if(self.classname == "item_cells")
return TRUE; // no normal cells?
-
+
if(self.weapon == WEP_MINSTANEX && self.classname == "droppedweapon")
{
self.ammo_cells = autocvar_g_minstagib_ammo_drop;
return FALSE;
}
-
+
if(self.weapon == WEP_ROCKET_LAUNCHER || self.weapon == WEP_NEX)
{
entity e = spawn();
self = oldself;
return TRUE;
}
-
+
if(self.flags & FL_POWERUP)
return FALSE;
-
+
if(self.ammo_cells > autocvar_g_minstagib_ammo_drop && self.classname != "item_minst_cells")
self.ammo_cells = autocvar_g_minstagib_ammo_drop;
-
+
if(self.ammo_cells && !self.weapon)
return FALSE;
-
+
return TRUE;
}
MUTATOR_HOOKFUNCTION(minstagib_CustomizeWaypoint)
{
entity e = WaypointSprite_getviewentity(other);
-
+
// if you have the invisibility powerup, sprites ALWAYS are restricted to your team
// but only apply this to real players, not to spectators
if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
if(DIFF_TEAM(self.owner, e))
return TRUE;
-
+
return FALSE;
}
return MUT_ITEMTOUCH_CONTINUE;
}
-
+
if(self.max_health)
{
other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_minstagib_extralives);
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
return MUT_ITEMTOUCH_PICKUP;
}
-
+
return MUT_ITEMTOUCH_CONTINUE;
}
if (!autocvar_g_powerups) { return FALSE; }
if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega"))
return FALSE;
-
+
entity e = spawn();
-
+
if(random() < 0.3)
e.think = spawnfunc_item_strength;
else if(random() < 0.6)
e.think = minstagib_health_mega;
else
e.think = spawnfunc_item_invincible;
-
+
e.nextthink = time + 0.1;
e.spawnflags = self.spawnflags;
e.noalign = self.noalign;
setorigin(e, self.origin);
-
+
return TRUE;
}
else
self.multijump_count = -2; // the cvar value for infinite jumps is -1, so this needs to be smaller
}
-
+
return FALSE;
}
self.multijump_ready = TRUE; // this is necessary to check that we released the jump button and pressed it again
else
self.multijump_ready = FALSE;
-
+
if(!player_multijump && self.multijump_ready && self.multijump_count < autocvar_g_multijump && self.velocity_z > autocvar_g_multijump_speed)
{
if (autocvar_g_multijump)
self.nextthink = time;
if(!self.owner || wasfreed(self.owner))
remove(self);
-
+
}
void nade_burn_spawn(entity _nade)
{
float p;
-
+
switch(_nade.realowner.team)
{
case NUM_TEAM_1: p = PROJECTILE_NADE_RED_BURN; break;
case NUM_TEAM_4: p = PROJECTILE_NADE_PINK_BURN; break;
default: p = PROJECTILE_NADE_BURN; break;
}
-
+
CSQCProjectile(_nade, TRUE, p, TRUE);
}
timer.think = nade_timer_think;
timer.nextthink = time;
timer.wait = _nade.wait;
- timer.owner = _nade;
+ timer.owner = _nade;
timer.skin = 10;
-
+
switch(_nade.realowner.team)
{
case NUM_TEAM_1: p = PROJECTILE_NADE_RED; break;
case NUM_TEAM_4: p = PROJECTILE_NADE_PINK; break;
default: p = PROJECTILE_NADE; break;
}
-
+
CSQCProjectile(_nade, TRUE, p, TRUE);
-
+
}
void nade_boom()
{
string expef;
-
+
switch(self.realowner.team)
{
case NUM_TEAM_1: expef = "nade_red_explode"; break;
case NUM_TEAM_4: expef = "nade_pink_explode"; break;
default: expef = "nade_explode"; break;
}
-
+
sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum(expef), self.origin + '0 0 1', '0 0 0', 1);
-
+
Damage_DamageInfo(self.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, self.projectiledeathtype, 0, self);
self.takedamage = DAMAGE_NO;
if(DEATH_ISWEAPON(deathtype, WEP_SHOTGUN) && !(deathtype & HITTYPE_SECONDARY))
damage = self.max_health * 1.1;
-
+
if(DEATH_ISWEAPON(deathtype, WEP_SHOTGUN) && (deathtype & HITTYPE_SECONDARY))
{
damage = self.max_health * 0.1;
force *= 15;
}
-
+
self.velocity += force;
if(!damage || (self.flags & FL_ONGROUND && IS_PLAYER(attacker)))
{
entity _nade = e.nade;
e.nade = world;
-
+
remove(e.fake_nade);
e.fake_nade = world;
-
+
makevectors(e.v_angle);
-
+
W_SetupShot(e, FALSE, FALSE, "", CH_WEAPON_A, 0);
-
+
Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_NADES);
-
+
//setorigin(_nade, CENTER_OR_VIEWOFS(e) + (v_right * 10) * -1);
setorigin(_nade, w_shotorg + (v_right * 25) * -1);
setmodel(_nade, "models/weapons/v_ok_grenade.md3");
PROJECTILE_MAKETRIGGER(_nade);
setsize(_nade, '-16 -16 -16', '16 16 16');
_nade.movetype = MOVETYPE_BOUNCE;
-
+
tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, FALSE, _nade);
if (trace_startsolid)
setorigin(_nade, e.origin);
-
+
if(e.crouch)
_nade.velocity = '0 0 -10';
else if(autocvar_g_nades_nade_newton_style == 1)
{
if(self.nade)
remove(self.nade);
-
+
if(self.fake_nade)
remove(self.fake_nade);
-
+
self.nade = spawn();
setmodel(self.nade, "null");
setattachment(self.nade, self, "bip01 l hand");
{
if(self.vehicle)
return FALSE;
-
+
if(gameover)
return FALSE;
-
+
if(self.deadflag != DEAD_NO)
return FALSE;
-
+
if (!autocvar_g_nades)
return FALSE; // allow turning them off mid match
-
+
if(forbidWeaponUse())
return FALSE;
-
+
if (!IS_PLAYER(self))
return FALSE;
-
+
return TRUE;
}
{
if(!CanThrowNade())
return;
-
+
if(!self.nade)
{
if(self.nade_refire < time)
{
if(other.nade)
toss_nade(other, '0 0 100', max(other.nade.wait, time + 0.05));
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
{
float key_pressed = ((g_grappling_hook || client_hasweapon(self, WEP_HOOK, FALSE, FALSE) || (weaponsInMap & WEPSET_HOOK)) ? self.button16 : self.BUTTON_HOOK);
-
+
if(self.nade)
if(self.nade.wait - 0.1 <= time)
toss_nade(self, '0 0 0', time + 0.05);
-
+
if(CanThrowNade())
if(self.nade_refire < time)
{
makevectors(self.v_angle);
float _force = time - self.nade.lifetime;
_force /= autocvar_g_nades_nade_lifetime;
- _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
+ _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
toss_nade(self, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
}
}
{
if(self.nade)
toss_nade(self, '0 0 100', max(self.nade.wait, time + 0.05));
-
+
return FALSE;
}
if(self.fake_nade)
remove(self.fake_nade);
-
+
return FALSE;
}
MUTATOR_HOOK(ClientDisconnect, nades_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(BuildMutatorsString, nades_BuildMutatorsString, CBC_ORDER_ANY);
MUTATOR_HOOK(BuildMutatorsPrettyString, nades_BuildMutatorsPrettyString, CBC_ORDER_ANY);
-
+
MUTATOR_ONADD
{
precache_model("models/ok_nade_counter/ok_nade_counter.md3");
-
+
precache_model("models/weapons/h_ok_grenade.iqm");
precache_model("models/weapons/v_ok_grenade.md3");
precache_sound("weapons/rocket_impact.wav");
minsta porto
tuba
-NEW rifle hlac minel seeker
+NEW rifle hlac minel seeker
IDEAS OPEN flak OPEN FUN FUN FUN FUN
WepSet newdefault;
WepSet warmup_newdefault;
-
+
newdefault = '0 0 0';
warmup_newdefault = '0 0 0';
if(self.switchweapon != j)
if(W_IsWeaponThrowable(j))
W_ThrowNewWeapon(self, j, FALSE, self.origin + (self.mins + self.maxs) * 0.5, randomvec() * 175 + '0 0 325');
-
+
return TRUE;
}
MUTATOR_HOOKFUNCTION(gravity_StartFrame)
{
- if(gameover || !cvar("g_random_gravity")) return FALSE;
+ if(gameover || !cvar("g_random_gravity")) return FALSE;
if(time < gravity_delay) return FALSE;
if(time < game_starttime) return FALSE;
if(round_handler_IsActive() && !round_handler_IsRoundStarted()) return FALSE;
-
- if(random() >= autocvar_g_random_gravity_negative_chance)
+
+ if(random() >= autocvar_g_random_gravity_negative_chance)
cvar_set("sv_gravity", ftos(bound(autocvar_g_random_gravity_min, random() - random() * -autocvar_g_random_gravity_negative, autocvar_g_random_gravity_max)));
else
cvar_set("sv_gravity", ftos(bound(autocvar_g_random_gravity_min, random() * autocvar_g_random_gravity_positive, autocvar_g_random_gravity_max)));
-
+
gravity_delay = time + autocvar_g_random_gravity_delay;
-
+
dprint("Gravity is now: ", ftos(autocvar_sv_gravity), "\n");
-
+
return FALSE;
}
MUTATOR_HOOK(SV_StartFrame, gravity_StartFrame, CBC_ORDER_ANY);
MUTATOR_HOOK(BuildMutatorsString, gravity_BuildMutatorsString, CBC_ORDER_ANY);
MUTATOR_HOOK(BuildMutatorsPrettyString, gravity_BuildMutatorsPrettyString, CBC_ORDER_ANY);
-
+
MUTATOR_ONADD
{
cvar_settemp("sv_gravity", cvar_string("sv_gravity")); // settemp current gravity so it's restored on match end
frag_attacker.health += bound(0, damage_take, frag_target.health);
frag_attacker.health = bound(0, frag_attacker.health, autocvar_g_balance_health_limit);
}
-
+
return FALSE;
}
void __showpath2_think()
{
- #ifdef TURRET_DEBUG
+ #ifdef TURRET_DEBUG
mark_info(self.origin,1);
#endif
if(self.path_next)
// FIXME! wp.wp##mincost is NOT distance. Make it distance or add a field for distance to be used here (for better speed)
cost = vlen(child.origin - wp.origin);
-
+
child.path_prev = wp;
child.pathlib_list = openlist;
child.pathlib_node_g = wp.pathlib_node_g + cost;
child.pathlib_node_h = pathlib_heuristic(child.origin, goal_node.origin);
child.pathlib_node_c = pathlib_wpp_waypointcallback(child, wp);
child.pathlib_node_f = child.pathlib_node_g + child.pathlib_node_h + child.pathlib_node_c;
-
+
if(child == goal_node)
pathlib_foundgoal = TRUE;
// FIXME! wp.wp##mincost is NOT distance. Make it distance or add a field for distance to be used here (for better speed)
cost = vlen(child.origin - wp.origin);
-
+
child.path_prev = wp;
child.pathlib_list = openlist;
child.pathlib_node_g = wp.pathlib_node_g + cost;
- child.pathlib_node_h = pathlib_heuristic(child.origin, goal_node.origin);
+ child.pathlib_node_h = pathlib_heuristic(child.origin, goal_node.origin);
child.pathlib_node_f = child.pathlib_node_g + child.pathlib_node_h;
if(child == goal_node)
if(wp.wp29) pathlib_wpp_open(wp,wp.wp29,wp.wp29mincost); else return 29;
if(wp.wp30) pathlib_wpp_open(wp,wp.wp30,wp.wp30mincost); else return 30;
if(wp.wp31) pathlib_wpp_open(wp,wp.wp31,wp.wp31mincost); else return 31;
-
+
return 32;
}
float ptime;
ptime = gettime(GETTIME_REALTIME);
- pathlib_starttime = ptime;
+ pathlib_starttime = ptime;
pathlib_movecost = 300;
pathlib_movecost_diag = vlen('1 1 0' * pathlib_movecost);
-
- if (!pathlib_wpp_waypointcallback)
+
+ if (!pathlib_wpp_waypointcallback)
callback = FALSE;
-
+
if (callback)
pathlib_wpp_open = pathlib_wpp_opencb;
else
pathlib_wpp_open = pathlib_wpp_openncb;
-
+
pathlib_heuristic = pathlib_h_none;
-
+
if (!openlist)
openlist = spawn();
n.pathlib_node_g = 0;
n.pathlib_node_f = 0;
n.pathlib_node_h = 0;
-
+
//setmodel(n, "models/runematch/rune.mdl");
//n.effects = EF_LOWPRECISION;
//n.colormod = '0 0 0';
//n.scale = 1;
-
+
}
goal_node = wp_to;
}
pathlib_wpp_close(n);
dprint("Expanding ",ftos(pathlib_wpp_expand(n))," links\n");
-
+
if(pathlib_foundgoal)
{
entity start, end, open, ln;
-
+
dprint("Target found. Rebuilding and filtering path...\n");
-
+
buildpath_nodefilter = buildpath_nodefilter_none;
start = path_build(world, start_node.origin, world, world);
end = path_build(world, goal_node.origin, world, start);
ln = end;
-
+
for(open = goal_node; open.path_prev != start_node; open = open.path_prev)
{
n = path_build(ln,open.origin,open.path_prev,start);
ln = n;
}
start.path_next = n;
- n.path_prev = start;
-
+ n.path_prev = start;
+
return start;
}
if(playerstats_db >= 0)
playerstats_waitforme = FALSE; // must wait for it at match end
- serverflags |= SERVERFLAG_PLAYERSTATS;
+ serverflags |= SERVERFLAG_PLAYERSTATS;
PlayerStats_AddEvent(PLAYERSTATS_ALIVETIME);
PlayerStats_AddEvent(PLAYERSTATS_AVGLATENCY);
string key;
key = sprintf("%s:*", e.playerstats_id);
-
+
string p;
p = db_get(playerstats_db, key);
if(p == "")
string key;
key = sprintf("%d", t);
-
+
string p;
p = db_get(playerstats_db, key);
if(p == "")
{
if(playerstats_db < 0)
return;
-
+
string key;
key = sprintf("*:%s", event_id);
-
+
string p;
p = db_get(playerstats_db, key);
if(p == "")
{
if((e.playerstats_id == "") || playerstats_db < 0)
return 0;
-
+
string key;
float val;
key = sprintf("%s:%s", e.playerstats_id, event_id);
U: UDP port number of the server
D: duration of the match
P: player ID of an existing player; this also sets the owner for all following "n", "e" and "t" lines (lower case!)
- Q: team number of an existing team (format: team#NN); this also sets the owner for all following "e" lines (lower case!)
+ Q: team number of an existing team (format: team#NN); this also sets the owner for all following "e" lines (lower case!)
n: nickname of the player (optional)
t: team ID
i: player index
oldrec = race_readTime(GetMapname(), newpos);
oldrec_holder = race_readName(GetMapname(), newpos);
-
+
// store new ranking
race_writeTime(GetMapname(), t, myuid);
if(rankings_reply)
strunzone(rankings_reply);
rankings_reply = strzone(getrankings());
-
+
if(newpos == player_prevpos)
{
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_NEW_IMPROVED, mynetname, newpos, t, oldrec);
other.porto_forbidden = 2; // decreased by 1 each StartFrame
if(defrag_ents) {
- if(self.race_checkpoint == -2)
+ if(self.race_checkpoint == -2)
{
self.race_checkpoint = other.race_checkpoint;
}
for(cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
if(cp.race_checkpoint == -2) // set defragcpexists to -1 so that the cp id file will be rewritten when someone finishes
defragcpexists = -1;
- }
+ }
}
}
if(cp_amount == 0) {
if(have_verified)
return;
have_verified = 1;
-
+
qual = g_race_qualifying;
oldself = self;
self.race_place = race_lowest_place_spawn;
if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE))
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
-
+
// race only (initial spawn)
g_race_qualifying = 0;
for(p = 1; p <= race_highest_place_spawn; ++p)
self.race_checkpoint = race_NextCheckpoint(0);
g_race_qualifying = 1;
self.race_place = 0; // there's only one spawn on defrag maps
-
+
// check if a defragcp file already exists, then read it and apply the checkpoint order
float fh;
float len;
targ.wait = 0;
targ.delay = 0;
- // These just make the game crash on some maps with oddly shaped triggers.
- // (on the other hand they used to fix the case when two players ran through a checkpoint at once,
+ // These just make the game crash on some maps with oddly shaped triggers.
+ // (on the other hand they used to fix the case when two players ran through a checkpoint at once,
// and often one of them just passed through without being registered. Hope it's fixed in a better way now.
// (happened on item triggers too)
//
self.message2 = "was pushed backwards by";
if (self.race_penalty_reason == "")
self.race_penalty_reason = "missing a checkpoint";
-
+
self.race_checkpoint = self.cnt;
if(self.race_checkpoint > race_highest_checkpoint)
l = PlayerScore_Add(e, SP_RACE_LAPS, 0);
if(e.race_completed)
return l; // not fractional
-
+
vector o0, o1;
float bestfraction, fraction;
entity lastcp, cp0, cp1;
if(nextcpindex == lastcpindex)
return l; // finish
-
+
bestfraction = 1;
for(cp0 = world; (cp0 = find(cp0, classname, "trigger_race_checkpoint")); )
{
if(teams < 0)
return 0;
}
-
+
return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
}
plist = p;
}
// Now plist points to the whole list.
-
+
pfirst = plast = world;
i = j = 0;
s = "Scores:";
s = strcat(s, strpad(max(0, NAMEWIDTH - strlennocol(s)), ""));
-
+
for(i = 0; i < MAX_SCORE; ++i)
if(scores_label[i] != "")
{
break;
}
}
-
+
for(i = 0; i < MAX_SCORE; ++i)
if(scores_label[i] != "")
{
t = p.team;
p = p.chain;
}
-
+
t = 0;
FOR_EACH_CLIENT(p)
if (!IS_PLAYER(p))
// only a player can trigger this
if (!IS_PLAYER(other))
return;
-
+
// update secrets found counter
secrets_found += 1;
//print("Secret found: ", ftos(secret_counter.cnt), "/");
// centerprint message (multi_touch() doesn't always call centerprint())
centerprint(other, self.message);
self.message = "";
-
+
// handle normal trigger features
multi_touch();
remove(self);
*/
void spawnfunc_trigger_secret() {
// FIXME: should it be disabled in most modes?
-
+
// update secrets count
secrets_total += 1;
-
+
// add default message
if (self.message == "")
self.message = "You found a secret!";
-
+
// set default sound
if (self.noise == "")
if (!self.sounds)
self.sounds = 1; // misc/secret.wav
-
+
// this entity can't be a target itself!!!!
self.targetname = "";
-
+
// you can't just shoot a room to find it, can you?
self.health = 0;
-
+
// a secret can not be delayed
self.delay = 0;
-
+
// convert this trigger to trigger_once
self.classname = "trigger_once";
spawnfunc_trigger_once();
-
+
// take over the touch() function, so we can mark secret as found
self.touch = trigger_secret_touch;
// ignore triggering;
float SpawnEvent_Send(entity to, float sf)
{
float send;
-
+
WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT);
if(autocvar_g_spawn_alloweffects)
{
entity oldself;
float dm;
-
+
oldself = self;
for(self = world; (self = findfloat(self, damagedbycontents, TRUE)); )
{
if (self.movetype == MOVETYPE_NOCLIP) { continue; }
-
+
float vehic = (self.vehicle_flags & VHF_ISVEHICLE);
float projectile = (self.flags & FL_PROJECTILE);
-
+
if (self.watertype <= CONTENT_WATER && self.waterlevel > 0) // workaround a retarded bug made by id software :P (yes, it's that old of a bug)
{
if (!(self.flags & FL_INWATER))
}
}
}
-
+
if (self.dmgtime < time)
{
- self.dmgtime = time + autocvar_g_balance_contents_damagerate;
-
+ self.dmgtime = time + autocvar_g_balance_contents_damagerate;
+
if (projectile)
{
if (self.watertype == CONTENT_LAVA)
}
}
}
-
+
self.oldvelocity = self.velocity;
}
self = oldself;
.float gravity;
.vector colormod;
void ItemDraw()
-{
+{
if(self.gravity)
- {
+ {
Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
- if(self.move_flags & FL_ONGROUND)
+ if(self.move_flags & FL_ONGROUND)
{ // For some reason move_avelocity gets set to '0 0 0' here ...
self.oldorigin = self.origin;
self.gravity = 0;
- if(autocvar_cl_animate_items)
- { // ... so reset it if animations are requested.
+ if(autocvar_cl_animate_items)
+ { // ... so reset it if animations are requested.
if(self.ItemStatus & ITS_ANIMATE1)
self.move_avelocity = '0 180 0';
-
+
if(self.ItemStatus & ITS_ANIMATE2)
self.move_avelocity = '0 -90 0';
}
}
}
else if (autocvar_cl_animate_items)
- {
+ {
if(self.ItemStatus & ITS_ANIMATE1)
{
self.angles += self.move_avelocity * frametime;
- setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2));
- }
-
+ setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2));
+ }
+
if(self.ItemStatus & ITS_ANIMATE2)
{
self.angles += self.move_avelocity * frametime;
- setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3));
+ setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3));
}
}
}
void ItemDrawSimple()
{
if(self.gravity)
- {
- Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
-
+ {
+ Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
+
if(self.move_flags & FL_ONGROUND)
self.gravity = 0;
}
setorigin(self, self.origin);
self.oldorigin = self.origin;
}
-
- if(sf & ISF_ANGLES)
+
+ if(sf & ISF_ANGLES)
{
self.angles_x = ReadCoord();
self.angles_y = ReadCoord();
- self.angles_z = ReadCoord();
+ self.angles_z = ReadCoord();
self.move_angles = self.angles;
}
-
+
if(sf & ISF_STATUS) // need to read/write status frist so model can handle simple, fb etc.
{
- self.ItemStatus = ReadByte();
-
+ self.ItemStatus = ReadByte();
+
if(self.ItemStatus & ITS_AVAILABLE)
{
self.alpha = 1;
}
else
self.alpha = -1;
- }
-
+ }
+
if(autocvar_cl_fullbright_items)
if(self.ItemStatus & ITS_ALLOWFB)
self.effects |= EF_FULLBRIGHT;
-
+
if(self.ItemStatus & ITS_STAYWEP)
{
self.colormod = self.glowmod = autocvar_cl_weapon_stay_color;
self.alpha = autocvar_cl_weapon_stay_alpha;
-
+
}
-
+
if(self.ItemStatus & ITS_POWERUP)
{
if(self.ItemStatus & ITS_AVAILABLE)
self.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT);
}
}
-
+
if(sf & ISF_MODEL)
{
self.drawmask = MASK_NORMAL;
self.movetype = MOVETYPE_NOCLIP;
self.draw = ItemDraw;
-
+
if(self.mdl)
strunzone(self.mdl);
-
+
self.mdl = "";
string _fn = ReadString();
-
+
if(autocvar_cl_simple_items && (self.ItemStatus & ITS_ALLOWSI))
{
string _fn2 = substring(_fn, 0 , strlen(_fn) -4);
self.draw = ItemDrawSimple;
-
-
-
+
+
+
if(fexists(sprintf("%s%s.md3", _fn2, autocvr_cl_simpleitems_postfix)))
self.mdl = strzone(sprintf("%s%s.md3", _fn2, autocvr_cl_simpleitems_postfix));
else if(fexists(sprintf("%s%s.dpm", _fn2, autocvr_cl_simpleitems_postfix)))
dprint("Simple item requested for ", _fn, " but no model exsist for it\n");
}
}
-
- if(self.draw != ItemDrawSimple)
- self.mdl = strzone(_fn);
-
-
+
+ if(self.draw != ItemDrawSimple)
+ self.mdl = strzone(_fn);
+
+
if(self.mdl == "")
dprint("^1WARNING!^7 self.mdl is unset for item ", self.classname, " tell tZork aboute this!\n");
-
+
precache_model(self.mdl);
setmodel(self, self.mdl);
}
-
+
if(sf & ISF_COLORMAP)
self.colormap = ReadShort();
-
+
if(sf & ISF_DROP)
{
self.gravity = 1;
self.move_velocity_z = ReadCoord();
self.velocity = self.move_velocity;
self.move_origin = self.oldorigin;
-
+
if(!self.move_time)
{
self.move_time = time;
else
self.move_time = max(self.move_time, time);
}
-
+
if(autocvar_cl_animate_items)
- {
+ {
if(self.ItemStatus & ITS_ANIMATE1)
self.move_avelocity = '0 180 0';
-
+
if(self.ItemStatus & ITS_ANIMATE2)
self.move_avelocity = '0 -90 0';
}
sf |= ISF_DROP;
else
sf &= ~ISF_DROP;
-
- WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM);
+
+ WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM);
WriteByte(MSG_ENTITY, sf);
//WriteByte(MSG_ENTITY, self.cnt);
WriteCoord(MSG_ENTITY, self.origin_y);
WriteCoord(MSG_ENTITY, self.origin_z);
}
-
+
if(sf & ISF_ANGLES)
{
WriteCoord(MSG_ENTITY, self.angles_x);
if(sf & ISF_MODEL)
{
-
+
if(self.mdl == "")
dprint("^1WARNING!^7 self.mdl is unset for item ", self.classname, "exspect a crash just aboute now\n");
-
+
WriteString(MSG_ENTITY, self.mdl);
}
-
-
+
+
if(sf & ISF_COLORMAP)
WriteShort(MSG_ENTITY, self.colormap);
WriteCoord(MSG_ENTITY, self.velocity_y);
WriteCoord(MSG_ENTITY, self.velocity_z);
}
-
+
return TRUE;
}
*/
void Item_Show (entity e, float mode)
-{
+{
e.effects &= ~(EF_ADDITIVE | EF_STARDUST | EF_FULLBRIGHT | EF_NODEPTHTEST);
e.ItemStatus &= ~ITS_STAYWEP;
if (mode > 0)
e.spawnshieldtime = 1;
e.ItemStatus &= ~ITS_AVAILABLE;
}
-
+
if (e.items & IT_STRENGTH || e.items & IT_INVINCIBLE)
- e.ItemStatus |= ITS_POWERUP;
-
+ e.ItemStatus |= ITS_POWERUP;
+
if (autocvar_g_nodepthtestitems)
e.effects |= EF_NODEPTHTEST;
-
-
+
+
if (autocvar_g_fullbrightitems)
e.ItemStatus |= ITS_ALLOWFB;
-
+
if (autocvar_sv_simple_items)
e.ItemStatus |= ITS_ALLOWSI;
}
:skip
-
+
// always eat teamed entities
if(item.team)
pickedup = TRUE;
void Item_Touch (void)
{
entity e, head;
-
+
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
if(self.classname == "droppedweapon")
{
if(self.model == "")
self.model = itemmodel;
-
+
if(self.model == "")
{
error(strcat("^1Tried to spawn ", itemname, " with no model!\n"));
return;
}
-
+
if(self.item_pickupsound == "")
self.item_pickupsound = pickupsound;
-
+
if(!self.respawntime) // both need to be set
{
self.respawntime = defaultrespawntime;
if(weaponid)
self.weapons = WepSet_FromWeapon(weaponid);
-
+
self.flags = FL_ITEM | itemflags;
if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
remove (self);
return;
}
-
+
if(self.angles != '0 0 0')
self.SendFlags |= ISF_ANGLES;
self.netname = itemname;
self.touch = Item_Touch;
setmodel(self, "null"); // precision set below
- //self.effects |= EF_LOWPRECISION;
-
+ //self.effects |= EF_LOWPRECISION;
+
if((itemflags & FL_POWERUP) || self.health || self.armorvalue)
{
self.pos1 = '-16 -16 0';
self.pos2 = '16 16 32';
}
setsize (self, self.pos1, self.pos2);
-
- if(itemflags & FL_POWERUP)
+
+ if(itemflags & FL_POWERUP)
self.ItemStatus |= ITS_ANIMATE1;
-
+
if(self.armorvalue || self.health)
self.ItemStatus |= ITS_ANIMATE2;
-
+
if(itemflags & FL_WEAPON)
{
if (self.classname != "droppedweapon") // if dropped, colormap is already set up nicely
self.colormap = 1024; // color shirt=0 pants=0 grey
else
self.gravity = 1;
-
+
self.ItemStatus |= ITS_ANIMATE1;
self.ItemStatus |= ISF_COLORMAP;
}
{
if(!self.cnt)
self.cnt = 1; // item probability weight
-
+
self.effects |= EF_NODRAW; // marker for item team search
InitializeEntity(self, Item_FindTeam, INITPRIO_FINDTARGET);
}
else
Item_Reset();
-
+
Net_LinkEntity(self, FALSE, 0, ItemSend);
// call this hook after everything else has been done
e.strength_finished = max(0, e.strength_finished - time);
e.invincible_finished = max(0, e.invincible_finished - time);
e.superweapons_finished = max(0, e.superweapons_finished - time);
-
+
PREGIVE(e, items);
PREGIVE_WEAPONS(e);
PREGIVE(e, strength_finished);
void func_rotating_setactive(float astate)
{
-
+
if (astate == ACTIVE_TOGGLE)
- {
+ {
if(self.active == ACTIVE_ACTIVE)
self.active = ACTIVE_NOT;
else
}
else
self.active = astate;
-
- if(self.active == ACTIVE_NOT)
+
+ if(self.active == ACTIVE_NOT)
self.avelocity = '0 0 0';
else
self.avelocity = self.pos1;
precache_sound(self.noise);
ambientsound(self.origin, self.noise, VOL_BASE, ATTEN_IDLE);
}
-
+
self.active = ACTIVE_ACTIVE;
self.setactive = func_rotating_setactive;
-
+
if (!self.speed)
self.speed = 100;
// FIXME: test if this turns the right way, then remove this comment (negate as needed)
// FIXME: test if this turns the right way, then remove this comment (negate as needed)
else // Z
self.avelocity = '0 1 0' * self.speed;
-
+
self.pos1 = self.avelocity;
-
+
if(self.dmg && (self.message == ""))
self.message = " was squished";
if(self.dmg && (self.message2 == ""))
{
vector v;
self.nextthink = time + 0.1;
-
+
if (!(self.owner.active == ACTIVE_ACTIVE))
{
- self.owner.velocity = '0 0 0';
+ self.owner.velocity = '0 0 0';
return;
}
-
+
// calculate sinewave using makevectors
makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
v = self.owner.destvec + self.owner.movedir * v_forward_y;
float door_check_keys(void) {
local entity door;
-
-
+
+
if (self.owner)
door = self.owner;
else
door = self;
-
+
// no key needed
if (!door.itemkeys)
return TRUE;
// only a player can have a key
if (!IS_PLAYER(other))
return FALSE;
-
+
if (item_keys_usekey(door, other)) {
// some keys were used
if (other.key_door_messagetime <= time) {
entity oself;
//dprint("door_use (model: ");dprint(self.model);dprint(")\n");
-
+
if (self.owner)
{
oself = self;
if (time < self.attack_finished_single)
return;
-
+
// check if door is locked
if (!door_check_keys())
return;
-
+
self.attack_finished_single = time + 1;
activator = other;
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
self.health = self.health - damage;
-
+
if (self.itemkeys) {
// don't allow opening doors through damage if keys are required
return;
}
-
+
if (self.health <= 0)
{
oself = self;
self.itemkeys |= ITEM_KEY_BIT(0);
if (self.spawnflags & SPAWNFLAGS_SILVER_KEY)
self.itemkeys |= ITEM_KEY_BIT(1);
-
+
//if (!self.deathtype) // map makers can override this
// self.deathtype = " got in the way";
SetMovedir ();
self.nextthink = time + 0.1;
if (!(self.owner.active == ACTIVE_ACTIVE))
{
- self.owner.velocity = '0 0 0';
+ self.owner.velocity = '0 0 0';
return;
}
if (!(self.owner.active == ACTIVE_ACTIVE))
{
- self.owner.velocity = '0 0 0';
+ self.owner.velocity = '0 0 0';
return;
}
/*
* t_swamp.c
* Adds spawnfunc_trigger_swamp and suppoart routines for xonotic 1.2.1+
-* Author tZork (Jakob MG)
+* Author tZork (Jakob MG)
* jakob@games43.se
* 2005 11 29
*/
* It works like this: When the plyer enters teh swamp the spawnfunc_trigger_swamp
* attaches a new "swampslug" to the player. As long as the plyer is inside
* the swamp the swamp gives the slug new health. But the slug slowly kills itself
-* so when the player goes outside the swamp, it dies and releases the player from the
-* swamps curses (dmg/slowdown)
-*
+* so when the player goes outside the swamp, it dies and releases the player from the
+* swamps curses (dmg/slowdown)
+*
* I do it this way becuz there is no "untouch" event.
*
-* --NOTE--
+* --NOTE--
* THE ACCTUAL slowdown is done in cl_physics.c on line 57-60
* --NOTE--
*/
-void swampslug_think(void)
+void swampslug_think(void)
{
//Slowly kill the slug
self.health = self.health - 1;
//centerprint(self.owner,"Killing slug...\n");
return;
}
-
+
// Slug still alive, so we are still in the swamp
// Or we have exited it very recently.
// Do the damage and renew the timer.
self.nextthink = time + self.swamp_interval;
}
-void swamp_touch(void)
+void swamp_touch(void)
{
// If whatever thats touching the swamp is not a player
// or if its a dead player, just dont care abt it.
}
/*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
-Players gettin into the swamp will
+Players gettin into the swamp will
get slowd down and damaged
*/
void spawnfunc_trigger_swamp(void)
{
// Init stuff
EXACTTRIGGER_INIT;
- self.touch = swamp_touch;
+ self.touch = swamp_touch;
// Setup default keys, if missing
- if(self.dmg <= 0)
+ if(self.dmg <= 0)
self.dmg = 5;
- if(self.swamp_interval <= 0)
+ if(self.swamp_interval <= 0)
self.swamp_interval = 1;
- if(self.swamp_slowdown <= 0)
+ if(self.swamp_slowdown <= 0)
self.swamp_slowdown = 0.5;
}
if(head != player) \
if(head.takedamage) \
if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
-
+
float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax)
{
vector locout;
entity e;
float p;
-
+
// Find the output teleporter
if(teleporter.enemy)
{
e = teleporter.enemy;
}
else
- {
+ {
RandomSelection_Init();
for(e = world; (e = find(e, targetname, teleporter.target)); )
{
}
if(!e) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
-
+
makevectors(e.mangle);
if(e.speed)
if(vlen(player.velocity) > e.speed)
player.velocity = normalize(player.velocity) * max(0, e.speed);
-
+
if(autocvar_g_teleport_maxspeed)
if(vlen(player.velocity) > autocvar_g_teleport_maxspeed)
player.velocity = normalize(player.velocity) * max(0, autocvar_g_teleport_maxspeed);
if (self.active != ACTIVE_ACTIVE)
return;
-
+
if (!other.teleportable)
return;
-
+
if(other.vehicle)
if(!other.vehicle.teleportable)
return;
-
+
if(other.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
return;
-
+
if(other.deadflag != DEAD_NO)
return;
if(IS_PLAYER(other))
RemoveGrapplingHook(other);
-
+
entity e;
e = Simple_TeleportPlayer(self, other);
return world;
}
-entity teleport_first;
+entity teleport_first;
.entity teleport_next;
void spawnfunc_trigger_teleport (void)
{
self.angles = '0 0 0';
EXACTTRIGGER_INIT;
-
- self.active = ACTIVE_ACTIVE;
-
+
+ self.active = ACTIVE_ACTIVE;
+
self.use = trigger_teleport_use;
// this must be called to spawn the teleport waypoints for bots
objerror ("Teleporter with no target");
return;
}
-
+
self.teleport_next = teleport_first;
teleport_first = self;
}
++c; // increase count to not include MYSELF
for(e = world; (e = findfloat(e, target_spawn_id, self.target_spawn_id)); --c)
;
-
+
// if c now is 0, we have AT LEAST the given count (maybe more), so don't spawn any more
if(c == 0)
return 0;
have_team_spawns = -1; // request team spawns
MUTATOR_ADD(gamemode_nexball);
}
-
+
if(g_keepaway)
{
MUTATOR_ADD(gamemode_keepaway);
cb -= cbb * 0.999;
}
}
-
+
// keep teams alive (teams of size 0 always count as smaller, ignoring score)
if(ca < 1)
if(cb >= 1)
GetTeamCounts(world);
RandomSelection_Init();
-
+
t = 1;
if(TeamSmallerEqThanTeam(2, t, pl))
t = 2;
// Lead?
if (self.aim_flags & TFL_AIM_LEAD)
- {
+ {
if (self.aim_flags & TFL_AIM_SHOTTIMECOMPENSATE) // Need to conpensate for shot traveltime
{
// FIXME: this cant be the best way to do this..
else
pre_pos = pre_pos + self.enemy.velocity * mintime;
}
-
+
if(self.aim_flags & TFL_AIM_GROUNDGROUND)
{
//tracebox(pre_pos + '0 0 32',self.enemy.mins,self.enemy.maxs,pre_pos -'0 0 64',MOVE_WORLDONLY,self.enemy);
self.SendFlags |= TNSF_STATUS;
self.nextthink = time + 0.2;
self.think = turret_hide;
-
+
if (self.turret_diehook)
self.turret_diehook();
}
self.deadflag = DEAD_NO;
self.effects = EF_LOWPRECISION;
self.solid = SOLID_BBOX;
-
+
self.takedamage = DAMAGE_AIM;
self.event_damage = turret_stdproc_damage;
self.nextthink = time + self.ticrate;
self.think = turret_think;
-
+
self.SendFlags = TNSF_FULL_UPDATE;
if (self.turret_respawnhook)
{
self.tur_head.angles_x = self.tur_head.angles_x + (-0.5 + random()) * damage;
self.tur_head.angles_y = self.tur_head.angles_y + (-0.5 + random()) * damage;
-
+
self.SendFlags |= TNSF_ANG;
}
if (self.turrcaps_flags & TFL_TURRCAPS_MOVE)
self.velocity = self.velocity + vforce;
-
+
if (self.health <= 0)
{
self.event_damage = func_null;
self.nextthink = time;
self.think = turret_stdproc_die;
}
-
+
self.SendFlags |= TNSF_STATUS;
}
#define cvar_base "g_turrets_unit_"
.float clientframe;
void turrets_setframe(float _frame, float client_only)
-{
+{
if((client_only ? self.clientframe : self.frame ) != _frame)
{
self.SendFlags |= TNSF_ANIM;
self.anim_start_time = time;
}
-
+
if(client_only)
self.clientframe = _frame;
else
self.frame = _frame;
-
+
}
float turret_send(entity to, float sf)
{
-
- WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET);
+
+ WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET);
WriteByte(MSG_ENTITY, sf);
if(sf & TNSF_SETUP)
{
WriteByte(MSG_ENTITY, self.turret_type);
-
+
WriteCoord(MSG_ENTITY, self.origin_x);
WriteCoord(MSG_ENTITY, self.origin_y);
WriteCoord(MSG_ENTITY, self.origin_z);
-
+
WriteAngle(MSG_ENTITY, self.angles_x);
WriteAngle(MSG_ENTITY, self.angles_y);
}
-
+
if(sf & TNSF_ANG)
{
WriteShort(MSG_ENTITY, rint(self.tur_head.angles_x));
WriteShort(MSG_ENTITY, rint(self.tur_head.angles_y));
}
-
+
if(sf & TNSF_AVEL)
- {
+ {
WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x));
WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y));
}
-
+
if(sf & TNSF_MOVE)
{
WriteShort(MSG_ENTITY, rint(self.origin_x));
WriteShort(MSG_ENTITY, rint(self.velocity_x));
WriteShort(MSG_ENTITY, rint(self.velocity_y));
- WriteShort(MSG_ENTITY, rint(self.velocity_z));
-
- WriteShort(MSG_ENTITY, rint(self.angles_y));
+ WriteShort(MSG_ENTITY, rint(self.velocity_z));
+
+ WriteShort(MSG_ENTITY, rint(self.angles_y));
}
-
+
if(sf & TNSF_ANIM)
{
WriteCoord(MSG_ENTITY, self.anim_start_time);
WriteByte(MSG_ENTITY, self.frame);
}
-
+
if(sf & TNSF_STATUS)
{
WriteByte(MSG_ENTITY, self.team);
-
+
if(self.health <= 0)
WriteByte(MSG_ENTITY, 0);
else
WriteByte(MSG_ENTITY, ceil((self.health / self.tur_health) * 255));
}
-
+
return TRUE;
}
void turret_projectile_explode()
{
-
+
self.takedamage = DAMAGE_NO;
- self.event_damage = func_null;
+ self.event_damage = func_null;
#ifdef TURRET_DEBUG
float d;
d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
proj.owner = self;
proj.realowner = self;
proj.bot_dodge = TRUE;
- proj.bot_dodgerating = self.shot_dmg;
+ proj.bot_dodgerating = self.shot_dmg;
proj.think = turret_projectile_explode;
proj.touch = turret_projectile_touch;
- proj.nextthink = time + 9;
+ proj.nextthink = time + 9;
proj.movetype = MOVETYPE_FLYMISSILE;
- proj.velocity = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
+ proj.velocity = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
proj.flags = FL_PROJECTILE;
proj.enemy = self.enemy;
proj.totalfrags = _death;
proj.flags |= FL_NOTARGET;
CSQCProjectile(proj, _cli_anim, _proj_type, _cull);
-
+
return proj;
}
}
else*/
tracebox(self.tur_shotorg, '-1 -1 -1','1 1 1', self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos), MOVE_NORMAL,self);
-
- self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos) - (vlen(self.enemy.maxs - self.enemy.mins) * 0.5);
+
+ self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos) - (vlen(self.enemy.maxs - self.enemy.mins) * 0.5);
self.tur_impactent = trace_ent;
self.tur_impacttime = vlen(self.tur_shotorg - trace_endpos) / self.shot_speed;
vector v1, v2;
v1 = self.tur_head.angles;
v2 = self.tur_head.avelocity;
-
+
if (self.track_flags == TFL_TRACK_NO)
return;
}
else
{
- target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg));
+ target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg));
}
-
+
self.tur_head.angles_x = anglemods(self.tur_head.angles_x);
self.tur_head.angles_y = anglemods(self.tur_head.angles_y);
// Find the diffrence between where we currently aim and where we want to aim
//move_angle = target_angle - (self.angles + self.tur_head.angles);
//move_angle = shortangle_vxy(move_angle,(self.angles + self.tur_head.angles));
-
- move_angle = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(self.angles), AnglesTransform_FromAngles(target_angle))) - self.tur_head.angles;
+
+ move_angle = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(self.angles), AnglesTransform_FromAngles(target_angle))) - self.tur_head.angles;
move_angle = shortangle_vxy(move_angle, self.tur_head.angles);
switch(self.track_type)
if(self.tur_head.angles_y < -self.aim_maxrot)
self.tur_head.angles_y = self.aim_maxrot;
}
-
+
// CSQC
self.SendFlags |= TNSF_ANG;
-
+
return;
case TFL_TRACKTYPE_FLUIDINERTIA:
{
self.tur_head.avelocity_x = 0;
self.tur_head.angles_x = self.aim_maxpitch;
-
+
self.SendFlags |= TNSF_ANG;
}
-
+
if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) < -self.aim_maxpitch)
{
self.tur_head.avelocity_x = 0;
self.tur_head.angles_x = -self.aim_maxpitch;
-
+
self.SendFlags |= TNSF_ANG;
}
}
{
self.tur_head.avelocity_y = 0;
self.tur_head.angles_y = self.aim_maxrot;
-
+
self.SendFlags |= TNSF_ANG;
}
{
self.tur_head.avelocity_y = 0;
self.tur_head.angles_y = -self.aim_maxrot;
-
+
self.SendFlags |= TNSF_ANG;
}
}
-
+
self.SendFlags |= TNSF_AVEL;
-
+
// Force a angle update every 10'th frame
self.turret_framecounter += 1;
if(self.turret_framecounter >= 10)
- {
+ {
self.SendFlags |= TNSF_ANG;
self.turret_framecounter = 0;
- }
+ }
}
float turret_stdproc_firecheck()
{
// This one just dont care =)
- if (self.firecheck_flags & TFL_FIRECHECK_NO)
+ if (self.firecheck_flags & TFL_FIRECHECK_NO)
return 1;
if (self.enemy == world)
if (self.shoot_flags & TFL_SHOOT_VOLLYALWAYS)
if (self.volly_counter != self.shot_volly)
if(self.ammo >= self.shot_dmg)
- return 1;
+ return 1;
// Lack of zombies makes shooting dead things unnecessary :P
if (self.firecheck_flags & TFL_FIRECHECK_DEAD)
if (self.firecheck_flags & TFL_FIRECHECK_OTHER_AMMO)
if (self.enemy.ammo >= self.enemy.ammo_max)
return 0;
-
+
// Target of opertunity?
if(turret_validate_target(self, self.tur_impactent, self.target_validate_flags) > 0)
{
self.enemy = self.tur_impactent;
return 1;
- }
+ }
if (self.firecheck_flags & TFL_FIRECHECK_DISTANCES)
{
// To close?
if (self.tur_dist_aimpos < self.target_range_min)
- if(turret_validate_target(self, self.tur_impactent, self.target_validate_flags) > 0)
+ if(turret_validate_target(self, self.tur_impactent, self.target_validate_flags) > 0)
return 1; // Target of opertunity?
- else
- return 0;
+ else
+ return 0;
}
// Try to avoid FF?
float turret_validate_target(entity e_turret, entity e_target, float validate_flags)
{
vector v_tmp;
-
+
//if(!validate_flags & TFL_TARGETSELECT_NOBUILTIN)
// return -0.5;
return -0.5;
if (!checkpvs(e_target.origin, e_turret))
- return -1;
+ return -1;
if (!e_target)
return -2;
return -5;
// Cant touch this
- if(e_target.vehicle_flags & VHF_ISVEHICLE)
+ if(e_target.vehicle_flags & VHF_ISVEHICLE)
{
if (e_target.vehicle_health <= 0)
return -6;
e = findradius(self.origin, self.target_range);
// Nothing to aim at?
- if (!e)
+ if (!e)
return world;
while (e)
entity e;
self.nextthink = time + self.ticrate;
-
+
// ONS uses somewhat backwards linking.
if (teamplay)
{
if (!(self.spawnflags & TSF_NO_AMMO_REGEN))
if (self.ammo < self.ammo_max)
self.ammo = min(self.ammo + self.ammo_recharge, self.ammo_max);
-
+
// Inactive turrets needs to run the think loop,
// So they can handle animation and wake up if need be.
if (!self.active)
// Are turrets allowed?
if (autocvar_g_turrets == 0)
return 0;
-
+
if(_turret_type < 1 || _turret_type > TID_LAST)
{
dprint("Invalid / Unkown turret type\"", ftos(_turret_type), "\", aborting!\n");
return 0;
- }
+ }
self.turret_type = _turret_type;
-
+
e = find(world, classname, "turret_manager");
if (!e)
{
e.think = turrets_manager_think;
e.nextthink = time + 2;
}
-
+
if (!(self.spawnflags & TSF_SUSPENDED))
builtin_droptofloor(); // why can't we use regular droptofloor here?
load_unit_settings(self, self.cvar_basename, 0);
self.effects = EF_NODRAW;
-
+
// Handle turret teams.
if (!teamplay)
self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
* as possible beforehand.
*/
if (!self.ticrate)
- {
+ {
if (self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
self.ticrate = 0.2; // Support units generaly dont need to have a high speed ai-loop
else
self.ticrate = 0.1; // 10 fps for normal turrets
}
-
+
self.ticrate = bound(sys_frametime, self.ticrate, 60); // keep it sane
// General stuff
// Offsets & origins
if (!self.tur_shotorg) self.tur_shotorg = '50 0 50';
-
+
if (!self.health)
self.health = 150;
self.turret_firecheckfunc = turret_stdproc_firecheck;
self.turret_firefunc = turret_stdproc_fire;
self.event_damage = turret_stdproc_damage;
-
+
if (self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
self.turret_score_target = turret_stdproc_targetscore_support;
else
activator = ee;
self.use();
}
-
+
turret_link();
- turret_stdproc_respawn();
+ turret_stdproc_respawn();
turret_tag_fire_update();
-
+
return 1;
}
float anglemods(float v)
{
v = v - 360 * floor(v / 360);
-
+
if(v >= 180)
return v - 360;
else if(v <= -180)
return v + 360;
- else
+ else
return v;
}
vector angleofs(entity from, entity to)
{
vector v_res;
-
+
v_res = normalize(to.origin - from.origin);
v_res = vectoangles(v_res);
v_res = v_res - from.angles;
vector angleofs3(vector from, vector from_a, entity to)
{
vector v_res;
-
+
v_res = normalize(to.origin - from);
v_res = vectoangles(v_res);
v_res = v_res - from_a;
}
/*
-* Railgun-like beam, but has thickness and suppots slowing of target
+* Railgun-like beam, but has thickness and suppots slowing of target
*/
void FireImoBeam (vector start, vector end, vector smin, vector smax,
float bforce, float f_dmg, float f_velfactor, float deathtype)
e.colormod = v_color;
SUB_SetFade(e,time,f_time);
}
-#endif
+#endif
{
if(self.enemy)
te_lightning1(self,self.origin, self.enemy.origin);
-
+
self.nextthink = time + 0.25;
}
#endif
{
setorigin(self,self.origin);
self.think = turret_checkpoint_init;
- self.nextthink = time + 0.2;
+ self.nextthink = time + 0.2;
}
// Compat.
{
float i;
entity _mis;
-
+
for (i = 0; i < 1; ++i)
{
turret_do_updates(self);
- _mis = turret_projectile("weapons/lasergun_fire.wav", 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_LASER, TRUE, TRUE);
+ _mis = turret_projectile("weapons/lasergun_fire.wav", 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_LASER, TRUE, TRUE);
_mis.missile_flags = MIF_SPLASH;
pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
self.pathcurrent = self.pathcurrent.path_next;
#else
- if (vlen(self.origin - self.pathcurrent.origin) < 64)
+ if (vlen(self.origin - self.pathcurrent.origin) < 64)
self.pathcurrent = self.pathcurrent.enemy;
#endif
{
float newframe;
-
+
self.steerto = steerlib_arrive(self.enemy.origin,self.target_range_optimal);
//self.steerto = steerlib_standoff(self.enemy.origin,self.target_range_optimal);
newframe = ewheel_amin_stop;
movelib_beak_simple(autocvar_g_turrets_unit_ewheel_speed_stop);
}
-
+
turrets_setframe(newframe , FALSE);
-
+
/*if(self.frame != newframe)
{
self.frame = newframe;
self.velocity_z = vz;
-
+
if(vlen(self.velocity))
self.SendFlags |= TNSF_MOVE;
}
// Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
if(self.movetype != MOVETYPE_WALK)
return;
-
+
self.velocity = '0 0 0';
self.enemy = world;
{
entity e;
- if (self.netname == "")
+ if (self.netname == "")
self.netname = "eWheel Turret";
if (self.target != "")
remove(self);
return;
}
-
+
self.frame = 1;
self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
if(self.enemy != world)
if(vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 3)
setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
-
+
#ifdef TURRET_DEBUG
float d;
d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
entity proj;
turret_tag_fire_update();
-
- proj = turret_projectile("weapons/hagar_fire.wav", 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, TRUE, TRUE);
+
+ proj = turret_projectile("weapons/hagar_fire.wav", 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, TRUE, TRUE);
pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
proj.think = turret_flac_projectile_think_explode;
proj.nextthink = time + self.tur_impacttime + (random() * 0.01 - random() * 0.01);
proj.missile_flags = MIF_SPLASH | MIF_PROXY;
-
+
self.tur_head.frame = self.tur_head.frame + 1;
- if (self.tur_head.frame >= 4)
+ if (self.tur_head.frame >= 4)
self.tur_head.frame = 0;
}
void turret_flac_dinit()
{
- if (self.netname == "")
+ if (self.netname == "")
self.netname = "FLAC Cannon";
self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_FASTPROJ | TFL_TURRCAPS_MISSILEKILL;
self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
-
+
if (turret_stdproc_init("flac_std", "models/turrets/base.md3", "models/turrets/flac.md3", TID_FLAC) == 0)
{
remove(self);
self.damage_flags |= TFL_DMG_HEADSHAKE;
self.target_select_flags |= TFL_TARGETSELECT_NOTURRETS | TFL_TARGETSELECT_MISSILESONLY;
-
+
// Our fire routine
self.turret_firefunc = turret_flac_attack;
**/
float turret_fusionreactor_firecheck()
{
- if (self.attack_finished_single > time)
+ if (self.attack_finished_single > time)
return 0;
if (self.enemy.deadflag != DEAD_NO)
if (self.enemy.ammo >= self.enemy.ammo_max)
return 0;
-
+
if (vlen(self.enemy.origin - self.origin) > self.target_range)
- return 0;
-
+ return 0;
+
if(self.team != self.enemy.team)
return 0;
-
+
if (!(self.enemy.ammo_flags & TFL_AMMO_ENERGY))
- return 0;
-
+ return 0;
+
return 1;
}
void turret_hellion_attack()
{
entity missile;
-
+
if(self.tur_head.frame != 0)
self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
else
self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
-
+
missile = turret_projectile("weapons/rocket_fire.wav", 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE);
te_explosion (missile.origin);
missile.think = turret_hellion_missile_think;
missile.cnt = time + 30;
missile.ticrate = max(autocvar_sys_ticrate, 0.05);
missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_AI;
-
+
if (self.tur_head.frame == 0)
self.tur_head.frame = self.tur_head.frame + 1;
void turret_hk_dinit()
{
- if (self.netname == "")
+ if (self.netname == "")
self.netname = "Hunter-killer turret";
self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_RECIVETARGETS;
self.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
self.turrcaps_flags = TFL_TURRCAPS_PLAYERKILL;
self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
-
+
if (!autocvar_g_antilag_bullets)
self.turrcaps_flags |= TFL_TURRCAPS_HITSCAN;
void turret_mlrs_attack()
{
entity missile;
-
- turret_tag_fire_update();
+
+ turret_tag_fire_update();
missile = turret_projectile("weapons/rocket_fire.wav", 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE);
missile.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 2) / self.shot_speed);
missile.missile_flags = MIF_SPLASH;
- te_explosion (missile.origin);
+ te_explosion (missile.origin);
}
void turret_mlrs_dinit()
{
float flying;
flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
-
+
FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
800, 0, 0, 0, 0, DEATH_TURRET_PLASMA);
}
void turret_plasma_attack()
-{
- entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
+{
+ entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
missile.missile_flags = MIF_SPLASH;
-
+
pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
if (self.tur_head.frame == 0)
self.tur_head.frame = 1;
void turret_plasma_dual_attack()
{
- entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
- missile.missile_flags = MIF_SPLASH;
+ entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
+ missile.missile_flags = MIF_SPLASH;
pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
self.tur_head.frame += 1;
}
}
if (etarget)
- {
+ {
te_csqc_lightningarc(from.origin,etarget.origin);
Damage(etarget, self, self, damage, DEATH_TURRET_TESLA, etarget.origin, '0 0 0');
etarget.railgunhit = 1;
{
// g_turrets_targetscan_maxdelay forces a target re-scan at least this often
float do_target_scan = 0;
-
+
if((self.target_select_time + autocvar_g_turrets_targetscan_maxdelay) < time)
do_target_scan = 1;
{
vector where;
entity e;
-
+
makevectors(self.angles);
where = self.origin + v_forward * 128;
e = findradius(where,32);
- while (e)
+ while (e)
{
if (turret_validate_target(self, e, self.target_validate_flags))
if (e != self && e.owner != self)
{
self.health = self.health - damage;
self.velocity = self.velocity + vforce;
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(self.owner, walker_rocket_explode);
}
void walker_fire_rocket(vector org)
{
entity rocket;
-
+
fixedmakevectors(self.angles);
te_explosion (org);
rocket.tur_shotorg = randomvec() * 512;
rocket.cnt = time + 1;
rocket.enemy = self.enemy;
-
+
if (random() < 0.01)
rocket.think = walker_rocket_loop;
else
rocket.solid = SOLID_BBOX;
rocket.tur_health = time + 9;
rocket.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
-
+
CSQCProjectile(rocket, FALSE, PROJECTILE_ROCKET, FALSE); // no culling, has fly sound
}
if(self.enemy)
{
self.enemy_last_loc = _target;
- self.enemy_last_time = time;
+ self.enemy_last_time = time;
}
}
walker_move_to(self.moveto, 0);
#else
- if (vlen(self.origin - self.pathcurrent.origin) < 64)
+ if (vlen(self.origin - self.pathcurrent.origin) < 64)
self.pathcurrent = self.pathcurrent.enemy;
-
+
if(!self.pathcurrent)
return;
-
+
self.moveto = self.pathcurrent.origin;
self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
walker_move_to(self.moveto, 0);
{
if(vlen(self.origin - self.enemy_last_loc) < 128 || time - self.enemy_last_time > 10)
self.enemy_last_time = 0;
- else
+ else
walker_move_to(self.enemy_last_loc, 0);
}
else
- {
+ {
if(self.animflag != ANIM_NO)
- {
+ {
traceline(self.origin + '0 0 64', self.origin + '0 0 64' + v_forward * 128, MOVE_NORMAL, self);
-
+
if(trace_fraction != 1.0)
self.tur_head.idletime = -1337;
else
{
- traceline(trace_endpos, trace_endpos - '0 0 256', MOVE_NORMAL, self);
+ traceline(trace_endpos, trace_endpos - '0 0 256', MOVE_NORMAL, self);
if(trace_fraction == 1.0)
self.tur_head.idletime = -1337;
}
-
+
if(self.tur_head.idletime == -1337)
{
- self.moveto = self.origin + randomvec() * 256;
+ self.moveto = self.origin + randomvec() * 256;
self.tur_head.idletime = 0;
}
self.moveto = self.moveto * 0.9 + ((self.origin + v_forward * 500) + randomvec() * 400) * 0.1;
- self.moveto_z = self.origin_z + 64;
+ self.moveto_z = self.origin_z + 64;
walker_move_to(self.moveto, 0);
- }
-
+ }
+
if(self.idletime < time)
{
if(random() < 0.5 || !(self.spawnflags & TSL_ROAM))
{
self.animflag = ANIM_WALK;
self.idletime = time + 4 + random() * 2;
- self.moveto = self.origin + randomvec() * 256;
+ self.moveto = self.origin + randomvec() * 256;
self.tur_head.moveto = self.moveto;
self.tur_head.idletime = 0;
}
}
- }
+ }
}
}
else
if (self.tur_dist_enemy < autocvar_g_turrets_unit_walker_std_meele_range && self.animflag != ANIM_MEELE)
{
vector wish_angle;
-
- wish_angle = angleofs(self, self.enemy);
+
+ wish_angle = angleofs(self, self.enemy);
if (self.animflag != ANIM_SWIM)
if (fabs(wish_angle_y) < 15)
{
}
}
else if (self.tur_head.attack_finished_single < time)
- {
+ {
if(self.tur_head.shot_volly)
{
self.animflag = ANIM_NO;
-
+
self.tur_head.shot_volly = self.tur_head.shot_volly -1;
if(self.tur_head.shot_volly == 0)
self.tur_head.attack_finished_single = time + autocvar_g_turrets_unit_walker_std_rocket_refire;
else
self.tur_head.attack_finished_single = time + 0.2;
-
+
if(self.tur_head.shot_volly > 1)
walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket01")));
else
}
else
{
- if (self.tur_dist_enemy > autocvar_g_turrets_unit_walker_std_rockets_range_min)
+ if (self.tur_dist_enemy > autocvar_g_turrets_unit_walker_std_rockets_range_min)
if (self.tur_dist_enemy < autocvar_g_turrets_unit_walker_std_rockets_range)
self.tur_head.shot_volly = 4;
}
}
else
- {
+ {
if (self.animflag != ANIM_MEELE)
walker_move_to(self.enemy.origin, self.tur_dist_enemy);
}
real_angle = vectoangles(self.steerto) - self.angles;
vz = self.velocity_z;
-
+
switch (self.animflag)
{
case ANIM_NO:
case ANIM_PAIN:
if(self.frame != ANIM_PAIN)
defer(0.25, walker_setnoanim);
-
+
break;
case ANIM_MEELE:
case ANIM_SWIM:
turny = autocvar_g_turrets_unit_walker_turn_swim;
turnx = autocvar_g_turrets_unit_walker_turn_swim;
-
+
self.angles_x += bound(-10, shortangle_f(real_angle_x, self.angles_x), 10);
movelib_move_simple(v_forward, autocvar_g_turrets_unit_walker_speed_swim, 0.3);
vz = self.velocity_z + sin(time * 4) * 8;
movelib_move_simple(v_forward ,autocvar_g_turrets_unit_walker_speed_roam, 0.5);
break;
}
-
+
if(turny)
- {
+ {
turny = bound( turny * -1, shortangle_f(real_angle_y, self.angles_y), turny );
self.angles_y += turny;
}
if(turnx)
- {
+ {
turnx = bound( turnx * -1, shortangle_f(real_angle_x, self.angles_x), turnx );
self.angles_x += turnx;
}
- self.velocity_z = vz;
+ self.velocity_z = vz;
}
-
+
if(self.origin != self.oldorigin)
self.SendFlags |= TNSF_MOVE;
-
+
self.oldorigin = self.origin;
turrets_setframe(self.animflag, FALSE);
}
// Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
if(self.movetype != MOVETYPE_WALK)
return;
-
+
setorigin(self, self.pos1);
self.angles = self.pos2;
-
+
if (self.target != "")
{
e = find(world, targetname, self.target);
self.damagedbycontents = TRUE;
self.movetype = MOVETYPE_WALK;
self.solid = SOLID_SLIDEBOX;
- self.takedamage = DAMAGE_AIM;
+ self.takedamage = DAMAGE_AIM;
setorigin(self, self.origin);
tracebox(self.origin + '0 0 128', self.mins, self.maxs, self.origin - '0 0 10000', MOVE_NORMAL, self);
setorigin(self, trace_endpos + '0 0 4');
self = vehic;
-
-
+
+
vehic.solid = SOLID_NOT;
//setorigin(gunner, vehic.origin);
gunner.velocity = vehic.velocity;
-
+
float _in, _out;
vehic.angles_x *= -1;
makevectors(vehic.angles);
{
_in = autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
_out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
- setorigin(gunner, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
+ setorigin(gunner, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
}
-
+
crosshair_trace(gunner);
vector _ct = trace_endpos;
vector ad;
WriteAngle(MSG_ONE, self.vehicle.angles_y);
WriteAngle(MSG_ONE, 0);
}
-
+
CSQCVehicleSetup(self, HUD_NORMAL);
setsize(self, PL_MIN, PL_MAX);
if(self == self.vehicle.owner.gunner1)
{
- self.vehicle.owner.gunner1 = world;
+ self.vehicle.owner.gunner1 = world;
}
else if(self == self.vehicle.owner.gunner2)
{
- self.vehicle.owner.gunner2 = world;
+ self.vehicle.owner.gunner2 = world;
v_right *= -1;
- }
+ }
else
dprint("^1self != gunner1 or gunner2, this is a BIG PROBLEM, tell tZork this happend.\n");
-
+
vector spot = self.vehicle.owner.origin + + v_up * 128 + v_right * 300;
spot = vehicles_findgoodexit(spot);
//setorigin(self , spot);
_gun.vehicle_hudmodel.viewmodelforclient = other;
CSQCVehicleSetup(other, other.hud);
-
+
vh_player = other;
vh_vehicle = _gun;
MUTATOR_CALLHOOK(VehicleEnter);
// Pitch
ftmp = 0;
- if(pilot.movement_x > 0 && vang_x < autocvar_g_vehicle_bumblebee_pitchlimit)
+ if(pilot.movement_x > 0 && vang_x < autocvar_g_vehicle_bumblebee_pitchlimit)
ftmp = 4;
- else if(pilot.movement_x < 0 && vang_x > -autocvar_g_vehicle_bumblebee_pitchlimit)
+ else if(pilot.movement_x < 0 && vang_x > -autocvar_g_vehicle_bumblebee_pitchlimit)
ftmp = -8;
newvel_x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x , autocvar_g_vehicle_bumblebee_pitchlimit);
vehic.velocity += newvel * frametime;
pilot.velocity = pilot.movement = vehic.velocity;
-
+
if(autocvar_g_vehicle_bumblebee_healgun_locktime)
- {
+ {
if(vehic.tur_head.lock_time < time || vehic.tur_head.enemy.deadflag)
vehic.tur_head.enemy = world;
}
}
else
- {
+ {
vehic.tur_head.enemy = trace_ent;
vehic.tur_head.lock_time = time + autocvar_g_vehicle_bumblebee_healgun_locktime;
}
}
-
+
if(vehic.tur_head.enemy)
{
- trace_endpos = real_origin(vehic.tur_head.enemy);
- UpdateAuxiliaryXhair(pilot, trace_endpos, '0 0.75 0', 0);
+ trace_endpos = real_origin(vehic.tur_head.enemy);
+ UpdateAuxiliaryXhair(pilot, trace_endpos, '0 0.75 0', 0);
}
}
-
+
vang = vehicle_aimturret(vehic, trace_endpos, self.gun3, "fire",
autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up,
autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides * -1, autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides, autocvar_g_vehicle_bumblebee_raygun_turnspeed);
{
vehic.gun3.enemy.realowner = pilot;
vehic.gun3.enemy.effects &= ~EF_NODRAW;
-
+
vehic.gun3.enemy.hook_start = gettaginfo(vehic.gun3, gettagindex(vehic.gun3, "fire"));
vehic.gun3.enemy.SendFlags |= BRG_START;
-
+
traceline(vehic.gun3.enemy.hook_start, vehic.gun3.enemy.hook_start + v_forward * autocvar_g_vehicle_bumblebee_raygun_range, MOVE_NORMAL, vehic);
-
+
if(trace_ent)
{
if(autocvar_g_vehicle_bumblebee_raygun)
}
}
}
-
+
vehic.gun3.enemy.hook_end = trace_endpos;
setorigin(vehic.gun3.enemy, trace_endpos);
vehic.gun3.enemy.SendFlags |= BRG_END;
-
+
vehic.wait = time + 1;
}
else
vehic.gun3.enemy = world;
}
*/
-
+
VEHICLE_UPDATE_PLAYER(pilot, health, bumblebee);
VEHICLE_UPDATE_PLAYER(pilot, energy, bumblebee);
if(vehic.vehicle_flags & VHF_HASSHIELD)
VEHICLE_UPDATE_PLAYER(pilot, shield, bumblebee);
-
+
vehic.angles_x *= -1;
makevectors(vehic.angles);
vehic.angles_x *= -1;
void bumb_think()
{
self.movetype = MOVETYPE_TOSS;
-
+
//self.velocity = self.velocity * 0.5;
self.angles_z *= 0.8;
self.angles_x *= 0.8;
-
+
self.nextthink = time + 0.05;
-
+
if(!self.owner)
{
- entity oldself = self;
+ entity oldself = self;
if(self.gunner1)
{
self = self.gunner1;
other = oldother;
return;
}
-
+
if(self.gunner2)
{
self = self.gunner2;
self.touch();
other = oldother;
return;
- }
+ }
}
-
+
}
void bumb_enter()
self.touch = vehicles_touch;
self.think = bumb_think;
self.nextthink = time;
-
+
if(!self.owner)
return;
-
+
fixedmakevectors(self.angles);
vector spot;
- if(vlen(self.velocity) > autocvar_g_vehicle_bumblebee_speed_forward * 0.5)
+ if(vlen(self.velocity) > autocvar_g_vehicle_bumblebee_speed_forward * 0.5)
spot = self.origin + v_up * 128 + v_forward * 200;
else
spot = self.origin + v_up * 128 - v_forward * 200;
-
+
spot = vehicles_findgoodexit(spot);
-
+
// Hide beam
if(self.gun3.enemy || !wasfreed(self.gun3.enemy)) {
self.gun3.enemy.effects |= EF_NODRAW;
self.owner.velocity = 0.75 * self.vehicle.velocity + normalize(spot - self.vehicle.origin) * 200;
self.owner.velocity_z += 10;
setorigin(self.owner, spot);
-
+
antilag_clear(self.owner);
self.owner = world;
}
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum("explosion_large"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
-
+
if(self.owner.deadflag == DEAD_DYING)
self.owner.deadflag = DEAD_DEAD;
-
+
remove(self);
}
void bumb_die()
{
entity oldself = self;
-
+
// Hide beam
if(self.gun3.enemy || !wasfreed(self.gun3.enemy))
self.gun3.enemy.effects |= EF_NODRAW;
-
+
if(self.gunner1)
{
self = self.gunner1;
_body.touch = bumb_blowup;
else
_body.touch = func_null;
-
+
_body.think = bumb_diethink;
_body.nextthink = time;
_body.wait = time + 2 + (random() * 8);
_body.owner = self;
_body.enemy = self.enemy;
-
+
pointparticles(particleeffectnum("explosion_medium"), findbetterlocation(self.origin, 16), '0 0 0', 1);
-
+
self.health = 0;
self.event_damage = func_null;
self.solid = SOLID_CORPSE;
void bumb_impact()
{
if(autocvar_g_vehicle_bumblebee_bouncepain_x)
- vehilces_impact(autocvar_g_vehicle_bumblebee_bouncepain_x,
- autocvar_g_vehicle_bumblebee_bouncepain_y,
+ vehilces_impact(autocvar_g_vehicle_bumblebee_bouncepain_x,
+ autocvar_g_vehicle_bumblebee_bouncepain_y,
autocvar_g_vehicle_bumblebee_bouncepain_z);
}
setorigin(self.gun2.vehicle_viewport, '-85 0 50');
self.scale = 1.5;
-
+
// Raygun beam
if(self.gun3.enemy == world)
- {
+ {
self.gun3.enemy = spawn();
Net_LinkEntity(self.gun3.enemy, TRUE, 0, bumble_raygun_send);
- self.gun3.enemy.SendFlags = BRG_SETUP;
- self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
+ self.gun3.enemy.SendFlags = BRG_SETUP;
+ self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
self.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION;
}
}
self.movetype = MOVETYPE_TOSS;
self.vehicle_impact = bumb_impact;
self.damageforcescale = 0.025;
-
+
setorigin(self, self.origin + '0 0 25');
}
_len = vlen(self.origin - self.move_origin);
_dir = normalize(self.move_origin - self.origin);
-
+
if(self.total_damages < time)
{
boxparticles(self.traileffect, self, self.origin, self.origin + _dir * -64, _dir * -_len , _dir * -_len, 1, PARTICLES_USEALPHA);
self.cnt = ReadByte();
self.team = ReadByte();
self.cnt = ReadByte();
-
+
if(self.cnt)
self.colormod = '1 0 0';
else
self.colormod = '0 1 0';
self.traileffect = particleeffectnum("healray_muzzleflash");
- self.lip = particleeffectnum("healray_impact");
+ self.lip = particleeffectnum("healray_impact");
self.draw = bumble_raygun_draw;
}
-
-
+
+
if(sf & BRG_START)
{
self.origin_x = ReadCoord();
{
remove(self);
return;
- }
-
+ }
+
self.vehicle_flags |= VHF_DMGSHAKE;
self.vehicle_flags |= VHF_DMGROLL;
racer_frame,
racer_enter, racer_exit,
racer_die, racer_think,
- TRUE,
+ TRUE,
autocvar_g_vehicle_racer_health,
autocvar_g_vehicle_racer_shield))
{
if(self.owner.flagcarried)
setorigin(self.owner.flagcarried, '-20 0 96');
-
+
CSQCVehicleSetup(self.owner, 0);
}
void raptor_land()
-{
+{
float hgt;
-
- hgt = raptor_altitude(512);
+
+ hgt = raptor_altitude(512);
self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
self.angles_x *= 0.95;
self.angles_z *= 0.95;
if (!self.owner)
return;
-
+
makevectors(self.angles);
if(eject)
{
self.owner.oldvelocity = self.owner.velocity;
setorigin(self.owner , spot);
}
-
- antilag_clear(self.owner);
+
+ antilag_clear(self.owner);
self.owner = world;
}
float raptor_takeoff()
{
entity player, raptor;
-
+
player = self;
raptor = self.vehicle;
self = raptor;
if(self.sound_nexttime < time)
- {
+ {
self.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
- }
+ }
// Takeoff sequense
if(raptor.frame < 25)
_missile.enemy = self;
_missile = _missile.chain;
}
-
+
if(self.tur_impacttime < time)
remove(self);
}
entity player, raptor;
float ftmp = 0;
vector df;
-
+
if(intermission_running)
return 1;
vehicles_painframe();
/*
ftmp = vlen(self.velocity);
- if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
+ if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
ftmp = 1;
- else
+ else
ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
*/
-
+
if(self.sound_nexttime < time)
- {
- self.sound_nexttime = time + 7.955812;
+ {
+ self.sound_nexttime = time + 7.955812;
//sound (self.tur_head, CH_TRIGGER_SINGLE, "vehicles/raptor_fly.wav", 1 - ftmp, ATTEN_NORM );
- sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", 1, ATTEN_NORM);
+ sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", 1, ATTEN_NORM);
self.wait = ftmp;
- }
+ }
/*
else if(fabs(ftmp - self.wait) > 0.2)
{
sound (self.tur_head, CH_TRIGGER_SINGLE, "", 1 - ftmp, ATTEN_NORM );
- sound (self, CH_TRIGGER_SINGLE, "", ftmp, ATTEN_NORM);
+ sound (self, CH_TRIGGER_SINGLE, "", ftmp, ATTEN_NORM);
self.wait = ftmp;
}
*/
-
+
if(raptor.deadflag != DEAD_NO)
{
self = player;
{
if(raptor.gun1.lock_time < time || raptor.gun1.enemy.deadflag)
raptor.gun1.enemy = world;
-
+
if(trace_ent)
if(trace_ent.movetype)
if(trace_ent.takedamage)
}
}
else
- {
+ {
raptor.gun1.enemy = trace_ent;
raptor.gun1.lock_time = time + 0.5;
}
}
-
+
if(raptor.gun1.enemy)
{
float i, distance, impact_time;
vector _vel = raptor.gun1.enemy.velocity;
if(raptor.gun1.enemy.movetype == MOVETYPE_WALK)
_vel_z *= 0.1;
-
+
if(autocvar_g_vehicle_raptor_cannon_predicttarget)
{
ad = vf;
impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
ad = vf + _vel * impact_time;
}
- trace_endpos = ad;
+ trace_endpos = ad;
}
else
- trace_endpos = vf;
+ trace_endpos = vf;
}
}
else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
}
- vehicle_aimturret(raptor, trace_endpos, raptor.gun1, "fire1",
- autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
+ vehicle_aimturret(raptor, trace_endpos, raptor.gun1, "fire1",
+ autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
- vehicle_aimturret(raptor, trace_endpos, raptor.gun2, "fire1",
- autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
+ vehicle_aimturret(raptor, trace_endpos, raptor.gun2, "fire1",
+ autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
/*
traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, raptor);
UpdateAuxiliaryXhair(player, trace_endpos, '0 1 0', 0);
*/
-
+
if(player.BUTTON_ATCK)
if(raptor.attack_finished_single <= time)
if(raptor.vehicle_energy > autocvar_g_vehicle_raptor_cannon_cost)
raptor_bombdrop();
raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
raptor.lip = time;
- }
+ }
}
else
{
{
float i;
entity _flare;
-
+
for(i = 0; i < 3; ++i)
{
_flare = spawn();
- setmodel(_flare, "models/runematch/rune.mdl");
+ setmodel(_flare, "models/runematch/rune.mdl");
_flare.effects = EF_LOWPRECISION | EF_FLAME;
_flare.scale = 0.5;
setorigin(_flare, self.origin - '0 0 16');
raptor.lip = time;
}
}
-
+
raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
_missile = _missile.chain;
}
-
+
if(_incomming)
sound(self, CH_PAIN_SINGLE, "vehicles/missile_alarm.wav", VOL_BASE, ATTEN_NONE);
-
+
self.bomb1.cnt = time + 1;
}
-
+
VEHICLE_UPDATE_PLAYER(player, health, raptor);
VEHICLE_UPDATE_PLAYER(player, energy, raptor);
VEHICLE_UPDATE_PLAYER(player, shield, raptor);
player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
-
+
self = player;
return 1;
}
{
if(time >= self.wait)
self.think = raptor_blowup;
-
+
if(random() < 0.1)
{
sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
self.think = raptor_diethink;
self.nextthink = time;
self.wait = time + 5 + (random() * 5);
-
+
pointparticles(particleeffectnum("explosion_medium"), findbetterlocation (self.origin, 16), '0 0 0', 1);
self.velocity_z += 600;
switch(_imp)
{
case 10:
- case 15:
+ case 15:
case 18:
self.vehicle.vehicle_weapon2mode += 1;
if(self.vehicle.vehicle_weapon2mode > RSM_LAST)
self.vehicle.vehicle_weapon2mode = RSM_FIRST;
-
+
CSQCVehicleSetup(self, 0);
return TRUE;
case 12:
self.vehicle.vehicle_weapon2mode -= 1;
if(self.vehicle.vehicle_weapon2mode < RSM_FIRST)
self.vehicle.vehicle_weapon2mode = RSM_LAST;
-
+
CSQCVehicleSetup(self, 0);
return TRUE;
- /*
+ /*
case 17: // toss gun, could be used to exit?
break;
case 20: // Manual minigun reload?
break;
*/
- }
+ }
return FALSE;
}
//FIXME: Camera is in a bad place in HUD model.
//setorigin(self.vehicle_viewport, '25 0 5');
-
+
self.vehicles_impusle = raptor_impulse;
-
+
self.frame = 0;
self.bomb1 = spawn();
setsize(self, RAPTOR_MIN, RAPTOR_MAX );
self.delay = time;
-
+
self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
- self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
- self.vehicle_impact = raptor_impact;
+ self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
+ self.vehicle_impact = raptor_impact;
self.damageforcescale = 0.25;
}
{
remove(self);
return;
- }
-
+ }
+
self.vehicle_flags |= VHF_DMGSHAKE;
self.vehicle_flags |= VHF_DMGROLL;
-
+
if(autocvar_g_vehicle_raptor_shield)
self.vehicle_flags |= VHF_HASSHIELD;
//precache_model ("models/vehicles/clusterbomb.md3");
precache_model ("models/vehicles/clusterbomb_folded.md3");
precache_model ("models/vehicles/raptor_body.dpm");
-
+
precache_sound ("vehicles/raptor_fly.wav");
precache_sound ("vehicles/raptor_speed.wav");
precache_sound ("vehicles/missile_alarm.wav");
-
+
if(!vehicle_initialize(
"Raptor",
"models/vehicles/raptor.dpm",
raptor_frame,
raptor_enter, raptor_exit,
raptor_die, raptor_think,
- FALSE,
+ FALSE,
autocvar_g_vehicle_raptor_health,
autocvar_g_vehicle_raptor_shield))
{
remove(self);
return;
}
-
-
+
+
}
#endif // SVQC
}
}
-float spiberbot_calcartillery_flighttime;
+float spiberbot_calcartillery_flighttime;
vector spiberbot_calcartillery(vector org, vector tgt, float ht)
{
float grav, sdist, zdist, vs, vz, jumpheight;
vector sdir;
-
+
grav = autocvar_sv_gravity;
zdist = tgt_z - org_z;
sdist = vlen(tgt - org - zdist * '0 0 1');
entity rocket = world;
if (self.wait != -10)
- {
+ {
if (self.owner.BUTTON_ATCK2 && self.vehicle_weapon2mode == SBRM_GUIDE)
{
if (self.wait == 1)
self.wait = 0;
}
}
-
+
if(self.gun2.cnt > time)
return;
self.tur_head.frame = 1;
self.wait = 0;
}
-
+
if (self.wait != -10)
if (!self.owner.BUTTON_ATCK2)
return;
v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
-
+
switch(self.vehicle_weapon2mode)
{
case SBRM_VOLLY:
rocket.nextthink = time;
rocket.think = spiderbot_rocket_guided;
-
+
break;
case SBRM_ARTILLERY:
rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav",
v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, FALSE, TRUE, self.owner);
-
+
crosshair_trace(self.owner);
-
+
rocket.pos1 = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
rocket.pos1_z = trace_endpos_z;
-
- traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+
+ traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
float h1 = 0.75 * vlen(v - trace_endpos);
-
+
//v = trace_endpos;
- traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+ traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
float h2 = 0.75 * vlen(rocket.pos1 - v);
-
+
rocket.velocity = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
- rocket.movetype = MOVETYPE_TOSS;
+ rocket.movetype = MOVETYPE_TOSS;
rocket.gravity = 1;
- //rocket.think = spiderbot_rocket_artillery;
+ //rocket.think = spiderbot_rocket_artillery;
break;
}
rocket.classname = "spiderbot_rocket";
-
+
rocket.cnt = time + autocvar_g_vehicle_spiderbot_rocket_lifetime;
-
+
self.tur_head.frame += 1;
if (self.tur_head.frame == 9)
self.attack_finished_single = autocvar_g_vehicle_spiderbot_rocket_reload;
if(intermission_running)
return 1;
-
+
player = self;
spider = self.vehicle;
self = spider;
vehicles_painframe();
-
+
player.BUTTON_ZOOM = 0;
player.BUTTON_CROUCH = 0;
player.switchweapon = 0;
-
+
#if 1 // 0 to enable per-gun impact aux crosshairs
// Avarage gun impact point's -> aux cross
ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromAngles(ad))) - spider.tur_head.angles;
ad = AnglesTransform_Normalize(ad, TRUE);
//UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
-
+
// Rotate head
- ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
+ ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
ad_y = bound(-ftmp, ad_y, ftmp);
spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
//fixedmakevectors(spider.angles);
makevectors(spider.angles + '-2 0 0' * spider.angles_x);
-
+
movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
if(spider.flags & FL_ONGROUND)
if(spider.frame == 4 && self.tur_head.wait != 0)
{
sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_land.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
- spider.frame = 5;
+ spider.frame = 5;
}
-
+
if(player.BUTTON_JUMP && self.tur_head.wait < time)
- {
+ {
sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_jump.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
//dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
self.delay = 0;
if(vlen(player.movement) == 0)
{
if(self.sound_nexttime < time || self.delay != 3)
- {
+ {
self.delay = 3;
self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
//dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
- }
+ }
movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop);
spider.frame = 5;
}
ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
else
ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
-
- ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
+
+ ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
spider.angles_y = anglemods(spider.angles_y + ftmp);
spider.tur_head.angles_y -= ftmp;
movelib_move_simple(normalize(v_forward * player.movement_x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia);
if(self.sound_nexttime < time || self.delay != 1)
- {
+ {
self.delay = 1;
self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_walk.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
}
movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
if(self.sound_nexttime < time || self.delay != 2)
- {
+ {
self.delay = 2;
self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_strafe.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
vehicles_regen(spider.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, FALSE);
-
+
spiderbot_rocket_do();
VEHICLE_UPDATE_PLAYER(player, shield, spiderbot);
self = player;
- return 1;
+ return 1;
}
void spiderbot_think()
{
if(self.owner.flagcarried)
{
- setattachment(self.owner.flagcarried, self.tur_head, "");
- setorigin(self.owner.flagcarried, '-20 0 120');
+ setattachment(self.owner.flagcarried, self.tur_head, "");
+ setorigin(self.owner.flagcarried, '-20 0 120');
}
}
{
entity e;
vector spot;
-
+
e = findchain(classname,"spiderbot_rocket");
while(e)
{
self.nextthink = time;
self.frame = 5;
self.movetype = MOVETYPE_WALK;
-
+
if (!self.owner)
return;
self.owner.oldvelocity = self.owner.velocity;
setorigin(self.owner , spot);
}
-
+
antilag_clear(self.owner);
self.owner = world;
}
void spider_impact()
{
if(autocvar_g_vehicle_spiderbot_bouncepain_x)
- vehilces_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+ vehilces_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
}
void spiderbot_headfade()
self.nextthink = time + 0.1;
return;
}
-
+
entity h, g1, g2, b;
b = spawn();
h = spawn();
switch(_imp)
{
case 10:
- case 15:
+ case 15:
case 18:
self.vehicle.vehicle_weapon2mode += 1;
if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
-
+
//centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
CSQCVehicleSetup(self, 0);
return TRUE;
self.vehicle.vehicle_weapon2mode -= 1;
if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
self.vehicle.vehicle_weapon2mode = SBRM_LAST;
-
+
//centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
CSQCVehicleSetup(self, 0);
return TRUE;
- /*
+ /*
case 17: // toss gun, could be used to exit?
break;
case 20: // Manual minigun reload?
break;
*/
- }
+ }
return FALSE;
}
void spiderbot_spawn(float _f)
{
if(!self.gun1)
- {
+ {
self.vehicles_impusle = spiderbot_impulse;
self.gun1 = spawn();
- self.gun2 = spawn();
+ self.gun2 = spawn();
setmodel(self.gun1, "models/vehicles/spiderbot_barrels.dpm");
setmodel(self.gun2, "models/vehicles/spiderbot_barrels.dpm");
setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
self.movetype = MOVETYPE_WALK;
self.solid = SOLID_SLIDEBOX;
self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
- self.tur_head.angles = '0 0 0';
+ self.tur_head.angles = '0 0 0';
setorigin(self, self.pos1 + '0 0 128');
self.angles = self.pos2;
{
remove(self);
return;
- }
+ }
self.vehicle_flags |= VHF_DMGSHAKE;
//self.vehicle_flags |= VHF_DMGROLL;
//self.vehicle_flags |= VHF_DMGHEADROLL;
-
+
precache_model ( "models/vhshield.md3");
precache_model ( "models/vehicles/spiderbot.dpm");
precache_model ( "models/vehicles/spiderbot_top.dpm");
precache_sound ( "weapons/uzi_fire.wav" );
precache_sound ( "weapons/rocket_impact.wav");
-
+
precache_sound ( "vehicles/spiderbot_die.wav");
precache_sound ( "vehicles/spiderbot_idle.wav");
precache_sound ( "vehicles/spiderbot_jump.wav");
if(autocvar_g_vehicle_spiderbot_health_regen)
self.vehicle_flags |= VHF_HEALTHREGEN;
-
+
if(!vehicle_initialize(
"Spiderbot",
"models/vehicles/spiderbot.dpm",
spiderbot_frame,
spiderbot_enter, spiderbot_exit,
spiderbot_die, spiderbot_think,
- FALSE,
+ FALSE,
autocvar_g_vehicle_spiderbot_health,
autocvar_g_vehicle_spiderbot_shield))
{
{
if (!IS_REAL_CLIENT(own))
return;
-
+
msg_entity = own;
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteByte(MSG_ONE, TE_CSQC_VEHICLESETUP);
if(vehicle_id != 0)
- WriteByte(MSG_ONE, vehicle_id);
+ WriteByte(MSG_ONE, vehicle_id);
else
WriteByte(MSG_ONE, 1 + own.vehicle.vehicle_weapon2mode + HUD_VEHICLE_LAST);
}
setorigin(self, self.pos1 + '0 0 0');
// Show it
pointparticles(particleeffectnum("teleport"), self.origin + '0 0 64', '0 0 0', 1);
-
+
if(self.vehicle_controller)
self.team = self.vehicle_controller.team;
-
+
vehicles_reset_colors();
self.vehicle_spawn(VHSF_NORMAL);
}
{
if(MUTATOR_CALLHOOK(VehicleTouch))
return;
-
+
// Vehicle currently in use
if(self.owner)
{
void vehicles_enter()
{
// Remove this when bots know how to use vehicles
-
- if (IS_BOT_CLIENT(other))
+
+ if (IS_BOT_CLIENT(other))
if (autocvar_g_vehicles_allow_bots)
dprint("Bot enters vehicle\n"); // This is where we need to disconnect (some, all?) normal bot AI and hand over to vehicle's _aiframe()
else
self.team = self.owner.team;
self.flags -= FL_NOTARGET;
-
+
if (IS_REAL_CLIENT(other))
{
msg_entity = other;
WriteByte (MSG_ONE, SVC_SETVIEWPORT);
WriteEntity(MSG_ONE, self.vehicle_viewport);
-
+
WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
if(self.tur_head)
{
vehicles_clearrturn();
CSQCVehicleSetup(self.owner, self.hud);
-
+
vh_player = other;
vh_vehicle = self;
MUTATOR_CALLHOOK(VehicleEnter);
entity _vehicle;
entity _player;
entity _oldself = self;
-
+
if(vehicles_exit_running)
{
dprint("^1vehicles_exit allready running! this is not good..\n");
return;
}
-
+
vehicles_exit_running = TRUE;
if(IS_CLIENT(self))
{
_vehicle = self.vehicle;
-
+
if (_vehicle.vehicle_flags & VHF_PLAYERSLOT)
{
_vehicle.vehicle_exit(eject);
self = _oldself;
vehicles_exit_running = FALSE;
- return;
+ return;
}
}
else
_vehicle = self;
-
+
_player = _vehicle.owner;
-
+
self = _vehicle;
if (_player)
WriteAngle(MSG_ONE, _vehicle.angles_y);
WriteAngle(MSG_ONE, 0);
}
-
+
setsize(_player, PL_MIN,PL_MAX);
_player.takedamage = DAMAGE_AIM;
CSQCVehicleSetup(_player, HUD_NORMAL);
}
_vehicle.flags |= FL_NOTARGET;
-
+
if(_vehicle.deadflag == DEAD_NO)
_vehicle.avelocity = '0 0 0';
-
+
_vehicle.tur_head.nodrawtoclient = world;
-
+
if(!teamplay)
_vehicle.team = 0;
_vehicle = vh_vehicle;
_vehicle.team = _vehicle.tur_head.team;
-
+
sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTEN_NORM);
- _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle;
+ _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle;
_vehicle.phase = time + 1;
-
+
_vehicle.vehicle_exit(eject);
-
+
vehicles_setreturn();
- vehicles_reset_colors();
+ vehicles_reset_colors();
_vehicle.owner = world;
self = _oldself;
-
+
vehicles_exit_running = FALSE;
}
{
if(_healthscale)
regen = regen * (self.vehicle_health / self.tur_health);
-
+
self.regen_field = min(self.regen_field + regen * delta_time, field_max);
if(self.owner)
void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
self.dmg_time = time;
-
+
if(DEATH_ISWEAPON(deathtype, WEP_NEX))
damage *= autocvar_g_vehicles_nex_damagerate;
-
+
if(DEATH_ISWEAPON(deathtype, WEP_UZI))
damage *= autocvar_g_vehicles_uzi_damagerate;
-
+
if(DEATH_ISWEAPON(deathtype, WEP_RIFLE))
damage *= autocvar_g_vehicles_rifle_damagerate;
-
+
if(DEATH_ISWEAPON(deathtype, WEP_MINSTANEX))
damage *= autocvar_g_vehicles_minstanex_damagerate;
if(DEATH_ISWEAPON(deathtype, WEP_SEEKER))
damage *= autocvar_g_vehicles_tag_damagerate;
-
+
self.enemy = attacker;
-
+
if((self.vehicle_flags & VHF_HASSHIELD) && (self.vehicle_shield > 0))
{
if (wasfreed(self.vehicle_shieldent) || self.vehicle_shieldent == world)
if(sound_allowed(MSG_BROADCAST, attacker))
spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
}
-
+
if(self.damageforcescale < 1 && self.damageforcescale > 0)
self.velocity += force * self.damageforcescale;
else
self.active = ACTIVE_NOT;
else
self.active = ACTIVE_ACTIVE;
-
+
if(self.active == ACTIVE_ACTIVE && self.deadflag == DEAD_NO)
{
dprint("^3Eat shit yall!\n");
}
else if(self.active == ACTIVE_NOT && self.deadflag != DEAD_NO)
{
-
+
}
}
-float vehicle_addplayerslot( entity _owner,
- entity _slot,
- float _hud,
+float vehicle_addplayerslot( entity _owner,
+ entity _slot,
+ float _hud,
string _hud_model,
- float() _framefunc,
+ float() _framefunc,
void(float) _exitfunc)
{
if (!(_owner.vehicle_flags & VHF_MULTISLOT))
_slot.vehicle_hudmodel = spawn();
_slot.vehicle_hudmodel.viewmodelforclient = _slot;
_slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
-
+
setmodel(_slot.vehicle_hudmodel, _hud_model);
setmodel(_slot.vehicle_viewport, "null");
-
+
setattachment(_slot.vehicle_hudmodel, _slot, "");
setattachment(_slot.vehicle_viewport, _slot.vehicle_hudmodel, "");
-
+
return TRUE;
}
{
if(!autocvar_g_vehicles)
return FALSE;
-
+
if(self.targetname)
{
self.vehicle_controller = find(world, target, self.targetname);
}
else
{
- self.team = self.vehicle_controller.team;
+ self.team = self.vehicle_controller.team;
self.use = vehicle_use;
-
+
if(teamplay)
{
if(self.vehicle_controller.team == 0)
self.active = ACTIVE_NOT;
else
- self.active = ACTIVE_ACTIVE;
+ self.active = ACTIVE_ACTIVE;
}
}
}
-
+
precache_sound("onslaught/ons_hit2.wav");
precache_sound("onslaught/electricity_explode.wav");
tracebox(self.origin + '0 0 100', min_s, max_s, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
setorigin(self, trace_endpos);
}
-
+
self.pos1 = self.origin;
self.pos2 = self.angles;
self.tur_head.team = self.team;
-
+
if(MUTATOR_CALLHOOK(VehicleSpawn))
return FALSE;
return TRUE;
}
-vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname,
- float _pichlimit_min, float _pichlimit_max,
+vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname,
+ float _pichlimit_min, float _pichlimit_max,
float _rotlimit_min, float _rotlimit_max, float _aimspeed)
{
vector vtmp, vtag;
ftmp = _aimspeed * frametime;
vtmp_y = bound(-ftmp, vtmp_y, ftmp);
vtmp_x = bound(-ftmp, vtmp_x, ftmp);
- _turrret.angles_y = bound(_rotlimit_min, _turrret.angles_y + vtmp_y, _rotlimit_max);
+ _turrret.angles_y = bound(_rotlimit_min, _turrret.angles_y + vtmp_y, _rotlimit_max);
_turrret.angles_x = bound(_pichlimit_min, _turrret.angles_x + vtmp_x, _pichlimit_max);
return vtag;
}
_gib.movetype = MOVETYPE_TOSS;
_gib.solid = SOLID_CORPSE;
_gib.colormod = '-0.5 -0.5 -0.5';
- _gib.effects = EF_LOWPRECISION;
+ _gib.effects = EF_LOWPRECISION;
_gib.avelocity = _rot;
-
+
if(_burn)
_gib.effects |= EF_FLAME;
-
+
if(_explode)
{
- _gib.think = vehicles_gib_explode;
+ _gib.think = vehicles_gib_explode;
_gib.nextthink = time + random() * _explode;
_gib.touch = vehicles_gib_explode;
}
else
{
_gib.cnt = time + _maxtime;
- _gib.think = vehicles_gib_think;
- _gib.nextthink = time + _maxtime - 1;
+ _gib.think = vehicles_gib_think;
+ _gib.nextthink = time + _maxtime - 1;
_gib.alpha = 1;
}
return _gib;
/*if(yoda && (time > (self.last_yoda + 5)))
{
Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
- self.last_yoda = time;
+ self.last_yoda = time;
}*/
// calculate hits for ballistic weapons
if(self.origin_x > world.maxs_x || self.origin_y > world.maxs_y || self.origin_z > world.maxs_z || self.origin_x < world.mins_x || self.origin_y < world.mins_y || self.origin_z < world.mins_z)
return 0;
- // special case for zero density and zero bullet constant:
+ // special case for zero density and zero bullet constant:
if(self.dmg_radius == 0)
{
if (pointcontents (trace_endpos) != CONTENT_SKY)
{
if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
- Damage_DamageInfo(trace_endpos, damage, 0, 0, dir * max(1, force), dtype, trace_ent.species, self);
+ Damage_DamageInfo(trace_endpos, damage, 0, 0, dir * max(1, force), dtype, trace_ent.species, self);
Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * force);
}
float is_from_contents = (deathtype == DEATH_SLIME || deathtype == DEATH_LAVA);
float is_from_owner = (inflictor == projowner);
float is_from_exception = (exception != -1);
-
+
//dprint(strcat("W_CheckProjectileDamage: from_contents ", ftos(is_from_contents), " : from_owner ", ftos(is_from_owner), " : exception ", strcat(ftos(is_from_exception), " (", ftos(exception), "). \n")));
if(autocvar_g_projectiles_damage <= -2)
return (exception); // if exception is detected, allow it to override
else if (!is_from_contents)
return FALSE; // otherwise, only allow damage from contents
- }
+ }
else if(autocvar_g_projectiles_damage == 1)
{
if(is_from_exception)
{
self.takedamage = DAMAGE_NO;
self.event_damage = func_null;
-
+
if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
{
self.owner = attacker;
self.realowner = attacker;
}
-
+
// do not explode NOW but in the NEXT FRAME!
// because recursive calls to RadiusDamage are not allowed
self.nextthink = time;
else
++hit_enemy;
}
-
+
head = head.chain;
}
f *= a;
float totaldamage = RadiusDamage(self, self.realowner, autocvar_g_balance_crylink_primary_damage * f, autocvar_g_balance_crylink_primary_edgedamage * f, autocvar_g_balance_crylink_primary_radius, world, autocvar_g_balance_crylink_primary_force * f, self.projectiledeathtype, other);
-
+
if(totaldamage && ((autocvar_g_balance_crylink_primary_linkexplode == 2) || ((autocvar_g_balance_crylink_primary_linkexplode == 1) && !W_Crylink_Touch_WouldHitFriendly(self, autocvar_g_balance_crylink_primary_radius))))
{
if(self == self.realowner.crylink_lastgroup)
f *= a;
float totaldamage = RadiusDamage(self, self.realowner, autocvar_g_balance_crylink_secondary_damage * f, autocvar_g_balance_crylink_secondary_edgedamage * f, autocvar_g_balance_crylink_secondary_radius, world, autocvar_g_balance_crylink_secondary_force * f, self.projectiledeathtype, other);
-
+
if(totaldamage && ((autocvar_g_balance_crylink_secondary_linkexplode == 2) || ((autocvar_g_balance_crylink_secondary_linkexplode == 1) && !W_Crylink_Touch_WouldHitFriendly(self, autocvar_g_balance_crylink_secondary_radius))))
{
if(self == self.realowner.crylink_lastgroup)
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
-
+
CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
other = proj; MUTATOR_CALLHOOK(EditProjectile);
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
-
+
CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
other = proj; MUTATOR_CALLHOOK(EditProjectile);
// note: combos are usually triggered by W_Plasma_TriggerCombo, not damage
float is_combo = (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim");
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_combo ? 1 : -1)))
- return; // g_projectiles_damage says to halt
-
+ return; // g_projectiles_damage says to halt
+
self.health = self.health - damage;
if (self.health <= 0)
{
{
if(self.health <= 0)
return;
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
-
+
self.health = self.health - damage;
if (self.health <= 0)
{
setsize(proj, '-16 -16 -16', '16 16 16');
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH | MIF_PROXY;
-
+
CSQCProjectile(proj, TRUE, PROJECTILE_FIREBALL, TRUE);
other = proj; MUTATOR_CALLHOOK(EditProjectile);
proj.angles = vectoangles(proj.velocity);
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
-
+
CSQCProjectile(proj, TRUE, PROJECTILE_FIREMINE, TRUE);
other = proj; MUTATOR_CALLHOOK(EditProjectile);
{
if (self.health <= 0)
return;
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
-
+
self.health = self.health - damage;
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(attacker, self.use);
}
spamsound (self, CH_SHOTS, "weapons/grenade_bounce6.wav", VOL_BASE, ATTEN_NORM);
self.projectiledeathtype |= HITTYPE_BOUNCE;
self.gl_bouncecnt += 1;
-
+
if (autocvar_g_balance_grenadelauncher_secondary_lifetime_bounce && self.gl_bouncecnt == 1)
self.nextthink = time + autocvar_g_balance_grenadelauncher_secondary_lifetime_bounce;
-
+
}
else if(autocvar_g_balance_grenadelauncher_secondary_type == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick
{
{
if (self.health <= 0)
return;
-
+
float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : TRUE)
- && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
+ && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
&& (self.projectiledeathtype & HITTYPE_SECONDARY));
-
+
if(is_linkexplode)
is_linkexplode = (is_linkexplode && autocvar_g_balance_hagar_secondary_load_linkexplode);
else
self.health = self.health - damage;
self.angles = vectoangles(self.velocity);
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(attacker, self.think);
}
missile.classname = "missile";
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hagar_primary_damage;
-
+
missile.takedamage = DAMAGE_YES;
missile.health = autocvar_g_balance_hagar_primary_health;
missile.damageforcescale = autocvar_g_balance_hagar_primary_damageforcescale;
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = TRUE;
-
+
missile.touch = W_Hagar_Touch;
missile.use = W_Hagar_Explode;
missile.think = adaptor_think2use_hittype_splash;
missile.angles = vectoangles (missile.velocity);
missile.flags = FL_PROJECTILE;
- missile.missile_flags = MIF_SPLASH;
+ missile.missile_flags = MIF_SPLASH;
CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
missile.classname = "missile";
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
-
+
missile.takedamage = DAMAGE_YES;
missile.health = autocvar_g_balance_hagar_secondary_health;
missile.damageforcescale = autocvar_g_balance_hagar_secondary_damageforcescale;
missile.angles = vectoangles (missile.velocity);
missile.flags = FL_PROJECTILE;
- missile.missile_flags = MIF_SPLASH;
+ missile.missile_flags = MIF_SPLASH;
CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
missile.classname = "missile";
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
-
+
missile.takedamage = DAMAGE_YES;
missile.health = autocvar_g_balance_hagar_secondary_health;
missile.damageforcescale = autocvar_g_balance_hagar_secondary_damageforcescale;
setorigin (missile, w_shotorg);
setsize(missile, '0 0 0', '0 0 0');
missile.movetype = MOVETYPE_FLY;
- missile.missile_flags = MIF_SPLASH;
-
+ missile.missile_flags = MIF_SPLASH;
+
// per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar)
- spread_pershot = ((shots - 1) / (autocvar_g_balance_hagar_secondary_load_max - 1));
+ spread_pershot = ((shots - 1) / (autocvar_g_balance_hagar_secondary_load_max - 1));
spread_pershot = (1 - (spread_pershot * autocvar_g_balance_hagar_secondary_load_spread_bias));
spread_pershot = (autocvar_g_balance_hagar_secondary_spread * spread_pershot * g_weaponspreadfactor);
-
+
// pattern spread calculation
s = '0 0 0';
if (counter == 0)
s_z = v_forward_y;
}
s = s * autocvar_g_balance_hagar_secondary_load_spread * g_weaponspreadfactor;
-
+
W_SetupProjectileVelocityEx(missile, w_shotdir + right * s_y + up * s_z, v_up, autocvar_g_balance_hagar_secondary_speed, 0, 0, spread_pershot, FALSE);
missile.angles = vectoangles (missile.velocity);
void W_Hagar_Attack2_Load (void)
{
// loadable hagar secondary attack, must always run each frame
-
+
if(time < game_starttime)
return;
self.hagar_warning = TRUE;
}
}
-
+
// release if player let go of button or if they've held it in too long
if(!self.BUTTON_ATCK2 || ((loaded || !enough_ammo) && self.hagar_loadstep < time && autocvar_g_balance_hagar_secondary_load_hold >= 0))
{
PROJECTILE_TOUCH;
self.event_damage = func_null;
-
+
if(self.projectiledeathtype & HITTYPE_SECONDARY)
RadiusDamage (self, self.realowner, autocvar_g_balance_hlac_secondary_damage, autocvar_g_balance_hlac_secondary_edgedamage, autocvar_g_balance_hlac_secondary_radius, world, autocvar_g_balance_hlac_secondary_force, self.projectiledeathtype, other);
else
missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
missile.flags = FL_PROJECTILE;
- missile.missile_flags = MIF_SPLASH;
+ missile.missile_flags = MIF_SPLASH;
missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
{
if (self.health <= 0)
return;
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
- return; // g_projectiles_damage says to halt
-
+ return; // g_projectiles_damage says to halt
+
self.health = self.health - damage;
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(self.realowner, W_Hook_Explode2);
}
gren.think = adaptor_think2use_hittype_splash;
gren.use = W_Hook_Explode2;
gren.touch = W_Hook_Touch2;
-
+
gren.takedamage = DAMAGE_YES;
gren.health = autocvar_g_balance_hook_secondary_health;
gren.damageforcescale = autocvar_g_balance_hook_secondary_damageforcescale;
float w_hook(float req)
{
float hooked_time_max, hooked_fuel;
-
+
if (req == WR_AIM)
{
// ... sorry ...
{
W_DecreaseAmmo(ammo_fuel, autocvar_g_balance_hook_primary_fuel, FALSE);
self.hook_state |= HOOK_FIRING;
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready);
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready);
}
}
if(self.hook && self.hook.state == 1)
{
- hooked_time_max = autocvar_g_balance_hook_primary_hooked_time_max;
+ hooked_time_max = autocvar_g_balance_hook_primary_hooked_time_max;
if (hooked_time_max > 0)
{
if ( time > self.hook_time_hooked + hooked_time_max )
self.hook_state |= HOOK_REMOVING;
}
-
+
hooked_fuel = autocvar_g_balance_hook_primary_hooked_fuel;
if (hooked_fuel > 0)
{
}
else
{
- self.hook_time_hooked = time;
+ self.hook_time_hooked = time;
self.hook_time_fueldecrease = time + autocvar_g_balance_hook_primary_hooked_time_free;
}
missile.touch = W_Laser_Touch;
missile.flags = FL_PROJECTILE;
- missile.missile_flags = MIF_SPLASH;
+ missile.missile_flags = MIF_SPLASH;
missile.think = W_Laser_Think;
missile.nextthink = time + autocvar_g_balance_laser_primary_delay;
self.movetype = MOVETYPE_NONE;
}
}
-
+
// our lifetime has expired, it's time to die - mine_time just allows us to play a sound for this
// TODO: replace this mine_trigger.wav sound with a real countdown
if ((time > self.cnt) && (!self.mine_time))
{
if (self.health <= 0)
return;
-
+
float is_from_enemy = (inflictor.realowner != self.realowner);
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_from_enemy ? 1 : -1)))
return; // g_projectiles_damage says to halt
-
+
self.health = self.health - damage;
self.angles = vectoangles(self.velocity);
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(attacker, W_Mine_Explode);
}
// common properties
other = mine; MUTATOR_CALLHOOK(EditProjectile);
-
+
self.minelayer_mines = W_Mine_Count(self);
}
WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
break;
}
-
+
W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo), autocvar_g_balance_minstanex_reload_ammo);
}
{
// handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
-
+
// decrease ammo for the laser?
if(autocvar_g_balance_minstanex_laser_ammo)
W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
self.weapon = WEP_LASER;
W_Laser_Attack(2);
self.weapon = w;
-
+
// now do normal refire
weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
}
FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_NEX);
if(yoda && flying)
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
+ Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
//beam and muzzle flash done on client
SendCSQCNexBeamParticle(charge);
{
// don't allow charging if we don't have enough ammo
ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_secondary_ammo;
return ammo_amount;
}
else
{
if (self.health <= 0)
return;
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
-
+
self.health = self.health - damage;
self.angles = vectoangles(self.velocity);
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(attacker, W_Rocket_Explode);
}
missile.nextthink = time;
missile.cnt = time + autocvar_g_balance_rocketlauncher_lifetime;
missile.flags = FL_PROJECTILE;
- missile.missile_flags = MIF_SPLASH;
+ missile.missile_flags = MIF_SPLASH;
CSQCProjectile(missile, autocvar_g_balance_rocketlauncher_guiderate == 0 && autocvar_g_balance_rocketlauncher_speedaccel == 0, PROJECTILE_ROCKET, FALSE); // because of fly sound
// Calc how important it is that we turn and add this to the desierd (enemy) dir.
desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
}
-
+
newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
self.velocity = newdir * spd; // make me fly in the new direction at my flight speed
}
{
if (self.health <= 0)
return;
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
self.health = self.health - (damage * 0.25);
else
self.health = self.health - damage;
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(attacker, Seeker_Missile_Explode);
}
missile.damageforcescale = autocvar_g_balance_seeker_missile_damageforcescale;
missile.damagedbycontents = TRUE;
//missile.think = Seeker_Missile_Animate; // csqc projectiles.
-
+
if (missile.enemy != world)
missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
- else
+ else
missile.projectiledeathtype = WEP_SEEKER;
missile.movetype = MOVETYPE_FLYMISSILE;
missile.flags = FL_PROJECTILE;
missile.missile_flags = MIF_SPLASH | MIF_GUIDED_TAG;
-
+
W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_missile);
missile.angles = vectoangles (missile.velocity);
}
// ============================
-// Begin: FLAC, close range attack meant for defeating rockets which are coming at you.
+// Begin: FLAC, close range attack meant for defeating rockets which are coming at you.
// ============================
void Seeker_Flac_Explode ()
{
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_seeker_flac_damage;
missile.touch = Seeker_Flac_Explode;
- missile.use = Seeker_Flac_Explode;
+ missile.use = Seeker_Flac_Explode;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + autocvar_g_balance_seeker_flac_lifetime + autocvar_g_balance_seeker_flac_lifetime_rand;
missile.solid = SOLID_BBOX;
- missile.movetype = MOVETYPE_FLY;
+ missile.movetype = MOVETYPE_FLY;
missile.projectiledeathtype = WEP_SEEKER;
missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
missile.flags = FL_PROJECTILE;
- missile.missile_flags = MIF_SPLASH;
-
+ missile.missile_flags = MIF_SPLASH;
+
// csqc projectiles
- //missile.angles = vectoangles (missile.velocity);
- //missile.scale = 0.4; // BUG: the model is too big
-
+ //missile.angles = vectoangles (missile.velocity);
+ //missile.scale = 0.4; // BUG: the model is too big
+
setorigin (missile, w_shotorg);
setsize (missile, '-2 -2 -2', '2 2 2');
-
+
W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_flac);
CSQCProjectile(missile, TRUE, PROJECTILE_FLAC, TRUE);
}
// ============================
-// Begin: Tag and rocket controllers
+// Begin: Tag and rocket controllers
// ============================
entity Seeker_Tagged_Info(entity isowner, entity istarget)
{
entity tag;
- for(tag = world; (tag = find(tag, classname, "tag_tracker")); )
+ for(tag = world; (tag = find(tag, classname, "tag_tracker")); )
if ((tag.realowner == isowner) && (tag.tag_target == istarget))
return tag;
-
+
return world;
}
void Seeker_Attack()
{
entity tracker, closest_target;
-
+
closest_target = world;
for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == self)
{
if (vlen(self.origin - tracker.tag_target.origin) < vlen(self.origin - closest_target.origin))
closest_target = tracker.tag_target;
}
- else
+ else
closest_target = tracker.tag_target;
}
-
+
traceline(self.origin + self.view_ofs, closest_target.origin, MOVE_NOMONSTERS, self);
if ((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target)))
closest_target = world;
-
+
Seeker_Fire_Missile('0 0 0', closest_target);
}
}
self.nextthink = time + autocvar_g_balance_seeker_missile_delay * W_WeaponRateFactor();
-
+
oldself = self;
self = self.realowner;
-
+
oldenemy = self.enemy;
self.enemy = oldself.enemy;
-
+
c = mod(self.cnt, 4);
switch(c)
{
self = oldself;
}
-void Seeker_Tracker_Think()
+void Seeker_Tracker_Think()
{
// commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
if ((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER)
}
return;
}
-
+
// Update the think method information
self.nextthink = time;
}
// ============================
-// Begin: Tag projectile
+// Begin: Tag projectile
// ============================
void Seeker_Tag_Explode ()
{
vector dir;
vector org2;
entity e;
-
+
PROJECTILE_TOUCH;
dir = normalize (self.realowner.origin - self.origin);
{
// check to see if this person is already tagged by me
entity tag = Seeker_Tagged_Info(self.realowner, other);
-
+
if (tag != world)
{
if (other.wps_tag_tracker && (autocvar_g_balance_seeker_type == 1)) // don't attach another waypointsprite without killing the old one first
WaypointSprite_Kill(other.wps_tag_tracker);
-
+
tag.tag_time = time;
}
else
- {
+ {
//sprint(self.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n"));
e = spawn();
e.cnt = autocvar_g_balance_seeker_missile_count;
e.classname = "tag_tracker";
e.owner = self.owner;
e.realowner = self.realowner;
-
+
if (autocvar_g_balance_seeker_type == 1)
{
e.tag_target = other;
e.tag_time = time;
e.think = Seeker_Tracker_Think;
}
- else
+ else
{
e.enemy = other;
e.think = Seeker_Vollycontroller_Think;
}
-
+
e.nextthink = time;
}
-
+
if (autocvar_g_balance_seeker_type == 1)
{
WaypointSprite_Spawn("tagged-target", autocvar_g_balance_seeker_tag_tracker_lifetime, 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, TRUE, RADARICON_TAGGED, '0.5 1 0');
setsize (missile, '-2 -2 -2', '2 2 2');
missile.flags = FL_PROJECTILE;
- //missile.missile_flags = MIF_..?;
+ //missile.missile_flags = MIF_..?;
missile.movetype = MOVETYPE_FLY;
W_SETUPPROJECTILEVELOCITY(missile, g_balance_seeker_tag);
if (req == WR_AIM)
{
- if (autocvar_g_balance_seeker_type == 1)
+ if (autocvar_g_balance_seeker_type == 1)
if (Seeker_Tagged_Info(self, self.enemy) != world)
self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_missile_speed_max, 0, autocvar_g_balance_seeker_missile_lifetime, FALSE);
else
{
if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo)) // forced reload
weapon_action(self.weapon, WR_RELOAD);
-
+
else if (self.BUTTON_ATCK)
{
- if (autocvar_g_balance_seeker_type == 1)
+ if (autocvar_g_balance_seeker_type == 1)
{
if (weapon_prepareattack(0, autocvar_g_balance_seeker_missile_refire))
{
weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_missile_animtime, w_ready);
}
}
- else
+ else
{
if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
{
else if (self.BUTTON_ATCK2)
{
- if (autocvar_g_balance_seeker_type == 1)
+ if (autocvar_g_balance_seeker_type == 1)
{
if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
{
weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
}
}
- else
+ else
{
if (weapon_prepareattack(0, autocvar_g_balance_seeker_flac_refire))
{
}
else if (req == WR_CHECKAMMO1)
{
- if (autocvar_g_balance_seeker_type == 1)
+ if (autocvar_g_balance_seeker_type == 1)
{
ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_missile_ammo;
ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_missile_ammo;
ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
}
-
+
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
- if (autocvar_g_balance_seeker_type == 1)
+ if (autocvar_g_balance_seeker_type == 1)
{
ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_flac_ammo;
ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_flac_ammo;
}
-
+
return ammo_amount;
}
else if (req == WR_RELOAD)
if(!self.cnt) // set start time of melee
{
- self.cnt = time;
+ self.cnt = time;
W_PlayStrengthSound(self.realowner);
}
makevectors(self.realowner.v_angle); // update values for v_* vectors
-
+
// calculate swing percentage based on time
meleetime = autocvar_g_balance_shotgun_secondary_melee_time * W_WeaponRateFactor();
swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
f = ((1 - swing) * autocvar_g_balance_shotgun_secondary_melee_traces);
-
+
// check to see if we can still continue, otherwise give up now
if((self.realowner.deadflag != DEAD_NO) && autocvar_g_balance_shotgun_secondary_melee_no_doubleslap)
{
remove(self);
return;
}
-
- // if okay, perform the traces needed for this frame
+
+ // if okay, perform the traces needed for this frame
for(i=self.swing_prev; i < f; ++i)
{
swing_factor = ((1 - (i / autocvar_g_balance_shotgun_secondary_melee_traces)) * 2 - 1);
-
- targpos = (self.realowner.origin + self.realowner.view_ofs
+
+ targpos = (self.realowner.origin + self.realowner.view_ofs
+ (v_forward * autocvar_g_balance_shotgun_secondary_melee_range)
+ (v_up * swing_factor * autocvar_g_balance_shotgun_secondary_melee_swing_up)
+ (v_right * swing_factor * autocvar_g_balance_shotgun_secondary_melee_swing_side));
WarpZone_traceline_antilag(self, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self, ANTILAG_LATENCY(self.realowner));
-
+
// draw lightning beams for debugging
- //te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
+ //te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
//te_customflash(targpos, 40, 2, '1 1 1');
-
+
is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body");
if((trace_fraction < 1) // if trace is good, apply the damage and remove self
- && (trace_ent.takedamage == DAMAGE_AIM)
+ && (trace_ent.takedamage == DAMAGE_AIM)
&& (trace_ent != self.swing_alreadyhit)
&& (is_player || autocvar_g_balance_shotgun_secondary_melee_nonplayerdamage))
{
target_victim = trace_ent; // so it persists through other calls
-
+
if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught.
swing_damage = (autocvar_g_balance_shotgun_secondary_damage * min(1, swing_factor + 1));
else
swing_damage = (autocvar_g_balance_shotgun_secondary_melee_nonplayerdamage * min(1, swing_factor + 1));
-
+
//print(strcat(self.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n"));
-
- Damage(target_victim, self.realowner, self.realowner,
- swing_damage, WEP_SHOTGUN | HITTYPE_SECONDARY,
- self.realowner.origin + self.realowner.view_ofs,
+
+ Damage(target_victim, self.realowner, self.realowner,
+ swing_damage, WEP_SHOTGUN | HITTYPE_SECONDARY,
+ self.realowner.origin + self.realowner.view_ofs,
v_forward * autocvar_g_balance_shotgun_secondary_force);
-
+
if(accuracy_isgooddamage(self.realowner, target_victim)) { accuracy_add(self.realowner, WEP_SHOTGUN, 0, swing_damage); }
-
+
// draw large red flash for debugging
//te_customflash(targpos, 200, 2, '15 0 0');
-
+
if(autocvar_g_balance_shotgun_secondary_melee_multihit) // allow multiple hits with one swing, but not against the same player twice.
{
self.swing_alreadyhit = target_victim;
}
}
}
-
+
if(time >= self.cnt + meleetime)
{
// melee is finished
}
else
{
- // set up next frame
+ // set up next frame
self.swing_prev = i;
self.nextthink = time;
}
note += 12;
if(hittype & HITTYPE_SECONDARY)
note += 7;
-
+
// we support two kinds of tubas, those tuned in Eb and those tuned in C
// kind of tuba currently is player slot number, or team number if in
// teamplay
if(pl.clientcolors & 1)
note += 3;
}
-
+
// total range of notes:
// 0
// *** ** ****
WriteByte(MSG_ENTITY, ENT_CLIENT_WAYPOINT);
sendflags = sendflags & 0x7F;
-
+
if(g_nexball)
sendflags &= ~0x80;
else if(self.max_health || (self.pain_finished && (time < self.pain_finished + 0.25)))
--- /dev/null
+FILES=`find client common menu server warpzonelib -name \*.c -o -name \*.h -o -name \*.qc -o -name \*.qh`
+out_raw()
+{
+ printf "%s\n" "$LINE"
+}
+out()
+{
+ printf "%-40s = %-8s # %s\n" "$KEY" "$VAL" "$COMMENT"
+}
+decide()
+{
+ verybestchoice=
+ verybestscore=2147483647
+ bestchoice=
+ bestscore=2147483647
+ secondbestchoice=
+ secondbestscore=2147483647
+ worstscore=0
+ haveignore=false
+ havefalse=false
+ have0=false
+ seen=
+ for choice in "$VAL" "$@"; do
+ case " $seen " in
+ *" $choice "*)
+ continue
+ ;;
+ *)
+ seen=$seen" $VAL"
+ ;;
+ esac
+ if [ x"$choice" = x"force" ]; then
+ continue
+ fi
+ if [ x"$choice" = x"ignore" ]; then
+ haveignore=true
+ fi
+ if [ x"$choice" = x"false" ]; then
+ havefalse=true
+ fi
+ if [ x"$choice" = x"0" ]; then
+ have0=true
+ fi
+ if [ x"$MODE" = x"initialize" ]; then
+ if [ x"$choice" = x"ignore" ]; then
+ score=0
+ else
+ score=2147483647
+ fi
+ else
+ {
+ cat uncrustify.cfg
+ printf "%s = %s\n" "$KEY" "$choice"
+ } > uncrustify.cfg.test
+ uncrustify -c uncrustify.cfg.test --replace --no-backup $FILES >/dev/null 2>&1
+ score=0
+ git diff --numstat > diffstat.tmp
+ while read -r add del rest; do
+ if [ x"$add" != x"-" ]; then
+ score=$(($score + $add))
+ fi
+ if [ x"$del" != x"-" ]; then
+ score=$(($score + $del))
+ fi
+ done < diffstat.tmp
+ git reset --hard >/dev/null 2>&1
+ fi
+ echo >&2 "$KEY = $choice: $score"
+ if [ x"$choice" != x"ignore" ]; then
+ if [ $score -lt $bestscore ]; then
+ secondbestscore=$bestscore
+ secondbestchoice=$bestchoice
+ bestscore=$score
+ bestchoice=$choice
+ elif [ $score -lt $secondbestscore ]; then
+ secondbestscore=$score
+ secondbestchoice=$choice
+ fi
+ fi
+ if [ $score -lt $verybestscore ]; then
+ verybestscore=$score
+ verybestchoice=$choice
+ fi
+ if [ $score -gt $worstscore ]; then
+ worstscore=$score
+ worstchoice=$choice
+ fi
+ done
+ if [ -z "$bestchoice" ]; then
+ echo "# WARNING: No best choice identified"
+ elif [ $verybestscore -ge $worstscore ]; then
+ echo "# WARNING: Code doesn't seem to use this feature - delete from the config?"
+ if $haveignore; then
+ VAL=ignore
+ elif $havefalse; then
+ VAL=false
+ elif $have0; then
+ VAL=0
+ fi
+ elif [ $bestscore -ge $worstscore ]; then
+ echo "# WARNING: Indifferent... please decide manually."
+ elif [ $bestscore -ge $secondbestscore ]; then
+ echo "# WARNING: Best is not unique ($bestchoice $secondbestchoice)"
+ elif [ $bestscore -gt $verybestscore ]; then
+ echo "# NOTE: is $(($bestscore - $verybestscore)) worse than $verybestchoice"
+ VAL=$bestchoice
+ else
+ VAL=$bestchoice
+ fi
+}
+while read -r LINE; do
+ case "$LINE" in
+ "# NOTE: "*)
+ continue
+ ;;
+ "# WARNING: "*)
+ continue
+ ;;
+ "# ERROR: "*)
+ continue
+ ;;
+ "#"*)
+ out_raw
+ continue
+ ;;
+ *"#force"*)
+ out_raw
+ continue
+ ;;
+ esac
+ printf "%s\n" "$LINE" | while read KEY EQ VAL DELIM COMMENT; do
+ if \
+ [ x"$EQ" != x"=" ] || \
+ [ x"$DELIM" != x"#" ]; then
+ out_raw
+ continue
+ fi
+ case "$COMMENT" in
+ number)
+ case "$KEY" in
+ indent_columns|*tab*)
+ decide 1 2 4 8
+ ;;
+ *)
+ decide 0 1 2 3 4 indent_columns
+ ;;
+ esac
+ out
+ ;;
+ string)
+ printf "# WARNING: unsupported %s\n" "$COMMENT"
+ out_raw
+ ;;
+ *[!a-z/_]*)
+ printf "# ERROR: invalid characters %s\n" "$COMMENT"
+ out_raw
+ ;;
+ */*)
+ decide `echo "$COMMENT" | tr / ' '`
+ out
+ ;;
+ *)
+ printf "# ERROR: only once choice %s\n" "$COMMENT"
+ out_raw
+ ;;
+ esac
+ done
+done < uncrustify.cfg
#
# The type of line endings
+# WARNING: Best is not unique (auto lf)
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input
string_escape_char = 92 # number
# Alternate string escape char for Pawn. Only works right before the quote char.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
string_escape_char2 = 0 # number
#
# 0=spaces only
# 1=indent with tabs to brace level, align with spaces
# 2=indent and align with tabs, using spaces when not on a tabstop
-indent_with_tabs = 1 # number
+indent_with_tabs = 1 # number #force
# Comments that are not a brace level are indented with tabs on a tabstop.
# Requires indent_with_tabs=2. If false, will use spaces.
indent_cmt_with_tabs = false # false/true
# Whether to indent strings broken by '\' so that they line up
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_align_string = false # false/true
# The number of spaces to indent multi-line XML strings.
# Requires indent_align_string=True
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_xml_string = 0 # number
# Spaces to indent '{' from level
indent_braces = false # false/true
# Disabled indenting function braces if indent_braces is true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_braces_no_func = false # false/true
# Disabled indenting class braces if indent_braces is true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_braces_no_class = false # false/true
# Disabled indenting struct braces if indent_braces is true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_braces_no_struct = false # false/true
# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc.
indent_brace_parent = false # false/true
# Whether the 'namespace' body is indented
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_namespace = false # false/true
# The number of spaces to indent a namespace block
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_namespace_level = 0 # number
# If the body of the namespace is longer than this number, it won't be indented.
# Requires indent_namespace=true. Default=0 (no limit)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_namespace_limit = 0 # number
# Whether the 'extern "C"' body is indented
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_extern = false # false/true
# Whether the 'class' body is indented
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_class = false # false/true
# Whether to indent the stuff after a leading class colon
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_class_colon = false # false/true
# False=treat 'else\nif' as 'else if' for indenting purposes
# True=indent the 'if' one level
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_else_if = false # false/true
# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute
indent_var_def_blk = 0 # number
# Indent continued variable declarations instead of aligning.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_var_def_cont = false # false/true
# True: indent continued function call parameters one indent level
# False: align parameters under the open paren
-indent_func_call_param = false # false/true
+indent_func_call_param = true # false/true
# Same as indent_func_call_param, but for function defs
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_func_def_param = false # false/true
# Same as indent_func_call_param, but for function protos
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_func_proto_param = false # false/true
# Same as indent_func_call_param, but for class declarations
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_func_class_param = false # false/true
# Same as indent_func_call_param, but for class variable constructors
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_func_ctor_var_param = false # false/true
# Same as indent_func_call_param, but for templates
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_template_param = false # false/true
# Double the indent for indent_func_xxx_param options
indent_func_param_double = false # false/true
# Indentation column for standalone 'const' function decl/proto qualifier
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_func_const = 0 # number
# Indentation column for standalone 'throw' function decl/proto qualifier
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_func_throw = 0 # number
# The number of spaces to indent a continued '->' or '.'
# Usually set to 0, 1, or indent_columns.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_member = 0 # number
# Spaces to indent single line ('//') comments on lines before code
# If set, will indent trailing single line ('//') comments relative
# to the code instead of trying to keep the same absolute column
-indent_relative_single_line_comments = false # false/true
+indent_relative_single_line_comments = true # false/true #force
# Spaces to indent 'case' from 'switch'
# Usually 0 or indent_columns.
-indent_switch_case = indent_columns # number
+indent_switch_case = indent_columns # number
# Spaces to shift the 'case' line, without affecting any other lines
# Usually 0.
# How to indent goto labels
# >0 : absolute column where 1 is the leftmost column
# <=0 : subtract from brace indent
-indent_label = 1 # number
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+indent_label = 0 # number
# Same as indent_label, but for access specifiers that are followed by a colon
-indent_access_spec = 1 # number
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+indent_access_spec = 0 # number
# Indent the code after an access specifier by one level.
# If set, this option forces 'indent_access_spec=0'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_access_spec_body = false # false/true
# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_paren_nl = false # false/true
# Controls the indent of a close paren after a newline.
# 0: Indent to body level
# 1: Align under the open paren
# 2: Indent to the brace level
-indent_paren_close = 0 # number
+indent_paren_close = 1 # number #force
# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_comma_paren = false # false/true
# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_bool_paren = false # false/true
# If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_first_bool_expr = false # false/true
# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_square_nl = false # false/true
# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies
+# WARNING: Code doesn't seem to use this feature - delete from the config?
indent_preserve_sql = false # false/true
# Align continued statements at the '='. Default=True
#
# Add or remove space around arithmetic operator '+', '-', '/', '*', etc
-sp_arith = ignore # ignore/add/remove/force
+# NOTE: is 518 worse than ignore
+sp_arith = add # ignore/add/remove/force
# Add or remove space around assignment operator '=', '+=', etc
+# NOTE: is 4 worse than ignore
sp_assign = add # ignore/add/remove/force
# Add or remove space around assignment operator '=' in a prototype
-sp_assign_default = add # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_assign_default = ignore # ignore/add/remove/force
-# Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign.
-sp_before_assign = ignore # ignore/add/remove/force
-
-# Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign.
-sp_after_assign = ignore # ignore/add/remove/force
+# # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign.
+# sp_before_assign = ignore # ignore/add/remove/force
+#
+# # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign.
+# sp_after_assign = ignore # ignore/add/remove/force
# Add or remove space around assignment '=' in enum
-sp_enum_assign = add # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_enum_assign = ignore # ignore/add/remove/force
-# Add or remove space before assignment '=' in enum. Overrides sp_enum_assign.
-sp_enum_before_assign = ignore # ignore/add/remove/force
-
-# Add or remove space after assignment '=' in enum. Overrides sp_enum_assign.
-sp_enum_after_assign = ignore # ignore/add/remove/force
+# # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign.
+# sp_enum_before_assign = ignore # ignore/add/remove/force
+#
+# # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign.
+# sp_enum_after_assign = ignore # ignore/add/remove/force
# Add or remove space around preprocessor '##' concatenation operator. Default=Add
+# NOTE: is 2 worse than ignore
sp_pp_concat = remove # ignore/add/remove/force
# Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add
sp_bool = add # ignore/add/remove/force
# Add or remove space around compare operator '<', '>', '==', etc
+# NOTE: is 4 worse than ignore
sp_compare = add # ignore/add/remove/force
# Add or remove space inside '(' and ')'
+# NOTE: is 2 worse than ignore
sp_inside_paren = remove # ignore/add/remove/force
# Add or remove space between nested parens
sp_balance_nested_parens = false # false/true
# Add or remove space between ')' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_paren_brace = ignore # ignore/add/remove/force
# Add or remove space before pointer star '*'
-sp_before_ptr_star = ignore # ignore/add/remove/force
+sp_before_ptr_star = add # ignore/add/remove/force
# Add or remove space before pointer star '*' that isn't followed by a variable name
# If set to 'ignore', sp_before_ptr_star is used instead.
-sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force
+sp_before_unnamed_ptr_star = add # ignore/add/remove/force
# Add or remove space between pointer stars '*'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_between_ptr_star = ignore # ignore/add/remove/force
# Add or remove space after pointer star '*', if followed by a word.
-sp_after_ptr_star = ignore # ignore/add/remove/force
+sp_after_ptr_star = add # ignore/add/remove/force
# Add or remove space after a pointer star '*', if followed by a func proto/def.
-sp_after_ptr_star_func = ignore # ignore/add/remove/force
+sp_after_ptr_star_func = add # ignore/add/remove/force
# Add or remove space before a pointer star '*', if followed by a func proto/def.
-sp_before_ptr_star_func = ignore # ignore/add/remove/force
+sp_before_ptr_star_func = add # ignore/add/remove/force
# Add or remove space before a reference sign '&'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_byref = ignore # ignore/add/remove/force
# Add or remove space before a reference sign '&' that isn't followed by a variable name
# If set to 'ignore', sp_before_byref is used instead.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_unnamed_byref = ignore # ignore/add/remove/force
# Add or remove space after reference sign '&', if followed by a word.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_byref = ignore # ignore/add/remove/force
# Add or remove space after a reference sign '&', if followed by a func proto/def.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_byref_func = ignore # ignore/add/remove/force
# Add or remove space before a reference sign '&', if followed by a func proto/def.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_byref_func = ignore # ignore/add/remove/force
# Add or remove space between type and word. Default=Force
-sp_after_type = force # ignore/add/remove/force
+sp_after_type = add # ignore/add/remove/force
# Add or remove space in 'template <' vs 'template<'.
# If set to ignore, sp_before_angle is used.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_template_angle = ignore # ignore/add/remove/force
# Add or remove space before '<>'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_angle = ignore # ignore/add/remove/force
# Add or remove space inside '<' and '>'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_inside_angle = ignore # ignore/add/remove/force
# Add or remove space after '<>'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_angle = ignore # ignore/add/remove/force
# Add or remove space between '<>' and '(' as found in 'new List<byte>();'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_angle_paren = ignore # ignore/add/remove/force
# Add or remove space between '<>' and a word as in 'List<byte> m;'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_angle_word = ignore # ignore/add/remove/force
# Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add
-sp_angle_shift = add # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_angle_shift = ignore # ignore/add/remove/force
# Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
-sp_before_sparen = ignore # ignore/add/remove/force
+# NOTE: is 734 worse than ignore
+sp_before_sparen = remove # ignore/add/remove/force
# Add or remove space inside if-condition '(' and ')'
-sp_inside_sparen = ignore # ignore/add/remove/force
+# NOTE: is 14 worse than ignore
+sp_inside_sparen = remove # ignore/add/remove/force
-# Add or remove space before if-condition ')'. Overrides sp_inside_sparen.
-sp_inside_sparen_close = ignore # ignore/add/remove/force
+# # Add or remove space before if-condition ')'. Overrides sp_inside_sparen.
+# sp_inside_sparen_close = ignore # ignore/add/remove/force
# Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_sparen = ignore # ignore/add/remove/force
# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_sparen_brace = ignore # ignore/add/remove/force
# Add or remove space between 'invariant' and '(' in the D language.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_invariant_paren = ignore # ignore/add/remove/force
# Add or remove space after the ')' in 'invariant (C) c' in the D language.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_invariant_paren = ignore # ignore/add/remove/force
# Add or remove space before empty statement ';' on 'if', 'for' and 'while'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_special_semi = ignore # ignore/add/remove/force
# Add or remove space before ';'. Default=Remove
sp_before_semi = remove # ignore/add/remove/force
# Add or remove space before ';' in non-empty 'for' statements
-sp_before_semi_for = ignore # ignore/add/remove/force
+sp_before_semi_for = remove # ignore/add/remove/force
# Add or remove space before a semicolon of an empty part of a for statement.
-sp_before_semi_for_empty = ignore # ignore/add/remove/force
+sp_before_semi_for_empty = add # ignore/add/remove/force
# Add or remove space after ';', except when followed by a comment. Default=Add
+# NOTE: is 60 worse than ignore
sp_after_semi = add # ignore/add/remove/force
# Add or remove space after ';' in non-empty 'for' statements. Default=Force
-sp_after_semi_for = force # ignore/add/remove/force
+sp_after_semi_for = add # ignore/add/remove/force
# Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; <here> ).
-sp_after_semi_for_empty = ignore # ignore/add/remove/force
+sp_after_semi_for_empty = add # ignore/add/remove/force
# Add or remove space before '[' (except '[]')
-sp_before_square = ignore # ignore/add/remove/force
+sp_before_square = remove # ignore/add/remove/force
# Add or remove space before '[]'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_squares = ignore # ignore/add/remove/force
# Add or remove space inside '[' and ']'
-sp_inside_square = ignore # ignore/add/remove/force
+sp_inside_square = remove # ignore/add/remove/force
# Add or remove space after ','
-sp_after_comma = ignore # ignore/add/remove/force
+# NOTE: is 48 worse than ignore
+sp_after_comma = add # ignore/add/remove/force
# Add or remove space before ','
sp_before_comma = remove # ignore/add/remove/force
# Add or remove space between an open paren and comma: '(,' vs '( ,'
-sp_paren_comma = force # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_paren_comma = ignore # ignore/add/remove/force
# Add or remove space before the variadic '...' when preceded by a non-punctuator
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_ellipsis = ignore # ignore/add/remove/force
# Add or remove space after class ':'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_class_colon = ignore # ignore/add/remove/force
# Add or remove space before class ':'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_class_colon = ignore # ignore/add/remove/force
# Add or remove space before case ':'. Default=Remove
sp_before_case_colon = remove # ignore/add/remove/force
# Add or remove space between 'operator' and operator sign
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_operator = ignore # ignore/add/remove/force
# Add or remove space between the operator symbol and the open paren, as in 'operator ++('
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_operator_sym = ignore # ignore/add/remove/force
# Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_cast = ignore # ignore/add/remove/force
# Add or remove spaces inside cast parens
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_inside_paren_cast = ignore # ignore/add/remove/force
# Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_cpp_cast_paren = ignore # ignore/add/remove/force
# Add or remove space between 'sizeof' and '('
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_sizeof_paren = ignore # ignore/add/remove/force
# Add or remove space after the tag keyword (Pawn)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_tag = ignore # ignore/add/remove/force
# Add or remove space inside enum '{' and '}'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_inside_braces_enum = ignore # ignore/add/remove/force
# Add or remove space inside struct/union '{' and '}'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_inside_braces_struct = ignore # ignore/add/remove/force
# Add or remove space inside '{' and '}'
-sp_inside_braces = ignore # ignore/add/remove/force
+sp_inside_braces = add # ignore/add/remove/force
# Add or remove space inside '{}'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_inside_braces_empty = ignore # ignore/add/remove/force
# Add or remove space between return type and function name
# A minimum of 1 is forced except for pointer return types.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_type_func = ignore # ignore/add/remove/force
# Add or remove space between function name and '(' on function declaration
-sp_func_proto_paren = ignore # ignore/add/remove/force
+sp_func_proto_paren = remove # ignore/add/remove/force
# Add or remove space between function name and '(' on function definition
-sp_func_def_paren = ignore # ignore/add/remove/force
+# NOTE: is 14 worse than ignore
+sp_func_def_paren = remove # ignore/add/remove/force
# Add or remove space inside empty function '()'
-sp_inside_fparens = ignore # ignore/add/remove/force
+sp_inside_fparens = remove # ignore/add/remove/force
# Add or remove space inside function '(' and ')'
-sp_inside_fparen = ignore # ignore/add/remove/force
+# NOTE: is 8 worse than ignore
+sp_inside_fparen = remove # ignore/add/remove/force
# Add or remove space between ']' and '(' when part of a function call.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_square_fparen = ignore # ignore/add/remove/force
# Add or remove space between ')' and '{' of function
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_fparen_brace = ignore # ignore/add/remove/force
# Add or remove space between function name and '(' on function calls
-sp_func_call_paren = add # ignore/add/remove/force
+# NOTE: is 28 worse than ignore
+sp_func_call_paren = remove # ignore/add/remove/force
# Add or remove space between function name and '()' on function calls without parameters.
# If set to 'ignore' (the default), sp_func_call_paren is used.
-sp_func_call_paren_empty = ignore # ignore/add/remove/force
+sp_func_call_paren_empty = remove # ignore/add/remove/force
# Add or remove space between the user function name and '(' on function calls
# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file.
-sp_func_call_user_paren = ignore # ignore/add/remove/force
+sp_func_call_user_paren = remove # ignore/add/remove/force
# Add or remove space between a constructor/destructor and the open paren
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_func_class_paren = ignore # ignore/add/remove/force
# Add or remove space between 'return' and '('
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_return_paren = ignore # ignore/add/remove/force
# Add or remove space between '__attribute__' and '('
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_attribute_paren = ignore # ignore/add/remove/force
# Add or remove space between 'defined' and '(' in '#if defined (FOO)'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_defined_paren = ignore # ignore/add/remove/force
# Add or remove space between 'throw' and '(' in 'throw (something)'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_throw_paren = ignore # ignore/add/remove/force
# Add or remove space between macro and value
-sp_macro = ignore # ignore/add/remove/force
+sp_macro = remove # ignore/add/remove/force #force
# Add or remove space between macro function ')' and value
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_macro_func = ignore # ignore/add/remove/force
# Add or remove space between 'else' and '{' if on the same line
-sp_else_brace = ignore # ignore/add/remove/force
+sp_else_brace = add # ignore/add/remove/force
# Add or remove space between '}' and 'else' if on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_brace_else = ignore # ignore/add/remove/force
# Add or remove space between '}' and the name of a typedef on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_brace_typedef = ignore # ignore/add/remove/force
# Add or remove space between 'catch' and '{' if on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_catch_brace = ignore # ignore/add/remove/force
# Add or remove space between '}' and 'catch' if on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_brace_catch = ignore # ignore/add/remove/force
# Add or remove space between 'finally' and '{' if on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_finally_brace = ignore # ignore/add/remove/force
# Add or remove space between '}' and 'finally' if on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_brace_finally = ignore # ignore/add/remove/force
# Add or remove space between 'try' and '{' if on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_try_brace = ignore # ignore/add/remove/force
# Add or remove space between get/set and '{' if on the same line
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_getset_brace = ignore # ignore/add/remove/force
# Add or remove space before the '::' operator
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_dc = ignore # ignore/add/remove/force
# Add or remove space after the '::' operator
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_dc = ignore # ignore/add/remove/force
# Add or remove around the D named array initializer ':' operator
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_d_array_colon = ignore # ignore/add/remove/force
# Add or remove space after the '!' (not) operator. Default=Remove
# Add or remove space after the '&' (address-of) operator. Default=Remove
# This does not affect the spacing after a '&' that is part of a type.
-sp_addr = remove # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_addr = ignore # ignore/add/remove/force
# Add or remove space around the '.' or '->' operators. Default=Remove
+# NOTE: is 4 worse than ignore
sp_member = remove # ignore/add/remove/force
# Add or remove space after the '*' (dereference) operator. Default=Remove
# This does not affect the spacing after a '*' that is part of a type.
-sp_deref = remove # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_deref = ignore # ignore/add/remove/force
# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove
+# NOTE: is 2 worse than ignore
sp_sign = remove # ignore/add/remove/force
# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove
sp_incdec = remove # ignore/add/remove/force
# Add or remove space before a backslash-newline at the end of a line. Default=Add
-sp_before_nl_cont = add # ignore/add/remove/force
+sp_before_nl_cont = add # ignore/add/remove/force #force
# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_oc_scope = ignore # ignore/add/remove/force
# Add or remove space after the colon in message specs
# '-(int) f:(int) x;' vs '-(int) f: (int) x;'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_oc_colon = ignore # ignore/add/remove/force
# Add or remove space before the colon in message specs
# '-(int) f: (int) x;' vs '-(int) f : (int) x;'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_oc_colon = ignore # ignore/add/remove/force
# Add or remove space after the colon in message specs
# '[object setValue:1];' vs '[object setValue: 1];'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_send_oc_colon = ignore # ignore/add/remove/force
# Add or remove space before the colon in message specs
# '[object setValue:1];' vs '[object setValue :1];'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_send_oc_colon = ignore # ignore/add/remove/force
# Add or remove space after the (type) in message specs
# '-(int)f: (int) x;' vs '-(int)f: (int)x;'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_oc_type = ignore # ignore/add/remove/force
# Add or remove space after the first (type) in message specs
# '-(int) f:(int)x;' vs '-(int)f:(int)x;'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_oc_return_type = ignore # ignore/add/remove/force
# Add or remove space between '@selector' and '('
# '@selector(msgName)' vs '@selector (msgName)'
# Also applies to @protocol() constructs
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_oc_at_sel = ignore # ignore/add/remove/force
# Add or remove space between '@selector(x)' and the following word
# '@selector(foo) a:' vs '@selector(foo)a:'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force
# Add or remove space inside '@selector' parens
# '@selector(foo)' vs '@selector( foo )'
# Also applies to @protocol() constructs
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force
# Add or remove space before a block pointer caret
# '^int (int arg){...}' vs. ' ^int (int arg){...}'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_before_oc_block_caret = ignore # ignore/add/remove/force
# Add or remove space after a block pointer caret
# '^int (int arg){...}' vs. '^ int (int arg){...}'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_after_oc_block_caret = ignore # ignore/add/remove/force
# Add or remove space around the ':' in 'b ? t : f'
-sp_cond_colon = ignore # ignore/add/remove/force
+sp_cond_colon = add # ignore/add/remove/force
# Add or remove space around the '?' in 'b ? t : f'
-sp_cond_question = ignore # ignore/add/remove/force
+sp_cond_question = add # ignore/add/remove/force
# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_case_label = ignore # ignore/add/remove/force
# Control the space around the D '..' operator.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_range = ignore # ignore/add/remove/force
# Control the space after the opening of a C++ comment '// A' vs '//A'
-sp_cmt_cpp_start = ignore # ignore/add/remove/force
+# NOTE: is 246 worse than ignore
+sp_cmt_cpp_start = add # ignore/add/remove/force
# Controls the spaces between #else or #endif and a trailing comment
+# WARNING: Code doesn't seem to use this feature - delete from the config?
sp_endif_cmt = ignore # ignore/add/remove/force
#
#
# Whether to keep non-indenting tabs
-align_keep_tabs = false # false/true
+align_keep_tabs = false # false/true #force
# Whether to use tabs for aligning
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_with_tabs = false # false/true
# Whether to bump out to the next tab when aligning
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_on_tabstop = false # false/true
# Whether to left-align numbers
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_number_left = false # false/true
# Align variable definitions in prototypes and functions
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_func_params = false # false/true
# Align parameters in single-line functions that have the same name.
# 0=Part of the type 'void * foo;'
# 1=Part of the variable 'void *foo;'
# 2=Dangling 'void *foo;'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_def_star_style = 0 # number
# How to align the '&' in variable definitions.
# 0=Part of the type
# 1=Part of the variable
# 2=Dangling
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_def_amp_style = 0 # number
# The threshold for aligning variable definitions (0=no limit)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_def_thresh = 0 # number
# The gap for aligning variable definitions
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_def_gap = 0 # number
# Whether to align the colon in struct bit fields
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_def_colon = false # false/true
# Whether to align any attribute after the variable name
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_def_attribute = false # false/true
# Whether to align inline struct/enum/union variable definitions
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_def_inline = false # false/true
# The span for aligning on '=' in assignments (0=don't align)
align_assign_span = 0 # number
# The threshold for aligning on '=' in assignments (0=no limit)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_assign_thresh = 0 # number
# The span for aligning on '=' in enums (0=don't align)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_enum_equ_span = 0 # number
# The threshold for aligning on '=' in enums (0=no limit)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_enum_equ_thresh = 0 # number
# The span for aligning struct/union (0=don't align)
align_var_struct_span = 0 # number
# The threshold for aligning struct/union member definitions (0=no limit)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_struct_thresh = 0 # number
# The gap for aligning struct/union member definitions
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_var_struct_gap = 0 # number
# The span for aligning struct initializer values (0=don't align)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_struct_init_span = 0 # number
# The minimum space between the type and the synonym of a typedef
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_typedef_gap = 0 # number
# The span for aligning single-line typedefs (0=don't align)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_typedef_span = 0 # number
# How to align typedef'd functions with other typedefs
# 0: Don't mix them at all
# 1: align the open paren with the types
# 2: align the function type name with the other type names
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_typedef_func = 0 # number
# Controls the positioning of the '*' in typedefs. Just try it.
# 0: Align on typedef type, ignore '*'
# 1: The '*' is part of type name: typedef int *pint;
# 2: The '*' is part of the type, but dangling: typedef int *pint;
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_typedef_star_style = 0 # number
# Controls the positioning of the '&' in typedefs. Just try it.
# 0: Align on typedef type, ignore '&'
# 1: The '&' is part of type name: typedef int &pint;
# 2: The '&' is part of the type, but dangling: typedef int &pint;
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_typedef_amp_style = 0 # number
# The span for aligning comments that end lines (0=don't align)
align_right_cmt_span = 0 # number
# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_right_cmt_mix = false # false/true
# If a trailing comment is more than this number of columns away from the text it follows,
# it will qualify for being aligned. This has to be > 0 to do anything.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_right_cmt_gap = 0 # number
# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_right_cmt_at_col = 0 # number
# The span for aligning function prototypes (0=don't align)
align_func_proto_span = 0 # number
# Minimum gap between the return type and the function name.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_func_proto_gap = 0 # number
# Align function protos on the 'operator' keyword instead of what follows
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_on_operator = false # false/true
# Whether to mix aligning prototype and variable declarations.
# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_mix_var_proto = false # false/true
# Align single-line functions with function prototypes, uses align_func_proto_span
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_single_line_func = false # false/true
# Aligning the open brace of single-line functions.
# Requires align_single_line_func=true, uses align_func_proto_span
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_single_line_brace = false # false/true
# Gap for align_single_line_brace.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_single_line_brace_gap = 0 # number
# The span for aligning ObjC msg spec (0=don't align)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_oc_msg_spec_span = 0 # number
# Whether to align macros wrapped with a backslash and a newline.
align_nl_cont = false # false/true
# The minimum space between label and value of a preprocessor define
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_pp_define_gap = 0 # number
# The span for aligning on '#define' bodies (0=don't align)
align_pp_define_span = 0 # number
# Align lines that start with '<<' with previous '<<'. Default=true
-align_left_shift = true # false/true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+align_left_shift = false # false/true
# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_oc_msg_colon_span = 0 # number
# Aligning parameters in an Obj-C '+' or '-' declaration on the ':'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
align_oc_decl_colon = false # false/true
#
nl_collapse_empty_body = false # false/true
# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_assign_leave_one_liners = false # false/true
# Don't split one-line braced statements inside a class xx { } body
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_class_leave_one_liners = false # false/true
# Don't split one-line enums: 'enum foo { BAR = 15 };'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_enum_leave_one_liners = false # false/true
# Don't split one-line get or set functions
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_getset_leave_one_liners = false # false/true
# Don't split one-line function definitions - 'int foo() { return 0; }'
-nl_func_leave_one_liners = false # false/true
+nl_func_leave_one_liners = true # false/true
# Don't split one-line if/else statements - 'if(a) b++;'
nl_if_leave_one_liners = true # false/true
# Add or remove newlines at the start of the file
-nl_start_of_file = ignore # ignore/add/remove/force
+nl_start_of_file = remove # ignore/add/remove/force #force
# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_start_of_file_min = 0 # number
# Add or remove newline at the end of the file
-nl_end_of_file = ignore # ignore/add/remove/force
+nl_end_of_file = add # ignore/add/remove/force
# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force')
nl_end_of_file_min = 0 # number
# Add or remove newline between '=' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_assign_brace = ignore # ignore/add/remove/force
# Add or remove newline between '=' and '[' (D only)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_assign_square = ignore # ignore/add/remove/force
# Add or remove newline after '= [' (D only). Will also affect the newline before the ']'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_after_square_assign = ignore # ignore/add/remove/force
# The number of blank lines after a block of variable definitions
-nl_func_var_def_blk = 0 # number
+nl_func_var_def_blk = 0 # number #force
# Add or remove newline between a function call's ')' and '{', as in:
# list_for_each(item, &list) { }
-nl_fcall_brace = ignore # ignore/add/remove/force
+nl_fcall_brace = add # ignore/add/remove/force
# Add or remove newline between 'enum' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_enum_brace = ignore # ignore/add/remove/force
# Add or remove newline between 'struct and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_struct_brace = ignore # ignore/add/remove/force
# Add or remove newline between 'union' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_union_brace = ignore # ignore/add/remove/force
# Add or remove newline between 'if' and '{'
-nl_if_brace = ignore # ignore/add/remove/force
+# NOTE: is 120 worse than ignore
+nl_if_brace = add # ignore/add/remove/force
# Add or remove newline between '}' and 'else'
-nl_brace_else = ignore # ignore/add/remove/force
+nl_brace_else = add # ignore/add/remove/force
# Add or remove newline between 'else if' and '{'
# If set to ignore, nl_if_brace is used instead
-nl_elseif_brace = ignore # ignore/add/remove/force
+nl_elseif_brace = add # ignore/add/remove/force
# Add or remove newline between 'else' and '{'
-nl_else_brace = ignore # ignore/add/remove/force
+nl_else_brace = add # ignore/add/remove/force
# Add or remove newline between 'else' and 'if'
-nl_else_if = ignore # ignore/add/remove/force
+nl_else_if = remove # ignore/add/remove/force
# Add or remove newline between '}' and 'finally'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_brace_finally = ignore # ignore/add/remove/force
# Add or remove newline between 'finally' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_finally_brace = ignore # ignore/add/remove/force
# Add or remove newline between 'try' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_try_brace = ignore # ignore/add/remove/force
# Add or remove newline between get/set and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_getset_brace = ignore # ignore/add/remove/force
# Add or remove newline between 'for' and '{'
-nl_for_brace = ignore # ignore/add/remove/force
+# NOTE: is 23 worse than ignore
+nl_for_brace = add # ignore/add/remove/force
# Add or remove newline between 'catch' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_catch_brace = ignore # ignore/add/remove/force
# Add or remove newline between '}' and 'catch'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_brace_catch = ignore # ignore/add/remove/force
# Add or remove newline between 'while' and '{'
-nl_while_brace = ignore # ignore/add/remove/force
+# NOTE: is 8 worse than ignore
+nl_while_brace = add # ignore/add/remove/force
# Add or remove newline between 'using' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_using_brace = ignore # ignore/add/remove/force
# Add or remove newline between two open or close braces.
# Due to general newline/brace handling, REMOVE may not work.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_brace_brace = ignore # ignore/add/remove/force
# Add or remove newline between 'do' and '{'
-nl_do_brace = ignore # ignore/add/remove/force
+nl_do_brace = add # ignore/add/remove/force
# Add or remove newline between '}' and 'while' of 'do' statement
-nl_brace_while = ignore # ignore/add/remove/force
+nl_brace_while = add # ignore/add/remove/force #force
# Add or remove newline between 'switch' and '{'
-nl_switch_brace = ignore # ignore/add/remove/force
+# NOTE: is 20 worse than ignore
+nl_switch_brace = add # ignore/add/remove/force
# Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc.
# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_multi_line_cond = false # false/true
# Force a newline in a define after the macro name for multi-line defines.
nl_before_case = false # false/true
# Add or remove newline between ')' and 'throw'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_before_throw = ignore # ignore/add/remove/force
# Whether to put a newline after 'case' statement
nl_after_case = false # false/true
# Newline between namespace and {
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_namespace_brace = ignore # ignore/add/remove/force
# Add or remove newline between 'template<>' and whatever follows.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_template_class = ignore # ignore/add/remove/force
# Add or remove newline between 'class' and '{'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_class_brace = ignore # ignore/add/remove/force
# Add or remove newline after each ',' in the constructor member initialization
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_class_init_args = ignore # ignore/add/remove/force
# Add or remove newline between return type and function name in a function definition
-nl_func_type_name = ignore # ignore/add/remove/force
+nl_func_type_name = remove # ignore/add/remove/force
# Add or remove newline between return type and function name inside a class {}
# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_func_type_name_class = ignore # ignore/add/remove/force
# Add or remove newline between function scope and name in a definition
# Controls the newline after '::' in 'void A::f() { }'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_func_scope_name = ignore # ignore/add/remove/force
# Add or remove newline between return type and function name in a prototype
-nl_func_proto_type_name = ignore # ignore/add/remove/force
+# NOTE: is 1 worse than ignore
+nl_func_proto_type_name = remove # ignore/add/remove/force
# Add or remove newline between a function name and the opening '('
-nl_func_paren = ignore # ignore/add/remove/force
+nl_func_paren = remove # ignore/add/remove/force
# Add or remove newline between a function name and the opening '(' in the definition
-nl_func_def_paren = ignore # ignore/add/remove/force
+nl_func_def_paren = remove # ignore/add/remove/force
# Add or remove newline after '(' in a function declaration
-nl_func_decl_start = ignore # ignore/add/remove/force
+nl_func_decl_start = remove # ignore/add/remove/force
# Add or remove newline after '(' in a function definition
-nl_func_def_start = ignore # ignore/add/remove/force
+nl_func_def_start = remove # ignore/add/remove/force
-# Overrides nl_func_decl_start when there is only one parameter.
-nl_func_decl_start_single = ignore # ignore/add/remove/force
-
-# Overrides nl_func_def_start when there is only one parameter.
-nl_func_def_start_single = ignore # ignore/add/remove/force
+# # Overrides nl_func_decl_start when there is only one parameter.
+# nl_func_decl_start_single = ignore # ignore/add/remove/force
+#
+# # Overrides nl_func_def_start when there is only one parameter.
+# nl_func_def_start_single = ignore # ignore/add/remove/force
# Add or remove newline after each ',' in a function declaration
-nl_func_decl_args = ignore # ignore/add/remove/force
+nl_func_decl_args = remove # ignore/add/remove/force
# Add or remove newline after each ',' in a function definition
-nl_func_def_args = ignore # ignore/add/remove/force
+nl_func_def_args = remove # ignore/add/remove/force
# Add or remove newline before the ')' in a function declaration
-nl_func_decl_end = ignore # ignore/add/remove/force
+nl_func_decl_end = remove # ignore/add/remove/force
# Add or remove newline before the ')' in a function definition
-nl_func_def_end = ignore # ignore/add/remove/force
+nl_func_def_end = remove # ignore/add/remove/force
-# Overrides nl_func_decl_end when there is only one parameter.
-nl_func_decl_end_single = ignore # ignore/add/remove/force
-
-# Overrides nl_func_def_end when there is only one parameter.
-nl_func_def_end_single = ignore # ignore/add/remove/force
+# # Overrides nl_func_decl_end when there is only one parameter.
+# nl_func_decl_end_single = ignore # ignore/add/remove/force
+#
+# # Overrides nl_func_def_end when there is only one parameter.
+# nl_func_def_end_single = ignore # ignore/add/remove/force
# Add or remove newline between '()' in a function declaration.
-nl_func_decl_empty = ignore # ignore/add/remove/force
+nl_func_decl_empty = remove # ignore/add/remove/force
# Add or remove newline between '()' in a function definition.
-nl_func_def_empty = ignore # ignore/add/remove/force
+nl_func_def_empty = remove # ignore/add/remove/force
# Add or remove newline between function signature and '{'
-nl_fdef_brace = ignore # ignore/add/remove/force
+# NOTE: is 27 worse than ignore
+nl_fdef_brace = add # ignore/add/remove/force
# Whether to put a newline after 'return' statement
nl_after_return = false # false/true
# Add or remove a newline between the return keyword and return expression.
-nl_return_expr = ignore # ignore/add/remove/force
+# NOTE: is 2 worse than ignore
+nl_return_expr = remove # ignore/add/remove/force
# Whether to put a newline after semicolons, except in 'for' statements
nl_after_semicolon = false # false/true
# Whether to put a newline after brace open.
# This also adds a newline before the matching brace close.
-nl_after_brace_open = true # false/true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+nl_after_brace_open = false # false/true
# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is
# placed between the open brace and a trailing single-line comment.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_after_brace_open_cmt = false # false/true
# Whether to put a newline after a virtual brace open with a non-empty body.
# These occur in un-braced if/while/do/for statement bodies.
-nl_after_vbrace_open = true # false/true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+nl_after_vbrace_open = false # false/true
# Whether to put a newline after a virtual brace open with an empty body.
# These occur in un-braced if/while/do/for statement bodies.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_after_vbrace_open_empty = false # false/true
# Whether to put a newline after a brace close.
# Does not apply if followed by a necessary ';'.
-nl_after_brace_close = true # false/true
+nl_after_brace_close = false # false/true
# Whether to put a newline after a virtual brace close.
# Would add a newline before return in: 'if (foo) a++; return;'
-nl_after_vbrace_close = true # false/true
+nl_after_vbrace_close = false # false/true
# Whether to alter newlines in '#define' macros
-nl_define_macro = false # false/true
+nl_define_macro = true # false/true
# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_squeeze_ifdef = false # false/true
# Add or remove blank line before 'if'
-nl_before_if = ignore # ignore/add/remove/force
+nl_before_if = ignore # ignore/add/remove/force #force
# Add or remove blank line after 'if' statement
-nl_after_if = ignore # ignore/add/remove/force
+nl_after_if = ignore # ignore/add/remove/force #force
# Add or remove blank line before 'for'
-nl_before_for = ignore # ignore/add/remove/force
+nl_before_for = ignore # ignore/add/remove/force #force
# Add or remove blank line after 'for' statement
-nl_after_for = ignore # ignore/add/remove/force
+nl_after_for = ignore # ignore/add/remove/force #force
# Add or remove blank line before 'while'
-nl_before_while = ignore # ignore/add/remove/force
+nl_before_while = ignore # ignore/add/remove/force #force
# Add or remove blank line after 'while' statement
-nl_after_while = ignore # ignore/add/remove/force
+nl_after_while = ignore # ignore/add/remove/force #force
# Add or remove blank line before 'switch'
-nl_before_switch = ignore # ignore/add/remove/force
+nl_before_switch = ignore # ignore/add/remove/force #force
# Add or remove blank line after 'switch' statement
-nl_after_switch = ignore # ignore/add/remove/force
+nl_after_switch = ignore # ignore/add/remove/force #force
# Add or remove blank line before 'do'
-nl_before_do = ignore # ignore/add/remove/force
+nl_before_do = ignore # ignore/add/remove/force #force
# Add or remove blank line after 'do/while' statement
-nl_after_do = ignore # ignore/add/remove/force
+nl_after_do = ignore # ignore/add/remove/force #force
# Whether to double-space commented-entries in struct/enum
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_ds_struct_enum_cmt = false # false/true
# Whether to double-space before the close brace of a struct/union/enum
# (lower priority than 'eat_blanks_before_close_brace')
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_ds_struct_enum_close_brace = false # false/true
# Add or remove a newline around a class colon.
# Related to pos_class_colon, nl_class_init_args, and pos_comma.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_class_colon = ignore # ignore/add/remove/force
# Change simple unbraced if statements into a one-liner
#
# The position of arithmetic operators in wrapped expressions
-pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+pos_arith = lead # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
# The position of assignment in wrapped expressions.
# Do not affect '=' followed by '{'
-pos_assign = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+pos_assign = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
# The position of boolean operators in wrapped expressions
-pos_bool = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+pos_bool = lead # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
# The position of comparison operators in wrapped expressions
+# WARNING: Best is not unique (lead trail)
pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
# The position of conditional (b ? t : f) operators in wrapped expressions
-pos_conditional = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+pos_conditional = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
# The position of the comma in wrapped expressions
-pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+pos_comma = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
# The position of the comma in the constructor initialization list
+# WARNING: Code doesn't seem to use this feature - delete from the config?
pos_class_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
# The position of colons between constructor and member initialization
+# WARNING: Code doesn't seem to use this feature - delete from the config?
pos_class_colon = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
#
code_width = 0 # number
# Whether to fully split long 'for' statements at semi-colons
+# WARNING: Code doesn't seem to use this feature - delete from the config?
ls_for_split_full = false # false/true
# Whether to fully split long function protos/calls at commas
+# WARNING: Code doesn't seem to use this feature - delete from the config?
ls_func_split_full = false # false/true
#
#
# The maximum consecutive newlines
-nl_max = 3 # number
+nl_max = 3 # number #force
# The number of newlines after a function prototype, if followed by another function prototype
+# WARNING: Best is not unique (0 1)
nl_after_func_proto = 0 # number
# The number of newlines after a function prototype, if not followed by another function prototype
+# WARNING: Best is not unique (0 1)
nl_after_func_proto_group = 0 # number
# The number of newlines after '}' of a multi-line function body
nl_after_func_body = 0 # number
# The number of newlines after '}' of a single line function body
+# WARNING: Best is not unique (0 1)
nl_after_func_body_one_liner = 0 # number
# The minimum number of newlines before a multi-line comment.
# Doesn't apply if after a brace open or another multi-line comment.
+# WARNING: Best is not unique (0 1)
nl_before_block_comment = 0 # number
# The minimum number of newlines before a single-line C comment.
# Doesn't apply if after a brace open or other single-line C comments.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_before_c_comment = 0 # number
# The minimum number of newlines before a CPP comment.
# Doesn't apply if after a brace open or other CPP comments.
+# WARNING: Best is not unique (0 1)
nl_before_cpp_comment = 0 # number
# Whether to force a newline after a multi-line comment.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_after_multiline_comment = false # false/true
# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
# Will not change the newline count if after a brace open.
# 0 = No change.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_before_access_spec = 0 # number
# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
# 0 = No change.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_after_access_spec = 0 # number
# The number of newlines between a function def and the function comment.
# 0 = No change.
+# WARNING: Best is not unique (0 2)
nl_comment_func_def = 0 # number
# The number of newlines after a try-catch-finally block that isn't followed by a brace close.
# 0 = No change.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_after_try_catch_finally = 0 # number
# The number of newlines before and after a property, indexer or event decl.
# 0 = No change.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_around_cs_property = 0 # number
# The number of newlines between the get/set/add/remove handlers in C#.
# 0 = No change.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
nl_between_get_set = 0 # number
# Whether to remove blank lines after '{'
-eat_blanks_after_open_brace = false # false/true
+eat_blanks_after_open_brace = true # false/true #force
# Whether to remove blank lines before '}'
-eat_blanks_before_close_brace = false # false/true
+eat_blanks_before_close_brace = true # false/true #force
#
# Code modifying options (non-whitespace)
#
# Add or remove braces on single-line 'do' statement
-mod_full_brace_do = ignore # ignore/add/remove/force
+mod_full_brace_do = add # ignore/add/remove/force
# Add or remove braces on single-line 'for' statement
-mod_full_brace_for = ignore # ignore/add/remove/force
+# NOTE: is 16 worse than ignore
+mod_full_brace_for = remove # ignore/add/remove/force
# Add or remove braces on single-line function definitions. (Pawn)
+# WARNING: Code doesn't seem to use this feature - delete from the config?
mod_full_brace_function = ignore # ignore/add/remove/force
# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
-mod_full_brace_if = ignore # ignore/add/remove/force
+# NOTE: is 35 worse than ignore
+mod_full_brace_if = remove # ignore/add/remove/force
# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if.
# If any must be braced, they are all braced. If all can be unbraced, then the braces are removed.
-mod_full_brace_if_chain = false # false/true
+mod_full_brace_if_chain = true # false/true #force
# Don't remove braces around statements that span N newlines
-mod_full_brace_nl = 0 # number
+mod_full_brace_nl = 2 # number #force
# Add or remove braces on single-line 'while' statement
-mod_full_brace_while = ignore # ignore/add/remove/force
+mod_full_brace_while = remove # ignore/add/remove/force
# Add or remove braces on single-line 'using ()' statement
+# WARNING: Code doesn't seem to use this feature - delete from the config?
mod_full_brace_using = ignore # ignore/add/remove/force
# Add or remove unnecessary paren on 'return' statement
-mod_paren_on_return = ignore # ignore/add/remove/force
+mod_paren_on_return = remove # ignore/add/remove/force
# Whether to change optional semicolons to real semicolons
+# WARNING: Code doesn't seem to use this feature - delete from the config?
mod_pawn_semicolon = false # false/true
# Add parens on 'while' and 'if' statement around bools
mod_full_paren_if_bool = false # false/true
# Whether to remove superfluous semicolons
+# WARNING: Code doesn't seem to use this feature - delete from the config?
mod_remove_extra_semicolon = false # false/true
# If a function body exceeds the specified number of newlines and doesn't have a comment after
mod_add_long_ifdef_else_comment = 0 # number
# If TRUE, will sort consecutive single-line 'import' statements [Java, D]
+# WARNING: Code doesn't seem to use this feature - delete from the config?
mod_sort_import = false # false/true
# If TRUE, will sort consecutive single-line 'using' statements [C#]
+# WARNING: Code doesn't seem to use this feature - delete from the config?
mod_sort_using = false # false/true
# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C]
# This is generally a bad idea, as it may break your code.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
mod_sort_include = false # false/true
# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace.
-mod_move_case_break = true # false/true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+mod_move_case_break = false # false/true
# Will add or remove the braces around a fully braced case statement.
# Will only remove the braces if there are no variable declarations in the block.
-mod_case_brace = ignore # ignore/add/remove/force
+# NOTE: is 41 worse than ignore
+mod_case_brace = remove # ignore/add/remove/force
# If TRUE, it will remove a void 'return;' that appears as the last statement in a function.
-mod_remove_empty_return = true # false/true
+mod_remove_empty_return = true # false/true #force
#
# Comment modifications
# 0: no reflowing (apart from the line wrapping due to cmt_width)
# 1: no touching at all
# 2: full reflow
-cmt_reflow_mode = 1 # number
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+cmt_reflow_mode = 0 # number
# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars.
# Default is true.
-cmt_indent_multi = true # false/true
+cmt_indent_multi = false # false/true
# Whether to group c-comments that look like they are in a block
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_c_group = false # false/true
# Whether to put an empty '/*' on the first line of the combined c-comment
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_c_nl_start = false # false/true
# Whether to put a newline before the closing '*/' of the combined c-comment
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_c_nl_end = false # false/true
# Whether to group cpp-comments that look like they are in a block
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_cpp_group = false # false/true
# Whether to put an empty '/*' on the first line of the combined cpp-comment
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_cpp_nl_start = false # false/true
# Whether to put a newline before the closing '*/' of the combined cpp-comment
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_cpp_nl_end = false # false/true
# Whether to change cpp-comments into c-comments
cmt_cpp_to_c = false # false/true
# Whether to put a star on subsequent comment lines
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_star_cont = false # false/true
# The number of spaces to insert at the start of subsequent comment lines
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_sp_before_star_cont = 0 # number
# The number of spaces to insert after the star on subsequent comment lines
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_sp_after_star_cont = 0 # number
# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of
# the comment are the same length. Default=True
-cmt_multi_check_last = true # false/true
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+cmt_multi_check_last = false # false/true
# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment.
# Will substitute $(filename) with the current file's name.
+# WARNING: unsupported string
cmt_insert_file_header = "" # string
# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment.
# Will substitute $(filename) with the current file's name.
+# WARNING: unsupported string
cmt_insert_file_footer = "" # string
# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment.
# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff.
# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... }
+# WARNING: unsupported string
cmt_insert_func_header = "" # string
# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment.
# Will substitute $(class) with the class name.
+# WARNING: unsupported string
cmt_insert_class_header = "" # string
# If a preprocessor is encountered when stepping backwards from a function name, then
# this option decides whether the comment should be inserted.
# Affects cmt_insert_func_header and cmt_insert_class_header.
+# WARNING: Code doesn't seem to use this feature - delete from the config?
cmt_insert_before_preproc = false # false/true
#
#
# Control indent of preprocessors inside #if blocks at brace level 0
+# WARNING: Indifferent... please decide manually.
pp_indent = ignore # ignore/add/remove/force
# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false)
pp_indent_at_level = false # false/true
# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1.
-pp_indent_count = 1 # number
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+pp_indent_count = 0 # number
# Add or remove space after # based on pp_level of #if blocks
-pp_space = ignore # ignore/add/remove/force
+pp_space = remove # ignore/add/remove/force
# Sets the number of spaces added with pp_space
+# WARNING: Code doesn't seem to use this feature - delete from the config?
pp_space_count = 0 # number
# The indent for #region and #endregion in C# and '#pragma region' in C/C++
+# WARNING: Code doesn't seem to use this feature - delete from the config?
pp_indent_region = 0 # number
# Whether to indent the code between #region and #endregion
+# WARNING: Code doesn't seem to use this feature - delete from the config?
pp_region_indent_code = false # false/true
# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level
+# WARNING: Code doesn't seem to use this feature - delete from the config?
pp_indent_if = 0 # number
# Control whether to indent the code between #if, #else and #endif when not at file-level
for(e = world; (e = nextent(e)); )
{
if(warpzone_warpzones_exist) { WarpZone_StoreProjectileData(e); }
-
+
if(IS_REAL_CLIENT(e))
{
if(e.solid == SOLID_NOT) // not spectating?
if(e.movetype == MOVETYPE_NOCLIP || e.movetype == MOVETYPE_FLY || e.movetype == MOVETYPE_FLY_WORLDONLY) // not spectating? (this is to catch observers)
{
other = e; // player
-
+
// warpzones
- if(warpzone_warpzones_exist) {
- self = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs);
+ if(warpzone_warpzones_exist) {
+ self = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs);
if(self)
if(!WarpZoneLib_ExactTrigger_Touch())
if(WarpZone_PlaneDist(self, e.origin + e.view_ofs) <= 0)
WarpZone_Teleport(self, e, -1, 0); } // NOT triggering targets by this!
-
+
// teleporters
self = Teleport_Find(e.origin + e.mins, e.origin + e.maxs);
if(self)
Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
}
}
-
+
if(IS_NOT_A_CLIENT(e))
{
if(warpzone_warpzones_exist)