TempleOSCD_140715.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:09 +02:00
1 parent 7ef616a20e
commit 64f679eeb9
1095 files changed
+24814 -221011

No files matched your search

+129 -24
View File
@@ -1,13 +1,79 @@
#help_index "Graphics"
public I64 GrRectB(CDC *dc=gr_dc,I64 x1,I64 y1,I64 x2,I64 y2)
{
if (x2<x1) SwapU64(&x1,&x2);
if (y2<y1) SwapU64(&y1,&y2);
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;
if (n<3) return 0;
if (dc->flags & DCF_SYMMETRY) {
for (i=1;i<n-1;i++) {
j=i-1;
if (i==1) {
x=poly[j].x; y=poly[j].y; z=poly[j].z;
if (dc->flags&DCF_TRANSFORMATION)
(*dc->transform)(dc,&x,&y,&z);
GrReflect(dc,&x,&y,&z);
tri[0].x=x; tri[0].y=y; tri[0].z=z;
}
j++;
if (i==1) {
x=poly[j].x; y=poly[j].y; z=poly[j].z;
if (dc->flags&DCF_TRANSFORMATION)
(*dc->transform)(dc,&x,&y,&z);
GrReflect(dc,&x,&y,&z);
}
tri[1].x=x; tri[1].y=y; tri[1].z=z;
j++;
x=poly[j].x; y=poly[j].y; z=poly[j].z;
if (dc->flags&DCF_TRANSFORMATION)
(*dc->transform)(dc,&x,&y,&z);
GrReflect(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]);
}
}
if (dc->flags&DCF_JUST_MIRROR)
return result;
for (i=1;i<n-1;i++) {
j=i-1;
if (i==1) {
x=poly[j].x; y=poly[j].y; z=poly[j].z;
if (dc->flags&DCF_TRANSFORMATION)
(*dc->transform)(dc,&x,&y,&z);
tri[0].x=x; tri[0].y=y; tri[0].z=z;
}
j++;
if (i==1) {
x=poly[j].x; y=poly[j].y; z=poly[j].z;
if (dc->flags&DCF_TRANSFORMATION)
(*dc->transform)(dc,&x,&y,&z);
}
tri[1].x=x; tri[1].y=y; tri[1].z=z;
j++;
x=poly[j].x; y=poly[j].y; z=poly[j].z;
if (dc->flags&DCF_TRANSFORMATION)
(*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]);
}
return result;
}
public I64 GrRectB(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
{//2D. Two point. Clipping but not transformation.
if (x2<x1) SwapI64(&x1,&x2);
if (y2<y1) SwapI64(&y1,&y2);
return GrRect(dc,x1,y1,x2-x1+1,y2-y1+1);
}
public I64 GrRect3(CDC *dc=gr_dc,I64 x,I64 y,I64 z,I64 w,I64 h)
{ //Clipping and transformation
public I64 GrRect3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,I64 w,I64 h)
{//3D. Width Height. Clipping and transformation.
CD3I32 poly[4];
poly[0].x=x;
poly[0].y=y;
@@ -24,18 +90,17 @@ public I64 GrRect3(CDC *dc=gr_dc,I64 x,I64 y,I64 z,I64 w,I64 h)
return GrFillPoly3(dc,4,poly);
}
public U0 GrLineRect4(CDC *dc=gr_dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
{
//Can be used with ROPF_DITHER+WHITE<<16+BLACK
//for dotted rect.
public U0 GrBorder(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
{//2D. Transformation with pen width.
//Can be used with ROPF_DITHER+WHITE<<16+BLACK for dotted rect.
GrLine3(dc,x1,y1,0,x2,y1,0,step,start);
GrLine3(dc,x2,y1,0,x2,y2,0,step,start);
GrLine3(dc,x2,y2,0,x1,y2,0,step,start);
GrLine3(dc,x1,y2,0,x1,y1,0,step,start);
}
public Bool GrArrow3(CDC *dc=gr_dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64 w=2.75,I64 step=1,I64 start=0)
{ //transformation with pen width
public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64 w=2.75,I64 step=1,I64 start=0)
{//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;
@@ -78,10 +143,8 @@ gr_done:
}
#help_index "Graphics/Char;Char/Graphics"
public Bool GrTextBox3(CDC *dc=gr_dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
{ //transformation
//DCF_SYMMETRY is silly.
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;
if (!s) return FALSE;
@@ -111,9 +174,8 @@ public Bool GrTextBox3(CDC *dc=gr_dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
#define MAX_DIAMOND_SLOPE 2.75
public Bool GrTextDiamond3(CDC *dc=gr_dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
{ //transformation
//DCF_SYMMETRY is silly.
public Bool GrTextDiamond3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
{//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;
@@ -176,19 +238,62 @@ public Bool GrTextDiamond3(CDC *dc=gr_dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=
return ToBool(result);
}
#help_index "Graphics/Mesh"
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;
CD3I32 *pt,*pt_sym,*p_sym,*dst;
CMeshTri *tri_sym=tri;
if (dc->flags&DCF_TRANSFORMATION) {
dst=pt=MAlloc(sizeof(CD3I32)*vertex_cnt);
for (i=0;i<vertex_cnt;i++,p++,dst++) {
x=p->x; y=p->y; z=p->z;
(*dc->transform)(dc,&x,&y,&z);
dst->x=x; dst->y=y; dst->z=z;
}
p=pt;
} else
pt=NULL;
if (dc->flags & DCF_SYMMETRY) {
dst=pt_sym=MAlloc(sizeof(CD3I32)*vertex_cnt);
p_sym=p;
for (i=0;i<vertex_cnt;i++,p_sym++,dst++) {
x=p_sym->x; y=p_sym->y; z=p_sym->z;
GrReflect(dc,&x,&y,&z);
dst->x=x; dst->y=y; dst->z=z;
}
p_sym=pt_sym;
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]],&p_sym[tri_sym->nums[1]]);
}
Free(pt_sym);
if (dc->flags&DCF_JUST_MIRROR)
goto mesh_done;
}
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]]);
}
mesh_done:
dc->color=old_color;
Free(pt);
return result;
}
#help_index "Graphics/Misc;Input Pointer/Displayed Image"
//Called by $LK,"DrawInputPtr",A="MN:DrawInputPtr"$() which is
//called by $LK,"WinFinalUpdate",A="MN:WinFinalUpdate"$().
public U0 DrawStdInputPtr(CDC *dc,I64 x,I64 y)
{//This is a callback.
//Called by $LK,"DrawInputPtr",A="MN:DrawInputPtr"$() which is
//called by $LK,"WinFinalUpdate",A="MN:WinFinalUpdate"$().
dc->pen_width=1;
dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
GrArrow3(dc,x+8,y+8,0,x,y,0);
}
public U0 (*fp_draw_input_ptr)(CDC *dc,I64 x,I64 y)=&DrawStdInputPtr;
public U0 (*fp_draw_grab_input_ptr)(CDC *dc,I64 x,I64 y,Bool closed)=NULL;
public U8 *gr_empty_sprite=NULL; //Gets assigned $LK,"gr_empty_sprite",A="FI:::/Adam/WallPaper.CPP"$
gr.fp_draw_input_ptr=&DrawStdInputPtr;
public U0 DrawWaitInputPtr(CDC *dc,I64 x,I64 y)
{//This is a callback.