TempleOSCDV4.06.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:47:19 +02:00
1 parent 6fe38d2d9d
commit b632ab9a4f
261 files changed
+6282 -5801

No files matched your search

+32 -32
View File
@@ -3,7 +3,7 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
{//3D. Must be convex.
//Returns cnt of pixs changed
CD3I32 tri[3];
I64 i,j,x,y,z,result=0;
I64 i,j,x,y,z,res=0;
if (n<3) return 0;
if (dc->flags & DCF_SYMMETRY) {
for (i=1;i<n-1;i++) {
@@ -32,11 +32,11 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
DCReflect(dc,&x,&y,&z);
tri[2].x=x; tri[2].y=y; tri[2].z=z;
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
}
}
if (dc->flags&DCF_JUST_MIRROR)
return result;
return res;
for (i=1;i<n-1;i++) {
j=i-1;
if (i==1) {
@@ -60,9 +60,9 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
(*dc->transform)(dc,&x,&y,&z);
tri[2].x=x; tri[2].y=y; tri[2].z=z;
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
}
return result;
return res;
}
public I64 GrRectB(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
@@ -105,7 +105,7 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
{//3D. Transformation with pen width.
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
F64 d;
Bool result=FALSE,was_transform=FALSE,was_symmetry=FALSE;
Bool res=FALSE,was_transform=FALSE,was_symmetry=FALSE;
if (dc->flags & DCF_TRANSFORMATION) {
(*dc->transform)(dc,&x1,&y1,&z1);
(*dc->transform)(dc,&x2,&y2,&z2);
@@ -118,26 +118,26 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
_x2=x2; _y2=y2; _z2=z2;
DCReflect(dc,&_x2,&_y2,&_z2);
dc->flags&=~DCF_SYMMETRY;
result=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
res=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
dx=_x2-_x1; dy=_y2-_y1;
if (d=Sqrt(dx*dx+dy*dy)) {
d=w*dc->pen_width/d;
result|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
res|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
_x2,_y2,_z2,&GrPlot3,step);
result|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
res|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
_x2,_y2,_z2,&GrPlot3,step);
}
was_symmetry=TRUE;
if (dc->flags&DCF_JUST_MIRROR)
goto gr_done;
}
result|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
res|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
dx=x2-x1; dy=y2-y1;
if (d=Sqrt(dx*dx+dy*dy)) {
d=w*dc->pen_width/d;
result|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
res|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
x2,y2,z2,&GrPlot3,step);
result|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
res|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
x2,y2,z2,&GrPlot3,step);
}
gr_done:
@@ -145,14 +145,14 @@ gr_done:
dc->flags|=DCF_TRANSFORMATION;
if (was_symmetry)
dc->flags|=DCF_SYMMETRY;
return result;
return res;
}
#help_index "Graphics/Char;Char/Graphics"
public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
{//3D. Transformation. DCF_SYMMETRY is silly.
U8 *ptr;
I64 ch,result,w,w_max,h;
I64 ch,res,w,w_max,h;
if (!s) return FALSE;
ptr=s;
w=0; w_max=0; h=FONT_HEIGHT;
@@ -170,12 +170,12 @@ public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
w+=FONT_WIDTH;
}
if (w>w_max) w_max=w;
result=GrPrint(dc,x1,y1,"%s",s);
result|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
result|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
result|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
result|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
return ToBool(result);
res=GrPrint(dc,x1,y1,"%s",s);
res|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
res|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
res|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
res|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
return ToBool(res);
}
#define MAX_DIAMOND_SLOPE 2.75
@@ -185,7 +185,7 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
{//3D. Transformation. DCF_SYMMETRY is silly.
Bool first=TRUE;
U8 ch,*ptr,*ptr_end,*st,*s;
I64 result=0,y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
I64 res=0,y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
F64 m;
if (!_s) return FALSE;
if (dc->flags & DCF_TRANSFORMATION)
@@ -214,10 +214,10 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
w=(StrLen(st)*FONT_WIDTH)>>1;
if (first) {
result|=GrPrint(dc,x1-w,y,"%s",st);
res|=GrPrint(dc,x1-w,y,"%s",st);
first=FALSE;
} else
result|=GrPrint(dc,x1-w,y,"%s",st);
res|=GrPrint(dc,x1-w,y,"%s",st);
if (w) {
w+=border;
do {
@@ -238,11 +238,11 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
}
Free(s);
result|=GrLine(dc,x1,y1-dy,x1+dx,y1);
result|=GrLine(dc,x1+dx,y1,x1,y1+dy);
result|=GrLine(dc,x1,y1+dy,x1-dx,y1);
result|=GrLine(dc,x1-dx,y1,x1,y1-dy);
return ToBool(result);
res|=GrLine(dc,x1,y1-dy,x1+dx,y1);
res|=GrLine(dc,x1+dx,y1,x1,y1+dy);
res|=GrLine(dc,x1,y1+dy,x1-dx,y1);
res|=GrLine(dc,x1-dx,y1,x1,y1-dy);
return ToBool(res);
}
#help_index "Graphics/Mesh"
@@ -250,7 +250,7 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
I64 tri_cnt,CMeshTri *tri)
{//Returns cnt of pixs changed.
CColorROPU32 old_color=dc->color;
I64 i,x,y,z,result=0;
I64 i,x,y,z,res=0;
CD3I32 *pt,*pt_sym,*p_sym,*dst;
CMeshTri *tri_sym=tri;
if (dc->flags&DCF_TRANSFORMATION) {
@@ -276,7 +276,7 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
for (i=0;i<tri_cnt;i++,tri_sym++) {
(*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
&p_sym[tri_sym->nums[1]],tri_sym->color);
result+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
res+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
&p_sym[tri_sym->nums[1]]);
}
Free(pt_sym);
@@ -286,12 +286,12 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
for (i=0;i<tri_cnt;i++,tri++) {
(*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],
&p[tri->nums[2]],tri->color);
result+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
res+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
}
mesh_done:
dc->color=old_color;
Free(pt);
return result;
return res;
}
#help_index "Graphics/Misc;Input Pointer/Displayed Image"