templeos-info/public/Wb/Adam/Gr/SpriteEd.HC.HTML

1210 lines
117 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics/Sprite;Sprites&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>SpriteSetSettings</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>CSprite</span><span class=cF0> *head,</span><span class=cF9>I64</span><span class=cF0> elem_num,
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> x=0,</span><span class=cF9>I64</span><span class=cF0> y=0,</span><span class=cF9>CColorROPU32</span><span class=cF0> *_color=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> *_thick=</span><span class=cF3>NULL</span><span class=cF0>,
<a name="l5"></a> </span><span class=cF9>I64</span><span class=cF0> *_xx=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> *_yy=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l6"></a>{
<a name="l7"></a> </span><span class=cF9>CSprite</span><span class=cF0> *res=head-&gt;next;
<a name="l8"></a> </span><span class=cF9>I64</span><span class=cF0> thick=1,xx=0,yy=0;
<a name="l9"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (dc) </span><span class=cF5>DCRst</span><span class=cF0>(dc);
<a name="l11"></a> </span><span class=cF1>while</span><span class=cF0> (elem_num--&gt;0 &amp;&amp; res!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l12"></a> </span><span class=cF1>switch</span><span class=cF0> (res-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>) {
<a name="l13"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_COLOR</span><span class=cF0>:
<a name="l14"></a> color=res-&gt;c.color;
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (dc) dc-&gt;color=color;
<a name="l16"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l17"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_DITHER_COLOR</span><span class=cF0>:
<a name="l18"></a> color=res-&gt;d.dither_color.u8[0]|
<a name="l19"></a> res-&gt;d.dither_color.u8[1]&lt;&lt;</span><span class=cF3>COLORROP_BITS</span><span class=cF0>|</span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (dc) dc-&gt;color=color;
<a name="l21"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_THICK</span><span class=cF0>:
<a name="l23"></a> thick=res-&gt;t.thick;
<a name="l24"></a> </span><span class=cF1>if</span><span class=cF0> (dc) dc-&gt;thick=thick;
<a name="l25"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l26"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFT</span><span class=cF0>:
<a name="l27"></a> xx+=res-&gt;p.x1;
<a name="l28"></a> yy+=res-&gt;p.y1;
<a name="l29"></a> x+=res-&gt;p.x1;
<a name="l30"></a> y+=res-&gt;p.y1;
<a name="l31"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l32"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (dc) </span><span class=cF7>{</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DCSymmetry3Set</span><span class=cF7>(</span><span class=cF0>dc,res-&gt;pp.x1+x,res-&gt;pp.y1+y,0,
<a name="l35"></a> res-&gt;pp.x2+x,res-&gt;pp.y2+y,0,
<a name="l36"></a> res-&gt;pp.x2+x,res-&gt;pp.y2+y,1</span><span class=cF7>)</span><span class=cF0>)
<a name="l37"></a> dc-&gt;flags|=</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l38"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l39"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l41"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l42"></a> }
<a name="l43"></a> res=res-&gt;next;
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l45"></a> </span><span class=cF1>if</span><span class=cF0> (_color) *_color=color;
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (_thick) *_thick=thick;
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (_xx) *_xx=xx;
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (_yy) *_yy=yy;
<a name="l49"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l50"></a>}
<a name="l51"></a>
<a name="l52"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>SpritePolyPtPlot</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> *head,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0>)
<a name="l53"></a>{
<a name="l54"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_PT</span><span class=cF7>)</span><span class=cF0>);
<a name="l55"></a> tmpg-&gt;type=</span><span class=cF3>SPT_PT</span><span class=cF0>;
<a name="l56"></a> tmpg-&gt;p.x1=x;
<a name="l57"></a> tmpg-&gt;p.y1=y;
<a name="l58"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg,head-&gt;last);
<a name="l59"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l60"></a>}
<a name="l61"></a>
<a name="l62"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>Sprite2SpriteQue</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *elems)
<a name="l63"></a>{
<a name="l64"></a> </span><span class=cF9>I64</span><span class=cF0> s;
<a name="l65"></a> </span><span class=cF9>CSprite</span><span class=cF0> *res=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CSprite</span><span class=cF7>)</span><span class=cF0>),
<a name="l66"></a> *tmpg=elems-</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF0>),*tmpg1;
<a name="l67"></a> </span><span class=cF5>QueInit</span><span class=cF0>(res);
<a name="l68"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l69"></a> tmpg1=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemSize</span><span class=cF7>(</span><span class=cF0>tmpg</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CSprite</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>);
<a name="l70"></a> s=</span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l71"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&amp;tmpg1-&gt;</span><span class=cF1>start</span><span class=cF0>,&amp;tmpg-&gt;</span><span class=cF1>start</span><span class=cF0>,s);
<a name="l72"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg1,res-&gt;last);
<a name="l73"></a> tmpg(</span><span class=cF1>U8</span><span class=cF0> *)+=s;
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l76"></a>}
<a name="l77"></a>
<a name="l78"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>SpriteQue2Sprite</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> *head,</span><span class=cF9>I64</span><span class=cF0> *_size=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l79"></a>{
<a name="l80"></a> </span><span class=cF9>I64</span><span class=cF0> i,size=</span><span class=cFB>sprite_elem_base_sizes</span><span class=cF0>[</span><span class=cF3>SPT_END</span><span class=cF0>];
<a name="l81"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg=head-&gt;next;
<a name="l82"></a> </span><span class=cF1>U8</span><span class=cF0> *res,*dst;
<a name="l83"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l84"></a> size+=</span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l85"></a> tmpg=tmpg-&gt;next;
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (_size) *_size=size;
<a name="l88"></a> res=dst=</span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l89"></a> tmpg=head-&gt;next;
<a name="l90"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l91"></a> i=</span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l92"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(dst,&amp;tmpg-&gt;</span><span class=cF1>start</span><span class=cF0>,i);
<a name="l93"></a> dst+=i;
<a name="l94"></a> tmpg=tmpg-&gt;next;
<a name="l95"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l96"></a> *dst=</span><span class=cF3>SPT_END</span><span class=cF0>;
<a name="l97"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l98"></a>}
<a name="l99"></a>
<a name="l100"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce,</span><span class=cF9>CSprite</span><span class=cF0> *head)
<a name="l101"></a>{
<a name="l102"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb=doc_ce-&gt;bin_data;
<a name="l103"></a> </span><span class=cF9>I64</span><span class=cF0> size;
<a name="l104"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l105"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb-&gt;data);
<a name="l106"></a> tmpb-&gt;data=</span><span class=cF5>SpriteQue2Sprite</span><span class=cF0>(head,&amp;size);
<a name="l107"></a> tmpb-&gt;size=size;
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l109"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l110"></a>}
<a name="l111"></a>
<a name="l112"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpriteSetOrigin</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> *head,</span><span class=cF9>I64</span><span class=cF0> dx,</span><span class=cF9>I64</span><span class=cF0> dy,</span><span class=cF9>I64</span><span class=cF0> dz)
<a name="l113"></a>{
<a name="l114"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l115"></a> </span><span class=cF9>I32</span><span class=cF0> *ptr;
<a name="l116"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *p;
<a name="l117"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg=head-&gt;next;
<a name="l118"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpg-&gt;type,</span><span class=cF3>SPf_SEL</span><span class=cF7>)</span><span class=cF0>)
<a name="l120"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>) {
<a name="l121"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l122"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l123"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l124"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l125"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l126"></a> tmpg-&gt;pp.x2+=dx;
<a name="l127"></a> tmpg-&gt;pp.y2+=dy;
<a name="l128"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l129"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l130"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l131"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l132"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l133"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l134"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l135"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l136"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l137"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l138"></a> tmpg-&gt;p.x1+=dx;
<a name="l139"></a> tmpg-&gt;p.y1+=dy;
<a name="l140"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l141"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l142"></a> ptr=&amp;tmpg-&gt;nu.u;
<a name="l143"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l144"></a> ptr[i&lt;&lt;1]+=dx;
<a name="l145"></a> ptr[i&lt;&lt;1+1]+=dy;
<a name="l146"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l147"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l148"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l149"></a> tmpg-&gt;npu.x+=dx;
<a name="l150"></a> tmpg-&gt;npu.y+=dy;
<a name="l151"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l152"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l153"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l154"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l155"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l156"></a> p=&amp;tmpg-&gt;nu.u;
<a name="l157"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++,p++) </span><span class=cF7>{</span><span class=cF0>
<a name="l158"></a> p-&gt;x+=dx;
<a name="l159"></a> p-&gt;y+=dy;
<a name="l160"></a> p-&gt;z+=dz;
<a name="l161"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l162"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l163"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l164"></a> p=&amp;tmpg-&gt;mu.u;
<a name="l165"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;mu.vertex_cnt;i++,p++) </span><span class=cF7>{</span><span class=cF0>
<a name="l166"></a> p-&gt;x+=dx;
<a name="l167"></a> p-&gt;y+=dy;
<a name="l168"></a> p-&gt;z+=dz;
<a name="l169"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l170"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l171"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l172"></a> tmpg-&gt;pmu.x+=dx;
<a name="l173"></a> tmpg-&gt;pmu.y+=dy;
<a name="l174"></a> tmpg-&gt;pmu.z+=dz;
<a name="l175"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l176"></a> }
<a name="l177"></a> tmpg=tmpg-&gt;next;
<a name="l178"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l179"></a>}
<a name="l180"></a>
<a name="l181"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>SpriteTransformCircle</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *r,</span><span class=cF9>CSprite</span><span class=cF0> *tmpg)
<a name="l182"></a>{
<a name="l183"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z;
<a name="l184"></a> </span><span class=cF1>F64</span><span class=cF0> m1,arg1,m2,radius=tmpg-&gt;pr.radius&lt;&lt;16;
<a name="l185"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_ELLIPSE</span><span class=cF7>)</span><span class=cF0>);
<a name="l186"></a> tmpg1-&gt;type=</span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>;
<a name="l187"></a>
<a name="l188"></a> x=tmpg-&gt;pr.x1; y=tmpg-&gt;pr.y1; z=0;
<a name="l189"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l190"></a> tmpg1-&gt;pwha.x1=x;
<a name="l191"></a> tmpg1-&gt;pwha.y1=y;
<a name="l192"></a>
<a name="l193"></a> x=radius; y=0; z=0;
<a name="l194"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l195"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m1,&amp;arg1,x,y);
<a name="l196"></a>
<a name="l197"></a> x=0; y=radius; z=0;
<a name="l198"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l199"></a> m2=</span><span class=cF5>Sqrt</span><span class=cF0>(x*x+y*y);
<a name="l200"></a>
<a name="l201"></a> tmpg1-&gt;pwha.width =</span><span class=cF5>ToI64</span><span class=cF0>(m1)/0x10000;
<a name="l202"></a> tmpg1-&gt;pwha.height=</span><span class=cF5>ToI64</span><span class=cF0>(m2)/0x10000;
<a name="l203"></a> tmpg1-&gt;pwha.angle=-arg1;
<a name="l204"></a>
<a name="l205"></a> tmpg1-&gt;type|=tmpg-&gt;type&amp;</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l206"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l207"></a>}
<a name="l208"></a>
<a name="l209"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>SpriteTransformEllipse</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *r,</span><span class=cF9>CSprite</span><span class=cF0> *tmpg)
<a name="l210"></a>{
<a name="l211"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z;
<a name="l212"></a> </span><span class=cF1>F64</span><span class=cF0> m1,arg1,m2,arg2,s,c,x_radius=tmpg-&gt;pwha.width&lt;&lt;16,
<a name="l213"></a> y_radius=tmpg-&gt;pwha.height&lt;&lt;16;
<a name="l214"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF7>(</span><span class=cF0>tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF7>)</span><span class=cF0>);
<a name="l215"></a> tmpg1-&gt;type=tmpg-&gt;type;
<a name="l216"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>SPT_POLYGON</span><span class=cF0>)
<a name="l217"></a> tmpg1-&gt;pwhas.sides=tmpg-&gt;pwhas.sides;
<a name="l218"></a>
<a name="l219"></a> x=tmpg-&gt;pwha.x1; y=tmpg-&gt;pwha.y1; z=0;
<a name="l220"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l221"></a> tmpg1-&gt;pwha.x1=x;
<a name="l222"></a> tmpg1-&gt;pwha.y1=y;
<a name="l223"></a>
<a name="l224"></a> c=</span><span class=cF5>Cos</span><span class=cF0>(-tmpg-&gt;pwha.angle);
<a name="l225"></a> s=</span><span class=cF5>Sin</span><span class=cF0>(-tmpg-&gt;pwha.angle);
<a name="l226"></a>
<a name="l227"></a> x=x_radius*c;
<a name="l228"></a> y=x_radius*s;
<a name="l229"></a> z=0;
<a name="l230"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l231"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m1,&amp;arg1,x,y);
<a name="l232"></a>
<a name="l233"></a> x=-y_radius*s;
<a name="l234"></a> y=y_radius*c;
<a name="l235"></a> z=0;
<a name="l236"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l237"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m2,&amp;arg2,x,y);
<a name="l238"></a> m2*=</span><span class=cF5>Abs</span><span class=cF0>(</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>arg2-arg1</span><span class=cF7>)</span><span class=cF0>);
<a name="l239"></a>
<a name="l240"></a> tmpg1-&gt;pwha.width=</span><span class=cF5>ToI64</span><span class=cF0>(m1)/0x10000;
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg1-&gt;pwha.width&lt;1) tmpg1-&gt;pwha.width=1;
<a name="l242"></a> tmpg1-&gt;pwha.height=</span><span class=cF5>ToI64</span><span class=cF0>(m2)/0x10000;
<a name="l243"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg1-&gt;pwha.height&lt;1) tmpg1-&gt;pwha.height=1;
<a name="l244"></a> tmpg1-&gt;pwha.angle=-arg1;
<a name="l245"></a>
<a name="l246"></a> tmpg1-&gt;type|=tmpg-&gt;type&amp;</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l247"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l248"></a>}
<a name="l249"></a>
<a name="l250"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>SpriteTransformRect</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *r,</span><span class=cF9>CSprite</span><span class=cF0> *tmpg,</span><span class=cF1>F64</span><span class=cF0> theta)
<a name="l251"></a>{
<a name="l252"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z,w,h;
<a name="l253"></a> </span><span class=cF1>F64</span><span class=cF0> m1,arg1,m2,arg2,s,c,
<a name="l254"></a> x_radius=(tmpg-&gt;pp.x2-tmpg-&gt;pp.x1)&lt;&lt;16,
<a name="l255"></a> y_radius=(tmpg-&gt;pp.y2-tmpg-&gt;pp.y1)&lt;&lt;16;
<a name="l256"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF7>)</span><span class=cF0>);
<a name="l257"></a> tmpg1-&gt;type=</span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>;
<a name="l258"></a>
<a name="l259"></a> x=tmpg-&gt;pp.x1; y=tmpg-&gt;pp.y1; z=0;
<a name="l260"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l261"></a> tmpg1-&gt;ppa.x1=x;
<a name="l262"></a> tmpg1-&gt;ppa.y1=y;
<a name="l263"></a>
<a name="l264"></a> c=</span><span class=cF5>Cos</span><span class=cF0>(-theta);
<a name="l265"></a> s=</span><span class=cF5>Sin</span><span class=cF0>(-theta);
<a name="l266"></a>
<a name="l267"></a> x=x_radius*c;
<a name="l268"></a> y=x_radius*s;
<a name="l269"></a> z=0;
<a name="l270"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l271"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m1,&amp;arg1,x,y);
<a name="l272"></a>
<a name="l273"></a> x=-y_radius*s;
<a name="l274"></a> y=y_radius*c;
<a name="l275"></a> z=0;
<a name="l276"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l277"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m2,&amp;arg2,x,y);
<a name="l278"></a> m2*=</span><span class=cF5>Abs</span><span class=cF0>(</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>arg2-arg1</span><span class=cF7>)</span><span class=cF0>);
<a name="l279"></a>
<a name="l280"></a> w=</span><span class=cF5>ToI64</span><span class=cF0>(m1)/0x10000;
<a name="l281"></a> </span><span class=cF1>if</span><span class=cF0> (w&lt;1) w=1;
<a name="l282"></a> h=</span><span class=cF5>ToI64</span><span class=cF0>(m2)/0x10000;
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (h&lt;1) h=1;
<a name="l284"></a> tmpg1-&gt;ppa.x2=tmpg1-&gt;ppa.x1+w;
<a name="l285"></a> tmpg1-&gt;ppa.y2=tmpg1-&gt;ppa.y1+h;
<a name="l286"></a> tmpg1-&gt;ppa.angle=-arg1;
<a name="l287"></a>
<a name="l288"></a> tmpg1-&gt;type|=tmpg-&gt;type&amp;</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l289"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l290"></a>}
<a name="l291"></a>
<a name="l292"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>SpriteTransformBitMap</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *r,</span><span class=cF9>CSprite</span><span class=cF0> *tmpg)
<a name="l293"></a>{
<a name="l294"></a> </span><span class=cF9>CDC</span><span class=cF0> *img,*dc3;
<a name="l295"></a> </span><span class=cF1>U8</span><span class=cF0> *elems;
<a name="l296"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z,minx,maxx,miny,maxy,minz,maxz;
<a name="l297"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1;
<a name="l298"></a>
<a name="l299"></a> x=tmpg-&gt;pwhu.x1; y=tmpg-&gt;pwhu.y1; z=0;
<a name="l300"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l301"></a> minx=maxx=x;
<a name="l302"></a> miny=maxy=y;
<a name="l303"></a> minz=maxz=z;
<a name="l304"></a>
<a name="l305"></a> x=tmpg-&gt;pwhu.x1; y=tmpg-&gt;pwhu.y1+tmpg-&gt;pwhu.height; z=0;
<a name="l306"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l307"></a> </span><span class=cF1>if</span><span class=cF0> (x&lt;minx) minx=x;
<a name="l308"></a> </span><span class=cF1>if</span><span class=cF0> (x&gt;maxx) maxx=x;
<a name="l309"></a> </span><span class=cF1>if</span><span class=cF0> (y&lt;miny) miny=y;
<a name="l310"></a> </span><span class=cF1>if</span><span class=cF0> (y&gt;maxy) maxy=y;
<a name="l311"></a> </span><span class=cF1>if</span><span class=cF0> (z&lt;minz) minz=z;
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (z&gt;maxz) maxz=z;
<a name="l313"></a>
<a name="l314"></a> x=tmpg-&gt;pwhu.x1+tmpg-&gt;pwhu.width; y=tmpg-&gt;pwhu.y1; z=0;
<a name="l315"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l316"></a> </span><span class=cF1>if</span><span class=cF0> (x&lt;minx) minx=x;
<a name="l317"></a> </span><span class=cF1>if</span><span class=cF0> (x&gt;maxx) maxx=x;
<a name="l318"></a> </span><span class=cF1>if</span><span class=cF0> (y&lt;miny) miny=y;
<a name="l319"></a> </span><span class=cF1>if</span><span class=cF0> (y&gt;maxy) maxy=y;
<a name="l320"></a> </span><span class=cF1>if</span><span class=cF0> (z&lt;minz) minz=z;
<a name="l321"></a> </span><span class=cF1>if</span><span class=cF0> (z&gt;maxz) maxz=z;
<a name="l322"></a>
<a name="l323"></a> x=tmpg-&gt;pwhu.x1+tmpg-&gt;pwhu.width; y=tmpg-&gt;pwhu.y1+tmpg-&gt;pwhu.height; z=0;
<a name="l324"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l325"></a> </span><span class=cF1>if</span><span class=cF0> (x&lt;minx) minx=x;
<a name="l326"></a> </span><span class=cF1>if</span><span class=cF0> (x&gt;maxx) maxx=x;
<a name="l327"></a> </span><span class=cF1>if</span><span class=cF0> (y&lt;miny) miny=y;
<a name="l328"></a> </span><span class=cF1>if</span><span class=cF0> (y&gt;maxy) maxy=y;
<a name="l329"></a> </span><span class=cF1>if</span><span class=cF0> (z&lt;minz) minz=z;
<a name="l330"></a> </span><span class=cF1>if</span><span class=cF0> (z&gt;maxz) maxz=z;
<a name="l331"></a>
<a name="l332"></a> dc3=</span><span class=cF5>DCNew</span><span class=cF0>(maxx-minx+1,maxy-miny+1);
<a name="l333"></a>
<a name="l334"></a> img=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDC</span><span class=cF7>)</span><span class=cF0>);
<a name="l335"></a> img-&gt;width=tmpg-&gt;pwhu.width;
<a name="l336"></a> img-&gt;width_internal=(tmpg-&gt;pwhu.width+7)&amp;~7;
<a name="l337"></a> img-&gt;height=tmpg-&gt;pwhu.height;
<a name="l338"></a> img-&gt;body=&amp;tmpg-&gt;pwhu.u;
<a name="l339"></a> img-&gt;dc_signature=</span><span class=cF3>DCS_SIGNATURE_VAL</span><span class=cF0>;
<a name="l340"></a>
<a name="l341"></a> dc3-&gt;color=</span><span class=cF3>TRANSPARENT</span><span class=cF0>;
<a name="l342"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc3,0,0,maxx-minx+1,maxy-miny+1);
<a name="l343"></a>
<a name="l344"></a> </span><span class=cF5>Free</span><span class=cF0>(dc3-&gt;r);
<a name="l345"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc3,r);
<a name="l346"></a> dc3-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l347"></a>
<a name="l348"></a> dc3-&gt;x=tmpg-&gt;pwhu.x1-minx;
<a name="l349"></a> dc3-&gt;y=tmpg-&gt;pwhu.y1-miny;
<a name="l350"></a> dc3-&gt;z=-minz;
<a name="l351"></a> </span><span class=cF5>GrBlot3</span><span class=cF0>(dc3,0,0,0,img);
<a name="l352"></a> </span><span class=cF5>Free</span><span class=cF0>(img);
<a name="l353"></a>
<a name="l354"></a> elems=</span><span class=cF5>DC2Sprite</span><span class=cF0>(dc3);
<a name="l355"></a> dc3-&gt;r=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l356"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc3);
<a name="l357"></a> tmpg1=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CSprite</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>MSize</span><span class=cF7>(</span><span class=cF0>elems</span><span class=cF7>)</span><span class=cF0>);
<a name="l358"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(tmpg1</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CSprite</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>,elems,</span><span class=cF5>MSize</span><span class=cF7>(</span><span class=cF0>elems</span><span class=cF7>)</span><span class=cF0>);
<a name="l359"></a> tmpg1-&gt;type=tmpg-&gt;type;
<a name="l360"></a>
<a name="l361"></a> x=tmpg-&gt;pwhu.x1; y=tmpg-&gt;pwhu.y1; z=0;
<a name="l362"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l363"></a> tmpg1-&gt;pwhu.x1=x;
<a name="l364"></a> tmpg1-&gt;pwhu.y1=y;
<a name="l365"></a>
<a name="l366"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l367"></a>}
<a name="l368"></a>
<a name="l369"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpriteTransformQue</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> *head,</span><span class=cF9>I64</span><span class=cF0> *r)
<a name="l370"></a>{
<a name="l371"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,k,num,x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3;
<a name="l372"></a> </span><span class=cF9>I32</span><span class=cF0> *ptr;
<a name="l373"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *p;
<a name="l374"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg=head-&gt;next,head2,*tmpg1,*tmpg2,*tmpg3;
<a name="l375"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l376"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpg-&gt;type,</span><span class=cF3>SPf_SEL</span><span class=cF7>)</span><span class=cF0>)
<a name="l377"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>) {
<a name="l378"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_THICK</span><span class=cF0>:
<a name="l379"></a> tmpg-&gt;t.thick*=</span><span class=cF5>Sqrt</span><span class=cF0>(</span><span class=cF5>Mat4x4NormSqr65536</span><span class=cF7>(</span><span class=cF0>r</span><span class=cF7>)</span><span class=cF0>)/65536;
<a name="l380"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg-&gt;t.thick&lt;0) tmpg-&gt;t.thick=0;
<a name="l381"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l382"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l383"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l384"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l385"></a> x=tmpg-&gt;pp.x2; y=tmpg-&gt;pp.y2; z=0;
<a name="l386"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l387"></a> tmpg-&gt;pp.x2=x;
<a name="l388"></a> tmpg-&gt;pp.y2=y;
<a name="l389"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l390"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l391"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l392"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l393"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l394"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l395"></a> x=tmpg-&gt;p.x1; y=tmpg-&gt;p.y1; z=0;
<a name="l396"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l397"></a> tmpg-&gt;p.x1=x;
<a name="l398"></a> tmpg-&gt;p.y1=y;
<a name="l399"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l400"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l401"></a> tmpg1=</span><span class=cF5>SpriteTransformBitMap</span><span class=cF0>(r,tmpg);
<a name="l402"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg1,tmpg);
<a name="l403"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg);
<a name="l404"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l405"></a> tmpg=tmpg1;
<a name="l406"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l407"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l408"></a> tmpg1=</span><span class=cF5>SpriteTransformRect</span><span class=cF0>(r,tmpg,tmpg-&gt;ppa.angle);
<a name="l409"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg1,tmpg);
<a name="l410"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg);
<a name="l411"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l412"></a> tmpg=tmpg1;
<a name="l413"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l414"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l415"></a> tmpg1=</span><span class=cF5>SpriteTransformRect</span><span class=cF0>(r,tmpg,0);
<a name="l416"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg1,tmpg);
<a name="l417"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg);
<a name="l418"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l419"></a> tmpg=tmpg1;
<a name="l420"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l421"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l422"></a> tmpg1=</span><span class=cF5>SpriteTransformCircle</span><span class=cF0>(r,tmpg);
<a name="l423"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg1,tmpg);
<a name="l424"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg);
<a name="l425"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l426"></a> tmpg=tmpg1;
<a name="l427"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l428"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l429"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l430"></a> tmpg1=</span><span class=cF5>SpriteTransformEllipse</span><span class=cF0>(r,tmpg);
<a name="l431"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg1,tmpg);
<a name="l432"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg);
<a name="l433"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l434"></a> tmpg=tmpg1;
<a name="l435"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l436"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l437"></a> ptr=&amp;tmpg-&gt;nu.u;
<a name="l438"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l439"></a> x=ptr[i&lt;&lt;1]; y=ptr[i&lt;&lt;1+1]; z=0;
<a name="l440"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l441"></a> ptr[i&lt;&lt;1]=x;
<a name="l442"></a> ptr[i&lt;&lt;1+1]=y;
<a name="l443"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l444"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l445"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l446"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;head2);
<a name="l447"></a> x=tmpg-&gt;npu.x; y=tmpg-&gt;npu.y; z=0;
<a name="l448"></a> x1=x; y1=y; z1=z; </span><span class=cF2>//unrotated cur coordinates</span><span class=cF0>
<a name="l449"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l450"></a> ptr=&amp;tmpg-&gt;npu.u;
<a name="l451"></a> k=tmpg-&gt;npu.num*3;
<a name="l452"></a> x2=x; y2=y; z2=z; </span><span class=cF2>//rotated start coordinates</span><span class=cF0>
<a name="l453"></a> x3=x; y3=y; z3=z; </span><span class=cF2>//lag 1 rotated coordinates</span><span class=cF0>
<a name="l454"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;k;i+=3) </span><span class=cF7>{</span><span class=cF0>
<a name="l455"></a> j=</span><span class=cF5>BFieldExtU32</span><span class=cF0>(ptr,i,3);
<a name="l456"></a> x1+=</span><span class=cFB>gr_x_offsets</span><span class=cF0>[j];
<a name="l457"></a> y1+=</span><span class=cFB>gr_y_offsets</span><span class=cF0>[j];
<a name="l458"></a> x=x1; y=y1; z=z1;
<a name="l459"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l460"></a> </span><span class=cF5>Line</span><span class=cF0>(&amp;head2,x3-x2,y3-y2,0,x-x2,y-y2,0,&amp;</span><span class=cF5>SpritePolyPtPlot</span><span class=cF0>);
<a name="l461"></a> x3=x; y3=y; z3=z;
<a name="l462"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l463"></a>
<a name="l464"></a> num=0;
<a name="l465"></a> tmpg1=head2.next;
<a name="l466"></a> x3=0; y3=0; z3=0;
<a name="l467"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg1!=&amp;head2) </span><span class=cF7>{</span><span class=cF0>
<a name="l468"></a> tmpg2=tmpg1-&gt;next;
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg1-&gt;p.x1==x3 &amp;&amp; tmpg1-&gt;p.y1==y3) {
<a name="l470"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg1);
<a name="l471"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg1);
<a name="l472"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l473"></a> num++;
<a name="l474"></a> x3=tmpg1-&gt;p.x1;
<a name="l475"></a> y3=tmpg1-&gt;p.y1;
<a name="l476"></a> }
<a name="l477"></a> tmpg1=tmpg2;
<a name="l478"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l479"></a>
<a name="l480"></a> tmpg3=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_POLYPT</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF7>(</span><span class=cF0>num*3+7</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3);
<a name="l481"></a> tmpg3-&gt;npu.x=x2;
<a name="l482"></a> tmpg3-&gt;npu.y=y2;
<a name="l483"></a> ptr=&amp;tmpg3-&gt;npu.u;
<a name="l484"></a> x3=0;y3=0; z3=0;
<a name="l485"></a> i=0;
<a name="l486"></a> tmpg1=head2.next;
<a name="l487"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg1!=&amp;head2) </span><span class=cF7>{</span><span class=cF0>
<a name="l488"></a> tmpg2=tmpg1-&gt;next;
<a name="l489"></a> </span><span class=cF5>BFieldOrU32</span><span class=cF0>(ptr,i,
<a name="l490"></a> </span><span class=cFB>polypt_map</span><span class=cF0>[</span><span class=cF5>SignI64</span><span class=cF7>(</span><span class=cF0>tmpg1-&gt;p.x1-x3</span><span class=cF7>)</span><span class=cF0>+1+
<a name="l491"></a> 3*</span><span class=cF7>(</span><span class=cF5>SignI64</span><span class=cF0>(tmpg1-&gt;p.y1-y3)+1</span><span class=cF7>)</span><span class=cF0>]);
<a name="l492"></a> i+=3;
<a name="l493"></a> x3=tmpg1-&gt;p.x1;y3=tmpg1-&gt;p.y1;
<a name="l494"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg1);
<a name="l495"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg1);
<a name="l496"></a> tmpg1=tmpg2;
<a name="l497"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l498"></a> tmpg3-&gt;type=</span><span class=cF3>SPT_POLYPT</span><span class=cF0>|tmpg-&gt;type&amp;</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l499"></a> tmpg3-&gt;npu.num=num;
<a name="l500"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg3,tmpg);
<a name="l501"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpg);
<a name="l502"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l503"></a> tmpg=tmpg3;
<a name="l504"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l505"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l506"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l507"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l508"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l509"></a> p=&amp;tmpg-&gt;nu.u;
<a name="l510"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++,p++) </span><span class=cF7>{</span><span class=cF0>
<a name="l511"></a> x=p-&gt;x; y=p-&gt;y; z=p-&gt;z;
<a name="l512"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l513"></a> p-&gt;x=x;
<a name="l514"></a> p-&gt;y=y;
<a name="l515"></a> p-&gt;z=z;
<a name="l516"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l517"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l518"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l519"></a> x=tmpg-&gt;pmu.x; y=tmpg-&gt;pmu.y; z=tmpg-&gt;pmu.z;
<a name="l520"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l521"></a> tmpg-&gt;pmu.x=x;
<a name="l522"></a> tmpg-&gt;pmu.y=y;
<a name="l523"></a> tmpg-&gt;pmu.z=z;
<a name="l524"></a> p=&amp;tmpg-&gt;pmu.u;
<a name="l525"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;pmu.vertex_cnt;i++,p++) </span><span class=cF7>{</span><span class=cF0>
<a name="l526"></a> x=p-&gt;x; y=p-&gt;y; z=p-&gt;z;
<a name="l527"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l528"></a> p-&gt;x=x;
<a name="l529"></a> p-&gt;y=y;
<a name="l530"></a> p-&gt;z=z;
<a name="l531"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l532"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l533"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l534"></a> p=&amp;tmpg-&gt;mu.u;
<a name="l535"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;mu.vertex_cnt;i++,p++) </span><span class=cF7>{</span><span class=cF0>
<a name="l536"></a> x=p-&gt;x; y=p-&gt;y; z=p-&gt;z;
<a name="l537"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&amp;x,&amp;y,&amp;z);
<a name="l538"></a> p-&gt;x=x;
<a name="l539"></a> p-&gt;y=y;
<a name="l540"></a> p-&gt;z=z;
<a name="l541"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l542"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l543"></a> }
<a name="l544"></a> tmpg=tmpg-&gt;next;
<a name="l545"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l546"></a>}
<a name="l547"></a>
<a name="l548"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SpriteQueSelCnt</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> *head,</span><span class=cF1>Bool</span><span class=cF0> val=</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l549"></a>{
<a name="l550"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
<a name="l551"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg=head-&gt;next;
<a name="l552"></a> val=</span><span class=cF5>ToBool</span><span class=cF0>(val);
<a name="l553"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l554"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpg-&gt;type,</span><span class=cF3>SPf_SEL</span><span class=cF7>)</span><span class=cF0>==val)
<a name="l555"></a> res++;
<a name="l556"></a> tmpg=tmpg-&gt;next;
<a name="l557"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l558"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l559"></a>}
<a name="l560"></a>
<a name="l561"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> *head,</span><span class=cF1>Bool</span><span class=cF0> val=</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l562"></a>{
<a name="l563"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
<a name="l564"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg=head-&gt;next;
<a name="l565"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l566"></a> </span><span class=cF5>BEqu</span><span class=cF0>(&amp;tmpg-&gt;type,</span><span class=cF3>SPf_SEL</span><span class=cF0>,val);
<a name="l567"></a> res++;
<a name="l568"></a> tmpg=tmpg-&gt;next;
<a name="l569"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l570"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l571"></a>}
<a name="l572"></a>
<a name="l573"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>SpriteEdText</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> **_head,</span><span class=cF9>I64</span><span class=cF0> *_cur_elem_num)
<a name="l574"></a>{
<a name="l575"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l576"></a> </span><span class=cF9>CSprite</span><span class=cF0> *head=*_head;
<a name="l577"></a> </span><span class=cF1>U8</span><span class=cF0> *elems=</span><span class=cF5>SpriteQue2Sprite</span><span class=cF0>(head);
<a name="l578"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocNew</span><span class=cF0>,*doc2,*old_put=</span><span class=cF5>DocPut</span><span class=cF0>;
<a name="l579"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(doc-&gt;filename.name,</span><span class=cF6>&quot;AI:0x%X&quot;</span><span class=cF0>,doc);
<a name="l580"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;//$PURPLE$$TX+CX,\&quot;Sprite Edit as Text\&quot;$$FG$\n&quot;</span><span class=cF0>
<a name="l581"></a> </span><span class=cF6>&quot;//$LK+PU+CX,\&quot;Click for Help\&quot;,&quot;</span><span class=cF0>
<a name="l582"></a> </span><span class=cF6>&quot;A=\&quot;FI:::/Doc/SpriteEdText.DD.Z\&quot;$\n\n&quot;</span><span class=cF0>);
<a name="l583"></a> </span><span class=cF5>Sprite2Code</span><span class=cF0>(doc,elems);
<a name="l584"></a> </span><span class=cF5>Free</span><span class=cF0>(elems);
<a name="l585"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l586"></a> </span><span class=cF1>if</span><span class=cF0> (res=</span><span class=cF5>PopUpPrint</span><span class=cF7>(</span><span class=cF6>&quot;DocEd(0x%X,0x%X);&quot;</span><span class=cF0>,doc,0</span><span class=cF7>)</span><span class=cF0>) {
<a name="l587"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;put_doc=doc2=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l588"></a> </span><span class=cF6>&quot;$WW,1$&quot;</span><span class=cF0>;
<a name="l589"></a> </span><span class=cF1>if</span><span class=cF0> (elems=</span><span class=cF5>Code2Sprite</span><span class=cF7>(</span><span class=cF0>doc</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l590"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc2);
<a name="l591"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;put_doc=old_put;
<a name="l592"></a> </span><span class=cF5>QueDel</span><span class=cF0>(head);
<a name="l593"></a> </span><span class=cF5>Free</span><span class=cF0>(head);
<a name="l594"></a> head=</span><span class=cF5>Sprite2SpriteQue</span><span class=cF0>(elems);
<a name="l595"></a> </span><span class=cF5>Free</span><span class=cF0>(elems);
<a name="l596"></a> *_cur_elem_num=</span><span class=cF5>QueCnt</span><span class=cF0>(head); </span><span class=cF2>//TODO: Might want to improve this.</span><span class=cF0>
<a name="l597"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l598"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l599"></a> </span><span class=cF5>PopUpPrint</span><span class=cF0>(</span><span class=cF6>&quot;DocEd(0x%X,0x%X);&quot;</span><span class=cF0>,doc2,0);
<a name="l600"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc2);
<a name="l601"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;put_doc=old_put;
<a name="l602"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l603"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l604"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l605"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l606"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l607"></a> </span><span class=cF1>if</span><span class=cF0> (_head) *_head=head;
<a name="l608"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l609"></a>}
<a name="l610"></a>
<a name="l611"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SEL_UNSEL_ALL</span><span class=cF0> 0
<a name="l612"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SEL</span><span class=cF0> 2
<a name="l613"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SEL_RECTS</span><span class=cF0> 3
<a name="l614"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_UNSEL</span><span class=cF0> 4
<a name="l615"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0> 5
<a name="l616"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0> 6
<a name="l617"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0> 7
<a name="l618"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SEL</span><span class=cF0> 8
<a name="l619"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_TRANSFORM_SEL</span><span class=cF0> 9
<a name="l620"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SET_ORIGIN</span><span class=cF0> 10
<a name="l621"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SUB_ORIGIN</span><span class=cF0> 11
<a name="l622"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_TEXT_ED</span><span class=cF0> 12
<a name="l623"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_INS_CLIP</span><span class=cF0> 13
<a name="l624"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_MAIN_MENU</span><span class=cF0> 14
<a name="l625"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_EXIT</span><span class=cF0> 15
<a name="l626"></a>
<a name="l627"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrInit3</span><span class=cF0>()
<a name="l628"></a>{
<a name="l629"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_SPRITE_ED_MENU&quot;</span><span class=cF0>,</span><span class=cF6>&quot;Select/Unselect All\0 \0Select\0&quot;</span><span class=cF0>
<a name="l630"></a> </span><span class=cF6>&quot;Select Rects\0Unselect\0Unselect Rects\0Shift Points\0Shift Rects\0&quot;</span><span class=cF0>
<a name="l631"></a> </span><span class=cF6>&quot;Shift Selected\0Transform Selected\0Set Origin\0&quot;</span><span class=cF0>
<a name="l632"></a> </span><span class=cF6>&quot;Insert Shift SubOrigin\0Edit as Text\0Insert Clip\0Main Menu\0&quot;</span><span class=cF0>);
<a name="l633"></a>}
<a name="l634"></a></span><span class=cF5>GrInit3</span><span class=cF0>;
<a name="l635"></a>
<a name="l636"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUpSpriteEd</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0> **_head,</span><span class=cF9>I64</span><span class=cF0> *_cur_elem_num)
<a name="l637"></a>{
<a name="l638"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l639"></a> </span><span class=cF9>CTask</span><span class=cF0> *pu_task;
<a name="l640"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l641"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l642"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;$PURPLE$$TX+CX,\&quot;Sprite Edit Menu\&quot;$\n&quot;</span><span class=cF0>
<a name="l643"></a> </span><span class=cF6>&quot;$LK+PU+CX,\&quot;Click for Help\&quot;,A=\&quot;FI:::/Doc/SpriteEd.DD.Z\&quot;$\n\n&quot;</span><span class=cF0>
<a name="l644"></a> </span><span class=cF6>&quot;$LTBLUE$$MU-UL,\&quot;Select/Unselect All\&quot;,LE=SPED_SEL_UNSEL_ALL$\n&quot;</span><span class=cF0>
<a name="l645"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Select Elems\&quot;,LE=SPED_SEL$\n&quot;</span><span class=cF0>
<a name="l646"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Select Elems with Rects\&quot;,LE=SPED_SEL_RECTS$\n&quot;</span><span class=cF0>
<a name="l647"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Unsel Elems\&quot;,LE=SPED_UNSEL$\n&quot;</span><span class=cF0>
<a name="l648"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Unsel Elems with Rects\&quot;,LE=SPED_UNSEL_RECTS$\n\n&quot;</span><span class=cF0>
<a name="l649"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Shift Points\&quot;,LE=SPED_SHIFT_PTS$\n&quot;</span><span class=cF0>
<a name="l650"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Shift Points with Rects\&quot;,LE=SPED_SHIFT_RECTS$\n&quot;</span><span class=cF0>
<a name="l651"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Shift Selected Elems\&quot;,LE=SPED_SHIFT_SEL$\n&quot;</span><span class=cF0>
<a name="l652"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Transform Selected Elems\&quot;,LE=SPED_TRANSFORM_SEL$\n\n&quot;</span><span class=cF0>
<a name="l653"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Set Origin\&quot;,LE=SPED_SET_ORIGIN$\n&quot;</span><span class=cF0>
<a name="l654"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Insert Shift SubOrigin\&quot;,LE=SPED_SHIFT_SUB_ORIGIN$\n\n&quot;</span><span class=cF0>
<a name="l655"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Edit as Text\&quot;,LE=SPED_TEXT_ED$\n&quot;</span><span class=cF0>
<a name="l656"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Insert Clip Sprite's\&quot;,LE=SPED_INS_CLIP$\n\n&quot;</span><span class=cF0>
<a name="l657"></a> </span><span class=cF6>&quot;$PURPLE$$MU-UL,\&quot;+] Sprite Main Menu\&quot;,LE=SPED_MAIN_MENU$$LTBLUE$\n&quot;</span><span class=cF0>
<a name="l658"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Exit Sprite\&quot;,LE=SPED_EXIT$\n&quot;</span><span class=cF0>
<a name="l659"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Abort Sprite\&quot;,LE=DOCM_CANCEL$&quot;</span><span class=cF0>);
<a name="l660"></a> st=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;SpriteSideBarTask(0x%X,0x%X,0x%X);&quot;</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>,_head,_cur_elem_num);
<a name="l661"></a> </span><span class=cF5>PopUp</span><span class=cF0>(st,</span><span class=cF3>NULL</span><span class=cF0>,&amp;pu_task);
<a name="l662"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l663"></a> res=</span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l664"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>pu_task</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l665"></a> *_head=</span><span class=cF5>SpriteSideBar2SpriteQue</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF7>(</span><span class=cF0>pu_task</span><span class=cF7>)</span><span class=cF0>,*_head,_cur_elem_num);
<a name="l666"></a> </span><span class=cF5>Kill</span><span class=cF0>(pu_task);
<a name="l667"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l668"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l669"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l670"></a>}
<a name="l671"></a>
<a name="l672"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0> 0
<a name="l673"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0> 1
<a name="l674"></a>
<a name="l675"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPEDF_SEL</span><span class=cF0> 1
<a name="l676"></a>
<a name="l677"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CEdSprite</span><span class=cF0>
<a name="l678"></a>{
<a name="l679"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *next,*last;
<a name="l680"></a> </span><span class=cF9>CSprite</span><span class=cF0> *g;
<a name="l681"></a> </span><span class=cF9>I32</span><span class=cF0> type,num,flags,xx,yy,zz;
<a name="l682"></a> </span><span class=cF9>I32</span><span class=cF0> *x,*y,*z,*w,*h;
<a name="l683"></a>};
<a name="l684"></a>
<a name="l685"></a></span><span class=cF9>CEdSprite</span><span class=cF0> *</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> type,</span><span class=cF9>CSprite</span><span class=cF0> *tmpg)
<a name="l686"></a>{
<a name="l687"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *res=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdSprite</span><span class=cF7>)</span><span class=cF0>);
<a name="l688"></a> res-&gt;g=tmpg;
<a name="l689"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPF_SEL</span><span class=cF0>)
<a name="l690"></a> res-&gt;flags|=</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l691"></a> res-&gt;type=type;
<a name="l692"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l693"></a>}
<a name="l694"></a>
<a name="l695"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpritePtQueNew</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *elems,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>CEdSprite</span><span class=cF0> *head)
<a name="l696"></a>{
<a name="l697"></a> </span><span class=cF9>I64</span><span class=cF0> i,num=0;
<a name="l698"></a> </span><span class=cF9>I32</span><span class=cF0> *ptr;
<a name="l699"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *p;
<a name="l700"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *tmpes;
<a name="l701"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg=elems-</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CSprite</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF0>);
<a name="l702"></a> </span><span class=cF5>QueInit</span><span class=cF0>(head);
<a name="l703"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l704"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>) {
<a name="l705"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l706"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l707"></a> tmpes=</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>,tmpg);
<a name="l708"></a> tmpes-&gt;xx=x;
<a name="l709"></a> tmpes-&gt;yy=y;
<a name="l710"></a> tmpes-&gt;x=&amp;tmpg-&gt;pwha.x1;
<a name="l711"></a> tmpes-&gt;y=&amp;tmpg-&gt;pwha.y1;
<a name="l712"></a> tmpes-&gt;w=&amp;tmpg-&gt;pwha.width;
<a name="l713"></a> tmpes-&gt;h=&amp;tmpg-&gt;pwha.height;
<a name="l714"></a> tmpes-&gt;num=num;
<a name="l715"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpes,head-&gt;last);
<a name="l716"></a> </span><span class=cF1>goto</span><span class=cF0> pq_x1_y1;
<a name="l717"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l718"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l719"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l720"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l721"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l722"></a> tmpes=</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>,tmpg);
<a name="l723"></a> tmpes-&gt;xx=x;
<a name="l724"></a> tmpes-&gt;yy=y;
<a name="l725"></a> tmpes-&gt;x=&amp;tmpg-&gt;pp.x2;
<a name="l726"></a> tmpes-&gt;y=&amp;tmpg-&gt;pp.y2;
<a name="l727"></a> tmpes-&gt;num=num;
<a name="l728"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpes,head-&gt;last);
<a name="l729"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l730"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l731"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l732"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l733"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l734"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l735"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l736"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l737"></a>pq_x1_y1:
<a name="l738"></a> tmpes=</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>,tmpg);
<a name="l739"></a> tmpes-&gt;xx=x;
<a name="l740"></a> tmpes-&gt;yy=y;
<a name="l741"></a> tmpes-&gt;x=&amp;tmpg-&gt;p.x1;
<a name="l742"></a> tmpes-&gt;y=&amp;tmpg-&gt;p.y1;
<a name="l743"></a> tmpes-&gt;num=num;
<a name="l744"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpes,head-&gt;last);
<a name="l745"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l746"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFT</span><span class=cF0>:
<a name="l747"></a> x+=tmpg-&gt;p.x1;
<a name="l748"></a> y+=tmpg-&gt;p.y1;
<a name="l749"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l750"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l751"></a> ptr=&amp;tmpg-&gt;nu.u;
<a name="l752"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l753"></a> tmpes=</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>,tmpg);
<a name="l754"></a> tmpes-&gt;xx=x;
<a name="l755"></a> tmpes-&gt;yy=y;
<a name="l756"></a> tmpes-&gt;x=&amp;ptr[i&lt;&lt;1];
<a name="l757"></a> tmpes-&gt;y=&amp;ptr[i&lt;&lt;1+1];
<a name="l758"></a> tmpes-&gt;num=num;
<a name="l759"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpes,head-&gt;last);
<a name="l760"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l761"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l762"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l763"></a> tmpes=</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>,tmpg);
<a name="l764"></a> tmpes-&gt;xx=x;
<a name="l765"></a> tmpes-&gt;yy=y;
<a name="l766"></a> tmpes-&gt;x=&amp;tmpg-&gt;npu.x;
<a name="l767"></a> tmpes-&gt;y=&amp;tmpg-&gt;npu.y;
<a name="l768"></a> tmpes-&gt;num=num;
<a name="l769"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpes,head-&gt;last);
<a name="l770"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l771"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l772"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l773"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l774"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l775"></a> p=&amp;tmpg-&gt;nu.u;
<a name="l776"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l777"></a> tmpes=</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>,tmpg);
<a name="l778"></a> tmpes-&gt;xx=x;
<a name="l779"></a> tmpes-&gt;yy=y;
<a name="l780"></a> tmpes-&gt;x=&amp;p[i].x;
<a name="l781"></a> tmpes-&gt;y=&amp;p[i].y;
<a name="l782"></a> tmpes-&gt;z=&amp;p[i].z;
<a name="l783"></a> tmpes-&gt;num=num;
<a name="l784"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpes,head-&gt;last);
<a name="l785"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l786"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l787"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l788"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l789"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l790"></a> tmpes=</span><span class=cF5>EdSpriteNew</span><span class=cF0>(</span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>,tmpg);
<a name="l791"></a> tmpes-&gt;xx=x;
<a name="l792"></a> tmpes-&gt;yy=y;
<a name="l793"></a> tmpes-&gt;x=&amp;tmpg-&gt;pmu.x;
<a name="l794"></a> tmpes-&gt;y=&amp;tmpg-&gt;pmu.y;
<a name="l795"></a> tmpes-&gt;z=&amp;tmpg-&gt;pmu.z;
<a name="l796"></a> tmpes-&gt;num=num;
<a name="l797"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpes,head-&gt;last);
<a name="l798"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l799"></a> }
<a name="l800"></a> tmpg(</span><span class=cF1>U8</span><span class=cF0> *)+=</span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l801"></a> num++;
<a name="l802"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l803"></a>}
<a name="l804"></a>
<a name="l805"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>CEdSprite</span><span class=cF0> *head)
<a name="l806"></a>{
<a name="l807"></a> </span><span class=cF9>I64</span><span class=cF0> x,y;
<a name="l808"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *tmpes;
<a name="l809"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l810"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l811"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cF0>20</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l812"></a> tmpes=head-&gt;next;
<a name="l813"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes!=head) {
<a name="l814"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type) </span><span class=cF7>{</span><span class=cF0>
<a name="l815"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l816"></a> x=*tmpes-&gt;x+tmpes-&gt;xx;
<a name="l817"></a> y=*tmpes-&gt;y+tmpes-&gt;yy;
<a name="l818"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l819"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l820"></a> x=*tmpes-&gt;w+*tmpes-&gt;x+tmpes-&gt;xx;
<a name="l821"></a> y=*tmpes-&gt;h+*tmpes-&gt;y+tmpes-&gt;yy;
<a name="l822"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l823"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l824"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;flags&amp;</span><span class=cF3>SPEDF_SEL</span><span class=cF0>)
<a name="l825"></a> dc-&gt;color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l826"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l827"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l828"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,x-2,y-2,4,4);
<a name="l829"></a> dc-&gt;color=</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l830"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,x-1,y-1,2,2);
<a name="l831"></a> tmpes=tmpes-&gt;next;
<a name="l832"></a> }
<a name="l833"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l834"></a>}
<a name="l835"></a>
<a name="l836"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpriteCtrlPtsMove</span><span class=cF0>(</span><span class=cF9>CEdSprite</span><span class=cF0> *head,</span><span class=cF9>I64</span><span class=cF0> dx,</span><span class=cF9>I64</span><span class=cF0> dy)
<a name="l837"></a>{
<a name="l838"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *tmpes;
<a name="l839"></a> tmpes=head-&gt;next;
<a name="l840"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes!=head) </span><span class=cF7>{</span><span class=cF0>
<a name="l841"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;flags&amp;</span><span class=cF3>SPEDF_SEL</span><span class=cF0>)
<a name="l842"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type) {
<a name="l843"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l844"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;x) *tmpes-&gt;x+=dx;
<a name="l845"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;y) *tmpes-&gt;y+=dy;
<a name="l846"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l847"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l848"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;w) *tmpes-&gt;w+=dx;
<a name="l849"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;h) *tmpes-&gt;h+=dy;
<a name="l850"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l851"></a> }
<a name="l852"></a> tmpes=tmpes-&gt;next;
<a name="l853"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l854"></a>}
<a name="l855"></a>
<a name="l856"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>SpriteSelUnselShiftPts</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *elems,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> *_cur_elem_num,</span><span class=cF9>I64</span><span class=cF0> mode)
<a name="l857"></a>{
<a name="l858"></a> </span><span class=cF9>I64</span><span class=cF0> msg_code,arg1,arg2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
<a name="l859"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l860"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
<a name="l861"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> head,*tmpes,*best_es;
<a name="l862"></a>
<a name="l863"></a> </span><span class=cF5>SpritePtQueNew</span><span class=cF0>(elems,x,y,&amp;head);
<a name="l864"></a> cur_elem_num=0;
<a name="l865"></a> </span><span class=cF1>if</span><span class=cF0> (head.next!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l866"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l867"></a> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(dc,&amp;head); </span><span class=cF2>//has Refresh</span><span class=cF0>
<a name="l868"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code=</span><span class=cF5>ScanMsg</span><span class=cF7>(</span><span class=cF0>&amp;arg1,&amp;arg2,
<a name="l869"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l870"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>:
<a name="l871"></a> </span><span class=cF1>switch</span><span class=cF0> (mode) {
<a name="l872"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL</span><span class=cF0>:
<a name="l873"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL</span><span class=cF0>:
<a name="l874"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0>:
<a name="l875"></a> xx=arg1; yy=arg2;
<a name="l876"></a> best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
<a name="l877"></a> tmpes=head.next;
<a name="l878"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l879"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type) {
<a name="l880"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l881"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;x+tmpes-&gt;xx-xx)+
<a name="l882"></a> </span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;y+tmpes-&gt;yy-yy);
<a name="l883"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l884"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l885"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;x+*tmpes-&gt;w+tmpes-&gt;xx-xx)+
<a name="l886"></a> </span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;y+*tmpes-&gt;h+tmpes-&gt;yy-yy);
<a name="l887"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l888"></a> }
<a name="l889"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;best_dd) {
<a name="l890"></a> best_dd=dd;
<a name="l891"></a> best_es=tmpes;
<a name="l892"></a> }
<a name="l893"></a> tmpes=tmpes-&gt;next;
<a name="l894"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l895"></a> cur_elem_num=best_es-&gt;num;
<a name="l896"></a> </span><span class=cF1>if</span><span class=cF0> (mode!=</span><span class=cF3>SPED_UNSEL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l897"></a> best_es-&gt;flags|=</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l898"></a> best_es-&gt;g-&gt;type|=</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l899"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l900"></a> best_es-&gt;flags&amp;=~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l901"></a> best_es-&gt;g-&gt;type&amp;=~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l902"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l903"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l904"></a> </span><span class=cF1>start</span><span class=cF0>:
<a name="l905"></a> xx2=xx=arg1; yy2=yy=arg2;
<a name="l906"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l907"></a> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(dc,&amp;head);
<a name="l908"></a> dc-&gt;color=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>+</span><span class=cF3>WHITE</span><span class=cF0>&lt;&lt;16+</span><span class=cF3>RED</span><span class=cF0>;
<a name="l909"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc,xx,yy,xx2,yy2);
<a name="l910"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code=</span><span class=cF5>ScanMsg</span><span class=cF7>(</span><span class=cF0>&amp;arg1,&amp;arg2,
<a name="l911"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF7>)</span><span class=cF0>) {
<a name="l912"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l913"></a> xx2=arg1; yy2=arg2;
<a name="l914"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l915"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l916"></a> }
<a name="l917"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l918"></a> </span><span class=cF1>if</span><span class=cF0> (xx2&lt;xx) </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;xx,&amp;xx2);
<a name="l919"></a> </span><span class=cF1>if</span><span class=cF0> (yy2&lt;yy) </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;yy,&amp;yy2);
<a name="l920"></a> tmpes=head.next;
<a name="l921"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l922"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type) {
<a name="l923"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l924"></a> </span><span class=cF1>if</span><span class=cF0> (xx&lt;=*tmpes-&gt;x+tmpes-&gt;xx&lt;=xx2 &amp;&amp;
<a name="l925"></a> yy&lt;=*tmpes-&gt;y+tmpes-&gt;yy&lt;=yy2) </span><span class=cF7>{</span><span class=cF0>
<a name="l926"></a> </span><span class=cF1>if</span><span class=cF0> (mode!=</span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>) {
<a name="l927"></a> tmpes-&gt;flags|=</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l928"></a> tmpes-&gt;g-&gt;type|=</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l929"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l930"></a> tmpes-&gt;flags&amp;=~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l931"></a> tmpes-&gt;g-&gt;type&amp;=~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l932"></a> }
<a name="l933"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l934"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l935"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l936"></a> </span><span class=cF1>if</span><span class=cF0> (xx&lt;=*tmpes-&gt;x+*tmpes-&gt;w+tmpes-&gt;xx&lt;=xx2 &amp;&amp;
<a name="l937"></a> yy&lt;=*tmpes-&gt;y+*tmpes-&gt;h+tmpes-&gt;yy&lt;=yy2) </span><span class=cF7>{</span><span class=cF0>
<a name="l938"></a> </span><span class=cF1>if</span><span class=cF0> (mode!=</span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>) {
<a name="l939"></a> tmpes-&gt;flags|=</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l940"></a> tmpes-&gt;g-&gt;type|=</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l941"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l942"></a> tmpes-&gt;flags&amp;=~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l943"></a> tmpes-&gt;g-&gt;type&amp;=~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l944"></a> }
<a name="l945"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l946"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l947"></a> }
<a name="l948"></a> tmpes=tmpes-&gt;next;
<a name="l949"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l950"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL_RECTS</span><span class=cF0>:
<a name="l951"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>:
<a name="l952"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l953"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0>:
<a name="l954"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l955"></a> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(dc,&amp;head);
<a name="l956"></a> msg_code=</span><span class=cF5>ScanMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,
<a name="l957"></a> 1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>);
<a name="l958"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> gs_key;
<a name="l959"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>);
<a name="l960"></a> xx=arg1;yy=arg2;
<a name="l961"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l962"></a> </span><span class=cF1>end</span><span class=cF0>:
<a name="l963"></a> }
<a name="l964"></a> </span><span class=cF1>switch</span><span class=cF0> (mode) {
<a name="l965"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0>:
<a name="l966"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0>:
<a name="l967"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l968"></a> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(dc,&amp;head);
<a name="l969"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code=</span><span class=cF5>ScanMsg</span><span class=cF7>(</span><span class=cF0>&amp;arg1,&amp;arg2,
<a name="l970"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF7>)</span><span class=cF0>) {
<a name="l971"></a> </span><span class=cF5>SpriteCtrlPtsMove</span><span class=cF0>(&amp;head,arg1-xx,arg2-yy);
<a name="l972"></a> xx=arg1;yy=arg2;
<a name="l973"></a> }
<a name="l974"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l975"></a> tmpes=head.next;
<a name="l976"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes!=&amp;head) </span><span class=cF7>{</span><span class=cF0>
<a name="l977"></a> tmpes-&gt;flags&amp;=~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l978"></a> tmpes-&gt;g-&gt;type&amp;=~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l979"></a> tmpes=tmpes-&gt;next;
<a name="l980"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l981"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l982"></a> }
<a name="l983"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l984"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
<a name="l985"></a>gs_key:
<a name="l986"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1.u8[0]) {
<a name="l987"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l988"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l989"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l990"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>);
<a name="l991"></a> </span><span class=cF1>goto</span><span class=cF0> gs_done;
<a name="l992"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l993"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'P'</span><span class=cF0>:
<a name="l994"></a> mode&amp;=~1;
<a name="l995"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l996"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'r'</span><span class=cF0>:
<a name="l997"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'R'</span><span class=cF0>:
<a name="l998"></a> mode|=1;
<a name="l999"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1000"></a> }
<a name="l1001"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1002"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>:
<a name="l1003"></a> </span><span class=cF1>goto</span><span class=cF0> gs_done;
<a name="l1004"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1005"></a> }
<a name="l1006"></a>gs_done:
<a name="l1007"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&amp;head,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1008"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1009"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l1010"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l1011"></a> </span><span class=cF1>if</span><span class=cF0> (_cur_elem_num &amp;&amp; res)
<a name="l1012"></a> *_cur_elem_num=cur_elem_num;
<a name="l1013"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1014"></a>}
<a name="l1015"></a>
<a name="l1016"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SpriteEd</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,
<a name="l1017"></a> </span><span class=cF9>CSprite</span><span class=cF0> **_head,</span><span class=cF9>I64</span><span class=cF0> *_cur_elem_num)
<a name="l1018"></a>{
<a name="l1019"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2;
<a name="l1020"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb;
<a name="l1021"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
<a name="l1022"></a> </span><span class=cF9>I64</span><span class=cF0> i,r[16],msg_code,arg1,arg2,xx,yy,
<a name="l1023"></a> old_de_flags;
<a name="l1024"></a> </span><span class=cF9>CSprite</span><span class=cF0> *head2,*next,*last,*tmpg,*insert_pt;
<a name="l1025"></a>
<a name="l1026"></a> old_de_flags=doc_ce-&gt;de_flags;
<a name="l1027"></a> tmpb=doc_ce-&gt;bin_data;
<a name="l1028"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l1029"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1030"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1031"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>winmgr</span><span class=cF0>.fps&lt;10)
<a name="l1032"></a> doc_ce-&gt;de_flags|=</span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF0>;
<a name="l1033"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;task_title,</span><span class=cF6>&quot;Sprite Edit Menu&quot;</span><span class=cF0>);
<a name="l1034"></a> i=</span><span class=cF5>PopUpSpriteEd</span><span class=cF0>(_head,_cur_elem_num);
<a name="l1035"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1036"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=i&lt;</span><span class=cF3>SPED_EXIT</span><span class=cF0>) {
<a name="l1037"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;task_title,</span><span class=cF5>DefineSub</span><span class=cF7>(</span><span class=cF0>i,</span><span class=cF6>&quot;ST_SPRITE_ED_MENU&quot;</span><span class=cF7>)</span><span class=cF0>);
<a name="l1038"></a> </span><span class=cF1>switch</span><span class=cF0> (i) </span><span class=cF7>{</span><span class=cF0>
<a name="l1039"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL_UNSEL_ALL</span><span class=cF0>:
<a name="l1040"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueSelCnt</span><span class=cF7>(</span><span class=cF0>*_head</span><span class=cF7>)</span><span class=cF0>)
<a name="l1041"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head);
<a name="l1042"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1043"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1044"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1045"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SET_ORIGIN</span><span class=cF0>:
<a name="l1046"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head);
<a name="l1047"></a> doc_ce-&gt;de_flags=old_de_flags;
<a name="l1048"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l1049"></a> </span><span class=cF5>SpriteSetOrigin</span><span class=cF0>(*_head,x-arg1,y-arg2,0);
<a name="l1050"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1051"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1052"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1053"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SEL</span><span class=cF0>:
<a name="l1054"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueSelCnt</span><span class=cF7>(</span><span class=cF0>*_head</span><span class=cF7>)</span><span class=cF0>)
<a name="l1055"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head);
<a name="l1056"></a> doc_ce-&gt;de_flags=old_de_flags;
<a name="l1057"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>);
<a name="l1058"></a> xx=arg1; yy=arg2;
<a name="l1059"></a> </span><span class=cF1>do</span><span class=cF0> {
<a name="l1060"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,
<a name="l1061"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>+1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>);
<a name="l1062"></a> </span><span class=cF5>SpriteSetOrigin</span><span class=cF0>(*_head,arg1-xx,arg2-yy,0);
<a name="l1063"></a> xx=arg1; yy=arg2;
<a name="l1064"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1065"></a> } </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l1066"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueSelCnt</span><span class=cF7>(</span><span class=cF0>*_head,</span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1067"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1068"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1069"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL</span><span class=cF0>:
<a name="l1070"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL_RECTS</span><span class=cF0>:
<a name="l1071"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL</span><span class=cF0>:
<a name="l1072"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>:
<a name="l1073"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0>:
<a name="l1074"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0>:
<a name="l1075"></a> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF3>ARf_CSPRITE_PTS_RECTANGLES</span><span class=cF0>,
<a name="l1076"></a> </span><span class=cF6>&quot;You can switch between points\n&quot;</span><span class=cF0>
<a name="l1077"></a> </span><span class=cF6>&quot;and rectangles with '$GREEN$p$FG$' and '$GREEN$r$FG$'.\n&quot;</span><span class=cF0>
<a name="l1078"></a> </span><span class=cF6>&quot;Press '$GREEN$r$FG$' after one rectangle\n&quot;</span><span class=cF0>
<a name="l1079"></a> </span><span class=cF6>&quot;to OR another rectangle.\n&quot;</span><span class=cF0>);
<a name="l1080"></a> doc_ce-&gt;de_flags=old_de_flags;
<a name="l1081"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>SpriteSelUnselShiftPts</span><span class=cF7>(</span><span class=cF0>tmpb-&gt;data,x,y,_cur_elem_num,i</span><span class=cF7>)</span><span class=cF0>) {
<a name="l1082"></a> </span><span class=cF5>QueDel</span><span class=cF0>(*_head);
<a name="l1083"></a> </span><span class=cF5>Free</span><span class=cF0>(*_head);
<a name="l1084"></a> *_head=</span><span class=cF5>Sprite2SpriteQue</span><span class=cF0>(tmpb-&gt;data);
<a name="l1085"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l1086"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1087"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1088"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_TRANSFORM_SEL</span><span class=cF0>:
<a name="l1089"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueSelCnt</span><span class=cF7>(</span><span class=cF0>*_head</span><span class=cF7>)</span><span class=cF0>)
<a name="l1090"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head);
<a name="l1091"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpTransform</span><span class=cF7>(</span><span class=cF0>r</span><span class=cF7>)</span><span class=cF0>) {
<a name="l1092"></a> </span><span class=cF5>SpriteTransformQue</span><span class=cF0>(*_head,r);
<a name="l1093"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1094"></a> }
<a name="l1095"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueSelCnt</span><span class=cF7>(</span><span class=cF0>*_head,</span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1096"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(*_head,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1097"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1098"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SUB_ORIGIN</span><span class=cF0>:
<a name="l1099"></a> doc_ce-&gt;de_flags=old_de_flags;
<a name="l1100"></a> insert_pt=</span><span class=cF5>SpriteSetSettings</span><span class=cF0>(,*_head,*_cur_elem_num);
<a name="l1101"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_SHIFT</span><span class=cF7>)</span><span class=cF0>);
<a name="l1102"></a> tmpg-&gt;type=</span><span class=cF3>SPT_SHIFT</span><span class=cF0>;
<a name="l1103"></a> tmpg-&gt;p.x1=0;
<a name="l1104"></a> tmpg-&gt;p.y1=0;
<a name="l1105"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpg,insert_pt-&gt;last);
<a name="l1106"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>);
<a name="l1107"></a> xx=arg1; yy=arg2;
<a name="l1108"></a> </span><span class=cF1>do</span><span class=cF0> {
<a name="l1109"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,
<a name="l1110"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>+1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>);
<a name="l1111"></a> tmpg-&gt;p.x1=arg1-xx;
<a name="l1112"></a> tmpg-&gt;p.y1=arg2-yy;
<a name="l1113"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1114"></a> } </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l1115"></a> *_cur_elem_num+=1;
<a name="l1116"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1117"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_INS_CLIP</span><span class=cF0>:
<a name="l1118"></a> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF3>ARf_CSPRITE_INS_CLIP</span><span class=cF0>,
<a name="l1119"></a> </span><span class=cF6>&quot;You will probably want to shift around\n&quot;</span><span class=cF0>
<a name="l1120"></a> </span><span class=cF6>&quot;the location of element groups. Use\n&quot;</span><span class=cF0>
<a name="l1121"></a> </span><span class=cF6>&quot;'Insert shift sub-origin' after picking the\n&quot;</span><span class=cF0>
<a name="l1122"></a> </span><span class=cF6>&quot;element to insert before. Or,\n&quot;</span><span class=cF0>
<a name="l1123"></a> </span><span class=cF6>&quot;use 'shift points'.\n&quot;</span><span class=cF0>);
<a name="l1124"></a> insert_pt=</span><span class=cF5>SpriteSetSettings</span><span class=cF0>(,*_head,*_cur_elem_num);
<a name="l1125"></a> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(</span><span class=cFB>sys_clip_doc</span><span class=cF0>);
<a name="l1126"></a> doc_e2=</span><span class=cFB>sys_clip_doc</span><span class=cF0>-&gt;head.next;
<a name="l1127"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e2!=</span><span class=cFB>sys_clip_doc</span><span class=cF0>) {
<a name="l1128"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;type_u8==</span><span class=cF3>DOCT_SPRITE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1129"></a> head2=</span><span class=cF5>Sprite2SpriteQue</span><span class=cF0>(doc_e2-&gt;bin_data-&gt;data);
<a name="l1130"></a> </span><span class=cF1>if</span><span class=cF0> (head2-&gt;next!=head2) {
<a name="l1131"></a> tmpg=head2-&gt;next;
<a name="l1132"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg!=head2) </span><span class=cF7>{</span><span class=cF0>
<a name="l1133"></a> *_cur_elem_num+=1;
<a name="l1134"></a> tmpg=tmpg-&gt;next;
<a name="l1135"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1136"></a> next=head2-&gt;next;
<a name="l1137"></a> last=head2-&gt;last;
<a name="l1138"></a> insert_pt-&gt;last-&gt;next=next;
<a name="l1139"></a> next-&gt;last=insert_pt-&gt;last;
<a name="l1140"></a> insert_pt-&gt;last=last;
<a name="l1141"></a> last-&gt;next=insert_pt;
<a name="l1142"></a> }
<a name="l1143"></a> </span><span class=cF5>Free</span><span class=cF0>(head2);
<a name="l1144"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1145"></a> doc_e2=doc_e2-&gt;next;
<a name="l1146"></a> }
<a name="l1147"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l1148"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(</span><span class=cFB>sys_clip_doc</span><span class=cF0>);
<a name="l1149"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1150"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1151"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_TEXT_ED</span><span class=cF0>:
<a name="l1152"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>SpriteEdText</span><span class=cF7>(</span><span class=cF0>_head,_cur_elem_num</span><span class=cF7>)</span><span class=cF0>)
<a name="l1153"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc,doc_ce,*_head);
<a name="l1154"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1155"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1156"></a> }
<a name="l1157"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (i!=</span><span class=cF3>DOCM_CANCEL</span><span class=cF0> &amp;&amp; i!=</span><span class=cF3>SPED_EXIT</span><span class=cF0> &amp;&amp; i!=</span><span class=cF3>SPED_MAIN_MENU</span><span class=cF0>);
<a name="l1158"></a> doc_ce-&gt;de_flags=old_de_flags;
<a name="l1159"></a>
<a name="l1160"></a> </span><span class=cF1>switch</span><span class=cF0> (i) </span><span class=cF7>{</span><span class=cF0>
<a name="l1161"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCM_CANCEL</span><span class=cF0>: </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>SPE_ABORT</span><span class=cF0>;
<a name="l1162"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_EXIT</span><span class=cF0>: </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>SPE_EXIT</span><span class=cF0>;
<a name="l1163"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_MAIN_MENU</span><span class=cF0>: </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>SPE_CONT</span><span class=cF0>;
<a name="l1164"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1165"></a>}
<a name="l1166"></a>
<a name="l1167"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics/Sprite;Sprites;Graphics/Math/3D Transformation&quot;</span><span class=cF0>
<a name="l1168"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>SpriteTransform</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *elems,</span><span class=cF9>I64</span><span class=cF0> *r)
<a name="l1169"></a>{</span><span class=cF2>//Rotate Sprite using 4x4 matrix. Uses </span><a href="/Wb/Demo/Lectures/FixedPoint.HC.HTML#l1"><span class=cF4>fixed-point</span></a><span class=cF2>.</span><span class=cF0>
<a name="l1170"></a> </span><span class=cF1>U8</span><span class=cF0> *res;
<a name="l1171"></a> </span><span class=cF9>CSprite</span><span class=cF0> *head=</span><span class=cF5>Sprite2SpriteQue</span><span class=cF0>(elems);
<a name="l1172"></a> </span><span class=cF5>SpriteQueSelAll</span><span class=cF0>(head);
<a name="l1173"></a> </span><span class=cF5>SpriteTransformQue</span><span class=cF0>(head,r);
<a name="l1174"></a> res=</span><span class=cF5>SpriteQue2Sprite</span><span class=cF0>(head);
<a name="l1175"></a> </span><span class=cF5>QueDel</span><span class=cF0>(head);
<a name="l1176"></a> </span><span class=cF5>Free</span><span class=cF0>(head);
<a name="l1177"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1178"></a>}
</span></pre></body>
</html>