TempleOSCDV5.00.ISO
This commit is contained in:
1 parent
122df6338e
commit
f6eacf7744
374 files changed
+11078
-11204
No files matched your search
+27
-5
@@ -294,19 +294,19 @@ mesh_done:
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Misc;Input Pointer/Displayed Image"
|
||||
public U0 DrawStdInputPtr(CDC *dc,I64 x,I64 y)
|
||||
#help_index "Graphics/Misc;Mouse/Ptr"
|
||||
public U0 DrawStdMs(CDC *dc,I64 x,I64 y)
|
||||
{//This is a callback. See $LK,"::/Demo/Graphics/Grid.HC"$.
|
||||
//Called by $LK,"DrawInputPtr",A="MN:DrawInputPtr"$() which is
|
||||
//Called by $LK,"DrawMs",A="MN:DrawMs"$() which is
|
||||
//called by $LK,"WinFinalUpdate",A="MN:WinFinalUpdate"$().
|
||||
dc->pen_width=1;
|
||||
dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
|
||||
GrArrow3(dc,x+8,y+8,0,x,y,0);
|
||||
}
|
||||
|
||||
gr.fp_draw_input_ptr=&DrawStdInputPtr;
|
||||
gr.fp_draw_ms=&DrawStdMs;
|
||||
|
||||
public U0 DrawWaitInputPtr(CDC *dc,I64 x,I64 y)
|
||||
public U0 DrawWaitMs(CDC *dc,I64 x,I64 y)
|
||||
{//This is a callback. See $LK,"::/Demo/Graphics/Grid.HC"$.
|
||||
I64 old_pen_width=dc->pen_width;
|
||||
CColorROPU32 old_color=dc->color;
|
||||
@@ -320,3 +320,25 @@ public U0 DrawWaitInputPtr(CDC *dc,I64 x,I64 y)
|
||||
dc->pen_width=old_pen_width;
|
||||
dc->color=old_color;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GR Files;Graphics/Scrn"
|
||||
public Bool GRScrnCaptureRead(U8 *filename,CDC *dc=gr.dc,I64 x=0,I64 y=0)
|
||||
{//GrBlot TempleOS GR File to dc,x,y.
|
||||
CDC *dc2;
|
||||
if (dc2=GRRead(filename)) {
|
||||
dc->color=ROP_EQU;
|
||||
GrBlot(dc,x,y,dc2);
|
||||
DCDel(dc2);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public I64 GRScrnCaptureWrite(U8 *filename,Bool include_zoom=TRUE)
|
||||
{//Capture scrn to a TempleOS GR File.
|
||||
I64 size;
|
||||
CDC *dc=DCScrnCapture(include_zoom);
|
||||
size=GRWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
}
|
||||
+4
-14
@@ -378,8 +378,8 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
#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,"GR.Z"),
|
||||
I64 size;
|
||||
U8 *st=DftExt(filename,"GR.Z"),
|
||||
*src=DCSave(dc,&size,dcsf_flags);
|
||||
FileWrite(st,src,size);
|
||||
Free(st);
|
||||
@@ -389,8 +389,8 @@ public I64 GRWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
|
||||
public CDC *GRRead(U8 *filename,CTask *task=NULL)
|
||||
{//TempleOS GR File.
|
||||
CDC *dc=NULL;
|
||||
U8 *st=DftExt(filename,"GR.Z"),
|
||||
CDC *dc=NULL;
|
||||
U8 *st=DftExt(filename,"GR.Z"),
|
||||
*src=FileRead(st);
|
||||
if (src)
|
||||
dc=DCLoad(src,,task);
|
||||
@@ -428,13 +428,3 @@ public CDC *DCScrnCapture(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
dc->body=dst;
|
||||
return dc;
|
||||
}
|
||||
|
||||
#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=DCScrnCapture(include_zoom);
|
||||
size=GRWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
}
|
||||
+3
-3
@@ -21,9 +21,9 @@ public class CGrGlbls
|
||||
I64 pan_text_x,pan_text_y; //[-7,7]
|
||||
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);
|
||||
U8 *empty_sprite; //Gets assigned $LK,"gr.empty_sprite",A="FF:::/Adam/AInputPointer.HC,empty_sprite"$
|
||||
U0 (*fp_draw_ms)(CDC *dc,I64 x,I64 y);
|
||||
U0 (*fp_draw_grab_ms)(CDC *dc,I64 x,I64 y,Bool closed);
|
||||
U8 *empty_sprite; //Gets assigned $LK,"gr.empty_sprite",A="FF:::/Adam/AMouse.HC,empty_sprite"$
|
||||
|
||||
#define GR_NUM_PEN_BRUSHES 64
|
||||
CDC *pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ public U0 WinZBufUpdate()
|
||||
U16 *ptr;
|
||||
CTask *task,*task1;
|
||||
if (gr.win_z_buf) {
|
||||
LBtr(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0);
|
||||
LBtr(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0);
|
||||
task1=task=sys_winmgr_task;
|
||||
do {
|
||||
if (!TaskValidate(task)) break;
|
||||
|
||||
+9
-9
@@ -110,7 +110,7 @@ public I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL)
|
||||
return Mat4x4Equ(MAlloc(sizeof(I64)*16,mem_task),src);
|
||||
}
|
||||
|
||||
public I64 *Mat4x4RotX(I64 *m1,F64 è)
|
||||
public I64 *Mat4x4RotX(I64 *m,F64 è)
|
||||
{//Rot matrix about X axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
F64 my_cos=Cos(è)*GR_SCALE,my_sin=Sin(è)*GR_SCALE;
|
||||
I64 r[16],r2[16];
|
||||
@@ -121,10 +121,10 @@ public I64 *Mat4x4RotX(I64 *m1,F64
|
||||
r[6]=-my_sin;
|
||||
r[0]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
|
||||
return Mat4x4Equ(m,Mat4x4MulMat4x4Equ(r2,r,m));
|
||||
}
|
||||
|
||||
public I64 *Mat4x4RotY(I64 *m1,F64 ê)
|
||||
public I64 *Mat4x4RotY(I64 *m,F64 ê)
|
||||
{//Rot matrix about Y axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
F64 my_cos=Cos(ê)*GR_SCALE,my_sin=Sin(ê)*GR_SCALE;
|
||||
I64 r[16],r2[16];
|
||||
@@ -135,10 +135,10 @@ public I64 *Mat4x4RotY(I64 *m1,F64
|
||||
r[2]=my_sin;
|
||||
r[5]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
|
||||
return Mat4x4Equ(m,Mat4x4MulMat4x4Equ(r2,r,m));
|
||||
}
|
||||
|
||||
public I64 *Mat4x4RotZ(I64 *m1,F64 é)
|
||||
public I64 *Mat4x4RotZ(I64 *m,F64 é)
|
||||
{//Rot matrix about Z axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
F64 my_cos=Cos(é)*GR_SCALE,my_sin=Sin(é)*GR_SCALE;
|
||||
I64 r[16],r2[16];
|
||||
@@ -149,15 +149,15 @@ public I64 *Mat4x4RotZ(I64 *m1,F64
|
||||
r[1]=-my_sin;
|
||||
r[10]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
|
||||
return Mat4x4Equ(m,Mat4x4MulMat4x4Equ(r2,r,m));
|
||||
}
|
||||
|
||||
public I64 *Mat4x4Scale(I64 *m1,F64 s)
|
||||
public I64 *Mat4x4Scale(I64 *m,F64 s)
|
||||
{//Scale 4x4 matrix by value.
|
||||
I64 i;
|
||||
for (i=0;i<16;i++)
|
||||
m1[i]*=s;
|
||||
return m1;
|
||||
m[i]*=s;
|
||||
return m;
|
||||
}
|
||||
|
||||
public U0 DCPenWidthScale(CDC *dc=gr.dc)
|
||||
|
||||
@@ -13,7 +13,7 @@ U0 GrPaletteIndicesSet()
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
while (LBts(&sys_semas[SEMA_VGA],0))
|
||||
Yield;
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
@@ -23,7 +23,7 @@ U0 GrPaletteIndicesSet()
|
||||
OutU8(VGAP_ATTR_INDEX,0x20);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,0); //Dummy write
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
LBtr(&sys_semas[SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ public U0 GrPaletteColorSet(I64 color_num,CBGR48 bgr48)
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
while (LBts(&sys_semas[SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_WRITE,color_num);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr48.r>>10);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr48.g>>10);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr48.b>>10);
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
LBtr(&sys_semas[SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
|
||||
@@ -49,14 +49,14 @@ public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
while (LBts(&sys_semas[SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_READ,color_num);
|
||||
res.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
LBtr(&sys_semas[SEMA_VGA],0);
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
|
||||
+11
-11
@@ -138,7 +138,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
I64 res,j,x1,ray_len,ray_len2;
|
||||
|
||||
if (UnusedStk<0x80)
|
||||
Dbg("Stk Overflow",Fs);
|
||||
Panic("Stk Overflow",Fs);
|
||||
|
||||
res=ray_len=GrRayLen(dc,&x,y,z,db);
|
||||
y--;
|
||||
@@ -859,7 +859,7 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
{//3D. Transformation with pen width.
|
||||
Bool res;
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
F64 m1,arg1,m2,arg2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
(*dc->transform)(dc,&cx,&cy,&cz);
|
||||
@@ -882,7 +882,7 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
x-=xx;
|
||||
y-=yy;
|
||||
z-=zz;
|
||||
R2P(&m1,&a1,x,y);
|
||||
R2P(&m1,&arg1,x,y);
|
||||
|
||||
x=-y_radius*s;
|
||||
y=y_radius*c;
|
||||
@@ -891,11 +891,11 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
x-=xx;
|
||||
y-=yy;
|
||||
z-=zz;
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
R2P(&m2,&arg2,x,y);
|
||||
m2*=Abs(Sin(arg2-arg1));
|
||||
|
||||
res=Ellipse(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||
m1/0x10000,m2/0x10000,&GrPlot3,-arg1,step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
res=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,
|
||||
@@ -924,7 +924,7 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
{//3D. Clipping and transform and pen width.
|
||||
Bool res;
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
F64 m1,arg1,m2,arg2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
(*dc->transform)(dc,&cx,&cy,&cz);
|
||||
@@ -947,7 +947,7 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
x-=xx;
|
||||
y-=yy;
|
||||
z-=zz;
|
||||
R2P(&m1,&a1,x,y);
|
||||
R2P(&m1,&arg1,x,y);
|
||||
|
||||
x=-y_radius*s;
|
||||
y=y_radius*c;
|
||||
@@ -956,11 +956,11 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
x-=xx;
|
||||
y-=yy;
|
||||
z-=zz;
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
R2P(&m2,&arg2,x,y);
|
||||
m2*=Abs(Sin(arg2-arg1));
|
||||
|
||||
res=RegPoly(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,
|
||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-arg1,
|
||||
step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
|
||||
+11
-11
@@ -61,7 +61,7 @@ U0 GrUpdateTasks()
|
||||
CTask *task,*task1;
|
||||
try {
|
||||
winmgr.ode_time=0;
|
||||
if (Bt(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0))
|
||||
if (Bt(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0))
|
||||
WinZBufUpdate;
|
||||
task1=task=sys_winmgr_task;
|
||||
do { //Loop through Core0 tasks.
|
||||
@@ -110,14 +110,14 @@ public U0 GrScaleZoom(F64 scale)
|
||||
gr.scrn_zoom=gr.scrn_zoom*scale;
|
||||
GrFixZoomScale;
|
||||
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.scrn_zoom;
|
||||
gr.sy=ip.pos.y-gr.zoomed_dc->height>>1/gr.scrn_zoom;
|
||||
ms.scale.x*=s;
|
||||
ms.scale.y*=s;
|
||||
ms.scale.z*=s;
|
||||
ms.offset.x=ms.pos.x-(ms.pos.x-ms.offset.x)*s;
|
||||
ms.offset.y=ms.pos.y-(ms.pos.y-ms.offset.y)*s;
|
||||
ms.offset.z=ms.pos.z-(ms.pos.z-ms.offset.z)*s;
|
||||
gr.sx=ms.pos.x-gr.zoomed_dc->width >>1/gr.scrn_zoom;
|
||||
gr.sy=ms.pos.y-gr.zoomed_dc->height>>1/gr.scrn_zoom;
|
||||
GrFixZoomScale;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ U0 GrUpdateTextModeText()
|
||||
I64 cur_ch,i=TEXT_COLS*TEXT_ROWS;
|
||||
U16 *dst=text.vga_text_alias,*dst2=gr.vga_text_cache;
|
||||
Bool blink_flag=Blink;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
while (i--) {
|
||||
cur_ch=*src++;
|
||||
if (cur_ch & ATTRF_SEL)
|
||||
@@ -374,7 +374,7 @@ U0 GrUpdateVGAGraphics()
|
||||
src=gr.zoomed_dc->body;
|
||||
}
|
||||
dst=gr.scrn_image->body;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
|
||||
@@ -253,7 +253,7 @@ public U0 Sprite3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
}
|
||||
|
||||
public U0 SpriteMat3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
public U0 Sprite3Mat4x4B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
{//Plot rotated by matrix.
|
||||
I64 r[16],*old_r=dc->r,new_m[16],
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
@@ -266,28 +266,28 @@ public U0 SpriteMat3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
}
|
||||
|
||||
public U0 SpriteX3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 è=0)
|
||||
public U0 Sprite3XB(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 è=0)
|
||||
{//Plot rotated around X axis.
|
||||
I64 r[16];
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotX(r,è);
|
||||
SpriteMat3B(dc,x,y,z,elems,r);
|
||||
Sprite3Mat4x4B(dc,x,y,z,elems,r);
|
||||
}
|
||||
|
||||
public U0 SpriteY3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 ê=0)
|
||||
public U0 Sprite3YB(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 ê=0)
|
||||
{//Plot rotated around Y axis.
|
||||
I64 r[16];
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,ê);
|
||||
SpriteMat3B(dc,x,y,z,elems,r);
|
||||
Sprite3Mat4x4B(dc,x,y,z,elems,r);
|
||||
}
|
||||
|
||||
public U0 SpriteZ3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
|
||||
public U0 Sprite3ZB(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
|
||||
{//Plot rotated around Z axis.
|
||||
I64 r[16];
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotZ(r,é);
|
||||
SpriteMat3B(dc,x,y,z,elems,r);
|
||||
Sprite3Mat4x4B(dc,x,y,z,elems,r);
|
||||
}
|
||||
|
||||
public U0 SpriteExtents(U8 *elems,I64 *min_x=NULL,I64 *max_x=NULL,
|
||||
|
||||
@@ -329,7 +329,7 @@ public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
|
||||
public U0 TextBorder(CTask *task=NULL,
|
||||
I64 l,I64 r,I64 t,I64 b,I64 attr,Bool solid)
|
||||
{//Plot border square. 30fps in Fs->draw_it() callback.
|
||||
//Draws window borders or DolDoc text button borders.
|
||||
//Draws window borders or DolDoc text bttn borders.
|
||||
//Set task=sys_winmgr_task for no clipping.
|
||||
I64 i;
|
||||
if (!task) task=Fs;
|
||||
|
||||
+68
-67
@@ -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=SPBM_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,arg1,arg2,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;
|
||||
@@ -222,11 +222,11 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
dc->pen_width=1;
|
||||
GrBorder(dc,xx1-1,yy1-1,xx2,yy2);//This is done little bit too often.
|
||||
|
||||
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
1<<MSG_IP_R_DOWN|1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
|
||||
while (msg_code=ScanMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|
|
||||
1<<MSG_MS_R_DOWN|1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN)) {
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case CH_SHIFT_ESC:
|
||||
res=SPE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
@@ -235,7 +235,7 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
goto bm_key_up_done;
|
||||
case 'c': //eye-dropper
|
||||
dc2=DCScrnCapture(FALSE);
|
||||
color=GrPeek(dc2,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
color=GrPeek(dc2,ms.pos.x,ms.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc2);
|
||||
break;
|
||||
case 't': //Set to transparent color
|
||||
@@ -244,7 +244,7 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_IP_R_DOWN:
|
||||
case MSG_MS_R_DOWN:
|
||||
bm_menu:
|
||||
DCFill(dc);
|
||||
StrCpy(Fs->task_title,"Sprite BitMap Menu");
|
||||
@@ -353,26 +353,26 @@ bm_menu:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
down=FALSE;
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_MS_L_DOWN:
|
||||
switch (mode) {
|
||||
case SPBM_PT:
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
GrPlot3(img,a1-xx1,a2-yy1,0);
|
||||
GrPlot3(img,arg1-xx1,arg2-yy1,0);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
start:
|
||||
if (down)
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
x1=a1; y1=a2;
|
||||
x1=arg1; y1=arg2;
|
||||
down=TRUE;
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
case SPBM_LINE:
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
GrLine3(dc,x1,y1,0,arg1,arg2,0);
|
||||
break;
|
||||
case SPBM_ARROW:
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
GrArrow3(dc,x1,y1,0,arg1,arg2,0);
|
||||
break;
|
||||
case SPBM_RECT:
|
||||
GrRect(dc,x1,y1,1,1);
|
||||
@@ -394,12 +394,12 @@ bm_menu:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==SPBM_PASTE) {
|
||||
clipboard->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc,a1,a2,clipboard);
|
||||
GrBlot(dc,arg1,arg2,clipboard);
|
||||
clipboard->flags&=~DCF_NO_TRANSPARENTS;
|
||||
} else {
|
||||
dc2=DCCopy(clipboard);
|
||||
DCColorChg(dc2,bkcolor);
|
||||
GrBlot(dc,a1,a2,dc2);
|
||||
GrBlot(dc,arg1,arg2,dc2);
|
||||
DCDel(dc2);
|
||||
}
|
||||
}
|
||||
@@ -407,48 +407,48 @@ bm_menu:
|
||||
case SPBM_TEXT:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPrint(dc,a1,a2,"%s",st);
|
||||
GrPrint(dc,arg1,arg2,"%s",st);
|
||||
break;
|
||||
case SPBM_TEXT_BOX:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextBox3(dc,a1,a2,0,st);
|
||||
GrTextBox3(dc,arg1,arg2,0,st);
|
||||
break;
|
||||
case SPBM_TEXT_DIAMOND:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextDiamond3(dc,a1,a2,0,st);
|
||||
GrTextDiamond3(dc,arg1,arg2,0,st);
|
||||
break;
|
||||
case SPBM_FLOOD_FILL:
|
||||
img->color=color;
|
||||
GrFloodFill(img,a1-xx1,a2-yy1);
|
||||
GrFloodFill(img,arg1-xx1,arg2-yy1);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case SPBM_FLOOD_FILL_NOT:
|
||||
img->color=color;
|
||||
GrFloodFill(img,a1-xx1,a2-yy1,TRUE);
|
||||
GrFloodFill(img,arg1-xx1,arg2-yy1,TRUE);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case SPBM_POLYLINE:
|
||||
if (!down) {
|
||||
x1=a1; y1=a2;
|
||||
x1=arg1; y1=arg2;
|
||||
down=TRUE;
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
GrLine3(dc,x1,y1,0,arg1,arg2,0);
|
||||
}
|
||||
break;
|
||||
case SPBM_POLYPT:
|
||||
x1=a1; y1=a2;
|
||||
x1=arg1; y1=arg2;
|
||||
down=TRUE;
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
GrLine3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
|
||||
GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
case MSG_MS_MOVE:
|
||||
switch (mode) {
|
||||
case SPBM_LINE:
|
||||
case SPBM_ARROW:
|
||||
@@ -458,26 +458,26 @@ bm_menu:
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
if (mode==SPBM_ARROW)
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
GrArrow3(dc,x1,y1,0,arg1,arg2,0);
|
||||
else
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
GrLine3(dc,x1,y1,0,arg1,arg2,0);
|
||||
}
|
||||
break;
|
||||
case SPBM_RECT:
|
||||
if (down) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (x1<a1) {
|
||||
if (x1<arg1) {
|
||||
x11=x1;
|
||||
x22=a1;
|
||||
x22=arg1;
|
||||
} else {
|
||||
x11=a1;
|
||||
x11=arg1;
|
||||
x22=x1;
|
||||
}
|
||||
if (y1<a2) {
|
||||
if (y1<arg2) {
|
||||
y11=y1;
|
||||
y22=a2;
|
||||
y22=arg2;
|
||||
} else {
|
||||
y11=a2;
|
||||
y11=arg2;
|
||||
y22=y1;
|
||||
}
|
||||
dc->color=color;
|
||||
@@ -488,18 +488,18 @@ bm_menu:
|
||||
case SPBM_DELETE:
|
||||
if (down) {
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (x1<a1) {
|
||||
if (x1<arg1) {
|
||||
x11=x1;
|
||||
x22=a1;
|
||||
x22=arg1;
|
||||
} else {
|
||||
x11=a1;
|
||||
x11=arg1;
|
||||
x22=x1;
|
||||
}
|
||||
if (y1<a2) {
|
||||
if (y1<arg2) {
|
||||
y11=y1;
|
||||
y22=a2;
|
||||
y22=arg2;
|
||||
} else {
|
||||
y11=a2;
|
||||
y11=arg2;
|
||||
y22=y1;
|
||||
}
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
@@ -512,7 +512,7 @@ bm_menu:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(a1-x1)+SqrI64(a2-y1)));
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(arg1-x1)+SqrI64(arg2-y1)));
|
||||
}
|
||||
break;
|
||||
case SPBM_PASTE:
|
||||
@@ -521,12 +521,12 @@ bm_menu:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==SPBM_PASTE) {
|
||||
clipboard->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc,a1,a2,clipboard);
|
||||
GrBlot(dc,arg1,arg2,clipboard);
|
||||
clipboard->flags&=~DCF_NO_TRANSPARENTS;
|
||||
} else {
|
||||
dc2=DCCopy(clipboard);
|
||||
DCColorChg(dc2,bkcolor);
|
||||
GrBlot(dc,a1,a2,dc2);
|
||||
GrBlot(dc,arg1,arg2,dc2);
|
||||
DCDel(dc2);
|
||||
}
|
||||
}
|
||||
@@ -534,30 +534,30 @@ bm_menu:
|
||||
case SPBM_TEXT:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPrint(dc,a1,a2,"%s",st);
|
||||
GrPrint(dc,arg1,arg2,"%s",st);
|
||||
break;
|
||||
case SPBM_TEXT_BOX:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextBox3(dc,a1,a2,0,st);
|
||||
GrTextBox3(dc,arg1,arg2,0,st);
|
||||
break;
|
||||
case SPBM_TEXT_DIAMOND:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrTextDiamond3(dc,a1,a2,0,st);
|
||||
GrTextDiamond3(dc,arg1,arg2,0,st);
|
||||
break;
|
||||
case SPBM_POLYPT:
|
||||
if (down) {
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
GrLine3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
|
||||
GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
x1=a1; y1=a2;
|
||||
x1=arg1; y1=arg2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
case MSG_MS_L_UP:
|
||||
switch (mode) {
|
||||
case SPBM_LINE:
|
||||
case SPBM_ARROW:
|
||||
@@ -566,29 +566,29 @@ bm_menu:
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
if (mode==SPBM_ARROW)
|
||||
GrArrow3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
|
||||
GrArrow3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
|
||||
else
|
||||
GrLine3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
|
||||
GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==SPBM_POLYLINE) {
|
||||
x1=a1; y1=a2;
|
||||
x1=arg1; y1=arg2;
|
||||
} else
|
||||
down=FALSE;
|
||||
break;
|
||||
case SPBM_RECT:
|
||||
img->color=color;
|
||||
if (x1<a1) {
|
||||
if (x1<arg1) {
|
||||
x11=x1;
|
||||
x22=a1;
|
||||
x22=arg1;
|
||||
} else {
|
||||
x11=a1;
|
||||
x11=arg1;
|
||||
x22=x1;
|
||||
}
|
||||
if (y1<a2) {
|
||||
if (y1<arg2) {
|
||||
y11=y1;
|
||||
y22=a2;
|
||||
y22=arg2;
|
||||
} else {
|
||||
y11=a2;
|
||||
y11=arg2;
|
||||
y22=y1;
|
||||
}
|
||||
GrRect(img,x11-xx1,y11-yy1,x22-x11+1,y22-y11+1);
|
||||
@@ -597,18 +597,18 @@ bm_menu:
|
||||
break;
|
||||
case SPBM_COPY:
|
||||
case SPBM_DELETE:
|
||||
if (x1<a1) {
|
||||
if (x1<arg1) {
|
||||
x11=x1;
|
||||
x22=a1;
|
||||
x22=arg1;
|
||||
} else {
|
||||
x11=a1;
|
||||
x11=arg1;
|
||||
x22=x1;
|
||||
}
|
||||
if (y1<a2) {
|
||||
if (y1<arg2) {
|
||||
y11=y1;
|
||||
y22=a2;
|
||||
y22=arg2;
|
||||
} else {
|
||||
y11=a2;
|
||||
y11=arg2;
|
||||
y22=y1;
|
||||
}
|
||||
DCDel(clipboard);
|
||||
@@ -622,7 +622,8 @@ bm_menu:
|
||||
case SPBM_CIRCLE:
|
||||
img->color=color;
|
||||
img->pen_width=width;
|
||||
GrCircle3(img,x1-xx1,y1-yy1,0,Sqrt(SqrI64(a1-x1)+SqrI64(a2-y1)));
|
||||
GrCircle3(img,x1-xx1,y1-yy1,0,
|
||||
Sqrt(SqrI64(arg1-x1)+SqrI64(arg2-y1)));
|
||||
down=FALSE;
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
@@ -632,12 +633,12 @@ bm_menu:
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
if (mode==SPBM_PASTE) {
|
||||
clipboard->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(img,a1-xx1,a2-yy1,clipboard);
|
||||
GrBlot(img,arg1-xx1,arg2-yy1,clipboard);
|
||||
clipboard->flags&=~DCF_NO_TRANSPARENTS;
|
||||
} else {
|
||||
dc2=DCCopy(clipboard);
|
||||
DCColorChg(dc2,bkcolor);
|
||||
GrBlot(img,a1-xx1,a2-yy1,dc2);
|
||||
GrBlot(img,arg1-xx1,arg2-yy1,dc2);
|
||||
DCDel(dc2);
|
||||
}
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
@@ -645,15 +646,15 @@ bm_menu:
|
||||
break;
|
||||
case SPBM_TEXT:
|
||||
img->color=color;
|
||||
GrPrint(img,a1-xx1,a2-yy1,"%s",st);
|
||||
GrPrint(img,arg1-xx1,arg2-yy1,"%s",st);
|
||||
goto bm_menu;
|
||||
case SPBM_TEXT_BOX:
|
||||
img->color=color;
|
||||
GrTextBox3(img,a1-xx1,a2-yy1,0,st);
|
||||
GrTextBox3(img,arg1-xx1,arg2-yy1,0,st);
|
||||
goto bm_menu;
|
||||
case SPBM_TEXT_DIAMOND:
|
||||
img->color=color;
|
||||
GrTextDiamond3(img,a1-xx1,a2-yy1,0,st);
|
||||
GrTextDiamond3(img,arg1-xx1,arg2-yy1,0,st);
|
||||
goto bm_menu;
|
||||
}
|
||||
break;
|
||||
|
||||
+68
-53
@@ -181,7 +181,7 @@ U0 SpriteSetOrigin(CSprite *head,I64 dx,I64 dy,I64 dz)
|
||||
CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,radius=tmpg->pr.radius<<16;
|
||||
F64 m1,arg1,m2,radius=tmpg->pr.radius<<16;
|
||||
CSprite *tmpg1=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
tmpg1->type=SPT_ELLIPSE;
|
||||
|
||||
@@ -192,7 +192,7 @@ CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
|
||||
|
||||
x=radius; y=0; z=0;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
R2P(&m1,&arg1,x,y);
|
||||
|
||||
x=0; y=radius; z=0;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
@@ -200,7 +200,7 @@ CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
|
||||
|
||||
tmpg1->pwha.width =ToI64(m1)/0x10000;
|
||||
tmpg1->pwha.height=ToI64(m2)/0x10000;
|
||||
tmpg1->pwha.angle=-a1;
|
||||
tmpg1->pwha.angle=-arg1;
|
||||
|
||||
tmpg1->type|=tmpg->type&SPF_SEL;
|
||||
return tmpg1;
|
||||
@@ -209,7 +209,7 @@ CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
|
||||
CSprite *SpriteTransformEllipse(I64 *r,CSprite *tmpg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,a2,s,c,x_radius=tmpg->pwha.width<<16,
|
||||
F64 m1,arg1,m2,arg2,s,c,x_radius=tmpg->pwha.width<<16,
|
||||
y_radius=tmpg->pwha.height<<16;
|
||||
CSprite *tmpg1=CAlloc(SpriteElemQuedBaseSize(tmpg->type&SPG_TYPE_MASK));
|
||||
tmpg1->type=tmpg->type;
|
||||
@@ -228,20 +228,20 @@ CSprite *SpriteTransformEllipse(I64 *r,CSprite *tmpg)
|
||||
y=x_radius*s;
|
||||
z=0;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
R2P(&m1,&arg1,x,y);
|
||||
|
||||
x=-y_radius*s;
|
||||
y=y_radius*c;
|
||||
z=0;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
R2P(&m2,&arg2,x,y);
|
||||
m2*=Abs(Sin(arg2-arg1));
|
||||
|
||||
tmpg1->pwha.width=ToI64(m1)/0x10000;
|
||||
if (tmpg1->pwha.width<1) tmpg1->pwha.width=1;
|
||||
tmpg1->pwha.height=ToI64(m2)/0x10000;
|
||||
if (tmpg1->pwha.height<1) tmpg1->pwha.height=1;
|
||||
tmpg1->pwha.angle=-a1;
|
||||
tmpg1->pwha.angle=-arg1;
|
||||
|
||||
tmpg1->type|=tmpg->type&SPF_SEL;
|
||||
return tmpg1;
|
||||
@@ -250,7 +250,7 @@ CSprite *SpriteTransformEllipse(I64 *r,CSprite *tmpg)
|
||||
CSprite *SpriteTransformRect(I64 *r,CSprite *tmpg,F64 é)
|
||||
{
|
||||
I64 x,y,z,w,h;
|
||||
F64 m1,a1,m2,a2,s,c,
|
||||
F64 m1,arg1,m2,arg2,s,c,
|
||||
x_radius=(tmpg->pp.x2-tmpg->pp.x1)<<16,
|
||||
y_radius=(tmpg->pp.y2-tmpg->pp.y1)<<16;
|
||||
CSprite *tmpg1=CAlloc(SpriteElemQuedBaseSize(SPT_ROTATED_RECT));
|
||||
@@ -268,14 +268,14 @@ CSprite *SpriteTransformRect(I64 *r,CSprite *tmpg,F64
|
||||
y=x_radius*s;
|
||||
z=0;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
R2P(&m1,&arg1,x,y);
|
||||
|
||||
x=-y_radius*s;
|
||||
y=y_radius*c;
|
||||
z=0;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
R2P(&m2,&arg2,x,y);
|
||||
m2*=Abs(Sin(arg2-arg1));
|
||||
|
||||
w=ToI64(m1)/0x10000;
|
||||
if (w<1) w=1;
|
||||
@@ -283,7 +283,7 @@ CSprite *SpriteTransformRect(I64 *r,CSprite *tmpg,F64
|
||||
if (h<1) h=1;
|
||||
tmpg1->ppa.x2=tmpg1->ppa.x1+w;
|
||||
tmpg1->ppa.y2=tmpg1->ppa.y1+h;
|
||||
tmpg1->ppa.angle=-a1;
|
||||
tmpg1->ppa.angle=-arg1;
|
||||
|
||||
tmpg1->type|=tmpg->type&SPF_SEL;
|
||||
return tmpg1;
|
||||
@@ -371,10 +371,9 @@ CSprite *SpriteTransformBitMap(I64 *r,CSprite *tmpg)
|
||||
return tmpg1;
|
||||
}
|
||||
|
||||
U0 SpriteTransform(I64 *r,CSprite *head)
|
||||
U0 SpriteTransformQue(CSprite *head,I64 *r)
|
||||
{
|
||||
I64 i,j,k,num,
|
||||
x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3;
|
||||
I64 i,j,k,num,x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSprite *tmpg=head->next,head2,*tmpg1,*tmpg2,*tmpg3;
|
||||
@@ -960,7 +959,7 @@ U0 SpriteCtrlPtsMove(CEdSprite *head,I64 dx,I64 dy)
|
||||
|
||||
Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
{
|
||||
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
||||
I64 msg_code,arg1,arg2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
||||
Bool res=TRUE;
|
||||
CDC *dc=DCAlias;
|
||||
CEdSprite head,*tmpes,*best_es;
|
||||
@@ -970,14 +969,14 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
if (head.next!=&head) {
|
||||
while (TRUE) {
|
||||
SpriteCtrlPtsDraw(dc,&head); //has Refresh
|
||||
switch (msg_code=ScanMsg(&a1,&a2,
|
||||
1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN|1<<MSG_KEY_DOWN)) {
|
||||
case MSG_IP_L_DOWN:
|
||||
switch (msg_code=ScanMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_R_UP|1<<MSG_MS_L_DOWN|1<<MSG_KEY_DOWN)) {
|
||||
case MSG_MS_L_DOWN:
|
||||
switch (mode) {
|
||||
case SPED_SEL:
|
||||
case SPED_UNSEL:
|
||||
case SPED_SHIFT_PTS:
|
||||
xx=a1; yy=a2;
|
||||
xx=arg1; yy=arg2;
|
||||
best_dd=MAX_I64;
|
||||
tmpes=head.next;
|
||||
while (tmpes!=&head) {
|
||||
@@ -1007,14 +1006,15 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
}
|
||||
break;
|
||||
start:
|
||||
xx2=xx=a1; yy2=yy=a2;
|
||||
xx2=xx=arg1; yy2=yy=arg2;
|
||||
while (TRUE) {
|
||||
SpriteCtrlPtsDraw(dc,&head);
|
||||
dc->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
GrBorder(dc,xx,yy,xx2,yy2);
|
||||
if (msg_code=ScanMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_IP_L_UP)) {
|
||||
if (msg_code==MSG_IP_MOVE) {
|
||||
xx2=a1; yy2=a2;
|
||||
if (msg_code=ScanMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_MOVE|1<<MSG_MS_L_UP)) {
|
||||
if (msg_code==MSG_MS_MOVE) {
|
||||
xx2=arg1; yy2=arg2;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
@@ -1057,10 +1057,11 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
case SPED_SHIFT_RECTS:
|
||||
do {
|
||||
SpriteCtrlPtsDraw(dc,&head);
|
||||
msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN);
|
||||
msg_code=ScanMsg(&arg1,&arg2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN);
|
||||
if (msg_code==MSG_KEY_DOWN) goto gs_key;
|
||||
} while (msg_code!=MSG_IP_L_DOWN);
|
||||
xx=a1;yy=a2;
|
||||
} while (msg_code!=MSG_MS_L_DOWN);
|
||||
xx=arg1;yy=arg2;
|
||||
break;
|
||||
end:
|
||||
}
|
||||
@@ -1069,11 +1070,12 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
case SPED_SHIFT_RECTS:
|
||||
do {
|
||||
SpriteCtrlPtsDraw(dc,&head);
|
||||
if (msg_code=ScanMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_IP_L_UP)) {
|
||||
SpriteCtrlPtsMove(&head,a1-xx,a2-yy);
|
||||
xx=a1;yy=a2;
|
||||
if (msg_code=ScanMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_MOVE|1<<MSG_MS_L_UP)) {
|
||||
SpriteCtrlPtsMove(&head,arg1-xx,arg2-yy);
|
||||
xx=arg1;yy=arg2;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
tmpes=head.next;
|
||||
while (tmpes!=&head) {
|
||||
tmpes->flags&=~SPEDF_SEL;
|
||||
@@ -1085,11 +1087,11 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
gs_key:
|
||||
switch (a1.u8[0]) {
|
||||
switch (arg1.u8[0]) {
|
||||
case CH_SHIFT_ESC:
|
||||
res=FALSE;
|
||||
case CH_ESC:
|
||||
GetMsg(&a1,&a2,1<<MSG_KEY_UP);
|
||||
GetMsg(&arg1,&arg2,1<<MSG_KEY_UP);
|
||||
goto gs_done;
|
||||
case 'p':
|
||||
case 'P':
|
||||
@@ -1101,7 +1103,7 @@ gs_key:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
case MSG_MS_R_UP:
|
||||
goto gs_done;
|
||||
}
|
||||
}
|
||||
@@ -1121,7 +1123,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||
CDocEntry *doc_e2;
|
||||
CDocBin *tmpb;
|
||||
Bool unlock;
|
||||
I64 i,r[16],msg_code,a1,a2,xx,yy,
|
||||
I64 i,r[16],msg_code,arg1,arg2,xx,yy,
|
||||
old_de_flags;
|
||||
CSprite *head2,*next,*last,*tmpg,*insert_pt;
|
||||
|
||||
@@ -1147,8 +1149,8 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||
case SPED_SET_ORIGIN:
|
||||
SpriteQueSelAll(*_head);
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
GetMsg(&a1,&a2,1<<MSG_IP_L_UP);
|
||||
SpriteSetOrigin(*_head,x-a1,y-a2,0);
|
||||
GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP);
|
||||
SpriteSetOrigin(*_head,x-arg1,y-arg2,0);
|
||||
SpriteEdUpdate(doc,doc_ce,*_head);
|
||||
SpriteQueSelAll(*_head,FALSE);
|
||||
break;
|
||||
@@ -1156,15 +1158,15 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||
if (!SpriteQueSelCnt(*_head))
|
||||
SpriteQueSelAll(*_head);
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN);
|
||||
xx=a1; yy=a2;
|
||||
GetMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN);
|
||||
xx=arg1; yy=arg2;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteSetOrigin(*_head,a1-xx,a2-yy,0);
|
||||
xx=a1; yy=a2;
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteSetOrigin(*_head,arg1-xx,arg2-yy,0);
|
||||
xx=arg1; yy=arg2;
|
||||
SpriteEdUpdate(doc,doc_ce,*_head);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
if (!SpriteQueSelCnt(*_head,FALSE))
|
||||
SpriteQueSelAll(*_head,FALSE);
|
||||
break;
|
||||
@@ -1191,7 +1193,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||
if (!SpriteQueSelCnt(*_head))
|
||||
SpriteQueSelAll(*_head);
|
||||
if (PopUpTransform(r)) {
|
||||
SpriteTransform(r,*_head);
|
||||
SpriteTransformQue(*_head,r);
|
||||
SpriteEdUpdate(doc,doc_ce,*_head);
|
||||
}
|
||||
if (!SpriteQueSelCnt(*_head,FALSE))
|
||||
@@ -1205,15 +1207,15 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||
tmpg->p.x1=0;
|
||||
tmpg->p.y1=0;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN);
|
||||
xx=a1; yy=a2;
|
||||
GetMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN);
|
||||
xx=arg1; yy=arg2;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
tmpg->p.x1=a1-xx;
|
||||
tmpg->p.y1=a2-yy;
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
tmpg->p.x1=arg1-xx;
|
||||
tmpg->p.y1=arg2-yy;
|
||||
SpriteEdUpdate(doc,doc_ce,*_head);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
*_cur_elem_num+=1;
|
||||
break;
|
||||
case SPED_INS_CLIPBOARD:
|
||||
@@ -1265,3 +1267,16 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||
case SPED_MAIN_MENU: return SPE_CONT;
|
||||
}
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Sprites;Graphics/Math/3D Transformation"
|
||||
public U8 *SpriteTransform(U8 *elems,I64 *r)
|
||||
{//Rotate Sprite using 4x4 matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
U8 *res;
|
||||
CSprite *head=Sprite2SpriteQue(elems);
|
||||
SpriteQueSelAll(head);
|
||||
SpriteTransformQue(head,r);
|
||||
res=SpriteQue2Sprite(head);
|
||||
QueDel(head);
|
||||
Free(head);
|
||||
return res;
|
||||
}
|
||||
+126
-122
@@ -128,17 +128,17 @@ U0 SpriteScrnInit(CDC *dc,I64,I64)
|
||||
dc->pen_width=old_pen_width;
|
||||
}
|
||||
|
||||
CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
|
||||
CSprite *res;
|
||||
do {
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
|
||||
@@ -150,17 +150,17 @@ CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
|
||||
CSprite *res;
|
||||
do {
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
|
||||
@@ -172,9 +172,9 @@ CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
||||
CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,old_width,old_flags;
|
||||
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,old_width,old_flags;
|
||||
CSprite *res;
|
||||
old_width=dc->pen_width;
|
||||
old_flags=dc->flags;
|
||||
@@ -183,10 +183,10 @@ CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
||||
do {
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
dc->flags=old_flags&DCF_SYMMETRY|dc->flags&~DCF_SYMMETRY;
|
||||
dc->pen_width=old_width;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
@@ -198,16 +198,17 @@ CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2;
|
||||
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,
|
||||
xx1=arg1,yy1=arg2,xx2=arg1,yy2=arg2;
|
||||
CSprite *res;
|
||||
do {
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
x2=arg1; y2=arg2;
|
||||
if (x2<x1) {
|
||||
xx1=x2; xx2=x1;
|
||||
} else {
|
||||
@@ -218,7 +219,7 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
} else {
|
||||
yy1=y1; yy2=y2;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||
@@ -230,10 +231,11 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
CColorROPU32 bm_bkcolor)
|
||||
CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,
|
||||
I64 arg1,I64 arg2,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;
|
||||
I64 i,msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,
|
||||
xx1=arg1,yy1=arg2,xx2=arg1,yy2=arg2,old_width;
|
||||
CDC *dc3,*img;
|
||||
CSprite *res;
|
||||
old_width=dc2->pen_width;
|
||||
@@ -242,9 +244,9 @@ CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
x2=arg1; y2=arg2;
|
||||
if (x2<x1) {
|
||||
xx1=x2; xx2=x1;
|
||||
} else {
|
||||
@@ -255,7 +257,7 @@ CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
} else {
|
||||
yy1=y1; yy2=y2;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
xx2++; yy2++;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
res->type=SPT_BITMAP;
|
||||
@@ -283,17 +285,17 @@ CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
|
||||
CSprite *res;
|
||||
do {
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||
@@ -304,18 +306,18 @@ CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
|
||||
F64 angle1,angle2;
|
||||
CSprite *res;
|
||||
do {
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
res->type=SPT_ELLIPSE;
|
||||
res->pwha.x1=(x1+x2)>>1-x;
|
||||
@@ -334,10 +336,10 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
if (res->pwha.width>=res->pwha.height)
|
||||
res->pwha.angle=-(angle1-angle2);
|
||||
@@ -349,20 +351,20 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,I64 sides,
|
||||
CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
|
||||
F64 angle1,angle2;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
res->type=SPT_POLYGON;
|
||||
res->pwhas.x1=(x1+x2)>>1-x;
|
||||
@@ -383,10 +385,10 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
if (res->pwhas.width>=res->pwhas.height)
|
||||
res->pwhas.angle=-(angle1-angle2);
|
||||
@@ -399,10 +401,10 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,
|
||||
CColorROPU32 color)
|
||||
{
|
||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I64 i,num=0,msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSprite *res,*tmpg,*tmpg1,head2;
|
||||
@@ -413,14 +415,15 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE+1<<MSG_IP_R_UP);
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE+1<<MSG_MS_R_UP);
|
||||
dc->color=TRANSPARENT;
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP && msg_code!=MSG_IP_R_UP);
|
||||
x2=arg1; y2=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP && msg_code!=MSG_MS_R_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
if (msg_code==MSG_MS_L_UP) {
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
@@ -431,7 +434,7 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
} while (msg_code!=MSG_MS_R_UP);
|
||||
|
||||
switch (eletype) {
|
||||
case SPT_POLYLINE:
|
||||
@@ -489,22 +492,22 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
|
||||
{
|
||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,x3,y3;
|
||||
I64 i,num=0,msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,x3,y3;
|
||||
I32 *ptr;
|
||||
CSprite *res,*tmpg,*tmpg1,head2;
|
||||
|
||||
QueInit(&head2);
|
||||
x3=a1-x; y3=a2-y;
|
||||
x3=arg1-x; y3=arg2-y;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
x2=a1; y2=a2;
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
x2=arg1; y2=arg2;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
Line(&head2,x1-x,y1-y,0,x2-x,y2-y,0,&SpritePolyPtPlot);
|
||||
x1=x2;y1=y2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
|
||||
num=0;
|
||||
res=head2.next;
|
||||
@@ -545,7 +548,7 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
}
|
||||
|
||||
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 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color,I64 *_cur_elem_num,
|
||||
I64 old_de_flags)
|
||||
{
|
||||
CSprite *tmpg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num);
|
||||
@@ -563,10 +566,10 @@ U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,CDC *dc,
|
||||
case SPT_TEXT_BOX: GrTextBox3(dc,x1,y1,0,st); break;
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x1=a1; y1=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
x1=arg1; y1=arg2;
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(eletype)+StrLen(st)+1);
|
||||
tmpg->type=eletype;
|
||||
tmpg->ps.x1=x1-x;
|
||||
@@ -580,10 +583,10 @@ U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,CDC *dc,
|
||||
}
|
||||
|
||||
I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
CDC *dc,I64 xx,I64 yy,I64 a1,I64 a2,CColorROPU32 bm_bkcolor,
|
||||
CDC *dc,I64 xx,I64 yy,I64 arg1,I64 arg2,CColorROPU32 bm_bkcolor,
|
||||
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;
|
||||
I64 i,msg_code,x=xx,y=yy,x1=arg1,y1=arg2,x2=arg1,y2=arg2,old_width;
|
||||
CSprite *tmpg,*tmpg1,*insert_pt;
|
||||
CDC *img;
|
||||
|
||||
@@ -591,16 +594,16 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
x+=xx; y+=yy;
|
||||
|
||||
if (sel) {
|
||||
xx1=a1; yy1=a2;
|
||||
xx2=a1; yy2=a2;
|
||||
xx1=arg1; yy1=arg2;
|
||||
xx2=arg1; yy2=arg2;
|
||||
old_width=dc->pen_width;
|
||||
dc->pen_width=1;
|
||||
do {
|
||||
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);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
SpriteScrnInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
x2=arg1; y2=arg2;
|
||||
if (x2<x1) {
|
||||
xx1=x2; xx2=x1;
|
||||
} else {
|
||||
@@ -611,7 +614,7 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
} else {
|
||||
yy1=y1; yy2=y2;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
dc->pen_width=old_width;
|
||||
}
|
||||
|
||||
@@ -714,7 +717,7 @@ 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)
|
||||
I64 x,I64 y,I64 arg1,I64 arg2,I64 *_cur_elem_num)
|
||||
{
|
||||
CSprite *tmpg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num),
|
||||
*tmpg1=insert_pt;
|
||||
@@ -723,8 +726,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
I32 *mesh,*old_mesh;
|
||||
if (tmpg1!=head && tmpg1->type&SPG_TYPE_MASK==SPT_MESH) {
|
||||
z=0;
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
x1=-(arg1-x);
|
||||
y1=-(arg2-y);
|
||||
z1=z;
|
||||
p=&tmpg1->mu.u;
|
||||
for (i=0;i<tmpg1->mu.vertex_cnt;i++,p++) {
|
||||
@@ -735,8 +738,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
old_mesh=&tmpg1->mu.vertex_cnt;
|
||||
} else if (tmpg1!=head && tmpg1->type&SPG_TYPE_MASK==SPT_SHIFTABLE_MESH) {
|
||||
z=-tmpg1->pmu.z;
|
||||
x1=tmpg1->pmu.x-(a1-x);
|
||||
y1=tmpg1->pmu.y-(a2-y);
|
||||
x1=tmpg1->pmu.x-(arg1-x);
|
||||
y1=tmpg1->pmu.y-(arg2-y);
|
||||
z1=tmpg1->pmu.z+z;
|
||||
p=&tmpg1->pmu.u;
|
||||
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
|
||||
@@ -754,8 +757,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
tmpg->type=SPT_SHIFTABLE_MESH;
|
||||
MemCpy(&tmpg->pmu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
tmpg->pmu.x=a1-x;
|
||||
tmpg->pmu.y=a2-y;
|
||||
tmpg->pmu.x=arg1-x;
|
||||
tmpg->pmu.y=arg2-y;
|
||||
tmpg->pmu.z=-z;
|
||||
QueIns(tmpg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,doc_ce,head);
|
||||
@@ -767,8 +770,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
} else
|
||||
*_cur_elem_num+=1;
|
||||
} else if (old_mesh && tmpg1->type&SPG_TYPE_MASK==SPT_SHIFTABLE_MESH) {
|
||||
x1=tmpg1->pmu.x-(a1-x);
|
||||
y1=tmpg1->pmu.y-(a2-y);
|
||||
x1=tmpg1->pmu.x-(arg1-x);
|
||||
y1=tmpg1->pmu.y-(arg2-y);
|
||||
z1=tmpg1->pmu.z+z;
|
||||
p=&tmpg1->pmu.u;
|
||||
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
|
||||
@@ -777,8 +780,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
|
||||
p->z-=z1;
|
||||
}
|
||||
} else if (old_mesh && tmpg1->type&SPG_TYPE_MASK==SPT_MESH) {
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
x1=-(arg1-x);
|
||||
y1=-(arg2-y);
|
||||
z1= z;
|
||||
p=&tmpg1->mu.u;
|
||||
for (i=0;i<tmpg1->mu.vertex_cnt;i++,p++) {
|
||||
@@ -809,7 +812,7 @@ U0 SMTaskTitleSet(I64 eletype)
|
||||
I64 SpriteMainEd(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
I64 res,i,x,y,a1,a2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
|
||||
I64 res,i,x,y,arg1,arg2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
|
||||
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;
|
||||
@@ -914,21 +917,21 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
doc_ce->de_flags|=DOCEF_DONT_DRAW;
|
||||
if (PopUpNoYes("Study the $$LK,\"X-Caliber\","
|
||||
"A=\"FF:::/PersonalMenu.DD.Z,X-Caliber\"$$ icon.\n\n"
|
||||
"It has black rectangle background with stars. The\n"
|
||||
"mesh is in front and rotates. To keep the background\n"
|
||||
"rectangle from rotating, "
|
||||
"$$GREEN$$TRANSFORM OFF$$FG$$ has been used.\n\n"
|
||||
"The X-Caliber mesh has a different origin for rotation.\n"
|
||||
"To avoid clipping, it also has also been moved in the\n"
|
||||
"negative Z direction by editing the sprite as text\n"
|
||||
"and changing the first vector.\n\n"
|
||||
"For the mesh you are creating, use same origin as\n"
|
||||
"the rest of the sprite? If $$GREEN$$YES$$FG$$, you can always\n"
|
||||
"shift the mesh origin point in the sprite edit menu.\n")) {
|
||||
"A=\"FF:::/PersonalMenu.DD.Z,X-Caliber\"$$ icon.\n\n"
|
||||
"It has black rectangle background with stars. The\n"
|
||||
"mesh is in front and rotates. To keep the background\n"
|
||||
"rectangle from rotating, "
|
||||
"$$GREEN$$TRANSFORM OFF$$FG$$ has been used.\n\n"
|
||||
"The X-Caliber mesh has a different origin for rotation.\n"
|
||||
"To avoid clipping, it also has also been moved in the\n"
|
||||
"negative Z direction by editing the sprite as text\n"
|
||||
"and changing the first vector.\n\n"
|
||||
"For the mesh you are creating, use same origin as\n"
|
||||
"the rest of the sprite? If $$GREEN$$YES$$FG$$, you can always\n"
|
||||
"shift the mesh origin point in the sprite edit menu.\n")) {
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
a1=x; a2=y;
|
||||
SMShiftableMesh(doc,doc_ce,head,x,y,a1,a2,&cur_elem_num);
|
||||
arg1=x; arg2=y;
|
||||
SMShiftableMesh(doc,doc_ce,head,x,y,arg1,arg2,&cur_elem_num);
|
||||
eletype=SPT_MENU;
|
||||
} else
|
||||
PopUpOk("Select Origin.\n");
|
||||
@@ -938,7 +941,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
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;
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_MS_L|WIF_FOCUS_TASK_MS_R|
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
@@ -956,7 +959,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
xx1+=xx; yy1+=yy;
|
||||
xx2+=xx; yy2+=yy;
|
||||
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,arg1,arg2,bm_bkcolor,
|
||||
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==SPE_EXIT) {
|
||||
res=SPE_EXIT;
|
||||
goto ei_done;
|
||||
@@ -976,7 +979,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
PopUpOk("Drag-out a rect for the extents of the\nbitmap.\n");
|
||||
}
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_MS_L|WIF_FOCUS_TASK_MS_R|
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
@@ -1016,7 +1019,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
SMTextFamily(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,
|
||||
SMTextFamily(eletype,doc,doc_ce,head,dc,xx,yy,arg1,arg2,
|
||||
color,&cur_elem_num,old_de_flags);
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
@@ -1034,9 +1037,10 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
res=SPE_ABORT;
|
||||
goto ei_done;
|
||||
}
|
||||
switch (GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN)) {
|
||||
switch (GetMsg(&arg1,&arg2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_MS_R_UP|1<<MSG_MS_L_DOWN)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case CH_ESC:
|
||||
res=SPE_EXIT;
|
||||
goto ei_done;
|
||||
@@ -1045,7 +1049,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
goto ei_done;
|
||||
case 'c': //eye-dropper
|
||||
dc3=DCScrnCapture(FALSE);
|
||||
color=GrPeek(dc3,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
color=GrPeek(dc3,ms.pos.x,ms.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc3);
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tmpg->type=SPT_COLOR;
|
||||
@@ -1064,7 +1068,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
case MSG_MS_R_UP:
|
||||
if (eletype==SPT_PLANAR_SYMMETRY) {
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
tmpg->type=SPT_PLANAR_SYMMETRY;
|
||||
@@ -1075,35 +1079,35 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
} else
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_MS_L_DOWN:
|
||||
switch (eletype) {
|
||||
start:
|
||||
case SPT_LINE:
|
||||
tmpg=SMLine(dc,x,y,a1,a2,color);
|
||||
tmpg=SMLine(dc,x,y,arg1,arg2,color);
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
tmpg=SMArrow(dc,x,y,a1,a2,color);
|
||||
tmpg=SMArrow(dc,x,y,arg1,arg2,color);
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
tmpg=SMPlanarSymmetry(dc,x,y,a1,a2);
|
||||
tmpg=SMPlanarSymmetry(dc,x,y,arg1,arg2);
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case SPT_RECT:
|
||||
tmpg=SMRect(dc,x,y,a1,a2,color);
|
||||
tmpg=SMRect(dc,x,y,arg1,arg2,color);
|
||||
break;
|
||||
case SPT_INS_SCRN_BITMAP:
|
||||
case SPT_INS_TRANSPARENT_SCRN_BITMAP:
|
||||
tmpg=SMScrnBitMap(eletype,dc,dc2,x,y,a1,a2,bm_bkcolor);
|
||||
tmpg=SMScrnBitMap(eletype,dc,dc2,x,y,arg1,arg2,bm_bkcolor);
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
tmpg=SMCircle(dc,x,y,a1,a2,color);
|
||||
tmpg=SMCircle(dc,x,y,arg1,arg2,color);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
tmpg=SMEllipse(dc,x,y,a1,a2,color);
|
||||
tmpg=SMEllipse(dc,x,y,arg1,arg2,color);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
tmpg=SMPolygon(dc,x,y,a1,a2,i,color);
|
||||
tmpg=SMPolygon(dc,x,y,arg1,arg2,i,color);
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case SPT_PT:
|
||||
@@ -1111,18 +1115,18 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
tmpg=CAlloc(SpriteElemQuedBaseSize(eletype));
|
||||
tmpg->type=eletype;
|
||||
tmpg->p.x1=a1-x;
|
||||
tmpg->p.y1=a2-y;
|
||||
tmpg->p.x1=arg1-x;
|
||||
tmpg->p.y1=arg2-y;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
tmpg=SMPolyLineFamily(eletype,dc,x,y,a1,a2,color);
|
||||
tmpg=SMPolyLineFamily(eletype,dc,x,y,arg1,arg2,color);
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
tmpg=SMPolyPoint(dc,x,y,a1,a2,color);
|
||||
tmpg=SMPolyPoint(dc,x,y,arg1,arg2,color);
|
||||
break;
|
||||
end:
|
||||
if (tmpg) {
|
||||
@@ -1132,8 +1136,8 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
}
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
TRUE,,,,,&cur_elem_num)==SPE_EXIT) {
|
||||
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,
|
||||
arg1,arg2,bm_bkcolor,TRUE,,,,,&cur_elem_num)==SPE_EXIT) {
|
||||
res=SPE_EXIT;
|
||||
goto ei_done;
|
||||
}
|
||||
@@ -1141,9 +1145,9 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
GetMsg(NULL,NULL,1<<MSG_IP_L_UP);
|
||||
GetMsg(NULL,NULL,1<<MSG_MS_L_UP);
|
||||
doc_ce->de_flags|=DOCEF_DONT_DRAW;
|
||||
SMShiftableMesh(doc,doc_ce,head,x,y,a1,a2,&cur_elem_num);
|
||||
SMShiftableMesh(doc,doc_ce,head,x,y,arg1,arg2,&cur_elem_num);
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
eletype=SPT_MENU;
|
||||
break;
|
||||
|
||||
+80
-79
@@ -10,7 +10,7 @@ class CMeshEdVertex
|
||||
CMeshEdVertex *next,*last,*copy;
|
||||
|
||||
U0 start;
|
||||
CD3I32 p; //World coordinates of the point.
|
||||
CD3I32 p; //World coordinates of the point.
|
||||
U0 end;
|
||||
CD3I32 p0,
|
||||
pt; //Transformed coordinates. (Scrn)
|
||||
@@ -34,7 +34,7 @@ class CMeshEdTri
|
||||
|
||||
class CMeshFrame
|
||||
{
|
||||
I64 ip_z,thickness; //Input pointer (mouse) Z-coordinate
|
||||
I64 ms_z,thickness; //Mouse Z-coordinate
|
||||
I64 ed_mode,cx,cy;
|
||||
CColorROPU32 cur_color;
|
||||
Bool grid_on,flip_y,sel_rect,vertex_on,closed,pad[3];
|
||||
@@ -80,7 +80,7 @@ CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
|
||||
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);
|
||||
dz=AbsI64(e->ms_z-tmpv->p.z);
|
||||
if (dd<best_dd || dd==best_dd && dz<best_dz) {
|
||||
res=tmpv;
|
||||
best_dd=dd;
|
||||
@@ -425,17 +425,17 @@ U0 MeshCurSnap(CMeshFrame *e)
|
||||
Mat4x4MulXYZ(e->w2s,&x1,&y1,&z1);
|
||||
x2=0; y2=e->cur_snap<<16; z2=0;
|
||||
Mat4x4MulXYZ(e->w2s,&x2,&y2,&z2);
|
||||
ip_grid.x=Max(1,MaxI64(x1,x2)>>16);
|
||||
ip_grid.y=Max(1,MaxI64(y1,y2)>>16);
|
||||
ip_grid.z=Min(ip_grid.x,ip_grid.y);
|
||||
ms_grid.x=Max(1,MaxI64(x1,x2)>>16);
|
||||
ms_grid.y=Max(1,MaxI64(y1,y2)>>16);
|
||||
ms_grid.z=Min(ms_grid.x,ms_grid.y);
|
||||
}
|
||||
}
|
||||
|
||||
U0 MeshScaleZoom(CMeshFrame *e,F64 scale)
|
||||
{
|
||||
CTask *task=Fs;
|
||||
I64 x=ip.pos.x-task->pix_left-task->scroll_x-task->pix_width/2,
|
||||
y=ip.pos.y-task->pix_top-task->scroll_y-task->pix_height/2;
|
||||
I64 x=ms.pos.x-task->pix_left-task->scroll_x-task->pix_width/2,
|
||||
y=ms.pos.y-task->pix_top-task->scroll_y-task->pix_height/2;
|
||||
task->horz_scroll.pos*=scale;
|
||||
task->vert_scroll.pos*=scale;
|
||||
task->horz_scroll.pos+=scale*x-x;
|
||||
@@ -561,9 +561,9 @@ I64 *MeshSetW2S(CMeshFrame *e,CTask *task)
|
||||
U0 MeshCursorW(CMeshFrame *e,CTask *task,I64 *_x,I64 *_y,I64 *_z)
|
||||
{
|
||||
I64 x_shadow,y_shadow,z_shadow,
|
||||
xc=ip.pos.x-task->pix_left-task->scroll_x-e->cx,
|
||||
yc=ip.pos.y-task->pix_top-task->scroll_y-e->cy,zc=0,
|
||||
x=0,y=0,z=e->ip_z,
|
||||
xc=ms.pos.x-task->pix_left-task->scroll_x-e->cx,
|
||||
yc=ms.pos.y-task->pix_top-task->scroll_y-e->cy,zc=0,
|
||||
x=0,y=0,z=e->ms_z,
|
||||
i,x2,y2,z2;
|
||||
Mat4x4MulXYZ(e->w2s,&x,&y,&z); //scrn of Z vect
|
||||
|
||||
@@ -584,7 +584,7 @@ U0 MeshCursorW(CMeshFrame *e,CTask *task,I64 *_x,I64 *_y,I64 *_z)
|
||||
Mat4x4MulXYZ(e->s2w,&x,&y,&z);
|
||||
x=RoundI64(x,e->cur_snap);
|
||||
y=RoundI64(y,e->cur_snap);
|
||||
z=RoundI64(e->ip_z,e->cur_snap);
|
||||
z=RoundI64(e->ms_z,e->cur_snap);
|
||||
*_x=x; *_y=y; *_z=z;
|
||||
}
|
||||
|
||||
@@ -729,7 +729,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
//GR_Z_ALL is set to half of the Z-range which is an I32.
|
||||
dc->z=GR_Z_ALL;
|
||||
|
||||
//Light source set to input pointer (mouse).
|
||||
//Light source set to mouse.
|
||||
MeshCursorW(e,task,&x,&y,&z);
|
||||
dc->ls.x=x;
|
||||
dc->ls.y=y;
|
||||
@@ -785,7 +785,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
tmpv=tmpv->next;
|
||||
}
|
||||
|
||||
if (CtrlInside(c,ip.presnap.x,ip.presnap.y)||winmgr.show_menu) {
|
||||
if (CtrlInside(c,ms.presnap.x,ms.presnap.y)||winmgr.show_menu) {
|
||||
GridInit;
|
||||
task->win_inhibit=WIF_SELF_DOC;
|
||||
} else {
|
||||
@@ -828,7 +828,7 @@ U0 MeshInit(CMeshFrame *e,Bool flip_y)
|
||||
e->ed_mode='v';
|
||||
e->grid_on=TRUE;
|
||||
e->vertex_on=TRUE;
|
||||
e->ip_z=0;
|
||||
e->ms_z=0;
|
||||
e->thickness=25;
|
||||
e->closed=TRUE;
|
||||
e->view_scale=1.0;
|
||||
@@ -971,7 +971,7 @@ See $LK,"::/Demo/Graphics/SpritePlot3D.HC"$.
|
||||
$WW,0$*/
|
||||
CCtrl *c=CtrlFindUnique(Fs,CTRLT_VIEWING_ANGLES);
|
||||
CViewAngles *s,*old_s;
|
||||
I64 i,msg_code,sel_mode,a1,a2,make_tri_vertex_num=0,x,y,z;
|
||||
I64 i,msg_code,sel_mode,arg1,arg2,make_tri_vertex_num=0,x,y,z;
|
||||
CD3I32 p0a,p0b;
|
||||
CMeshEdVertex *va[3],*tmpv;
|
||||
Bool adjusting_z=FALSE,moving,save_and_exit;
|
||||
@@ -1077,33 +1077,34 @@ $WW,0$*/
|
||||
try {//In case of <CTRL-ALT-c>
|
||||
while (TRUE) {
|
||||
MeshUpdateMenu(&e);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|
|
||||
1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP);
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|
|
||||
1<<MSG_MS_L_UP|1<<MSG_MS_R_DOWN|1<<MSG_MS_R_UP);
|
||||
me_restart:
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
switch (a2.u8[0]) {
|
||||
switch (arg2.u8[0]) {
|
||||
case SC_DELETE:
|
||||
if (a2&SCF_SHIFT)
|
||||
if (arg2&SCF_SHIFT)
|
||||
goto me_clipboard_cut;
|
||||
else {
|
||||
if (MeshSelCnt(&e))
|
||||
MeshClipboardDel(&e);
|
||||
else if (e.ed_mode!='t')
|
||||
MeshVertexDel(&e,MeshVertexFindScrPt(&e,
|
||||
ip.presnap.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.presnap.y-Fs->pix_top-Fs->scroll_y));
|
||||
ms.presnap.x-Fs->pix_left-Fs->scroll_x,
|
||||
ms.presnap.y-Fs->pix_top-Fs->scroll_y));
|
||||
MeshVertexSelAll(&e,FALSE);
|
||||
MeshTriSelAll(&e,FALSE);
|
||||
make_tri_vertex_num=0;
|
||||
}
|
||||
break;
|
||||
case SC_INS:
|
||||
if (a2&SCF_CTRL)
|
||||
if (arg2&SCF_CTRL)
|
||||
goto me_clipboard_copy;
|
||||
else if (a2&SCF_SHIFT)
|
||||
else if (arg2&SCF_SHIFT)
|
||||
goto me_clipboard_paste;
|
||||
}
|
||||
break;
|
||||
@@ -1129,7 +1130,7 @@ me_restart:
|
||||
case 'p':
|
||||
e.thickness=PopUpGetI64("Thickness (%d):",e.thickness);
|
||||
case 'n':
|
||||
if (a1=='n' || a1=='p')
|
||||
if (arg1=='n' || arg1=='p')
|
||||
e.closed=TRUE;
|
||||
else
|
||||
e.closed=PopUpNoYes("Closed?\n");
|
||||
@@ -1143,9 +1144,9 @@ me_chain:
|
||||
case 'M':
|
||||
adjusting_z=FALSE;
|
||||
moving=FALSE;
|
||||
e.ed_mode=a1;
|
||||
e.ed_mode=arg1;
|
||||
make_tri_vertex_num=0;
|
||||
Snd(0);
|
||||
Snd;
|
||||
break;
|
||||
case 'T':
|
||||
MeshTransformSel(&e);
|
||||
@@ -1166,29 +1167,29 @@ me_chain:
|
||||
case 'a':
|
||||
case 'u':
|
||||
case 'o':
|
||||
if (a1=='a')
|
||||
if (arg1=='a')
|
||||
sel_mode=SEL_MESH_EQU;
|
||||
else if (a1=='u')
|
||||
else if (arg1=='u')
|
||||
sel_mode=SEL_MESH_AND;
|
||||
else
|
||||
sel_mode=SEL_MESH_OR;
|
||||
if ((msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|
|
||||
1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP))
|
||||
!=MSG_IP_L_DOWN) {
|
||||
if ((msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|
|
||||
1<<MSG_MS_L_UP|1<<MSG_MS_R_DOWN|1<<MSG_MS_R_UP))
|
||||
!=MSG_MS_L_DOWN) {
|
||||
Beep; Beep;
|
||||
goto me_restart;
|
||||
}
|
||||
e.x1=a1; e.y1=a2;
|
||||
e.x2=a1; e.y2=a2;
|
||||
e.x1=arg1; e.y1=arg2;
|
||||
e.x2=arg1; e.y2=arg2;
|
||||
e.sel_rect=TRUE;
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN|
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|
|
||||
1<<MSG_IP_R_UP);
|
||||
if (msg_code==MSG_IP_MOVE) {
|
||||
e.x2=a1; e.y2=a2;
|
||||
} else if (msg_code==MSG_IP_L_UP) {
|
||||
e.x2=a1; e.y2=a2;
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN|
|
||||
1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_DOWN|
|
||||
1<<MSG_MS_R_UP);
|
||||
if (msg_code==MSG_MS_MOVE) {
|
||||
e.x2=arg1; e.y2=arg2;
|
||||
} else if (msg_code==MSG_MS_L_UP) {
|
||||
e.x2=arg1; e.y2=arg2;
|
||||
break;
|
||||
} else {
|
||||
e.sel_rect=FALSE;
|
||||
@@ -1268,13 +1269,13 @@ me_clipboard_cut:
|
||||
if (moving)
|
||||
MeshVertexIgnoreSet(&e,TRUE);
|
||||
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(tmpv->p.z,e.cur_snap);
|
||||
ms.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ms.pos.y-Fs->pix_top-Fs->scroll_y)) {
|
||||
Noise(25,86,110);
|
||||
e.ms_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
} else {
|
||||
Beep; Beep;
|
||||
e.ip_z=0;
|
||||
e.ms_z=0;
|
||||
}
|
||||
MeshVertexIgnoreSet(&e,FALSE);
|
||||
if (moving) {
|
||||
@@ -1319,14 +1320,14 @@ me_clipboard_cut:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_MS_L_DOWN:
|
||||
switch (e.ed_mode) {
|
||||
case 'm':
|
||||
if (!moving) {
|
||||
if (!MeshSelCnt(&e) &&
|
||||
(tmpv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
(tmpv=MeshVertexFindScrPt(&e,arg1,arg2))) {
|
||||
tmpv->flags|=VF_SEL;
|
||||
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
e.ms_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
}
|
||||
if (MeshSelCnt(&e)) {
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
@@ -1341,9 +1342,9 @@ me_clipboard_cut:
|
||||
case 'M':
|
||||
if (!adjusting_z && !moving) {
|
||||
if (!MeshSelCnt(&e) &&
|
||||
(tmpv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
(tmpv=MeshVertexFindScrPt(&e,arg1,arg2))) {
|
||||
tmpv->flags|=VF_SEL;
|
||||
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
e.ms_z=RoundI64(tmpv->p.z,e.cur_snap);
|
||||
}
|
||||
if (MeshSelCnt(&e)) {
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
@@ -1353,23 +1354,23 @@ me_clipboard_cut:
|
||||
MeshP0Capture(&e);
|
||||
moving=TRUE;
|
||||
|
||||
p0b.x=ip.presnap.x;
|
||||
p0b.y=ip.presnap.y;
|
||||
p0b.z=e.ip_z;
|
||||
p0b.x=ms.presnap.x;
|
||||
p0b.y=ms.presnap.y;
|
||||
p0b.z=e.ms_z;
|
||||
adjusting_z=TRUE;
|
||||
Snd(ClampI64(3*e.ip_z+1500,0,15000));
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
case MSG_MS_L_UP:
|
||||
switch (e.ed_mode) {
|
||||
case 'n':
|
||||
case 'f':
|
||||
case 'p':
|
||||
case 'v':
|
||||
Noise(25,2000,8000);
|
||||
Noise(25,86,110);
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
e.cur_vertex=MeshVertexNew(&e,x,y,z);
|
||||
break;
|
||||
@@ -1377,10 +1378,10 @@ me_clipboard_cut:
|
||||
case 'M':
|
||||
if (moving) {
|
||||
if (adjusting_z) {
|
||||
e.ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
|
||||
e.ms_z=RoundI64(Sign(p0b.y-ms.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ms.presnap.x)+Sqr(p0b.y-ms.presnap.y))
|
||||
+p0b.z,e.cur_snap);
|
||||
Snd(0);
|
||||
Snd;
|
||||
adjusting_z=FALSE;
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
MeshP0Offset(&e,0,0,z-p0a.z);
|
||||
@@ -1394,14 +1395,14 @@ me_clipboard_cut:
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (tmpv=MeshVertexFindScrPt(&e,a1,a2)) {
|
||||
if (tmpv=MeshVertexFindScrPt(&e,arg1,arg2)) {
|
||||
for (i=0;i<make_tri_vertex_num;i++)
|
||||
if (va[i]==tmpv) {
|
||||
Beep; Beep;
|
||||
break;
|
||||
}
|
||||
if (i==make_tri_vertex_num) {
|
||||
Noise(25,2000,8000);
|
||||
Noise(25,86,110);
|
||||
va[make_tri_vertex_num++]=tmpv;
|
||||
tmpv->flags|=VF_SEL;
|
||||
if (make_tri_vertex_num==3) {
|
||||
@@ -1415,7 +1416,7 @@ me_clipboard_cut:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_R_DOWN:
|
||||
case MSG_MS_R_DOWN:
|
||||
if (!adjusting_z && e.ed_mode!='M' &&
|
||||
(e.chain_pred==e.vertex_head.last ||
|
||||
e.ed_mode!='n' && e.ed_mode!='f' && e.ed_mode!='p')) {
|
||||
@@ -1427,19 +1428,19 @@ me_clipboard_cut:
|
||||
p0a.z=z;
|
||||
MeshP0Capture(&e);
|
||||
}
|
||||
p0b.x=ip.presnap.x;
|
||||
p0b.y=ip.presnap.y;
|
||||
p0b.z=e.ip_z;
|
||||
p0b.x=ms.presnap.x;
|
||||
p0b.y=ms.presnap.y;
|
||||
p0b.z=e.ms_z;
|
||||
adjusting_z=TRUE;
|
||||
Snd(ClampI64(3*e.ip_z+1500,0,15000));
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
|
||||
}
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
case MSG_MS_R_UP:
|
||||
if (adjusting_z) {
|
||||
e.ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
|
||||
e.ms_z=RoundI64(Sign(p0b.y-ms.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ms.presnap.x)+Sqr(p0b.y-ms.presnap.y))
|
||||
+p0b.z,e.cur_snap);
|
||||
Snd(0);
|
||||
Snd;
|
||||
adjusting_z=FALSE;
|
||||
if (moving) {
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
@@ -1452,26 +1453,26 @@ me_clipboard_cut:
|
||||
} else if (e.ed_mode=='n') {
|
||||
if (e.chain_pred && e.chain_pred!=e.vertex_head.last)
|
||||
MeshPolygon(&e,e.chain_pred->next,e.vertex_head.last,FALSE);
|
||||
a1=e.ed_mode;
|
||||
arg1=e.ed_mode;
|
||||
goto me_chain;
|
||||
} else if (e.ed_mode=='f') {
|
||||
if (e.chain_pred && e.chain_pred!=e.vertex_head.last)
|
||||
MeshFence(&e);
|
||||
a1=e.ed_mode;
|
||||
arg1=e.ed_mode;
|
||||
goto me_chain;
|
||||
} else if (e.ed_mode=='p') {
|
||||
if (e.chain_pred && e.chain_pred!=e.vertex_head.last)
|
||||
MeshPrism(&e);
|
||||
a1=e.ed_mode;
|
||||
arg1=e.ed_mode;
|
||||
goto me_chain;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
case MSG_MS_MOVE:
|
||||
if (adjusting_z) {
|
||||
e.ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
|
||||
e.ms_z=RoundI64(Sign(p0b.y-ms.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ms.presnap.x)+Sqr(p0b.y-ms.presnap.y))
|
||||
+p0b.z,e.cur_snap);
|
||||
Snd(ClampI64(3*e.ip_z+1500,0,15000));
|
||||
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
|
||||
}
|
||||
if (moving) {
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
|
||||
@@ -15,20 +15,20 @@ I64 sprite_elem_base_sizes[SPT_NUM_TYPES]={
|
||||
sizeof(CSpritePt), //SPT_PT
|
||||
sizeof(CSpriteNumPtU8s), //SPT_POLYPT
|
||||
sizeof(CSpritePtPt), //SPT_LINE
|
||||
sizeof(CSpriteNumU8s), //SPT_POLYLINE
|
||||
sizeof(CSpriteNumU8s), //SPT_POLYLINE
|
||||
sizeof(CSpritePtPt), //SPT_RECT
|
||||
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
|
||||
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
|
||||
sizeof(CSpritePtRad), //SPT_CIRCLE
|
||||
sizeof(CSpritePtWHAng), //SPT_ELLIPSE
|
||||
sizeof(CSpritePtWHAng), //SPT_ELLIPSE
|
||||
sizeof(CSpritePtWHAngSides), //SPT_POLYGON
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2_CLOSED
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3_CLOSED
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2_CLOSED
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3_CLOSED
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL_NOT
|
||||
sizeof(CSpritePtWHU8s), //SPT_BITMAP
|
||||
sizeof(CSpriteMeshU8s), //SPT_MESH
|
||||
sizeof(CSpritePtWHU8s), //SPT_BITMAP
|
||||
sizeof(CSpriteMeshU8s), //SPT_MESH
|
||||
sizeof(CSpritePtMeshU8s), //SPT_SHIFTABLE_MESH
|
||||
sizeof(CSpritePtPt), //SPT_ARROW
|
||||
sizeof(CSpritePtStr), //SPT_TEXT
|
||||
|
||||
Reference in new issue
Block a user