ZealOS/docs/System/Gr/SpriteEd.ZC.html
2021-12-11 06:10:58 -05:00

1458 lines
144 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<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, </span><span class=cF9>I64</span><span class=cF0> x=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> y=</span><span class=cFE>0</span><span class=cF0>,
<a name="l4"></a> </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>, </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="l5"></a>{
<a name="l6"></a> </span><span class=cF9>CSprite</span><span class=cF0> *res = head-&gt;next;
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> thick = </span><span class=cFE>1</span><span class=cF0>, xx = </span><span class=cFE>0</span><span class=cF0>, yy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l8"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l9"></a>
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (dc)
<a name="l11"></a> </span><span class=cF5>DCReset</span><span class=cF0>(dc);
<a name="l12"></a> </span><span class=cF1>while</span><span class=cF0> (elem_num-- &gt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; res != head)
<a name="l13"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l14"></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="l15"></a> {
<a name="l16"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_COLOR</span><span class=cF0>:
<a name="l17"></a> color = res-&gt;c.color;
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (dc)
<a name="l19"></a> dc-&gt;color = color;
<a name="l20"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l21"></a>
<a name="l22"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_DITHER_COLOR</span><span class=cF0>:
<a name="l23"></a> color = res-&gt;d.dither_color.u8[</span><span class=cFE>0</span><span class=cF0>] | res-&gt;d.dither_color.u8[</span><span class=cFE>1</span><span class=cF0>] &lt;&lt; </span><span class=cF3>COLORROP_BITS</span><span class=cF0> | </span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l24"></a> </span><span class=cF1>if</span><span class=cF0> (dc)
<a name="l25"></a> dc-&gt;color = color;
<a name="l26"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l27"></a>
<a name="l28"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_THICK</span><span class=cF0>:
<a name="l29"></a> thick = res-&gt;t.thick;
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (dc)
<a name="l31"></a> dc-&gt;thick = thick;
<a name="l32"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l33"></a>
<a name="l34"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFT</span><span class=cF0>:
<a name="l35"></a> xx += res-&gt;p.x1;
<a name="l36"></a> yy += res-&gt;p.y1;
<a name="l37"></a> x += res-&gt;p.x1;
<a name="l38"></a> y += res-&gt;p.y1;
<a name="l39"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l40"></a>
<a name="l41"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (dc)
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DCSymmetry3Set</span><span class=cF7>(</span><span class=cF0>dc,
<a name="l45"></a> res-&gt;pp.x1 + x, res-&gt;pp.y1 + y, </span><span class=cFE>0</span><span class=cF0>,
<a name="l46"></a> res-&gt;pp.x2 + x, res-&gt;pp.y2 + y, </span><span class=cFE>0</span><span class=cF0>,
<a name="l47"></a> res-&gt;pp.x2 + x, res-&gt;pp.y2 + y, </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>)
<a name="l48"></a> dc-&gt;flags |= </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l49"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l50"></a> dc-&gt;flags &amp;= ~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l51"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l52"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l53"></a> }
<a name="l54"></a> res = res-&gt;next;
<a name="l55"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (_color)
<a name="l57"></a> *_color = color;
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (_thick)
<a name="l59"></a> *_thick = thick;
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (_xx)
<a name="l61"></a> *_xx = xx;
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (_yy)
<a name="l63"></a> *_yy = yy;
<a name="l64"></a>
<a name="l65"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l66"></a>}
<a name="l67"></a>
<a name="l68"></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="l69"></a>{
<a name="l70"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQueuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_PT</span><span class=cF7>)</span><span class=cF0>);
<a name="l71"></a>
<a name="l72"></a>
<a name="l73"></a> tmpg-&gt;type = </span><span class=cF3>SPT_PT</span><span class=cF0>;
<a name="l74"></a> tmpg-&gt;p.x1 = x;
<a name="l75"></a> tmpg-&gt;p.y1 = y;
<a name="l76"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg, head-&gt;last);
<a name="l77"></a>
<a name="l78"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l79"></a>}
<a name="l80"></a>
<a name="l81"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>Sprite2SpriteQueue</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *elems)
<a name="l82"></a>{
<a name="l83"></a> </span><span class=cF9>I64</span><span class=cF0> s;
<a name="l84"></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>), *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="l85"></a>
<a name="l86"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(res);
<a name="l87"></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>)
<a name="l88"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l89"></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="l90"></a> s = </span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l91"></a> </span><span class=cF5>MemCopy</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="l92"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg1, res-&gt;last);
<a name="l93"></a> tmpg(</span><span class=cF1>U8</span><span class=cF0> *) += s;
<a name="l94"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l95"></a>
<a name="l96"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l97"></a>}
<a name="l98"></a>
<a name="l99"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>SpriteQueue2Sprite</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="l100"></a>{
<a name="l101"></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="l102"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg = head-&gt;next;
<a name="l103"></a> </span><span class=cF1>U8</span><span class=cF0> *res, *dst;
<a name="l104"></a>
<a name="l105"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg != head)
<a name="l106"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l107"></a> size += </span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l108"></a> tmpg = tmpg-&gt;next;
<a name="l109"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (_size)
<a name="l111"></a> *_size = size;
<a name="l112"></a> res = dst = </span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l113"></a> tmpg = head-&gt;next;
<a name="l114"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg != head)
<a name="l115"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l116"></a> i = </span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l117"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(dst, &amp;tmpg-&gt;</span><span class=cF1>start</span><span class=cF0>, i);
<a name="l118"></a> dst += i;
<a name="l119"></a> tmpg = tmpg-&gt;next;
<a name="l120"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l121"></a> *dst = </span><span class=cF3>SPT_END</span><span class=cF0>;
<a name="l122"></a>
<a name="l123"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l124"></a>}
<a name="l125"></a>
<a name="l126"></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="l127"></a>{
<a name="l128"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb = doc_ce-&gt;bin_data;
<a name="l129"></a> </span><span class=cF9>I64</span><span class=cF0> size;
<a name="l130"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l131"></a>
<a name="l132"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb-&gt;data);
<a name="l133"></a> tmpb-&gt;data = </span><span class=cF5>SpriteQueue2Sprite</span><span class=cF0>(head, &amp;size);
<a name="l134"></a> tmpb-&gt;size = size;
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l136"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l137"></a>}
<a name="l138"></a>
<a name="l139"></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="l140"></a>{
<a name="l141"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l142"></a> </span><span class=cF9>I32</span><span class=cF0> *ptr;
<a name="l143"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *p;
<a name="l144"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg = head-&gt;next;
<a name="l145"></a>
<a name="l146"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg != head)
<a name="l147"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l148"></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="l149"></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="l150"></a> {
<a name="l151"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l152"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l153"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l154"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l155"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l156"></a> tmpg-&gt;pp.x2 += dx;
<a name="l157"></a> tmpg-&gt;pp.y2 += dy;
<a name="l158"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l159"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l160"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l161"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l162"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l163"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l164"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l165"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l166"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l167"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l168"></a> tmpg-&gt;p.x1 += dx;
<a name="l169"></a> tmpg-&gt;p.y1 += dy;
<a name="l170"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l171"></a>
<a name="l172"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l173"></a> ptr = &amp;tmpg-&gt;nu.u;
<a name="l174"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;nu.num; i++)
<a name="l175"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l176"></a> ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0>] += dx;
<a name="l177"></a> ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>] += dy;
<a name="l178"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l179"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l180"></a>
<a name="l181"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l182"></a> tmpg-&gt;npu.x += dx;
<a name="l183"></a> tmpg-&gt;npu.y += dy;
<a name="l184"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l185"></a>
<a name="l186"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l187"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l188"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l189"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l190"></a> p = &amp;tmpg-&gt;nu.u;
<a name="l191"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;nu.num; i++, p++)
<a name="l192"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l193"></a> p-&gt;x += dx;
<a name="l194"></a> p-&gt;y += dy;
<a name="l195"></a> p-&gt;z += dz;
<a name="l196"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l197"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l198"></a>
<a name="l199"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l200"></a> p = &amp;tmpg-&gt;mu.u;
<a name="l201"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;mu.vertex_count; i++, p++)
<a name="l202"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l203"></a> p-&gt;x += dx;
<a name="l204"></a> p-&gt;y += dy;
<a name="l205"></a> p-&gt;z += dz;
<a name="l206"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l207"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l208"></a>
<a name="l209"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l210"></a> tmpg-&gt;pmu.x += dx;
<a name="l211"></a> tmpg-&gt;pmu.y += dy;
<a name="l212"></a> tmpg-&gt;pmu.z += dz;
<a name="l213"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l214"></a> }
<a name="l215"></a> tmpg = tmpg-&gt;next;
<a name="l216"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l217"></a>}
<a name="l218"></a>
<a name="l219"></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="l220"></a>{
<a name="l221"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, z;
<a name="l222"></a> </span><span class=cF1>F64</span><span class=cF0> m1, arg1, m2, radius = tmpg-&gt;pr.radius &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l223"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1 = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQueuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_ELLIPSE</span><span class=cF7>)</span><span class=cF0>);
<a name="l224"></a>
<a name="l225"></a> tmpg1-&gt;type = </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>;
<a name="l226"></a>
<a name="l227"></a> x = tmpg-&gt;pr.x1;
<a name="l228"></a> y = tmpg-&gt;pr.y1;
<a name="l229"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l230"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l231"></a> tmpg1-&gt;pwha.x1 = x;
<a name="l232"></a> tmpg1-&gt;pwha.y1 = y;
<a name="l233"></a>
<a name="l234"></a> x = radius;
<a name="l235"></a> y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l236"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l237"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l238"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m1, &amp;arg1, x, y);
<a name="l239"></a>
<a name="l240"></a> x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l241"></a> y = radius;
<a name="l242"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l243"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l244"></a> m2 = </span><span class=cF5>Sqrt</span><span class=cF0>(x * x + y * y);
<a name="l245"></a>
<a name="l246"></a> tmpg1-&gt;pwha.width = </span><span class=cF5>ToI64</span><span class=cF0>(m1) / </span><span class=cFE>0x10000</span><span class=cF0>;
<a name="l247"></a> tmpg1-&gt;pwha.height = </span><span class=cF5>ToI64</span><span class=cF0>(m2) / </span><span class=cFE>0x10000</span><span class=cF0>;
<a name="l248"></a> tmpg1-&gt;pwha.angle = -arg1;
<a name="l249"></a>
<a name="l250"></a> tmpg1-&gt;type |= tmpg-&gt;type &amp; </span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l251"></a>
<a name="l252"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l253"></a>}
<a name="l254"></a>
<a name="l255"></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="l256"></a>{
<a name="l257"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, z;
<a name="l258"></a> </span><span class=cF1>F64</span><span class=cF0> m1, arg1, m2, arg2, s, c, x_radius = tmpg-&gt;pwha.width &lt;&lt; </span><span class=cFE>16</span><span class=cF0>, y_radius = tmpg-&gt;pwha.height &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l259"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1 = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQueuedBaseSize</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="l260"></a>
<a name="l261"></a> tmpg1-&gt;type = tmpg-&gt;type;
<a name="l262"></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="l263"></a> tmpg1-&gt;pwhas.sides = tmpg-&gt;pwhas.sides;
<a name="l264"></a>
<a name="l265"></a> x = tmpg-&gt;pwha.x1;
<a name="l266"></a> y = tmpg-&gt;pwha.y1;
<a name="l267"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l268"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l269"></a> tmpg1-&gt;pwha.x1 = x;
<a name="l270"></a> tmpg1-&gt;pwha.y1 = y;
<a name="l271"></a>
<a name="l272"></a> c = </span><span class=cF5>Cos</span><span class=cF0>(-tmpg-&gt;pwha.angle);
<a name="l273"></a> s = </span><span class=cF5>Sin</span><span class=cF0>(-tmpg-&gt;pwha.angle);
<a name="l274"></a>
<a name="l275"></a> x = x_radius * c;
<a name="l276"></a> y = x_radius * s;
<a name="l277"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l278"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l279"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m1, &amp;arg1, x, y);
<a name="l280"></a>
<a name="l281"></a> x = -y_radius * s;
<a name="l282"></a> y = y_radius * c;
<a name="l283"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l284"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l285"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m2, &amp;arg2, x, y);
<a name="l286"></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="l287"></a>
<a name="l288"></a> tmpg1-&gt;pwha.width = </span><span class=cF5>ToI64</span><span class=cF0>(m1) / </span><span class=cFE>0x10000</span><span class=cF0>;
<a name="l289"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg1-&gt;pwha.width &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l290"></a> tmpg1-&gt;pwha.width = </span><span class=cFE>1</span><span class=cF0>;
<a name="l291"></a> tmpg1-&gt;pwha.height = </span><span class=cF5>ToI64</span><span class=cF0>(m2) / </span><span class=cFE>0x10000</span><span class=cF0>;
<a name="l292"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg1-&gt;pwha.height &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l293"></a> tmpg1-&gt;pwha.height = </span><span class=cFE>1</span><span class=cF0>;
<a name="l294"></a> tmpg1-&gt;pwha.angle = -arg1;
<a name="l295"></a>
<a name="l296"></a> tmpg1-&gt;type |= tmpg-&gt;type &amp; </span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l297"></a>
<a name="l298"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l299"></a>}
<a name="l300"></a>
<a name="l301"></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="l302"></a>{
<a name="l303"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, z, w, h;
<a name="l304"></a> </span><span class=cF1>F64</span><span class=cF0> m1, arg1, m2, arg2, s, c,
<a name="l305"></a> x_radius = (tmpg-&gt;pp.x2 - tmpg-&gt;pp.x1) &lt;&lt; </span><span class=cFE>16</span><span class=cF0>,
<a name="l306"></a> y_radius = (tmpg-&gt;pp.y2 - tmpg-&gt;pp.y1) &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l307"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1 = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQueuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF7>)</span><span class=cF0>);
<a name="l308"></a>
<a name="l309"></a> tmpg1-&gt;type = </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>;
<a name="l310"></a>
<a name="l311"></a> x = tmpg-&gt;pp.x1;
<a name="l312"></a> y = tmpg-&gt;pp.y1;
<a name="l313"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l314"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l315"></a> tmpg1-&gt;ppa.x1 = x;
<a name="l316"></a> tmpg1-&gt;ppa.y1 = y;
<a name="l317"></a>
<a name="l318"></a> c = </span><span class=cF5>Cos</span><span class=cF0>(-theta);
<a name="l319"></a> s = </span><span class=cF5>Sin</span><span class=cF0>(-theta);
<a name="l320"></a>
<a name="l321"></a> x = x_radius * c;
<a name="l322"></a> y = x_radius * s;
<a name="l323"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<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=cF5>R2P</span><span class=cF0>(&amp;m1, &amp;arg1, x, y);
<a name="l326"></a>
<a name="l327"></a> x = -y_radius * s;
<a name="l328"></a> y = y_radius * c;
<a name="l329"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l330"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l331"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m2, &amp;arg2, x, y);
<a name="l332"></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="l333"></a>
<a name="l334"></a> w = </span><span class=cF5>ToI64</span><span class=cF0>(m1) / </span><span class=cFE>0x10000</span><span class=cF0>;
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> (w &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l336"></a> w = </span><span class=cFE>1</span><span class=cF0>;
<a name="l337"></a> h = </span><span class=cF5>ToI64</span><span class=cF0>(m2) / </span><span class=cFE>0x10000</span><span class=cF0>;
<a name="l338"></a> </span><span class=cF1>if</span><span class=cF0> (h &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l339"></a> h = </span><span class=cFE>1</span><span class=cF0>;
<a name="l340"></a> tmpg1-&gt;ppa.x2 = tmpg1-&gt;ppa.x1 + w;
<a name="l341"></a> tmpg1-&gt;ppa.y2 = tmpg1-&gt;ppa.y1 + h;
<a name="l342"></a> tmpg1-&gt;ppa.angle = -arg1;
<a name="l343"></a>
<a name="l344"></a> tmpg1-&gt;type |= tmpg-&gt;type &amp; </span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l345"></a>
<a name="l346"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l347"></a>}
<a name="l348"></a>
<a name="l349"></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="l350"></a>{
<a name="l351"></a> </span><span class=cF9>CDC</span><span class=cF0> *img, *dc3;
<a name="l352"></a> </span><span class=cF1>U8</span><span class=cF0> *elems;
<a name="l353"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, z, minx, maxx, miny, maxy, minz, maxz;
<a name="l354"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg1;
<a name="l355"></a>
<a name="l356"></a> x = tmpg-&gt;pwhu.x1;
<a name="l357"></a> y = tmpg-&gt;pwhu.y1;
<a name="l358"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l359"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l360"></a> minx = maxx = x;
<a name="l361"></a> miny = maxy = y;
<a name="l362"></a> minz = maxz = z;
<a name="l363"></a>
<a name="l364"></a> x = tmpg-&gt;pwhu.x1;
<a name="l365"></a> y = tmpg-&gt;pwhu.y1 + tmpg-&gt;pwhu.height;
<a name="l366"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l367"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l368"></a> </span><span class=cF1>if</span><span class=cF0> (x &lt; minx) minx = x;
<a name="l369"></a> </span><span class=cF1>if</span><span class=cF0> (x &gt; maxx) maxx = x;
<a name="l370"></a> </span><span class=cF1>if</span><span class=cF0> (y &lt; miny) miny = y;
<a name="l371"></a> </span><span class=cF1>if</span><span class=cF0> (y &gt; maxy) maxy = y;
<a name="l372"></a> </span><span class=cF1>if</span><span class=cF0> (z &lt; minz) minz = z;
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (z &gt; maxz) maxz = z;
<a name="l374"></a>
<a name="l375"></a> x = tmpg-&gt;pwhu.x1 + tmpg-&gt;pwhu.width;
<a name="l376"></a> y = tmpg-&gt;pwhu.y1;
<a name="l377"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l378"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l379"></a> </span><span class=cF1>if</span><span class=cF0> (x &lt; minx) minx = x;
<a name="l380"></a> </span><span class=cF1>if</span><span class=cF0> (x &gt; maxx) maxx = x;
<a name="l381"></a> </span><span class=cF1>if</span><span class=cF0> (y &lt; miny) miny = y;
<a name="l382"></a> </span><span class=cF1>if</span><span class=cF0> (y &gt; maxy) maxy = y;
<a name="l383"></a> </span><span class=cF1>if</span><span class=cF0> (z &lt; minz) minz = z;
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (z &gt; maxz) maxz = z;
<a name="l385"></a>
<a name="l386"></a> x = tmpg-&gt;pwhu.x1 + tmpg-&gt;pwhu.width;
<a name="l387"></a> y = tmpg-&gt;pwhu.y1 + tmpg-&gt;pwhu.height;
<a name="l388"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l389"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l390"></a> </span><span class=cF1>if</span><span class=cF0> (x &lt; minx) minx = x;
<a name="l391"></a> </span><span class=cF1>if</span><span class=cF0> (x &gt; maxx) maxx = x;
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (y &lt; miny) miny = y;
<a name="l393"></a> </span><span class=cF1>if</span><span class=cF0> (y &gt; maxy) maxy = y;
<a name="l394"></a> </span><span class=cF1>if</span><span class=cF0> (z &lt; minz) minz = z;
<a name="l395"></a> </span><span class=cF1>if</span><span class=cF0> (z &gt; maxz) maxz = z;
<a name="l396"></a>
<a name="l397"></a> dc3 = </span><span class=cF5>DCNew</span><span class=cF0>(maxx - minx + </span><span class=cFE>1</span><span class=cF0>, maxy - miny + </span><span class=cFE>1</span><span class=cF0>);
<a name="l398"></a>
<a name="l399"></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="l400"></a> img-&gt;width = tmpg-&gt;pwhu.width;
<a name="l401"></a> img-&gt;width_internal = (tmpg-&gt;pwhu.width + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF0>;
<a name="l402"></a> img-&gt;height = tmpg-&gt;pwhu.height;
<a name="l403"></a> img-&gt;body = &amp;tmpg-&gt;pwhu.u;
<a name="l404"></a> img-&gt;dc_signature = </span><span class=cF3>DCS_SIGNATURE_VAL</span><span class=cF0>;
<a name="l405"></a>
<a name="l406"></a> dc3-&gt;color = </span><span class=cF3>TRANSPARENT</span><span class=cF0>;
<a name="l407"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc3, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, maxx - minx + </span><span class=cFE>1</span><span class=cF0>, maxy - miny + </span><span class=cFE>1</span><span class=cF0>);
<a name="l408"></a>
<a name="l409"></a> </span><span class=cF5>Free</span><span class=cF0>(dc3-&gt;r);
<a name="l410"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc3, r);
<a name="l411"></a> dc3-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l412"></a>
<a name="l413"></a> dc3-&gt;x = tmpg-&gt;pwhu.x1 - minx;
<a name="l414"></a> dc3-&gt;y = tmpg-&gt;pwhu.y1 - miny;
<a name="l415"></a> dc3-&gt;z = -minz;
<a name="l416"></a> </span><span class=cF5>GrBlot3</span><span class=cF0>(dc3, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, img);
<a name="l417"></a> </span><span class=cF5>Free</span><span class=cF0>(img);
<a name="l418"></a>
<a name="l419"></a> elems = </span><span class=cF5>DC2Sprite</span><span class=cF0>(dc3);
<a name="l420"></a> dc3-&gt;r = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l421"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc3);
<a name="l422"></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="l423"></a> </span><span class=cF5>MemCopy</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="l424"></a> tmpg1-&gt;type = tmpg-&gt;type;
<a name="l425"></a>
<a name="l426"></a> x = tmpg-&gt;pwhu.x1;
<a name="l427"></a> y = tmpg-&gt;pwhu.y1;
<a name="l428"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l429"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l430"></a> tmpg1-&gt;pwhu.x1 = x;
<a name="l431"></a> tmpg1-&gt;pwhu.y1 = y;
<a name="l432"></a>
<a name="l433"></a> </span><span class=cF1>return</span><span class=cF0> tmpg1;
<a name="l434"></a>}
<a name="l435"></a>
<a name="l436"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpriteTransformQueue</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="l437"></a>{
<a name="l438"></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="l439"></a> </span><span class=cF9>I32</span><span class=cF0> *ptr;
<a name="l440"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *p;
<a name="l441"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg = head-&gt;next, head2, *tmpg1, *tmpg2, *tmpg3;
<a name="l442"></a>
<a name="l443"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg != head)
<a name="l444"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l445"></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="l446"></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="l447"></a> {
<a name="l448"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_THICK</span><span class=cF0>:
<a name="l449"></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>) / </span><span class=cFE>65536</span><span class=cF0>;
<a name="l450"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg-&gt;t.thick &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l451"></a> tmpg-&gt;t.thick = </span><span class=cFE>0</span><span class=cF0>;
<a name="l452"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l453"></a>
<a name="l454"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l455"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l456"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l457"></a> x = tmpg-&gt;pp.x2;
<a name="l458"></a> y = tmpg-&gt;pp.y2;
<a name="l459"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l460"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l461"></a> tmpg-&gt;pp.x2 = x;
<a name="l462"></a> tmpg-&gt;pp.y2 = y;
<a name="l463"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l464"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l465"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l466"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l467"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l468"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l469"></a> x = tmpg-&gt;p.x1;
<a name="l470"></a> y = tmpg-&gt;p.y1;
<a name="l471"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l472"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l473"></a> tmpg-&gt;p.x1 = x;
<a name="l474"></a> tmpg-&gt;p.y1 = y;
<a name="l475"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l476"></a>
<a name="l477"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l478"></a> tmpg1 = </span><span class=cF5>SpriteTransformBitMap</span><span class=cF0>(r, tmpg);
<a name="l479"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg1, tmpg);
<a name="l480"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg);
<a name="l481"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l482"></a> tmpg = tmpg1;
<a name="l483"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l484"></a>
<a name="l485"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l486"></a> tmpg1 = </span><span class=cF5>SpriteTransformRect</span><span class=cF0>(r, tmpg, tmpg-&gt;ppa.angle);
<a name="l487"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg1, tmpg);
<a name="l488"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg);
<a name="l489"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l490"></a> tmpg = tmpg1;
<a name="l491"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l492"></a>
<a name="l493"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l494"></a> tmpg1 = </span><span class=cF5>SpriteTransformRect</span><span class=cF0>(r, tmpg, </span><span class=cFE>0</span><span class=cF0>);
<a name="l495"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg1, tmpg);
<a name="l496"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg);
<a name="l497"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l498"></a> tmpg = tmpg1;
<a name="l499"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l500"></a>
<a name="l501"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l502"></a> tmpg1 = </span><span class=cF5>SpriteTransformCircle</span><span class=cF0>(r, tmpg);
<a name="l503"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg1, tmpg);
<a name="l504"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg);
<a name="l505"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l506"></a> tmpg = tmpg1;
<a name="l507"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l508"></a>
<a name="l509"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l510"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l511"></a> tmpg1 = </span><span class=cF5>SpriteTransformEllipse</span><span class=cF0>(r, tmpg);
<a name="l512"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg1, tmpg);
<a name="l513"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg);
<a name="l514"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l515"></a> tmpg = tmpg1;
<a name="l516"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l517"></a>
<a name="l518"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l519"></a> ptr = &amp;tmpg-&gt;nu.u;
<a name="l520"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;nu.num; i++)
<a name="l521"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l522"></a> x = ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0>];
<a name="l523"></a> y = ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>];
<a name="l524"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l525"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l526"></a> ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0>] = x;
<a name="l527"></a> ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>] = y;
<a name="l528"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l529"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l530"></a>
<a name="l531"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l532"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;head2);
<a name="l533"></a> x = tmpg-&gt;npu.x;
<a name="l534"></a> y = tmpg-&gt;npu.y;
<a name="l535"></a> z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l536"></a> x1 = x; </span><span class=cF2>//</span><span class=cF0>
<a name="l537"></a> y1 = y; </span><span class=cF2>//</span><span class=cF0>
<a name="l538"></a> z1 = z; </span><span class=cF2>//unrotated cur coordinates</span><span class=cF0>
<a name="l539"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l540"></a> ptr = &amp;tmpg-&gt;npu.u;
<a name="l541"></a> k = tmpg-&gt;npu.num * </span><span class=cFE>3</span><span class=cF0>;
<a name="l542"></a> x2 = x; </span><span class=cF2>//</span><span class=cF0>
<a name="l543"></a> y2 = y; </span><span class=cF2>//</span><span class=cF0>
<a name="l544"></a> z2 = z; </span><span class=cF2>//rotated start coordinates</span><span class=cF0>
<a name="l545"></a>
<a name="l546"></a> x3 = x; </span><span class=cF2>//</span><span class=cF0>
<a name="l547"></a> y3 = y; </span><span class=cF2>//</span><span class=cF0>
<a name="l548"></a> z3 = z; </span><span class=cF2>//lag 1 rotated coordinates</span><span class=cF0>
<a name="l549"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; k; i += </span><span class=cFE>3</span><span class=cF0>)
<a name="l550"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l551"></a> j = </span><span class=cF5>BFieldExtU32</span><span class=cF0>(ptr, i, </span><span class=cFE>3</span><span class=cF0>);
<a name="l552"></a> x1 += </span><span class=cFB>gr_x_offsets</span><span class=cF0>[j];
<a name="l553"></a> y1 += </span><span class=cFB>gr_y_offsets</span><span class=cF0>[j];
<a name="l554"></a> x = x1;
<a name="l555"></a> y = y1;
<a name="l556"></a> z = z1;
<a name="l557"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l558"></a> </span><span class=cF5>Line</span><span class=cF0>(&amp;head2, x3 - x2, y3 - y2, </span><span class=cFE>0</span><span class=cF0>, x - x2, y - y2, </span><span class=cFE>0</span><span class=cF0>, &amp;</span><span class=cF5>SpritePolyPtPlot</span><span class=cF0>);
<a name="l559"></a> x3 = x;
<a name="l560"></a> y3 = y;
<a name="l561"></a> z3 = z;
<a name="l562"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l563"></a>
<a name="l564"></a> num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l565"></a> tmpg1 = head2.next;
<a name="l566"></a> x3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l567"></a> y3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l568"></a> z3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l569"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg1 != &amp;head2)
<a name="l570"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l571"></a> tmpg2 = tmpg1-&gt;next;
<a name="l572"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg1-&gt;p.x1 == x3 &amp;&amp; tmpg1-&gt;p.y1 == y3)
<a name="l573"></a> {
<a name="l574"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg1);
<a name="l575"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg1);
<a name="l576"></a> }
<a name="l577"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l578"></a> {
<a name="l579"></a> num++;
<a name="l580"></a> x3 = tmpg1-&gt;p.x1;
<a name="l581"></a> y3 = tmpg1-&gt;p.y1;
<a name="l582"></a> }
<a name="l583"></a> tmpg1 = tmpg2;
<a name="l584"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l585"></a>
<a name="l586"></a> tmpg3 = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQueuedBaseSize</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 * </span><span class=cFE>3</span><span class=cF0> + </span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>3</span><span class=cF0>);
<a name="l587"></a> tmpg3-&gt;npu.x = x2;
<a name="l588"></a> tmpg3-&gt;npu.y = y2;
<a name="l589"></a> ptr = &amp;tmpg3-&gt;npu.u;
<a name="l590"></a> x3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l591"></a> y3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l592"></a> z3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l593"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l594"></a> tmpg1 = head2.next;
<a name="l595"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg1 != &amp;head2)
<a name="l596"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l597"></a> tmpg2 = tmpg1-&gt;next;
<a name="l598"></a> </span><span class=cF5>BFieldOrU32</span><span class=cF0>(ptr, i, </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> + </span><span class=cFE>1</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF5>SignI64</span><span class=cF0>(tmpg1-&gt;p.y1 - y3) + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>]);
<a name="l599"></a> i += </span><span class=cFE>3</span><span class=cF0>;
<a name="l600"></a> x3 = tmpg1-&gt;p.x1;
<a name="l601"></a> y3 = tmpg1-&gt;p.y1;
<a name="l602"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg1);
<a name="l603"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg1);
<a name="l604"></a> tmpg1 = tmpg2;
<a name="l605"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l606"></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="l607"></a> tmpg3-&gt;npu.num = num;
<a name="l608"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg3, tmpg);
<a name="l609"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpg);
<a name="l610"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpg);
<a name="l611"></a> tmpg = tmpg3;
<a name="l612"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l613"></a>
<a name="l614"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l615"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l616"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l617"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l618"></a> p = &amp;tmpg-&gt;nu.u;
<a name="l619"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;nu.num; i++, p++)
<a name="l620"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l621"></a> x = p-&gt;x;
<a name="l622"></a> y = p-&gt;y;
<a name="l623"></a> z = p-&gt;z;
<a name="l624"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l625"></a> p-&gt;x = x;
<a name="l626"></a> p-&gt;y = y;
<a name="l627"></a> p-&gt;z = z;
<a name="l628"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l629"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l630"></a>
<a name="l631"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l632"></a> x = tmpg-&gt;pmu.x;
<a name="l633"></a> y = tmpg-&gt;pmu.y;
<a name="l634"></a> z = tmpg-&gt;pmu.z;
<a name="l635"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l636"></a> tmpg-&gt;pmu.x = x;
<a name="l637"></a> tmpg-&gt;pmu.y = y;
<a name="l638"></a> tmpg-&gt;pmu.z = z;
<a name="l639"></a> p = &amp;tmpg-&gt;pmu.u;
<a name="l640"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;pmu.vertex_count; i++, p++)
<a name="l641"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l642"></a> x = p-&gt;x;
<a name="l643"></a> y = p-&gt;y;
<a name="l644"></a> z = p-&gt;z;
<a name="l645"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l646"></a> p-&gt;x = x;
<a name="l647"></a> p-&gt;y = y;
<a name="l648"></a> p-&gt;z = z;
<a name="l649"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l650"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l651"></a>
<a name="l652"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l653"></a> p = &amp;tmpg-&gt;mu.u;
<a name="l654"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;mu.vertex_count; i++, p++)
<a name="l655"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l656"></a> x = p-&gt;x;
<a name="l657"></a> y = p-&gt;y;
<a name="l658"></a> z = p-&gt;z;
<a name="l659"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;x, &amp;y, &amp;z);
<a name="l660"></a> p-&gt;x = x;
<a name="l661"></a> p-&gt;y = y;
<a name="l662"></a> p-&gt;z = z;
<a name="l663"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l664"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l665"></a> }
<a name="l666"></a> tmpg = tmpg-&gt;next;
<a name="l667"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l668"></a>}
<a name="l669"></a>
<a name="l670"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SpriteQueueSelCount</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="l671"></a>{
<a name="l672"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l673"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg = head-&gt;next;
<a name="l674"></a>
<a name="l675"></a> val = </span><span class=cF5>ToBool</span><span class=cF0>(val);
<a name="l676"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg != head)
<a name="l677"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l678"></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="l679"></a> res++;
<a name="l680"></a> tmpg = tmpg-&gt;next;
<a name="l681"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l682"></a>
<a name="l683"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l684"></a>}
<a name="l685"></a>
<a name="l686"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SpriteQueueSelAll</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="l687"></a>{
<a name="l688"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l689"></a> </span><span class=cF9>CSprite</span><span class=cF0> *tmpg = head-&gt;next;
<a name="l690"></a>
<a name="l691"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg != head)
<a name="l692"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l693"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;tmpg-&gt;type, </span><span class=cF3>SPf_SEL</span><span class=cF0>, val);
<a name="l694"></a> res++;
<a name="l695"></a> tmpg = tmpg-&gt;next;
<a name="l696"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l697"></a>
<a name="l698"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l699"></a>}
<a name="l700"></a>
<a name="l701"></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="l702"></a>{
<a name="l703"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l704"></a> </span><span class=cF9>CSprite</span><span class=cF0> *head = *_head;
<a name="l705"></a> </span><span class=cF1>U8</span><span class=cF0> *elems = </span><span class=cF5>SpriteQueue2Sprite</span><span class=cF0>(head);
<a name="l706"></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="l707"></a>
<a name="l708"></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="l709"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,
<a name="l710"></a> </span><span class=cF6>&quot;//$PURPLE$$TX+CX,\&quot;Sprite Edit as Text\&quot;$$FG$\n&quot;</span><span class=cF0>
<a name="l711"></a> </span><span class=cF6>&quot;//$LK+PU+CX,\&quot;Click for Help\&quot;,&quot;</span><span class=cF0>
<a name="l712"></a> </span><span class=cF6>&quot;A=\&quot;FI:::/Doc/SpriteEdText.DD\&quot;$\n\n&quot;</span><span class=cF0>);
<a name="l713"></a> </span><span class=cF5>Sprite2Code</span><span class=cF0>(doc, elems);
<a name="l714"></a> </span><span class=cF5>Free</span><span class=cF0>(elems);
<a name="l715"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l716"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l717"></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, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
<a name="l718"></a> {
<a name="l719"></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="l720"></a> </span><span class=cF6>&quot;$WW,1$&quot;</span><span class=cF0>;
<a name="l721"></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>)
<a name="l722"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l723"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc2);
<a name="l724"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;put_doc = old_put;
<a name="l725"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(head);
<a name="l726"></a> </span><span class=cF5>Free</span><span class=cF0>(head);
<a name="l727"></a> head = </span><span class=cF5>Sprite2SpriteQueue</span><span class=cF0>(elems);
<a name="l728"></a> </span><span class=cF5>Free</span><span class=cF0>(elems);
<a name="l729"></a> *_cur_elem_num = </span><span class=cF5>QueueCount</span><span class=cF0>(head); </span><span class=cF2>//TODO: Might want to improve this.</span><span class=cF0>
<a name="l730"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l731"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l732"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l733"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l734"></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, </span><span class=cFE>0</span><span class=cF0>);
<a name="l735"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc2);
<a name="l736"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;put_doc = old_put;
<a name="l737"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l738"></a> }
<a name="l739"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l740"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l741"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l742"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l743"></a> </span><span class=cF1>if</span><span class=cF0> (_head)
<a name="l744"></a> *_head = head;
<a name="l745"></a>
<a name="l746"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l747"></a>}
<a name="l748"></a>
<a name="l749"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SEL_UNSEL_ALL</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>
<a name="l750"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SEL</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
<a name="l751"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SEL_RECTS</span><span class=cF0> </span><span class=cFE>3</span><span class=cF0>
<a name="l752"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_UNSEL</span><span class=cF0> </span><span class=cFE>4</span><span class=cF0>
<a name="l753"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0> </span><span class=cFE>5</span><span class=cF0>
<a name="l754"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0> </span><span class=cFE>6</span><span class=cF0>
<a name="l755"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0> </span><span class=cFE>7</span><span class=cF0>
<a name="l756"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SEL</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>
<a name="l757"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_TRANSFORM_SEL</span><span class=cF0> </span><span class=cFE>9</span><span class=cF0>
<a name="l758"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SET_ORIGIN</span><span class=cF0> </span><span class=cFE>10</span><span class=cF0>
<a name="l759"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SUB_ORIGIN</span><span class=cF0> </span><span class=cFE>11</span><span class=cF0>
<a name="l760"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_TEXT_ED</span><span class=cF0> </span><span class=cFE>12</span><span class=cF0>
<a name="l761"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_INS_CLIP</span><span class=cF0> </span><span class=cFE>13</span><span class=cF0>
<a name="l762"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_MAIN_MENU</span><span class=cF0> </span><span class=cFE>14</span><span class=cF0>
<a name="l763"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPED_EXIT</span><span class=cF0> </span><span class=cFE>15</span><span class=cF0>
<a name="l764"></a>
<a name="l765"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrInit3</span><span class=cF0>()
<a name="l766"></a>{
<a name="l767"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_SPRITE_ED_MENU&quot;</span><span class=cF0>,
<a name="l768"></a>
<a name="l769"></a> </span><span class=cF6>&quot;Select/Unselect All\0&quot;</span><span class=cF0>
<a name="l770"></a> </span><span class=cF6>&quot; \0&quot;</span><span class=cF0>
<a name="l771"></a> </span><span class=cF6>&quot;Select\0&quot;</span><span class=cF0>
<a name="l772"></a> </span><span class=cF6>&quot;Select Rects\0&quot;</span><span class=cF0>
<a name="l773"></a> </span><span class=cF6>&quot;Unselect\0&quot;</span><span class=cF0>
<a name="l774"></a> </span><span class=cF6>&quot;Unselect Rects\0&quot;</span><span class=cF0>
<a name="l775"></a> </span><span class=cF6>&quot;Shift Points\0&quot;</span><span class=cF0>
<a name="l776"></a> </span><span class=cF6>&quot;Shift Rects\0&quot;</span><span class=cF0>
<a name="l777"></a> </span><span class=cF6>&quot;Shift Selected\0&quot;</span><span class=cF0>
<a name="l778"></a> </span><span class=cF6>&quot;Transform Selected\0&quot;</span><span class=cF0>
<a name="l779"></a> </span><span class=cF6>&quot;Set Origin\0&quot;</span><span class=cF0>
<a name="l780"></a> </span><span class=cF6>&quot;Insert Shift SubOrigin\0&quot;</span><span class=cF0>
<a name="l781"></a> </span><span class=cF6>&quot;Edit as Text\0&quot;</span><span class=cF0>
<a name="l782"></a> </span><span class=cF6>&quot;Insert Clip\0&quot;</span><span class=cF0>
<a name="l783"></a> </span><span class=cF6>&quot;Main Menu\0&quot;</span><span class=cF0>);
<a name="l784"></a>}
<a name="l785"></a></span><span class=cF5>GrInit3</span><span class=cF0>;
<a name="l786"></a>
<a name="l787"></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="l788"></a>{
<a name="l789"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l790"></a> </span><span class=cF9>CTask</span><span class=cF0> *pu_task;
<a name="l791"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l792"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l793"></a>
<a name="l794"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,
<a name="l795"></a> </span><span class=cF6>&quot;$PURPLE$$TX+CX,\&quot;Sprite Edit Menu\&quot;$\n&quot;</span><span class=cF0>
<a name="l796"></a> </span><span class=cF6>&quot;$LK+PU+CX,\&quot;Click for Help\&quot;,A=\&quot;FI:::/Doc/SpriteEd.DD\&quot;$\n\n&quot;</span><span class=cF0>
<a name="l797"></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="l798"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Select Elems\&quot;,LE=SPED_SEL$\n&quot;</span><span class=cF0>
<a name="l799"></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="l800"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Unsel Elems\&quot;,LE=SPED_UNSEL$\n&quot;</span><span class=cF0>
<a name="l801"></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="l802"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Shift Points\&quot;,LE=SPED_SHIFT_PTS$\n&quot;</span><span class=cF0>
<a name="l803"></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="l804"></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="l805"></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="l806"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Set Origin\&quot;,LE=SPED_SET_ORIGIN$\n&quot;</span><span class=cF0>
<a name="l807"></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="l808"></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="l809"></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="l810"></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="l811"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Exit Sprite\&quot;,LE=SPED_EXIT$\n&quot;</span><span class=cF0>
<a name="l812"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Abort Sprite\&quot;,LE=DOCM_CANCEL$&quot;</span><span class=cF0>);
<a name="l813"></a>
<a name="l814"></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="l815"></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="l816"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l817"></a> res = </span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l818"></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>)
<a name="l819"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l820"></a> *_head = </span><span class=cF5>SpriteSideBar2SpriteQueue</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="l821"></a> </span><span class=cF5>Kill</span><span class=cF0>(pu_task);
<a name="l822"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l823"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l824"></a>
<a name="l825"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l826"></a>}
<a name="l827"></a>
<a name="l828"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>
<a name="l829"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
<a name="l830"></a>
<a name="l831"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPEDF_SEL</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
<a name="l832"></a>
<a name="l833"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CEdSprite</span><span class=cF0>
<a name="l834"></a>{
<a name="l835"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *next, *last;
<a name="l836"></a> </span><span class=cF9>CSprite</span><span class=cF0> *g;
<a name="l837"></a> </span><span class=cF9>I32</span><span class=cF0> type, num, flags, xx, yy, zz;
<a name="l838"></a> </span><span class=cF9>I32</span><span class=cF0> *x, *y, *z, *w, *h;
<a name="l839"></a>};
<a name="l840"></a>
<a name="l841"></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="l842"></a>{
<a name="l843"></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="l844"></a>
<a name="l845"></a> res-&gt;g = tmpg;
<a name="l846"></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="l847"></a> res-&gt;flags |= </span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l848"></a> res-&gt;type = type;
<a name="l849"></a>
<a name="l850"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l851"></a>}
<a name="l852"></a>
<a name="l853"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpritePtQueueNew</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="l854"></a>{
<a name="l855"></a> </span><span class=cF9>I64</span><span class=cF0> i, num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l856"></a> </span><span class=cF9>I32</span><span class=cF0> *ptr;
<a name="l857"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *p;
<a name="l858"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *tmpes;
<a name="l859"></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="l860"></a>
<a name="l861"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(head);
<a name="l862"></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>)
<a name="l863"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l864"></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="l865"></a> {
<a name="l866"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l867"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l868"></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="l869"></a> tmpes-&gt;xx = x;
<a name="l870"></a> tmpes-&gt;yy = y;
<a name="l871"></a> tmpes-&gt;x = &amp;tmpg-&gt;pwha.x1;
<a name="l872"></a> tmpes-&gt;y = &amp;tmpg-&gt;pwha.y1;
<a name="l873"></a> tmpes-&gt;w = &amp;tmpg-&gt;pwha.width;
<a name="l874"></a> tmpes-&gt;h = &amp;tmpg-&gt;pwha.height;
<a name="l875"></a> tmpes-&gt;num = num;
<a name="l876"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpes, head-&gt;last);
<a name="l877"></a> </span><span class=cF1>goto</span><span class=cF0> pq_x1_y1;
<a name="l878"></a>
<a name="l879"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l880"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l881"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l882"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l883"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l884"></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="l885"></a> tmpes-&gt;xx = x;
<a name="l886"></a> tmpes-&gt;yy = y;
<a name="l887"></a> tmpes-&gt;x = &amp;tmpg-&gt;pp.x2;
<a name="l888"></a> tmpes-&gt;y = &amp;tmpg-&gt;pp.y2;
<a name="l889"></a> tmpes-&gt;num = num;
<a name="l890"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpes, head-&gt;last);
<a name="l891"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l892"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l893"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l894"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l895"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l896"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l897"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l898"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l899"></a>pq_x1_y1:
<a name="l900"></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="l901"></a> tmpes-&gt;xx = x;
<a name="l902"></a> tmpes-&gt;yy = y;
<a name="l903"></a> tmpes-&gt;x = &amp;tmpg-&gt;p.x1;
<a name="l904"></a> tmpes-&gt;y = &amp;tmpg-&gt;p.y1;
<a name="l905"></a> tmpes-&gt;num = num;
<a name="l906"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpes, head-&gt;last);
<a name="l907"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l908"></a>
<a name="l909"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFT</span><span class=cF0>:
<a name="l910"></a> x += tmpg-&gt;p.x1;
<a name="l911"></a> y += tmpg-&gt;p.y1;
<a name="l912"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l913"></a>
<a name="l914"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l915"></a> ptr = &amp;tmpg-&gt;nu.u;
<a name="l916"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;nu.num; i++)
<a name="l917"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l918"></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="l919"></a> tmpes-&gt;xx = x;
<a name="l920"></a> tmpes-&gt;yy = y;
<a name="l921"></a> tmpes-&gt;x = &amp;ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0>];
<a name="l922"></a> tmpes-&gt;y = &amp;ptr[i &lt;&lt; </span><span class=cFE>1</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>];
<a name="l923"></a> tmpes-&gt;num = num;
<a name="l924"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpes, head-&gt;last);
<a name="l925"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l926"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l927"></a>
<a name="l928"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l929"></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="l930"></a> tmpes-&gt;xx = x;
<a name="l931"></a> tmpes-&gt;yy = y;
<a name="l932"></a> tmpes-&gt;x = &amp;tmpg-&gt;npu.x;
<a name="l933"></a> tmpes-&gt;y = &amp;tmpg-&gt;npu.y;
<a name="l934"></a> tmpes-&gt;num = num;
<a name="l935"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpes, head-&gt;last);
<a name="l936"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l937"></a>
<a name="l938"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l939"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l940"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l941"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l942"></a> p = &amp;tmpg-&gt;nu.u;
<a name="l943"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; tmpg-&gt;nu.num; i++)
<a name="l944"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l945"></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="l946"></a> tmpes-&gt;xx = x;
<a name="l947"></a> tmpes-&gt;yy = y;
<a name="l948"></a> tmpes-&gt;x = &amp;p[i].x;
<a name="l949"></a> tmpes-&gt;y = &amp;p[i].y;
<a name="l950"></a> tmpes-&gt;z = &amp;p[i].z;
<a name="l951"></a> tmpes-&gt;num = num;
<a name="l952"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpes, head-&gt;last);
<a name="l953"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l954"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l955"></a>
<a name="l956"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l957"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l958"></a>
<a name="l959"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l960"></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="l961"></a> tmpes-&gt;xx = x;
<a name="l962"></a> tmpes-&gt;yy = y;
<a name="l963"></a> tmpes-&gt;x = &amp;tmpg-&gt;pmu.x;
<a name="l964"></a> tmpes-&gt;y = &amp;tmpg-&gt;pmu.y;
<a name="l965"></a> tmpes-&gt;z = &amp;tmpg-&gt;pmu.z;
<a name="l966"></a> tmpes-&gt;num = num;
<a name="l967"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpes, head-&gt;last);
<a name="l968"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l969"></a> }
<a name="l970"></a> tmpg(</span><span class=cF1>U8</span><span class=cF0> *) += </span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l971"></a> num++;
<a name="l972"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l973"></a>}
<a name="l974"></a>
<a name="l975"></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="l976"></a>{
<a name="l977"></a> </span><span class=cF9>I64</span><span class=cF0> x, y;
<a name="l978"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *tmpes;
<a name="l979"></a>
<a name="l980"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l981"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l982"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>20</span><span class=cF7>)</span><span class=cF0>)
<a name="l983"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l984"></a> tmpes = head-&gt;next;
<a name="l985"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes != head)
<a name="l986"></a> {
<a name="l987"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type)
<a name="l988"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l989"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l990"></a> x = *tmpes-&gt;x + tmpes-&gt;xx;
<a name="l991"></a> y = *tmpes-&gt;y + tmpes-&gt;yy;
<a name="l992"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l993"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l994"></a> x = *tmpes-&gt;w + *tmpes-&gt;x + tmpes-&gt;xx;
<a name="l995"></a> y = *tmpes-&gt;h + *tmpes-&gt;y + tmpes-&gt;yy;
<a name="l996"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l997"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l998"></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="l999"></a> dc-&gt;color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l1000"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1001"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l1002"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, x - </span><span class=cFE>2</span><span class=cF0>, y - </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
<a name="l1003"></a> dc-&gt;color = </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l1004"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, x - </span><span class=cFE>1</span><span class=cF0>, y - </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0>);
<a name="l1005"></a> tmpes = tmpes-&gt;next;
<a name="l1006"></a> }
<a name="l1007"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1008"></a>}
<a name="l1009"></a>
<a name="l1010"></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="l1011"></a>{
<a name="l1012"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> *tmpes;
<a name="l1013"></a>
<a name="l1014"></a> tmpes = head-&gt;next;
<a name="l1015"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes != head)
<a name="l1016"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1017"></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="l1018"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type)
<a name="l1019"></a> {
<a name="l1020"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l1021"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;x)
<a name="l1022"></a> *tmpes-&gt;x += dx;
<a name="l1023"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;y)
<a name="l1024"></a> *tmpes-&gt;y += dy;
<a name="l1025"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1026"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l1027"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;w)
<a name="l1028"></a> *tmpes-&gt;w += dx;
<a name="l1029"></a> </span><span class=cF1>if</span><span class=cF0> (tmpes-&gt;h)
<a name="l1030"></a> *tmpes-&gt;h += dy;
<a name="l1031"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1032"></a> }
<a name="l1033"></a> tmpes = tmpes-&gt;next;
<a name="l1034"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1035"></a>}
<a name="l1036"></a>
<a name="l1037"></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="l1038"></a>{
<a name="l1039"></a> </span><span class=cF9>I64</span><span class=cF0> message_code, arg1, arg2, xx, yy, xx2, yy2, dd, best_dd, cur_elem_num;
<a name="l1040"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1041"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>;
<a name="l1042"></a> </span><span class=cF9>CEdSprite</span><span class=cF0> head, *tmpes, *best_es;
<a name="l1043"></a>
<a name="l1044"></a> </span><span class=cF5>SpritePtQueueNew</span><span class=cF0>(elems, x, y, &amp;head);
<a name="l1045"></a> cur_elem_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1046"></a> </span><span class=cF1>if</span><span class=cF0> (head.next != &amp;head)
<a name="l1047"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1048"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l1049"></a> {
<a name="l1050"></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="l1051"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code = </span><span class=cF5>MessageScan</span><span class=cF7>(</span><span class=cF0>&amp;arg1, &amp;arg2,
<a name="l1052"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF7>)</span><span class=cF0>)
<a name="l1053"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1054"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
<a name="l1055"></a> </span><span class=cF1>switch</span><span class=cF0> (mode)
<a name="l1056"></a> {
<a name="l1057"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL</span><span class=cF0>:
<a name="l1058"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL</span><span class=cF0>:
<a name="l1059"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0>:
<a name="l1060"></a> xx = arg1;
<a name="l1061"></a> yy = arg2;
<a name="l1062"></a> best_dd = </span><span class=cF3>I64_MAX</span><span class=cF0>;
<a name="l1063"></a> tmpes = head.next;
<a name="l1064"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes != &amp;head)
<a name="l1065"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1066"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type)
<a name="l1067"></a> {
<a name="l1068"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l1069"></a> dd = </span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;x + tmpes-&gt;xx - xx) + </span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;y + tmpes-&gt;yy - yy);
<a name="l1070"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1071"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l1072"></a> dd = </span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;x + *tmpes-&gt;w + tmpes-&gt;xx - xx) +
<a name="l1073"></a> </span><span class=cF5>SqrI64</span><span class=cF0>(*tmpes-&gt;y + *tmpes-&gt;h + tmpes-&gt;yy - yy);
<a name="l1074"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1075"></a> }
<a name="l1076"></a> </span><span class=cF1>if</span><span class=cF0> (dd &lt; best_dd)
<a name="l1077"></a> {
<a name="l1078"></a> best_dd = dd;
<a name="l1079"></a> best_es = tmpes;
<a name="l1080"></a> }
<a name="l1081"></a> tmpes = tmpes-&gt;next;
<a name="l1082"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1083"></a> cur_elem_num = best_es-&gt;num;
<a name="l1084"></a> </span><span class=cF1>if</span><span class=cF0> (mode != </span><span class=cF3>SPED_UNSEL</span><span class=cF0>)
<a name="l1085"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1086"></a> best_es-&gt;flags |= </span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l1087"></a> best_es-&gt;g-&gt;type |= </span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l1088"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1089"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1090"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1091"></a> best_es-&gt;flags &amp;= ~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l1092"></a> best_es-&gt;g-&gt;type &amp;= ~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l1093"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1094"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1095"></a> </span><span class=cF1>start</span><span class=cF0>:
<a name="l1096"></a> xx2 = xx = arg1;
<a name="l1097"></a> yy2 = yy = arg2;
<a name="l1098"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l1099"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1100"></a> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(dc, &amp;head);
<a name="l1101"></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; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>RED</span><span class=cF0>;
<a name="l1102"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc, xx, yy, xx2, yy2);
<a name="l1103"></a> </span><span class=cF1>if</span><span class=cF0> (message_code = </span><span class=cF5>MessageScan</span><span class=cF7>(</span><span class=cF0>&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF7>)</span><span class=cF0>)
<a name="l1104"></a> {
<a name="l1105"></a> </span><span class=cF1>if</span><span class=cF0> (message_code == </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>)
<a name="l1106"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1107"></a> xx2 = arg1;
<a name="l1108"></a> yy2 = arg2;
<a name="l1109"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1110"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1111"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1112"></a> }
<a name="l1113"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1114"></a> </span><span class=cF1>if</span><span class=cF0> (xx2 &lt; xx)
<a name="l1115"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;xx, &amp;xx2);
<a name="l1116"></a> </span><span class=cF1>if</span><span class=cF0> (yy2 &lt; yy)
<a name="l1117"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;yy, &amp;yy2);
<a name="l1118"></a> tmpes = head.next;
<a name="l1119"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes != &amp;head)
<a name="l1120"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1121"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpes-&gt;type)
<a name="l1122"></a> {
<a name="l1123"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_SIMPLE_PT</span><span class=cF0>:
<a name="l1124"></a> </span><span class=cF1>if</span><span class=cF0> (xx &lt;= *tmpes-&gt;x + tmpes-&gt;xx &lt;= xx2 &amp;&amp; yy &lt;= *tmpes-&gt;y + tmpes-&gt;yy &lt;= yy2)
<a name="l1125"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1126"></a> </span><span class=cF1>if</span><span class=cF0> (mode != </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>)
<a name="l1127"></a> {
<a name="l1128"></a> tmpes-&gt;flags |= </span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l1129"></a> tmpes-&gt;g-&gt;type |= </span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l1130"></a> }
<a name="l1131"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1132"></a> {
<a name="l1133"></a> tmpes-&gt;flags &amp;= ~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l1134"></a> tmpes-&gt;g-&gt;type &amp;= ~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l1135"></a> }
<a name="l1136"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1137"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1138"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPEDT_WIDTH_HEIGHT</span><span class=cF0>:
<a name="l1139"></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="l1140"></a> yy &lt;= *tmpes-&gt;y + *tmpes-&gt;h + tmpes-&gt;yy &lt;= yy2)
<a name="l1141"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1142"></a> </span><span class=cF1>if</span><span class=cF0> (mode != </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>)
<a name="l1143"></a> {
<a name="l1144"></a> tmpes-&gt;flags |= </span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l1145"></a> tmpes-&gt;g-&gt;type |= </span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l1146"></a> }
<a name="l1147"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1148"></a> {
<a name="l1149"></a> tmpes-&gt;flags &amp;= ~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l1150"></a> tmpes-&gt;g-&gt;type &amp;= ~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l1151"></a> }
<a name="l1152"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1153"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1154"></a> }
<a name="l1155"></a> tmpes = tmpes-&gt;next;
<a name="l1156"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1157"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL_RECTS</span><span class=cF0>:
<a name="l1158"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>:
<a name="l1159"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1160"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0>:
<a name="l1161"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l1162"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1163"></a> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(dc, &amp;head);
<a name="l1164"></a> message_code = </span><span class=cF5>MessageScan</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>);
<a name="l1165"></a> </span><span class=cF1>if</span><span class=cF0> (message_code == </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>)
<a name="l1166"></a> </span><span class=cF1>goto</span><span class=cF0> gs_key;
<a name="l1167"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1168"></a> </span><span class=cF1>while</span><span class=cF0> (message_code != </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>);
<a name="l1169"></a>
<a name="l1170"></a> xx = arg1;
<a name="l1171"></a> yy = arg2;
<a name="l1172"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1173"></a> </span><span class=cF1>end</span><span class=cF0>:
<a name="l1174"></a> }
<a name="l1175"></a> </span><span class=cF1>switch</span><span class=cF0> (mode)
<a name="l1176"></a> {
<a name="l1177"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0>:
<a name="l1178"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0>:
<a name="l1179"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l1180"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1181"></a> </span><span class=cF5>SpriteCtrlPtsDraw</span><span class=cF0>(dc, &amp;head);
<a name="l1182"></a> </span><span class=cF1>if</span><span class=cF0> (message_code = </span><span class=cF5>MessageScan</span><span class=cF7>(</span><span class=cF0>&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF7>)</span><span class=cF0>)
<a name="l1183"></a> {
<a name="l1184"></a> </span><span class=cF5>SpriteCtrlPtsMove</span><span class=cF0>(&amp;head, arg1 - xx, arg2 - yy);
<a name="l1185"></a> xx = arg1;
<a name="l1186"></a> yy = arg2;
<a name="l1187"></a> }
<a name="l1188"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1189"></a> </span><span class=cF1>while</span><span class=cF0> (message_code != </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>);
<a name="l1190"></a>
<a name="l1191"></a> tmpes = head.next;
<a name="l1192"></a> </span><span class=cF1>while</span><span class=cF0> (tmpes != &amp;head)
<a name="l1193"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1194"></a> tmpes-&gt;flags &amp;= ~</span><span class=cF3>SPEDF_SEL</span><span class=cF0>;
<a name="l1195"></a> tmpes-&gt;g-&gt;type &amp;= ~</span><span class=cF3>SPF_SEL</span><span class=cF0>;
<a name="l1196"></a> tmpes = tmpes-&gt;next;
<a name="l1197"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1198"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1199"></a> }
<a name="l1200"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1201"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l1202"></a>gs_key:
<a name="l1203"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1.u8[</span><span class=cFE>0</span><span class=cF0>])
<a name="l1204"></a> {
<a name="l1205"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l1206"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1207"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l1208"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
<a name="l1209"></a> </span><span class=cF1>goto</span><span class=cF0> gs_done;
<a name="l1210"></a>
<a name="l1211"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>:
<a name="l1212"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'P'</span><span class=cF0>:
<a name="l1213"></a> mode &amp;= ~</span><span class=cFE>1</span><span class=cF0>;
<a name="l1214"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1215"></a>
<a name="l1216"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'r'</span><span class=cF0>:
<a name="l1217"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'R'</span><span class=cF0>:
<a name="l1218"></a> mode |= </span><span class=cFE>1</span><span class=cF0>;
<a name="l1219"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1220"></a> }
<a name="l1221"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1222"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>:
<a name="l1223"></a> </span><span class=cF1>goto</span><span class=cF0> gs_done;
<a name="l1224"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1225"></a> }
<a name="l1226"></a>gs_done:
<a name="l1227"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;head, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l1228"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1229"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l1230"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l1231"></a> </span><span class=cF1>if</span><span class=cF0> (_cur_elem_num &amp;&amp; res)
<a name="l1232"></a> *_cur_elem_num = cur_elem_num;
<a name="l1233"></a>
<a name="l1234"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1235"></a>}
<a name="l1236"></a>
<a name="l1237"></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, </span><span class=cF9>CSprite</span><span class=cF0> **_head, </span><span class=cF9>I64</span><span class=cF0> *_cur_elem_num)
<a name="l1238"></a>{
<a name="l1239"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2;
<a name="l1240"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb;
<a name="l1241"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
<a name="l1242"></a> </span><span class=cF9>I64</span><span class=cF0> i, r[</span><span class=cFE>16</span><span class=cF0>], message_code, arg1, arg2, xx, yy, old_de_flags;
<a name="l1243"></a> </span><span class=cF9>CSprite</span><span class=cF0> *head2, *next, *last, *tmpg, *insert_pt;
<a name="l1244"></a>
<a name="l1245"></a> old_de_flags = doc_ce-&gt;de_flags;
<a name="l1246"></a> tmpb = doc_ce-&gt;bin_data;
<a name="l1247"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l1248"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1249"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l1250"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1251"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>winmgr</span><span class=cF0>.fps &lt; </span><span class=cFE>10</span><span class=cF0>)
<a name="l1252"></a> doc_ce-&gt;de_flags |= </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF0>;
<a name="l1253"></a> </span><span class=cF5>StrCopy</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="l1254"></a> i=</span><span class=cF5>PopUpSpriteEd</span><span class=cF0>(_head, _cur_elem_num);
<a name="l1255"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1256"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= i &lt; </span><span class=cF3>SPED_EXIT</span><span class=cF0>)
<a name="l1257"></a> {
<a name="l1258"></a> </span><span class=cF5>StrCopy</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="l1259"></a> </span><span class=cF1>switch</span><span class=cF0> (i)
<a name="l1260"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1261"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL_UNSEL_ALL</span><span class=cF0>:
<a name="l1262"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueueSelCount</span><span class=cF7>(</span><span class=cF0>*_head</span><span class=cF7>)</span><span class=cF0>)
<a name="l1263"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head);
<a name="l1264"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1265"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1266"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1267"></a>
<a name="l1268"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SET_ORIGIN</span><span class=cF0>:
<a name="l1269"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head);
<a name="l1270"></a> doc_ce-&gt;de_flags = old_de_flags;
<a name="l1271"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>);
<a name="l1272"></a> </span><span class=cF5>SpriteSetOrigin</span><span class=cF0>(*_head, x - arg1, y - arg2, </span><span class=cFE>0</span><span class=cF0>);
<a name="l1273"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1274"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1275"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1276"></a>
<a name="l1277"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SEL</span><span class=cF0>:
<a name="l1278"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueueSelCount</span><span class=cF7>(</span><span class=cF0>*_head</span><span class=cF7>)</span><span class=cF0>)
<a name="l1279"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head);
<a name="l1280"></a> doc_ce-&gt;de_flags = old_de_flags;
<a name="l1281"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>);
<a name="l1282"></a> xx = arg1;
<a name="l1283"></a> yy = arg2;
<a name="l1284"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l1285"></a> {
<a name="l1286"></a> message_code = </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>);
<a name="l1287"></a> </span><span class=cF5>SpriteSetOrigin</span><span class=cF0>(*_head, arg1 - xx, arg2 - yy, </span><span class=cFE>0</span><span class=cF0>);
<a name="l1288"></a> xx = arg1;
<a name="l1289"></a> yy = arg2;
<a name="l1290"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1291"></a> }
<a name="l1292"></a> </span><span class=cF1>while</span><span class=cF0> (message_code != </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>);
<a name="l1293"></a>
<a name="l1294"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueueSelCount</span><span class=cF7>(</span><span class=cF0>*_head, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1295"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1296"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1297"></a>
<a name="l1298"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL</span><span class=cF0>:
<a name="l1299"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SEL_RECTS</span><span class=cF0>:
<a name="l1300"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL</span><span class=cF0>:
<a name="l1301"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_UNSEL_RECTS</span><span class=cF0>:
<a name="l1302"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_PTS</span><span class=cF0>:
<a name="l1303"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_RECTS</span><span class=cF0>:
<a name="l1304"></a> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF3>ARf_CSPRITE_PTS_RECTANGLES</span><span class=cF0>,
<a name="l1305"></a> </span><span class=cF6>&quot;You can switch between points\n&quot;</span><span class=cF0>
<a name="l1306"></a> </span><span class=cF6>&quot;and rectangles with '$GREEN$p$FG$' and '$GREEN$r$FG$'.\n&quot;</span><span class=cF0>
<a name="l1307"></a> </span><span class=cF6>&quot;Press '$GREEN$r$FG$' after one rectangle\n&quot;</span><span class=cF0>
<a name="l1308"></a> </span><span class=cF6>&quot;to OR another rectangle.\n&quot;</span><span class=cF0>);
<a name="l1309"></a> doc_ce-&gt;de_flags = old_de_flags;
<a name="l1310"></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="l1311"></a> {
<a name="l1312"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(*_head);
<a name="l1313"></a> </span><span class=cF5>Free</span><span class=cF0>(*_head);
<a name="l1314"></a> *_head = </span><span class=cF5>Sprite2SpriteQueue</span><span class=cF0>(tmpb-&gt;data);
<a name="l1315"></a> }
<a name="l1316"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1317"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1318"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1319"></a>
<a name="l1320"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_TRANSFORM_SEL</span><span class=cF0>:
<a name="l1321"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueueSelCount</span><span class=cF7>(</span><span class=cF0>*_head</span><span class=cF7>)</span><span class=cF0>)
<a name="l1322"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head);
<a name="l1323"></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="l1324"></a> {
<a name="l1325"></a> </span><span class=cF5>SpriteTransformQueue</span><span class=cF0>(*_head, r);
<a name="l1326"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1327"></a> }
<a name="l1328"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>SpriteQueueSelCount</span><span class=cF7>(</span><span class=cF0>*_head, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1329"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(*_head, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l1330"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1331"></a>
<a name="l1332"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_SHIFT_SUB_ORIGIN</span><span class=cF0>:
<a name="l1333"></a> doc_ce-&gt;de_flags = old_de_flags;
<a name="l1334"></a> insert_pt = </span><span class=cF5>SpriteSetSettings</span><span class=cF0>(, *_head, *_cur_elem_num);
<a name="l1335"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF5>SpriteElemQueuedBaseSize</span><span class=cF7>(</span><span class=cF3>SPT_SHIFT</span><span class=cF7>)</span><span class=cF0>);
<a name="l1336"></a> tmpg-&gt;type = </span><span class=cF3>SPT_SHIFT</span><span class=cF0>;
<a name="l1337"></a> tmpg-&gt;p.x1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1338"></a> tmpg-&gt;p.y1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1339"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpg, insert_pt-&gt;last);
<a name="l1340"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>);
<a name="l1341"></a> xx = arg1;
<a name="l1342"></a> yy = arg2;
<a name="l1343"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l1344"></a> {
<a name="l1345"></a> message_code=</span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>);
<a name="l1346"></a> tmpg-&gt;p.x1 = arg1 - xx;
<a name="l1347"></a> tmpg-&gt;p.y1 = arg2 - yy;
<a name="l1348"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1349"></a> }
<a name="l1350"></a> </span><span class=cF1>while</span><span class=cF0> (message_code != </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>);
<a name="l1351"></a>
<a name="l1352"></a> *_cur_elem_num += </span><span class=cFE>1</span><span class=cF0>;
<a name="l1353"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1354"></a>
<a name="l1355"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_INS_CLIP</span><span class=cF0>:
<a name="l1356"></a> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF3>ARf_CSPRITE_INS_CLIP</span><span class=cF0>,
<a name="l1357"></a> </span><span class=cF6>&quot;You will probably want to shift around\n&quot;</span><span class=cF0>
<a name="l1358"></a> </span><span class=cF6>&quot;the location of element groups. Use\n&quot;</span><span class=cF0>
<a name="l1359"></a> </span><span class=cF6>&quot;'Insert shift sub-origin' after picking the\n&quot;</span><span class=cF0>
<a name="l1360"></a> </span><span class=cF6>&quot;element to insert before. Or,\n&quot;</span><span class=cF0>
<a name="l1361"></a> </span><span class=cF6>&quot;use 'shift points'.\n&quot;</span><span class=cF0>);
<a name="l1362"></a> insert_pt = </span><span class=cF5>SpriteSetSettings</span><span class=cF0>(, *_head, *_cur_elem_num);
<a name="l1363"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(</span><span class=cFB>sys_clip_doc</span><span class=cF0>);
<a name="l1364"></a> doc_e2 = </span><span class=cFB>sys_clip_doc</span><span class=cF0>-&gt;head.next;
<a name="l1365"></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="l1366"></a> {
<a name="l1367"></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>)
<a name="l1368"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1369"></a> head2 = </span><span class=cF5>Sprite2SpriteQueue</span><span class=cF0>(doc_e2-&gt;bin_data-&gt;data);
<a name="l1370"></a> </span><span class=cF1>if</span><span class=cF0> (head2-&gt;next != head2)
<a name="l1371"></a> {
<a name="l1372"></a> tmpg = head2-&gt;next;
<a name="l1373"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg != head2)
<a name="l1374"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1375"></a> *_cur_elem_num += </span><span class=cFE>1</span><span class=cF0>;
<a name="l1376"></a> tmpg = tmpg-&gt;next;
<a name="l1377"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1378"></a> next = head2-&gt;next;
<a name="l1379"></a> last = head2-&gt;last;
<a name="l1380"></a> insert_pt-&gt;last-&gt;next = next;
<a name="l1381"></a> next-&gt;last = insert_pt-&gt;last;
<a name="l1382"></a> insert_pt-&gt;last = last;
<a name="l1383"></a> last-&gt;next = insert_pt;
<a name="l1384"></a> }
<a name="l1385"></a> </span><span class=cF5>Free</span><span class=cF0>(head2);
<a name="l1386"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1387"></a> doc_e2 = doc_e2-&gt;next;
<a name="l1388"></a> }
<a name="l1389"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l1390"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(</span><span class=cFB>sys_clip_doc</span><span class=cF0>);
<a name="l1391"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1392"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1393"></a>
<a name="l1394"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_TEXT_ED</span><span class=cF0>:
<a name="l1395"></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="l1396"></a> </span><span class=cF5>SpriteEdUpdate</span><span class=cF0>(doc, doc_ce, *_head);
<a name="l1397"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1398"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1399"></a> }
<a name="l1400"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1401"></a> </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="l1402"></a>
<a name="l1403"></a> doc_ce-&gt;de_flags = old_de_flags;
<a name="l1404"></a>
<a name="l1405"></a> </span><span class=cF1>switch</span><span class=cF0> (i)
<a name="l1406"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1407"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCM_CANCEL</span><span class=cF0>:
<a name="l1408"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>SPE_ABORT</span><span class=cF0>;
<a name="l1409"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_EXIT</span><span class=cF0>:
<a name="l1410"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>SPE_EXIT</span><span class=cF0>;
<a name="l1411"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPED_MAIN_MENU</span><span class=cF0>:
<a name="l1412"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>SPE_CONT</span><span class=cF0>;
<a name="l1413"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1414"></a>}
<a name="l1415"></a>
<a name="l1416"></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="l1417"></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="l1418"></a>{</span><span class=cF2>//Rotate Sprite using 4x4 matrix. Uses </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Lectures/FixedPoint.ZC.html#l1"><span class=cF4>fixed-point</span></a><span class=cF2>.</span><span class=cF0>
<a name="l1419"></a> </span><span class=cF1>U8</span><span class=cF0> *res;
<a name="l1420"></a> </span><span class=cF9>CSprite</span><span class=cF0> *head = </span><span class=cF5>Sprite2SpriteQueue</span><span class=cF0>(elems);
<a name="l1421"></a>
<a name="l1422"></a> </span><span class=cF5>SpriteQueueSelAll</span><span class=cF0>(head);
<a name="l1423"></a> </span><span class=cF5>SpriteTransformQueue</span><span class=cF0>(head, r);
<a name="l1424"></a> res = </span><span class=cF5>SpriteQueue2Sprite</span><span class=cF0>(head);
<a name="l1425"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(head);
<a name="l1426"></a> </span><span class=cF5>Free</span><span class=cF0>(head);
<a name="l1427"></a>
<a name="l1428"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1429"></a>}
</span></pre></body>
</html>