TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
+36
-36
@@ -83,7 +83,7 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
CColorROPU32 color,c,old_color;
|
||||
CTask *win_task;
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->scroll_x;
|
||||
y+=win_task->scroll_y;
|
||||
@@ -98,7 +98,7 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
h1=0;
|
||||
w2=img->width;
|
||||
h2=img->height;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
x+=win_task->pix_left;
|
||||
y+=win_task->pix_top;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
if (x+w1<0) w1=-x;
|
||||
if (x+w2>win_task->pix_right+1)
|
||||
w2=win_task->pix_right+1-x;
|
||||
@@ -165,7 +165,7 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
case ROPB_MONO:
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
if (img->flags&DCF_NO_TRANSPARENTS) {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
@@ -273,7 +273,7 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
}
|
||||
} else {
|
||||
k=h1*img->width_internal;
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
for (j=h1;j<h2;j++) {
|
||||
for (i=w1;i<w2;i++)
|
||||
if (img->body[k+i])
|
||||
@@ -318,7 +318,7 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
break;
|
||||
case ROPB_EQU:
|
||||
if (img->flags&DCF_NO_TRANSPARENTS) {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
@@ -423,7 +423,7 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
} else {
|
||||
here1a:
|
||||
k=h1*img->width_internal;
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
for (j=h1;j<h2;j++) {
|
||||
for (i=w1;i<w2;i++) {
|
||||
c=img->body[k+i];
|
||||
@@ -477,7 +477,7 @@ here1a:
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (img->flags&DCF_NO_TRANSPARENTS) {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
@@ -625,7 +625,7 @@ public CDC *DCExt(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||
CTask *win_task;
|
||||
if (x1>x2) SwapI64(&x1,&x2);
|
||||
if (y1>y2) SwapI64(&y1,&y2);
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x1+=win_task->pix_left+win_task->scroll_x;
|
||||
y1+=win_task->pix_top +win_task->scroll_y;
|
||||
@@ -648,7 +648,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
CColorROPU32 color,c;
|
||||
CTask *win_task;
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->scroll_x;
|
||||
y+=win_task->scroll_y;
|
||||
@@ -665,7 +665,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
w2=FONT_WIDTH;
|
||||
h2=FONT_HEIGHT;
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
x+=win_task->pix_left;
|
||||
y+=win_task->pix_top;
|
||||
}
|
||||
@@ -676,7 +676,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
if (x+w1<0) w1=-x;
|
||||
if (x+w2>win_task->pix_right+1)
|
||||
w2=win_task->pix_right+1-x;
|
||||
@@ -729,7 +729,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
k1=x+w1;
|
||||
kk1=(h1+y)*dc->width_internal+k1;
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
if (leading_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr;
|
||||
@@ -937,7 +937,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
Bool dither,probability_dither;
|
||||
CTask *win_task;
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->scroll_x;
|
||||
y+=win_task->scroll_y;
|
||||
@@ -954,7 +954,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
w2=w;
|
||||
h2=h;
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
x+=win_task->pix_left;
|
||||
y+=win_task->pix_top;
|
||||
}
|
||||
@@ -968,7 +968,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
if (x+w1<0) w1=-x;
|
||||
if (x+w2>win_task->pix_right+1)
|
||||
w2=win_task->pix_right+1-x;
|
||||
@@ -1028,7 +1028,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
}
|
||||
res+=dc->collision_cnt;
|
||||
} else {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
@@ -1380,7 +1380,7 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
Bool not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||
CTask *win_task;
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->scroll_x;
|
||||
y+=win_task->scroll_y;
|
||||
@@ -1389,7 +1389,7 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
y3=y;
|
||||
if (x3<0 || y3<0)
|
||||
goto gr_done;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
x3+=win_task->pix_left;
|
||||
y3+=win_task->pix_top;
|
||||
if (!(0<=x3<=win_task->pix_right) || !(0<=y3<=win_task->pix_bottom) ||
|
||||
@@ -1404,7 +1404,7 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
while (TRUE) {
|
||||
x3=x;
|
||||
if (x3&(FONT_WIDTH-1)==FONT_WIDTH-1) {
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
if (x3<0) break;
|
||||
x3+=win_task->pix_left;
|
||||
if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
|
||||
@@ -1413,7 +1413,7 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
} else
|
||||
if (!(0<=x3<dc->width))
|
||||
break;
|
||||
} else if (dc->flags & DCF_SCREEN_BITMAP)
|
||||
} else if (dc->flags & DCF_SCRN_BITMAP)
|
||||
x3+=win_task->pix_left;
|
||||
dst=dst2+x3;
|
||||
c=*dst;
|
||||
@@ -1447,7 +1447,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
I32 *db2;
|
||||
CTask *win_task;
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->scroll_x;
|
||||
y+=win_task->scroll_y;
|
||||
@@ -1458,7 +1458,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
y3=y;
|
||||
if (x3<0 || y3<0)
|
||||
goto gr_done;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
x3+=win_task->pix_left;
|
||||
y3+=win_task->pix_top;
|
||||
if (!(0<=x3<=win_task->pix_right) || !(0<=y3<=win_task->pix_bottom) ||
|
||||
@@ -1487,7 +1487,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
while (TRUE) {
|
||||
x3=x;
|
||||
if (!(x3&(FONT_WIDTH-1))) {
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
if (x3<0) break;
|
||||
x3+=win_task->pix_left;
|
||||
if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
|
||||
@@ -1497,7 +1497,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
if (!(0<=x3<dc->width))
|
||||
break;
|
||||
}
|
||||
} else if (dc->flags & DCF_SCREEN_BITMAP)
|
||||
} else if (dc->flags & DCF_SCRN_BITMAP)
|
||||
x3+=win_task->pix_left;
|
||||
|
||||
dst=dst2+x3;
|
||||
@@ -1558,7 +1558,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
} else
|
||||
break;
|
||||
}
|
||||
if (dc->flags & DCF_SCREEN_BITMAP)
|
||||
if (dc->flags & DCF_SCRN_BITMAP)
|
||||
*x1=x-1-win_task->scroll_x;
|
||||
else
|
||||
*x1=x-1;
|
||||
@@ -1566,7 +1566,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
while (TRUE) {
|
||||
x3=x;
|
||||
if (x3&(FONT_WIDTH-1)==FONT_WIDTH-1) {
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
if (x3<0) break;
|
||||
x3+=win_task->pix_left;
|
||||
if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
|
||||
@@ -1575,7 +1575,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
} else
|
||||
if (!(0<=x3<dc->width))
|
||||
break;
|
||||
} else if (dc->flags & DCF_SCREEN_BITMAP)
|
||||
} else if (dc->flags & DCF_SCRN_BITMAP)
|
||||
x3+=win_task->pix_left;
|
||||
|
||||
dst=dst2+x3;
|
||||
@@ -1656,7 +1656,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
return GrRect(dc,x1,y,x2-x1+1,1);
|
||||
}
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x1+=win_task->scroll_x;
|
||||
x2+=win_task->scroll_x;
|
||||
@@ -1685,7 +1685,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
} else
|
||||
i=0;
|
||||
j=0;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
x1+=win_task->pix_left;
|
||||
x2+=win_task->pix_left;
|
||||
if (x1>win_task->pix_right)
|
||||
@@ -1731,7 +1731,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
goto gr_done;
|
||||
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) ||
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) ||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x1,y))
|
||||
char_clear=TRUE;
|
||||
@@ -1799,7 +1799,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
db++;
|
||||
z+=dz;
|
||||
if (!(x1&(FONT_WIDTH-1)) && x1<=x2) {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP)||
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP)||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x1,y))
|
||||
char_clear=TRUE;
|
||||
@@ -1827,7 +1827,7 @@ public I64 GrVLine(CDC *dc=gr.dc,I64 x,I64 y1,I64 y2,I64 z1=0,I64 z2=0)
|
||||
return GrRect(dc,x,y1,1,y2-y1+1);
|
||||
}
|
||||
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x +=win_task->scroll_x;
|
||||
y1+=win_task->scroll_y;
|
||||
@@ -1856,7 +1856,7 @@ public I64 GrVLine(CDC *dc=gr.dc,I64 x,I64 y1,I64 y2,I64 z1=0,I64 z2=0)
|
||||
} else
|
||||
i=0;
|
||||
j=0;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
y1+=win_task->pix_top;
|
||||
y2+=win_task->pix_top;
|
||||
if (y1>win_task->pix_bottom)
|
||||
@@ -1902,7 +1902,7 @@ public I64 GrVLine(CDC *dc=gr.dc,I64 x,I64 y1,I64 y2,I64 z1=0,I64 z2=0)
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
goto gr_done;
|
||||
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) ||
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) ||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x,y1))
|
||||
char_clear=TRUE;
|
||||
@@ -1970,7 +1970,7 @@ public I64 GrVLine(CDC *dc=gr.dc,I64 x,I64 y1,I64 y2,I64 z1=0,I64 z2=0)
|
||||
db+=dc->width_internal;
|
||||
z+=dz;
|
||||
if (!(y1&(FONT_HEIGHT-1)) && y1<=y2) {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP)||
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP)||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x,y1))
|
||||
char_clear=TRUE;
|
||||
|
||||
+24
-24
@@ -373,13 +373,13 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files"
|
||||
#help_file "::/Doc/GRAFiles"
|
||||
#help_index "Graphics/Device Contexts;Graphics/GRA Files"
|
||||
public I64 GRAWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
{//TempleOS GRA File.
|
||||
#help_index "Graphics/GR Files"
|
||||
#help_file "::/Doc/GRFiles"
|
||||
#help_index "Graphics/Device Contexts;Graphics/GR Files"
|
||||
public I64 GRWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
{//TempleOS GR File.
|
||||
I64 size;
|
||||
U8 *st=DftExt(filename,"GRA.Z"),
|
||||
U8 *st=DftExt(filename,"GR.Z"),
|
||||
*src=DCSave(dc,&size,dcsf_flags);
|
||||
FileWrite(st,src,size);
|
||||
Free(st);
|
||||
@@ -387,10 +387,10 @@ public I64 GRAWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
return size;
|
||||
}
|
||||
|
||||
public CDC *GRARead(U8 *filename,CTask *task=NULL)
|
||||
{//TempleOS GRA File.
|
||||
public CDC *GRRead(U8 *filename,CTask *task=NULL)
|
||||
{//TempleOS GR File.
|
||||
CDC *dc=NULL;
|
||||
U8 *st=DftExt(filename,"GRA.Z"),
|
||||
U8 *st=DftExt(filename,"GR.Z"),
|
||||
*src=FileRead(st);
|
||||
if (src)
|
||||
dc=DCLoad(src,,task);
|
||||
@@ -399,27 +399,27 @@ public CDC *GRARead(U8 *filename,CTask *task=NULL)
|
||||
return dc;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/GRA Files;DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocGRA(CDoc *doc=NULL,U8 *filename)
|
||||
{//Put a GRA file into a document as asprite.
|
||||
CDC *dc=GRARead(filename);
|
||||
#help_index "Graphics/Sprite;Graphics/GR Files;DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocGR(CDoc *doc=NULL,U8 *filename)
|
||||
{//Put a GR file into a document as asprite.
|
||||
CDC *dc=GRRead(filename);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
DocSprite(doc,elems);
|
||||
Free(elems);
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
#help_index "Graphics/Device Contexts;Graphics/Screen"
|
||||
public CDC *DCScreenCapture(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
{//Capture screen to a device context.
|
||||
#help_index "Graphics/Device Contexts;Graphics/Scrn"
|
||||
public CDC *DCScrnCapture(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
{//Capture scrn to a device context.
|
||||
CDC *dc;
|
||||
U8 *dst;
|
||||
WinMgrSync(2,TRUE);
|
||||
Refresh(2,TRUE);
|
||||
if (include_zoom)
|
||||
dc=DCCopy(gr.screen_image,task);
|
||||
dc=DCCopy(gr.scrn_image,task);
|
||||
else
|
||||
dc=DCCopy(gr.dc1,task);
|
||||
dc->flags&=~DCF_SCREEN_BITMAP;
|
||||
dc->flags&=~DCF_SCRN_BITMAP;
|
||||
dst=MAlloc(dc->width_internal*dc->height,task);
|
||||
//Pick background color that never occurs. COLOR_INVALID
|
||||
GrBitMap4ToBitMap8(dst,dc->body,
|
||||
@@ -429,12 +429,12 @@ public CDC *DCScreenCapture(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
return dc;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files;Graphics/Screen"
|
||||
public I64 GRAScreenCapture(U8 *filename,Bool include_zoom=TRUE)
|
||||
{//Capture screen to a TempleOS GRA File.
|
||||
#help_index "Graphics/GR Files;Graphics/Scrn"
|
||||
public I64 GRScrnCapture(U8 *filename,Bool include_zoom=TRUE)
|
||||
{//Capture scrn to a TempleOS GR File.
|
||||
I64 size;
|
||||
CDC *dc=DCScreenCapture(include_zoom);
|
||||
size=GRAWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
CDC *dc=DCScrnCapture(include_zoom);
|
||||
size=GRWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
}
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
#help_index "Graphics/Screen"
|
||||
#help_index "Graphics/Scrn"
|
||||
|
||||
U0 CtrlAltZ(I64 sc)
|
||||
{
|
||||
@@ -10,9 +10,9 @@ U0 CtrlAltZ(I64 sc)
|
||||
CtrlAltCBSet('Z',&CtrlAltZ,"Cmd /Zoom In",
|
||||
"Cmd /Zoom Out");
|
||||
|
||||
U0 Screen2Clipboard(I64)
|
||||
U0 Scrn2Clipboard(I64)
|
||||
{
|
||||
CDC *dc=DCScreenCapture;
|
||||
CDC *dc=DCScrnCapture;
|
||||
U8 *elems=DC2Sprite(dc);
|
||||
Bool unlock_doc=DocLock(sys_clipboard_doc);
|
||||
ClipboardDel;
|
||||
@@ -24,6 +24,6 @@ U0 Screen2Clipboard(I64)
|
||||
}
|
||||
U0 CtrlAltS(I64)
|
||||
{
|
||||
Spawn(&Screen2Clipboard);
|
||||
Spawn(&Scrn2Clipboard);
|
||||
}
|
||||
CtrlAltCBSet('S',&CtrlAltS,"Cmd /Screen Shot to Clipboard");
|
||||
CtrlAltCBSet('S',&CtrlAltS,"Cmd /Scrn Shot to Clipboard");
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
public class CGrGlbls
|
||||
{
|
||||
I64 *to_8_bits,*to_8_colors;
|
||||
CDC *screen_image, //Read only.
|
||||
CDC *scrn_image, //Read only.
|
||||
*dc, //Persistent
|
||||
*dc1,
|
||||
*dc2, //Updated every refresh
|
||||
@@ -19,7 +19,7 @@ public class CGrGlbls
|
||||
I64 highest_uncovered;
|
||||
U16 *vga_text_cache;
|
||||
I64 pan_text_x,pan_text_y; //[-7,7]
|
||||
U0 (*fp_final_screen_update)(CDC *dc);//Mouse cursor is handled here.
|
||||
U0 (*fp_final_scrn_update)(CDC *dc);//Mouse cursor is handled here.
|
||||
U0 (*fp_wall_paper)(CTask *task);
|
||||
U0 (*fp_draw_input_ptr)(CDC *dc,I64 x,I64 y);
|
||||
U0 (*fp_draw_grab_input_ptr)(CDC *dc,I64 x,I64 y,Bool closed);
|
||||
@@ -33,9 +33,9 @@ public class CGrGlbls
|
||||
I8 circle_lo[GR_NUM_PEN_BRUSHES][GR_NUM_PEN_BRUSHES],
|
||||
circle_hi[GR_NUM_PEN_BRUSHES][GR_NUM_PEN_BRUSHES];
|
||||
|
||||
#define GR_MAX_SCREEN_ZOOM 8
|
||||
U8 *screen_zoom_tables[GR_MAX_SCREEN_ZOOM+1];
|
||||
I64 screen_zoom,sx,sy;
|
||||
#define GR_MAX_SCRN_ZOOM 8
|
||||
U8 *scrn_zoom_tables[GR_MAX_SCRN_ZOOM+1];
|
||||
I64 scrn_zoom,sx,sy;
|
||||
|
||||
//When zoomed, this keeps the mouse centered.
|
||||
Bool continuous_scroll,
|
||||
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
#help_index "Graphics/Screen"
|
||||
#help_index "Graphics/Scrn"
|
||||
|
||||
U0 GrSetUpTables()
|
||||
{
|
||||
@@ -75,10 +75,10 @@ U0 GrSetUpTables()
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
//Virtual Box crashes on the following for some reason.
|
||||
// MemSet(text.vga_alias,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
MemSet(gr.scrn_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
}
|
||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++) {
|
||||
dst=gr.screen_zoom_tables[i]=MAlloc(256*i);
|
||||
for (i=1;i<=GR_MAX_SCRN_ZOOM;i++) {
|
||||
dst=gr.scrn_zoom_tables[i]=MAlloc(256*i);
|
||||
for (j=0;j<256;j++) {
|
||||
m=0;
|
||||
for (k=0;k<8;k++) {
|
||||
@@ -93,7 +93,7 @@ U0 GrSetUpTables()
|
||||
}
|
||||
}
|
||||
|
||||
#help_index "Graphics/Screen;Windows"
|
||||
#help_index "Graphics/Scrn;Windows"
|
||||
|
||||
U0 WinZBufFill(CTask *task)
|
||||
{//Not public
|
||||
@@ -175,7 +175,7 @@ U0 GrInit2()
|
||||
MemSet(&gr,0,sizeof(CGrGlbls));
|
||||
gr.sprite_hash=HashTableNew(512);
|
||||
HashDefineLstAdd("ST_SPRITE_ELEM_CODES",SPHT_ELEM_CODE,gr.sprite_hash);
|
||||
gr.screen_zoom=1;
|
||||
gr.scrn_zoom=1;
|
||||
|
||||
PaletteSetStd;
|
||||
fp_set_std_palette=&PaletteSetStd;
|
||||
@@ -191,19 +191,19 @@ U0 GrInit2()
|
||||
gr.win_z_buf=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
|
||||
gr.dc2=DCNew(GR_WIDTH,GR_HEIGHT);
|
||||
gr.dc2->flags|=DCF_SCREEN_BITMAP;
|
||||
gr.dc2->flags|=DCF_SCRN_BITMAP;
|
||||
gr.dc_cache=DCNew(GR_WIDTH,GR_HEIGHT);
|
||||
|
||||
gr.dc=DCNew(GR_WIDTH,GR_HEIGHT);
|
||||
gr.dc->flags|=DCF_SCREEN_BITMAP|DCF_ON_TOP;
|
||||
gr.dc->flags|=DCF_SCRN_BITMAP|DCF_ON_TOP;
|
||||
DCFill;
|
||||
|
||||
gr.dc1=DCNew(GR_WIDTH,GR_HEIGHT);
|
||||
gr.dc1->flags|=DCF_SCREEN_BITMAP;
|
||||
gr.dc1->flags|=DCF_SCRN_BITMAP;
|
||||
|
||||
gr.screen_image=DCNew(GR_WIDTH,GR_HEIGHT); //4-bit
|
||||
gr.scrn_image=DCNew(GR_WIDTH,GR_HEIGHT); //4-bit
|
||||
gr.zoomed_dc =DCNew(GR_WIDTH,GR_HEIGHT); //4-bit
|
||||
gr.zoomed_dc->flags|=DCF_SCREEN_BITMAP;
|
||||
gr.zoomed_dc->flags|=DCF_SCRN_BITMAP;
|
||||
}
|
||||
|
||||
GrInit2;
|
||||
+42
-42
@@ -277,8 +277,8 @@ public U0 DCReflect(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Math"
|
||||
#define SCALE1 24
|
||||
#define SCALE2 8
|
||||
#define GR_SCALE1_BITS 24
|
||||
#define GR_SCALE2_BITS 8
|
||||
public Bool Circle(U8 *aux_data,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),
|
||||
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
||||
@@ -288,13 +288,13 @@ public Bool Circle(U8 *aux_data,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||
F64 t;
|
||||
if (radius<=0||!step) return TRUE;
|
||||
t=1.0/radius;
|
||||
c=1<<SCALE1*Cos(t);
|
||||
c=1<<GR_SCALE1_BITS*Cos(t);
|
||||
if (step<0) {
|
||||
step=-step;
|
||||
s2=1<<SCALE1*Sin(t);
|
||||
s2=1<<GR_SCALE1_BITS*Sin(t);
|
||||
s1=-s2;
|
||||
} else {
|
||||
s1=1<<SCALE1*Sin(t);
|
||||
s1=1<<GR_SCALE1_BITS*Sin(t);
|
||||
s2=-s1;
|
||||
}
|
||||
if (start_radians) {
|
||||
@@ -304,14 +304,14 @@ public Bool Circle(U8 *aux_data,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||
x=radius;
|
||||
y=0;
|
||||
}
|
||||
x<<=SCALE2;
|
||||
y<<=SCALE2;
|
||||
x<<=GR_SCALE2_BITS;
|
||||
y<<=GR_SCALE2_BITS;
|
||||
for (i=0;i<=len;i+=step) {
|
||||
if (!(*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
if (!(*fp_plot)(aux_data,cx+x>>GR_SCALE2_BITS,cy+y>>GR_SCALE2_BITS,cz))
|
||||
return FALSE;
|
||||
for (j=0;j<step;j++) {
|
||||
x1=(c*x+s1*y)>>SCALE1;
|
||||
y1=(s2*x+c*y)>>SCALE1;
|
||||
x1=(c*x+s1*y)>>GR_SCALE1_BITS;
|
||||
y1=(s2*x+c*y)>>GR_SCALE1_BITS;
|
||||
x=x1; y=y1;
|
||||
}
|
||||
}
|
||||
@@ -336,18 +336,18 @@ public Bool Ellipse(U8 *aux_data,I64 cx,I64 cy,I64 cz,
|
||||
len=Ceil(len_radians*y_radius);
|
||||
}
|
||||
|
||||
c=1<<SCALE1*Cos(t);
|
||||
c=1<<GR_SCALE1_BITS*Cos(t);
|
||||
if (step<0) {
|
||||
step=-step;
|
||||
s2=1<<SCALE1*Sin(t);
|
||||
s2=1<<GR_SCALE1_BITS*Sin(t);
|
||||
s1=-s2;
|
||||
} else {
|
||||
s1=1<<SCALE1*Sin(t);
|
||||
s1=1<<GR_SCALE1_BITS*Sin(t);
|
||||
s2=-s1;
|
||||
}
|
||||
|
||||
c2=1<<SCALE1*Cos(rot_angle);
|
||||
s12=1<<SCALE1*Sin(rot_angle);
|
||||
c2=1<<GR_SCALE1_BITS*Cos(rot_angle);
|
||||
s12=1<<GR_SCALE1_BITS*Sin(rot_angle);
|
||||
s22=-s12;
|
||||
|
||||
if (start_radians) {
|
||||
@@ -357,29 +357,29 @@ public Bool Ellipse(U8 *aux_data,I64 cx,I64 cy,I64 cz,
|
||||
x=x_radius;
|
||||
y=0;
|
||||
}
|
||||
x<<=SCALE2;
|
||||
y<<=SCALE2;
|
||||
x<<=GR_SCALE2_BITS;
|
||||
y<<=GR_SCALE2_BITS;
|
||||
x2=x;
|
||||
y2=y;
|
||||
|
||||
y1=y2*y_radius/x_radius;
|
||||
x=(c2*x2+s12*y1)>>SCALE1;
|
||||
y=(s22*x2+c2*y1)>>SCALE1;
|
||||
x=(c2*x2+s12*y1)>>GR_SCALE1_BITS;
|
||||
y=(s22*x2+c2*y1)>>GR_SCALE1_BITS;
|
||||
|
||||
for (i=0;i<=len;i+=step) {
|
||||
if ((x>>SCALE2!=_x || y>>SCALE2!=_y || first) &&
|
||||
!(*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
if ((x>>GR_SCALE2_BITS!=_x || y>>GR_SCALE2_BITS!=_y || first) &&
|
||||
!(*fp_plot)(aux_data,cx+x>>GR_SCALE2_BITS,cy+y>>GR_SCALE2_BITS,cz))
|
||||
return FALSE;
|
||||
|
||||
_x=x>>SCALE2; _y=y>>SCALE2; first=FALSE;
|
||||
_x=x>>GR_SCALE2_BITS; _y=y>>GR_SCALE2_BITS; first=FALSE;
|
||||
for (j=0;j<step;j++) {
|
||||
x1=(c*x2+s1*y2)>>SCALE1;
|
||||
y1=(s2*x2+c*y2)>>SCALE1;
|
||||
x1=(c*x2+s1*y2)>>GR_SCALE1_BITS;
|
||||
y1=(s2*x2+c*y2)>>GR_SCALE1_BITS;
|
||||
x2=x1;
|
||||
y2=y1;
|
||||
y1=y1*y_radius/x_radius;
|
||||
x=(c2*x1+s12*y1)>>SCALE1;
|
||||
y=(s22*x1+c2*y1)>>SCALE1;
|
||||
x=(c2*x1+s12*y1)>>GR_SCALE1_BITS;
|
||||
y=(s22*x1+c2*y1)>>GR_SCALE1_BITS;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@@ -401,13 +401,13 @@ public Bool RegPoly(U8 *aux_data,I64 cx,I64 cy,I64 cz,
|
||||
angle_step=2*ã/sides;
|
||||
n=len_radians*sides/(2*ã);
|
||||
|
||||
s1=1<<SCALE1*Sin(angle_step);
|
||||
s1=1<<GR_SCALE1_BITS*Sin(angle_step);
|
||||
s2=-s1;
|
||||
c=1<<SCALE1*Cos(angle_step);
|
||||
c=1<<GR_SCALE1_BITS*Cos(angle_step);
|
||||
|
||||
s12=1<<SCALE1*Sin(rot_angle);
|
||||
s12=1<<GR_SCALE1_BITS*Sin(rot_angle);
|
||||
s22=-s12;
|
||||
c2=1<<SCALE1*Cos(rot_angle);
|
||||
c2=1<<GR_SCALE1_BITS*Cos(rot_angle);
|
||||
|
||||
if (start_radians) {
|
||||
x=x_radius*Cos(start_radians);
|
||||
@@ -416,27 +416,27 @@ public Bool RegPoly(U8 *aux_data,I64 cx,I64 cy,I64 cz,
|
||||
x=x_radius;
|
||||
y=0;
|
||||
}
|
||||
x<<=SCALE2;
|
||||
y<<=SCALE2;
|
||||
x<<=GR_SCALE2_BITS;
|
||||
y<<=GR_SCALE2_BITS;
|
||||
x2=x;
|
||||
y2=y;
|
||||
|
||||
y1=y2*y_radius/x_radius;
|
||||
x=(c2*x2+s12*y1)>>SCALE1;
|
||||
y=(s22*x2+c2*y1)>>SCALE1;
|
||||
x=(c2*x2+s12*y1)>>GR_SCALE1_BITS;
|
||||
y=(s22*x2+c2*y1)>>GR_SCALE1_BITS;
|
||||
|
||||
xx1=cx+x>>SCALE2;
|
||||
yy1=cy+y>>SCALE2;
|
||||
xx1=cx+x>>GR_SCALE2_BITS;
|
||||
yy1=cy+y>>GR_SCALE2_BITS;
|
||||
for (i=0;i<n;i++) {
|
||||
x1=(c*x2+s1*y2)>>SCALE1;
|
||||
y1=(s2*x2+c*y2)>>SCALE1;
|
||||
x1=(c*x2+s1*y2)>>GR_SCALE1_BITS;
|
||||
y1=(s2*x2+c*y2)>>GR_SCALE1_BITS;
|
||||
x2=x1;
|
||||
y2=y1;
|
||||
y1=y1*y_radius/x_radius;
|
||||
x=(c2*x1+s12*y1)>>SCALE1;
|
||||
y=(s22*x1+c2*y1)>>SCALE1;
|
||||
xx2=cx+x>>SCALE2;
|
||||
yy2=cy+y>>SCALE2;
|
||||
x=(c2*x1+s12*y1)>>GR_SCALE1_BITS;
|
||||
y=(s22*x1+c2*y1)>>GR_SCALE1_BITS;
|
||||
xx2=cx+x>>GR_SCALE2_BITS;
|
||||
yy2=cy+y>>GR_SCALE2_BITS;
|
||||
if (!Line(aux_data,xx1,yy1,cz,xx2,yy2,cz,fp_plot,step))
|
||||
return FALSE;
|
||||
xx1=xx2; yy1=yy2;
|
||||
|
||||
+14
-14
@@ -2,13 +2,13 @@
|
||||
|
||||
public Bool GrClamp(CDC *dc=gr.dc,I64 *left,I64 *top,I64 *right,I64 *bottom,
|
||||
I64 width=0,I64 height=0)
|
||||
{//Returns screen, not window coordinates.
|
||||
{//Returns scrn, not window coordinates.
|
||||
CTask *win_task;
|
||||
*left=0;
|
||||
*top=0;
|
||||
*right=dc->width-1;
|
||||
*bottom=dc->height-1;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
if (GR_WIDTH-1<*right)
|
||||
*right=GR_WIDTH-1;
|
||||
@@ -32,11 +32,11 @@ public Bool GrClamp(CDC *dc=gr.dc,I64 *left,I64 *top,I64 *right,I64 *bottom,
|
||||
|
||||
Bool DCClipLine(CDC *dc=gr.dc,I64 *x1,I64 *y1,I64 *x2,I64 *y2,
|
||||
I64 width=0,I64 height=0)
|
||||
{//Also converts window to screen coordinates
|
||||
{//Also converts window to scrn coordinates
|
||||
I64 left,top,right,bottom;
|
||||
CTask *win_task;
|
||||
if (GrClamp(dc,&left,&top,&right,&bottom,width,height)) {
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
*x1+=win_task->pix_left+win_task->scroll_x;
|
||||
*y1+=win_task->pix_top+win_task->scroll_y;
|
||||
@@ -60,12 +60,12 @@ public Bool GrPlot(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
dc->color.c0.rop=ROPB_MONO;
|
||||
GrBlot(dc,x,y,dc->brush);
|
||||
dc->color=old_color;
|
||||
} else if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
} else if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
if (win_task->pix_left<=x<=win_task->pix_right &&
|
||||
win_task->pix_top <=y<=win_task->pix_bottom &&
|
||||
win_task->pix_top<=y<=win_task->pix_bottom &&
|
||||
0<=x<dc->width && 0<=y<dc->height &&
|
||||
(win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
@@ -91,7 +91,7 @@ Bool GrPlot1(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
else
|
||||
GrBlot(dc,x,y,dc->brush);
|
||||
dc->color=old_color;
|
||||
} else if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
} else if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
@@ -110,9 +110,9 @@ Bool GrPlot1(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
|
||||
public I64 GrPeek(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
{//2D. Clipping but no transformation.
|
||||
//Returns pix color or -1 if off-screen or covered.
|
||||
//Returns pix color or -1 if off-scrn or covered.
|
||||
CTask *win_task;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
@@ -512,7 +512,7 @@ public Bool GrPlot3(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
}
|
||||
}
|
||||
if (record) {
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
@@ -550,7 +550,7 @@ gr_done:
|
||||
Bool GrLinePlot0(CDC *dc,I64 x,I64 y,I64 z)
|
||||
{//This is a callback.
|
||||
CTask *win_task=dc->win_task;
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) ||
|
||||
if (!(dc->flags & DCF_SCRN_BITMAP) ||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x,y)) {
|
||||
@@ -1204,7 +1204,7 @@ normal_image:
|
||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||
x+=dw;
|
||||
}
|
||||
res=1; //TODO: check off screen
|
||||
res=1; //TODO: check off scrn
|
||||
} else
|
||||
res=GrBlot(dc,x1,y1,img);
|
||||
gr_done:
|
||||
@@ -1415,7 +1415,7 @@ public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||
|
||||
min=0;
|
||||
max=dc->height;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
min-=win_task->scroll_y+win_task->pix_top;
|
||||
max-=win_task->scroll_y+win_task->pix_top;
|
||||
@@ -1623,7 +1623,7 @@ public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||
|
||||
min=0;
|
||||
max=dc->width;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (dc->flags & DCF_SCRN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
min-=win_task->scroll_x+win_task->pix_left;
|
||||
max-=win_task->scroll_x+win_task->pix_left;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#help_index "Graphics/Screen"
|
||||
#help_index "Graphics/Scrn"
|
||||
|
||||
U0 GrUpdateTaskODEs(CTask *task)
|
||||
{
|
||||
sys_task_being_screen_updated=task;
|
||||
sys_task_being_scrn_updated=task;
|
||||
try
|
||||
ODEsUpdate(task);
|
||||
catch {
|
||||
@@ -12,14 +12,14 @@ U0 GrUpdateTaskODEs(CTask *task)
|
||||
Sleep(3000);
|
||||
VGAFlush;
|
||||
}
|
||||
sys_task_being_screen_updated=NULL;
|
||||
sys_task_being_scrn_updated=NULL;
|
||||
}
|
||||
|
||||
U0 GrUpdateTaskWin(CTask *task)
|
||||
{ //Draw a win. Only core0 tasks have a win.
|
||||
{ //Draw a win. Only Core0 tasks have a win.
|
||||
CDC *dc;
|
||||
CD3I64 saved_scroll;
|
||||
sys_task_being_screen_updated=task;
|
||||
sys_task_being_scrn_updated=task;
|
||||
try {
|
||||
if (!Bt(&task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextBorder(Fs,task->win_left,task->win_right,task->win_top,
|
||||
@@ -52,7 +52,7 @@ U0 GrUpdateTaskWin(CTask *task)
|
||||
VGAFlush;
|
||||
}
|
||||
}
|
||||
sys_task_being_screen_updated=NULL;
|
||||
sys_task_being_scrn_updated=NULL;
|
||||
}
|
||||
|
||||
U0 GrUpdateTasks()
|
||||
@@ -64,7 +64,7 @@ U0 GrUpdateTasks()
|
||||
if (Bt(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0))
|
||||
WinZBufUpdate;
|
||||
task1=task=sys_winmgr_task;
|
||||
do { //Loop through core0 tasks.
|
||||
do { //Loop through Core0 tasks.
|
||||
if (!TaskValidate(task)) break;
|
||||
if (Bt(&task->display_flags,DISPLAYf_SHOW) &&
|
||||
Bt(gr.win_uncovered_bitmap,task->win_z_num))
|
||||
@@ -89,62 +89,62 @@ U0 GrUpdateTasks()
|
||||
winmgr.last_ode_time=winmgr.ode_time;
|
||||
ode_alloced_factor=LowPass1(0.1,ode_alloced_factor,
|
||||
Clamp(Gs->idle_factor-0.1,0.2,0.8),1/winmgr.fps);
|
||||
sys_task_being_screen_updated=NULL;
|
||||
sys_task_being_scrn_updated=NULL;
|
||||
}
|
||||
|
||||
U0 GrFixZoomScale()
|
||||
{
|
||||
gr.screen_zoom=ClampI64(gr.screen_zoom,1,GR_MAX_SCREEN_ZOOM);
|
||||
if (gr.screen_zoom==1) {
|
||||
gr.scrn_zoom=ClampI64(gr.scrn_zoom,1,GR_MAX_SCRN_ZOOM);
|
||||
if (gr.scrn_zoom==1) {
|
||||
gr.sx=0;
|
||||
gr.sy=0;
|
||||
} else {
|
||||
gr.sx=ClampI64(gr.sx,0,GR_WIDTH-GR_WIDTH/gr.screen_zoom)&~7;
|
||||
gr.sy=ClampI64(gr.sy,0,GR_HEIGHT-GR_HEIGHT/gr.screen_zoom);
|
||||
gr.sx=ClampI64(gr.sx,0,GR_WIDTH-GR_WIDTH/gr.scrn_zoom)&~7;
|
||||
gr.sy=ClampI64(gr.sy,0,GR_HEIGHT-GR_HEIGHT/gr.scrn_zoom);
|
||||
}
|
||||
}
|
||||
|
||||
public U0 GrScaleZoom(F64 scale)
|
||||
{//Multiply zoom factor larger or smaller.
|
||||
F64 s=gr.screen_zoom;
|
||||
gr.screen_zoom=gr.screen_zoom*scale;
|
||||
F64 s=gr.scrn_zoom;
|
||||
gr.scrn_zoom=gr.scrn_zoom*scale;
|
||||
GrFixZoomScale;
|
||||
s/=gr.screen_zoom;
|
||||
s/=gr.scrn_zoom;
|
||||
ip.scale.x*=s;
|
||||
ip.scale.y*=s;
|
||||
ip.scale.z*=s;
|
||||
ip.offset.x=ip.pos.x-(ip.pos.x-ip.offset.x)*s;
|
||||
ip.offset.y=ip.pos.y-(ip.pos.y-ip.offset.y)*s;
|
||||
ip.offset.z=ip.pos.z-(ip.pos.z-ip.offset.z)*s;
|
||||
gr.sx=ip.pos.x-gr.zoomed_dc->width >>1/gr.screen_zoom;
|
||||
gr.sy=ip.pos.y-gr.zoomed_dc->height>>1/gr.screen_zoom;
|
||||
gr.sx=ip.pos.x-gr.zoomed_dc->width >>1/gr.scrn_zoom;
|
||||
gr.sy=ip.pos.y-gr.zoomed_dc->height>>1/gr.scrn_zoom;
|
||||
GrFixZoomScale;
|
||||
}
|
||||
|
||||
U0 GrZoomInScreen()
|
||||
U0 GrZoomInScrn()
|
||||
{
|
||||
GrFixZoomScale;
|
||||
I64 plane,row,col,k,l,
|
||||
d2=gr.zoomed_dc->width>>3/gr.screen_zoom,
|
||||
d2=gr.zoomed_dc->width>>3/gr.scrn_zoom,
|
||||
d4=gr.zoomed_dc->width_internal>>3,
|
||||
d5=d4-d2*gr.screen_zoom,
|
||||
d3=gr.zoomed_dc->height/gr.screen_zoom,
|
||||
d5=d4-d2*gr.scrn_zoom,
|
||||
d3=gr.zoomed_dc->height/gr.scrn_zoom,
|
||||
d6=(gr.zoomed_dc->height-d3)*gr.dc1->width_internal>>3,
|
||||
d7=gr.zoomed_dc->height%gr.screen_zoom*d4;
|
||||
U8 *src,*src2,*dst,*src3,*map=gr.screen_zoom_tables[gr.screen_zoom];
|
||||
d7=gr.zoomed_dc->height%gr.scrn_zoom*d4;
|
||||
U8 *src,*src2,*dst,*src3,*map=gr.scrn_zoom_tables[gr.scrn_zoom];
|
||||
|
||||
src=gr.dc1->body+gr.sx>>3+gr.sy*gr.dc1->width_internal>>3;
|
||||
dst=gr.zoomed_dc->body;
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
row=d3;
|
||||
while (row--) {
|
||||
k=gr.screen_zoom;
|
||||
k=gr.scrn_zoom;
|
||||
while (k--) {
|
||||
src2=src;
|
||||
col=d2;
|
||||
while (col--) {
|
||||
src3=&map[*src2++];
|
||||
l=gr.screen_zoom;
|
||||
l=gr.scrn_zoom;
|
||||
while (l--) {
|
||||
*dst++=*src3;
|
||||
src3+=256;
|
||||
@@ -367,13 +367,13 @@ U0 GrUpdateVGAGraphics()
|
||||
{//Update Graphic Card
|
||||
I64 row,plane,d=gr.zoomed_dc->width_internal>>6;
|
||||
U32 *src,*vga,*dst;
|
||||
if (gr.screen_zoom==1)
|
||||
if (gr.scrn_zoom==1)
|
||||
src=gr.dc1->body;
|
||||
else {
|
||||
GrZoomInScreen;
|
||||
GrZoomInScrn;
|
||||
src=gr.zoomed_dc->body;
|
||||
}
|
||||
dst=gr.screen_image->body;
|
||||
dst=gr.scrn_image->body;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
@@ -395,8 +395,8 @@ U0 GrUpdateVGAGraphics()
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrUpdateScreen()
|
||||
{//Called by the Window Manager $LK,"HERE",A="FF:::/Adam/WinB.HC,GrUpdateScreen"$, 30 times a second.
|
||||
U0 GrUpdateScrn()
|
||||
{//Called by the Window Manager $LK,"HERE",A="FF:::/Adam/WinMgr.HC,GrUpdateScrn"$, 30 times a second.
|
||||
CDC *dc;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
GrUpdateTasks;
|
||||
@@ -409,8 +409,8 @@ U0 GrUpdateScreen()
|
||||
|
||||
dc=DCAlias(gr.dc2,Fs);
|
||||
dc->flags|=DCF_ON_TOP;
|
||||
if (gr.fp_final_screen_update)
|
||||
(*gr.fp_final_screen_update)(dc);
|
||||
if (gr.fp_final_scrn_update)
|
||||
(*gr.fp_final_scrn_update)(dc);
|
||||
DCDel(dc);
|
||||
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
+122
-122
@@ -18,7 +18,7 @@ one of the most complicated.
|
||||
public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,
|
||||
Bool just_one_elem=FALSE)
|
||||
{//Plot a sprite into a CDC.
|
||||
CSprite *tempg=elems-offset(CSprite.start);
|
||||
CSprite *tmpg=elems-offset(CSprite.start);
|
||||
I64 i,j,k,x1,y1,z1,x2,y2,
|
||||
cur_sprite_elem_num=0,*old_r,*r2,
|
||||
old_flags=dc->flags,
|
||||
@@ -33,19 +33,19 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,
|
||||
dc->nearest_sprite_elem_num=0;
|
||||
dc->nearest_dist=MAX_I64;
|
||||
}
|
||||
while (tempg->type) {
|
||||
while (tmpg->type) {
|
||||
dc->cur_sprite_elem_num=cur_sprite_elem_num;
|
||||
switch (tempg->type) {
|
||||
switch (tmpg->type) {
|
||||
case SPT_COLOR:
|
||||
dc->color=dc->color&~(COLORROP_COLORS_MASK|ROPF_DITHER)|tempg->c.color;
|
||||
dc->color=dc->color&~(COLORROP_COLORS_MASK|ROPF_DITHER)|tmpg->c.color;
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
dc->color=dc->color&~COLORROP_COLORS_MASK|
|
||||
tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
tmpg->d.dither_color.u8[0]|
|
||||
tmpg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
dc->pen_width=tempg->w.width;
|
||||
dc->pen_width=tmpg->w.width;
|
||||
DCPenWidthScale(dc);
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
@@ -65,94 +65,94 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
break;
|
||||
case SPT_PT:
|
||||
GrPlot3(dc,tempg->p.x1+x,tempg->p.y1+y,z);
|
||||
GrPlot3(dc,tmpg->p.x1+x,tmpg->p.y1+y,z);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
GrPrint3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,"%s",tempg->ps.st);
|
||||
GrPrint3(dc,tmpg->ps.x1+x,tmpg->ps.y1+y,z,"%s",tmpg->ps.st);
|
||||
break;
|
||||
case SPT_TEXT_BOX:
|
||||
GrTextBox3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,tempg->ps.st);
|
||||
GrTextBox3(dc,tmpg->ps.x1+x,tmpg->ps.y1+y,z,tmpg->ps.st);
|
||||
break;
|
||||
case SPT_TEXT_DIAMOND:
|
||||
GrTextDiamond3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,tempg->ps.st);
|
||||
GrTextDiamond3(dc,tmpg->ps.x1+x,tmpg->ps.y1+y,z,tmpg->ps.st);
|
||||
break;
|
||||
case SPT_FLOOD_FILL:
|
||||
GrFloodFill3(dc,tempg->p.x1+x,tempg->p.y1+y,z,FALSE);
|
||||
GrFloodFill3(dc,tmpg->p.x1+x,tmpg->p.y1+y,z,FALSE);
|
||||
break;
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
i=dc->color;
|
||||
dc->color=dc->color.c0;
|
||||
GrFloodFill3(dc,tempg->p.x1+x,tempg->p.y1+y,z,TRUE);
|
||||
GrFloodFill3(dc,tmpg->p.x1+x,tmpg->p.y1+y,z,TRUE);
|
||||
dc->color=i;
|
||||
break;
|
||||
case SPT_SHIFT:
|
||||
x+=tempg->p.x1;
|
||||
y+=tempg->p.y1;
|
||||
x+=tmpg->p.x1;
|
||||
y+=tmpg->p.y1;
|
||||
break;
|
||||
case SPT_LINE:
|
||||
GrLine3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
GrLine3(dc,tmpg->pp.x1+x,tmpg->pp.y1+y,z,
|
||||
tmpg->pp.x2+x,tmpg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
GrArrow3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
GrArrow3(dc,tmpg->pp.x1+x,tmpg->pp.y1+y,z,
|
||||
tmpg->pp.x2+x,tmpg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (DCSymmetry3Set(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z+1))
|
||||
if (DCSymmetry3Set(dc,tmpg->pp.x1+x,tmpg->pp.y1+y,z,
|
||||
tmpg->pp.x2+x,tmpg->pp.y2+y,z,
|
||||
tmpg->pp.x2+x,tmpg->pp.y2+y,z+1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
img=CAlloc(sizeof(CDC));
|
||||
img->width=tempg->pwhu.width;
|
||||
img->width_internal=(tempg->pwhu.width+7)&~7;
|
||||
img->height=tempg->pwhu.height;
|
||||
img->body=&tempg->pwhu.u;
|
||||
img->width=tmpg->pwhu.width;
|
||||
img->width_internal=(tmpg->pwhu.width+7)&~7;
|
||||
img->height=tmpg->pwhu.height;
|
||||
img->body=&tmpg->pwhu.u;
|
||||
img->dc_signature=DCS_SIGNATURE_VAL;
|
||||
GrBlot3(dc,tempg->pwhu.x1+x,tempg->pwhu.y1+y,z,img);
|
||||
GrBlot3(dc,tmpg->pwhu.x1+x,tmpg->pwhu.y1+y,z,img);
|
||||
Free(img);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
GrRect3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
GrRect3(dc,tmpg->pp.x1+x,tmpg->pp.y1+y,z,
|
||||
tmpg->pp.x2-tmpg->pp.x1,tmpg->pp.y2-tmpg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
x1=tempg->ppa.x1+x;
|
||||
y1=tempg->ppa.y1+y;
|
||||
x1=tmpg->ppa.x1+x;
|
||||
y1=tmpg->ppa.y1+y;
|
||||
z1=z;
|
||||
Mat4x4MulXYZ(dc->r,&x1,&y1,&z1);
|
||||
old_r=dc->r;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
r2=Mat4x4IdentNew;
|
||||
Mat4x4RotZ(r2,-tempg->ppa.angle);
|
||||
Mat4x4RotZ(r2,-tmpg->ppa.angle);
|
||||
Mat4x4TranslationEqu(r2,x1,y1,z1);
|
||||
DCMat4x4Set(dc,Mat4x4MulMat4x4New(old_r,r2));
|
||||
GrRect3(dc,0,0,0,
|
||||
tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1);
|
||||
tmpg->ppa.x2-tmpg->ppa.x1,tmpg->ppa.y2-tmpg->ppa.y1);
|
||||
Free(dc->r);
|
||||
Free(r2);
|
||||
DCMat4x4Set(dc,old_r);
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
GrCircle3(dc,tempg->pr.x1+x,tempg->pr.y1+y,z,tempg->pr.radius);
|
||||
GrCircle3(dc,tmpg->pr.x1+x,tmpg->pr.y1+y,z,tmpg->pr.radius);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,z,tempg->pwha.width,
|
||||
tempg->pwha.height,tempg->pwha.angle);
|
||||
GrEllipse3(dc,tmpg->pwha.x1+x,tmpg->pwha.y1+y,z,tmpg->pwha.width,
|
||||
tmpg->pwha.height,tmpg->pwha.angle);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,z,tempg->pwhas.width,
|
||||
tempg->pwhas.height,tempg->pwhas.sides,tempg->pwhas.angle);
|
||||
GrRegPoly3(dc,tmpg->pwhas.x1+x,tmpg->pwhas.y1+y,z,tmpg->pwhas.width,
|
||||
tmpg->pwhas.height,tmpg->pwhas.sides,tmpg->pwhas.angle);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->nu.u;
|
||||
ptr=&tmpg->nu.u;
|
||||
x1=ptr[0];
|
||||
y1=ptr[1];
|
||||
for (i=1;i<tempg->nu.num;i++) {
|
||||
for (i=1;i<tmpg->nu.num;i++) {
|
||||
x2=ptr[i<<1];
|
||||
y2=ptr[i<<1+1];
|
||||
GrLine3(dc,x1+x,y1+y,z,x2+x,y2+y,z);
|
||||
@@ -160,10 +160,10 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
x1=tempg->npu.x;
|
||||
y1=tempg->npu.y;
|
||||
ptr=&tempg->npu.u;
|
||||
k=tempg->npu.num*3;
|
||||
x1=tmpg->npu.x;
|
||||
y1=tmpg->npu.y;
|
||||
ptr=&tmpg->npu.u;
|
||||
k=tmpg->npu.num*3;
|
||||
GrPlot3(dc,x1+x,y1+y,z);
|
||||
for (i=0;i<k;i+=3) {
|
||||
j=BFieldExtU32(ptr,i,3);
|
||||
@@ -173,73 +173,73 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,
|
||||
}
|
||||
break;
|
||||
start:
|
||||
p2=p=MAlloc(tempg->nu.num*sizeof(CD3I32));
|
||||
MemCpy(p,&tempg->nu.u,tempg->nu.num*sizeof(CD3I32));
|
||||
for (i=0;i<tempg->nu.num;i++,p2++) {
|
||||
p2=p=MAlloc(tmpg->nu.num*sizeof(CD3I32));
|
||||
MemCpy(p,&tmpg->nu.u,tmpg->nu.num*sizeof(CD3I32));
|
||||
for (i=0;i<tmpg->nu.num;i++,p2++) {
|
||||
p2->x+=x;
|
||||
p2->y+=y;
|
||||
p2->z+=z;
|
||||
}
|
||||
case SPT_BSPLINE2:
|
||||
Gr2BSpline3(dc,p,tempg->nu.num,FALSE);
|
||||
Gr2BSpline3(dc,p,tmpg->nu.num,FALSE);
|
||||
break;
|
||||
case SPT_BSPLINE3:
|
||||
Gr3BSpline3(dc,p,tempg->nu.num,FALSE);
|
||||
Gr3BSpline3(dc,p,tmpg->nu.num,FALSE);
|
||||
break;
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
Gr2BSpline3(dc,p,tempg->nu.num,TRUE);
|
||||
Gr2BSpline3(dc,p,tmpg->nu.num,TRUE);
|
||||
break;
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
Gr3BSpline3(dc,p,tempg->nu.num,TRUE);
|
||||
Gr3BSpline3(dc,p,tmpg->nu.num,TRUE);
|
||||
break;
|
||||
end:
|
||||
Free(p);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p2=p=MAlloc(tempg->mu.vertex_cnt*sizeof(CD3I32));
|
||||
MemCpy(p,&tempg->mu.u,tempg->mu.vertex_cnt*sizeof(CD3I32));
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p2++) {
|
||||
p2=p=MAlloc(tmpg->mu.vertex_cnt*sizeof(CD3I32));
|
||||
MemCpy(p,&tmpg->mu.u,tmpg->mu.vertex_cnt*sizeof(CD3I32));
|
||||
for (i=0;i<tmpg->mu.vertex_cnt;i++,p2++) {
|
||||
p2->x+=x;
|
||||
p2->y+=y;
|
||||
p2->z+=z;
|
||||
}
|
||||
Gr3Mesh(dc,tempg->mu.vertex_cnt,p,tempg->mu.tri_cnt,
|
||||
(&tempg->mu.u)(U8 *)+sizeof(CD3I32)*tempg->mu.vertex_cnt);
|
||||
Gr3Mesh(dc,tmpg->mu.vertex_cnt,p,tmpg->mu.tri_cnt,
|
||||
(&tmpg->mu.u)(U8 *)+sizeof(CD3I32)*tmpg->mu.vertex_cnt);
|
||||
Free(p);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
dc->x+=tempg->pmu.x;
|
||||
dc->y+=tempg->pmu.y;
|
||||
dc->z+=tempg->pmu.z;
|
||||
dc->x+=tmpg->pmu.x;
|
||||
dc->y+=tmpg->pmu.y;
|
||||
dc->z+=tmpg->pmu.z;
|
||||
x1=x;
|
||||
y1=y;
|
||||
z1=z;
|
||||
} else {
|
||||
x1=tempg->pmu.x+x;
|
||||
y1=tempg->pmu.y+y;
|
||||
z1=tempg->pmu.z+z;
|
||||
x1=tmpg->pmu.x+x;
|
||||
y1=tmpg->pmu.y+y;
|
||||
z1=tmpg->pmu.z+z;
|
||||
}
|
||||
p2=p=MAlloc(tempg->pmu.vertex_cnt*sizeof(CD3I32));
|
||||
MemCpy(p,&tempg->pmu.u,tempg->pmu.vertex_cnt*sizeof(CD3I32));
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p2++) {
|
||||
p2=p=MAlloc(tmpg->pmu.vertex_cnt*sizeof(CD3I32));
|
||||
MemCpy(p,&tmpg->pmu.u,tmpg->pmu.vertex_cnt*sizeof(CD3I32));
|
||||
for (i=0;i<tmpg->pmu.vertex_cnt;i++,p2++) {
|
||||
p2->x+=x1;
|
||||
p2->y+=y1;
|
||||
p2->z+=z1;
|
||||
}
|
||||
Gr3Mesh(dc,tempg->pmu.vertex_cnt,p,tempg->pmu.tri_cnt,
|
||||
(&tempg->pmu.u)(U8 *)+sizeof(CD3I32)*tempg->pmu.vertex_cnt);
|
||||
Gr3Mesh(dc,tmpg->pmu.vertex_cnt,p,tmpg->pmu.tri_cnt,
|
||||
(&tmpg->pmu.u)(U8 *)+sizeof(CD3I32)*tmpg->pmu.vertex_cnt);
|
||||
Free(p);
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
dc->x-=tempg->pmu.x;
|
||||
dc->y-=tempg->pmu.y;
|
||||
dc->z-=tempg->pmu.z;
|
||||
dc->x-=tmpg->pmu.x;
|
||||
dc->y-=tmpg->pmu.y;
|
||||
dc->z-=tmpg->pmu.z;
|
||||
}
|
||||
break;
|
||||
}
|
||||
cur_sprite_elem_num++;
|
||||
if (just_one_elem) break;
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
tmpg(U8 *)+=SpriteElemSize(tmpg);
|
||||
}
|
||||
MemCpy(&dc->sym,&old_sym,sizeof(CGrSym));
|
||||
dc->color=old_color;
|
||||
@@ -334,8 +334,8 @@ public U8 *SpriteInterpolate(F64 t,U8 *elems0,U8 *elems1)
|
||||
I32 *ptr0,*ptr1,*ptrr;
|
||||
CD3I32 *p0,*p1,*pr;
|
||||
U8 *res;
|
||||
CSprite *tempg0=elems0-offset(CSprite.start),
|
||||
*tempg1=elems1-offset(CSprite.start),*tempgr;
|
||||
CSprite *tmpg0=elems0-offset(CSprite.start),
|
||||
*tmpg1=elems1-offset(CSprite.start),*tmpgr;
|
||||
if (t<0.5) {
|
||||
i=SpriteSize(elems0),
|
||||
res=MAlloc(i);
|
||||
@@ -345,19 +345,19 @@ public U8 *SpriteInterpolate(F64 t,U8 *elems0,U8 *elems1)
|
||||
res=MAlloc(i);
|
||||
MemCpy(res,elems1,i);
|
||||
}
|
||||
tempgr=res-offset(CSprite.start);
|
||||
while (tempg0->type) {
|
||||
if (tempg0->type!=tempg1->type)
|
||||
tmpgr=res-offset(CSprite.start);
|
||||
while (tmpg0->type) {
|
||||
if (tmpg0->type!=tmpg1->type)
|
||||
throw('Graphics');
|
||||
switch (tempg0->type) {
|
||||
switch (tmpg0->type) {
|
||||
case SPT_ROTATED_RECT:
|
||||
tempgr->ppa.angle=(tempg0->ppa.angle*t0+tempg1->ppa.angle*t1)/GR_SCALE;
|
||||
tmpgr->ppa.angle=(tmpg0->ppa.angle*t0+tmpg1->ppa.angle*t1)/GR_SCALE;
|
||||
case SPT_RECT:
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
tempgr->pp.x2=(tempg0->pp.x2*t0+tempg1->pp.x2*t1)>>32;
|
||||
tempgr->pp.y2=(tempg0->pp.y2*t0+tempg1->pp.y2*t1)>>32;
|
||||
tmpgr->pp.x2=(tmpg0->pp.x2*t0+tmpg1->pp.x2*t1)>>32;
|
||||
tmpgr->pp.y2=(tmpg0->pp.y2*t0+tmpg1->pp.y2*t1)>>32;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
@@ -365,75 +365,75 @@ public U8 *SpriteInterpolate(F64 t,U8 *elems0,U8 *elems1)
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_SHIFT:
|
||||
tempgr->p.x1=(tempg0->p.x1*t0+tempg1->p.x1*t1)>>32;
|
||||
tempgr->p.y1=(tempg0->p.y1*t0+tempg1->p.y1*t1)>>32;
|
||||
tmpgr->p.x1=(tmpg0->p.x1*t0+tmpg1->p.x1*t1)>>32;
|
||||
tmpgr->p.y1=(tmpg0->p.y1*t0+tmpg1->p.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
tempgr->pr.radius=(tempg0->pr.radius*t0+tempg1->pr.radius*t1)>>32;
|
||||
tempgr->pr.x1=(tempg0->pr.x1*t0+tempg1->pr.x1*t1)>>32;
|
||||
tempgr->pr.y1=(tempg0->pr.y1*t0+tempg1->pr.y1*t1)>>32;
|
||||
tmpgr->pr.radius=(tmpg0->pr.radius*t0+tmpg1->pr.radius*t1)>>32;
|
||||
tmpgr->pr.x1=(tmpg0->pr.x1*t0+tmpg1->pr.x1*t1)>>32;
|
||||
tmpgr->pr.y1=(tmpg0->pr.y1*t0+tmpg1->pr.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
tempgr->pwha.x1=(tempg0->pwha.x1*t0+tempg1->pwha.x1*t1)>>32;
|
||||
tempgr->pwha.y1=(tempg0->pwha.y1*t0+tempg1->pwha.y1*t1)>>32;
|
||||
tempgr->pwha.width =(tempg0->pwha.width *t0+tempg1->pwha.width*t1)>>32;
|
||||
tempgr->pwha.height=(tempg0->pwha.height*t0+tempg1->pwha.height*t1)>>32;
|
||||
tmpgr->pwha.x1=(tmpg0->pwha.x1*t0+tmpg1->pwha.x1*t1)>>32;
|
||||
tmpgr->pwha.y1=(tmpg0->pwha.y1*t0+tmpg1->pwha.y1*t1)>>32;
|
||||
tmpgr->pwha.width =(tmpg0->pwha.width *t0+tmpg1->pwha.width*t1)>>32;
|
||||
tmpgr->pwha.height=(tmpg0->pwha.height*t0+tmpg1->pwha.height*t1)>>32;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
tempgr->pwhu.x1=(tempg0->pwhu.x1*t0+tempg1->pwhu.x1*t1)>>32;
|
||||
tempgr->pwhu.y1=(tempg0->pwhu.y1*t0+tempg1->pwhu.y1*t1)>>32;
|
||||
tmpgr->pwhu.x1=(tmpg0->pwhu.x1*t0+tmpg1->pwhu.x1*t1)>>32;
|
||||
tmpgr->pwhu.y1=(tmpg0->pwhu.y1*t0+tmpg1->pwhu.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr0=&tempg0->nu.u;
|
||||
ptr1=&tempg1->nu.u;
|
||||
ptrr=&tempgr->nu.u;
|
||||
for (i=0;i<tempg0->nu.num;i++) {
|
||||
ptr0=&tmpg0->nu.u;
|
||||
ptr1=&tmpg1->nu.u;
|
||||
ptrr=&tmpgr->nu.u;
|
||||
for (i=0;i<tmpg0->nu.num;i++) {
|
||||
ptrr[i<<1]=(ptr0[i<<1]*t0+ptr1[i<<1]*t1)>>32;
|
||||
ptrr[i<<1+1]=(ptr0[i<<1+1]*t0+ptr1[i<<1+1]*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
tempgr->npu.x=(tempg0->npu.x*t0+tempg1->npu.x*t1)>>32;
|
||||
tempgr->npu.y=(tempg0->npu.y*t0+tempg1->npu.y*t1)>>32;
|
||||
tmpgr->npu.x=(tmpg0->npu.x*t0+tmpg1->npu.x*t1)>>32;
|
||||
tmpgr->npu.y=(tmpg0->npu.y*t0+tmpg1->npu.y*t1)>>32;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p0=&tempg0->nu.u;
|
||||
p1=&tempg1->nu.u;
|
||||
pr=&tempgr->nu.u;
|
||||
for (i=0;i<tempg0->nu.num;i++) {
|
||||
p0=&tmpg0->nu.u;
|
||||
p1=&tmpg1->nu.u;
|
||||
pr=&tmpgr->nu.u;
|
||||
for (i=0;i<tmpg0->nu.num;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p0=&tempg0->mu.u;
|
||||
p1=&tempg1->mu.u;
|
||||
pr=&tempgr->mu.u;
|
||||
for (i=0;i<tempg0->mu.vertex_cnt;i++) {
|
||||
p0=&tmpg0->mu.u;
|
||||
p1=&tmpg1->mu.u;
|
||||
pr=&tmpgr->mu.u;
|
||||
for (i=0;i<tmpg0->mu.vertex_cnt;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
p0=&tempg0->pmu.u;
|
||||
p1=&tempg1->pmu.u;
|
||||
pr=&tempgr->pmu.u;
|
||||
for (i=0;i<tempg0->pmu.vertex_cnt;i++) {
|
||||
p0=&tmpg0->pmu.u;
|
||||
p1=&tmpg1->pmu.u;
|
||||
pr=&tmpgr->pmu.u;
|
||||
for (i=0;i<tmpg0->pmu.vertex_cnt;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tempg0(U8 *)+=SpriteElemSize(tempg0);
|
||||
tempg1(U8 *)+=SpriteElemSize(tempg1);
|
||||
tempgr(U8 *)+=SpriteElemSize(tempgr);
|
||||
tmpg0(U8 *)+=SpriteElemSize(tmpg0);
|
||||
tmpg1(U8 *)+=SpriteElemSize(tmpg1);
|
||||
tmpgr(U8 *)+=SpriteElemSize(tmpgr);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -446,26 +446,26 @@ public CDocEntry *DocSprite(CDoc *doc=NULL,U8 *elems,U8 *fmt=NULL)
|
||||
U8 *st;
|
||||
Bool unlock;
|
||||
CDocEntry *doc_e;
|
||||
CDocBin *tempb;
|
||||
CDocBin *tmpb;
|
||||
if (!doc && !(doc=DocPut)) return NULL;
|
||||
unlock=DocLock(doc);
|
||||
size=SpriteSize(elems);
|
||||
tempb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
tempb->size=size;
|
||||
tempb->data=MAlloc(size,doc->mem_task);
|
||||
MemCpy(tempb->data,elems,size);
|
||||
tempb->num=doc->cur_bin_num;
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_head.last);
|
||||
tmpb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
tmpb->size=size;
|
||||
tmpb->data=MAlloc(size,doc->mem_task);
|
||||
MemCpy(tmpb->data,elems,size);
|
||||
tmpb->num=doc->cur_bin_num;
|
||||
tmpb->use_cnt=1;
|
||||
QueIns(tmpb,doc->bin_head.last);
|
||||
if (fmt)
|
||||
st=MStrPrint(fmt,doc->cur_bin_num++);
|
||||
else
|
||||
st=MStrPrint("$$SP,\"\",BI=%d$$",doc->cur_bin_num++);
|
||||
doc_e=DocPrint(doc,"%s",st);
|
||||
Free(st);
|
||||
doc_e->bin_data=tempb;
|
||||
doc_e->bin_data=tmpb;
|
||||
if (doc_e && doc_e->de_flags&DOCEF_TAG && doc_e->tag && *doc_e->tag)
|
||||
tempb->tag=StrNew(doc_e->tag,doc->mem_task);
|
||||
tmpb->tag=StrNew(doc_e->tag,doc->mem_task);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return doc_e;
|
||||
|
||||
+4
-4
@@ -10,14 +10,14 @@ Cd(__DIR__);;
|
||||
#include "GrDC"
|
||||
#include "GrInitB"
|
||||
#include "GrMath"
|
||||
#include "GrScreen"
|
||||
#include "GrScrn"
|
||||
#include "GrBitMap"
|
||||
#include "GrPrimatives"
|
||||
#include "GrComposites"
|
||||
|
||||
#define GE_ABORT (-1)
|
||||
#define GE_EXIT 0
|
||||
#define GE_CONT 1
|
||||
#define SPE_ABORT (-1)
|
||||
#define SPE_EXIT 0
|
||||
#define SPE_CONT 1
|
||||
#include "SpriteNew"
|
||||
#include "GrSpritePlot"
|
||||
#include "SpriteMesh"
|
||||
|
||||
+144
-144
@@ -1,33 +1,33 @@
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
|
||||
#define GBM_EXIT 0
|
||||
#define GBM_MAIN_MENU 1
|
||||
#define GBM_COLOR 2
|
||||
#define GBM_DITHER_COLOR 3
|
||||
#define GBM_WIDTH 4
|
||||
#define GBM_PT 5
|
||||
#define GBM_LINE 6
|
||||
#define GBM_ARROW 7
|
||||
#define GBM_RECT 8
|
||||
#define GBM_CIRCLE 9
|
||||
#define GBM_TEXT 10
|
||||
#define GBM_TEXT_BOX 11
|
||||
#define GBM_TEXT_DIAMOND 12
|
||||
#define GBM_FLOOD_FILL 13
|
||||
#define GBM_FLOOD_FILL_NOT 14
|
||||
#define GBM_POLYLINE 15
|
||||
#define GBM_POLYPT 16
|
||||
#define GBM_COPY 17
|
||||
#define GBM_DELETE 18
|
||||
#define GBM_PASTE 19
|
||||
#define GBM_PASTE_TRANSPARENT 20
|
||||
#define GBM_FIND_AND_REPLACE 21
|
||||
#define GBM_TRIM_TO_EXTENTS 22
|
||||
#define GBM_ADD_OUTLINE 23
|
||||
#define GBM_ETCH 24
|
||||
#define GBM_UNDO 25
|
||||
#define GBM_SAVE_BMP 26
|
||||
#define GBM_SAVE_GRA 27
|
||||
#define SPBM_EXIT 0
|
||||
#define SPBM_MAIN_MENU 1
|
||||
#define SPBM_COLOR 2
|
||||
#define SPBM_DITHER_COLOR 3
|
||||
#define SPBM_WIDTH 4
|
||||
#define SPBM_PT 5
|
||||
#define SPBM_LINE 6
|
||||
#define SPBM_ARROW 7
|
||||
#define SPBM_RECT 8
|
||||
#define SPBM_CIRCLE 9
|
||||
#define SPBM_TEXT 10
|
||||
#define SPBM_TEXT_BOX 11
|
||||
#define SPBM_TEXT_DIAMOND 12
|
||||
#define SPBM_FLOOD_FILL 13
|
||||
#define SPBM_FLOOD_FILL_NOT 14
|
||||
#define SPBM_POLYLINE 15
|
||||
#define SPBM_POLYPT 16
|
||||
#define SPBM_COPY 17
|
||||
#define SPBM_DELETE 18
|
||||
#define SPBM_PASTE 19
|
||||
#define SPBM_PASTE_TRANSPARENT 20
|
||||
#define SPBM_FIND_AND_REPLACE 21
|
||||
#define SPBM_TRIM_TO_EXTENTS 22
|
||||
#define SPBM_ADD_OUTLINE 23
|
||||
#define SPBM_ETCH 24
|
||||
#define SPBM_UNDO 25
|
||||
#define SPBM_SAVE_BMP 26
|
||||
#define SPBM_SAVE_GRA 27
|
||||
|
||||
U0 GrInit4()
|
||||
{
|
||||
@@ -36,7 +36,7 @@ U0 GrInit4()
|
||||
"Rect\0Circle\0Text\0Text Box\0Text Diamond\0Flood Fill\0"
|
||||
"Flood Fill Not Color\0PolyLine\0PolyPoint\0Copy\0Delete\0Paste\0"
|
||||
"Paste Transparent\0Find and Replace\0Trim to Extents\0Add Outline\0"
|
||||
"Etch\0Undo\0Save BMP\0Save GRA\0");
|
||||
"Etch\0Undo\0Save BMP\0Save GR\0");
|
||||
}
|
||||
GrInit4;
|
||||
|
||||
@@ -56,34 +56,34 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width)
|
||||
}
|
||||
DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Sprite BitMap Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/SpriteBitMap.DD.Z\"$$\n"
|
||||
"\n$$LTBLUE$$$$MU-UL,\"Color %s\",LE=GBM_COLOR$$\n"
|
||||
"$$MU-UL,\"Dither Color %s\",LE=GBM_DITHER_COLOR$$\n"
|
||||
"$$MU-UL,\"Width %d\",LE=GBM_WIDTH$$\n"
|
||||
"$$MU-UL,\"Find & Replace Color\",LE=GBM_FIND_AND_REPLACE$$\n"
|
||||
"$$MU-UL,\"Trim to Extents\",LE=GBM_TRIM_TO_EXTENTS$$\n"
|
||||
"$$MU-UL,\"Add Outline\",LE=GBM_ADD_OUTLINE$$\n"
|
||||
"$$MU-UL,\"Etch\",LE=GBM_ETCH$$\n"
|
||||
"\n$$MU-UL,\"Point\",LE=GBM_PT$$\n"
|
||||
"$$MU-UL,\"Line\",LE=GBM_LINE$$\n"
|
||||
"$$MU-UL,\"Arrow\",LE=GBM_ARROW$$\n"
|
||||
"$$MU-UL,\"Rect\",LE=GBM_RECT$$\n"
|
||||
"$$MU-UL,\"Circle\",LE=GBM_CIRCLE$$\n"
|
||||
"$$MU-UL,\"Text\",LE=GBM_TEXT$$\n"
|
||||
"$$MU-UL,\"Text Box\",LE=GBM_TEXT_BOX$$\n"
|
||||
"$$MU-UL,\"Text Diamond\",LE=GBM_TEXT_DIAMOND$$\n"
|
||||
"$$MU-UL,\"Flood Fill\",LE=GBM_FLOOD_FILL$$\n"
|
||||
"$$MU-UL,\"Flood Fill Not Color\",LE=GBM_FLOOD_FILL_NOT$$\n"
|
||||
"$$MU-UL,\"PolyLine\",LE=GBM_POLYLINE$$\n"
|
||||
"$$MU-UL,\"PolyPoint\",LE=GBM_POLYPT$$\n"
|
||||
"\n$$MU-UL,\"Copy to Clipboard\",LE=GBM_COPY$$\n"
|
||||
"$$MU-UL,\"Delete to Clipboard\",LE=GBM_DELETE$$\n"
|
||||
"$$MU-UL,\"Paste Clipboard\",LE=GBM_PASTE$$\n"
|
||||
"$$MU-UL,\"Paste Transparent Clipboard\",LE=GBM_PASTE_TRANSPARENT$$\n"
|
||||
"\n$$MU-UL,\"Save BMP File\",LE=GBM_SAVE_BMP$$\n"
|
||||
"$$MU-UL,\"Save GRA File\",LE=GBM_SAVE_GRA$$\n"
|
||||
"\n$$MU-UL,\"Undo\",LE=GBM_UNDO$$\n"
|
||||
"\n$$PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",LE=GBM_MAIN_MENU$$$$LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",LE=GBM_EXIT$$\n"
|
||||
"\n$$LTBLUE$$$$MU-UL,\"Color %s\",LE=SPBM_COLOR$$\n"
|
||||
"$$MU-UL,\"Dither Color %s\",LE=SPBM_DITHER_COLOR$$\n"
|
||||
"$$MU-UL,\"Width %d\",LE=SPBM_WIDTH$$\n"
|
||||
"$$MU-UL,\"Find & Replace Color\",LE=SPBM_FIND_AND_REPLACE$$\n"
|
||||
"$$MU-UL,\"Trim to Extents\",LE=SPBM_TRIM_TO_EXTENTS$$\n"
|
||||
"$$MU-UL,\"Add Outline\",LE=SPBM_ADD_OUTLINE$$\n"
|
||||
"$$MU-UL,\"Etch\",LE=SPBM_ETCH$$\n"
|
||||
"\n$$MU-UL,\"Point\",LE=SPBM_PT$$\n"
|
||||
"$$MU-UL,\"Line\",LE=SPBM_LINE$$\n"
|
||||
"$$MU-UL,\"Arrow\",LE=SPBM_ARROW$$\n"
|
||||
"$$MU-UL,\"Rect\",LE=SPBM_RECT$$\n"
|
||||
"$$MU-UL,\"Circle\",LE=SPBM_CIRCLE$$\n"
|
||||
"$$MU-UL,\"Text\",LE=SPBM_TEXT$$\n"
|
||||
"$$MU-UL,\"Text Box\",LE=SPBM_TEXT_BOX$$\n"
|
||||
"$$MU-UL,\"Text Diamond\",LE=SPBM_TEXT_DIAMOND$$\n"
|
||||
"$$MU-UL,\"Flood Fill\",LE=SPBM_FLOOD_FILL$$\n"
|
||||
"$$MU-UL,\"Flood Fill Not Color\",LE=SPBM_FLOOD_FILL_NOT$$\n"
|
||||
"$$MU-UL,\"PolyLine\",LE=SPBM_POLYLINE$$\n"
|
||||
"$$MU-UL,\"PolyPoint\",LE=SPBM_POLYPT$$\n"
|
||||
"\n$$MU-UL,\"Copy to Clipboard\",LE=SPBM_COPY$$\n"
|
||||
"$$MU-UL,\"Delete to Clipboard\",LE=SPBM_DELETE$$\n"
|
||||
"$$MU-UL,\"Paste Clipboard\",LE=SPBM_PASTE$$\n"
|
||||
"$$MU-UL,\"Paste Transparent Clipboard\",LE=SPBM_PASTE_TRANSPARENT$$\n"
|
||||
"\n$$MU-UL,\"Save BMP File\",LE=SPBM_SAVE_BMP$$\n"
|
||||
"$$MU-UL,\"Save GR File\",LE=SPBM_SAVE_GRA$$\n"
|
||||
"\n$$MU-UL,\"Undo\",LE=SPBM_UNDO$$\n"
|
||||
"\n$$PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",LE=SPBM_MAIN_MENU$$$$LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",LE=SPBM_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n"
|
||||
"\nRight-Click to get back to this menu.",st1,st2,width);
|
||||
i=PopUpMenu(doc);
|
||||
@@ -201,7 +201,7 @@ U0 GrBitMapEdEtch(CDC *img,I64 width,CColorROPU32 bkcolor)
|
||||
I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor)
|
||||
{
|
||||
I64 i,j,mode=GBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,
|
||||
I64 i,j,mode=SPBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,
|
||||
x22,y22,res,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
||||
old_de_flags=doc_e->de_flags;
|
||||
Bool down=FALSE;
|
||||
@@ -228,13 +228,13 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case CH_SHIFT_ESC:
|
||||
res=GE_ABORT;
|
||||
res=SPE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
case CH_ESC:
|
||||
res=GE_CONT;
|
||||
res=SPE_CONT;
|
||||
goto bm_key_up_done;
|
||||
case 'c': //eye-dropper
|
||||
dc2=DCScreenCapture(FALSE);
|
||||
dc2=DCScrnCapture(FALSE);
|
||||
color=GrPeek(dc2,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc2);
|
||||
break;
|
||||
@@ -253,19 +253,19 @@ bm_menu:
|
||||
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
|
||||
switch (i) {
|
||||
case DOCM_CANCEL:
|
||||
res=GE_ABORT;
|
||||
res=SPE_ABORT;
|
||||
goto bm_done;
|
||||
case GBM_EXIT:
|
||||
res=GE_EXIT;
|
||||
case SPBM_EXIT:
|
||||
res=SPE_EXIT;
|
||||
goto bm_done;
|
||||
case GBM_MAIN_MENU:
|
||||
res=GE_CONT;
|
||||
case SPBM_MAIN_MENU:
|
||||
res=SPE_CONT;
|
||||
goto bm_done;
|
||||
case GBM_COLOR:
|
||||
case SPBM_COLOR:
|
||||
i=PopUpColor(,,FALSE);
|
||||
if (i>=0) color=i;
|
||||
goto bm_menu;
|
||||
case GBM_FIND_AND_REPLACE:
|
||||
case SPBM_FIND_AND_REPLACE:
|
||||
i=PopUpColor("Find Color\n",,FALSE);
|
||||
if (i>=0) {
|
||||
j=PopUpColor("Replace Color\n",,FALSE);
|
||||
@@ -275,43 +275,43 @@ bm_menu:
|
||||
}
|
||||
}
|
||||
goto bm_menu;
|
||||
case GBM_TRIM_TO_EXTENTS:
|
||||
case SPBM_TRIM_TO_EXTENTS:
|
||||
GrBitMapEdTrimToExtents(&img,&xx1,&yy1,&xx2,&yy2,bkcolor);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
goto bm_menu;
|
||||
case GBM_ADD_OUTLINE:
|
||||
case SPBM_ADD_OUTLINE:
|
||||
i=PopUpRangeI64(1,16,1,"Outline Width\n");
|
||||
if (i>=0) {
|
||||
GrBitMapEdAddOutline(img,i,color,bkcolor);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
}
|
||||
goto bm_menu;
|
||||
case GBM_ETCH:
|
||||
case SPBM_ETCH:
|
||||
i=PopUpRangeI64(1,16,1,"Etch Width\n");
|
||||
if (i>=0) {
|
||||
GrBitMapEdEtch(img,i,bkcolor);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
}
|
||||
goto bm_menu;
|
||||
case GBM_SAVE_BMP:
|
||||
case SPBM_SAVE_BMP:
|
||||
*filename.name=0;
|
||||
if (DocForm(&filename) && *filename.name)
|
||||
BMPWrite(filename.name,img);
|
||||
goto bm_menu;
|
||||
case GBM_SAVE_GRA:
|
||||
case SPBM_SAVE_GRA:
|
||||
*filename.name=0;
|
||||
if (DocForm(&filename) && *filename.name)
|
||||
GRAWrite(filename.name,img,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
GRWrite(filename.name,img,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
goto bm_menu;
|
||||
case GBM_DITHER_COLOR:
|
||||
case SPBM_DITHER_COLOR:
|
||||
i=PopUpColorDither;
|
||||
if (i>=0) color=i;
|
||||
goto bm_menu;
|
||||
case GBM_WIDTH:
|
||||
case SPBM_WIDTH:
|
||||
i=PopUpRangeI64(1,16,1,"Pen Width\n");
|
||||
if (i>=0) width=i;
|
||||
goto bm_menu;
|
||||
case GBM_UNDO:
|
||||
case SPBM_UNDO:
|
||||
if (undo) {
|
||||
DCFill(img,bkcolor);
|
||||
img->color=ROP_EQU;
|
||||
@@ -320,24 +320,24 @@ bm_menu:
|
||||
undo=NULL;
|
||||
}
|
||||
goto bm_menu;
|
||||
case GBM_PT:
|
||||
case GBM_LINE:
|
||||
case GBM_ARROW:
|
||||
case GBM_RECT:
|
||||
case GBM_CIRCLE:
|
||||
case GBM_FLOOD_FILL:
|
||||
case GBM_FLOOD_FILL_NOT:
|
||||
case GBM_POLYPT:
|
||||
case GBM_POLYLINE:
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
case GBM_PASTE:
|
||||
case GBM_PASTE_TRANSPARENT:
|
||||
case SPBM_PT:
|
||||
case SPBM_LINE:
|
||||
case SPBM_ARROW:
|
||||
case SPBM_RECT:
|
||||
case SPBM_CIRCLE:
|
||||
case SPBM_FLOOD_FILL:
|
||||
case SPBM_FLOOD_FILL_NOT:
|
||||
case SPBM_POLYPT:
|
||||
case SPBM_POLYLINE:
|
||||
case SPBM_COPY:
|
||||
case SPBM_DELETE:
|
||||
case SPBM_PASTE:
|
||||
case SPBM_PASTE_TRANSPARENT:
|
||||
mode=i;
|
||||
break;
|
||||
case GBM_TEXT:
|
||||
case GBM_TEXT_BOX:
|
||||
case GBM_TEXT_DIAMOND:
|
||||
case SPBM_TEXT:
|
||||
case SPBM_TEXT_BOX:
|
||||
case SPBM_TEXT_DIAMOND:
|
||||
Free(st);
|
||||
st=PopUpGetStr("Enter text and press <ESC>.\n");
|
||||
if (st && *st)
|
||||
@@ -349,13 +349,13 @@ bm_menu:
|
||||
DCDel(undo);
|
||||
undo=DCExt(img,0,0,img->width-1,img->height-1);
|
||||
undo->bkcolor=bkcolor;
|
||||
WinMgrSync(2,TRUE); //Let popup close
|
||||
Refresh(2,TRUE); //Let popup close
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
down=FALSE;
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
switch (mode) {
|
||||
case GBM_PT:
|
||||
case SPBM_PT:
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
GrPlot3(img,a1-xx1,a2-yy1,0);
|
||||
@@ -368,31 +368,31 @@ bm_menu:
|
||||
down=TRUE;
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
case GBM_LINE:
|
||||
case SPBM_LINE:
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_ARROW:
|
||||
case SPBM_ARROW:
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_RECT:
|
||||
case SPBM_RECT:
|
||||
GrRect(dc,x1,y1,1,1);
|
||||
break;
|
||||
case GBM_CIRCLE:
|
||||
case SPBM_CIRCLE:
|
||||
GrCircle3(dc,x1,y1,0,1);
|
||||
break;
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
case SPBM_COPY:
|
||||
case SPBM_DELETE:
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrBorder(dc,x1,y1,x1,y1);
|
||||
break;
|
||||
end:
|
||||
break;
|
||||
case GBM_PASTE:
|
||||
case GBM_PASTE_TRANSPARENT:
|
||||
case SPBM_PASTE:
|
||||
case SPBM_PASTE_TRANSPARENT:
|
||||
if (clipboard) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==GBM_PASTE) {
|
||||
if (mode==SPBM_PASTE) {
|
||||
clipboard->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc,a1,a2,clipboard);
|
||||
clipboard->flags&=~DCF_NO_TRANSPARENTS;
|
||||
@@ -404,32 +404,32 @@ bm_menu:
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GBM_TEXT:
|
||||
case SPBM_TEXT:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPrint(dc,a1,a2,"%s",st);
|
||||
break;
|
||||
case GBM_TEXT_BOX:
|
||||
case SPBM_TEXT_BOX:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextBox3(dc,a1,a2,0,st);
|
||||
break;
|
||||
case GBM_TEXT_DIAMOND:
|
||||
case SPBM_TEXT_DIAMOND:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextDiamond3(dc,a1,a2,0,st);
|
||||
break;
|
||||
case GBM_FLOOD_FILL:
|
||||
case SPBM_FLOOD_FILL:
|
||||
img->color=color;
|
||||
GrFloodFill(img,a1-xx1,a2-yy1);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case GBM_FLOOD_FILL_NOT:
|
||||
case SPBM_FLOOD_FILL_NOT:
|
||||
img->color=color;
|
||||
GrFloodFill(img,a1-xx1,a2-yy1,TRUE);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case GBM_POLYLINE:
|
||||
case SPBM_POLYLINE:
|
||||
if (!down) {
|
||||
x1=a1; y1=a2;
|
||||
down=TRUE;
|
||||
@@ -438,7 +438,7 @@ bm_menu:
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
}
|
||||
break;
|
||||
case GBM_POLYPT:
|
||||
case SPBM_POLYPT:
|
||||
x1=a1; y1=a2;
|
||||
down=TRUE;
|
||||
img->color=color;
|
||||
@@ -450,20 +450,20 @@ bm_menu:
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
switch (mode) {
|
||||
case GBM_LINE:
|
||||
case GBM_ARROW:
|
||||
case GBM_POLYLINE:
|
||||
case SPBM_LINE:
|
||||
case SPBM_ARROW:
|
||||
case SPBM_POLYLINE:
|
||||
if (down) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
if (mode==GBM_ARROW)
|
||||
if (mode==SPBM_ARROW)
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
else
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
}
|
||||
break;
|
||||
case GBM_RECT:
|
||||
case SPBM_RECT:
|
||||
if (down) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (x1<a1) {
|
||||
@@ -484,8 +484,8 @@ bm_menu:
|
||||
GrRect(dc,x11,y11,x22-x11+1,y22-y11+1);
|
||||
}
|
||||
break;
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
case SPBM_COPY:
|
||||
case SPBM_DELETE:
|
||||
if (down) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (x1<a1) {
|
||||
@@ -507,7 +507,7 @@ bm_menu:
|
||||
GrBorder(dc,x11,y11,x22,y22);
|
||||
}
|
||||
break;
|
||||
case GBM_CIRCLE:
|
||||
case SPBM_CIRCLE:
|
||||
if (down) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
@@ -515,11 +515,11 @@ bm_menu:
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(a1-x1)+SqrI64(a2-y1)));
|
||||
}
|
||||
break;
|
||||
case GBM_PASTE:
|
||||
case GBM_PASTE_TRANSPARENT:
|
||||
case SPBM_PASTE:
|
||||
case SPBM_PASTE_TRANSPARENT:
|
||||
if (clipboard) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==GBM_PASTE) {
|
||||
if (mode==SPBM_PASTE) {
|
||||
clipboard->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc,a1,a2,clipboard);
|
||||
clipboard->flags&=~DCF_NO_TRANSPARENTS;
|
||||
@@ -531,22 +531,22 @@ bm_menu:
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GBM_TEXT:
|
||||
case SPBM_TEXT:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPrint(dc,a1,a2,"%s",st);
|
||||
break;
|
||||
case GBM_TEXT_BOX:
|
||||
case SPBM_TEXT_BOX:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextBox3(dc,a1,a2,0,st);
|
||||
break;
|
||||
case GBM_TEXT_DIAMOND:
|
||||
case SPBM_TEXT_DIAMOND:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextDiamond3(dc,a1,a2,0,st);
|
||||
break;
|
||||
case GBM_POLYPT:
|
||||
case SPBM_POLYPT:
|
||||
if (down) {
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
@@ -559,23 +559,23 @@ bm_menu:
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
switch (mode) {
|
||||
case GBM_LINE:
|
||||
case GBM_ARROW:
|
||||
case GBM_POLYPT:
|
||||
case GBM_POLYLINE:
|
||||
case SPBM_LINE:
|
||||
case SPBM_ARROW:
|
||||
case SPBM_POLYPT:
|
||||
case SPBM_POLYLINE:
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
if (mode==GBM_ARROW)
|
||||
if (mode==SPBM_ARROW)
|
||||
GrArrow3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
|
||||
else
|
||||
GrLine3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==GBM_POLYLINE) {
|
||||
if (mode==SPBM_POLYLINE) {
|
||||
x1=a1; y1=a2;
|
||||
} else
|
||||
down=FALSE;
|
||||
break;
|
||||
case GBM_RECT:
|
||||
case SPBM_RECT:
|
||||
img->color=color;
|
||||
if (x1<a1) {
|
||||
x11=x1;
|
||||
@@ -595,8 +595,8 @@ bm_menu:
|
||||
down=FALSE;
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
case SPBM_COPY:
|
||||
case SPBM_DELETE:
|
||||
if (x1<a1) {
|
||||
x11=x1;
|
||||
x22=a1;
|
||||
@@ -614,23 +614,23 @@ bm_menu:
|
||||
DCDel(clipboard);
|
||||
clipboard=DCExt(img,x11-xx1,y11-yy1,x22-xx1,y22-yy1);
|
||||
clipboard->bkcolor=bkcolor;
|
||||
if (mode==GBM_DELETE) {
|
||||
if (mode==SPBM_DELETE) {
|
||||
img->color=bkcolor;
|
||||
GrRect(img,x11-xx1,y11-yy1,x22-x11+1,y22-y11+1);
|
||||
}
|
||||
goto bm_menu;
|
||||
case GBM_CIRCLE:
|
||||
case SPBM_CIRCLE:
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
GrCircle3(img,x1-xx1,y1-yy1,0,Sqrt(SqrI64(a1-x1)+SqrI64(a2-y1)));
|
||||
down=FALSE;
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case GBM_PASTE:
|
||||
case GBM_PASTE_TRANSPARENT:
|
||||
case SPBM_PASTE:
|
||||
case SPBM_PASTE_TRANSPARENT:
|
||||
if (clipboard) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==GBM_PASTE) {
|
||||
if (mode==SPBM_PASTE) {
|
||||
clipboard->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(img,a1-xx1,a2-yy1,clipboard);
|
||||
clipboard->flags&=~DCF_NO_TRANSPARENTS;
|
||||
@@ -643,15 +643,15 @@ bm_menu:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
}
|
||||
break;
|
||||
case GBM_TEXT:
|
||||
case SPBM_TEXT:
|
||||
img->color=color;
|
||||
GrPrint(img,a1-xx1,a2-yy1,"%s",st);
|
||||
goto bm_menu;
|
||||
case GBM_TEXT_BOX:
|
||||
case SPBM_TEXT_BOX:
|
||||
img->color=color;
|
||||
GrTextBox3(img,a1-xx1,a2-yy1,0,st);
|
||||
goto bm_menu;
|
||||
case GBM_TEXT_DIAMOND:
|
||||
case SPBM_TEXT_DIAMOND:
|
||||
img->color=color;
|
||||
GrTextDiamond3(img,a1-xx1,a2-yy1,0,st);
|
||||
goto bm_menu;
|
||||
@@ -659,7 +659,7 @@ bm_menu:
|
||||
break;
|
||||
}
|
||||
}
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
}
|
||||
bm_key_up_done:
|
||||
GetMsg(,,1<<MSG_KEY_UP);
|
||||
|
||||
+117
-117
@@ -1,6 +1,6 @@
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
|
||||
U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
U0 SpriteElem2Code(CDoc *doc,CSprite *tmpg)
|
||||
{
|
||||
U8 buf1[STR_LEN],buf2[STR_LEN];
|
||||
I32 *ptr;
|
||||
@@ -8,16 +8,16 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
CD3I32 *p;
|
||||
CMeshTri *tri;
|
||||
if (!doc) doc=DocPut;
|
||||
DocPrint(doc,"%Z",tempg->type,"ST_SPRITE_ELEM_CODES");
|
||||
switch (tempg->type) {
|
||||
DocPrint(doc,"%Z",tmpg->type,"ST_SPRITE_ELEM_CODES");
|
||||
switch (tmpg->type) {
|
||||
case SPT_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf1,tempg->c.color));
|
||||
Color2Str(buf1,tmpg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
Color2Str(buf2,ROPF_DITHER|tmpg->d.dither_color.u8[0]|
|
||||
tmpg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
DocPrint(doc,"{ON}");
|
||||
@@ -28,54 +28,54 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2,tempg->pp.y2);
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tmpg->pp.x1,tmpg->pp.y1,
|
||||
tmpg->pp.x2,tmpg->pp.y2);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d)}",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d)}",tmpg->pp.x1,tmpg->pp.y1,
|
||||
tmpg->pp.x2-tmpg->pp.x1,tmpg->pp.y2-tmpg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->ppa.x1,tempg->ppa.y1,
|
||||
tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1,
|
||||
180/ã*Wrap(tempg->ppa.angle));
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tmpg->ppa.x1,tmpg->ppa.y1,
|
||||
tmpg->ppa.x2-tmpg->ppa.x1,tmpg->ppa.y2-tmpg->ppa.y1,
|
||||
180/ã*Wrap(tmpg->ppa.angle));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_SHIFT:
|
||||
DocPrint(doc,"{(%d,%d)}",tempg->p.x1,tempg->p.y1);
|
||||
DocPrint(doc,"{(%d,%d)}",tmpg->p.x1,tmpg->p.y1);
|
||||
break;
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
DocPrint(doc,"{(%d,%d),TRUE}",tempg->p.x1,tempg->p.y1);
|
||||
DocPrint(doc,"{(%d,%d),TRUE}",tmpg->p.x1,tmpg->p.y1);
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
DocPrint(doc,"{(%d,%d):%d}",tempg->pr.x1,tempg->pr.y1,tempg->pr.radius);
|
||||
DocPrint(doc,"{(%d,%d):%d}",tmpg->pr.x1,tmpg->pr.y1,tmpg->pr.radius);
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
DocPrint(doc,"{%d}",tempg->w.width);
|
||||
DocPrint(doc,"{%d}",tmpg->w.width);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->pwha.x1,tempg->pwha.y1,
|
||||
tempg->pwha.width,tempg->pwha.height,180/ã*Wrap(tempg->pwha.angle));
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tmpg->pwha.x1,tmpg->pwha.y1,
|
||||
tmpg->pwha.width,tmpg->pwha.height,180/ã*Wrap(tmpg->pwha.angle));
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
DocPrint(doc,"{%d,(%d,%d):(%d,%d),%0.4f}",tempg->pwhas.sides,
|
||||
tempg->pwhas.x1,tempg->pwhas.y1,
|
||||
tempg->pwhas.width,tempg->pwhas.height,
|
||||
180/ã*Wrap(tempg->pwhas.angle));
|
||||
DocPrint(doc,"{%d,(%d,%d):(%d,%d),%0.4f}",tmpg->pwhas.sides,
|
||||
tmpg->pwhas.x1,tmpg->pwhas.y1,
|
||||
tmpg->pwhas.width,tmpg->pwhas.height,
|
||||
180/ã*Wrap(tmpg->pwhas.angle));
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
DocPrint(doc,"{(%d,%d),\"%Q\"}",tempg->ps.x1,tempg->ps.y1,tempg->ps.st);
|
||||
DocPrint(doc,"{(%d,%d),\"%Q\"}",tmpg->ps.x1,tmpg->ps.y1,tmpg->ps.st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->nu.u;
|
||||
ptr=&tmpg->nu.u;
|
||||
DocPrint(doc,"{");
|
||||
for (i=0;i<tempg->nu.num;i++,ptr+=2) {
|
||||
for (i=0;i<tmpg->nu.num;i++,ptr+=2) {
|
||||
DocPrint(doc,"(%d,%d)",ptr[0],ptr[1]);
|
||||
if (i+1<tempg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->nu.num)
|
||||
if (i+1<tmpg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tmpg->nu.num)
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
DocPrint(doc,"}");
|
||||
@@ -84,26 +84,26 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
ptr=&tempg->nu.u;
|
||||
ptr=&tmpg->nu.u;
|
||||
DocPrint(doc,"{");
|
||||
for (i=0;i<tempg->nu.num;i++,ptr+=3) {
|
||||
for (i=0;i<tmpg->nu.num;i++,ptr+=3) {
|
||||
DocPrint(doc,"(%d,%d,%d)",ptr[0],ptr[1],ptr[2]);
|
||||
if (i+1<tempg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->nu.num)
|
||||
if (i+1<tmpg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tmpg->nu.num)
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
if (tempg->type==SPT_BSPLINE2||tempg->type==SPT_BSPLINE3)
|
||||
if (tmpg->type==SPT_BSPLINE2||tmpg->type==SPT_BSPLINE3)
|
||||
DocPrint(doc,",FALSE}");
|
||||
else
|
||||
DocPrint(doc,",TRUE}");
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
DocPrint(doc,"{(%d,%d),",tempg->npu.x,tempg->npu.y);
|
||||
ptr=&tempg->npu.u;
|
||||
DocPrint(doc,"{(%d,%d),",tmpg->npu.x,tmpg->npu.y);
|
||||
ptr=&tmpg->npu.u;
|
||||
col=16;
|
||||
for (i=0;i<tempg->npu.num;i++) {
|
||||
for (i=0;i<tmpg->npu.num;i++) {
|
||||
DocPrint(doc,"%d",BFieldExtU32(ptr,i*3,3));
|
||||
if (++col>=64 && i+1<tempg->npu.num) {
|
||||
if (++col>=64 && i+1<tmpg->npu.num) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -111,24 +111,24 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),\n",tempg->pwhu.x1,tempg->pwhu.y1,
|
||||
tempg->pwhu.width,tempg->pwhu.height);
|
||||
width_internal=(tempg->pwhu.width+7)&~7;
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),\n",tmpg->pwhu.x1,tmpg->pwhu.y1,
|
||||
tmpg->pwhu.width,tmpg->pwhu.height);
|
||||
width_internal=(tmpg->pwhu.width+7)&~7;
|
||||
if (width_internal<80)
|
||||
k=width_internal;
|
||||
else
|
||||
k=64;
|
||||
ptr=&tempg->pwhu.u;
|
||||
ptr=&tmpg->pwhu.u;
|
||||
col=0;
|
||||
for (j=0;j<tempg->pwhu.height;j++)
|
||||
for (j=0;j<tmpg->pwhu.height;j++)
|
||||
for (i=0;i<width_internal;i++,ptr(U8 *)++) {
|
||||
if (i>=tempg->pwhu.width)
|
||||
if (i>=tmpg->pwhu.width)
|
||||
DocPrint(doc,"_");
|
||||
else if (*ptr(U8 *)<16)
|
||||
DocPrint(doc,"%X",*ptr(U8 *));
|
||||
else
|
||||
DocPrint(doc,"%c",CH_SHIFT_SPACE);
|
||||
if (++col>=k && (i+1<width_internal||j+1<tempg->pwhu.height)) {
|
||||
if (++col>=k && (i+1<width_internal||j+1<tmpg->pwhu.height)) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -137,11 +137,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
break;
|
||||
case SPT_MESH:
|
||||
DocPrint(doc,"{FALSE,");
|
||||
p=&tempg->mu.u;
|
||||
p=&tmpg->mu.u;
|
||||
col=0;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
for (i=0;i<tmpg->mu.vertex_cnt;i++,p++) {
|
||||
DocPrint(doc,"(%d,%d,%d)",p->x,p->y,p->z);
|
||||
if (i+1<tempg->mu.vertex_cnt) DocPrint(doc,",");
|
||||
if (i+1<tmpg->mu.vertex_cnt) DocPrint(doc,",");
|
||||
if (++col==4) {
|
||||
DocPrint(doc,"\t//%d\n",i);
|
||||
col=0;
|
||||
@@ -149,11 +149,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
}
|
||||
DocPrint(doc,":");
|
||||
tri=p;
|
||||
for (i=0;i<tempg->mu.tri_cnt;i++,tri++) {
|
||||
for (i=0;i<tmpg->mu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->mu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->mu.tri_cnt) {
|
||||
if (i+1<tmpg->mu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tmpg->mu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -161,12 +161,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
DocPrint(doc,"{TRUE,(%d,%d,%d):",tempg->pmu.x,tempg->pmu.y,tempg->pmu.z);
|
||||
p=&tempg->pmu.u;
|
||||
DocPrint(doc,"{TRUE,(%d,%d,%d):",tmpg->pmu.x,tmpg->pmu.y,tmpg->pmu.z);
|
||||
p=&tmpg->pmu.u;
|
||||
col=1;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
for (i=0;i<tmpg->pmu.vertex_cnt;i++,p++) {
|
||||
DocPrint(doc,"(%d,%d,%d)",p->x,p->y,p->z);
|
||||
if (i+1<tempg->pmu.vertex_cnt) DocPrint(doc,",");
|
||||
if (i+1<tmpg->pmu.vertex_cnt) DocPrint(doc,",");
|
||||
if (++col==4) {
|
||||
DocPrint(doc,"\t//%d\n",i);
|
||||
col=0;
|
||||
@@ -174,11 +174,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
}
|
||||
DocPrint(doc,":");
|
||||
tri=p;
|
||||
for (i=0;i<tempg->pmu.tri_cnt;i++,tri++) {
|
||||
for (i=0;i<tmpg->pmu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->pmu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->pmu.tri_cnt) {
|
||||
if (i+1<tmpg->pmu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tmpg->pmu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -191,10 +191,10 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
|
||||
public U0 Sprite2Code(CDoc *doc=NULL,U8 *elems)
|
||||
{//Sprite to text.
|
||||
CSprite *tempg=elems-offset(CSprite.start);
|
||||
while (tempg->type) {
|
||||
SpriteElem2Code(doc,tempg);
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
CSprite *tmpg=elems-offset(CSprite.start);
|
||||
while (tmpg->type) {
|
||||
SpriteElem2Code(doc,tmpg);
|
||||
tmpg(U8 *)+=SpriteElemSize(tmpg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,9 +204,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
CSprite *res,g;
|
||||
CColorROPU32 color;
|
||||
U8 *st,*ptr;
|
||||
CQueD3I32 headp,*tempp,*tempa1;
|
||||
CQueMeshTri headt,*tempt,*tempt1;
|
||||
CQueVectU8 *tempv;
|
||||
CQueD3I32 headp,*tmpp,*tmpa1;
|
||||
CQueMeshTri headt,*tmpt,*tmpt1;
|
||||
CQueVectU8 *tmpv;
|
||||
MemSet(&g,0,sizeof(CSprite));
|
||||
switch (type) {
|
||||
start:
|
||||
@@ -340,9 +340,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
g.type=SPT_POLYLINE;
|
||||
QueInit(&headp);
|
||||
while (cc->token=='(') {
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD2I32(cc,&tempp->p);
|
||||
QueIns(tempp,headp.last);
|
||||
tmpp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD2I32(cc,&tmpp->p);
|
||||
QueIns(tmpp,headp.last);
|
||||
g.nu.num++;
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
@@ -353,13 +353,13 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
res=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->nu.u;
|
||||
tempp=headp.next;
|
||||
while (tempp!=&headp) {
|
||||
tempa1=tempp->next;
|
||||
MemCpy(ptr,&tempp->p,sizeof(CD2I32));
|
||||
tmpp=headp.next;
|
||||
while (tmpp!=&headp) {
|
||||
tmpa1=tmpp->next;
|
||||
MemCpy(ptr,&tmpp->p,sizeof(CD2I32));
|
||||
ptr+=sizeof(CD2I32);
|
||||
Free(tempp);
|
||||
tempp=tempa1;
|
||||
Free(tmpp);
|
||||
tmpp=tmpa1;
|
||||
}
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
@@ -369,9 +369,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
Lex(cc); //Skip {
|
||||
QueInit(&headp);
|
||||
while (cc->token=='(') {
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(cc,&tempp->p);
|
||||
QueIns(tempp,headp.last);
|
||||
tmpp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(cc,&tmpp->p);
|
||||
QueIns(tmpp,headp.last);
|
||||
g.nu.num++;
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
@@ -393,13 +393,13 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
}
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->nu.u;
|
||||
tempp=headp.next;
|
||||
while (tempp!=&headp) {
|
||||
tempa1=tempp->next;
|
||||
MemCpy(ptr,&tempp->p,sizeof(CD3I32));
|
||||
tmpp=headp.next;
|
||||
while (tmpp!=&headp) {
|
||||
tmpa1=tmpp->next;
|
||||
MemCpy(ptr,&tmpp->p,sizeof(CD3I32));
|
||||
ptr+=sizeof(CD3I32);
|
||||
Free(tempp);
|
||||
tempp=tempa1;
|
||||
Free(tmpp);
|
||||
tmpp=tmpa1;
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
@@ -407,14 +407,14 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
LexD2I32(cc,&g.npu.x);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"Expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
tmpv=QueVectU8New;
|
||||
while (TRUE) {
|
||||
if (!(i=LexGetChar(cc)))
|
||||
LexExcept(cc,"Expecting '}' at ");
|
||||
if (i=='}')
|
||||
break;
|
||||
if ('0'<=i<='7')
|
||||
QueVectU8Put(tempv,g.npu.num++,i-'0');
|
||||
QueVectU8Put(tmpv,g.npu.num++,i-'0');
|
||||
}
|
||||
Bts(&cc->flags,CCf_USE_LAST_U16);
|
||||
Lex(cc); //Load '}'
|
||||
@@ -424,8 +424,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->npu.u;
|
||||
for (i=0;i<g.npu.num;i++)
|
||||
BFieldOrU32(ptr,i*3,QueVectU8Get(tempv,i));
|
||||
QueVectU8Del(tempv);
|
||||
BFieldOrU32(ptr,i*3,QueVectU8Get(tmpv,i));
|
||||
QueVectU8Del(tmpv);
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
Lex(cc); //Skip {
|
||||
@@ -436,7 +436,7 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
LexD2I32(cc,&g.pwhu.width);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"Expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
tmpv=QueVectU8New;
|
||||
num1=0;
|
||||
while (TRUE) {
|
||||
if (!(i=ToUpper(LexGetChar(cc))))
|
||||
@@ -444,13 +444,13 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
if (i=='}')
|
||||
break;
|
||||
if ('0'<=i<='9')
|
||||
QueVectU8Put(tempv,num1++,i-'0');
|
||||
QueVectU8Put(tmpv,num1++,i-'0');
|
||||
else if ('A'<=i<='F')
|
||||
QueVectU8Put(tempv,num1++,i-'A'+10);
|
||||
QueVectU8Put(tmpv,num1++,i-'A'+10);
|
||||
else if (i==CH_SPACE||i==CH_SHIFT_SPACE)
|
||||
QueVectU8Put(tempv,num1++,TRANSPARENT);
|
||||
QueVectU8Put(tmpv,num1++,TRANSPARENT);
|
||||
else if (i=='_')
|
||||
QueVectU8Put(tempv,num1++,0);
|
||||
QueVectU8Put(tmpv,num1++,0);
|
||||
}
|
||||
Bts(&cc->flags,CCf_USE_LAST_U16);
|
||||
Lex(cc); //Load '}'
|
||||
@@ -460,8 +460,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->pwhu.u;
|
||||
for (i=0;i<num1;i++)
|
||||
*ptr++=QueVectU8Get(tempv,i);
|
||||
QueVectU8Del(tempv);
|
||||
*ptr++=QueVectU8Get(tmpv,i);
|
||||
QueVectU8Del(tmpv);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
@@ -484,9 +484,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
num1=0;
|
||||
QueInit(&headp);
|
||||
while (cc->token=='(') {
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(cc,&tempp->p);
|
||||
QueIns(tempp,headp.last);
|
||||
tmpp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(cc,&tmpp->p);
|
||||
QueIns(tmpp,headp.last);
|
||||
num1++;
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
@@ -497,27 +497,27 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
num2=0;
|
||||
QueInit(&headt);
|
||||
while (cc->token=='(') {
|
||||
tempt=CAlloc(sizeof(CQueMeshTri));
|
||||
tmpt=CAlloc(sizeof(CQueMeshTri));
|
||||
st=LexFirstRem(cc,",");
|
||||
tempt->color=Str2ColorU32(st);
|
||||
tmpt->color=Str2ColorU32(st);
|
||||
Free(st);
|
||||
Lex(cc); //Skip color
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"Expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
tempt->nums[0]=LexExpressionI64(cc);
|
||||
tmpt->nums[0]=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"Expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
tempt->nums[1]=LexExpressionI64(cc);
|
||||
tmpt->nums[1]=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"Expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
tempt->nums[2]=LexExpressionI64(cc);
|
||||
tmpt->nums[2]=LexExpressionI64(cc);
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"Expecting ')' at ");
|
||||
Lex(cc); //Skip )
|
||||
QueIns(tempt,headt.last);
|
||||
QueIns(tmpt,headt.last);
|
||||
num2++;
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
@@ -534,21 +534,21 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
res=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||
MemCpy(res,&g,size);
|
||||
ptr=res(U8 *)+size;
|
||||
tempp=headp.next;
|
||||
while (tempp!=&headp) {
|
||||
tempa1=tempp->next;
|
||||
MemCpy(ptr,&tempp->p,sizeof(CD3I32));
|
||||
tmpp=headp.next;
|
||||
while (tmpp!=&headp) {
|
||||
tmpa1=tmpp->next;
|
||||
MemCpy(ptr,&tmpp->p,sizeof(CD3I32));
|
||||
ptr+=sizeof(CD3I32);
|
||||
Free(tempp);
|
||||
tempp=tempa1;
|
||||
Free(tmpp);
|
||||
tmpp=tmpa1;
|
||||
}
|
||||
tempt=headt.next;
|
||||
while (tempt!=&headt) {
|
||||
tempt1=tempt->next;
|
||||
MemCpy(ptr,&tempt->start,sizeof(CMeshTri));
|
||||
tmpt=headt.next;
|
||||
while (tmpt!=&headt) {
|
||||
tmpt1=tmpt->next;
|
||||
MemCpy(ptr,&tmpt->start,sizeof(CMeshTri));
|
||||
ptr+=sizeof(CMeshTri);
|
||||
Free(tempt);
|
||||
tempt=tempt1;
|
||||
Free(tmpt);
|
||||
tmpt=tmpt1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -566,7 +566,7 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
I64 i,size=0;
|
||||
QueInit(&head);
|
||||
LexAttachDoc(cc,,doc);
|
||||
@@ -574,8 +574,8 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
do {
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
if (Lex(cc)==TK_IDENT && //Skip ;
|
||||
(temph=HashFind(cc->cur_str,gr.sprite_hash,SPHT_ELEM_CODE))) {
|
||||
i=temph->user_data0;
|
||||
(tmph=HashFind(cc->cur_str,gr.sprite_hash,SPHT_ELEM_CODE))) {
|
||||
i=tmph->user_data0;
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
if (Lex(cc)=='{') //Skip ident
|
||||
QueIns(Code2SpriteElem(cc,i),head.last);
|
||||
|
||||
+406
-406
File diff suppressed because it is too large.
Load diff
+235
-235
@@ -1,8 +1,8 @@
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
|
||||
#define SPT_MENU -2
|
||||
#define SPT_INS_SCREEN_BITMAP -3
|
||||
#define SPT_INS_TRANSPARENT_SCREEN_BITMAP -4
|
||||
#define SPT_INS_SCRN_BITMAP -3
|
||||
#define SPT_INS_TRANSPARENT_SCRN_BITMAP -4
|
||||
#define SPT_ED_MENU -5
|
||||
#define SPT_EXIT -6
|
||||
|
||||
@@ -43,9 +43,9 @@ I64 PopUpSpriteMain(CSprite **_head,I64 *_cur_elem_num,
|
||||
"$$MU-UL,\"BSpline3\",LE=SPT_BSPLINE3$$\n"
|
||||
"$$MU-UL,\"BSpline2 Closed\",LE=SPT_BSPLINE2_CLOSED$$\n"
|
||||
"$$MU-UL,\"BSpline3 Closed\",LE=SPT_BSPLINE3_CLOSED$$\n"
|
||||
"$$MU-UL,\"Insert Screen-Captured BitMap\",LE=SPT_INS_SCREEN_BITMAP$$\n"
|
||||
"$$MU-UL,\"Insert Transparent Screen-Captured BitMap\","
|
||||
"LE=SPT_INS_TRANSPARENT_SCREEN_BITMAP$$\n"
|
||||
"$$MU-UL,\"Insert Scrn-Captured BitMap\",LE=SPT_INS_SCRN_BITMAP$$\n"
|
||||
"$$MU-UL,\"Insert Transparent Scrn-Captured BitMap\","
|
||||
"LE=SPT_INS_TRANSPARENT_SCRN_BITMAP$$\n"
|
||||
"$$PURPLE$$$$MU-UL,\"+] Create or Edit 3D Mesh\",LE=SPT_MESH$$\n"
|
||||
"$$MU-UL,\"+] Create or Edit Shiftable 3D Mesh\","
|
||||
"LE=SPT_SHIFTABLE_MESH$$\n"
|
||||
@@ -101,12 +101,12 @@ Bool PopUpExtents(I64 *_x1,I64 *_x2,I64 *_y1,I64 *_y2)
|
||||
return i;
|
||||
}
|
||||
|
||||
U0 SpriteScreenInit(CDC *dc,I64,I64)
|
||||
U0 SpriteScrnInit(CDC *dc,I64,I64)
|
||||
{
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
I64 xx,yy,old_pen_width=dc->pen_width;
|
||||
CColorROPU32 old_color=dc->color;
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
DCFill(dc);
|
||||
if (dc->flags&DCF_SYMMETRY) {
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
@@ -136,7 +136,7 @@ CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
@@ -158,7 +158,7 @@ CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
@@ -184,7 +184,7 @@ CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->flags=old_flags&DCF_SYMMETRY|dc->flags&~DCF_SYMMETRY;
|
||||
@@ -206,7 +206,7 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
if (x2<x1) {
|
||||
xx1=x2; xx2=x1;
|
||||
@@ -230,7 +230,7 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
CColorROPU32 bm_bkcolor)
|
||||
{
|
||||
I64 i,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2,old_width;
|
||||
@@ -243,7 +243,7 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
GrBorder(dc2,xx1+Fs->pix_left+Fs->scroll_x,yy1+Fs->pix_top+Fs->scroll_y,
|
||||
xx2+Fs->pix_left+Fs->scroll_x,yy2+Fs->pix_top+Fs->scroll_y);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
if (x2<x1) {
|
||||
xx1=x2; xx2=x1;
|
||||
@@ -263,15 +263,15 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
res->pwhu.height=yy2-yy1;
|
||||
res->pwhu.x1=0;
|
||||
res->pwhu.y1=0;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
i=gr.screen_zoom;
|
||||
SpriteScrnInit(dc,x,y);
|
||||
i=gr.scrn_zoom;
|
||||
GrScaleZoom(1.0/i);
|
||||
WinMgrSync(2,TRUE);
|
||||
Refresh(2,TRUE);
|
||||
|
||||
dc3=DCScreenCapture;
|
||||
dc3=DCScrnCapture;
|
||||
img=DCExt(dc3,Fs->pix_left+Fs->scroll_x+xx1,Fs->pix_top+Fs->scroll_y+yy1,
|
||||
Fs->pix_left+Fs->scroll_x+xx2-1,Fs->pix_top+Fs->scroll_y+yy2-1);
|
||||
if (eletype==SPT_INS_TRANSPARENT_SCREEN_BITMAP)
|
||||
if (eletype==SPT_INS_TRANSPARENT_SCRN_BITMAP)
|
||||
DCColorChg(img,bm_bkcolor);
|
||||
GrScaleZoom(i);
|
||||
MemCpy(&res->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
@@ -291,7 +291,7 @@ CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
@@ -313,7 +313,7 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,(x1+x2)>>1,(y1+y2)>>1,0,AbsI64(x1-x2)>>1,AbsI64(y1-y2)>>1);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
@@ -335,7 +335,7 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
|
||||
res->pwha.width,res->pwha.height,res->pwha.angle);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
@@ -360,7 +360,7 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
GrRegPoly3(dc,(x1+x2)>>1,(y1+y2)>>1,0,
|
||||
AbsI64(x1-x2)>>1,AbsI64(y1-y2)>>1,sides);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
@@ -384,7 +384,7 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
res->pwhas.width,res->pwhas.height,
|
||||
res->pwhas.sides,res->pwhas.angle);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
@@ -405,7 +405,7 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSprite *res,*tempg,*tempg1,head2;
|
||||
CSprite *res,*tmpg,*tmpg1,head2;
|
||||
|
||||
QueInit(&head2);
|
||||
do {
|
||||
@@ -438,22 +438,22 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
if (num>1) {
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
ptr=&res->nu.u;
|
||||
tempg1=head2.next;
|
||||
tmpg1=head2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
ptr[i<<1]=tempg1->p.x1;
|
||||
ptr[i<<1+1]=tempg1->p.y1;
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
tmpg=tmpg1->next;
|
||||
ptr[i<<1]=tmpg1->p.x1;
|
||||
ptr[i<<1+1]=tmpg1->p.y1;
|
||||
Free(tmpg1);
|
||||
tmpg1=tmpg;
|
||||
}
|
||||
res->type=SPT_POLYLINE;
|
||||
res->nu.num=num;
|
||||
} else {
|
||||
tempg1=head2.next;
|
||||
tmpg1=head2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
tmpg=tmpg1->next;
|
||||
Free(tmpg1);
|
||||
tmpg1=tmpg;
|
||||
}
|
||||
res=NULL;
|
||||
}
|
||||
@@ -465,22 +465,22 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
if (num>2) {
|
||||
res=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
p=&res->nu.u;
|
||||
tempg1=head2.next;
|
||||
tmpg1=head2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
p[i].x=tempg1->p.x1;
|
||||
p[i].y=tempg1->p.y1;
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
tmpg=tmpg1->next;
|
||||
p[i].x=tmpg1->p.x1;
|
||||
p[i].y=tmpg1->p.y1;
|
||||
Free(tmpg1);
|
||||
tmpg1=tmpg;
|
||||
}
|
||||
res->type=eletype;
|
||||
res->nu.num=num;
|
||||
} else {
|
||||
tempg1=head2.next;
|
||||
tmpg1=head2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
tmpg=tmpg1->next;
|
||||
Free(tmpg1);
|
||||
tmpg1=tmpg;
|
||||
}
|
||||
res=NULL;
|
||||
}
|
||||
@@ -493,7 +493,7 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
{
|
||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,x3,y3;
|
||||
I32 *ptr;
|
||||
CSprite *res,*tempg,*tempg1,head2;
|
||||
CSprite *res,*tmpg,*tmpg1,head2;
|
||||
|
||||
QueInit(&head2);
|
||||
x3=a1-x; y3=a2-y;
|
||||
@@ -510,7 +510,7 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
res=head2.next;
|
||||
x1=x3; y1=y3;
|
||||
while (res!=&head2) {
|
||||
tempg=res->next;
|
||||
tmpg=res->next;
|
||||
if (res->p.x1==x1 && res->p.y1==y1) {
|
||||
QueRem(res);
|
||||
Free(res);
|
||||
@@ -519,7 +519,7 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
x1=res->p.x1;
|
||||
y1=res->p.y1;
|
||||
}
|
||||
res=tempg;
|
||||
res=tmpg;
|
||||
}
|
||||
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
@@ -528,16 +528,16 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
ptr=&res->npu.u;
|
||||
x1=x3; y1=y3;
|
||||
i=0;
|
||||
tempg1=head2.next;
|
||||
while (tempg1!=&head2) {
|
||||
tempg=tempg1->next;
|
||||
BFieldOrU32(ptr,i,polypt_map[SignI64(tempg1->p.x1-x1)+1+
|
||||
3*(SignI64(tempg1->p.y1-y1)+1)]);
|
||||
tmpg1=head2.next;
|
||||
while (tmpg1!=&head2) {
|
||||
tmpg=tmpg1->next;
|
||||
BFieldOrU32(ptr,i,polypt_map[SignI64(tmpg1->p.x1-x1)+1+
|
||||
3*(SignI64(tmpg1->p.y1-y1)+1)]);
|
||||
i+=3;
|
||||
x1=tempg1->p.x1;y1=tempg1->p.y1;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
x1=tmpg1->p.x1;y1=tmpg1->p.y1;
|
||||
QueRem(tmpg1);
|
||||
Free(tmpg1);
|
||||
tmpg1=tmpg;
|
||||
}
|
||||
res->type=SPT_POLYPT;
|
||||
res->npu.num=num;
|
||||
@@ -548,7 +548,7 @@ U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,CDC *dc,
|
||||
I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color,I64 *_cur_elem_num,
|
||||
I64 old_de_flags)
|
||||
{
|
||||
CSprite *tempg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num);
|
||||
CSprite *tmpg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num);
|
||||
I64 msg_code,x1,y1;
|
||||
U8 *st;
|
||||
doc_ce->de_flags|=DOCEF_DONT_DRAW;
|
||||
@@ -564,15 +564,15 @@ U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,CDC *dc,
|
||||
case SPT_TEXT_DIAMOND: GrTextDiamond3(dc,x1,y1,0,st); break;
|
||||
}
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x1=a1; y1=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(eletype)+StrLen(st)+1);
|
||||
tempg->type=eletype;
|
||||
tempg->ps.x1=x1-x;
|
||||
tempg->ps.y1=y1-y;
|
||||
StrCpy(tempg->ps.st,st);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(eletype)+StrLen(st)+1);
|
||||
tmpg->type=eletype;
|
||||
tmpg->ps.x1=x1-x;
|
||||
tmpg->ps.y1=y1-y;
|
||||
StrCpy(tmpg->ps.st,st);
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
*_cur_elem_num+=1;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
Bool sel,I64 xx1=0,I64 yy1=0,I64 xx2=0,I64 yy2=0,I64 *_cur_elem_num)
|
||||
{
|
||||
I64 i,msg_code,x=xx,y=yy,x1=a1,y1=a2,x2=a1,y2=a2,old_width;
|
||||
CSprite *tempg,*tempg1,*insert_pt;
|
||||
CSprite *tmpg,*tmpg1,*insert_pt;
|
||||
CDC *img;
|
||||
|
||||
insert_pt=SpriteSetSettings(,head,*_cur_elem_num,xx,yy,,,&x,&y);
|
||||
@@ -599,7 +599,7 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
GrBorder(dc,xx1,yy1,xx2,yy2);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
if (x2<x1) {
|
||||
xx1=x2; xx2=x1;
|
||||
@@ -616,18 +616,18 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
}
|
||||
|
||||
xx2++; yy2++;
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=xx1-x;
|
||||
tempg->pwhu.y1=yy1-y;
|
||||
img=DCNew(tempg->pwhu.width,tempg->pwhu.height,Fs);
|
||||
tmpg->type=SPT_BITMAP;
|
||||
tmpg->pwhu.width=xx2-xx1;
|
||||
tmpg->pwhu.height=yy2-yy1;
|
||||
tmpg->pwhu.x1=xx1-x;
|
||||
tmpg->pwhu.y1=yy1-y;
|
||||
img=DCNew(tmpg->pwhu.width,tmpg->pwhu.height,Fs);
|
||||
img->color=bm_bkcolor;
|
||||
GrRect(img,0,0,tempg->pwhu.width,tempg->pwhu.height);
|
||||
tempg1=insert_pt;
|
||||
if (tempg1==head || tempg1->type!=SPT_BITMAP) {
|
||||
GrRect(img,0,0,tmpg->pwhu.width,tmpg->pwhu.height);
|
||||
tmpg1=insert_pt;
|
||||
if (tmpg1==head || tmpg1->type!=SPT_BITMAP) {
|
||||
SpriteSetSettings(img,head,0,-(xx1-x),-(yy1-y));
|
||||
x=xx; y=yy;
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,doc_ce->bin_data->data);
|
||||
@@ -636,29 +636,29 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
*_cur_elem_num=1;
|
||||
} else {
|
||||
SpriteSetSettings(img,head,*_cur_elem_num,-(xx1-x),-(yy1-y));
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,&tempg1->start,TRUE);
|
||||
insert_pt=tempg1->next;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,&tmpg1->start,TRUE);
|
||||
insert_pt=tmpg1->next;
|
||||
QueRem(tmpg1);
|
||||
Free(tmpg1);
|
||||
}
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
MemCpy(&tmpg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
|
||||
switch (i=SpriteBitMapEd(doc,doc_ce,dc,&xx1,&yy1,
|
||||
&xx2,&yy2,&img,bm_bkcolor)) {
|
||||
case GE_EXIT:
|
||||
case GE_CONT:
|
||||
Free(tempg);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
case SPE_EXIT:
|
||||
case SPE_CONT:
|
||||
Free(tmpg);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=xx1-x;
|
||||
tempg->pwhu.y1=yy1-y;
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tmpg->type=eletype;
|
||||
tmpg->pwhu.width=xx2-xx1;
|
||||
tmpg->pwhu.height=yy2-yy1;
|
||||
tmpg->pwhu.x1=xx1-x;
|
||||
tmpg->pwhu.y1=yy1-y;
|
||||
MemCpy(&tmpg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
break;
|
||||
}
|
||||
QueIns(tempg,insert_pt->last);
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
DCDel(img);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
return i;
|
||||
@@ -666,46 +666,46 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
|
||||
U0 SMMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,I64 *_cur_elem_num)
|
||||
{
|
||||
CSprite *tempg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num),
|
||||
*tempg1=insert_pt;
|
||||
CSprite *tmpg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num),
|
||||
*tmpg1=insert_pt;
|
||||
CD3I32 *p;
|
||||
I64 i,size,x1,y1,z1;
|
||||
I32 *mesh,*old_mesh;
|
||||
if (tempg1!=head && tempg1->type==SPT_MESH)
|
||||
old_mesh=&tempg1->mu.vertex_cnt;
|
||||
else if (tempg1!=head && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->pmu.x;
|
||||
y1=tempg1->pmu.y;
|
||||
z1=tempg1->pmu.z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
if (tmpg1!=head && tmpg1->type==SPT_MESH)
|
||||
old_mesh=&tmpg1->mu.vertex_cnt;
|
||||
else if (tmpg1!=head && tmpg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tmpg1->pmu.x;
|
||||
y1=tmpg1->pmu.y;
|
||||
z1=tmpg1->pmu.z;
|
||||
p=&tmpg1->pmu.u;
|
||||
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->pmu.vertex_cnt;
|
||||
old_mesh=&tmpg1->pmu.vertex_cnt;
|
||||
} else
|
||||
old_mesh=NULL;
|
||||
if (mesh=SpriteMeshEd(old_mesh,&size,TRUE)) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=SPT_MESH;
|
||||
MemCpy(&tempg->mu.vertex_cnt,mesh,size);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_MESH)-sizeof(I32)*2+size);
|
||||
tmpg->type=SPT_MESH;
|
||||
MemCpy(&tmpg->mu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
if (old_mesh) {
|
||||
insert_pt=tempg;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
insert_pt=tmpg;
|
||||
QueRem(tmpg1);
|
||||
Free(tmpg1);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
} else
|
||||
*_cur_elem_num+=1;
|
||||
} else if (old_mesh && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->pmu.x;
|
||||
y1=tempg1->pmu.y;
|
||||
z1=tempg1->pmu.z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
} else if (old_mesh && tmpg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tmpg1->pmu.x;
|
||||
y1=tmpg1->pmu.y;
|
||||
z1=tmpg1->pmu.z;
|
||||
p=&tmpg1->pmu.u;
|
||||
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -716,72 +716,72 @@ U0 SMMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,I64 *_cur_elem_num)
|
||||
U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
I64 x,I64 y,I64 a1,I64 a2,I64 *_cur_elem_num)
|
||||
{
|
||||
CSprite *tempg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num),
|
||||
*tempg1=insert_pt;
|
||||
CSprite *tmpg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num),
|
||||
*tmpg1=insert_pt;
|
||||
CD3I32 *p;
|
||||
I64 i,size,z,x1,y1,z1;
|
||||
I32 *mesh,*old_mesh;
|
||||
if (tempg1!=head && tempg1->type==SPT_MESH) {
|
||||
if (tmpg1!=head && tmpg1->type==SPT_MESH) {
|
||||
z=0;
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
z1=z;
|
||||
p=&tempg1->mu.u;
|
||||
for (i=0;i<tempg1->mu.vertex_cnt;i++,p++) {
|
||||
p=&tmpg1->mu.u;
|
||||
for (i=0;i<tmpg1->mu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->mu.vertex_cnt;
|
||||
} else if (tempg1!=head && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
z=-tempg1->pmu.z;
|
||||
x1=tempg1->pmu.x-(a1-x);
|
||||
y1=tempg1->pmu.y-(a2-y);
|
||||
z1=tempg1->pmu.z+z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
old_mesh=&tmpg1->mu.vertex_cnt;
|
||||
} else if (tmpg1!=head && tmpg1->type==SPT_SHIFTABLE_MESH) {
|
||||
z=-tmpg1->pmu.z;
|
||||
x1=tmpg1->pmu.x-(a1-x);
|
||||
y1=tmpg1->pmu.y-(a2-y);
|
||||
z1=tmpg1->pmu.z+z;
|
||||
p=&tmpg1->pmu.u;
|
||||
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->pmu.vertex_cnt;
|
||||
old_mesh=&tmpg1->pmu.vertex_cnt;
|
||||
} else {
|
||||
z=0;
|
||||
old_mesh=NULL;
|
||||
}
|
||||
if (mesh=SpriteMeshEd(old_mesh,&size,TRUE)) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_SHIFTABLE_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=SPT_SHIFTABLE_MESH;
|
||||
MemCpy(&tempg->pmu.vertex_cnt,mesh,size);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_SHIFTABLE_MESH)-sizeof(I32)*2+size);
|
||||
tmpg->type=SPT_SHIFTABLE_MESH;
|
||||
MemCpy(&tmpg->pmu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
tempg->pmu.x=a1-x;
|
||||
tempg->pmu.y=a2-y;
|
||||
tempg->pmu.z=-z;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg->pmu.x=a1-x;
|
||||
tmpg->pmu.y=a2-y;
|
||||
tmpg->pmu.z=-z;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
if (old_mesh) {
|
||||
insert_pt=tempg;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
insert_pt=tmpg;
|
||||
QueRem(tmpg1);
|
||||
Free(tmpg1);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
} else
|
||||
*_cur_elem_num+=1;
|
||||
} else if (old_mesh && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->pmu.x-(a1-x);
|
||||
y1=tempg1->pmu.y-(a2-y);
|
||||
z1=tempg1->pmu.z+z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
} else if (old_mesh && tmpg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tmpg1->pmu.x-(a1-x);
|
||||
y1=tmpg1->pmu.y-(a2-y);
|
||||
z1=tmpg1->pmu.z+z;
|
||||
p=&tmpg1->pmu.u;
|
||||
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
}
|
||||
} else if (old_mesh && tempg1->type==SPT_MESH) {
|
||||
} else if (old_mesh && tmpg1->type==SPT_MESH) {
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
z1= z;
|
||||
p=&tempg1->mu.u;
|
||||
for (i=0;i<tempg1->mu.vertex_cnt;i++,p++) {
|
||||
p=&tmpg1->mu.u;
|
||||
for (i=0;i<tmpg1->mu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -793,11 +793,11 @@ U0 SMTaskTitleSet(I64 eletype)
|
||||
{
|
||||
Fs->title_src=TTS_CONST; //Violates TTS_LOCKED_CONST
|
||||
switch (eletype) {
|
||||
case SPT_INS_SCREEN_BITMAP:
|
||||
StrCpy(Fs->task_title,"Insert Screen BitMap");
|
||||
case SPT_INS_SCRN_BITMAP:
|
||||
StrCpy(Fs->task_title,"Insert Scrn BitMap");
|
||||
break;
|
||||
case SPT_INS_TRANSPARENT_SCREEN_BITMAP:
|
||||
StrCpy(Fs->task_title,"Insert Transparent Screen BitMap");
|
||||
case SPT_INS_TRANSPARENT_SCRN_BITMAP:
|
||||
StrCpy(Fs->task_title,"Insert Transparent Scrn BitMap");
|
||||
break;
|
||||
default:
|
||||
if (eletype>=0)
|
||||
@@ -813,13 +813,13 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
cur_elem_num,old_border_src=Fs->border_src,old_title_src=Fs->title_src,
|
||||
old_de_flags=doc_ce->de_flags;
|
||||
CColorROPU32 bm_bkcolor,color;
|
||||
CSprite *head,*tempg,*insert_pt;
|
||||
CSprite *head,*tmpg,*insert_pt;
|
||||
CDC *dc=DCAlias(,Fs),*dc2=DCAlias(,sys_winmgr_task),*dc3;
|
||||
U8 *old_task_title=StrNew(Fs->task_title);
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
AutoComplete;
|
||||
WinMgrSync(2,TRUE);
|
||||
Refresh(2,TRUE);
|
||||
dc2->flags|=DCF_ON_TOP;
|
||||
head=Sprite2SpriteQue(doc_ce->bin_data->data);
|
||||
cur_elem_num=QueCnt(head);
|
||||
@@ -873,10 +873,10 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
i=PopUpColor(,,FALSE);
|
||||
if (i>=0) {
|
||||
color=i;
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->c.color=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tmpg->type=SPT_COLOR;
|
||||
tmpg->c.color=color;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
}
|
||||
@@ -888,10 +888,10 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
i=PopUpColorDither;
|
||||
if (i>=0) {
|
||||
color=i;
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_DITHER_COLOR));
|
||||
tempg->type=SPT_DITHER_COLOR;
|
||||
tempg->d.dither_color=color.c0.color|color.c1.color<<8;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_DITHER_COLOR));
|
||||
tmpg->type=SPT_DITHER_COLOR;
|
||||
tmpg->d.dither_color=color.c0.color|color.c1.color<<8;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
}
|
||||
@@ -900,9 +900,9 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
break;
|
||||
case SPT_ED_MENU:
|
||||
switch (SpriteEd(doc,doc_ce,x,y,&head,&cur_elem_num)) {
|
||||
case GE_ABORT: eletype=DOCM_CANCEL; break;
|
||||
case GE_EXIT: eletype=SPT_EXIT; break;
|
||||
case GE_CONT: eletype=SPT_MENU; break;
|
||||
case SPE_ABORT: eletype=DOCM_CANCEL; break;
|
||||
case SPE_EXIT: eletype=SPT_EXIT; break;
|
||||
case SPE_CONT: eletype=SPT_MENU; break;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
@@ -934,7 +934,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
PopUpOk("Select Origin.\n");
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
break;
|
||||
case SPT_INS_SCREEN_BITMAP:
|
||||
case SPT_INS_SCRN_BITMAP:
|
||||
doc_ce->de_flags|=DOCEF_DONT_DRAW;
|
||||
PopUpOk("Drag-out a rect for the extents of the\nbitmap.\n");
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
@@ -957,8 +957,8 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
xx1+=xx; yy1+=yy;
|
||||
xx2+=xx; yy2+=yy;
|
||||
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==GE_EXIT) {
|
||||
res=GE_EXIT;
|
||||
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==SPE_EXIT) {
|
||||
res=SPE_EXIT;
|
||||
goto ei_done;
|
||||
}
|
||||
eletype=SPT_MENU;
|
||||
@@ -966,7 +966,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
}
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
break;
|
||||
case SPT_INS_TRANSPARENT_SCREEN_BITMAP:
|
||||
case SPT_INS_TRANSPARENT_SCRN_BITMAP:
|
||||
doc_ce->de_flags|=DOCEF_DONT_DRAW;
|
||||
i=PopUpColor("Color to Become Transparent\n\n",,FALSE);
|
||||
if (i<0)
|
||||
@@ -984,10 +984,10 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
i=PopUpRangeI64(1,16,1,"Pen Width\n");
|
||||
if (i>=1) {
|
||||
width=i;
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_WIDTH));
|
||||
tempg->type=SPT_WIDTH;
|
||||
tempg->w.width=width;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_WIDTH));
|
||||
tmpg->type=SPT_WIDTH;
|
||||
tmpg->w.width=width;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
}
|
||||
@@ -996,12 +996,12 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
case SPT_TRANSFORM_OFF:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_TRANSFORM_ON));
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_TRANSFORM_ON));
|
||||
if (eletype==SPT_TRANSFORM_ON)
|
||||
tempg->type=SPT_TRANSFORM_ON;
|
||||
tmpg->type=SPT_TRANSFORM_ON;
|
||||
else
|
||||
tempg->type=SPT_TRANSFORM_OFF;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg->type=SPT_TRANSFORM_OFF;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
eletype=SPT_MENU;
|
||||
@@ -1026,39 +1026,39 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
insert_pt=SpriteSetSettings(dc,head,cur_elem_num,xx,yy,
|
||||
&color,&width,&x,&y);
|
||||
x+=xx; y+=yy;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
if (eletype==SPT_EXIT) {
|
||||
res=GE_EXIT;
|
||||
res=SPE_EXIT;
|
||||
goto ei_done;
|
||||
} else if (eletype==DOCM_CANCEL) {
|
||||
res=GE_ABORT;
|
||||
res=SPE_ABORT;
|
||||
goto ei_done;
|
||||
}
|
||||
switch (GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case CH_ESC:
|
||||
res=GE_EXIT;
|
||||
res=SPE_EXIT;
|
||||
goto ei_done;
|
||||
case CH_SHIFT_ESC:
|
||||
res=GE_ABORT;
|
||||
res=SPE_ABORT;
|
||||
goto ei_done;
|
||||
case 'c': //eye-dropper
|
||||
dc3=DCScreenCapture(FALSE);
|
||||
dc3=DCScrnCapture(FALSE);
|
||||
color=GrPeek(dc3,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc3);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->c.color=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tmpg->type=SPT_COLOR;
|
||||
tmpg->c.color=color;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
break;
|
||||
case 't': //Set to transparent color
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->c.color=TRANSPARENT;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tmpg->type=SPT_COLOR;
|
||||
tmpg->c.color=TRANSPARENT;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
break;
|
||||
@@ -1066,9 +1066,9 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
if (eletype==SPT_PLANAR_SYMMETRY) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
tempg->type=SPT_PLANAR_SYMMETRY;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
tmpg->type=SPT_PLANAR_SYMMETRY;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
eletype=SPT_MENU;
|
||||
@@ -1079,62 +1079,62 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
switch (eletype) {
|
||||
start:
|
||||
case SPT_LINE:
|
||||
tempg=SMLine(dc,x,y,a1,a2,color);
|
||||
tmpg=SMLine(dc,x,y,a1,a2,color);
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
tempg=SMArrow(dc,x,y,a1,a2,color);
|
||||
tmpg=SMArrow(dc,x,y,a1,a2,color);
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
tempg=SMPlanarSymmetry(dc,x,y,a1,a2);
|
||||
tmpg=SMPlanarSymmetry(dc,x,y,a1,a2);
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case SPT_RECT:
|
||||
tempg=SMRect(dc,x,y,a1,a2,color);
|
||||
tmpg=SMRect(dc,x,y,a1,a2,color);
|
||||
break;
|
||||
case SPT_INS_SCREEN_BITMAP:
|
||||
case SPT_INS_TRANSPARENT_SCREEN_BITMAP:
|
||||
tempg=SMScreenBitMap(eletype,dc,dc2,x,y,a1,a2,bm_bkcolor);
|
||||
case SPT_INS_SCRN_BITMAP:
|
||||
case SPT_INS_TRANSPARENT_SCRN_BITMAP:
|
||||
tmpg=SMScrnBitMap(eletype,dc,dc2,x,y,a1,a2,bm_bkcolor);
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
tempg=SMCircle(dc,x,y,a1,a2,color);
|
||||
tmpg=SMCircle(dc,x,y,a1,a2,color);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
tempg=SMEllipse(dc,x,y,a1,a2,color);
|
||||
tmpg=SMEllipse(dc,x,y,a1,a2,color);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
tempg=SMPolygon(dc,x,y,a1,a2,i,color);
|
||||
tmpg=SMPolygon(dc,x,y,a1,a2,i,color);
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(eletype));
|
||||
tempg->type=eletype;
|
||||
tempg->p.x1=a1-x;
|
||||
tempg->p.y1=a2-y;
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(eletype));
|
||||
tmpg->type=eletype;
|
||||
tmpg->p.x1=a1-x;
|
||||
tmpg->p.y1=a2-y;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
tempg=SMPolyLineFamily(eletype,dc,x,y,a1,a2,color);
|
||||
tmpg=SMPolyLineFamily(eletype,dc,x,y,a1,a2,color);
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
tempg=SMPolyPoint(dc,x,y,a1,a2,color);
|
||||
tmpg=SMPolyPoint(dc,x,y,a1,a2,color);
|
||||
break;
|
||||
end:
|
||||
if (tempg) {
|
||||
QueIns(tempg,insert_pt->last);
|
||||
if (tmpg) {
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
cur_elem_num++;
|
||||
}
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
TRUE,,,,,&cur_elem_num)==GE_EXIT) {
|
||||
res=GE_EXIT;
|
||||
TRUE,,,,,&cur_elem_num)==SPE_EXIT) {
|
||||
res=SPE_EXIT;
|
||||
goto ei_done;
|
||||
}
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
@@ -1172,33 +1172,33 @@ U0 EdSpriteIns(CDoc *doc)
|
||||
Bool unlock;
|
||||
U8 *st;
|
||||
CDocEntry *doc_e;
|
||||
CDocBin *tempb;
|
||||
CDocBin *tmpb;
|
||||
if (Fs!=doc->mem_task)
|
||||
throw('Graphics');
|
||||
if (st=EdSprite(doc->cur_bin_num)) {
|
||||
unlock=DocLock(doc);
|
||||
tempb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
tempb->size=sprite_elem_base_sizes[SPT_END];
|
||||
tempb->data=CAlloc(tempb->size,doc->mem_task);
|
||||
tempb->num=doc->cur_bin_num++;
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_head.last);
|
||||
tmpb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
tmpb->size=sprite_elem_base_sizes[SPT_END];
|
||||
tmpb->data=CAlloc(tmpb->size,doc->mem_task);
|
||||
tmpb->num=doc->cur_bin_num++;
|
||||
tmpb->use_cnt=1;
|
||||
QueIns(tmpb,doc->bin_head.last);
|
||||
doc_e=DocPrint(doc,"%s",st);
|
||||
doc_e->bin_data=tempb;
|
||||
doc_e->bin_data=tmpb;
|
||||
Free(st);
|
||||
if (doc_e) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag && *doc_e->tag)
|
||||
tempb->tag=StrNew(doc_e->tag,doc->mem_task);
|
||||
tmpb->tag=StrNew(doc_e->tag,doc->mem_task);
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_col=0;
|
||||
DocUnlock(doc);
|
||||
DocRecalc(doc);
|
||||
if (SpriteMainEd(doc)==GE_ABORT) {
|
||||
if (SpriteMainEd(doc)==SPE_ABORT) {
|
||||
DocLock(doc);
|
||||
DocEntryDel(doc,doc_e);
|
||||
}
|
||||
} else
|
||||
DocBinDel(doc,tempb);
|
||||
DocBinDel(doc,tmpb);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -1209,21 +1209,21 @@ U0 EdSpriteIns(CDoc *doc)
|
||||
U0 EdSpriteEd(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce;
|
||||
CDocBin *tempb;
|
||||
CDocBin *tmpb;
|
||||
CSprite *old_csprite;
|
||||
I64 old_size;
|
||||
Bool unlock=DocLock(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
tempb=doc_ce->bin_data;
|
||||
old_size=tempb->size;
|
||||
old_csprite=tempb->data;
|
||||
tempb->data=MAllocIdent(old_csprite,doc->mem_task);
|
||||
tmpb=doc_ce->bin_data;
|
||||
old_size=tmpb->size;
|
||||
old_csprite=tmpb->data;
|
||||
tmpb->data=MAllocIdent(old_csprite,doc->mem_task);
|
||||
DocUnlock(doc);
|
||||
if (SpriteMainEd(doc)==GE_ABORT) {
|
||||
if (SpriteMainEd(doc)==SPE_ABORT) {
|
||||
DocLock(doc);
|
||||
Free(tempb->data);
|
||||
tempb->data=old_csprite;
|
||||
tempb->size=old_size;
|
||||
Free(tmpb->data);
|
||||
tmpb->data=old_csprite;
|
||||
tmpb->size=old_size;
|
||||
} else
|
||||
Free(old_csprite);
|
||||
if (unlock)
|
||||
|
||||
+296
-296
@@ -13,7 +13,7 @@ class CMeshEdVertex
|
||||
CD3I32 p; //World coordinates of the point.
|
||||
U0 end;
|
||||
CD3I32 p0,
|
||||
pt; //Transformed coordinates. (Screen)
|
||||
pt; //Transformed coordinates. (Scrn)
|
||||
I32 num,flags;
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ class CMeshFrame
|
||||
F64 view_scale;
|
||||
CDC *dc;
|
||||
I32 *depth_buf;
|
||||
I64 *w2s,*s2w; //Screen-to-world and world-to-screen transform matrices.
|
||||
I64 *w2s,*s2w; //Scrn-to-world and world-to-scrn transform matrices.
|
||||
I64 vertex_cnt,tri_cnt; //Set by MeshSize
|
||||
CMeshEdVertex vertex_head,*cur_vertex,*chain_pred;
|
||||
CMeshEdTri tri_head,*cur_tri;
|
||||
@@ -51,128 +51,128 @@ class CMeshFrame
|
||||
|
||||
CMeshEdVertex *MeshVertexNew(CMeshFrame *e,I64 x,I64 y,I64 z)
|
||||
{
|
||||
CMeshEdVertex *tempv=CAlloc(sizeof(CMeshEdVertex));
|
||||
tempv->p.x=x;
|
||||
tempv->p.y=y;
|
||||
tempv->p.z=z;
|
||||
QueIns(tempv,e->vertex_head.last);
|
||||
return tempv;
|
||||
CMeshEdVertex *tmpv=CAlloc(sizeof(CMeshEdVertex));
|
||||
tmpv->p.x=x;
|
||||
tmpv->p.y=y;
|
||||
tmpv->p.z=z;
|
||||
QueIns(tmpv,e->vertex_head.last);
|
||||
return tmpv;
|
||||
}
|
||||
|
||||
CMeshEdTri *MeshTriNew(CMeshFrame *e,CColorROPU32 color,
|
||||
CMeshEdVertex *v1,CMeshEdVertex *v2,CMeshEdVertex *v3)
|
||||
{
|
||||
static I64 cpu_num=0;
|
||||
CMeshEdTri *tempt=CAlloc(sizeof(CMeshEdTri));
|
||||
tempt->cpu_num=cpu_num++%mp_cnt;
|
||||
tempt->mt.color=color;
|
||||
tempt->t[0]=v1;
|
||||
tempt->t[1]=v2;
|
||||
tempt->t[2]=v3;
|
||||
QueIns(tempt,e->tri_head.last);
|
||||
return tempt;
|
||||
CMeshEdTri *tmpt=CAlloc(sizeof(CMeshEdTri));
|
||||
tmpt->cpu_num=cpu_num++%mp_cnt;
|
||||
tmpt->mt.color=color;
|
||||
tmpt->t[0]=v1;
|
||||
tmpt->t[1]=v2;
|
||||
tmpt->t[2]=v3;
|
||||
QueIns(tmpt,e->tri_head.last);
|
||||
return tmpt;
|
||||
}
|
||||
|
||||
CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
|
||||
{//Screen coordinates
|
||||
CMeshEdVertex *res=NULL,*tempv=e->vertex_head.next;
|
||||
{//Scrn coordinates
|
||||
CMeshEdVertex *res=NULL,*tmpv=e->vertex_head.next;
|
||||
I64 dd,dz,best_dd=MAX_I64,best_dz=MAX_I64;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (!(tempv->flags&VF_IGNORE)) {
|
||||
dd=SqrI64(x-tempv->pt.x)+SqrI64(y-tempv->pt.y);
|
||||
dz=AbsI64(e->ip_z-tempv->p.z);
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (!(tmpv->flags&VF_IGNORE)) {
|
||||
dd=SqrI64(x-tmpv->pt.x)+SqrI64(y-tmpv->pt.y);
|
||||
dz=AbsI64(e->ip_z-tmpv->p.z);
|
||||
if (dd<best_dd || dd==best_dd && dz<best_dz) {
|
||||
res=tempv;
|
||||
res=tmpv;
|
||||
best_dd=dd;
|
||||
best_dz=dz;
|
||||
}
|
||||
}
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
CMeshEdVertex *MeshVertexFindNum(CMeshFrame *haystack_e,I64 needle_num)
|
||||
{
|
||||
CMeshEdVertex *tempv=haystack_e->vertex_head.next;
|
||||
while (tempv!=&haystack_e->vertex_head) {
|
||||
if (tempv->num==needle_num)
|
||||
return tempv;
|
||||
tempv=tempv->next;
|
||||
CMeshEdVertex *tmpv=haystack_e->vertex_head.next;
|
||||
while (tmpv!=&haystack_e->vertex_head) {
|
||||
if (tmpv->num==needle_num)
|
||||
return tmpv;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 MeshTriDel(CMeshFrame *e,CMeshEdTri *tempt)
|
||||
U0 MeshTriDel(CMeshFrame *e,CMeshEdTri *tmpt)
|
||||
{
|
||||
if (tempt) {
|
||||
if (tempt==e->cur_tri)
|
||||
if (tmpt) {
|
||||
if (tmpt==e->cur_tri)
|
||||
e->cur_tri=NULL;
|
||||
QueRem(tempt);
|
||||
Free(tempt);
|
||||
QueRem(tmpt);
|
||||
Free(tmpt);
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshVertexDel(CMeshFrame *e,CMeshEdVertex *tempv)
|
||||
U0 MeshVertexDel(CMeshFrame *e,CMeshEdVertex *tmpv)
|
||||
{
|
||||
I64 i;
|
||||
CMeshEdTri *tempt,*tempt1;
|
||||
if (tempv) {
|
||||
tempt=e->tri_head.next;
|
||||
while (tempt!=&e->tri_head) {
|
||||
tempt1=tempt->next;
|
||||
CMeshEdTri *tmpt,*tmpt1;
|
||||
if (tmpv) {
|
||||
tmpt=e->tri_head.next;
|
||||
while (tmpt!=&e->tri_head) {
|
||||
tmpt1=tmpt->next;
|
||||
for (i=0;i<3;i++)
|
||||
if (tempt->t[i]==tempv)
|
||||
if (tmpt->t[i]==tmpv)
|
||||
break;
|
||||
if (i<3)
|
||||
MeshTriDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
MeshTriDel(e,tmpt);
|
||||
tmpt=tmpt1;
|
||||
}
|
||||
if (tempv==e->cur_vertex)
|
||||
if (tmpv==e->cur_vertex)
|
||||
e->cur_vertex=NULL;
|
||||
if (tempv==e->chain_pred)
|
||||
if (tmpv==e->chain_pred)
|
||||
e->chain_pred=NULL;
|
||||
QueRem(tempv);
|
||||
Free(tempv);
|
||||
QueRem(tmpv);
|
||||
Free(tmpv);
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshFence(CMeshFrame *e)
|
||||
{
|
||||
CMeshEdVertex *tempv,*tempv1,*tempv_last=NULL,*tempv1_last=NULL,
|
||||
CMeshEdVertex *tmpv,*tmpv1,*tmpv_last=NULL,*tmpv1_last=NULL,
|
||||
*start=e->chain_pred->next,*end=e->vertex_head.last;
|
||||
tempv=start;
|
||||
tmpv=start;
|
||||
while (TRUE) {
|
||||
tempv1=MeshVertexNew(e,tempv->p.x,tempv->p.y,tempv->p.z+e->thickness);
|
||||
if (tempv_last) {
|
||||
MeshTriNew(e,e->cur_color,tempv_last,tempv,tempv1);
|
||||
MeshTriNew(e,e->cur_color,tempv1,tempv1_last,tempv_last);
|
||||
tmpv1=MeshVertexNew(e,tmpv->p.x,tmpv->p.y,tmpv->p.z+e->thickness);
|
||||
if (tmpv_last) {
|
||||
MeshTriNew(e,e->cur_color,tmpv_last,tmpv,tmpv1);
|
||||
MeshTriNew(e,e->cur_color,tmpv1,tmpv1_last,tmpv_last);
|
||||
}
|
||||
tempv_last=tempv;
|
||||
tempv1_last=tempv1;
|
||||
if (tempv==end)
|
||||
tmpv_last=tmpv;
|
||||
tmpv1_last=tmpv1;
|
||||
if (tmpv==end)
|
||||
break;
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
if (e->closed && tempv_last) {
|
||||
MeshTriNew(e,e->cur_color,tempv_last,start,end->next);
|
||||
MeshTriNew(e,e->cur_color,end->next,tempv1_last,tempv_last);
|
||||
if (e->closed && tmpv_last) {
|
||||
MeshTriNew(e,e->cur_color,tmpv_last,start,end->next);
|
||||
MeshTriNew(e,e->cur_color,end->next,tmpv1_last,tmpv_last);
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshPolygon(CMeshFrame *e,CMeshEdVertex *start,CMeshEdVertex *end,Bool rev)
|
||||
{
|
||||
CMeshEdVertex *tempv,*tempv1;
|
||||
CMeshEdVertex *tmpv,*tmpv1;
|
||||
if (start!=end) {
|
||||
tempv=start;
|
||||
tempv1=tempv->next;
|
||||
while (tempv1!=end) {
|
||||
tmpv=start;
|
||||
tmpv1=tmpv->next;
|
||||
while (tmpv1!=end) {
|
||||
if (rev)
|
||||
MeshTriNew(e,e->cur_color,tempv1,tempv,end);
|
||||
MeshTriNew(e,e->cur_color,tmpv1,tmpv,end);
|
||||
else
|
||||
MeshTriNew(e,e->cur_color,tempv,tempv1,end);
|
||||
tempv=tempv->next;
|
||||
tempv1=tempv1->next;
|
||||
MeshTriNew(e,e->cur_color,tmpv,tmpv1,end);
|
||||
tmpv=tmpv->next;
|
||||
tmpv1=tmpv1->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,58 +187,58 @@ U0 MeshPrism(CMeshFrame *e)
|
||||
|
||||
U0 MeshVertexSelAll(CMeshFrame *e,Bool val)
|
||||
{
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (val)
|
||||
tempv->flags|=VF_SEL;
|
||||
tmpv->flags|=VF_SEL;
|
||||
else
|
||||
tempv->flags&=~VF_SEL;
|
||||
tempv=tempv->next;
|
||||
tmpv->flags&=~VF_SEL;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshTriSelAll(CMeshFrame *e,Bool val)
|
||||
{
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
while (tempt!=&e->tri_head) {
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
while (tmpt!=&e->tri_head) {
|
||||
if (val)
|
||||
tempt->flags|=TF_SEL;
|
||||
tmpt->flags|=TF_SEL;
|
||||
else
|
||||
tempt->flags&=~TF_SEL;
|
||||
tempt=tempt->next;
|
||||
tmpt->flags&=~TF_SEL;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshVertexIgnoreSet(CMeshFrame *e,Bool val)
|
||||
{
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
tempv->flags&=~VF_IGNORE;
|
||||
if (tempv->flags&VF_SEL && val)
|
||||
tempv->flags|=VF_IGNORE;
|
||||
tempv=tempv->next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
tmpv->flags&=~VF_IGNORE;
|
||||
if (tmpv->flags&VF_SEL && val)
|
||||
tmpv->flags|=VF_IGNORE;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshP0Capture(CMeshFrame *e)
|
||||
{
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
MemCpy(&tempv->p0,&tempv->p,sizeof(CD3I32));
|
||||
tempv=tempv->next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
MemCpy(&tmpv->p0,&tmpv->p,sizeof(CD3I32));
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshP0Offset(CMeshFrame *e,I64 dx,I64 dy,I64 dz)
|
||||
{
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (tempv->flags&VF_SEL) {
|
||||
tempv->p.x=tempv->p0.x+dx;
|
||||
tempv->p.y=tempv->p0.y+dy;
|
||||
tempv->p.z=tempv->p0.z+dz;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (tmpv->flags&VF_SEL) {
|
||||
tmpv->p.x=tmpv->p0.x+dx;
|
||||
tmpv->p.y=tmpv->p0.y+dy;
|
||||
tmpv->p.z=tmpv->p0.z+dz;
|
||||
}
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,69 +248,69 @@ U0 MeshP0Offset(CMeshFrame *e,I64 dx,I64 dy,I64 dz)
|
||||
|
||||
U0 MeshVertexSelRect(CMeshFrame *e,I64 sel_mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
{
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
if (x1>x2) SwapI64(&x1,&x2);
|
||||
if (y1>y2) SwapI64(&y1,&y2);
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (x1<=tempv->pt.x<=x2 &&
|
||||
y1<=tempv->pt.y<=y2) {
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (x1<=tmpv->pt.x<=x2 &&
|
||||
y1<=tmpv->pt.y<=y2) {
|
||||
if (sel_mode==SEL_MESH_AND)
|
||||
tempv->flags&=~VF_SEL;
|
||||
tmpv->flags&=~VF_SEL;
|
||||
else
|
||||
tempv->flags|=VF_SEL;
|
||||
tmpv->flags|=VF_SEL;
|
||||
} else if (sel_mode==SEL_MESH_EQU)
|
||||
tempv->flags&=~VF_SEL;
|
||||
tempv=tempv->next;
|
||||
tmpv->flags&=~VF_SEL;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshTriSelRect(CMeshFrame *e,I64 sel_mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
{
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
if (x1>x2) SwapI64(&x1,&x2);
|
||||
if (y1>y2) SwapI64(&y1,&y2);
|
||||
while (tempt!=&e->tri_head) {
|
||||
if (x1<=tempt->t[0]->pt.x<=x2 &&
|
||||
y1<=tempt->t[0]->pt.y<=y2 &&
|
||||
x1<=tempt->t[1]->pt.x<=x2 &&
|
||||
y1<=tempt->t[1]->pt.y<=y2 &&
|
||||
x1<=tempt->t[2]->pt.x<=x2 &&
|
||||
y1<=tempt->t[2]->pt.y<=y2) {
|
||||
while (tmpt!=&e->tri_head) {
|
||||
if (x1<=tmpt->t[0]->pt.x<=x2 &&
|
||||
y1<=tmpt->t[0]->pt.y<=y2 &&
|
||||
x1<=tmpt->t[1]->pt.x<=x2 &&
|
||||
y1<=tmpt->t[1]->pt.y<=y2 &&
|
||||
x1<=tmpt->t[2]->pt.x<=x2 &&
|
||||
y1<=tmpt->t[2]->pt.y<=y2) {
|
||||
if (sel_mode==SEL_MESH_AND)
|
||||
tempt->flags&=~TF_SEL;
|
||||
tmpt->flags&=~TF_SEL;
|
||||
else
|
||||
tempt->flags|=TF_SEL;
|
||||
tmpt->flags|=TF_SEL;
|
||||
} else {
|
||||
if (sel_mode==SEL_MESH_EQU)
|
||||
tempt->flags&=~TF_SEL;
|
||||
tmpt->flags&=~TF_SEL;
|
||||
else if (sel_mode==SEL_MESH_AND) {
|
||||
if (x1<=tempt->t[0]->pt.x<=x2 &&
|
||||
y1<=tempt->t[0]->pt.y<=y2 ||
|
||||
x1<=tempt->t[1]->pt.x<=x2 &&
|
||||
y1<=tempt->t[1]->pt.y<=y2 ||
|
||||
x1<=tempt->t[2]->pt.x<=x2 &&
|
||||
y1<=tempt->t[2]->pt.y<=y2)
|
||||
tempt->flags&=~TF_SEL;
|
||||
if (x1<=tmpt->t[0]->pt.x<=x2 &&
|
||||
y1<=tmpt->t[0]->pt.y<=y2 ||
|
||||
x1<=tmpt->t[1]->pt.x<=x2 &&
|
||||
y1<=tmpt->t[1]->pt.y<=y2 ||
|
||||
x1<=tmpt->t[2]->pt.x<=x2 &&
|
||||
y1<=tmpt->t[2]->pt.y<=y2)
|
||||
tmpt->flags&=~TF_SEL;
|
||||
}
|
||||
}
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
}
|
||||
|
||||
I64 MeshSelCnt(CMeshFrame *e)
|
||||
{
|
||||
I64 res=0;
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (tempv->flags&VF_SEL)
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (tmpv->flags&VF_SEL)
|
||||
res++;
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
while (tempt!=&e->tri_head) {
|
||||
if (tempt->flags&TF_SEL)
|
||||
while (tmpt!=&e->tri_head) {
|
||||
if (tmpt->flags&TF_SEL)
|
||||
res++;
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -318,16 +318,16 @@ I64 MeshSelCnt(CMeshFrame *e)
|
||||
U0 MeshSwapAxes(CMeshFrame *e,I64 o1,I64 o2)
|
||||
{
|
||||
Bool unsel;
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
if (!MeshSelCnt(e)) {
|
||||
MeshVertexSelAll(e,TRUE);
|
||||
unsel=TRUE;
|
||||
} else
|
||||
unsel=FALSE;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (tempv->flags&VF_SEL)
|
||||
SwapU32((&tempv->p)(U8 *)+o1,(&tempv->p)(U8 *)+o2);
|
||||
tempv=tempv->next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (tmpv->flags&VF_SEL)
|
||||
SwapU32((&tmpv->p)(U8 *)+o1,(&tmpv->p)(U8 *)+o2);
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
if (unsel)
|
||||
MeshVertexSelAll(e,FALSE);
|
||||
@@ -336,16 +336,16 @@ U0 MeshSwapAxes(CMeshFrame *e,I64 o1,I64 o2)
|
||||
U0 MeshInvertAxis(CMeshFrame *e,I64 o)
|
||||
{
|
||||
Bool unsel;
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
if (!MeshSelCnt(e)) {
|
||||
MeshVertexSelAll(e,TRUE);
|
||||
unsel=TRUE;
|
||||
} else
|
||||
unsel=FALSE;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (tempv->flags&VF_SEL)
|
||||
*((&tempv->p)(U8 *)+o)(I32 *)=-*((&tempv->p)(U8 *)+o)(I32 *);
|
||||
tempv=tempv->next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (tmpv->flags&VF_SEL)
|
||||
*((&tmpv->p)(U8 *)+o)(I32 *)=-*((&tmpv->p)(U8 *)+o)(I32 *);
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
if (unsel)
|
||||
MeshVertexSelAll(e,FALSE);
|
||||
@@ -355,20 +355,20 @@ U0 MeshTransformSel(CMeshFrame *e)
|
||||
{
|
||||
Bool unsel;
|
||||
I64 r[16],x,y,z;
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
if (PopUpTransform(r)) {
|
||||
if (!MeshSelCnt(e)) {
|
||||
MeshVertexSelAll(e,TRUE);
|
||||
unsel=TRUE;
|
||||
} else
|
||||
unsel=FALSE;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (tempv->flags&VF_SEL) {
|
||||
x=tempv->p.x; y=tempv->p.y; z=tempv->p.z;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (tmpv->flags&VF_SEL) {
|
||||
x=tmpv->p.x; y=tmpv->p.y; z=tmpv->p.z;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempv->p.x=x; tempv->p.y=y; tempv->p.z=z;
|
||||
tmpv->p.x=x; tmpv->p.y=y; tmpv->p.z=z;
|
||||
}
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
if (unsel)
|
||||
MeshVertexSelAll(e,FALSE);
|
||||
@@ -378,16 +378,16 @@ U0 MeshTransformSel(CMeshFrame *e)
|
||||
U0 MeshColorTris(CMeshFrame *e)
|
||||
{
|
||||
Bool unsel;
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
if (!MeshSelCnt(e)) {
|
||||
MeshTriSelAll(e,TRUE);
|
||||
unsel=TRUE;
|
||||
} else
|
||||
unsel=FALSE;
|
||||
while (tempt!=&e->tri_head) {
|
||||
if (tempt->flags & TF_SEL)
|
||||
tempt->mt.color=e->cur_color;
|
||||
tempt=tempt->next;
|
||||
while (tmpt!=&e->tri_head) {
|
||||
if (tmpt->flags & TF_SEL)
|
||||
tmpt->mt.color=e->cur_color;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
if (unsel)
|
||||
MeshTriSelAll(e,FALSE);
|
||||
@@ -396,16 +396,16 @@ U0 MeshColorTris(CMeshFrame *e)
|
||||
U0 MeshRevTris(CMeshFrame *e)
|
||||
{
|
||||
Bool unsel;
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
if (!MeshSelCnt(e)) {
|
||||
MeshTriSelAll(e,TRUE);
|
||||
unsel=TRUE;
|
||||
} else
|
||||
unsel=FALSE;
|
||||
while (tempt!=&e->tri_head) {
|
||||
if (tempt->flags & TF_SEL)
|
||||
SwapI64(&tempt->t[1],&tempt->t[2]);
|
||||
tempt=tempt->next;
|
||||
while (tmpt!=&e->tri_head) {
|
||||
if (tmpt->flags & TF_SEL)
|
||||
SwapI64(&tmpt->t[1],&tmpt->t[2]);
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
if (unsel)
|
||||
MeshTriSelAll(e,FALSE);
|
||||
@@ -451,7 +451,7 @@ U0 MPDrawIt(CMeshFrame *e)
|
||||
//Makes a copy of e->dc so we can change dc->color member and stuff.
|
||||
CDC *dc=DCAlias(e->dc,e->dc->win_task);
|
||||
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
I64 i,*old_r=dc->r;
|
||||
|
||||
//$LK,"DCAlias",A="MN:DCAlias"$() allocs a new identity rotation matrix.
|
||||
@@ -493,21 +493,21 @@ U0 MPDrawIt(CMeshFrame *e)
|
||||
GrLine3(dc,0,0,-500,0,0,0);
|
||||
}
|
||||
|
||||
while (tempt!=&e->tri_head) {
|
||||
if (tempt->cpu_num==Gs->num) {
|
||||
if (tempt->flags & TF_SEL) {
|
||||
while (tmpt!=&e->tri_head) {
|
||||
if (tmpt->cpu_num==Gs->num) {
|
||||
if (tmpt->flags & TF_SEL) {
|
||||
if (Blink)
|
||||
dc->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
else
|
||||
dc->color=ROPF_DITHER+RED<<16+WHITE;
|
||||
GrFillTri0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
GrFillTri0(dc,&tmpt->t[0]->pt,&tmpt->t[1]->pt,&tmpt->t[2]->pt);
|
||||
} else {
|
||||
(*dc->lighting)(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,
|
||||
&tempt->t[2]->pt,tempt->mt.color);
|
||||
GrFillTri0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
(*dc->lighting)(dc,&tmpt->t[0]->pt,&tmpt->t[1]->pt,
|
||||
&tmpt->t[2]->pt,tmpt->mt.color);
|
||||
GrFillTri0(dc,&tmpt->t[0]->pt,&tmpt->t[1]->pt,&tmpt->t[2]->pt);
|
||||
}
|
||||
}
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
dc->r=old_r;
|
||||
|
||||
@@ -519,7 +519,7 @@ U0 MPDrawIt(CMeshFrame *e)
|
||||
}
|
||||
|
||||
I64 *MeshW2S(CMeshFrame *e,CTask *task)
|
||||
{//World to screen coordinate transform matrix.
|
||||
{//World to scrn coordinate transform matrix.
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
CViewAngles *s=c->state;
|
||||
I64 *r=Mat4x4IdentNew(task);
|
||||
@@ -534,7 +534,7 @@ I64 *MeshW2S(CMeshFrame *e,CTask *task)
|
||||
}
|
||||
|
||||
I64 *MeshS2W(CMeshFrame *e,CTask *task)
|
||||
{//Screen to world coordinate transform matrix.
|
||||
{//Scrn to world coordinate transform matrix.
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
CViewAngles *s=c->state;
|
||||
I64 *r=Mat4x4IdentNew(task);
|
||||
@@ -565,7 +565,7 @@ U0 MeshCursorW(CMeshFrame *e,CTask *task,I64 *_x,I64 *_y,I64 *_z)
|
||||
yc=ip.pos.y-task->pix_top-task->scroll_y-e->cy,zc=0,
|
||||
x=0,y=0,z=e->ip_z,
|
||||
i,x2,y2,z2;
|
||||
Mat4x4MulXYZ(e->w2s,&x,&y,&z); //screen of Z vect
|
||||
Mat4x4MulXYZ(e->w2s,&x,&y,&z); //scrn of Z vect
|
||||
|
||||
//Converges onto a solution for zc, an unknown.
|
||||
for (i=0;i<128;i++) {
|
||||
@@ -606,97 +606,97 @@ U0 MeshClipboardRst()
|
||||
|
||||
U0 MeshClipboardCopy(CMeshFrame *e)
|
||||
{
|
||||
CMeshEdVertex *tempv=e->vertex_head.next,*tempv2;
|
||||
CMeshEdTri *tempt=e->tri_head.next,*tempt2;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next,*tmpv2;
|
||||
CMeshEdTri *tmpt=e->tri_head.next,*tmpt2;
|
||||
|
||||
MeshClipboardRst;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
if (tempv->flags&VF_SEL) {
|
||||
tempv->copy=tempv2=ACAlloc(sizeof(CMeshEdVertex));
|
||||
MemCpy(&tempv2->p,&tempv->p,sizeof(CD3I32));
|
||||
QueIns(tempv2,sys_clipboard_vertex_head.last);
|
||||
tempv->flags|=VF_COPIED;
|
||||
tempv->flags&=~VF_SEL;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
if (tmpv->flags&VF_SEL) {
|
||||
tmpv->copy=tmpv2=ACAlloc(sizeof(CMeshEdVertex));
|
||||
MemCpy(&tmpv2->p,&tmpv->p,sizeof(CD3I32));
|
||||
QueIns(tmpv2,sys_clipboard_vertex_head.last);
|
||||
tmpv->flags|=VF_COPIED;
|
||||
tmpv->flags&=~VF_SEL;
|
||||
} else {
|
||||
tempv->copy=NULL;
|
||||
tempv->flags&=~(VF_COPIED|VF_SEL);
|
||||
tmpv->copy=NULL;
|
||||
tmpv->flags&=~(VF_COPIED|VF_SEL);
|
||||
}
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
while (tempt!=&e->tri_head) {
|
||||
if (tempt->flags&TF_SEL &&
|
||||
tempt->t[0]->copy && tempt->t[1]->copy && tempt->t[2]->copy) {
|
||||
tempt2=ACAlloc(sizeof(CMeshEdTri));
|
||||
tempt2->t[0]=tempt->t[0]->copy;
|
||||
tempt2->t[1]=tempt->t[1]->copy;
|
||||
tempt2->t[2]=tempt->t[2]->copy;
|
||||
tempt2->mt.color=tempt->mt.color;
|
||||
QueIns(tempt2,sys_clipboard_tri_head.last);
|
||||
tempt->flags|=TF_COPIED;
|
||||
tempt->flags&=~TF_SEL;
|
||||
while (tmpt!=&e->tri_head) {
|
||||
if (tmpt->flags&TF_SEL &&
|
||||
tmpt->t[0]->copy && tmpt->t[1]->copy && tmpt->t[2]->copy) {
|
||||
tmpt2=ACAlloc(sizeof(CMeshEdTri));
|
||||
tmpt2->t[0]=tmpt->t[0]->copy;
|
||||
tmpt2->t[1]=tmpt->t[1]->copy;
|
||||
tmpt2->t[2]=tmpt->t[2]->copy;
|
||||
tmpt2->mt.color=tmpt->mt.color;
|
||||
QueIns(tmpt2,sys_clipboard_tri_head.last);
|
||||
tmpt->flags|=TF_COPIED;
|
||||
tmpt->flags&=~TF_SEL;
|
||||
} else
|
||||
tempt->flags&=~(TF_COPIED|TF_SEL);
|
||||
tempt=tempt->next;
|
||||
tmpt->flags&=~(TF_COPIED|TF_SEL);
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshClipboardCut(CMeshFrame *e)
|
||||
{
|
||||
CMeshEdVertex *tempv=e->vertex_head.next,*tempv1;
|
||||
CMeshEdTri *tempt=e->tri_head.next,*tempt1;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next,*tmpv1;
|
||||
CMeshEdTri *tmpt=e->tri_head.next,*tmpt1;
|
||||
MeshClipboardCopy(e);
|
||||
while (tempt!=&e->tri_head) {
|
||||
tempt1=tempt->next;
|
||||
if (tempt->flags&TF_COPIED)
|
||||
MeshTriDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
while (tmpt!=&e->tri_head) {
|
||||
tmpt1=tmpt->next;
|
||||
if (tmpt->flags&TF_COPIED)
|
||||
MeshTriDel(e,tmpt);
|
||||
tmpt=tmpt1;
|
||||
}
|
||||
while (tempv!=&e->vertex_head) {
|
||||
tempv1=tempv->next;
|
||||
if (tempv->flags&VF_COPIED)
|
||||
MeshVertexDel(e,tempv);
|
||||
tempv=tempv1;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
tmpv1=tmpv->next;
|
||||
if (tmpv->flags&VF_COPIED)
|
||||
MeshVertexDel(e,tmpv);
|
||||
tmpv=tmpv1;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshClipboardDel(CMeshFrame *e)
|
||||
{//Technically not clipboard
|
||||
CMeshEdVertex *tempv=e->vertex_head.next,*tempv1;
|
||||
CMeshEdTri *tempt=e->tri_head.next,*tempt1;
|
||||
while (tempt!=&e->tri_head) {
|
||||
tempt1=tempt->next;
|
||||
if (tempt->flags&TF_SEL)
|
||||
MeshTriDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next,*tmpv1;
|
||||
CMeshEdTri *tmpt=e->tri_head.next,*tmpt1;
|
||||
while (tmpt!=&e->tri_head) {
|
||||
tmpt1=tmpt->next;
|
||||
if (tmpt->flags&TF_SEL)
|
||||
MeshTriDel(e,tmpt);
|
||||
tmpt=tmpt1;
|
||||
}
|
||||
while (tempv!=&e->vertex_head) {
|
||||
tempv1=tempv->next;
|
||||
if (tempv->flags&VF_SEL)
|
||||
MeshVertexDel(e,tempv);
|
||||
tempv=tempv1;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
tmpv1=tmpv->next;
|
||||
if (tmpv->flags&VF_SEL)
|
||||
MeshVertexDel(e,tmpv);
|
||||
tmpv=tmpv1;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshClipboardPaste(CMeshFrame *e)
|
||||
{
|
||||
CMeshEdVertex *tempv2=sys_clipboard_vertex_head.next,*tempv;
|
||||
CMeshEdTri *tempt2=sys_clipboard_tri_head.next,*tempt;
|
||||
CMeshEdVertex *tmpv2=sys_clipboard_vertex_head.next,*tmpv;
|
||||
CMeshEdTri *tmpt2=sys_clipboard_tri_head.next,*tmpt;
|
||||
|
||||
MeshVertexSelAll(e,FALSE);
|
||||
MeshTriSelAll(e,FALSE);
|
||||
while (tempv2!=&sys_clipboard_vertex_head) {
|
||||
tempv2->copy=tempv=CAlloc(sizeof(CMeshEdVertex));
|
||||
MemCpy(&tempv->p,&tempv2->p,sizeof(CD3I32));
|
||||
QueIns(tempv,e->vertex_head.last);
|
||||
tempv->flags|=VF_SEL;
|
||||
tempv2=tempv2->next;
|
||||
while (tmpv2!=&sys_clipboard_vertex_head) {
|
||||
tmpv2->copy=tmpv=CAlloc(sizeof(CMeshEdVertex));
|
||||
MemCpy(&tmpv->p,&tmpv2->p,sizeof(CD3I32));
|
||||
QueIns(tmpv,e->vertex_head.last);
|
||||
tmpv->flags|=VF_SEL;
|
||||
tmpv2=tmpv2->next;
|
||||
}
|
||||
|
||||
while (tempt2!=&sys_clipboard_tri_head) {
|
||||
tempt=MeshTriNew(e,tempt2->mt.color,tempt2->t[0]->copy,
|
||||
tempt2->t[1]->copy,tempt2->t[2]->copy);
|
||||
tempt->flags|=TF_SEL;
|
||||
tempt2=tempt2->next;
|
||||
while (tmpt2!=&sys_clipboard_tri_head) {
|
||||
tmpt=MeshTriNew(e,tmpt2->mt.color,tmpt2->t[0]->copy,
|
||||
tmpt2->t[1]->copy,tmpt2->t[2]->copy);
|
||||
tmpt->flags|=TF_SEL;
|
||||
tmpt2=tmpt2->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -708,7 +708,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
F64 d;
|
||||
I64 i,x,y,z;
|
||||
CMeshEdVertex *tempv;
|
||||
CMeshEdVertex *tmpv;
|
||||
|
||||
task->horz_scroll.min=-(MESH_WORKSPACE_SIZE-task->pix_width)/2;
|
||||
task->horz_scroll.max= (MESH_WORKSPACE_SIZE-task->pix_width)/2;
|
||||
@@ -724,7 +724,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
dc->x=e->cx;
|
||||
dc->y=e->cy;
|
||||
//z-vals less than zero are in front of screen and not drawn.
|
||||
//z-vals less than zero are in front of scrn and not drawn.
|
||||
//we want to shift all Z-vals into a drawable range.
|
||||
//GR_Z_ALL is set to half of the Z-range which is an I32.
|
||||
dc->z=GR_Z_ALL;
|
||||
@@ -741,12 +741,12 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
DCDepthBufAlloc(dc);
|
||||
|
||||
tempv=e->vertex_head.next;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
x=tempv->p.x; y=tempv->p.y; z=tempv->p.z;
|
||||
tmpv=e->vertex_head.next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
x=tmpv->p.x; y=tmpv->p.y; z=tmpv->p.z;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
tempv->pt.x=x; tempv->pt.y=y; tempv->pt.z=z;
|
||||
tempv=tempv->next;
|
||||
tmpv->pt.x=x; tmpv->pt.y=y; tmpv->pt.z=z;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
|
||||
e->mp_not_done_flags=1<<mp_cnt-1; //Issue jobs to all cores.
|
||||
@@ -755,9 +755,9 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
JobQue(&MPDrawIt,e,i);
|
||||
|
||||
tempv=e->vertex_head.next;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
x=tempv->pt.x; y=tempv->pt.y; z=tempv->pt.z;
|
||||
tmpv=e->vertex_head.next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
x=tmpv->pt.x; y=tmpv->pt.y; z=tmpv->pt.z;
|
||||
if (e->vertex_on) {
|
||||
if (Blink(10)) //This blinks at 10 Hz.
|
||||
dc->color=ROPF_DITHER+BLACK<<16+WHITE;
|
||||
@@ -766,7 +766,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
GrLine(dc,x-3,y-3,x+3,y+3);
|
||||
GrLine(dc,x-3,y+3,x+3,y-3);
|
||||
}
|
||||
if (tempv->flags&VF_SEL) {
|
||||
if (tmpv->flags&VF_SEL) {
|
||||
if (e->ed_mode=='t') {
|
||||
if (Blink(10)) //This blinks at 10 Hz.
|
||||
dc->color=ROPF_DITHER+e->cur_color.c0.color<<16+
|
||||
@@ -782,7 +782,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
GrCircle(dc,x,y,3);
|
||||
}
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
|
||||
if (CtrlInside(c,ip.presnap.x,ip.presnap.y)||winmgr.show_menu) {
|
||||
@@ -847,7 +847,7 @@ U0 MeshLoad(CMeshFrame *e,U8 *src)
|
||||
{
|
||||
I64 i,j,x,y,z;
|
||||
CColorROPU32 color;
|
||||
CMeshEdVertex *tempv,*va[3];
|
||||
CMeshEdVertex *tmpv,*va[3];
|
||||
|
||||
QueInit(&e->vertex_head);
|
||||
QueInit(&e->tri_head);
|
||||
@@ -858,8 +858,8 @@ U0 MeshLoad(CMeshFrame *e,U8 *src)
|
||||
x=*src(I32 *)++;
|
||||
y=*src(I32 *)++;
|
||||
z=*src(I32 *)++;
|
||||
tempv=MeshVertexNew(e,x,y,z);
|
||||
tempv->num=i;
|
||||
tmpv=MeshVertexNew(e,x,y,z);
|
||||
tmpv->num=i;
|
||||
}
|
||||
for (i=0;i<e->tri_cnt;i++) {
|
||||
color=*src(I32 *)++;
|
||||
@@ -872,21 +872,21 @@ U0 MeshLoad(CMeshFrame *e,U8 *src)
|
||||
I64 MeshSize(CMeshFrame *e)
|
||||
{
|
||||
I64 i;
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
|
||||
e->vertex_cnt=0;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
tempv->num=e->vertex_cnt++;
|
||||
tempv=tempv->next;
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
tmpv->num=e->vertex_cnt++;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
|
||||
e->tri_cnt=0;
|
||||
while (tempt!=&e->tri_head) {
|
||||
while (tmpt!=&e->tri_head) {
|
||||
e->tri_cnt++;
|
||||
for (i=0;i<3;i++)
|
||||
tempt->mt.nums[i]=tempt->t[i]->num;
|
||||
tempt=tempt->next;
|
||||
tmpt->mt.nums[i]=tmpt->t[i]->num;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
return sizeof(I32)*2+
|
||||
(offset(CMeshEdVertex.end)-offset(CMeshEdVertex.start))*e->vertex_cnt+
|
||||
@@ -897,25 +897,25 @@ I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||
{
|
||||
I64 size=MeshSize(e);
|
||||
U8 *res=MAlloc(size),*dst=res;
|
||||
CMeshEdVertex *tempv=e->vertex_head.next;
|
||||
CMeshEdTri *tempt=e->tri_head.next;
|
||||
CMeshEdVertex *tmpv=e->vertex_head.next;
|
||||
CMeshEdTri *tmpt=e->tri_head.next;
|
||||
|
||||
*dst(I32 *)++=e->vertex_cnt;
|
||||
*dst(I32 *)++=e->tri_cnt;
|
||||
|
||||
e->vertex_cnt=0;
|
||||
while (tempv!=&e->vertex_head) {
|
||||
MemCpy(dst,&tempv->start,offset(CMeshEdVertex.end)
|
||||
while (tmpv!=&e->vertex_head) {
|
||||
MemCpy(dst,&tmpv->start,offset(CMeshEdVertex.end)
|
||||
-offset(CMeshEdVertex.start));
|
||||
dst+=offset(CMeshEdVertex.end)-offset(CMeshEdVertex.start);
|
||||
tempv=tempv->next;
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
|
||||
e->tri_cnt=0;
|
||||
while (tempt!=&e->tri_head) {
|
||||
MemCpy(dst,&tempt->start,offset(CMeshEdTri.end)-offset(CMeshEdTri.start));
|
||||
while (tmpt!=&e->tri_head) {
|
||||
MemCpy(dst,&tmpt->start,offset(CMeshEdTri.end)-offset(CMeshEdTri.start));
|
||||
dst+=offset(CMeshEdTri.end)-offset(CMeshEdTri.start);
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
if (_size) *_size=size;
|
||||
return res;
|
||||
@@ -931,27 +931,27 @@ U0 MeshCleanUp(CMeshFrame *e)
|
||||
|
||||
U0 MeshUpdateMenu(CMeshFrame *e)
|
||||
{
|
||||
CMenuEntry *tempse;
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"View/Grid"))
|
||||
tempse->checked=ToBool(e->grid_on);
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"View/Vertex"))
|
||||
tempse->checked=ToBool(e->vertex_on);
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/PlaceVertex"))
|
||||
tempse->checked=ToBool(e->ed_mode=='v');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/MoveVertex"))
|
||||
tempse->checked=ToBool(e->ed_mode=='m');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/MoveVertexZ"))
|
||||
tempse->checked=ToBool(e->ed_mode=='M');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/Triangle"))
|
||||
tempse->checked=ToBool(e->ed_mode=='t');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/Polygon"))
|
||||
tempse->checked=ToBool(e->ed_mode=='n');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/Fence"))
|
||||
tempse->checked=ToBool(e->ed_mode=='f');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/Prism"))
|
||||
tempse->checked=ToBool(e->ed_mode=='p');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"View/FlipY"))
|
||||
tempse->checked=ToBool(e->flip_y);
|
||||
CMenuEntry *tmpse;
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"View/Grid"))
|
||||
tmpse->checked=ToBool(e->grid_on);
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"View/Vertex"))
|
||||
tmpse->checked=ToBool(e->vertex_on);
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Mode/PlaceVertex"))
|
||||
tmpse->checked=ToBool(e->ed_mode=='v');
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Mode/MoveVertex"))
|
||||
tmpse->checked=ToBool(e->ed_mode=='m');
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Mode/MoveVertexZ"))
|
||||
tmpse->checked=ToBool(e->ed_mode=='M');
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Mode/Triangle"))
|
||||
tmpse->checked=ToBool(e->ed_mode=='t');
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Mode/Polygon"))
|
||||
tmpse->checked=ToBool(e->ed_mode=='n');
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Mode/Fence"))
|
||||
tmpse->checked=ToBool(e->ed_mode=='f');
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Mode/Prism"))
|
||||
tmpse->checked=ToBool(e->ed_mode=='p');
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"View/FlipY"))
|
||||
tmpse->checked=ToBool(e->flip_y);
|
||||
}
|
||||
|
||||
I32 *SpriteMeshEd(I32 *head=NULL,I64 *_size=NULL,Bool flip_y=FALSE)
|
||||
@@ -973,7 +973,7 @@ $WW,0$*/
|
||||
CViewAngles *s,*old_s;
|
||||
I64 i,msg_code,sel_mode,a1,a2,make_tri_vertex_num=0,x,y,z;
|
||||
CD3I32 p0a,p0b;
|
||||
CMeshEdVertex *va[3],*tempv;
|
||||
CMeshEdVertex *va[3],*tmpv;
|
||||
Bool adjusting_z=FALSE,moving,save_and_exit;
|
||||
CMeshFrame e;
|
||||
|
||||
@@ -1060,7 +1060,7 @@ $WW,0$*/
|
||||
"$$GREEN$$'p'$$FG$$: Prism Mode\n"
|
||||
"$$GREEN$$'c'$$FG$$: Set color\n"
|
||||
"$$GREEN$$'s'$$FG$$: Set snap\n"
|
||||
"\nSee menu at top of screen for more.\n");
|
||||
"\nSee menu at top of scrn for more.\n");
|
||||
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_SELF_DOC-WIF_SELF_FOCUS-WIF_SELF_BORDER
|
||||
-WIF_SELF_CTRLS-WIF_FOCUS_TASK_MENU-WIF_SELF_GRAB_SCROLL;
|
||||
@@ -1267,11 +1267,11 @@ me_clipboard_cut:
|
||||
case 'j':
|
||||
if (moving)
|
||||
MeshVertexIgnoreSet(&e,TRUE);
|
||||
if (tempv=MeshVertexFindScrPt(&e,
|
||||
if (tmpv=MeshVertexFindScrPt(&e,
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y)) {
|
||||
Noise(25,2000,8000);
|
||||
e.ip_z=RoundI64(tempv->p.z,e.cur_snap);
|
||||
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
} else {
|
||||
Beep; Beep;
|
||||
e.ip_z=0;
|
||||
@@ -1324,9 +1324,9 @@ me_clipboard_cut:
|
||||
case 'm':
|
||||
if (!moving) {
|
||||
if (!MeshSelCnt(&e) &&
|
||||
(tempv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
tempv->flags|=VF_SEL;
|
||||
e.ip_z=RoundI64(tempv->p.z,e.cur_snap);
|
||||
(tmpv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
tmpv->flags|=VF_SEL;
|
||||
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
}
|
||||
if (MeshSelCnt(&e)) {
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
@@ -1341,9 +1341,9 @@ me_clipboard_cut:
|
||||
case 'M':
|
||||
if (!adjusting_z && !moving) {
|
||||
if (!MeshSelCnt(&e) &&
|
||||
(tempv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
tempv->flags|=VF_SEL;
|
||||
e.ip_z=RoundI64(tempv->p.z,e.cur_snap);
|
||||
(tmpv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
tmpv->flags|=VF_SEL;
|
||||
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
}
|
||||
if (MeshSelCnt(&e)) {
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
@@ -1394,16 +1394,16 @@ me_clipboard_cut:
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (tempv=MeshVertexFindScrPt(&e,a1,a2)) {
|
||||
if (tmpv=MeshVertexFindScrPt(&e,a1,a2)) {
|
||||
for (i=0;i<make_tri_vertex_num;i++)
|
||||
if (va[i]==tempv) {
|
||||
if (va[i]==tmpv) {
|
||||
Beep; Beep;
|
||||
break;
|
||||
}
|
||||
if (i==make_tri_vertex_num) {
|
||||
Noise(25,2000,8000);
|
||||
va[make_tri_vertex_num++]=tempv;
|
||||
tempv->flags|=VF_SEL;
|
||||
va[make_tri_vertex_num++]=tmpv;
|
||||
tmpv->flags|=VF_SEL;
|
||||
if (make_tri_vertex_num==3) {
|
||||
e.cur_tri=MeshTriNew(&e,e.cur_color,va[0],va[1],va[2]);
|
||||
for (i=0;i<make_tri_vertex_num;i++)
|
||||
|
||||
+51
-51
@@ -41,37 +41,37 @@ I64 SpriteElemQuedBaseSize(I64 type)
|
||||
return sprite_elem_base_sizes[type]+offset(CSprite.start);
|
||||
}
|
||||
|
||||
I64 SpriteElemSize(CSprite *tempg)
|
||||
I64 SpriteElemSize(CSprite *tmpg)
|
||||
{
|
||||
I64 i=sprite_elem_base_sizes[tempg->type];
|
||||
switch (tempg->type) {
|
||||
I64 i=sprite_elem_base_sizes[tmpg->type];
|
||||
switch (tmpg->type) {
|
||||
case SPT_POLYLINE:
|
||||
i+=tempg->nu.num*sizeof(CD2I32);
|
||||
i+=tmpg->nu.num*sizeof(CD2I32);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
i+=StrLen(tempg->ps.st)+1;
|
||||
i+=StrLen(tmpg->ps.st)+1;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
i+=((tempg->pwhu.width+7)&~7)*tempg->pwhu.height;
|
||||
i+=((tmpg->pwhu.width+7)&~7)*tmpg->pwhu.height;
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
i+=(tempg->npu.num*3+7)>>3;
|
||||
i+=(tmpg->npu.num*3+7)>>3;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
i+=tempg->nu.num*sizeof(CD3I32);
|
||||
i+=tmpg->nu.num*sizeof(CD3I32);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
i+=tempg->mu.vertex_cnt*sizeof(CD3I32)+
|
||||
tempg->mu.tri_cnt*sizeof(CMeshTri);
|
||||
i+=tmpg->mu.vertex_cnt*sizeof(CD3I32)+
|
||||
tmpg->mu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
i+=tempg->pmu.vertex_cnt*sizeof(CD3I32)+
|
||||
tempg->pmu.tri_cnt*sizeof(CMeshTri);
|
||||
i+=tmpg->pmu.vertex_cnt*sizeof(CD3I32)+
|
||||
tmpg->pmu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
@@ -79,101 +79,101 @@ I64 SpriteElemSize(CSprite *tempg)
|
||||
|
||||
public I64 SpriteSize(U8 *elems)
|
||||
{//Walk sprite elements and return size of sprite as binary data.
|
||||
CSprite *tempg=elems-offset(CSprite.start),*tempg1=tempg;
|
||||
while (tempg->type)
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
return tempg(U8 *)-tempg1(U8 *)+sprite_elem_base_sizes[SPT_END];
|
||||
CSprite *tmpg=elems-offset(CSprite.start),*tmpg1=tmpg;
|
||||
while (tmpg->type)
|
||||
tmpg(U8 *)+=SpriteElemSize(tmpg);
|
||||
return tmpg(U8 *)-tmpg1(U8 *)+sprite_elem_base_sizes[SPT_END];
|
||||
}
|
||||
|
||||
I64 SpriteTypeMask(U8 *elems)
|
||||
{
|
||||
I64 res=0;
|
||||
CSprite *tempg=elems-offset(CSprite.start);
|
||||
while (tempg->type) {
|
||||
if (tempg->type>=SPT_NUM_TYPES)
|
||||
CSprite *tmpg=elems-offset(CSprite.start);
|
||||
while (tmpg->type) {
|
||||
if (tmpg->type>=SPT_NUM_TYPES)
|
||||
return 1<<SPT_NUM_TYPES;
|
||||
Bts(&res,tempg->type);
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
Bts(&res,tmpg->type);
|
||||
tmpg(U8 *)+=SpriteElemSize(tmpg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *DC2Sprite(CDC *tempb)
|
||||
public U8 *DC2Sprite(CDC *tmpb)
|
||||
{//Convert device context to sprite.
|
||||
CSprite *tempg;
|
||||
tempg=CAlloc(sprite_elem_base_sizes[SPT_BITMAP]+
|
||||
tempb->width_internal*tempb->height+
|
||||
CSprite *tmpg;
|
||||
tmpg=CAlloc(sprite_elem_base_sizes[SPT_BITMAP]+
|
||||
tmpb->width_internal*tmpb->height+
|
||||
sprite_elem_base_sizes[SPT_END])
|
||||
(U8 *)-offset(CSprite.start);
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->pwhu.width=tempb->width;
|
||||
tempg->pwhu.height=tempb->height;
|
||||
tempg->pwhu.x1=0;
|
||||
tempg->pwhu.y1=0;
|
||||
MemCpy(&tempg->pwhu.u,tempb->body,tempb->width_internal*tempb->height);
|
||||
return tempg(U8 *)+offset(CSprite.start);
|
||||
tmpg->type=SPT_BITMAP;
|
||||
tmpg->pwhu.width=tmpb->width;
|
||||
tmpg->pwhu.height=tmpb->height;
|
||||
tmpg->pwhu.x1=0;
|
||||
tmpg->pwhu.y1=0;
|
||||
MemCpy(&tmpg->pwhu.u,tmpb->body,tmpb->width_internal*tmpb->height);
|
||||
return tmpg(U8 *)+offset(CSprite.start);
|
||||
}
|
||||
|
||||
public U8 *SpriteElem2Summary(CSprite *tempg)
|
||||
public U8 *SpriteElem2Summary(CSprite *tmpg)
|
||||
{//Study $LK,"::/Demo/Graphics/SpriteText.HC"$.
|
||||
U8 buf[STR_LEN],buf2[STR_LEN];
|
||||
I32 *ptr;
|
||||
StrPrint(buf,"%Z",tempg->type,"ST_SPRITE_ELEM_TYPES");
|
||||
switch (tempg->type) {
|
||||
StrPrint(buf,"%Z",tmpg->type,"ST_SPRITE_ELEM_TYPES");
|
||||
switch (tmpg->type) {
|
||||
case SPT_COLOR:
|
||||
CatPrint(buf," %s",Color2Str(buf2,tempg->c.color));
|
||||
CatPrint(buf," %s",Color2Str(buf2,tmpg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tmpg->d.dither_color.u8[0]|
|
||||
tmpg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_SHIFT:
|
||||
CatPrint(buf," (%d,%d)",tempg->p.x1,tempg->p.y1);
|
||||
CatPrint(buf," (%d,%d)",tmpg->p.x1,tmpg->p.y1);
|
||||
break;
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2,tempg->pp.y2);
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tmpg->pp.x1,tmpg->pp.y1,
|
||||
tmpg->pp.x2,tmpg->pp.y2);
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
CatPrint(buf," (%d,%d):%dR",tempg->pr.x1,tempg->pr.y1,tempg->pr.radius);
|
||||
CatPrint(buf," (%d,%d):%dR",tmpg->pr.x1,tmpg->pr.y1,tmpg->pr.radius);
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
CatPrint(buf," %d",tempg->w.width);
|
||||
CatPrint(buf," %d",tmpg->w.width);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
CatPrint(buf," %d,%d:%-16tQ",tempg->ps.x1,tempg->ps.y1,tempg->ps.st);
|
||||
CatPrint(buf," %d,%d:%-16tQ",tmpg->ps.x1,tmpg->ps.y1,tmpg->ps.st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->npu.x;
|
||||
CatPrint(buf," %d (%d,%d)",tempg->npu.num,ptr[0],ptr[1]);
|
||||
ptr=&tmpg->npu.x;
|
||||
CatPrint(buf," %d (%d,%d)",tmpg->npu.num,ptr[0],ptr[1]);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
case SPT_BITMAP:
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tempg->pwhu.x1,tempg->pwhu.y1,
|
||||
tempg->pwhu.width,tempg->pwhu.height);
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tmpg->pwhu.x1,tmpg->pwhu.y1,
|
||||
tmpg->pwhu.width,tmpg->pwhu.height);
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
CatPrint(buf," %d",tempg->nu.num);
|
||||
CatPrint(buf," %d",tmpg->nu.num);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
CatPrint(buf," %dV,%dT",tempg->mu.vertex_cnt,tempg->mu.tri_cnt);
|
||||
CatPrint(buf," %dV,%dT",tmpg->mu.vertex_cnt,tmpg->mu.tri_cnt);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
CatPrint(buf," %dV,%dT",tempg->pmu.vertex_cnt,tempg->pmu.tri_cnt);
|
||||
CatPrint(buf," %dV,%dT",tmpg->pmu.vertex_cnt,tmpg->pmu.tri_cnt);
|
||||
break;
|
||||
}
|
||||
return StrNew(buf);
|
||||
|
||||
Reference in new issue
Block a user