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

635 lines
72 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics/Sprite;Sprites&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SpriteElem2Code</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>CSprite</span><span class=cF0> *tmpg)
<a name="l4"></a>{
<a name="l5"></a> </span><span class=cF1>U8</span><span class=cF0> buf1[</span><span class=cF3>STR_LEN</span><span class=cF0>],buf2[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l6"></a> </span><span class=cF9>I32</span><span class=cF0> *ptr;
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,k,col,width_internal;
<a name="l8"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *p;
<a name="l9"></a> </span><span class=cF9>CMeshTri</span><span class=cF0> *tri;
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (!doc) doc=</span><span class=cF5>DocPut</span><span class=cF0>;
<a name="l11"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;%Z&quot;</span><span class=cF0>,tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>,</span><span class=cF6>&quot;ST_SPRITE_ELEM_CODES&quot;</span><span class=cF0>);
<a name="l12"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l13"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_COLOR</span><span class=cF0>:
<a name="l14"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{%s}&quot;</span><span class=cF0>,
<a name="l15"></a> </span><span class=cF5>Color2Str</span><span class=cF7>(</span><span class=cF0>buf1,tmpg-&gt;c.color</span><span class=cF7>)</span><span class=cF0>);
<a name="l16"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l17"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_DITHER_COLOR</span><span class=cF0>:
<a name="l18"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{%s}&quot;</span><span class=cF0>,
<a name="l19"></a> </span><span class=cF5>Color2Str</span><span class=cF7>(</span><span class=cF0>buf2,</span><span class=cF3>ROPF_DITHER</span><span class=cF0>|tmpg-&gt;d.dither_color.u8[0]|
<a name="l20"></a> tmpg-&gt;d.dither_color.u8[1]&lt;&lt;</span><span class=cF3>COLORROP_BITS</span><span class=cF7>)</span><span class=cF0>);
<a name="l21"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TRANSFORM_ON</span><span class=cF0>:
<a name="l23"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{ON}&quot;</span><span class=cF0>);
<a name="l24"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l25"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TRANSFORM_OFF</span><span class=cF0>:
<a name="l26"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{OFF}&quot;</span><span class=cF0>);
<a name="l27"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l28"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l29"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l30"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l31"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d),(%d,%d)}&quot;</span><span class=cF0>,tmpg-&gt;pp.x1,tmpg-&gt;pp.y1,
<a name="l32"></a> tmpg-&gt;pp.x2,tmpg-&gt;pp.y2);
<a name="l33"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l34"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l35"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d):(%d,%d)}&quot;</span><span class=cF0>,tmpg-&gt;pp.x1,tmpg-&gt;pp.y1,
<a name="l36"></a> tmpg-&gt;pp.x2-tmpg-&gt;pp.x1,tmpg-&gt;pp.y2-tmpg-&gt;pp.y1);
<a name="l37"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l38"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l39"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d):(%d,%d),%0.4f}&quot;</span><span class=cF0>,tmpg-&gt;ppa.x1,tmpg-&gt;ppa.y1,
<a name="l40"></a> tmpg-&gt;ppa.x2-tmpg-&gt;ppa.x1,tmpg-&gt;ppa.y2-tmpg-&gt;ppa.y1,
<a name="l41"></a> 180/</span><span class=cF3>pi</span><span class=cF0>*</span><span class=cF5>Wrap</span><span class=cF7>(</span><span class=cF0>tmpg-&gt;ppa.angle</span><span class=cF7>)</span><span class=cF0>);
<a name="l42"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l43"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l44"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l45"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFT</span><span class=cF0>:
<a name="l46"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d)}&quot;</span><span class=cF0>,tmpg-&gt;p.x1,tmpg-&gt;p.y1);
<a name="l47"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l48"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l49"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d),TRUE}&quot;</span><span class=cF0>,tmpg-&gt;p.x1,tmpg-&gt;p.y1);
<a name="l50"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l51"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l52"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d):%d}&quot;</span><span class=cF0>,tmpg-&gt;pr.x1,tmpg-&gt;pr.y1,tmpg-&gt;pr.radius);
<a name="l53"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l54"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_THICK</span><span class=cF0>:
<a name="l55"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{%d}&quot;</span><span class=cF0>,tmpg-&gt;t.thick);
<a name="l56"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l57"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l58"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d):(%d,%d),%0.4f}&quot;</span><span class=cF0>,tmpg-&gt;pwha.x1,tmpg-&gt;pwha.y1,
<a name="l59"></a> tmpg-&gt;pwha.width,tmpg-&gt;pwha.height,180/</span><span class=cF3>pi</span><span class=cF0>*</span><span class=cF5>Wrap</span><span class=cF7>(</span><span class=cF0>tmpg-&gt;pwha.angle</span><span class=cF7>)</span><span class=cF0>);
<a name="l60"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l61"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l62"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{%d,(%d,%d):(%d,%d),%0.4f}&quot;</span><span class=cF0>,tmpg-&gt;pwhas.sides,
<a name="l63"></a> tmpg-&gt;pwhas.x1,tmpg-&gt;pwhas.y1,
<a name="l64"></a> tmpg-&gt;pwhas.width,tmpg-&gt;pwhas.height,
<a name="l65"></a> 180/</span><span class=cF3>pi</span><span class=cF0>*</span><span class=cF5>Wrap</span><span class=cF7>(</span><span class=cF0>tmpg-&gt;pwhas.angle</span><span class=cF7>)</span><span class=cF0>);
<a name="l66"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l67"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l68"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l69"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l70"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d),\&quot;%Q\&quot;}&quot;</span><span class=cF0>,tmpg-&gt;ps.x1,tmpg-&gt;ps.y1,tmpg-&gt;ps.st);
<a name="l71"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l72"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l73"></a> ptr=&amp;tmpg-&gt;nu.u;
<a name="l74"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{&quot;</span><span class=cF0>);
<a name="l75"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++,ptr+=2) {
<a name="l76"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;(%d,%d)&quot;</span><span class=cF0>,ptr[0],ptr[1]);
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (i+1&lt;tmpg-&gt;nu.num) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>);
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (i&amp;3==3 &amp;&amp; i+1&lt;tmpg-&gt;nu.num)
<a name="l79"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\n&quot;</span><span class=cF0>);
<a name="l80"></a> }
<a name="l81"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l82"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l83"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l84"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l85"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l86"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l87"></a> ptr=&amp;tmpg-&gt;nu.u;
<a name="l88"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{&quot;</span><span class=cF0>);
<a name="l89"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;nu.num;i++,ptr+=3) {
<a name="l90"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;(%d,%d,%d)&quot;</span><span class=cF0>,ptr[0],ptr[1],ptr[2]);
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (i+1&lt;tmpg-&gt;nu.num) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>);
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (i&amp;3==3 &amp;&amp; i+1&lt;tmpg-&gt;nu.num)
<a name="l93"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\n&quot;</span><span class=cF0>);
<a name="l94"></a> }
<a name="l95"></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_BSPLINE2</span><span class=cF0>||
<a name="l96"></a> tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>)
<a name="l97"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,FALSE}&quot;</span><span class=cF0>);
<a name="l98"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l99"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,TRUE}&quot;</span><span class=cF0>);
<a name="l100"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l101"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l102"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d),&quot;</span><span class=cF0>,tmpg-&gt;npu.x,tmpg-&gt;npu.y);
<a name="l103"></a> ptr=&amp;tmpg-&gt;npu.u;
<a name="l104"></a> col=16;
<a name="l105"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;npu.num;i++) {
<a name="l106"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;%d&quot;</span><span class=cF0>,</span><span class=cF5>BFieldExtU32</span><span class=cF7>(</span><span class=cF0>ptr,i*3,3</span><span class=cF7>)</span><span class=cF0>);
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (++col&gt;=64 &amp;&amp; i+1&lt;tmpg-&gt;npu.num) </span><span class=cF7>{</span><span class=cF0>
<a name="l108"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\n&quot;</span><span class=cF0>);
<a name="l109"></a> col=0;
<a name="l110"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l111"></a> }
<a name="l112"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l113"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l114"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l115"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{(%d,%d):(%d,%d),\n&quot;</span><span class=cF0>,tmpg-&gt;pwhu.x1,tmpg-&gt;pwhu.y1,
<a name="l116"></a> tmpg-&gt;pwhu.width,tmpg-&gt;pwhu.height);
<a name="l117"></a> width_internal=(tmpg-&gt;pwhu.width+7)&amp;~7;
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (width_internal&lt;80)
<a name="l119"></a> k=width_internal;
<a name="l120"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l121"></a> k=64;
<a name="l122"></a> ptr=&amp;tmpg-&gt;pwhu.u;
<a name="l123"></a> col=0;
<a name="l124"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;tmpg-&gt;pwhu.height;j++)
<a name="l125"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;width_internal;i++,ptr</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++) {
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;=tmpg-&gt;pwhu.width)
<a name="l127"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;_&quot;</span><span class=cF0>);
<a name="l128"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*ptr</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>&lt;16)
<a name="l129"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;%X&quot;</span><span class=cF0>,*ptr</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
<a name="l130"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l131"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;%c&quot;</span><span class=cF0>,</span><span class=cF3>CH_SHIFT_SPACE</span><span class=cF0>);
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (++col&gt;=k &amp;&amp; </span><span class=cF7>(</span><span class=cF0>i+1&lt;width_internal||j+1&lt;tmpg-&gt;pwhu.height</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\n&quot;</span><span class=cF0>);
<a name="l134"></a> col=0;
<a name="l135"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l136"></a> }
<a name="l137"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l138"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l139"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l140"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{FALSE,&quot;</span><span class=cF0>);
<a name="l141"></a> p=&amp;tmpg-&gt;mu.u;
<a name="l142"></a> col=0;
<a name="l143"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;mu.vertex_cnt;i++,p++) {
<a name="l144"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;(%d,%d,%d)&quot;</span><span class=cF0>,p-&gt;x,p-&gt;y,p-&gt;z);
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (i+1&lt;tmpg-&gt;mu.vertex_cnt) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>);
<a name="l146"></a> </span><span class=cF1>if</span><span class=cF0> (++col==4) </span><span class=cF7>{</span><span class=cF0>
<a name="l147"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\t//%d\n&quot;</span><span class=cF0>,i);
<a name="l148"></a> col=0;
<a name="l149"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l150"></a> }
<a name="l151"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;:&quot;</span><span class=cF0>);
<a name="l152"></a> tri=p;
<a name="l153"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;mu.tri_cnt;i++,tri++) {
<a name="l154"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;(%s,%d,%d,%d)&quot;</span><span class=cF0>,</span><span class=cF5>Color2Str</span><span class=cF7>(</span><span class=cF0>buf1,tri-&gt;color</span><span class=cF7>)</span><span class=cF0>,
<a name="l155"></a> tri-&gt;nums[0],tri-&gt;nums[1],tri-&gt;nums[2]);
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (i+1&lt;tmpg-&gt;mu.tri_cnt) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>);
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (++col&gt;=3 &amp;&amp; i+1&lt;tmpg-&gt;mu.tri_cnt) </span><span class=cF7>{</span><span class=cF0>
<a name="l158"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\n&quot;</span><span class=cF0>);
<a name="l159"></a> col=0;
<a name="l160"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l161"></a> }
<a name="l162"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l163"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l165"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;{TRUE,(%d,%d,%d):&quot;</span><span class=cF0>,tmpg-&gt;pmu.x,tmpg-&gt;pmu.y,tmpg-&gt;pmu.z);
<a name="l166"></a> p=&amp;tmpg-&gt;pmu.u;
<a name="l167"></a> col=1;
<a name="l168"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;pmu.vertex_cnt;i++,p++) {
<a name="l169"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;(%d,%d,%d)&quot;</span><span class=cF0>,p-&gt;x,p-&gt;y,p-&gt;z);
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (i+1&lt;tmpg-&gt;pmu.vertex_cnt) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>);
<a name="l171"></a> </span><span class=cF1>if</span><span class=cF0> (++col==4) </span><span class=cF7>{</span><span class=cF0>
<a name="l172"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\t//%d\n&quot;</span><span class=cF0>,i);
<a name="l173"></a> col=0;
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l175"></a> }
<a name="l176"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;:&quot;</span><span class=cF0>);
<a name="l177"></a> tri=p;
<a name="l178"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpg-&gt;pmu.tri_cnt;i++,tri++) {
<a name="l179"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;(%s,%d,%d,%d)&quot;</span><span class=cF0>,</span><span class=cF5>Color2Str</span><span class=cF7>(</span><span class=cF0>buf1,tri-&gt;color</span><span class=cF7>)</span><span class=cF0>,
<a name="l180"></a> tri-&gt;nums[0],tri-&gt;nums[1],tri-&gt;nums[2]);
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (i+1&lt;tmpg-&gt;pmu.tri_cnt) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>);
<a name="l182"></a> </span><span class=cF1>if</span><span class=cF0> (++col&gt;=3 &amp;&amp; i+1&lt;tmpg-&gt;pmu.tri_cnt) </span><span class=cF7>{</span><span class=cF0>
<a name="l183"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\n&quot;</span><span class=cF0>);
<a name="l184"></a> col=0;
<a name="l185"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l186"></a> }
<a name="l187"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l188"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l189"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l190"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;;\n&quot;</span><span class=cF0>);
<a name="l191"></a>}
<a name="l192"></a>
<a name="l193"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Sprite2Code</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *elems)
<a name="l194"></a>{</span><span class=cF2>//Sprite to text.</span><span class=cF0>
<a name="l195"></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="l196"></a> </span><span class=cF1>while</span><span class=cF0> (tmpg-&gt;type&amp;</span><span class=cF3>SPG_TYPE_MASK</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l197"></a> </span><span class=cF5>SpriteElem2Code</span><span class=cF0>(doc,tmpg);
<a name="l198"></a> tmpg(</span><span class=cF1>U8</span><span class=cF0> *)+=</span><span class=cF5>SpriteElemSize</span><span class=cF0>(tmpg);
<a name="l199"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l200"></a>}
<a name="l201"></a>
<a name="l202"></a></span><span class=cF9>CSprite</span><span class=cF0> *</span><span class=cF5>Code2SpriteElem</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> type)
<a name="l203"></a>{
<a name="l204"></a> </span><span class=cF9>I64</span><span class=cF0> i,num1,num2,size;
<a name="l205"></a> </span><span class=cF9>CSprite</span><span class=cF0> *res,g;
<a name="l206"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> color;
<a name="l207"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*ptr;
<a name="l208"></a> </span><span class=cF9>CQueD3I32</span><span class=cF0> headp,*tmpp,*tmpa1;
<a name="l209"></a> </span><span class=cF9>CQueMeshTri</span><span class=cF0> headt,*tmpt,*tmpt1;
<a name="l210"></a> </span><span class=cF9>CQueVectU8</span><span class=cF0> *tmpv;
<a name="l211"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;g,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CSprite</span><span class=cF7>)</span><span class=cF0>);
<a name="l212"></a> </span><span class=cF1>switch</span><span class=cF0> (type) </span><span class=cF7>{</span><span class=cF0>
<a name="l213"></a> </span><span class=cF1>start</span><span class=cF0>:
<a name="l214"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_COLOR</span><span class=cF0>:
<a name="l215"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_DITHER_COLOR</span><span class=cF0>:
<a name="l216"></a> st=</span><span class=cF5>LexFirstRem</span><span class=cF0>(cc,</span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l217"></a> color=</span><span class=cF5>Str2ColorU32</span><span class=cF0>(st);
<a name="l218"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l219"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip color</span><span class=cF0>
<a name="l220"></a> g.c.color=color.c0.color;
<a name="l221"></a> </span><span class=cF1>if</span><span class=cF0> (color&amp;</span><span class=cF3>ROPF_DITHER</span><span class=cF0>) {
<a name="l222"></a> g.d.dither_color.u8[1]=color.c1.color;
<a name="l223"></a> g.type=</span><span class=cF3>SPT_DITHER_COLOR</span><span class=cF0>;
<a name="l224"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l225"></a> g.type=</span><span class=cF3>SPT_COLOR</span><span class=cF0>;
<a name="l226"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l227"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TRANSFORM_ON</span><span class=cF0>:
<a name="l228"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TRANSFORM_OFF</span><span class=cF0>:
<a name="l229"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l230"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LexExpressionI64</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>)
<a name="l231"></a> g.type=</span><span class=cF3>SPT_TRANSFORM_ON</span><span class=cF0>;
<a name="l232"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l233"></a> g.type=</span><span class=cF3>SPT_TRANSFORM_OFF</span><span class=cF0>;
<a name="l234"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l235"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_LINE</span><span class=cF0>:
<a name="l236"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ARROW</span><span class=cF0>:
<a name="l237"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PLANAR_SYMMETRY</span><span class=cF0>:
<a name="l238"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l239"></a> g.type=type;
<a name="l240"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pp.x1);
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l242"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l243"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l244"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pp.x2);
<a name="l245"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l246"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_RECT</span><span class=cF0>:
<a name="l247"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>:
<a name="l248"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l249"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pp.x1);
<a name="l250"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>':'</span><span class=cF0>)
<a name="l251"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ':' at &quot;</span><span class=cF0>);
<a name="l252"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip :</span><span class=cF0>
<a name="l253"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pp.x2);
<a name="l254"></a> g.ppa.x2+=g.pp.x1;
<a name="l255"></a> g.ppa.y2+=g.pp.y1;
<a name="l256"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>','</span><span class=cF0>) {
<a name="l257"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l258"></a> g.ppa.angle=</span><span class=cF3>pi</span><span class=cF0>/180*</span><span class=cF5>LexExpressionF64</span><span class=cF0>(cc);
<a name="l259"></a> g.type=</span><span class=cF3>SPT_ROTATED_RECT</span><span class=cF0>;
<a name="l260"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l261"></a> g.type=</span><span class=cF3>SPT_RECT</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l263"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_PT</span><span class=cF0>:
<a name="l264"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFT</span><span class=cF0>:
<a name="l265"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l266"></a> g.type=type;
<a name="l267"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.p.x1);
<a name="l268"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l269"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>:
<a name="l270"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l271"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l272"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.p.x1);
<a name="l273"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>','</span><span class=cF0>) {
<a name="l274"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l275"></a> i=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l276"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l277"></a> i=0;
<a name="l278"></a> </span><span class=cF1>if</span><span class=cF0> (i)
<a name="l279"></a> g.type=</span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF0>;
<a name="l280"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l281"></a> g.type=</span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0>;
<a name="l282"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l283"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_THICK</span><span class=cF0>:
<a name="l284"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l285"></a> g.t.thick=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l286"></a> g.type=</span><span class=cF3>SPT_THICK</span><span class=cF0>;
<a name="l287"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l288"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_CIRCLE</span><span class=cF0>:
<a name="l289"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l290"></a> g.type=</span><span class=cF3>SPT_CIRCLE</span><span class=cF0>;
<a name="l291"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pr.x1);
<a name="l292"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>':'</span><span class=cF0>)
<a name="l293"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ':' at &quot;</span><span class=cF0>);
<a name="l294"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip :</span><span class=cF0>
<a name="l295"></a> g.pr.radius=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l296"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l297"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYGON</span><span class=cF0>:
<a name="l298"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l299"></a> g.pwhas.sides=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l300"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l301"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l302"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_ELLIPSE</span><span class=cF0>:
<a name="l303"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l304"></a> g.type=type;
<a name="l305"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pwha.x1);
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>':'</span><span class=cF0>)
<a name="l307"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ':' at &quot;</span><span class=cF0>);
<a name="l308"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip :</span><span class=cF0>
<a name="l309"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pwha.width);
<a name="l310"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l311"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l312"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l313"></a> g.pwha.angle=</span><span class=cF3>pi</span><span class=cF0>/180*</span><span class=cF5>LexExpressionF64</span><span class=cF0>(cc);
<a name="l314"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l315"></a> </span><span class=cF1>end</span><span class=cF0>:
<a name="l316"></a> size=</span><span class=cF5>SpriteElemSize</span><span class=cF0>(&amp;g)+</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="l317"></a> res=</span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l318"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res,&amp;g,size);
<a name="l319"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l320"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT</span><span class=cF0>:
<a name="l321"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_BOX</span><span class=cF0>:
<a name="l322"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_TEXT_DIAMOND</span><span class=cF0>:
<a name="l323"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l324"></a> g.type=type;
<a name="l325"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.ps.x1);
<a name="l326"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l327"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l328"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF3>TK_STR</span><span class=cF0>) </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l329"></a> st=</span><span class=cF5>LexExtStr</span><span class=cF0>(cc);
<a name="l330"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l331"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting string at &quot;</span><span class=cF0>);
<a name="l332"></a> size=</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF0>(type);
<a name="l333"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(st)+1;
<a name="l334"></a> res=</span><span class=cF5>MAlloc</span><span class=cF0>(size+i);
<a name="l335"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res,&amp;g,size);
<a name="l336"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>+size,st,i);
<a name="l337"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l338"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l339"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYLINE</span><span class=cF0>:
<a name="l340"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l341"></a> g.type=</span><span class=cF3>SPT_POLYLINE</span><span class=cF0>;
<a name="l342"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;headp);
<a name="l343"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>'('</span><span class=cF0>) {
<a name="l344"></a> tmpp=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CQueD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l345"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;tmpp-&gt;p);
<a name="l346"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpp,headp.last);
<a name="l347"></a> g.nu.num++;
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>','</span><span class=cF0>)
<a name="l349"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l350"></a> }
<a name="l351"></a> </span><span class=cF1>if</span><span class=cF0> (g.nu.num&lt;2)
<a name="l352"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting point at &quot;</span><span class=cF0>);
<a name="l353"></a> size=</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF0>(</span><span class=cF3>SPT_POLYLINE</span><span class=cF0>);
<a name="l354"></a> res=</span><span class=cF5>MAlloc</span><span class=cF0>(size+g.nu.num*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD2I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l355"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res,&amp;g,size);
<a name="l356"></a> ptr=&amp;res-&gt;nu.u;
<a name="l357"></a> tmpp=headp.next;
<a name="l358"></a> </span><span class=cF1>while</span><span class=cF0> (tmpp!=&amp;headp) {
<a name="l359"></a> tmpa1=tmpp-&gt;next;
<a name="l360"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr,&amp;tmpp-&gt;p,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD2I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l361"></a> ptr+=</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CD2I32</span><span class=cF0>);
<a name="l362"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpp);
<a name="l363"></a> tmpp=tmpa1;
<a name="l364"></a> }
<a name="l365"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l366"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>:
<a name="l367"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>:
<a name="l368"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>:
<a name="l369"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>:
<a name="l370"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l371"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;headp);
<a name="l372"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>'('</span><span class=cF0>) {
<a name="l373"></a> tmpp=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CQueD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l374"></a> </span><span class=cF5>LexD3I32</span><span class=cF0>(cc,&amp;tmpp-&gt;p);
<a name="l375"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpp,headp.last);
<a name="l376"></a> g.nu.num++;
<a name="l377"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>','</span><span class=cF0>)
<a name="l378"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l379"></a> }
<a name="l380"></a> </span><span class=cF1>if</span><span class=cF0> (g.nu.num&lt;2)
<a name="l381"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting point at &quot;</span><span class=cF0>);
<a name="l382"></a> size=</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF0>(type);
<a name="l383"></a> res=</span><span class=cF5>MAlloc</span><span class=cF0>(size+g.nu.num*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LexExpressionI64</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>) {
<a name="l385"></a> </span><span class=cF1>if</span><span class=cF0> (type==</span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>||type==</span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>)
<a name="l386"></a> g.type=</span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>;
<a name="l387"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l388"></a> g.type=</span><span class=cF3>SPT_BSPLINE3_CLOSED</span><span class=cF0>;
<a name="l389"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l390"></a> </span><span class=cF1>if</span><span class=cF0> (type==</span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>||type==</span><span class=cF3>SPT_BSPLINE2_CLOSED</span><span class=cF0>)
<a name="l391"></a> g.type=</span><span class=cF3>SPT_BSPLINE2</span><span class=cF0>;
<a name="l392"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l393"></a> g.type=</span><span class=cF3>SPT_BSPLINE3</span><span class=cF0>;
<a name="l394"></a> }
<a name="l395"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res,&amp;g,size);
<a name="l396"></a> ptr=&amp;res-&gt;nu.u;
<a name="l397"></a> tmpp=headp.next;
<a name="l398"></a> </span><span class=cF1>while</span><span class=cF0> (tmpp!=&amp;headp) {
<a name="l399"></a> tmpa1=tmpp-&gt;next;
<a name="l400"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr,&amp;tmpp-&gt;p,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l401"></a> ptr+=</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CD3I32</span><span class=cF0>);
<a name="l402"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpp);
<a name="l403"></a> tmpp=tmpa1;
<a name="l404"></a> }
<a name="l405"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l406"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_POLYPT</span><span class=cF0>:
<a name="l407"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l408"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.npu.x);
<a name="l409"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l410"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l411"></a> tmpv=</span><span class=cF5>QueVectU8New</span><span class=cF0>;
<a name="l412"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l413"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i=</span><span class=cF5>LexGetChar</span><span class=cF0>(cc)</span><span class=cF7>)</span><span class=cF0>)
<a name="l414"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting '}' at &quot;</span><span class=cF0>);
<a name="l415"></a> </span><span class=cF1>if</span><span class=cF0> (i==</span><span class=cF6>'}'</span><span class=cF0>)
<a name="l416"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l417"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0>&lt;=i&lt;=</span><span class=cF6>'7'</span><span class=cF0>)
<a name="l418"></a> </span><span class=cF5>QueVectU8Put</span><span class=cF0>(tmpv,g.npu.num++,i-</span><span class=cF6>'0'</span><span class=cF0>);
<a name="l419"></a> }
<a name="l420"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;cc-&gt;flags,</span><span class=cF3>CCf_USE_LAST_U16</span><span class=cF0>);
<a name="l421"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Load '}'</span><span class=cF0>
<a name="l422"></a> g.type=</span><span class=cF3>SPT_POLYPT</span><span class=cF0>;
<a name="l423"></a> size=</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF0>(</span><span class=cF3>SPT_POLYPT</span><span class=cF0>);
<a name="l424"></a> res=</span><span class=cF5>CAlloc</span><span class=cF0>(size+</span><span class=cF7>(</span><span class=cF0>g.npu.num*3+7</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3);
<a name="l425"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res,&amp;g,size);
<a name="l426"></a> ptr=&amp;res-&gt;npu.u;
<a name="l427"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;g.npu.num;i++)
<a name="l428"></a> </span><span class=cF5>BFieldOrU32</span><span class=cF0>(ptr,i*3,</span><span class=cF5>QueVectU8Get</span><span class=cF7>(</span><span class=cF0>tmpv,i</span><span class=cF7>)</span><span class=cF0>);
<a name="l429"></a> </span><span class=cF5>QueVectU8Del</span><span class=cF0>(tmpv);
<a name="l430"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l431"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_BITMAP</span><span class=cF0>:
<a name="l432"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l433"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pwhu.x1);
<a name="l434"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>':'</span><span class=cF0>)
<a name="l435"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ':' at &quot;</span><span class=cF0>);
<a name="l436"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip :</span><span class=cF0>
<a name="l437"></a> </span><span class=cF5>LexD2I32</span><span class=cF0>(cc,&amp;g.pwhu.width);
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l439"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l440"></a> tmpv=</span><span class=cF5>QueVectU8New</span><span class=cF0>;
<a name="l441"></a> num1=0;
<a name="l442"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l443"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i=</span><span class=cF5>ToUpper</span><span class=cF0>(</span><span class=cF5>LexGetChar</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
<a name="l444"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting '}' at &quot;</span><span class=cF0>);
<a name="l445"></a> </span><span class=cF1>if</span><span class=cF0> (i==</span><span class=cF6>'}'</span><span class=cF0>)
<a name="l446"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l447"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0>&lt;=i&lt;=</span><span class=cF6>'9'</span><span class=cF0>)
<a name="l448"></a> </span><span class=cF5>QueVectU8Put</span><span class=cF0>(tmpv,num1++,i-</span><span class=cF6>'0'</span><span class=cF0>);
<a name="l449"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0>&lt;=i&lt;=</span><span class=cF6>'F'</span><span class=cF0>)
<a name="l450"></a> </span><span class=cF5>QueVectU8Put</span><span class=cF0>(tmpv,num1++,i-</span><span class=cF6>'A'</span><span class=cF0>+10);
<a name="l451"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i==</span><span class=cF3>CH_SPACE</span><span class=cF0>||i==</span><span class=cF3>CH_SHIFT_SPACE</span><span class=cF0>)
<a name="l452"></a> </span><span class=cF5>QueVectU8Put</span><span class=cF0>(tmpv,num1++,</span><span class=cF3>TRANSPARENT</span><span class=cF0>);
<a name="l453"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i==</span><span class=cF6>'_'</span><span class=cF0>)
<a name="l454"></a> </span><span class=cF5>QueVectU8Put</span><span class=cF0>(tmpv,num1++,0);
<a name="l455"></a> }
<a name="l456"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;cc-&gt;flags,</span><span class=cF3>CCf_USE_LAST_U16</span><span class=cF0>);
<a name="l457"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Load '}'</span><span class=cF0>
<a name="l458"></a> g.type=</span><span class=cF3>SPT_BITMAP</span><span class=cF0>;
<a name="l459"></a> size=</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF0>(</span><span class=cF3>SPT_BITMAP</span><span class=cF0>);
<a name="l460"></a> res=</span><span class=cF5>CAlloc</span><span class=cF0>(size+num1);
<a name="l461"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res,&amp;g,size);
<a name="l462"></a> ptr=&amp;res-&gt;pwhu.u;
<a name="l463"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;num1;i++)
<a name="l464"></a> *ptr++=</span><span class=cF5>QueVectU8Get</span><span class=cF0>(tmpv,i);
<a name="l465"></a> </span><span class=cF5>QueVectU8Del</span><span class=cF0>(tmpv);
<a name="l466"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l467"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_MESH</span><span class=cF0>:
<a name="l468"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>:
<a name="l469"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l470"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LexExpressionI64</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>) {
<a name="l471"></a> g.type=</span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF0>;
<a name="l472"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l473"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l474"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l475"></a> </span><span class=cF5>LexD3I32</span><span class=cF0>(cc,&amp;g.pmu.x);
<a name="l476"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>':'</span><span class=cF0>)
<a name="l477"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ':' at &quot;</span><span class=cF0>);
<a name="l478"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip :</span><span class=cF0>
<a name="l479"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l480"></a> g.type=</span><span class=cF3>SPT_MESH</span><span class=cF0>;
<a name="l481"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l482"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l483"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l484"></a> }
<a name="l485"></a> num1=0;
<a name="l486"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;headp);
<a name="l487"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>'('</span><span class=cF0>) {
<a name="l488"></a> tmpp=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CQueD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l489"></a> </span><span class=cF5>LexD3I32</span><span class=cF0>(cc,&amp;tmpp-&gt;p);
<a name="l490"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpp,headp.last);
<a name="l491"></a> num1++;
<a name="l492"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>','</span><span class=cF0>)
<a name="l493"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l494"></a> }
<a name="l495"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>':'</span><span class=cF0>)
<a name="l496"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ':' at &quot;</span><span class=cF0>);
<a name="l497"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip :</span><span class=cF0>
<a name="l498"></a> num2=0;
<a name="l499"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;headt);
<a name="l500"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>'('</span><span class=cF0>) {
<a name="l501"></a> tmpt=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CQueMeshTri</span><span class=cF7>)</span><span class=cF0>);
<a name="l502"></a> st=</span><span class=cF5>LexFirstRem</span><span class=cF0>(cc,</span><span class=cF6>&quot;,&quot;</span><span class=cF0>);
<a name="l503"></a> tmpt-&gt;color=</span><span class=cF5>Str2ColorU32</span><span class=cF0>(st);
<a name="l504"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l505"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip color</span><span class=cF0>
<a name="l506"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l507"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l508"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l509"></a> tmpt-&gt;nums[0]=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l510"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l511"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l512"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l513"></a> tmpt-&gt;nums[1]=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l514"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>','</span><span class=cF0>)
<a name="l515"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l516"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l517"></a> tmpt-&gt;nums[2]=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l518"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>')'</span><span class=cF0>)
<a name="l519"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ')' at &quot;</span><span class=cF0>);
<a name="l520"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip )</span><span class=cF0>
<a name="l521"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpt,headt.last);
<a name="l522"></a> num2++;
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token==</span><span class=cF6>','</span><span class=cF0>)
<a name="l524"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ,</span><span class=cF0>
<a name="l525"></a> }
<a name="l526"></a> </span><span class=cF1>if</span><span class=cF0> (g.type==</span><span class=cF3>SPT_MESH</span><span class=cF0>) {
<a name="l527"></a> g.mu.vertex_cnt=num1;
<a name="l528"></a> g.mu.tri_cnt=num2;
<a name="l529"></a> size=</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF0>(</span><span class=cF3>SPT_MESH</span><span class=cF0>);
<a name="l530"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l531"></a> g.pmu.vertex_cnt=num1;
<a name="l532"></a> g.pmu.tri_cnt=num2;
<a name="l533"></a> }
<a name="l534"></a> size=</span><span class=cF5>SpriteElemQuedBaseSize</span><span class=cF0>(g.type);
<a name="l535"></a> res=</span><span class=cF5>MAlloc</span><span class=cF0>(size+num1*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>+num2*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshTri</span><span class=cF7>)</span><span class=cF0>);
<a name="l536"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res,&amp;g,size);
<a name="l537"></a> ptr=res(</span><span class=cF1>U8</span><span class=cF0> *)+size;
<a name="l538"></a> tmpp=headp.next;
<a name="l539"></a> </span><span class=cF1>while</span><span class=cF0> (tmpp!=&amp;headp) {
<a name="l540"></a> tmpa1=tmpp-&gt;next;
<a name="l541"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr,&amp;tmpp-&gt;p,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l542"></a> ptr+=</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CD3I32</span><span class=cF0>);
<a name="l543"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpp);
<a name="l544"></a> tmpp=tmpa1;
<a name="l545"></a> }
<a name="l546"></a> tmpt=headt.next;
<a name="l547"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&amp;headt) {
<a name="l548"></a> tmpt1=tmpt-&gt;next;
<a name="l549"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr,&amp;tmpt-&gt;</span><span class=cF1>start</span><span class=cF0>,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshTri</span><span class=cF7>)</span><span class=cF0>);
<a name="l550"></a> ptr+=</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CMeshTri</span><span class=cF0>);
<a name="l551"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
<a name="l552"></a> tmpt=tmpt1;
<a name="l553"></a> }
<a name="l554"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l555"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l556"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token!=</span><span class=cF6>'}'</span><span class=cF0>)
<a name="l557"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting '}' at &quot;</span><span class=cF0>);
<a name="l558"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>!=</span><span class=cF6>';'</span><span class=cF0>)
<a name="l559"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting ';' at &quot;</span><span class=cF0>);
<a name="l560"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l561"></a>}
<a name="l562"></a>
<a name="l563"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>Code2Sprite</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>I64</span><span class=cF0> *_size=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l564"></a>{</span><span class=cF2>//Text to sprite.</span><span class=cF0>
<a name="l565"></a> </span><span class=cF9>CSprite</span><span class=cF0> head;
<a name="l566"></a> </span><span class=cF1>U8</span><span class=cF0> *res;
<a name="l567"></a> </span><span class=cF1>Bool</span><span class=cF0> okay=</span><span class=cF3>TRUE</span><span class=cF0>,unlock_doc=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l568"></a> </span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc=</span><span class=cF5>CmpCtrlNew</span><span class=cF0>(,</span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>);
<a name="l569"></a> </span><span class=cF9>CHashTable</span><span class=cF0> *old_hash_table_lst=cc-&gt;htc.hash_table_lst;
<a name="l570"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
<a name="l571"></a> </span><span class=cF9>I64</span><span class=cF0> i,size=0;
<a name="l572"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;head);
<a name="l573"></a> </span><span class=cF5>LexAttachDoc</span><span class=cF0>(cc,,doc);
<a name="l574"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l575"></a> </span><span class=cF1>do</span><span class=cF0> {
<a name="l576"></a> cc-&gt;htc.hash_table_lst=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l577"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF3>TK_IDENT</span><span class=cF0> &amp;&amp; </span><span class=cF2>//Skip ;</span><span class=cF0>
<a name="l578"></a> </span><span class=cF7>(</span><span class=cF0>tmph=</span><span class=cF5>HashFind</span><span class=cF0>(cc-&gt;cur_str,</span><span class=cFB>gr</span><span class=cF0>.sprite_hash,</span><span class=cF3>SPHT_ELEM_CODE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l579"></a> i=tmph-&gt;user_data0;
<a name="l580"></a> cc-&gt;htc.hash_table_lst=old_hash_table_lst;
<a name="l581"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF6>'{'</span><span class=cF0>) </span><span class=cF2>//Skip ident</span><span class=cF0>
<a name="l582"></a> </span><span class=cF5>QueIns</span><span class=cF0>(</span><span class=cF5>Code2SpriteElem</span><span class=cF7>(</span><span class=cF0>cc,i</span><span class=cF7>)</span><span class=cF0>,head.last);
<a name="l583"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token)
<a name="l584"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>&quot;Expecting sprite element type name at &quot;</span><span class=cF0>);
<a name="l585"></a> } </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token);
<a name="l586"></a> okay=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l587"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l588"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l589"></a> okay=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l590"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l591"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l592"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l593"></a> </span><span class=cF1>if</span><span class=cF0> (okay) </span><span class=cF7>{</span><span class=cF0>
<a name="l594"></a> </span><span class=cF5>CmpCtrlDel</span><span class=cF0>(cc); </span><span class=cF2>//TODO: can crash</span><span class=cF0>
<a name="l595"></a> res=</span><span class=cF5>SpriteQue2Sprite</span><span class=cF0>(&amp;head,&amp;size);
<a name="l596"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l597"></a> res=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l598"></a> size=0;
<a name="l599"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l600"></a> </span><span class=cF1>if</span><span class=cF0> (_size) *_size=size;
<a name="l601"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&amp;head);
<a name="l602"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l603"></a>}
</span></pre></body>
</html>