random fixups

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4528 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-11-22 00:13:52 +00:00
parent ef8a74fe1c
commit fb22181816
6 changed files with 42 additions and 42 deletions

View File

@ -85,7 +85,7 @@ static void spline_calclength(spline_t *s)
{
int i;
s->totallength = 0;
for (i = 0; i < s->numpoints - 1; i++)
for (i = 0; i < s->numpoints - 1; i+=1)
{
s->totallength = s->totallength + vlen(s->pos[i] - s->pos[i+1]);
}
@ -185,11 +185,11 @@ void (vector pos, float point_size, vector color) draw_point
offsets[3] = point;
point1_z = -(point_size/2);
for (i=0; i<4; i++)
for (i=0; i<4; i+=1)
points[i] = offsets[i] + point1 + pos;
point1_z = (point_size/2);
for (i=4; i<8; i++)
for (i=4; i<8; i+=1)
points[i] = offsets[i-4] + point1 + pos;
/*
@ -295,7 +295,7 @@ vector(spline_t *s, float frac_time) spline_calculate_position =
t2 = pow(t1, s->numpoints - 1i);
t3 = pow(frac_time, s->numpoints - 1i);
for (i=0; i<s->numpoints; i++)
for (i=0; i<s->numpoints; i+=1)
{
if (i == 0i)
{
@ -322,7 +322,7 @@ vector(spline_t *s, float frac_time) spline_calculate_position =
t5 = 1 / (float)(s->numpoints - 3i);
for (i=1, t4=t5; t4<frac_time; t4 = t4 + t5)
{
i++;
i+=1;
}
if (i >= s->numpoints)
@ -415,7 +415,7 @@ static void(spline_t *s) spline_draw =
//fakeline(pos2, s->pos[s->numpoints-1]);
// draw points
for (i=0; i<s->numpoints; i++)
for (i=0; i<s->numpoints; i+=1)
{
psize = 5;
color = '0.25 0.25 0.25';

View File

@ -89,10 +89,10 @@ void() wrap_renderscene =
"clampmap $3d:",autocvar_ca_colourtint,"\n"
"}\n"
//else (glsl not available)
"][\n"
"else\n"
//just don't draw anything.
"surfaceparm nodraw\n"
"]\n"
"endif\n"
"}\n"
);
drawpic(getproperty(VF_MIN), shdrname, getproperty(VF_SIZE), '1 1 1', 1);
@ -115,7 +115,7 @@ void() wrap_renderscene =
renderscene();
for (i = 0; i < MODE_COUNT; i++)
for (i = 0; i < MODE_COUNT; i+=1)
{
if (autocvar_ca_editormode == i+1)
col = '1 0 0';
@ -406,11 +406,11 @@ void(float prevprogs) init =
externset(0, wrap_InputEvent, "CSQC_InputEvent");
}
csfixups();
localcmd(sprintf("alias rtlight_editor \"set ca_show 1; set ca_editormode %s\"\n", MODE_LIGHTEDIT));
localcmd(sprintf("alias camquake_editor \"set ca_show 1; set ca_editormode %s\"\n", MODE_SPLINEEDIT));
localcmd(sprintf("alias terrain_editor \"set ca_show 1; set ca_editormode %s\"\n", MODE_TERRAINEDIT));
localcmd(sprintf("alias r_part_editor \"set ca_show 1; set ca_editormode %s\"\n", MODE_PARTICLEEDIT));
localcmd(sprintf("alias entities_editor \"set ca_show 1; set ca_editormode %s\"\n", MODE_ENTSEDIT));
localcmd(sprintf("alias rtlight_editor \"set ca_show 1; set ca_editormode %g\"\n", MODE_LIGHTEDIT));
localcmd(sprintf("alias camquake_editor \"set ca_show 1; set ca_editormode %g\"\n", MODE_SPLINEEDIT));
localcmd(sprintf("alias terrain_editor \"set ca_show 1; set ca_editormode %g\"\n", MODE_TERRAINEDIT));
localcmd(sprintf("alias r_part_editor \"set ca_show 1; set ca_editormode %g\"\n", MODE_PARTICLEEDIT));
localcmd(sprintf("alias entities_editor \"set ca_show 1; set ca_editormode %g\"\n", MODE_ENTSEDIT));
};
void() CSQC_Shutdown =

View File

@ -18,7 +18,7 @@ void() editor_lights_add =
if (!tempent)
tempent = spawn();
l = dynamiclight_get(-1, -1);
l = (float)dynamiclight_get(-1, -1);
precache_model(autocvar_cg_editor_lightmodel); /*just to silence it*/
setmodel(tempent, autocvar_cg_editor_lightmodel);
while(l > 0)
@ -184,7 +184,7 @@ void(vector m) editor_lights_overlay =
fldname[NUMLFIELDS+2] = strcat("realtime world: ", cvar("r_shadow_realtime_world")?"on":"off");
fldname[NUMLFIELDS+3] = strcat("realtime dlight: ", cvar("r_shadow_realtime_dynamic")?"on":"off");
for (i = 1f; i <= NUMLFIELDS; i++)
for (i = 1f; i <= NUMLFIELDS; i+=1)
{
if (editfield == i)
s = editvalue;
@ -202,7 +202,7 @@ void(vector m) editor_lights_overlay =
drawrawstring('0 32 0' + '0 8 0' * (float)i, s, '8 8 0', col, 1);
}
for (i = NUMLFIELDS+1f; i <= NUMLFIELDS+NUMCMDS; i++)
for (i = NUMLFIELDS+1f; i <= NUMLFIELDS+NUMCMDS; i+=1)
{
s = strcat(ftos(i), " ", fldname[i]);
@ -248,12 +248,12 @@ static void(vector fwd, vector vorg) selectbestlight =
{
float l, b=selectedlight, d, bd;
vector ldir;
l = dynamiclight_get(-1f, -1f);
l = (float)dynamiclight_get(-1f, -1f);
bd = 0;
while(l > 0)
{
l--;
ldir = dynamiclight_get(l, LFIELD_ORIGIN);
l-=1;
ldir = (vector)dynamiclight_get(l, LFIELD_ORIGIN);
ldir = normalize(ldir - vorg);
d = fwd*ldir;
if (d > bd)
@ -348,9 +348,9 @@ float(float keyc, float unic, vector m) editor_lights_key =
editvalue = strzone(readfield(editfield, 1));
}
else if (unic == '=')
selectedlight++;
selectedlight+=1;
else if (unic == '-')
selectedlight--;
selectedlight-=1;
else if (unic == 'n' || unic == 'N')
localcmd("noclip\n");
// else if (unic == 's' || unic == 'S')
@ -376,7 +376,7 @@ float(float keyc, float unic, vector m) editor_lights_key =
else if (unic == 'i' || unic == 'I')
{
float oldl = selectedlight;
for (selectedlight = 32; ; selectedlight++)
for (selectedlight = 32; ; selectedlight+=1)
{
if (!(float)dynamiclight_get(selectedlight, LFIELD_RADIUS))
{
@ -422,26 +422,26 @@ float(float keyc, float unic, vector m) editor_lights_key =
}
else if (unic == '[')
{
o = getproperty(11);
o = (vector)getproperty(11);
traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, dynamiclight_get(selectedlight, LFIELD_ORIGIN) - trace_plane_normal);
}
else if (unic == ']')
{
o = getproperty(11);
o = (vector)getproperty(11);
traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, dynamiclight_get(selectedlight, LFIELD_ORIGIN) + trace_plane_normal);
}
else if (unic == '\'' || unic == '@')
{
o = getproperty(11);
o = (vector)getproperty(11);
traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_RADIUS, 1.5*vlen(trace_endpos - dynamiclight_get(selectedlight, LFIELD_ORIGIN)));
dynamiclight_set(selectedlight, LFIELD_RADIUS, 1.5*vlen(trace_endpos - (vector)dynamiclight_get(selectedlight, LFIELD_ORIGIN)));
}
else if (unic == '#')
{
float fl;
fl = dynamiclight_get(selectedlight, LFIELD_FLAGS);
fl = (float)dynamiclight_get(selectedlight, LFIELD_FLAGS);
if (fl & LFLAG_NOSHADOWS)
fl -= LFLAG_NOSHADOWS;
else

View File

@ -148,7 +148,7 @@ static int(string src, int *start) skipblock =
{
if (!level)
*start = le+1;
++level;
level+=1;
}
else if (line == "}")
{
@ -196,7 +196,7 @@ static void() updateloadedparticles =
pdesc[numptypes].end = le;
// print("particle: ", pdesc[numptypes].efname, "\n", substring(particlesfile, pdesc[numptypes].start, pdesc[numptypes].end - pdesc[numptypes].start), "\n");
++numptypes;
numptypes+=1;
}
}
ls = le+1;
@ -277,7 +277,7 @@ static void() applyparticles =
localcmd("}\n");
sln = strcat("+", pdesc[cureffect].efname);
for (i = cureffect + 1; i < numptypes; i++)
for (i = cureffect + 1; i < numptypes; i+=1)
{
if (pdesc[i].efname == sln)
{
@ -393,7 +393,7 @@ void(vector mousepos) editor_particles_overlay =
if (ef < 0)
ef = 0;
y = '0 32 0';
for (; ; ef++)
for (; ; ef+=1)
{
if (ef >= numptypes)
break;
@ -406,5 +406,5 @@ void(vector mousepos) editor_particles_overlay =
y_y += 8;
}
textfield_draw('128 32 0', &tf_particle, fields);
textfield_draw('128 32 0', &tf_particle, &fields[0]);
};

View File

@ -498,7 +498,7 @@ void(vector mousepos) editor_terrain_overlay =
if (texturesearchhighlighted)
{
strunzone(texturesearchhighlighted);
texturesearchhighlighted = 0;
texturesearchhighlighted = __NULL__;
}
if (curtool == ter_tex)
{

View File

@ -55,9 +55,9 @@ void(textfield_t *fld, string text) textfield_fill =
if (end < 0)
break;
while(text[start] == '\t')
++start;
start+=1;
term = end;
if (term) if (text[term-1] == '\r') term--;
if (term) if (text[term-1] == '\r') term-=1;
line = substring(text, start, term - start);
end += 1;
@ -106,11 +106,11 @@ void(vector pos, textfield_t *fld, textfield_linedesc_t *fields) textfield_draw
cmd = substring(cmd, 0, llen);
/*show command completion box*/
for (l = 0; fields[l].name; l++)
for (l = 0; fields[l].name; l+=1)
{
if (!strncmp(fields[l].name, cmd, llen))
{
nummatches++;
nummatches+=1;
lastmatch = l;
/*if its an exact match, then stop here*/
if (cmd == fields[l].name)
@ -128,7 +128,7 @@ void(vector pos, textfield_t *fld, textfield_linedesc_t *fields) textfield_draw
else
{
/*show command completion box*/
for (l = 0; fields[l].name; l++)
for (l = 0; fields[l].name; l+=1)
{
if (!strncmp(fields[l].name, cmd, llen))
{
@ -215,7 +215,7 @@ float(textfield_t *fld, float keyc, float unic, vector m) textfield_key
l = strcat(l, r);
strunzone(fld->lines[fld->cursorline - 1i]);
fld->lines[fld->cursorline - 1i] = strzone(l);
for (i = fld->cursorline; i < fld->linecount - 1i; i++)
for (i = fld->cursorline; i < fld->linecount - 1i; i+=1)
{
fld->lines[i] = fld->lines[i + 1i];
}
@ -241,7 +241,7 @@ float(textfield_t *fld, float keyc, float unic, vector m) textfield_key
l = strcat(l, r);
strunzone(fld->lines[fld->cursorline]);
fld->lines[fld->cursorline] = strzone(l);
for (i = fld->cursorline + 1i; i < fld->linecount - 1i; i++)
for (i = fld->cursorline + 1i; i < fld->linecount - 1i; i+=1)
{
fld->lines[i] = fld->lines[i + 1i];
}
@ -297,7 +297,7 @@ float(textfield_t *fld, float keyc, float unic, vector m) textfield_key
{
/*shift trailing lines down*/
fld->linecount = fld->linecount + 1i;
for (i = fld->linecount - 1i; i > fld->cursorline; i--)
for (i = fld->linecount - 1i; i > fld->cursorline; i-=1)
{
fld->lines[i] = fld->lines[i - 1i];
}