mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
390 lines
30 KiB
HTML
Executable file
390 lines
30 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.00">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF2>//This is a whimsical program which demonstrates some techniques.</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> BORDER </span><span class=cFE>20</span><span class=cF0>
|
|
<a name="l4"></a>
|
|
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_PT </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_CIRCLE </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_LINE </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_SPRITE </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_NUM </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l10"></a>
|
|
<a name="l11"></a></span><span class=cF1>extern</span><span class=cF0> </span><span class=cF1>class</span><span class=cF0> PObj;
|
|
<a name="l12"></a>
|
|
<a name="l13"></a></span><span class=cF1>class</span><span class=cF0> PPt
|
|
<a name="l14"></a>{
|
|
<a name="l15"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p;
|
|
<a name="l16"></a>};
|
|
<a name="l17"></a>
|
|
<a name="l18"></a></span><span class=cF1>class</span><span class=cF0> PCircle
|
|
<a name="l19"></a>{
|
|
<a name="l20"></a> PObj *p;
|
|
<a name="l21"></a> </span><span class=cF9>I64</span><span class=cF0> radius;
|
|
<a name="l22"></a>};
|
|
<a name="l23"></a>
|
|
<a name="l24"></a></span><span class=cF1>class</span><span class=cF0> PLine
|
|
<a name="l25"></a>{
|
|
<a name="l26"></a> PObj *p1, *p2;
|
|
<a name="l27"></a>};
|
|
<a name="l28"></a>
|
|
<a name="l29"></a></span><span class=cF1>class</span><span class=cF0> PCSprite
|
|
<a name="l30"></a>{
|
|
<a name="l31"></a> PObj *p;
|
|
<a name="l32"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l33"></a> </span><span class=cF9>I64</span><span class=cF0> *r,
|
|
<a name="l34"></a> *dr; </span><span class=cF2>//Rounding error might eventually screw this up</span><span class=cF0>
|
|
<a name="l35"></a>}
|
|
<a name="l36"></a>
|
|
<a name="l37"></a></span><span class=cF1>class</span><span class=cF0> PObj
|
|
<a name="l38"></a>{
|
|
<a name="l39"></a> PObj *next, *last;
|
|
<a name="l40"></a> </span><span class=cF9>I64</span><span class=cF0> type, color;
|
|
<a name="l41"></a> </span><span class=cF1>union</span><span class=cF0>
|
|
<a name="l42"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l43"></a> PPt p;
|
|
<a name="l44"></a> PCircle c;
|
|
<a name="l45"></a> PLine l;
|
|
<a name="l46"></a> PCSprite g;
|
|
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0>;
|
|
<a name="l48"></a>};
|
|
<a name="l49"></a>
|
|
<a name="l50"></a></span><span class=cF1>class</span><span class=cF0> PickFrame
|
|
<a name="l51"></a>{
|
|
<a name="l52"></a> PObj o_head;
|
|
<a name="l53"></a> </span><span class=cF9>I64</span><span class=cF0> o_counts[PTY_NUM];
|
|
<a name="l54"></a> </span><span class=cF9>I64</span><span class=cF0> cx, cy;
|
|
<a name="l55"></a>};
|
|
<a name="l56"></a>
|
|
<a name="l57"></a>#</span><span class=cF1>define</span><span class=cF0> IMGS_NUM </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l58"></a>
|
|
<a name="l59"></a>
|
|
<a name="l60"></a>
|
|
<a name="l61"></a> </span><span class=cFA><1>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l62"></a>
|
|
<a name="l63"></a>
|
|
<a name="l64"></a>
|
|
<a name="l65"></a> </span><span class=cFA><2>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l66"></a>
|
|
<a name="l67"></a>
|
|
<a name="l68"></a>
|
|
<a name="l69"></a>
|
|
<a name="l70"></a> </span><span class=cFA><3>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l71"></a>
|
|
<a name="l72"></a>
|
|
<a name="l73"></a></span><span class=cF1>U8</span><span class=cF0> *imgs[IMGS_NUM] = {</span><span class=cFA><1></span><span class=cF0>, </span><span class=cFA><2></span><span class=cF0>, </span><span class=cFA><3></span><span class=cF0>};
|
|
<a name="l74"></a>
|
|
<a name="l75"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawIt</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>CDC</span><span class=cF0> *dc)
|
|
<a name="l76"></a>{
|
|
<a name="l77"></a> </span><span class=cF9>I64</span><span class=cF0> *r, *old_r;
|
|
<a name="l78"></a> PickFrame *pf = </span><span class=cF5>FramePtr</span><span class=cF0>(</span><span class=cF6>"PickFrame"</span><span class=cF0>, task);
|
|
<a name="l79"></a> PObj *tmpo = pf->o_head.next;
|
|
<a name="l80"></a>
|
|
<a name="l81"></a> pf->cx = task->pix_width >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l82"></a> pf->cy = task->pix_height >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
|
|
<a name="l85"></a>
|
|
<a name="l86"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l87"></a> dc->thick = </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l88"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc, BORDER, BORDER, </span><span class=cFE>2</span><span class=cF0> * pf->cx-BORDER, </span><span class=cFE>2</span><span class=cF0> * pf->cy-BORDER);
|
|
<a name="l89"></a>
|
|
<a name="l90"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &pf->o_head)
|
|
<a name="l91"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l92"></a> dc->color = tmpo->color;
|
|
<a name="l93"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpo->type)
|
|
<a name="l94"></a> {
|
|
<a name="l95"></a> </span><span class=cF1>case</span><span class=cF0> PTY_PT:
|
|
<a name="l96"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, pf->cx + tmpo->p.p.x + </span><span class=cFE>2</span><span class=cF0>, pf->cy + tmpo->p.p.y + </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l97"></a> pf->cx + tmpo->p.p.x - </span><span class=cFE>2</span><span class=cF0>, pf->cy + tmpo->p.p.y - </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l98"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, pf->cx + tmpo->p.p.x - </span><span class=cFE>2</span><span class=cF0>, pf->cy + tmpo->p.p.y + </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l99"></a> pf->cx + tmpo->p.p.x + </span><span class=cFE>2</span><span class=cF0>, pf->cy + tmpo->p.p.y - </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l100"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l101"></a>
|
|
<a name="l102"></a> </span><span class=cF1>case</span><span class=cF0> PTY_CIRCLE:
|
|
<a name="l103"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, pf->cx + tmpo->c.p->p.p.x, pf->cy + tmpo->c.p->p.p.y, tmpo->c.radius);
|
|
<a name="l104"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l105"></a>
|
|
<a name="l106"></a> </span><span class=cF1>case</span><span class=cF0> PTY_LINE:
|
|
<a name="l107"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, pf->cx + tmpo->l.p1->p.p.x, pf->cy + tmpo->l.p1->p.p.y,
|
|
<a name="l108"></a> pf->cx + tmpo->l.p2->p.p.x, pf->cy + tmpo->l.p2->p.p.y);
|
|
<a name="l109"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l110"></a>
|
|
<a name="l111"></a> </span><span class=cF1>case</span><span class=cF0> PTY_SPRITE:
|
|
<a name="l112"></a> old_r = dc->r;
|
|
<a name="l113"></a> dc->r = tmpo->g.r;
|
|
<a name="l114"></a> dc->x = pf->cx + tmpo->g.p->p.p.x;
|
|
<a name="l115"></a> dc->y = pf->cy + tmpo->g.p->p.p.y;
|
|
<a name="l116"></a> dc->z = </span><span class=cF3>GR_Z_ALL</span><span class=cF0>;
|
|
<a name="l117"></a> dc->flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l118"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, </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>, tmpo->g.img);
|
|
<a name="l119"></a> dc->flags &= ~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l120"></a> dc->r = old_r;
|
|
<a name="l121"></a>
|
|
<a name="l122"></a> </span><span class=cF2>//Updated each refresh, not guarenteed to be uniform.</span><span class=cF0>
|
|
<a name="l123"></a> </span><span class=cF2>//Rounding error might corrupt, as well.</span><span class=cF0>
|
|
<a name="l124"></a> r = </span><span class=cF5>Mat4x4MulMat4x4New</span><span class=cF0>(tmpo->g.dr, tmpo->g.r, task);
|
|
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo->g.r);
|
|
<a name="l126"></a> tmpo->g.r = r;
|
|
<a name="l127"></a>
|
|
<a name="l128"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l129"></a> }
|
|
<a name="l130"></a> tmpo = tmpo->next;
|
|
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l132"></a>}
|
|
<a name="l133"></a>
|
|
<a name="l134"></a>PObj *PObjNew(PickFrame *pf, </span><span class=cF9>I64</span><span class=cF0> type, </span><span class=cF9>I64</span><span class=cF0> color)
|
|
<a name="l135"></a>{
|
|
<a name="l136"></a> PObj *tmpo = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PObj</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l137"></a>
|
|
<a name="l138"></a> tmpo->type = type;
|
|
<a name="l139"></a> tmpo->color = color;
|
|
<a name="l140"></a> pf->o_counts[type]++;
|
|
<a name="l141"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpo, pf->o_head.last);
|
|
<a name="l142"></a>
|
|
<a name="l143"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
|
|
<a name="l144"></a>}
|
|
<a name="l145"></a>
|
|
<a name="l146"></a></span><span class=cF1>U0</span><span class=cF0> PObjDel(PickFrame *pf, PObj *tmpo)
|
|
<a name="l147"></a>{
|
|
<a name="l148"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpo);
|
|
<a name="l149"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpo->type)
|
|
<a name="l150"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l151"></a> </span><span class=cF1>case</span><span class=cF0> PTY_SPRITE:
|
|
<a name="l152"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo->g.r);
|
|
<a name="l153"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo->g.dr);
|
|
<a name="l154"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l155"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l156"></a> pf->o_counts[tmpo->type]--;
|
|
<a name="l157"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo);
|
|
<a name="l158"></a>}
|
|
<a name="l159"></a>
|
|
<a name="l160"></a>PObj *PPtNew(PickFrame *pf, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l161"></a>{
|
|
<a name="l162"></a> PObj *tmpo = PObjNew(pf, PTY_PT, </span><span class=cF3>BLACK</span><span class=cF0>);
|
|
<a name="l163"></a>
|
|
<a name="l164"></a> tmpo->p.p.x = x;
|
|
<a name="l165"></a> tmpo->p.p.y = y;
|
|
<a name="l166"></a>
|
|
<a name="l167"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
|
|
<a name="l168"></a>}
|
|
<a name="l169"></a>
|
|
<a name="l170"></a>PObj *PPtNum(PickFrame *pf, </span><span class=cF9>I64</span><span class=cF0> num)
|
|
<a name="l171"></a>{
|
|
<a name="l172"></a> PObj *tmpo = pf->o_head.next;
|
|
<a name="l173"></a>
|
|
<a name="l174"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &pf->o_head)
|
|
<a name="l175"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo->type == PTY_PT && !num--)
|
|
<a name="l177"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
|
|
<a name="l178"></a> tmpo = tmpo->next;
|
|
<a name="l179"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l180"></a>
|
|
<a name="l181"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l182"></a>}
|
|
<a name="l183"></a>
|
|
<a name="l184"></a>PObj *PPtFind(PickFrame *pf, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l185"></a>{
|
|
<a name="l186"></a> </span><span class=cF9>I64</span><span class=cF0> dd, best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l187"></a> PObj *tmpo = pf->o_head.next, *res = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l188"></a>
|
|
<a name="l189"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &pf->o_head)
|
|
<a name="l190"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo->type == PTY_PT)
|
|
<a name="l192"></a> {
|
|
<a name="l193"></a> dd = </span><span class=cF5>SqrI64</span><span class=cF0>(tmpo->p.p.x - x) + </span><span class=cF5>SqrI64</span><span class=cF0>(tmpo->p.p.y - y);
|
|
<a name="l194"></a> </span><span class=cF1>if</span><span class=cF0> (dd < best_dd)
|
|
<a name="l195"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l196"></a> best_dd = dd;
|
|
<a name="l197"></a> res = tmpo;
|
|
<a name="l198"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l199"></a> }
|
|
<a name="l200"></a> tmpo = tmpo->next;
|
|
<a name="l201"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l202"></a>
|
|
<a name="l203"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l204"></a>}
|
|
<a name="l205"></a>
|
|
<a name="l206"></a>PObj *PCircleNew(PickFrame *pf, </span><span class=cF9>I64</span><span class=cF0> p_num, </span><span class=cF9>I64</span><span class=cF0> r)
|
|
<a name="l207"></a>{
|
|
<a name="l208"></a> PObj *tmpo = PObjNew(pf, PTY_CIRCLE, </span><span class=cF3>RED</span><span class=cF0>);
|
|
<a name="l209"></a>
|
|
<a name="l210"></a> tmpo->c.p = PPtNum(pf, p_num);
|
|
<a name="l211"></a> tmpo->c.radius = r;
|
|
<a name="l212"></a>
|
|
<a name="l213"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
|
|
<a name="l214"></a>}
|
|
<a name="l215"></a>
|
|
<a name="l216"></a>PObj *PLineNew(PickFrame *pf, </span><span class=cF9>I64</span><span class=cF0> p1_num, </span><span class=cF9>I64</span><span class=cF0> p2_num)
|
|
<a name="l217"></a>{
|
|
<a name="l218"></a> PObj *tmpo = PObjNew(pf, PTY_LINE, </span><span class=cF3>GREEN</span><span class=cF0>);
|
|
<a name="l219"></a>
|
|
<a name="l220"></a> tmpo->l.p1 = PPtNum(pf, p1_num);
|
|
<a name="l221"></a> tmpo->l.p2 = PPtNum(pf, p2_num);
|
|
<a name="l222"></a>
|
|
<a name="l223"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
|
|
<a name="l224"></a>}
|
|
<a name="l225"></a>
|
|
<a name="l226"></a>PObj *PCSpriteNew(PickFrame *pf, </span><span class=cF1>U8</span><span class=cF0> *img, </span><span class=cF9>I64</span><span class=cF0> p_num, </span><span class=cF9>I64</span><span class=cF0> *r, </span><span class=cF9>I64</span><span class=cF0> *dr)
|
|
<a name="l227"></a>{
|
|
<a name="l228"></a> PObj *tmpo = PObjNew(pf, PTY_SPRITE, </span><span class=cF3>BLACK</span><span class=cF0>);
|
|
<a name="l229"></a>
|
|
<a name="l230"></a> tmpo->g.p = PPtNum(pf, p_num);
|
|
<a name="l231"></a> tmpo->g.img = img;
|
|
<a name="l232"></a> tmpo->g.r = r;
|
|
<a name="l233"></a> tmpo->g.dr = dr;
|
|
<a name="l234"></a>
|
|
<a name="l235"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
|
|
<a name="l236"></a>}
|
|
<a name="l237"></a>
|
|
<a name="l238"></a>PickFrame *Init()
|
|
<a name="l239"></a>{
|
|
<a name="l240"></a> PickFrame *pf = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PickFrame</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l241"></a> </span><span class=cF9>I64</span><span class=cF0> i, *r, *dr;
|
|
<a name="l242"></a>
|
|
<a name="l243"></a> pf->cx = </span><span class=cF5>Fs</span><span class=cF0>->pix_width >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l244"></a> pf->cy = </span><span class=cF5>Fs</span><span class=cF0>->pix_height >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l245"></a>
|
|
<a name="l246"></a> pf->o_head.next = pf->o_head.last = &pf->o_head;
|
|
<a name="l247"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>50</span><span class=cF0>; i++)
|
|
<a name="l248"></a> PPtNew(pf, </span><span class=cF5>RandI32</span><span class=cF0> % </span><span class=cF7>(</span><span class=cF0>pf->cx - BORDER</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>RandI32</span><span class=cF0> % </span><span class=cF7>(</span><span class=cF0>pf->cy - BORDER</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l249"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>20</span><span class=cF0>; i++)
|
|
<a name="l250"></a> PCircleNew(pf, pf->o_counts[PTY_PT] * </span><span class=cF5>RandU16</span><span class=cF0> / </span><span class=cF3>U16_MAX</span><span class=cF0>, </span><span class=cFE>6</span><span class=cF0>);
|
|
<a name="l251"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>20</span><span class=cF0>; i++)
|
|
<a name="l252"></a> PLineNew(pf, pf->o_counts[PTY_PT] * </span><span class=cF5>RandU16</span><span class=cF0> / </span><span class=cF3>U16_MAX</span><span class=cF0>, pf->o_counts[PTY_PT] * </span><span class=cF5>RandU16</span><span class=cF0> / </span><span class=cF3>U16_MAX</span><span class=cF0>);
|
|
<a name="l253"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>10</span><span class=cF0>; i++)
|
|
<a name="l254"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l255"></a> r = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
|
|
<a name="l256"></a> dr = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
|
|
<a name="l257"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dr, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>05</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l258"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(dr, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>05</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l259"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dr, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>05</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l260"></a> PCSpriteNew(pf, imgs[IMGS_NUM * </span><span class=cF5>RandU16</span><span class=cF0> / </span><span class=cF3>U16_MAX</span><span class=cF0>], pf->o_counts[PTY_PT] * </span><span class=cF5>RandU16</span><span class=cF0> / </span><span class=cF3>U16_MAX</span><span class=cF0>, r, dr);
|
|
<a name="l261"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l262"></a> </span><span class=cF5>FramePtrSet</span><span class=cF0>(</span><span class=cF6>"PickFrame"</span><span class=cF0>, pf);
|
|
<a name="l263"></a>
|
|
<a name="l264"></a> </span><span class=cF1>return</span><span class=cF0> pf;
|
|
<a name="l265"></a>}
|
|
<a name="l266"></a>
|
|
<a name="l267"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp(PickFrame *pf)
|
|
<a name="l268"></a>{
|
|
<a name="l269"></a> PObj *tmpo = pf->o_head.next, *tmpo1;
|
|
<a name="l270"></a>
|
|
<a name="l271"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &pf->o_head)
|
|
<a name="l272"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l273"></a> tmpo1 = tmpo->next;
|
|
<a name="l274"></a> PObjDel(pf, tmpo);
|
|
<a name="l275"></a> tmpo = tmpo1;
|
|
<a name="l276"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l277"></a> </span><span class=cF5>Free</span><span class=cF0>(pf);
|
|
<a name="l278"></a>}
|
|
<a name="l279"></a>
|
|
<a name="l280"></a></span><span class=cF1>U0</span><span class=cF0> Pick3D()
|
|
<a name="l281"></a>{
|
|
<a name="l282"></a> </span><span class=cF9>I64</span><span class=cF0> message_code, arg1, arg2;
|
|
<a name="l283"></a> PObj *tmpo;
|
|
<a name="l284"></a> PickFrame *pf = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l285"></a>
|
|
<a name="l286"></a> </span><span class=cF5>FramePtrAdd</span><span class=cF0>(</span><span class=cF6>"PickFrame"</span><span class=cF0>);
|
|
<a name="l287"></a>
|
|
<a name="l288"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l289"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l290"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l291"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l292"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l293"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l294"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l295"></a> );
|
|
<a name="l296"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l297"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l298"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l299"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l300"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l301"></a> </span><span class=cF6>"$BK,1$Move things around.$BK,0$\n"</span><span class=cF0>;
|
|
<a name="l302"></a> pf = Init;
|
|
<a name="l303"></a> tmpo = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l304"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit = </span><span class=cF3>WIG_TASK_DEFAULT</span><span class=cF0> - </span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0> - </span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0> - </span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>;
|
|
<a name="l305"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l306"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l307"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l308"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l309"></a> {
|
|
<a name="l310"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code = </span><span class=cF5>MessageGet</span><span class=cF7>(</span><span class=cF0>&arg1, &arg2, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> |
|
|
<a name="l311"></a> </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l312"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l313"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l314"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l315"></a> {
|
|
<a name="l316"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l317"></a> CleanUp(pf);
|
|
<a name="l318"></a> pf = Init;
|
|
<a name="l319"></a> tmpo = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l320"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l321"></a>
|
|
<a name="l322"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l323"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l324"></a> </span><span class=cF1>goto</span><span class=cF0> pd_done;
|
|
<a name="l325"></a> }
|
|
<a name="l326"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l327"></a>
|
|
<a name="l328"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
|
|
<a name="l329"></a> tmpo = PPtFind(pf, arg1 - pf->cx, arg2 - pf->cy);
|
|
<a name="l330"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l331"></a>
|
|
<a name="l332"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>:
|
|
<a name="l333"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo)
|
|
<a name="l334"></a> {
|
|
<a name="l335"></a> tmpo->p.p.x = arg1 - pf->cx;
|
|
<a name="l336"></a> tmpo->p.p.y = arg2 - pf->cy;
|
|
<a name="l337"></a> tmpo = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l338"></a> }
|
|
<a name="l339"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l340"></a>
|
|
<a name="l341"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
|
|
<a name="l342"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo)
|
|
<a name="l343"></a> {
|
|
<a name="l344"></a> tmpo->p.p.x = arg1 - pf->cx;
|
|
<a name="l345"></a> tmpo->p.p.y = arg2 - pf->cy;
|
|
<a name="l346"></a> }
|
|
<a name="l347"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l348"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l349"></a> }
|
|
<a name="l350"></a>pd_done:
|
|
<a name="l351"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
|
|
<a name="l352"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l353"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l354"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l355"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l356"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l357"></a> CleanUp(pf);
|
|
<a name="l358"></a> </span><span class=cF5>FramePtrDel</span><span class=cF0>(</span><span class=cF6>"PickFrame"</span><span class=cF0>);
|
|
<a name="l359"></a>}
|
|
<a name="l360"></a>
|
|
<a name="l361"></a>Pick3D;
|
|
</span></pre></body>
|
|
</html>
|