// 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 "WARNING: WILL BREAK CONFIG!!! enable top-down view of the map- meant to be used for radar map images"
+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"
+set cl_orthoview_resolution 512 "resolution accuracy multiplier for deciding fov scaling and view distance"
+
// 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)
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)
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 = (autocvar_cl_orthoview_resolution * 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_set("r_nearclip", ftos(ov_nearest));
+ cvar_set("r_farclip_base", ftos(ov_furthest));
+ cvar_set("r_farclip_world", "0");
+ cvar_set("r_novis", "1");
+ cvar_set("r_useportalculling", "0");
+ cvar_set("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_orthoview_resolution;
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)
CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1);
CSQCPlayer_LOD_Apply();
if(!isplayer)
+ {
+ skeleton_loadinfo(self);
+ float doblend = (self.bone_upperbody >= 0);
CSQCPlayer_FallbackFrame_Apply();
+ if(doblend)
+ {
+ skeleton_from_frames(self, self.csqcmodel_isdead);
+ }
+ else
+ {
+ free_skeleton_from_frames(self);
+ // just in case, clear these (we're animating in frame and frame3)
+ self.lerpfrac = 0;
+ self.lerpfrac4 = 0;
+ }
+ }
else
{
// we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
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 '1 1 1';
}
+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;
}
/*
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
CSQCMODEL_ENDIF \
CSQCMODEL_PROPERTY(512, float, ReadChar, WriteChar, anim_upper_action) \
CSQCMODEL_PROPERTY(512, float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
- CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
CSQCMODEL_ENDIF \
+ CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
CSQCMODEL_PROPERTY_SCALED(4096, float, ReadByte, WriteByte, scale, 16, 0, 255)
// TODO get rid of colormod/glowmod here, find good solution for nex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
// 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;
}
#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
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);
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
}
void CSQCModel_Read(float isnew)
{
float sf;
- sf = ReadShort();
+ sf = ReadInt24_t();
// some nice flags for CSQCMODEL_IF and the hooks
local noref float isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
// 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;
}
.float frame2time;
.float lerpfrac;
-#define CSQCMODEL_PROPERTY_FRAME 32768
-#define CSQCMODEL_PROPERTY_TELEPORTED 16384 // the "teleport bit" cancelling interpolation
-#define CSQCMODEL_PROPERTY_MODELINDEX 8192
-#define CSQCMODEL_PROPERTY_ORIGIN 4096
-#define CSQCMODEL_PROPERTY_YAW 2048
-#define CSQCMODEL_PROPERTY_PITCHROLL 1024
-#define CSQCMODEL_PROPERTY_FRAME2 512
-#define CSQCMODEL_PROPERTY_LERPFRAC 256
-#define CSQCMODEL_PROPERTY_SIZE 128
+#define CSQCMODEL_PROPERTY_FRAME 8388608
+#define CSQCMODEL_PROPERTY_TELEPORTED 4194304 // the "teleport bit" cancelling interpolation
+#define CSQCMODEL_PROPERTY_MODELINDEX 2097152
+#define CSQCMODEL_PROPERTY_ORIGIN 1048576
+#define CSQCMODEL_PROPERTY_YAW 524288
+#define CSQCMODEL_PROPERTY_PITCHROLL 262144
+#define CSQCMODEL_PROPERTY_FRAME2 131072
+#define CSQCMODEL_PROPERTY_LERPFRAC 65536
+#define CSQCMODEL_PROPERTY_SIZE 32768
#define ALLPROPERTIES_COMMON \
CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, float, ReadByte, WriteByte, frame) \
unused_float = isnolocalplayer;
WriteByte(MSG_ENTITY, ENT_CLIENT_MODEL);
- WriteShort(MSG_ENTITY, sf);
+ WriteInt24_t(MSG_ENTITY, sf);
#define CSQCMODEL_IF(cond) if(cond) {
#define CSQCMODEL_ENDIF }
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();
}
// 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;
}
/*
if(g_race)
- dprint(sprintf("%f %.6f\n", time, race_GetFractionalLapCount(self)));
+ dprintf("%f %.6f\n", time, race_GetFractionalLapCount(self));
*/
CSQCMODEL_AUTOUPDATE();
self.teleportable = oldself.teleportable;
self.damagedbycontents = oldself.damagedbycontents;
self.angles = oldself.angles;
+ self.v_angle = oldself.v_angle;
self.avelocity = oldself.avelocity;
self.classname = "body";
self.damageforcescale = oldself.damageforcescale;
{
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
}
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)
}
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));
}
//if (targ == attacker)
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(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)
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)
{
entity newwep = get_weaponinfo(self.owner.switchweapon);
f = f * g_weaponratefactor / max(f, newwep.switchdelay_raise);
- //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)));
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, oldwep.switchdelay_drop);
- //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)));
self.angles_x = -90 * f * f;
}
else if (self.state == WS_CLEAR)
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