set g_balance_shotgun_primary_refire 0.5
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 12000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_shotgun_secondary 1
set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
set g_balance_shotgun_secondary_melee_range 120
set g_balance_uzi_sustained_refire 0.1
set g_balance_uzi_sustained_ammo 1
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
set g_balance_uzi_switchdelay_drop 0.15
set g_balance_uzi_switchdelay_raise 0.15
set g_balance_shotgun_primary_refire 1
set g_balance_shotgun_primary_animtime 0.3
set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 12000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_shotgun_secondary 1
set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
set g_balance_shotgun_secondary_melee_range 120
set g_balance_uzi_sustained_refire 0.1
set g_balance_uzi_sustained_ammo 1
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
set g_balance_uzi_switchdelay_drop 0.15
set g_balance_uzi_switchdelay_raise 0.15
set g_balance_shotgun_primary_refire 0.75
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 8000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_shotgun_secondary 1
set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
set g_balance_shotgun_secondary_melee_range 120
set g_balance_uzi_sustained_refire 0.1
set g_balance_uzi_sustained_ammo 1
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
set g_balance_uzi_switchdelay_drop 0
set g_balance_uzi_switchdelay_raise 0
set g_balance_shotgun_primary_refire 0.75
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 8000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_shotgun_secondary 1
set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
set g_balance_shotgun_secondary_melee_range 120
set g_balance_uzi_sustained_refire 0.1
set g_balance_uzi_sustained_ammo 1
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
set g_balance_uzi_switchdelay_drop 0.2
set g_balance_uzi_switchdelay_raise 0.2
set g_balance_shotgun_primary_refire 0.75
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 8000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_shotgun_secondary 1
set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
set g_balance_shotgun_secondary_melee_range 120
set g_balance_uzi_sustained_refire 0.1
set g_balance_uzi_sustained_ammo 1
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
set g_balance_uzi_switchdelay_drop 0.2
set g_balance_uzi_switchdelay_raise 0.2
// q3map_skylight 9.32523632 3
alias skybox_nosRGB_to_sRGB "rpn $3 402.123 $4 div div $rpn_sRGB_to_linear 402.123 $4 div mul /new_skylight: $3 402.123 $4 div div $1 256 div $2 0.017453 mul sin mul add $rpn_sRGB_to_linear $3 402.123 $4 div div $rpn_sRGB_to_linear sub 256 mul $2 0.017453 mul sin div /new_sunlight:"
+set cl_orthoview 0 "enable top-down view of the map- meant to be used for radar map images (note: orthoview sets cvars temporarily, requires restart to return them to normal)"
+set cl_orthoview_nofog 1 "disable fog while in orthoview-- note, should not be enabled on ALL maps, i.e. oilrig works fine with this disabled"
+
// these settings determine how much the view is affected by movement/damage
cl_smoothviewheight 0.05 // time of the averaging to the viewheight value so that it creates a smooth transition for crouching and such. 0 for instant transition
cl_deathfade 0 // fade screen to dark red when dead, value represents how fast the fade is (higher is faster)
// Quake-Joule: 1 qJ = 1 qN * 1 qu
// Quake-Pascal: 1 qPa = 1 qN / 1 qu^2
-set g_ballistics_materialconstant 1414213562
-set g_ballistics_mindistance 16
+set g_ballistics_mindistance 2 // enable ballistics starting from 2 qu
set g_ballistics_density_player 0.50 // players are 2x as easy to pass as walls
set g_ballistics_density_corpse 0.10 // corpses are 10x as easy to pass as walls
-// unit: qJ / qu^3 (energy needed per volume unit of solid to push/burn away
-// parameter: bullet constant: mass / area in g/qu^2
-// = mass / (pi/4 * caliber^2)
-// with caliber in inches, mass in grams:
-// = 1.273239544735163 * mass / caliber^2
-// with caliber in inches, mass in grains:
-// = 0.082633246453312 * mass / caliber^2
-
-// bullet max travel distance inside solid:
-// 0.5 * v^2 * bulletconstant / g_ballistics_materialconstant
-
-// some bullet constants:
-// http://hypertextbook.com/facts/2000/ShantayArmstrong.shtml
-// second bullet: caliber .45, mass 16.2g, bullet constant 101.859163578813
-// third bullet: caliber .338, mass 16.2g, bullet constant 180.5476053421592
-// fourth bullet: caliber .25, mass 2.3g, bullet constant 46.85521524625399
-// http://en.wikipedia.org/wiki/.50_BMG
-// caliber .5, 360 grains, bullet constant 118.9918748927693
-// AK-47:
-// caliber .3, 62 grains, bullet constant 56.92512533450383
-// .3 winchester magnum:
-// caliber .3, 150 grains, bullet constant 137.7220774221867
set cl_stripcolorcodes 0 "experimental feature (notes: strips ALL color codes from messages!)"
set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during clan arena games."
set g_ca_warmup 10 "how long the players will have time to run around the map before the round starts"
set g_ca_damage2score_multiplier 0.01
-set g_ca_round_timelimit 180
+set g_ca_round_timelimit 180 "round time limit in seconds"
seta g_ca_teams_override 0
+set g_ca_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
set g_ca_teams 0
// ==========================
set g_dm 1 "Deathmatch: killing any other player is one frag, player with most frags wins"
set g_tdm_teams 2 "how many teams are in team deathmatch (set by mapinfo)"
-set g_tdm_team_spawns 0 "when 1, a map can define team spawnpoints for TDM"
+set g_tdm_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
seta g_tdm_teams_override 0 "how many teams are in team deathmatch"
set g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him"
set g_freezetag_revive_falldamage 0 "Enable reviving from this amount of fall damage"
set g_freezetag_revive_falldamage_health 40 "Amount of health player has if they revived from falling"
-set g_freezetag_round_timelimit 180
+set g_freezetag_round_timelimit 180 "round time limit in seconds"
set g_freezetag_frozen_force 0.6 "How much to multiply the force on a frozen player with"
set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds"
seta g_freezetag_teams_override 0
+set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
set g_freezetag_teams 0
set g_balance_rifle_primary_damage 80
set g_balance_rifle_primary_spread 0
set g_balance_rifle_primary_force 100
-set g_balance_rifle_primary_speed 40000
-set g_balance_rifle_primary_lifetime 5
set g_balance_rifle_primary_refire 1.2
set g_balance_rifle_primary_animtime 0.4
set g_balance_rifle_primary_ammo 10
-set g_balance_rifle_primary_bulletconstant 110 // 62.2qu
+set g_balance_rifle_primary_solidpenetration 62.2
set g_balance_rifle_primary_burstcost 0
set g_balance_rifle_primary_bullethail 0 // empty magazine on shot
set g_balance_rifle_secondary 1
set g_balance_rifle_secondary_damage 20
set g_balance_rifle_secondary_spread 0.04
set g_balance_rifle_secondary_force 50
-set g_balance_rifle_secondary_speed 20000
-set g_balance_rifle_secondary_lifetime 5
set g_balance_rifle_secondary_refire 0.9
set g_balance_rifle_secondary_animtime 0.3
set g_balance_rifle_secondary_ammo 10
-set g_balance_rifle_secondary_bulletconstant 110 // 15.5qu
+set g_balance_rifle_secondary_solidpenetration 15.5
set g_balance_rifle_secondary_burstcost 0
set g_balance_rifle_secondary_bullethail 0 // empty magazine on shot
set g_balance_rifle_switchdelay_drop 0.2
check_unacceptable_compiler_bugs();
#ifdef WATERMARK
- print(sprintf(_("^4CSQC Build information: ^1%s\n"), WATERMARK));
+ printf(_("^4CSQC Build information: ^1%s\n"), WATERMARK);
#endif
float i;
default:
if(GetTeam(Team, false) == world)
{
- print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
+ printf(_("trying to switch to unsupported team %d\n"), Team);
Team = NUM_SPECTATOR;
}
break;
default:
if(GetTeam(Team, false) == world)
{
- print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
+ printf(_("trying to switch to unsupported team %d\n"), Team);
Team = NUM_SPECTATOR;
}
break;
if(!isNew && n != self.sv_entnum)
{
//print("A CSQC entity changed its owner!\n");
- print(sprintf("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(self), self.classname));
+ printf("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(self), self.classname);
isNew = true;
Ent_Remove();
self.enttype = ENT_CLIENT_SCORES;
}
}
- //print(sprintf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(self.origin), teamnum, self.cnt));
+ //printf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(self.origin), teamnum, self.cnt);
}
void Ent_ReadSpawnEvent(float is_new)
}
}
- //print(sprintf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d, localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum));
+ //printf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d, localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum);
}
// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
t = ReadByte();
if(autocvar_developer_csqcentities)
- print(sprintf("CSQC_Ent_Update(%d) with self=%i self.entnum=%d self.enttype=%d t=%d\n", bIsNewEntity, self, self.entnum, self.enttype, t));
+ printf("CSQC_Ent_Update(%d) with self=%i self.entnum=%d self.enttype=%d t=%d\n", bIsNewEntity, self, self.entnum, self.enttype, t);
// set up the "time" global for received entities to be correct for interpolation purposes
savetime = time;
if(t != self.enttype || bIsNewEntity)
{
//print("A CSQC entity changed its type!\n");
- print(sprintf("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(self), self.entnum, self.enttype, t));
+ printf("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(self), self.entnum, self.enttype, t);
Ent_Remove();
clearentity(self);
bIsNewEntity = 1;
{
if(!bIsNewEntity)
{
- print(sprintf("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(self), self.entnum, t));
+ printf("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(self), self.entnum, t);
bIsNewEntity = 1;
}
}
void CSQC_Ent_Remove()
{
if(autocvar_developer_csqcentities)
- print(sprintf("CSQC_Ent_Remove() with self=%i self.entnum=%d self.enttype=%d\n", self, self.entnum, self.enttype));
+ printf("CSQC_Ent_Remove() with self=%i self.entnum=%d self.enttype=%d\n", self, self.entnum, self.enttype);
if(wasfreed(self))
{
void CSQC_Parse_StuffCmd(string strMessage)
{
if(autocvar_developer_csqcentities)
- print(sprintf("CSQC_Parse_StuffCmd(\"%s\")\n", strMessage));
+ printf("CSQC_Parse_StuffCmd(\"%s\")\n", strMessage);
localcmd(strMessage);
}
void CSQC_Parse_Print(string strMessage)
{
if(autocvar_developer_csqcentities)
- print(sprintf("CSQC_Parse_Print(\"%s\")\n", strMessage));
+ printf("CSQC_Parse_Print(\"%s\")\n", strMessage);
print(ColorTranslateRGB(strMessage));
}
void CSQC_Parse_CenterPrint(string strMessage)
{
if(autocvar_developer_csqcentities)
- print(sprintf("CSQC_Parse_CenterPrint(\"%s\")\n", strMessage));
+ printf("CSQC_Parse_CenterPrint(\"%s\")\n", strMessage);
centerprint_hud(strMessage);
}
{
// TODO somehow thwart prvm_globalset client ...
- if(forcefog != "")
- localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2));
+ if(autocvar_cl_orthoview && autocvar_cl_orthoview_nofog)
+ { localcmd("\nr_drawfog 0\n"); }
+ else if(forcefog != "")
+ { localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2)); }
}
void Gamemode_Init();
nTEID = ReadByte();
if(autocvar_developer_csqcentities)
- print(sprintf("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID));
+ printf("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID);
// NOTE: Could just do return instead of break...
switch(nTEID)
Net_ReadRace();
bHandled = true;
break;
- case TE_CSQC_ZCURVEPARTICLES:
- Net_ReadZCurveParticles();
- bHandled = true;
- break;
case TE_CSQC_NEXGUNBEAMPARTICLE:
Net_ReadNexgunBeamParticle();
bHandled = true;
return '1 0 0' * fovx + '0 1 0' * fovy;
}
+vector GetOrthoviewFOV(vector ov_worldmin, vector ov_worldmax, vector ov_mid, vector ov_org)
+{
+ float fovx, fovy;
+ float width = (ov_worldmax_x - ov_worldmin_x);
+ float height = (ov_worldmax_y - ov_worldmin_y);
+ float distance_to_middle_of_world = vlen(ov_mid - ov_org);
+ fovx = atan2(width/2, distance_to_middle_of_world) / M_PI * 360.0;
+ fovy = atan2(height/2, distance_to_middle_of_world) / M_PI * 360.0;
+ return '1 0 0' * fovx + '0 1 0' * fovy;
+}
+
// this function must match W_SetupShot!
float zoomscript_caught;
break;
}
+ vector traceorigin = getplayerorigin(player_localentnum-1) + (eZ * getstati(STAT_VIEWHEIGHT));
+
vecs = decompressShotOrigin(getstati(STAT_SHOTORG));
- traceline(view_origin, view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+ traceline(traceorigin, traceorigin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
trueaimpoint = trace_endpos;
- if(vlen(trueaimpoint - view_origin) < g_trueaim_minrange)
- trueaimpoint = view_origin + view_forward * g_trueaim_minrange;
+ if(vlen(trueaimpoint - traceorigin) < g_trueaim_minrange)
+ trueaimpoint = traceorigin + view_forward * g_trueaim_minrange;
if(vecs_x > 0)
vecs_y = -vecs_y;
vecs = '0 0 0';
dv = view_right * vecs_y + view_up * vecs_z;
- w_shotorg = view_origin + dv;
+ w_shotorg = traceorigin + dv;
// now move the vecs forward as much as requested if possible
tracebox(w_shotorg, mi, ma, w_shotorg + view_forward * (vecs_x + nudge), MOVE_NORMAL, ta); // FIXME this MOVE_NORMAL part will misbehave a little in csqc
// event chase camera
if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
{
- if((spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead)) || intermission)
+ if(((spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead)) || intermission) && !autocvar_cl_orthoview)
{
// make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
WarpZone_FixView();
//WarpZone_FixPMove();
+ vector ov_org = '0 0 0';
+ vector ov_mid = '0 0 0';
+ vector ov_worldmin = '0 0 0';
+ vector ov_worldmax = '0 0 0';
+ if(autocvar_cl_orthoview)
+ {
+ ov_worldmin = mi_picmin;
+ ov_worldmax = mi_picmax;
+
+ float ov_width = (ov_worldmax_x - ov_worldmin_x);
+ float ov_height = (ov_worldmax_y - ov_worldmin_y);
+ float ov_distance = (max(vid_width, vid_height) * max(ov_width, ov_height));
+
+ ov_mid = ((ov_worldmax + ov_worldmin) * 0.5);
+ ov_org = vec3(ov_mid_x, ov_mid_y, (ov_mid_z + ov_distance));
+
+ float ov_nearest = vlen(ov_org - vec3(
+ bound(ov_worldmin_x, ov_org_x, ov_worldmax_x),
+ bound(ov_worldmin_y, ov_org_y, ov_worldmax_y),
+ bound(ov_worldmin_z, ov_org_z, ov_worldmax_z)
+ ));
+
+ float ov_furthest = 0;
+ float dist = 0;
+
+ if((dist = vlen(vec3(ov_worldmin_x, ov_worldmin_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+ if((dist = vlen(vec3(ov_worldmax_x, ov_worldmin_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+ if((dist = vlen(vec3(ov_worldmin_x, ov_worldmax_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+ if((dist = vlen(vec3(ov_worldmin_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+ if((dist = vlen(vec3(ov_worldmax_x, ov_worldmax_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+ if((dist = vlen(vec3(ov_worldmin_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+ if((dist = vlen(vec3(ov_worldmax_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+ if((dist = vlen(vec3(ov_worldmax_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+
+ cvar_settemp("r_nearclip", ftos(ov_nearest));
+ cvar_settemp("r_farclip_base", ftos(ov_furthest));
+ cvar_settemp("r_farclip_world", "0");
+ cvar_settemp("r_novis", "1");
+ cvar_settemp("r_useportalculling", "0");
+ cvar_settemp("r_useinfinitefarclip", "0");
+
+ setproperty(VF_ORIGIN, ov_org);
+ setproperty(VF_ANGLES, '90 0 0');
+
+ #if 0
+ printf("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f\n",
+ vtos(ov_org),
+ vtos(getpropertyvec(VF_ANGLES)),
+ ov_distance,
+ ov_nearest,
+ ov_furthest);
+ #endif
+ }
+
// Render the Scene
view_origin = getpropertyvec(VF_ORIGIN);
view_angles = getpropertyvec(VF_ANGLES);
vid_conheight = autocvar_vid_conheight;
vid_pixelheight = autocvar_vid_pixelheight;
- setproperty(VF_FOV, GetCurrentFov(fov));
+ if(autocvar_cl_orthoview) { setproperty(VF_FOV, GetOrthoviewFOV(ov_worldmin, ov_worldmax, ov_mid, ov_org)); }
+ else { setproperty(VF_FOV, GetCurrentFov(fov)); }
// Camera for demo playback
if(camera_active)
}
}
- //print(sprintf("crosshair style: %s\n", wcross_style));
+ //printf("crosshair style: %s\n", wcross_style);
wcross_name = strcat("gfx/crosshair", wcross_style);
// MAIN CROSSHAIR COLOR DECISION
float autocvar_cl_hidewaypoints;
float autocvar_cl_lockview;
float autocvar_cl_nogibs;
+float autocvar_cl_orthoview;
+float autocvar_cl_orthoview_nofog;
float autocvar_cl_particlegibs;
float autocvar_cl_particles_oldnexbeam;
float autocvar_cl_particles_quality;
e.bgmscriptline = e.bgmscriptline0 = i;
if(i >= bgmscriptbufsize)
{
- print(sprintf("ERROR: bgmscript does not define %s\n", e.bgmscript));
+ printf("ERROR: bgmscript does not define %s\n", e.bgmscript);
strunzone(e.bgmscript);
e.bgmscript = string_null;
}
self.forceplayermodels_isgoodmodel = fexists(self.forceplayermodels_savemodel);
self.forceplayermodels_isgoodmodel_mdl = self.forceplayermodels_savemodel;
if(!self.forceplayermodels_isgoodmodel)
- print(sprintf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel));
+ printf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel);
}
}
void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
}
- //print(sprintf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod)));
+ //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod));
}
// FEATURE: fallback frames
case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
}
- print(sprintf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model));
+ printf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model);
return f;
}
void CSQCPlayer_FallbackFrame_Apply(void)
void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num)
{
- //print(sprintf("centerprint_generic(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num));
+ //printf("centerprint_generic(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num);
float i, j;
if(strMessage == "" && new_id == 0)
float a, sz, align, current_msg_pos_y = 0, msg_size;
vector pos;
string ts;
-
- n = -1; // if no msg will be displayed, n stays -1
+ float all_messages_expired = TRUE;
pos = panel_pos;
if (autocvar_hud_panel_centerprint_flip)
continue;
}
+ all_messages_expired = FALSE;
// 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 = bound(0, (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, autocvar_hud_panel_centerprint_fade_in), 1);
- else if(centerprint_expire_time[j] > time)
+ if(centerprint_time[j] < 0) // Expired but forced. Expire time is the fade-in time.
+ a = (time - centerprint_expire_time[j]) / max(0.0001, autocvar_hud_panel_centerprint_fade_in);
+ else if(centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time) // Regularily printed. Not fading out yet.
+ a = (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, autocvar_hud_panel_centerprint_fade_in);
+ else // Expiring soon, so fade it out.
a = (centerprint_expire_time[j] - time) / max(0.0001, autocvar_hud_panel_centerprint_fade_out);
- else
- a = 0;
+
+ if (a <= 0.5/255.0) // Guaranteed invisible - don't show.
+ continue;
+ if (a > 1)
+ a = 1;
// 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);
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
}
+ a *= panel_fg_alpha;
// 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));
{
if (align)
pos_x = panel_pos_x + (panel_size_x - stringwidth(ts, TRUE, fontsize)) * align;
- drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize_y, ts, fontsize, a * panel_fg_alpha, DRAWFLAG_NORMAL);
+ if (a > 0.5/255.0) // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
+ drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize_y, ts, fontsize, a, DRAWFLAG_NORMAL);
pos_y += fontsize_y;
}
else
}
}
drawfontscale = '1 1 0';
- if (n == -1)
+ if (all_messages_expired)
{
centerprint_showing = FALSE;
reset_centerprint_messages();
strunzone(panel.current_panel_bg); \
if(panel_bg == "")\
{\
- /*print(sprintf("^xf08 %s panel: panel_bg is empty\n", panel.panel_name));*/\
+ /*printf("^xf08 %s panel: panel_bg is empty\n", panel.panel_name);*/\
panel_bg = "0";\
}\
panel.current_panel_bg = strzone(panel_bg); \
panel_bg = panel.current_panel_bg; \
if(panel.current_panel_bg == "")\
{\
- /*print(sprintf("^xf08 %s panel: panel.current_panel_bg is empty\n", panel.panel_name));*/\
+ /*printf("^xf08 %s panel: panel.current_panel_bg is empty\n", panel.panel_name);*/\
panel_bg = "0";\
}\
panel_bg_alpha = panel.current_panel_bg_alpha; \
}
HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
- print(sprintf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename));
+ printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
fclose(fh);
}
else
- print(sprintf(_("^1Couldn't write to %s\n"), filename));
+ printf(_("^1Couldn't write to %s\n"), filename);
}
void HUD_Configure_Exit_Force()
return GETPLAYERORIGIN_ERROR;
}
+float getplayeralpha(float pl)
+{
+ entity e;
+
+ e = CSQCModel_server2csqc(pl + 1);
+ if(e)
+ return e.alpha;
+
+ return 1;
+}
+
float getplayerisdead(float pl)
{
entity e;
}
else
{
- print(sprintf("Received HTTP request data for an invalid id %d.\n", id));
+ printf("Received HTTP request data for an invalid id %d.\n", id);
}
}
if(!_Movetype_TestEntityPosition('0 0 -1' * i)) goto success;
if(!_Movetype_TestEntityPosition('0 0 1' * i)) goto success;
}
- dprint(sprintf(_("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin)));
+ dprintf(_("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin));
return FALSE;
:success
- dprint(sprintf(_("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin)));
+ dprintf(_("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin));
_Movetype_LinkEdict(TRUE);
return TRUE;
}
self.draw = Draw_Snow;
}
-entity zcurve;
-void zcurveparticles(float effectnum, vector start, vector end, float end_dz, float speed, float depth)
-{
- // end_dz:
- // IF IT WERE A STRAIGHT LINE, it'd end end_dz above end
-
- vector mid;
- mid = (start + end) * 0.5;
-
- end_dz *= 0.25;
- mid_z += end_dz;
-
- --depth;
- if(depth < 0 || normalize(mid - start) * normalize(end - start) > 0.999999)
- // TODO make this a variable threshold
- // currently: 0.081 degrees
- // 0.99999 would be 0.256 degrees and is visible
- {
- zcurve.velocity = speed * normalize(end - start);
- trailparticles(zcurve, effectnum, start, end);
- }
- else
- {
- zcurveparticles(effectnum, start, mid, end_dz, speed, depth);
- zcurveparticles(effectnum, mid, end, end_dz, speed, depth);
- }
-}
-
-void Net_ReadZCurveParticles()
-{
- vector start, end;
- float end_dz;
- float effectnum, speed;
-
- if(!zcurve)
- {
- zcurve = spawn();
- zcurve.classname = "zcurve";
- }
-
- effectnum = ReadShort();
-
- start_x = ReadCoord();
- start_y = ReadCoord();
- start_z = ReadCoord();
-
- do
- {
- end_x = ReadCoord();
- end_y = ReadCoord();
- end_z = ReadCoord();
- end_dz = ReadCoord();
- speed = ReadShort();
- zcurveparticles(effectnum, start, end, end_dz, 16 * (speed & 0x7FFF), 5); // at most 32 segments
- }
- while(!(speed & 0x8000));
-}
-
void Net_ReadNexgunBeamParticle()
{
vector shotorg, endpos;
/*
vector neworg = skel_get_boneabs(s, bone);
- print(sprintf("ANG: want: %v, got: %v\n", absang, fixedvectoangles2(v_forward, v_up)));
- print(sprintf("ORG: want: %v, got: %v\n", absorg, neworg));
+ printf("ANG: want: %v, got: %v\n", absang, fixedvectoangles2(v_forward, v_up));
+ printf("ORG: want: %v, got: %v\n", absorg, neworg);
*/
}
e.lerpfrac3 = 0;
e.lerpfrac4 = savelerpfrac4 * 2;
}
- //print(sprintf("Run: bone %d to %d, type %d\n", firstbone + 1, bone, bonetype));
- //print(sprintf("frame %d %d %d %d lerpfrac * %d %d %d\n", e.frame, e.frame2, e.frame3, e.frame4, e.lerpfrac, e.lerpfrac3, e.lerpfrac4));
+ //printf("Run: bone %d to %d, type %d\n", firstbone + 1, bone, bonetype);
+ //printf("frame %d %d %d %d lerpfrac * %d %d %d\n", e.frame, e.frame2, e.frame3, e.frame4, e.lerpfrac, e.lerpfrac3, e.lerpfrac4);
skel_build(s, e, m, 0, firstbone + 1, bone);
}
e.lerpfrac = savelerpfrac;
else
{
if (!nocomplain)
- print(sprintf("^1Error:^7 Unknown score field: '%s'\n", str));
+ printf("^1Error:^7 Unknown score field: '%s'\n", str);
continue;
}
:found
hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
hud_field[hud_num_fields] = ps_secondary;
++hud_num_fields;
- print(sprintf("fixed missing field '%s'\n", scores_label[ps_secondary]));
+ printf("fixed missing field '%s'\n", scores_label[ps_secondary]);
}
if(!have_primary)
{
hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
hud_field[hud_num_fields] = ps_primary;
++hud_num_fields;
- print(sprintf("fixed missing field '%s'\n", scores_label[ps_primary]));
+ printf("fixed missing field '%s'\n", scores_label[ps_primary]);
}
}
else if(time > ent.fadedelay) // fade in for enemies
ent.alpha = min(1, ent.alpha + SHOWNAMES_FADESPEED * frametime);
- if(!ent.alpha)
+ // multiply by player alpha
+ if(!ent.sameteam || (ent.sv_entnum == player_localentnum))
+ ent.alpha *= getplayeralpha(ent.sv_entnum-1);
+
+ if(ent.alpha < ALPHA_MIN_VISIBLE)
return;
float dist;
sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE);
if(getsoundtime(e, CH_BGM_SINGLE) < 0)
{
- print(sprintf(_("Cannot initialize sound %s\n"), e.noise));
+ printf(_("Cannot initialize sound %s\n"), e.noise);
strunzone(e.noise);
e.noise = string_null;
}
sound(self, CH_BGM_SINGLE, self.noise, 0, ATTEN_NONE);
if(getsoundtime(self, CH_BGM_SINGLE) < 0)
{
- print(sprintf(_("Cannot initialize sound %s\n"), self.noise));
+ printf(_("Cannot initialize sound %s\n"), self.noise);
strunzone(self.noise);
self.noise = string_null;
}
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));
+ printf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
}
txt = self.netname;
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));
+ printf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
}
if(time - floor(time) > 0.5)
do_cvar = curl_uri_get_cvar[i];
if(status != 0)
{
- print(sprintf(_("error: status is %d\n"), status));
+ printf(_("error: status is %d\n"), status);
if(do_cvar)
strunzone(do_cvar);
return;
if(fh >= 0)
{
Dump_Notifications(fh, alsoprint);
- print(sprintf("Dumping notifications... File located in ^2data/data/%s^7.\n", filename));
+ printf("Dumping notifications... File located in ^2data/data/%s^7.\n", filename);
fclose(fh);
}
else
{
- print(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+ printf("^1Error: ^7Could not open file '%s'!\n", filename);
}
#else
print(_("Notification dump command only works with cl_cmd and sv_cmd.\n"));
case CMD_REQUEST_COMMAND:
{
#ifndef MENUQC
- print(sprintf(
+ printf(
strcat(
"Restart_Notifications(): Restarting %d notifications... ",
"Counts: MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n"
NOTIF_CENTER_COUNT,
NOTIF_MULTI_COUNT,
NOTIF_CHOICE_COUNT
- ));
+ );
Destroy_All_Notifications();
CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
#else
const float TE_CSQC_PICTURE = 100;
const float TE_CSQC_RACE = 101;
-const float TE_CSQC_ZCURVEPARTICLES = 102;
const float TE_CSQC_NEXGUNBEAMPARTICLE = 103;
const float TE_CSQC_LIGHTNINGARC = 104;
const float TE_CSQC_TEAMNAGGER = 105;
v = explosion_calcpush(explosion_f * speedfactor, m, target_v, 1, 0);
// the factor we then get is:
// 1
- print(sprintf("MASS: %f\nv: %v -> %v\nENERGY BEFORE == %f + %f = %f\nENERGY AFTER >= %f\n",
+ printf("MASS: %f\nv: %v -> %v\nENERGY BEFORE == %f + %f = %f\nENERGY AFTER >= %f\n",
m,
target_v, target_v + v,
target_v * target_v, m * explosion_f * speedfactor * explosion_f * speedfactor, target_v * target_v + m * explosion_f * speedfactor * explosion_f * speedfactor,
- (target_v + v) * (target_v + v)));
+ (target_v + v) * (target_v + v));
return v;
#endif
return explosion_f * explosion_calcpush_getmultiplier(explosion_f * speedfactor, target_v);
// done to both MSG_INFO and MSG_CENTER
if(substring(input, (strlen(input) - 1), 1) == "\n")
{
- print(sprintf(
+ printf(
strcat(
"^1TRAILING NEW LINE AT END OF NOTIFICATION: ",
"^7net_type = %s, net_name = %s, string = %s.\n"
notiftype,
notifname,
stringtype
- ));
+ );
notif_error = TRUE;
input = substring(input, 1, (strlen(input) - 1));
}
{
if(sel_num == NOTIF_MAX_ARGS)
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
"^7net_type = %s, net_name = %s, max args = %d.\n"
notiftype,
notifname,
NOTIF_MAX_ARGS
- ));
+ );
notif_error = TRUE;
break;
}
#undef ARG_CASE_ARG_CS_SV_HA
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
"^7net_type = %s, net_name = %s, args arg = '%s'.\n"
notiftype,
notifname,
selected
- ));
+ );
notif_error = TRUE;
break;
}
{
if(sel_num == NOTIF_MAX_HUDARGS)
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
"^7net_type = %s, net_name = %s, max hudargs = %d.\n"
notiftype,
notifname,
NOTIF_MAX_HUDARGS
- ));
+ );
notif_error = TRUE;
break;
}
#undef ARG_CASE_ARG_CS_SV_HA
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
"^7net_type = %s, net_name = %s, hudargs arg = '%s'.\n"
notiftype,
notifname,
selected
- ));
+ );
notif_error = TRUE;
break;
}
{
if(sel_num == NOTIF_MAX_DURCNT)
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
"^7net_type = %s, net_name = %s, max durcnt = %d.\n"
notiftype,
notifname,
NOTIF_MAX_DURCNT
- ));
+ );
notif_error = TRUE;
break;
}
if(ftos(stof(selected)) != "") { ++sel_num; }
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
"^7net_type = %s, net_name = %s, durcnt arg = '%s'.\n"
notiftype,
notifname,
selected
- ));
+ );
notif_error = TRUE;
}
break;
}
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH NO SOUND: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
}
else if((hudargs == "") && (durcnt ==""))
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: ",
"^7net_type = %s, net_name = %s, strnum = %d, flnum = %d\n"
namestring,
strnum,
flnum
- ));
+ );
notif_error = TRUE;
}
}
if(icon != "") { notif.nent_icon = strzone(icon); }
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS HUDARGS BUT NO ICON: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
else if(icon != "")
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS ICON BUT NO HUDARGS: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS DURCNT BUT NO CPID: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
// Check to make sure a string was chosen
if(notif.nent_string == "")
{
- print(sprintf(
+ printf(
strcat(
"^1EMPTY NOTIFICATION: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
// Set MSG_MULTI string/float counts
if((anncename == NO_MSG) && (infoname == NO_MSG) && (centername == NO_MSG))
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH NO SUBCALLS: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
else
{
if((chtype == NO_MSG) || (optiona == NO_MSG) || (optionb == NO_MSG))
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION IS MISSING CHOICE PARAMS: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
else
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH IMPROPER TYPE: ",
"^7net_type = %d, net_name = %s.\n"
),
typeid,
namestring
- ));
+ );
notif_error = TRUE;
break;
}
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH IMPROPER TYPE: ",
"^7net_type = %d, net_name = %s.\n"
),
typeid,
namestring
- ));
+ );
notif_error = TRUE;
break;
}
void Local_Notification_HUD_Notify_Push(
string icon, string hudargs,
- string s1, string s2, string s3, string s4)
+ string s1, string s2, string s3, string s4,
+ float f1, float f2, float f3, float f4)
{
string selected;
float sel_num;
}
#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
- "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s);\n",
+ "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s, %s);\n",
icon,
hudargs,
MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
+ sprintf("%d, %d, %d, %d", f1, f2, f3, f4),
MakeConsoleSafe(sprintf("'%s^7', '%s^7'", stof(arg_slot[0]), stof(arg_slot[1])))
));
#endif
Local_Notification_HUD_Notify_Push(
notif.nent_icon,
notif.nent_hudargs,
- s1, s2, s3, s4);
+ s1, s2, s3, s4,
+ f1, f2, f3, f4);
}
#endif
break;
MSG_INFO_NOTIF(2, INFO_QUIT_KICK_IDLING, 1, 0, "s1", "", "", _("^BG%s^F3 was kicked for idling"), "") \
MSG_INFO_NOTIF(1, INFO_QUIT_KICK_SPECTATING, 0, 0, "", "", "", _("^F2You were kicked from the server because you are a spectator and spectators aren't allowed at the moment."), "") \
MSG_INFO_NOTIF(1, INFO_QUIT_SPECTATE, 1, 0, "s1", "", "", _("^BG%s^F3 is now spectating"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_ABANDONED, 1, 0, "s1", "", "", _("^BG%s^BG has abandoned the race"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_FAIL_RANKED, 1, 3, "s1 race_col f1ord race_col f3race_time race_diff", "s1", "race_newfail", _("^BG%s^BG couldn't break their %s%s^BG place record of %s%s %s"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_FAIL_UNRANKED, 1, 3, "s1 race_col f1ord race_col f3race_time race_diff", "s1", "race_newfail", _("^BG%s^BG couldn't break the %s%s^BG place record of %s%s %s"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_FINISHED, 1, 0, "s1", "", "", _("^BG%s^BG has finished the race"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_NEW_BROKEN, 2, 3, "s1 s2 race_col f1ord race_col f2race_time race_diff", "s1 s2", "race_newrankyellow", _("^BG%s^BG broke %s^BG's %s%s^BG place record with %s%s %s"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_NEW_IMPROVED, 1, 3, "s1 race_col f1ord race_col f2race_time race_diff", "s1", "race_newtime", _("^BG%s^BG improved their %s%s^BG place record with %s%s %s"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_NEW_MISSING_UID, 1, 1, "s1 f1race_time", "s1", "race_newfail", _("^BG%s^BG scored a new record with ^F2%s^BG, but unfortunately lacks a UID and will be lost."), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_NEW_SET, 1, 2, "s1 race_col f1ord race_col f2race_time", "s1", "race_newrecordserver", _("^BG%s^BG set the %s%s^BG place record with %s%s"), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_ABANDONED, 1, 0, "s1", "", "", _("^BG%s^BG has abandoned the race"), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_FAIL_RANKED, 1, 3, "s1 race_col f1ord race_col f3race_time race_diff", "s1 f3race_time", "race_newfail", _("^BG%s^BG couldn't break their %s%s^BG place record of %s%s %s"), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_FAIL_UNRANKED, 1, 3, "s1 race_col f1ord race_col f3race_time race_diff", "s1 f3race_time", "race_newfail", _("^BG%s^BG couldn't break the %s%s^BG place record of %s%s %s"), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_FINISHED, 1, 0, "s1", "", "", _("^BG%s^BG has finished the race"), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_NEW_BROKEN, 2, 3, "s1 s2 race_col f1ord race_col f2race_time race_diff", "s1 f2race_time", "race_newrankyellow", _("^BG%s^BG broke %s^BG's %s%s^BG place record with %s%s %s"), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_NEW_IMPROVED, 1, 3, "s1 race_col f1ord race_col f2race_time race_diff", "s1 f2race_time", "race_newtime", _("^BG%s^BG improved their %s%s^BG place record with %s%s %s"), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_NEW_MISSING_UID, 1, 1, "s1 f1race_time", "s1 f1race_time", "race_newfail", _("^BG%s^BG scored a new record with ^F2%s^BG, but unfortunately lacks a UID and will be lost."), "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_NEW_SET, 1, 2, "s1 race_col f1ord race_col f2race_time", "s1 f2race_time", "race_newrecordserver", _("^BG%s^BG set the %s%s^BG place record with %s%s"), "") \
MULTITEAM_INFO(1, INFO_SCORES_, 4, 0, 0, "", "", "", _("^TC^TT ^BGteam scores!"), "") \
MSG_INFO_NOTIF(1, INFO_SPECTATE_WARNING, 0, 1, "f1secs", "", "", _("^F2You have to become a player within the next %s, otherwise you will be kicked, because spectating isn't allowed at this time!"), "") \
MSG_INFO_NOTIF(1, INFO_SUPERWEAPON_PICKUP, 1, 0, "s1", "s1", "strength", _("^BG%s^K1 picked up a Superweapon"), "") \
ARG_CASE(ARG_CS, "f1secs", count_seconds(f1)) \
ARG_CASE(ARG_CS_SV, "f1ord", count_ordinal(f1)) \
ARG_CASE(ARG_CS, "f1time", process_time(2, f1)) \
- ARG_CASE(ARG_CS_SV, "f1race_time", mmssss(f1)) \
- ARG_CASE(ARG_CS_SV, "f2race_time", mmssss(f2)) \
- ARG_CASE(ARG_CS_SV, "f3race_time", mmssss(f3)) \
+ ARG_CASE(ARG_CS_SV_HA, "f1race_time", mmssss(f1)) \
+ ARG_CASE(ARG_CS_SV_HA, "f2race_time", mmssss(f2)) \
+ ARG_CASE(ARG_CS_SV_HA, "f3race_time", mmssss(f3)) \
ARG_CASE(ARG_CS_SV, "race_col", CCR(((f1 == 1) ? "^F1" : "^F2"))) \
ARG_CASE(ARG_CS_SV, "race_diff", ((f2 > f3) ? sprintf(CCR("^1[+%s]"), mmssss(f2 - f3)) : sprintf(CCR("^2[-%s]"), mmssss(f3 - f2)))) \
ARG_CASE(ARG_CS, "missing_teams", notif_arg_missing_teams(f1, f2, f3, f4)) \
#define dedi ""
#endif
- print(sprintf("Beginning notification initialization on %s%s program...\n", dedi, PROGNAME));
+ printf("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)
#endif
notif_global_error = TRUE;
- print(sprintf("^1NOTIFICATION VERSION MISMATCH: ^7program = %s, config = %d, code = %d.\n",
- PROGNAME, autocvar_notification_version, NOTIF_VERSION));
+ printf("^1NOTIFICATION VERSION MISMATCH: ^7program = %s, config = %d, code = %d.\n",
+ PROGNAME, autocvar_notification_version, NOTIF_VERSION);
}*/
}
void TEST_Fail(string cond)
{
- print(sprintf("Assertion failed: ", cond));
+ printf("Assertion failed: ", cond);
//backtrace();
++TEST_failed;
}
}
if(f)
{
- print(sprintf("%d tests failed\n", f));
+ printf("%d tests failed\n", f);
return 1;
}
else
{
- print(sprintf("All tests OK\n", f));
+ printf("All tests OK\n", f);
return 0;
}
}
float TEST_Run(string s)
{
- print(sprintf("%s: testing...\n", s));
+ printf("%s: testing...\n", s);
TEST_failed = TEST_ok = 0;
callfunction(strcat("_TEST_", s));
if(TEST_failed > 0)
{
- print(sprintf("%s: %d items failed.\n", s, TEST_failed));
+ printf("%s: %d items failed.\n", s, TEST_failed);
return 0;
}
else if(!TEST_ok)
{
- print(sprintf("%s: did not complete.\n", s));
+ printf("%s: did not complete.\n", s);
return 0;
}
return 1;
return 0;
if(e.url_rbuf >= 0 || e.url_wbuf >= 0)
{
- print(sprintf("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url));
+ printf("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url);
return 0;
}
if(!cvar_type(tmp_cvar))
{
- print(sprintf("Error: cvar %s doesn't exist!\n", tmp_cvar));
+ printf("Error: cvar %s doesn't exist!\n", tmp_cvar);
return 0;
}
++i;
}
else
- print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", e.netname));
+ printf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", e.netname);
}
return i;
++carets;
// check if carets aren't all escaped
- if (carets == 1 || mod(carets, 2) == 1) // first check is just an optimization
+ if (carets & 1)
{
if(i+1 <= len)
if(strstrofs("0123456789", substring(s, i+1, 1), 0) >= 0)
// expand multiple arguments into one argument by stripping parenthesis
#define XPD(...) __VA_ARGS__
+// Some common varargs functions. Lowercase as they match C.
+#define printf(...) print(sprintf(__VA_ARGS__))
+#define dprintf(...) dprint(sprintf(__VA_ARGS__))
+#define fprintf(file, ...) fputs(file, sprintf(__VA_ARGS__))
+#define bprintf(...) bprint(sprintf(__VA_ARGS__))
+
#ifndef MENUQC
void backtrace(string msg);
#endif
// commented out as this one did not help
if(onground_diff)
{
- print(sprintf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v));
+ printf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v);
return;
}
*/
if(vlen(o) > 32 || vlen(v) > 192)
{
- //print(sprintf("TOO BIG: x=%v v=%v\n", o, v));
+ //printf("TOO BIG: x=%v v=%v\n", o, v);
return;
}
me.realOrigin_x = me.keepspaceLeft;
if(!me.overrideCondenseFactor)
me.condenseFactor = spaceAvail / spaceUsed;
- dprint(sprintf(_("NOTE: label text %s too wide for label, condensed by factor %f\n"), t, me.condenseFactor));
+ dprintf(_("NOTE: label text %s too wide for label, condensed by factor %f\n"), t, me.condenseFactor);
}
if(!me.overrideRealOrigin_y)
check_unacceptable_compiler_bugs();
#ifdef WATERMARK
- print(sprintf(_("^4MQC Build information: ^1%s\n"), WATERMARK));
+ printf(_("^4MQC Build information: ^1%s\n"), WATERMARK);
#endif
// list all game dirs (TEST)
float XonoticColorpicker_mouseDrag(entity me, vector coords)
{
- float i;
+ float i, carets;
for(;;)
{
i = me.controlledTextbox.cursorPos;
if(i >= 2)
{
if(substring(me.controlledTextbox.text, i-2, 1) == "^")
- if(strstrofs("0123456789", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
- {
- me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
- me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
- continue;
- }
+ {
+ carets = 1;
+ while (i - 2 - carets >= 0 && substring(me.controlledTextbox.text, i - 2 - carets, 1) == "^")
+ ++carets;
+ if (carets & 1)
+ if(strstrofs("0123456789", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
+ {
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+ continue;
+ }
+ }
}
if(i >= 5)
{
if(substring(me.controlledTextbox.text, i-5, 2) == "^x")
- if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-3, 1), 0) >= 0)
- if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-2, 1), 0) >= 0)
- if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
- {
- me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
- me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
- me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
- me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
- me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
- continue;
- }
+ {
+ carets = 1;
+ while (i - 5 - carets >= 0 && substring(me.controlledTextbox.text, i - 5 - carets, 1) == "^")
+ ++carets;
+ if (carets & 1)
+ if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-3, 1), 0) >= 0)
+ if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-2, 1), 0) >= 0)
+ if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
+ {
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+ continue;
+ }
+ }
}
break;
}
+ if(substring(me.controlledTextbox.text, i-1, 1) == "^")
+ {
+ carets = 1;
+ while (i - 1 - carets >= 0 && substring(me.controlledTextbox.text, i - 1 - carets, 1) == "^")
+ ++carets;
+ if (carets & 1)
+ me.controlledTextbox.enterText(me.controlledTextbox, "^"); // escape previous caret
+ }
+
vector margin;
margin = me.imagemargin;
if(coords_x >= margin_x)
} \
else \
{ \
- print(sprintf( \
+ printf( \
"RegisterSLCategories(): Improper override '%s' for category '%s'!\n", \
s, \
categories[i].cat_name \
- )); \
+ ); \
} \
} \
strunzone(categories[i].override_string); \
case "cts":
case "xdf": { return CAT_DEFRAG; }
- default: { dprint(sprintf("Found strange mod type: %s\n", modtype)); return CAT_MODIFIED; }
+ default: { dprintf("Found strange mod type: %s\n", modtype); return CAT_MODIFIED; }
}
}
float m, pure, freeslots, j, sflags;
string s, typestr, versionstr, k, v, modname;
- //print(sprintf("time: %f, i: %d, item: %d, nitems: %d\n", time, i, item, me.nItems));
+ //printf("time: %f, i: %d, item: %d, nitems: %d\n", time, i, item, me.nItems);
vector oldscale = draw_scale;
vector oldshift = draw_shift;
float v = fromDecibelOfSquare(db, -40);
float dbv = toDecibelOfSquare(v, -40);
float d = dbv - db;
- print(sprintf("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d));
+ printf("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
TEST_Check(fabs(d) > 0.02);
}
TEST_OK();
n = tokenize_console(me.cvarNames_Multi);
for(i = 0; i < n; ++i)
- cvar_set(argv(i), s);
+ {
+ if(substring(argv(i), 0, 1) == "!")
+ cvar_set(substring(argv(i), 1, strlen(argv(i))), ((s == "0") ? "1" : "0"));
+ else
+ cvar_set(argv(i), s);
+ }
}
void makeMulti(entity e, string otherCvars)
{
}
else
{
- print(sprintf("Received HTTP request data for an invalid id %d.\n", id));
+ printf("Received HTTP request data for an invalid id %d.\n", id);
}
}
}
if(status != 0)
{
- print(sprintf(_("error receiving update notification: status is %d\n"), status));
+ printf(_("error receiving update notification: status is %d\n"), status);
return;
}
if(substring(data, 0, 1) == "<")
{
// update needed
_Nex_ExtResponseSystem_UpdateTo = strzone(un_version);
- if(un_download) { print(sprintf(_("Update can be downloaded at:\n%s\n"), un_download)); }
+ if(un_download) { printf(_("Update can be downloaded at:\n%s\n"), un_download); }
if(un_url) { _Nex_ExtResponseSystem_UpdateToURL = strzone(un_url); }
DisableServerBackwardsCompatibility();
}
float accuracy_byte(float n, float d)
{
- //print(sprintf("accuracy: %d / %d\n", n, d));
+ //printf("accuracy: %d / %d\n", n, d);
if(n <= 0)
return 0;
if(n > d)
float autocvar_g_balance_rifle_bursttime;
float autocvar_g_balance_rifle_primary_ammo;
float autocvar_g_balance_rifle_primary_animtime;
-float autocvar_g_balance_rifle_primary_bulletconstant;
float autocvar_g_balance_rifle_primary_bullethail;
float autocvar_g_balance_rifle_primary_burstcost;
float autocvar_g_balance_rifle_primary_damage;
float autocvar_g_balance_rifle_primary_force;
-float autocvar_g_balance_rifle_primary_lifetime;
float autocvar_g_balance_rifle_primary_refire;
float autocvar_g_balance_rifle_primary_shots;
-float autocvar_g_balance_rifle_primary_speed;
+float autocvar_g_balance_rifle_primary_solidpenetration;
float autocvar_g_balance_rifle_primary_spread;
float autocvar_g_balance_rifle_primary_tracer;
float autocvar_g_balance_rifle_secondary;
float autocvar_g_balance_rifle_secondary_ammo;
float autocvar_g_balance_rifle_secondary_animtime;
-float autocvar_g_balance_rifle_secondary_bulletconstant;
float autocvar_g_balance_rifle_secondary_bullethail;
float autocvar_g_balance_rifle_secondary_burstcost;
float autocvar_g_balance_rifle_secondary_damage;
float autocvar_g_balance_rifle_secondary_force;
-float autocvar_g_balance_rifle_secondary_lifetime;
float autocvar_g_balance_rifle_secondary_reload;
float autocvar_g_balance_rifle_secondary_refire;
float autocvar_g_balance_rifle_secondary_shots;
-float autocvar_g_balance_rifle_secondary_speed;
+float autocvar_g_balance_rifle_secondary_solidpenetration;
float autocvar_g_balance_rifle_secondary_spread;
float autocvar_g_balance_rifle_secondary_tracer;
float autocvar_g_balance_rifle_reload_ammo;
float autocvar_g_balance_health_rot;
float autocvar_g_balance_health_rotlinear;
float autocvar_g_balance_health_rotstable;
-float autocvar_g_balance_health_start;
float autocvar_g_balance_hlac_primary_ammo;
float autocvar_g_balance_hlac_primary_animtime;
float autocvar_g_balance_hlac_primary_damage;
float autocvar_g_balance_selfdamagepercent;
float autocvar_g_balance_shotgun_primary_ammo;
float autocvar_g_balance_shotgun_primary_animtime;
-float autocvar_g_balance_shotgun_primary_bulletconstant;
float autocvar_g_balance_shotgun_primary_bullets;
float autocvar_g_balance_shotgun_primary_damage;
float autocvar_g_balance_shotgun_primary_force;
float autocvar_g_balance_shotgun_primary_refire;
-float autocvar_g_balance_shotgun_primary_speed;
+float autocvar_g_balance_shotgun_primary_solidpenetration;
float autocvar_g_balance_shotgun_primary_spread;
float autocvar_g_balance_shotgun_secondary;
float autocvar_g_balance_shotgun_secondary_animtime;
float autocvar_g_balance_tuba_force;
float autocvar_g_balance_tuba_radius;
float autocvar_g_balance_tuba_refire;
-float autocvar_g_balance_uzi_bulletconstant;
float autocvar_g_balance_uzi_burst;
float autocvar_g_balance_uzi_burst_ammo;
float autocvar_g_balance_uzi_burst_animtime;
float autocvar_g_balance_uzi_first_refire;
float autocvar_g_balance_uzi_first_spread;
float autocvar_g_balance_uzi_mode;
-float autocvar_g_balance_uzi_speed;
+float autocvar_g_balance_uzi_solidpenetration;
float autocvar_g_balance_uzi_spread_add;
float autocvar_g_balance_uzi_spread_max;
float autocvar_g_balance_uzi_spread_min;
float autocvar_g_balance_uzi_reload_time;
float autocvar_g_ballistics_density_corpse;
float autocvar_g_ballistics_density_player;
-float autocvar_g_ballistics_materialconstant;
float autocvar_g_ballistics_mindistance;
float autocvar_g_ban_default_bantime;
float autocvar_g_ban_default_masksize;
float autocvar_g_ca_spectate_enemies;
float autocvar_g_ca_teams;
float autocvar_g_ca_teams_override;
+float autocvar_g_ca_team_spawns;
float autocvar_g_ca_warmup;
float autocvar_g_campaign;
#define autocvar_g_campaign_forceteam cvar("g_campaign_forceteam")
float autocvar_g_freezetag_round_timelimit;
float autocvar_g_freezetag_teams;
float autocvar_g_freezetag_teams_override;
+float autocvar_g_freezetag_team_spawns;
float autocvar_g_freezetag_warmup;
#define autocvar_g_friendlyfire cvar("g_friendlyfire")
#define autocvar_g_friendlyfire_virtual cvar("g_friendlyfire_virtual")
// if we get here, player is not allowed to cheat. Log it.
if(i)
- bprint(sprintf("Player %s^7 tried to use cheat 'impulse %d'\n", self.netname, i));
+ bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", self.netname, i);
else if(argc)
- bprint(sprintf("Player %s^7 tried to use cheat '%s'\n", self.netname, argv(0)));
+ bprintf("Player %s^7 tried to use cheat '%s'\n", self.netname, argv(0));
else if(fr)
- bprint(sprintf("Player %s^7 tried to use cheat frame %d\n", self.netname, fr));
+ bprintf("Player %s^7 tried to use cheat frame %d\n", self.netname, fr);
else
- bprint(sprintf("Player %s^7 tried to use an unknown cheat\n", self.netname));
+ bprintf("Player %s^7 tried to use an unknown cheat\n", self.netname);
return 0;
}
RemoveGrapplingHook(self); // Wazat's Grappling Hook
+ if(self.vehicle)
+ vehicles_exit(VHEF_RELESE);
+
self.classname = "player";
self.wasplayer = TRUE;
self.iscreature = TRUE;
/*
if(g_race)
- dprint(sprintf("%f %.6f\n", time, race_GetFractionalLapCount(self)));
+ dprintf("%f %.6f\n", time, race_GetFractionalLapCount(self));
*/
CSQCMODEL_AUTOUPDATE();
return;
self.impulse = 0;
- // forbid impulses when not in round time
+ // allow only weapon change impulses when not in round time
if(round_handler_IsActive() && !round_handler_IsRoundStarted())
+ if(imp == 17 || (imp >= 20 && imp < 200) || imp > 253)
return;
if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
if(self.vehicle)
if(self.vehicle.deadflag == DEAD_NO)
- if(self.vehicle.vehicles_impusle)
- if(self.vehicle.vehicles_impusle(imp))
+ if(self.vehicle.vehicles_impulse)
+ if(self.vehicle.vehicles_impulse(imp))
return;
if(CheatImpulse(imp))
// VorteX: add player model weapon select frame here
// setcustomframe(PlayerWeaponRaise);
weapon_thinkf(WFRAME_IDLE, cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)), w_ready);
- //print(sprintf("W_WeaponFrame(): cvar: %s, value: %f\n", sprintf("g_balance_%s_switchdelay_raise", newwep.netname), cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname))));
+ //printf("W_WeaponFrame(): cvar: %s, value: %f\n", sprintf("g_balance_%s_switchdelay_raise", newwep.netname), cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)));
weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');
}
else if (self.weaponentity.state == WS_DROP)
self.weaponentity.state = WS_DROP;
// set up weapon switch think in the future, and start drop anim
weapon_thinkf(WFRAME_DONTCHANGE, cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)), w_clear);
- //print(sprintf("W_WeaponFrame(): cvar: %s, value: %f\n", sprintf("g_balance_%s_switchdelay_drop", oldwep.netname), cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname))));
+ //printf("W_WeaponFrame(): cvar: %s, value: %f\n", sprintf("g_balance_%s_switchdelay_drop", oldwep.netname), cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)));
weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);
#ifndef INDEPENDENT_ATTACK_FINISHED
}
{
entity newwep = get_weaponinfo(self.owner.switchweapon);
f = f * g_weaponratefactor / max(f, cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)));
- //print(sprintf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_raise", newwep.netname), cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)), (self.owner.weapon_nextthink - time)));
+ //printf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_raise", newwep.netname), cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)), (self.owner.weapon_nextthink - time));
self.angles_x = -90 * f * f;
}
else if (self.state == WS_DROP && !intermission_running)
{
entity oldwep = get_weaponinfo(self.owner.weapon);
f = 1 - f * g_weaponratefactor / max(f, cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)));
- //print(sprintf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_drop", oldwep.netname), cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)), (self.owner.weapon_nextthink - time)));
+ //printf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_drop", oldwep.netname), cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)), (self.owner.weapon_nextthink - time));
self.angles_x = -90 * f * f;
}
else if (self.state == WS_CLEAR)
{
case CMD_REQUEST_COMMAND:
{
- print(sprintf("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1))));
+ printf("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
self.checkfail = 1;
return; // never fall through to usage
}
c = trace_endpos;
}
- n += tracebox_inverted(c, mi, ma, b, MOVE_WORLDONLY, world, FALSE);
+ n += tracebox_inverted(c, mi, ma, b, MOVE_WORLDONLY, world, FALSE, world);
white += vlen(trace_endpos - c);
c = trace_endpos;
first_command = argv(startpos);
- /*dprint(sprintf("VoteCommand_parse(): Command: '%s', Length: %f.\n",
+ /*printf("VoteCommand_parse(): Command: '%s', Length: %f.\n",
substring(vote_command, argv_start_index(startpos), strlen(vote_command) - argv_start_index(startpos)),
strlen(substring(vote_command, argv_start_index(startpos), strlen(vote_command) - argv_start_index(startpos)))
- ));*/
+ );*/
if(
(autocvar_sv_vote_limit > 0)
.string message2;
-vector railgun_start, railgun_end; // filled by FireRailgunBullet, used by damage code for head shot
.float stat_allow_oldnexbeam;
// reset to 0 on weapon switch
}
else
{
- dprint(sprintf(
+ dprintf(
"Obituary_WeaponDeath(): ^1Deathtype ^7(%d)^1 has no notification for weapon %d!\n",
deathtype,
death_weapon
- ));
+ );
}
return TRUE;
mininv_f = (vlen(force) * (1-tfloorforce)) / autocvar_g_throughfloor_force_max_stddev;
if(autocvar_g_throughfloor_debug)
- print(sprintf("THROUGHFLOOR: D=%f F=%f max(dD)=1/%f max(dF)=1/%f", finaldmg, vlen(force), mininv_d, mininv_f));
+ printf("THROUGHFLOOR: D=%f F=%f max(dD)=1/%f max(dF)=1/%f", finaldmg, vlen(force), mininv_d, mininv_f);
total = 0.25 * pow(max(mininv_f, mininv_d), 2);
if(autocvar_g_throughfloor_debug)
- print(sprintf(" steps=%f", total));
+ printf(" steps=%f", total);
if (IS_PLAYER(targ))
total = ceil(bound(autocvar_g_throughfloor_min_steps_player, total, autocvar_g_throughfloor_max_steps_player));
total = ceil(bound(autocvar_g_throughfloor_min_steps_other, total, autocvar_g_throughfloor_max_steps_other));
if(autocvar_g_throughfloor_debug)
- print(sprintf(" steps=%f dD=%f dF=%f", total, finaldmg * (1-tfloordmg) / (2 * sqrt(total)), vlen(force) * (1-tfloorforce) / (2 * sqrt(total))));
+ printf(" steps=%f dD=%f dF=%f", total, finaldmg * (1-tfloordmg) / (2 * sqrt(total)), vlen(force) * (1-tfloorforce) / (2 * sqrt(total)));
for(c = 0; c < total; ++c)
{
force = force * a;
if(autocvar_g_throughfloor_debug)
- print(sprintf(" D=%f F=%f\n", finaldmg, vlen(force)));
+ printf(" D=%f F=%f\n", finaldmg, vlen(force));
}
// laser force adjustments :P
tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, TRUE);
}
-float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity) // returns the number of traces done, for benchmarking
+float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity) // returns the number of traces done, for benchmarking
{
vector pos, dir, t;
float nudge;
for(;;)
{
- if((pos - v1) * dir >= (v2 - v1) * dir)
+ if(pos * dir >= v2 * dir)
{
// went too far
trace_fraction = 1;
pos = t + dir * nudge;
// but if we hit an entity, stop RIGHT before it
- if(stopatentity && stopentity)
+ if(stopatentity && stopentity && stopentity != ignorestopatentity)
{
trace_ent = stopentity;
trace_endpos = t;
}
}
-void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity)
+void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity)
{
- tracebox_inverted(v1, '0 0 0', '0 0 0', v2, nomonsters, forent, stopatentity);
+ tracebox_inverted(v1, '0 0 0', '0 0 0', v2, nomonsters, forent, stopatentity, ignorestopatentity);
}
/*
tet_piecemins_y = 1;
tet_piecemaxs_y = sz_y;
}
- //print(sprintf("ce%v sz%v mi%v ma%v\n", ce, sz, tet_piecemins, tet_piecemaxs));
+ //printf("ce%v sz%v mi%v ma%v\n", ce, sz, tet_piecemins, tet_piecemaxs);
if (rot == 1) // 90 degrees
{
t = tet_piecemins_y;
s = BastetSearch(buf, pc, x, y+1, rot, move_bias + 2); if(s > sm) sm = s;
if(s < 0)
{
- //print(sprintf("MAY CEMENT AT: %d %d %d\n", x, y, rot));
+ //printf("MAY CEMENT AT: %d %d %d\n", x, y, rot);
// moving down did not work - that means we can fixate the block here
t1 = gettime(GETTIME_HIRES);
b = buf_create(); bastet_piece[6] = 7; bastet_score[6] = BastetSearch(b, 7, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[6]; buf_del(b);
var float t2 = gettime(GETTIME_HIRES);
- dprint(sprintf("Time taken: %.6f seconds (of this, ev = %.2f%%, cm = %.2f%%)\n", t2 - t1, 100 * bastet_profile_evaluate_time / (t2 - t1), 100 * bastet_profile_checkmetrics_time / (t2 - t1)));
+ dprintf("Time taken: %.6f seconds (of this, ev = %.2f%%, cm = %.2f%%)\n", t2 - t1, 100 * bastet_profile_evaluate_time / (t2 - t1), 100 * bastet_profile_checkmetrics_time / (t2 - t1));
// sort
float i, j, k, p, s;
/*
for(i = 0; i < 7; ++i)
{
- print(sprintf("piece %s value = %d\n", substring("OJLIZST", bastet_piece[i]-1, 1), bastet_score[i]));
+ printf("piece %s value = %d\n", substring("OJLIZST", bastet_piece[i]-1, 1), bastet_score[i]);
}
*/
if(WinningConditionHelper_zeroisworst)
leadlimit = 0; // not supported in this mode
- if(g_dm || g_tdm || g_ca || (g_race && !g_race_qualifying) || g_nexball)
+ if(g_dm || g_tdm || g_ca || g_freezetag || (g_race && !g_race_qualifying) || g_nexball)
// these modes always score in increments of 1, thus this makes sense
{
if(leaderfrags != WinningConditionHelper_topscore)
if(trace_dphitcontents == 0)
{
//dprint("A hit happened with zero hit contents... DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct.\n");
- dprint(sprintf("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.origin)));
+ dprintf("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.origin));
checkclient();
}
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return FALSE;
}
-float zcurveparticles_effectno;
-vector zcurveparticles_start;
-float zcurveparticles_spd;
-
-void endzcurveparticles()
-{
- if(zcurveparticles_effectno)
- {
- // terminator
- WriteShort(MSG_BROADCAST, zcurveparticles_spd | 0x8000);
- }
- zcurveparticles_effectno = 0;
-}
-
-void zcurveparticles(float effectno, vector start, vector end, float end_dz, float spd)
-{
- spd = bound(0, floor(spd / 16), 32767);
- if(effectno != zcurveparticles_effectno || start != zcurveparticles_start)
- {
- endzcurveparticles();
- WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte(MSG_BROADCAST, TE_CSQC_ZCURVEPARTICLES);
- WriteShort(MSG_BROADCAST, effectno);
- WriteCoord(MSG_BROADCAST, start_x);
- WriteCoord(MSG_BROADCAST, start_y);
- WriteCoord(MSG_BROADCAST, start_z);
- zcurveparticles_effectno = effectno;
- zcurveparticles_start = start;
- }
- else
- WriteShort(MSG_BROADCAST, zcurveparticles_spd);
- WriteCoord(MSG_BROADCAST, end_x);
- WriteCoord(MSG_BROADCAST, end_y);
- WriteCoord(MSG_BROADCAST, end_z);
- WriteCoord(MSG_BROADCAST, end_dz);
- zcurveparticles_spd = spd;
-}
-
-void zcurveparticles_from_tracetoss(float effectno, vector start, vector end, vector vel)
-{
- float end_dz;
- vector vecxy, velxy;
-
- vecxy = end - start;
- vecxy_z = 0;
- velxy = vel;
- velxy_z = 0;
-
- if (vlen(velxy) < 0.000001 * fabs(vel_z))
- {
- endzcurveparticles();
- trailparticles(world, effectno, start, end);
- return;
- }
-
- end_dz = vlen(vecxy) / vlen(velxy) * vel_z - (end_z - start_z);
- zcurveparticles(effectno, start, end, end_dz, vlen(vel));
-}
-
void write_recordmarker(entity pl, float tstart, float dt)
{
GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));
// trigger new round
// reset objectives, toggle spawnpoints, reset triggers, ...
-void vehicles_clearrturn();
-void vehicles_spawn();
void assault_new_round()
{
- entity oldself;
- //bprint("ASSAULT: new round\n");
-
- oldself = self;
- // Eject players from vehicles
- FOR_EACH_PLAYER(self)
- {
- if(self.vehicle)
- vehicles_exit(VHEF_RELESE);
- }
-
- self = findchainflags(vehicle_flags, VHF_ISVEHICLE);
- while(self)
- {
- vehicles_clearrturn();
- vehicles_spawn();
- self = self.chain;
- }
-
- self = oldself;
-
// up round counter
self.winning = self.winning + 1;
if(!allowed_to_spawn)
{
self.classname = "observer";
+ if(self.jointime != time) //not when connecting
if(!self.caplayer)
{
self.caplayer = 0.5;
{
FOR_EACH_CLIENT(self)
{
+ self.killcount = 0;
if(self.caplayer)
{
self.classname = "player";
MUTATOR_HOOKFUNCTION(ca_GetTeamCount)
{
- ca_teams = autocvar_g_ca_teams_override;
- if(ca_teams < 2)
- ca_teams = autocvar_g_ca_teams;
- ca_teams = bound(2, ca_teams, 4);
ret_float = ca_teams;
- return 1;
+ return 0;
}
MUTATOR_HOOKFUNCTION(ca_PlayerDies)
MUTATOR_HOOKFUNCTION(ca_SetStartItems)
{
- start_health = cvar("g_lms_start_health");
- start_armorvalue = cvar("g_lms_start_armor");
-
- start_ammo_shells = cvar("g_lms_start_ammo_shells");
- start_ammo_nails = cvar("g_lms_start_ammo_nails");
- 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;
+ start_health = warmup_start_health = cvar("g_lms_start_health");
+ start_armorvalue = warmup_start_armorvalue = cvar("g_lms_start_armor");
+ start_ammo_shells = warmup_start_ammo_shells = cvar("g_lms_start_ammo_shells");
+ start_ammo_nails = warmup_start_ammo_nails = cvar("g_lms_start_ammo_nails");
+ start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+ start_ammo_cells = warmup_start_ammo_cells = cvar("g_lms_start_ammo_cells");
+ start_ammo_fuel = warmup_start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
return 0;
}
return FALSE;
}
-// scoreboard setup
-void ca_ScoreRules()
-{
- ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
- ScoreInfo_SetLabel_TeamScore (ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
- ScoreRules_basics_end();
-}
-
-void ca_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
-{
- ca_ScoreRules();
-}
-
void ca_Initialize()
{
allowed_to_spawn = TRUE;
+ ca_teams = autocvar_g_ca_teams_override;
+ if(ca_teams < 2)
+ ca_teams = autocvar_g_ca_teams;
+ ca_teams = bound(2, ca_teams, 4);
+ ret_float = ca_teams;
+ ScoreRules_ca(ca_teams);
+
round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
-
- InitializeEntity(world, ca_DelayedInit, INITPRIO_GAMETYPE);
}
MUTATOR_DEFINITION(gamemode_ca)
// should be removed in the future, as other code should not have to care
.float caplayer; // 0.5 if scheduled to join the next round
-
-#ifdef SVQC
-
-#define ST_CA_ROUNDS 1
-
-#endif
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER);
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER);
FOR_EACH_PLAYER(e)
+ {
e.freezetag_frozen_timeout = 0;
+ e.freezetag_revive_progress = 0;
+ }
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
return 1;
}
}
FOR_EACH_PLAYER(e)
+ {
e.freezetag_frozen_timeout = 0;
+ e.freezetag_revive_progress = 0;
+ }
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
return 1;
}
{
FOR_EACH_PLAYER(self)
{
+ self.killcount = 0;
if (self.freezetag_frozen)
freezetag_Unfreeze(world);
self.freezetag_frozen_timeout = -1;
if(n && self.freezetag_frozen) // OK, there is at least one teammate reviving us
{
self.freezetag_revive_progress = bound(0, self.freezetag_revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
- self.health = max(1, self.freezetag_revive_progress * autocvar_g_balance_health_start);
+ if(warmup_stage)
+ self.health = max(1, self.freezetag_revive_progress * warmup_start_health);
+ else
+ self.health = max(1, self.freezetag_revive_progress * start_health);
if(self.freezetag_revive_progress >= 1)
{
else if(!n && self.freezetag_frozen) // only if no teammate is nearby will we reset
{
self.freezetag_revive_progress = bound(0, self.freezetag_revive_progress - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
- self.health = max(1, self.freezetag_revive_progress * autocvar_g_balance_health_start);
+ if(warmup_stage)
+ self.health = max(1, self.freezetag_revive_progress * warmup_start_health);
+ else
+ self.health = max(1, self.freezetag_revive_progress * start_health);
}
else if(!n)
{
MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount)
{
- freezetag_teams = autocvar_g_freezetag_teams_override;
- if(freezetag_teams < 2)
- freezetag_teams = autocvar_g_freezetag_teams;
- freezetag_teams = bound(2, freezetag_teams, 4);
ret_float = freezetag_teams;
return 0;
}
void freezetag_Initialize()
{
precache_model("models/ice/ice.md3");
- ScoreRules_freezetag();
+
+ freezetag_teams = autocvar_g_freezetag_teams_override;
+ if(freezetag_teams < 2)
+ freezetag_teams = autocvar_g_freezetag_teams;
+ freezetag_teams = bound(2, freezetag_teams, 4);
+ ScoreRules_freezetag(freezetag_teams);
round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
MUTATOR_HOOKFUNCTION(lms_SetStartItems)
{
start_items &= ~IT_UNLIMITED_AMMO;
- start_ammo_shells = cvar("g_lms_start_ammo_shells");
- start_ammo_nails = cvar("g_lms_start_ammo_nails");
- 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_health = cvar("g_lms_start_health");
- start_armorvalue = cvar("g_lms_start_armor");
+ start_health = warmup_start_health = cvar("g_lms_start_health");
+ start_armorvalue = warmup_start_armorvalue = cvar("g_lms_start_armor");
+ start_ammo_shells = warmup_start_ammo_shells = cvar("g_lms_start_ammo_shells");
+ start_ammo_nails = warmup_start_ammo_nails = cvar("g_lms_start_ammo_nails");
+ start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+ start_ammo_cells = warmup_start_ammo_cells = cvar("g_lms_start_ammo_cells");
+ start_ammo_fuel = warmup_start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
return FALSE;
}
ScoreRules_basics_end();
}
-// FreezeTag stuff
#define SP_FREEZETAG_REVIVALS 4
-void ScoreRules_freezetag()
+void ScoreRules_freezetag(float teams)
{
- CheckAllowedTeams(world);
- ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY
+ ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY
ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS, "revivals", 0);
ScoreRules_basics_end();
}
+
+#define ST_CA_ROUNDS 1
+void ScoreRules_ca(float teams)
+{
+ ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+ ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
+ ScoreRules_basics_end();
+}
fraglimit_override = autocvar_g_ca_point_limit;
leadlimit_override = autocvar_g_ca_point_leadlimit;
MUTATOR_ADD(gamemode_ca);
+ if(autocvar_g_ca_team_spawns)
+ have_team_spawns = -1; // request team spawns
}
if(g_keyhunt)
fraglimit_override = autocvar_g_freezetag_point_limit;
leadlimit_override = autocvar_g_freezetag_point_leadlimit;
MUTATOR_ADD(gamemode_freezetag);
+ if(autocvar_g_freezetag_team_spawns)
+ have_team_spawns = -1; // request team spawns
}
if(g_assault)
//.float bulletcounter;
void turret_machinegun_attack()
{
- fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, self.shot_speed, 5, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0, autocvar_g_balance_uzi_bulletconstant);
- endFireBallisticBullet();
+ fireBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0);
UziFlash();
setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
void walker_attack()
{
sound (self, CH_WEAPON_A, "weapons/uzi_fire.wav", VOL_BASE, ATTEN_NORM);
- fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, self.shot_speed, 5, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0, autocvar_g_balance_uzi_bulletconstant);
- endFireBallisticBullet();
+ fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0);
pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
}
void bumb_impact()
{
- if(autocvar_g_vehicle_bumblebee_bouncepain_x)
- vehilces_impact(autocvar_g_vehicle_bumblebee_bouncepain_x,
- autocvar_g_vehicle_bumblebee_bouncepain_y,
- autocvar_g_vehicle_bumblebee_bouncepain_z);
+ if(autocvar_g_vehicle_bumblebee_bouncepain_x)
+ vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
}
void bumb_spawn(float _f)
vector autocvar_g_vehicle_racer_bouncepain;
var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
-void racer_spawn_default();
void racer_align4point(float _delta)
{
void racer_impact()
{
- if(autocvar_g_vehicle_racer_bouncepain_x)
- vehilces_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+ if(autocvar_g_vehicle_racer_bouncepain_x)
+ vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
}
void racer_blowup()
autocvar_g_vehicle_racer_blowup_forceintensity,
DEATH_VH_WAKI_DEATH, world);
- self.nextthink = time + autocvar_g_vehicle_racer_respawntime;
- self.think = racer_spawn_default;
+ self.alpha = -1;
self.movetype = MOVETYPE_NONE;
self.effects = EF_NODRAW;
-
self.colormod = '0 0 0';
self.avelocity = '0 0 0';
self.velocity = '0 0 0';
setorigin(self, self.pos1);
+ self.touch = func_null;
+ self.nextthink = 0;
}
void racer_deadtouch()
self.damageforcescale = 0.5;
//self.destvec = autocvar_g_vehicle_racer_bouncepain;
}
-void racer_spawn_default()
-{
- racer_spawn(0);
-}
-
-
void spawnfunc_vehicle_racer()
{
float autocvar_g_vehicle_raptor_shield_regen;
float autocvar_g_vehicle_raptor_shield_regen_pause;
+float autocvar_g_vehicle_raptor_blowup_radius;
+float autocvar_g_vehicle_raptor_blowup_coredamage;
+float autocvar_g_vehicle_raptor_blowup_edgedamage;
+float autocvar_g_vehicle_raptor_blowup_forceintensity;
+
float autocvar_g_vehicle_raptor_bouncefactor;
float autocvar_g_vehicle_raptor_bouncestop;
vector autocvar_g_vehicle_raptor_bouncepain;
{
self.deadflag = DEAD_DEAD;
self.vehicle_exit(VHEF_NORMAL);
- RadiusDamage (self, self.enemy, 250, 15, 250, world, 250, DEATH_VH_RAPT_DEATH, world);
+ RadiusDamage(self, self.enemy, autocvar_g_vehicle_raptor_blowup_coredamage,
+ autocvar_g_vehicle_raptor_blowup_edgedamage,
+ autocvar_g_vehicle_raptor_blowup_radius, world,
+ autocvar_g_vehicle_raptor_blowup_forceintensity, DEATH_VH_RAPT_DEATH, world);
self.alpha = -1;
self.movetype = MOVETYPE_NONE;
void raptor_impact()
{
- if(autocvar_g_vehicle_raptor_bouncepain_x)
- vehilces_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+ if(autocvar_g_vehicle_raptor_bouncepain_x)
+ vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
}
// If we dont do this ever now and then, the raptors rotors
//FIXME: Camera is in a bad place in HUD model.
//setorigin(self.vehicle_viewport, '25 0 5');
- self.vehicles_impusle = raptor_impulse;
+ self.vehicles_impulse = raptor_impulse;
self.frame = 0;
float autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
float autocvar_g_vehicle_spiderbot_minigun_force;
-float autocvar_g_vehicle_spiderbot_minigun_speed;
-float autocvar_g_vehicle_spiderbot_minigun_bulletconstant;
+float autocvar_g_vehicle_spiderbot_minigun_solidpenetration;
float autocvar_g_vehicle_spiderbot_rocket_damage;
float autocvar_g_vehicle_spiderbot_rocket_force;
float autocvar_g_vehicle_spiderbot_rocket_turnrate;
float autocvar_g_vehicle_spiderbot_rocket_lifetime;
+float autocvar_g_vehicle_spiderbot_blowup_radius;
+float autocvar_g_vehicle_spiderbot_blowup_coredamage;
+float autocvar_g_vehicle_spiderbot_blowup_edgedamage;
+float autocvar_g_vehicle_spiderbot_blowup_forceintensity;
+
vector autocvar_g_vehicle_spiderbot_bouncepain;
v_forward = normalize(v_forward);
v += v_forward * 50;
-//void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float bulletconstant)
-
- fireBallisticBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_speed,
- 5, autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0, autocvar_g_vehicle_spiderbot_minigun_bulletconstant);
-
- endFireBallisticBullet();
+ fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+ autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0);
// fireBullet (v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_damage,
// autocvar_g_vehicle_spiderbot_minigun_spread, DEATH_VH_SPID_MINIGUN, 0);
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);
+ if(autocvar_g_vehicle_spiderbot_bouncepain_x)
+ vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
}
void spiderbot_headfade()
SUB_SetFade(g1, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
SUB_SetFade(g2, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
- RadiusDamage (self, self.enemy, 250, 15, 250, world, 250, DEATH_VH_SPID_DEATH, world);
+ RadiusDamage(self, self.enemy, autocvar_g_vehicle_spiderbot_blowup_coredamage,
+ autocvar_g_vehicle_spiderbot_blowup_edgedamage,
+ autocvar_g_vehicle_spiderbot_blowup_radius, world,
+ autocvar_g_vehicle_spiderbot_blowup_forceintensity, DEATH_VH_SPID_DEATH, world);
self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
self.movetype = MOVETYPE_NONE;
self.deadflag = DEAD_DEAD;
self.solid = SOLID_NOT;
self.tur_head.effects &= ~EF_FLAME;
- self.vehicle_hudmodel.viewmodelforclient = self;
+ self.vehicle_hudmodel.viewmodelforclient = self;
+ setorigin(self, self.pos1);
}
void spiderbot_die()
{
if(!self.gun1)
{
- self.vehicles_impusle = spiderbot_impulse;
+ self.vehicles_impulse = spiderbot_impulse;
self.gun1 = spawn();
self.gun2 = spawn();
setmodel(self.gun1, "models/vehicles/spiderbot_barrels.dpm");
void vehicles_enter();
void vehicles_touch();
void vehicles_reset_colors();
-void vehicles_clearrturn();
+void vehicles_clearreturn();
void vehicles_setreturn();
}
// End generic vehile projectile system
+void vehicles_reset()
+{
+ if(self.owner)
+ {
+ entity oldself = self;
+ self = self.owner;
+ vehicles_exit(VHEF_RELESE);
+ self = oldself;
+ }
+ self.alpha = -1;
+ self.movetype = MOVETYPE_NONE;
+ self.effects = EF_NODRAW;
+ self.colormod = '0 0 0';
+ self.avelocity = '0 0 0';
+ self.velocity = '0 0 0';
+ self.event_damage = func_null;
+ self.solid = SOLID_NOT;
+ self.deadflag = DEAD_NO;
+
+ self.touch = func_null;
+ self.nextthink = 0;
+ vehicles_setreturn();
+}
+
/** vehicles_spawn
Exetuted for all vehicles on (re)spawn.
Sets defaults for newly spawned units.
self.owner = world;
self.touch = vehicles_touch;
self.event_damage = vehicles_damage;
+ self.reset = vehicles_reset;
self.iscreature = TRUE;
self.teleportable = FALSE; // no teleporting for vehicles, too buggy
self.damagedbycontents = TRUE;
return FALSE;
}
-void vehilces_impact(float _minspeed, float _speedfac, float _maxpain)
+void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
{
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return;
}
}
- vehicles_clearrturn();
+ vehicles_clearreturn();
CSQCVehicleSetup(self.owner, self.hud);
}
}
-void vehicles_clearrturn()
+void vehicles_clearreturn()
{
entity ret;
// Remove "return helper", if any.
{
entity ret;
- vehicles_clearrturn();
+ vehicles_clearreturn();
ret = spawn();
ret.classname = "vehicle_return";
ret.team = self.team;
ret.think = vehicles_showwp;
- if(self.deadflag != DEAD_NO)
- {
- ret.cnt = time + self.vehicle_respawntime;
- ret.nextthink = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 5);
- }
- else
- {
- ret.nextthink = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);
- }
+ if(self.deadflag != DEAD_NO)
+ {
+ ret.cnt = max(game_starttime, time) + self.vehicle_respawntime;
+ ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 5);
+ }
+ else
+ ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 1);
setmodel(ret, "null");
setorigin(ret, self.pos1 + '0 0 96');
-
}
void vehicles_reset_colors()
self.event_damage = func_null;
self.touch = vehicles_touch;
self.think = vehicles_spawn;
- self.nextthink = time;
- self.vehicle_respawntime = _respawntime;
self.vehicle_spawn = spawnproc;
+ self.vehicle_respawntime = max(0, _respawntime);
self.effects = EF_NODRAW;
self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
- if(!autocvar_g_vehicles_delayspawn)
- self.nextthink = time + game_starttime;
- else
- self.nextthink = time + _respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
+ if(!autocvar_g_vehicles_delayspawn || !self.vehicle_respawntime)
+ self.nextthink = time;
+ else
+ self.nextthink = max(time, game_starttime) + max(0, self.vehicle_respawntime + ((random() * 2 - 1) * autocvar_g_vehicles_delayspawn_jitter));
if(autocvar_g_playerclip_collisions)
self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
#define VHSF_NORMAL 0
#define VHSF_FACTORY 2
.void(float _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
-.float(float _imp) vehicles_impusle;
+.float(float _imp) vehicles_impulse;
.float vehicle_weapon2mode = volly_counter;
-//§ .void() vehicle_factory()
-
#ifdef VEHICLES_USE_ODE
void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force
pseudoprojectile = world;
- railgun_start = start;
- railgun_end = end;
-
dir = normalize(end - start);
length = vlen(end - start);
force = dir * bforce;
trace_dphitq3surfaceflags = endq3surfaceflags;
}
-.float dmg_force;
-.float dmg_radius;
-.float dmg_total;
-//.float last_yoda;
-void W_BallisticBullet_Hit (void)
-{
- float f, q, g;
-
- f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
- q = 1 + self.dmg_edge / self.dmg;
-
- if(other.solid == SOLID_BSP || other.solid == SOLID_SLIDEBOX)
- Damage_DamageInfo(self.origin, self.dmg * f, 0, 0, max(1, self.dmg_force) * normalize(self.velocity) * f, self.projectiledeathtype, other.species, self);
-
- if(other && other != self.enemy)
- {
- endzcurveparticles();
-
- yoda = 0;
- railgun_start = self.origin - 2 * frametime * self.velocity;
- railgun_end = self.origin + 2 * frametime * self.velocity;
- g = accuracy_isgooddamage(self.realowner, other);
- Damage(other, self, self.realowner, self.dmg * f, self.projectiledeathtype, self.origin, self.dmg_force * normalize(self.velocity) * f);
-
- /*if(yoda && (time > (self.last_yoda + 5)))
- {
- Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
- self.last_yoda = time;
- }*/
-
- // calculate hits for ballistic weapons
- if(g)
- {
- // do not exceed 100%
- q = min(self.dmg * q, self.dmg_total + f * self.dmg) - self.dmg_total;
- self.dmg_total += f * self.dmg;
- accuracy_add(self.realowner, self.realowner.weapon, 0, q);
- }
- }
-
- self.enemy = other; // don't hit the same player twice with the same bullet
-}
-
-.void(void) W_BallisticBullet_LeaveSolid_think_save;
-.float W_BallisticBullet_LeaveSolid_nextthink_save;
-.vector W_BallisticBullet_LeaveSolid_origin;
-.vector W_BallisticBullet_LeaveSolid_velocity;
-
-void W_BallisticBullet_LeaveSolid_think()
+float fireBullet_trace_callback_eff;
+entity fireBullet_last_hit;
+void fireBullet_trace_callback(vector start, vector hit, vector end)
{
- setorigin(self, self.W_BallisticBullet_LeaveSolid_origin);
- self.velocity = self.W_BallisticBullet_LeaveSolid_velocity;
-
- self.think = self.W_BallisticBullet_LeaveSolid_think_save;
- self.nextthink = max(time, self.W_BallisticBullet_LeaveSolid_nextthink_save);
- self.W_BallisticBullet_LeaveSolid_think_save = func_null;
-
- self.flags &= ~FL_ONGROUND;
-
- if(self.enemy.solid == SOLID_BSP)
- {
- float f;
- f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
- Damage_DamageInfo(self.origin, 0, 0, 0, max(1, self.dmg_force) * normalize(self.velocity) * -f, self.projectiledeathtype, 0, self);
- }
-
- UpdateCSQCProjectile(self);
-}
-
-float W_BallisticBullet_LeaveSolid(float eff)
-{
- // move the entity along its velocity until it's out of solid, then let it resume
- vector vel = self.velocity;
- float dt, dst, velfactor, v0, vs;
- float maxdist;
- float E0_m, Es_m;
- float constant = self.dmg_radius * (other.ballistics_density ? other.ballistics_density : 1);
-
- // outside the world? forget it
- 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:
-
- if(self.dmg_radius == 0)
- {
- if(other.ballistics_density < 0)
- constant = 0; // infinite travel distance
- else
- return 0; // no penetration
- }
- else
- {
- if(other.ballistics_density < 0)
- constant = 0; // infinite travel distance
- else if(other.ballistics_density == 0)
- constant = self.dmg_radius;
- else
- constant = self.dmg_radius * other.ballistics_density;
- }
-
- // E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
- v0 = vlen(vel);
-
- E0_m = 0.5 * v0 * v0;
-
- if(constant)
- {
- maxdist = E0_m / constant;
- // maxdist = 0.5 * v0 * v0 / constant
- // dprint("max dist = ", ftos(maxdist), "\n");
-
- if(maxdist <= autocvar_g_ballistics_mindistance)
- return 0;
- }
- else
- {
- maxdist = vlen(other.maxs - other.mins) + 1; // any distance, as long as we leave the entity
- }
-
- traceline_inverted (self.origin, self.origin + normalize(vel) * maxdist, MOVE_NORMAL, self, TRUE);
- if(trace_fraction == 1) // 1: we never got out of solid
- return 0;
-
- self.W_BallisticBullet_LeaveSolid_origin = trace_endpos;
-
- dst = max(autocvar_g_ballistics_mindistance, vlen(trace_endpos - self.origin));
- // E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
- Es_m = E0_m - constant * dst;
- if(Es_m <= 0)
- {
- // roundoff errors got us
- return 0;
- }
- vs = sqrt(2 * Es_m);
- velfactor = vs / v0;
-
- dt = dst / (0.5 * (v0 + vs));
- // this is not correct, but the differential equations have no analytic
- // solution - and these times are very small anyway
- //print("dt = ", ftos(dt), "\n");
-
- self.W_BallisticBullet_LeaveSolid_think_save = self.think;
- self.W_BallisticBullet_LeaveSolid_nextthink_save = self.nextthink;
- self.think = W_BallisticBullet_LeaveSolid_think;
- self.nextthink = time + dt;
-
- vel = vel * velfactor;
-
- self.velocity = '0 0 0';
- self.flags |= FL_ONGROUND; // prevent moving
- self.W_BallisticBullet_LeaveSolid_velocity = vel;
-
- if(eff >= 0)
- if(vlen(trace_endpos - self.origin) > 4)
- {
- endzcurveparticles();
- trailparticles(self, eff, self.origin, trace_endpos);
- }
-
- return 1;
-}
-
-void W_BallisticBullet_Touch (void)
-{
- //float density;
-
- if(self.think == W_BallisticBullet_LeaveSolid_think) // skip this!
- return;
-
- PROJECTILE_TOUCH;
- W_BallisticBullet_Hit ();
-
- if(self.dmg_radius < 0) // these NEVER penetrate solid
- {
- remove(self);
- return;
- }
-
- // if we hit "weapclip", bail out
- //
- // rationale of this check:
- //
- // any shader that is solid, nodraw AND trans is meant to clip weapon
- // shots and players, but has no other effect!
- //
- // if it is not trans, it is caulk and should not have this side effect
- //
- // matching shaders:
- // common/weapclip (intended)
- // common/noimpact (is supposed to eat projectiles, but is erased farther above)
- if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
- if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
- if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
- {
- remove(self);
- return;
- }
-
- // go through solid!
- if(!W_BallisticBullet_LeaveSolid(-1))
- {
- remove(self);
- return;
- }
-
- self.projectiledeathtype |= HITTYPE_BOUNCE;
-}
-
-void endFireBallisticBullet()
-{
- endzcurveparticles();
-}
-
-entity fireBallisticBullet_trace_callback_ent;
-float fireBallisticBullet_trace_callback_eff;
-void fireBallisticBullet_trace_callback(vector start, vector hit, vector end)
-{
- if(vlen(trace_endpos - fireBallisticBullet_trace_callback_ent.origin) > 16)
- zcurveparticles_from_tracetoss(fireBallisticBullet_trace_callback_eff, fireBallisticBullet_trace_callback_ent.origin, trace_endpos, fireBallisticBullet_trace_callback_ent.velocity);
+ if(vlen(hit - start) > 16)
+ trailparticles(world, fireBullet_trace_callback_eff, start, hit);
WarpZone_trace_forent = world;
- self.owner = world;
+ fireBullet_last_hit = world;
}
-void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float bulletconstant)
+void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, float tracereffects)
{
- float lag, dt, savetime; //, density;
- entity pl, oldself;
-
- entity proj;
- proj = spawn();
- proj.classname = "bullet";
- proj.owner = proj.realowner = self;
- PROJECTILE_MAKETRIGGER(proj);
- proj.movetype = MOVETYPE_FLY;
- proj.think = SUB_Remove;
- proj.nextthink = time + lifetime; // min(pLifetime, vlen(world.maxs - world.mins) / pSpeed);
- W_SetupProjectileVelocityEx(proj, dir, v_up, pSpeed, 0, 0, spread, TRUE);
- proj.angles = vectoangles(proj.velocity);
- if(bulletconstant > 0)
- proj.dmg_radius = autocvar_g_ballistics_materialconstant / bulletconstant;
- else if(bulletconstant == 0)
- proj.dmg_radius = 0;
- else
- proj.dmg_radius = -1;
- // so: bulletconstant = bullet mass / area of bullet circle
- setorigin(proj, start);
- proj.flags = FL_PROJECTILE;
-
- proj.touch = W_BallisticBullet_Touch;
- proj.dmg = damage;
- proj.dmg_force = force;
- proj.projectiledeathtype = dtype;
-
- proj.oldvelocity = proj.velocity;
+ // TODO antilag takeback
+ vector end;
- other = proj; MUTATOR_CALLHOOK(EditProjectile);
+ dir = normalize(dir + randomvec() * spread);
+ end = start + dir * MAX_SHOT_DISTANCE;
- float eff;
+ entity pl;
+ fireBullet_last_hit = world;
+ float solid_penetration_left = 1;
+ float total_damage = 0;
if(tracereffects & EF_RED)
- eff = particleeffectnum("tr_rifle");
+ fireBullet_trace_callback_eff = particleeffectnum("tr_rifle");
else if(tracereffects & EF_BLUE)
- eff = particleeffectnum("tr_rifle_weak");
+ fireBullet_trace_callback_eff = particleeffectnum("tr_rifle_weak");
else
- eff = particleeffectnum("tr_bullet");
+ fireBullet_trace_callback_eff = particleeffectnum("tr_bullet");
- // NOTE: this may severely throw off weapon balance
- lag = ANTILAG_LATENCY(self);
+ float lag = ANTILAG_LATENCY(self);
if(lag < 0.001)
lag = 0;
if (!IS_REAL_CLIENT(self))
lag = 0;
if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
lag = 0; // only do hitscan, but no antilag
-
if(lag)
FOR_EACH_PLAYER(pl)
if(pl != self)
antilag_takeback(pl, time - lag);
- oldself = self;
- self = proj;
-
- savetime = frametime;
- frametime = 0.05;
+ WarpZone_trace_forent = self;
- for(;;)
+ for (;;)
{
- // DP tracetoss is stupid and always traces in 0.05s
- // ticks. This makes it trace in 0.05*0.125s ticks
- // instead.
- vector v0;
- v0 = self.velocity;
- self.velocity = self.velocity * 0.125;
- trace_fraction = 0;
- fireBallisticBullet_trace_callback_ent = self;
- fireBallisticBullet_trace_callback_eff = eff;
- WarpZone_TraceToss_ThroughZone(self, self.owner, world, fireBallisticBullet_trace_callback);
- self.velocity = v0;
-
- if(trace_fraction == 1)
+ // TODO also show effect while tracing
+ WarpZone_TraceBox_ThroughZone(start, '0 0 0', '0 0 0', end, FALSE, WarpZone_trace_forent, world, fireBullet_trace_callback);
+ dir = WarpZone_TransformVelocity(WarpZone_trace_transform, dir);
+ end = WarpZone_TransformOrigin(WarpZone_trace_transform, end);
+ start = trace_endpos;
+ entity hit = trace_ent;
+
+ // When hitting sky, stop.
+ if (pointcontents(start) == CONTENT_SKY)
break;
- // won't hit anything anytime soon (DP's
- // tracetoss does 200 tics of, here,
- // 0.05*0.125s, that is, 1.25 seconds
-
- other = trace_ent;
- dt = WarpZone_tracetoss_time * 0.125; // this is only approximate!
- setorigin(self, trace_endpos);
- self.velocity = WarpZone_tracetoss_velocity * (1 / 0.125);
-
- if(!SUB_OwnerCheck())
- {
- if(SUB_NoImpactCheck())
- break;
-
- // hit the player
- W_BallisticBullet_Hit();
- }
- if(proj.dmg_radius < 0) // these NEVER penetrate solid
+ if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
break;
// if we hit "weapclip", bail out
//
// matching shaders:
// common/weapclip (intended)
- // common/noimpact (is supposed to eat projectiles, but is erased farther above)
+ // common/noimpact (is supposed to eat projectiles, but is erased anyway)
+ float is_weapclip = 0;
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
- break;
+ is_weapclip = 1;
- // go through solid!
- if(!W_BallisticBullet_LeaveSolid((other && (other.solid != SOLID_BSP)) ? eff : -1))
- break;
+ if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
+ Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
- W_BallisticBullet_LeaveSolid_think();
+ if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit) // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
+ {
+ fireBullet_last_hit = hit;
+ yoda = 0;
+ float g = accuracy_isgooddamage(self, hit);
+ Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+ // calculate hits for ballistic weapons
+ if(g)
+ {
+ // do not exceed 100%
+ float added_damage = min(damage - total_damage, damage * solid_penetration_left);
+ total_damage += damage * solid_penetration_left;
+ accuracy_add(self, self.weapon, 0, added_damage);
+ }
+ }
- self.projectiledeathtype |= HITTYPE_BOUNCE;
- }
- frametime = savetime;
- self = oldself;
+ if (is_weapclip)
+ break;
- if(lag)
- FOR_EACH_PLAYER(pl)
- if(pl != self)
- antilag_restore(pl);
+ // go through solid!
+ // outside the world? forget it
+ if(start_x > world.maxs_x || start_y > world.maxs_y || start_z > world.maxs_z || start_x < world.mins_x || start_y < world.mins_y || start_z < world.mins_z)
+ break;
- remove(proj);
+ float maxdist;
+ if(max_solid_penetration < 0)
+ break;
+ else if(hit.ballistics_density < -1)
+ break; // -2: no solid penetration, ever
+ else if(hit.ballistics_density < 0)
+ maxdist = vlen(hit.maxs - hit.mins) + 1; // -1: infinite travel distance
+ else if(hit.ballistics_density == 0)
+ maxdist = max_solid_penetration * solid_penetration_left;
+ else
+ maxdist = max_solid_penetration * solid_penetration_left * hit.ballistics_density;
- return;
-}
+ if(maxdist <= autocvar_g_ballistics_mindistance)
+ break;
-void fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer)
-{
- vector end;
+ // move the entity along its velocity until it's out of solid, then let it resume
+ // The previously hit entity is ignored here!
+ traceline_inverted (start, start + dir * maxdist, MOVE_NORMAL, WarpZone_trace_forent, TRUE, hit);
+ if(trace_fraction == 1) // 1: we never got out of solid
+ break;
- dir = normalize(dir + randomvec() * spread);
- end = start + dir * MAX_SHOT_DISTANCE;
- if(self.antilag_debug)
- traceline_antilag (self, start, end, FALSE, self, self.antilag_debug);
- else
- traceline_antilag (self, start, end, FALSE, self, ANTILAG_LATENCY(self));
+ float dist_taken = max(autocvar_g_ballistics_mindistance, vlen(trace_endpos - start));
+ solid_penetration_left *= (dist_taken / maxdist);
- end = trace_endpos;
+ // Only show effect when going through a player (invisible otherwise)
+ if (hit && (hit.solid != SOLID_BSP))
+ if(vlen(trace_endpos - start) > 4)
+ trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
- 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);
+ start = trace_endpos;
- Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * force);
+ if(hit.solid == SOLID_BSP)
+ Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, self);
}
- trace_endpos = end;
+
+ if(lag)
+ FOR_EACH_PLAYER(pl)
+ if(pl != self)
+ antilag_restore(pl);
}
float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtype, float exception)
.float rifle_accumulator;
-void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant, float pTracer, float pShots, string pSound)
+void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, float deathtype, float pTracer, float pShots, string pSound)
{
float i;
}
for(i = 0; i < pShots; ++i)
- fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE), pBulletConstant);
- endFireBallisticBullet();
+ fireBullet(w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
if (autocvar_g_casings >= 2)
SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
void W_Rifle_Attack()
{
- W_Rifle_FireBullet(autocvar_g_balance_rifle_primary_spread, autocvar_g_balance_rifle_primary_damage, autocvar_g_balance_rifle_primary_force, autocvar_g_balance_rifle_primary_speed, autocvar_g_balance_rifle_primary_lifetime, autocvar_g_balance_rifle_primary_ammo, WEP_RIFLE, autocvar_g_balance_rifle_primary_bulletconstant, autocvar_g_balance_rifle_primary_tracer, autocvar_g_balance_rifle_primary_shots, "weapons/campingrifle_fire.wav");
+ W_Rifle_FireBullet(autocvar_g_balance_rifle_primary_spread, autocvar_g_balance_rifle_primary_damage, autocvar_g_balance_rifle_primary_force, autocvar_g_balance_rifle_primary_solidpenetration, autocvar_g_balance_rifle_primary_ammo, WEP_RIFLE, autocvar_g_balance_rifle_primary_tracer, autocvar_g_balance_rifle_primary_shots, "weapons/campingrifle_fire.wav");
}
void W_Rifle_Attack2()
{
- W_Rifle_FireBullet(autocvar_g_balance_rifle_secondary_spread, autocvar_g_balance_rifle_secondary_damage, autocvar_g_balance_rifle_secondary_force, autocvar_g_balance_rifle_secondary_speed, autocvar_g_balance_rifle_secondary_lifetime, autocvar_g_balance_rifle_secondary_ammo, WEP_RIFLE | HITTYPE_SECONDARY, autocvar_g_balance_rifle_secondary_bulletconstant, autocvar_g_balance_rifle_secondary_tracer, autocvar_g_balance_rifle_secondary_shots, "weapons/campingrifle_fire2.wav");
+ W_Rifle_FireBullet(autocvar_g_balance_rifle_secondary_spread, autocvar_g_balance_rifle_secondary_damage, autocvar_g_balance_rifle_secondary_force, autocvar_g_balance_rifle_secondary_solidpenetration, autocvar_g_balance_rifle_secondary_ammo, WEP_RIFLE | HITTYPE_SECONDARY, autocvar_g_balance_rifle_secondary_tracer, autocvar_g_balance_rifle_secondary_shots, "weapons/campingrifle_fire2.wav");
}
void spawnfunc_weapon_rifle (void)
self.bot_secondary_riflemooth = 0;
if(self.bot_secondary_riflemooth == 0)
{
- if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, FALSE))
+ if(bot_aim(1000000, 0, 0.001, FALSE))
{
self.BUTTON_ATCK = TRUE;
if(random() < 0.01) self.bot_secondary_riflemooth = 1;
}
else
{
- if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, FALSE))
+ if(bot_aim(1000000, 0, 0.001, FALSE))
{
self.BUTTON_ATCK2 = TRUE;
if(random() < 0.03) self.bot_secondary_riflemooth = 0;
float d;
float f;
float spread;
- float bulletspeed;
- float bulletconstant;
+ float solidpenetration;
entity flash;
ammoamount = autocvar_g_balance_shotgun_primary_ammo;
d = autocvar_g_balance_shotgun_primary_damage;
f = autocvar_g_balance_shotgun_primary_force;
spread = autocvar_g_balance_shotgun_primary_spread;
- bulletspeed = autocvar_g_balance_shotgun_primary_speed;
- bulletconstant = autocvar_g_balance_shotgun_primary_bulletconstant;
+ solidpenetration = autocvar_g_balance_shotgun_primary_solidpenetration;
W_DecreaseAmmo(ammo_shells, ammoamount, autocvar_g_balance_shotgun_reload_ammo);
W_SetupShot (self, TRUE, 5, "weapons/shotgun_fire.wav", CH_WEAPON_A, d * bullets);
for (sc = 0;sc < bullets;sc = sc + 1)
- fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, f, WEP_SHOTGUN, 0, bulletconstant);
- endFireBallisticBullet();
+ fireBullet(w_shotorg, w_shotdir, spread, solidpenetration, d, f, WEP_SHOTGUN, 0);
pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, autocvar_g_balance_shotgun_primary_ammo);
mmax = 240 / mintempo; // 60 = "0.25 means 1 sec", at 120 0.5 means 1 sec, at 240 1 means 1 sec
else
mmax = 240; // you won't try THAT hard... (tempo 1)
- //print(sprintf("initial tempo rules: %f %f\n", mmin, mmax));
+ //printf("initial tempo rules: %f %f\n", mmin, mmax);
for(i = 0; i < n; ++i)
{
// vi_x <= vi_y <= vj_x <= vj_y
// ti <= tj
- //print(sprintf("first note: %f to %f, should be %f\n", vi_x, vi_y, ti));
- //print(sprintf("second note: %f to %f, should be %f\n", vj_x, vj_y, tj));
- //print(sprintf("m1 = %f\n", (vi_x - vj_y) / (ti - tj)));
- //print(sprintf("m2 = %f\n", (vi_y - vj_x) / (ti - tj)));
+ //printf("first note: %f to %f, should be %f\n", vi_x, vi_y, ti);
+ //printf("second note: %f to %f, should be %f\n", vj_x, vj_y, tj);
+ //printf("m1 = %f\n", (vi_x - vj_y) / (ti - tj));
+ //printf("m2 = %f\n", (vi_y - vj_x) / (ti - tj));
mmin = max(mmin, (vi_x - vj_y) / (ti - tj)); // lower bound
mmax = min(mmax, (vi_y - vj_x) / (ti - tj)); // upper bound
}
ATTACK_FINISHED(self) = time + autocvar_g_balance_uzi_first_refire * W_WeaponRateFactor();
if (self.misc_bulletcounter == 1)
- fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_first_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_first_damage, autocvar_g_balance_uzi_first_force, deathtype, 0, autocvar_g_balance_uzi_bulletconstant);
+ fireBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_first_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_first_damage, autocvar_g_balance_uzi_first_force, deathtype, 0);
else
- fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_sustained_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, deathtype, 0, autocvar_g_balance_uzi_bulletconstant);
- endFireBallisticBullet();
+ fireBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_sustained_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, deathtype, 0);
pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
}
uzi_spread = bound(autocvar_g_balance_uzi_spread_min, autocvar_g_balance_uzi_spread_min + (autocvar_g_balance_uzi_spread_add * self.misc_bulletcounter), autocvar_g_balance_uzi_spread_max);
- fireBallisticBullet(w_shotorg, w_shotdir, uzi_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0, autocvar_g_balance_uzi_bulletconstant);
- endFireBallisticBullet();
+ fireBullet(w_shotorg, w_shotdir, uzi_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0);
self.misc_bulletcounter = self.misc_bulletcounter + 1;
self.punchangle_y = random () - 0.5;
}
- fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_burst_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0, autocvar_g_balance_uzi_bulletconstant);
- endFireBallisticBullet();
-
+ fireBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_burst_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0);
pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
self.alpha = bound(0, (self.warpzone_fadeend - vlen(org - self.origin - 0.5 * (self.mins + self.maxs))) / (self.warpzone_fadeend - self.warpzone_fadestart), 1);
else
self.alpha = 1;
- //print(sprintf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs)));
+ //printf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs));
if(self.alpha <= 0)
self.drawmask = 0;
else
set g_vehicle_raptor_shield_regen 25
set g_vehicle_raptor_shield_regen_pause 1.5
+set g_vehicle_raptor_blowup_radius 250
+set g_vehicle_raptor_blowup_coredamage 250
+set g_vehicle_raptor_blowup_edgedamage 15
+set g_vehicle_raptor_blowup_forceintensity 250
+
set g_vehicle_raptor_bouncefactor 0.2
set g_vehicle_raptor_bouncestop 0
set g_vehicle_raptor_bouncepain "1 4 1000"
set g_vehicle_spiderbot_minigun_refire 0.06
set g_vehicle_spiderbot_minigun_force 9
set g_vehicle_spiderbot_minigun_spread 0.015
-set g_vehicle_spiderbot_minigun_speed 45000 // ~ 32QU
-set g_vehicle_spiderbot_minigun_bulletconstant 110
+set g_vehicle_spiderbot_minigun_solidpenetration 32
set g_vehicle_spiderbot_minigun_ammo_cost 1
set g_vehicle_spiderbot_minigun_ammo_max 100
set g_vehicle_spiderbot_minigun_ammo_regen 40
set g_vehicle_spiderbot_rocket_lifetime 20
set g_vehicle_spiderbot_rocket_spread 0.05
+set g_vehicle_spiderbot_blowup_radius 250
+set g_vehicle_spiderbot_blowup_coredamage 250
+set g_vehicle_spiderbot_blowup_edgedamage 15
+set g_vehicle_spiderbot_blowup_forceintensity 250
+
set g_vehicle_spiderbot_bouncefactor 0 // Factor of old velocity to keep after colission
set g_vehicle_spiderbot_bouncestop 0 // if != 0, New veloctiy after bounce = 0 if new velocity < this
set g_vehicle_spiderbot_bouncepain "0 0 0" // "minspeed_for_pain speedchange_to_pain_factor max_damage"