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

241 lines
26 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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/Scrn&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>GrSetUpTables</span><span class=cF0>()
<a name="l4"></a>{
<a name="l5"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc;
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,k,l,m,x,y,rr;
<a name="l7"></a> </span><span class=cF1>U8</span><span class=cF0> *dst;
<a name="l8"></a>
<a name="l9"></a> k=0;
<a name="l10"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;256;i++)
<a name="l11"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;8;j++)
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;i,j</span><span class=cF7>)</span><span class=cF0>)
<a name="l13"></a> </span><span class=cFB>gr</span><span class=cF0>.to_8_bits(</span><span class=cF1>U8</span><span class=cF0> *)[k++]=0xFF;
<a name="l14"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l15"></a> </span><span class=cFB>gr</span><span class=cF0>.to_8_bits(</span><span class=cF1>U8</span><span class=cF0> *)[k++]=0x00;
<a name="l16"></a> k=0;
<a name="l17"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;256;i++)
<a name="l18"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;8;j++)
<a name="l19"></a> </span><span class=cFB>gr</span><span class=cF0>.to_8_colors(</span><span class=cF1>U8</span><span class=cF0> *)[k++]=i;
<a name="l20"></a>
<a name="l21"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l22"></a> k=i+1;
<a name="l23"></a>
<a name="l24"></a> rr=k*k;
<a name="l25"></a> </span><span class=cF1>for</span><span class=cF0> (y=1;y&lt;k;y++)
<a name="l26"></a> </span><span class=cF1>for</span><span class=cF0> (x=1;x&lt;k;x++)
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y*2-k</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x*2-k</span><span class=cF7>)</span><span class=cF0>&lt;rr) {
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (x-1-i&gt;&gt;1&lt;</span><span class=cFB>gr</span><span class=cF0>.circle_lo[i][i-y])
<a name="l29"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_lo[i][i-y]=x-1-i&gt;&gt;1;
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (x-1-i&gt;&gt;1&gt;</span><span class=cFB>gr</span><span class=cF0>.circle_hi[i][i-y])
<a name="l31"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[i][i-y]=x-1-i&gt;&gt;1;
<a name="l32"></a> }
<a name="l33"></a>
<a name="l34"></a> dc=</span><span class=cF5>DCNew</span><span class=cF0>(i,i);
<a name="l35"></a> </span><span class=cFB>gr</span><span class=cF0>.pen_brushes[i]=dc;
<a name="l36"></a> dc-&gt;color=</span><span class=cF3>COLOR_MONO</span><span class=cF0>;
<a name="l37"></a> rr=k*k;
<a name="l38"></a> </span><span class=cF1>for</span><span class=cF0> (y=1;y&lt;k;y++)
<a name="l39"></a> </span><span class=cF1>for</span><span class=cF0> (x=1;x&lt;k;x++)
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y*2-k</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x*2-k</span><span class=cF7>)</span><span class=cF0>&lt;rr)
<a name="l41"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x-1,y-1);
<a name="l42"></a>
<a name="l43"></a> dc=</span><span class=cF5>DCNew</span><span class=cF0>(i,i);
<a name="l44"></a> </span><span class=cFB>gr</span><span class=cF0>.collision_pen_brushes[i]=dc;
<a name="l45"></a> dc-&gt;color=</span><span class=cF3>COLOR_INVALID</span><span class=cF0>;</span><span class=cF2>//Want color that never occurs.</span><span class=cF0>
<a name="l46"></a> rr=k*k;
<a name="l47"></a> </span><span class=cF1>for</span><span class=cF0> (y=1;y&lt;k;y++)
<a name="l48"></a> </span><span class=cF1>for</span><span class=cF0> (x=1;x&lt;k;x++)
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y*2-k</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x*2-k</span><span class=cF7>)</span><span class=cF0>&lt;rr)
<a name="l50"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x-1,y-1);
<a name="l51"></a>
<a name="l52"></a> dc=</span><span class=cF5>DCNew</span><span class=cF0>(i,i);
<a name="l53"></a> </span><span class=cFB>gr</span><span class=cF0>.even_pen_brushes[i]=dc;
<a name="l54"></a> dc-&gt;color=</span><span class=cF3>COLOR_MONO</span><span class=cF0>;
<a name="l55"></a> rr=k*k;
<a name="l56"></a> </span><span class=cF1>for</span><span class=cF0> (y=1;y&lt;k;y++)
<a name="l57"></a> </span><span class=cF1>for</span><span class=cF0> (x=1;x&lt;k;x++)
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>x-1</span><span class=cF7>)</span><span class=cF0>^</span><span class=cF7>(</span><span class=cF0>y-1</span><span class=cF7>)</span><span class=cF0>)&amp;1</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y*2-k</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x*2-k</span><span class=cF7>)</span><span class=cF0>&lt;rr)
<a name="l59"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x-1,y-1);
<a name="l60"></a>
<a name="l61"></a> dc=</span><span class=cF5>DCNew</span><span class=cF0>(i,i);
<a name="l62"></a> </span><span class=cFB>gr</span><span class=cF0>.odd_pen_brushes[i]=dc;
<a name="l63"></a> dc-&gt;color=</span><span class=cF3>COLOR_MONO</span><span class=cF0>;
<a name="l64"></a> rr=k*k;
<a name="l65"></a> </span><span class=cF1>for</span><span class=cF0> (y=1;y&lt;k;y++)
<a name="l66"></a> </span><span class=cF1>for</span><span class=cF0> (x=1;x&lt;k;x++)
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>(x-1)^(y-1)</span><span class=cF7>)</span><span class=cF0>&amp;1 &amp;&amp; </span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y*2-k</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x*2-k</span><span class=cF7>)</span><span class=cF0>&lt;rr)
<a name="l68"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x-1,y-1);
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>,</span><span class=cF3>RLf_VGA</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//if text mode</span><span class=cF0>
<a name="l71"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.vga_text_alias,0,</span><span class=cF3>TEXT_ROWS</span><span class=cF0>*</span><span class=cF3>TEXT_COLS</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>U16</span><span class=cF7>)</span><span class=cF0>);
<a name="l72"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.vga_text_cache,0,</span><span class=cF3>TEXT_ROWS</span><span class=cF0>*</span><span class=cF3>TEXT_COLS</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>U16</span><span class=cF7>)</span><span class=cF0>);
<a name="l73"></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="l74"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_IDX</span><span class=cF0>,</span><span class=cF3>VGAR_MAP_MASK</span><span class=cF0>);
<a name="l75"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_DATA</span><span class=cF0>,0x0F);
<a name="l76"></a></span><span class=cF2>//Virtual Box crashes on the following for some reason.</span><span class=cF0>
<a name="l77"></a> </span><span class=cF2>//</span><span class=cF0> </span><span class=cF2> MemSet(text.vga_alias,0,GR_HEIGHT*GR_WIDTH&gt;&gt;3);</span><span class=cF0>
<a name="l78"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.scrn_image-&gt;body,0,</span><span class=cF3>GR_WIDTH</span><span class=cF0>*</span><span class=cF3>GR_HEIGHT</span><span class=cF0>&gt;&gt;1);
<a name="l79"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l80"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;=</span><span class=cF3>GR_SCRN_ZOOM_MAX</span><span class=cF0>;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l81"></a> dst=</span><span class=cFB>gr</span><span class=cF0>.scrn_zoom_tables[i]=</span><span class=cF5>MAlloc</span><span class=cF0>(256*i);
<a name="l82"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;256;j++) {
<a name="l83"></a> m=0;
<a name="l84"></a> </span><span class=cF1>for</span><span class=cF0> (k=0;k&lt;8;k++) </span><span class=cF7>{</span><span class=cF0>
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;j,k</span><span class=cF7>)</span><span class=cF0>) {
<a name="l86"></a> </span><span class=cF1>for</span><span class=cF0> (l=0;l&lt;i;l++)
<a name="l87"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;m,l+k*i);
<a name="l88"></a> }
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>for</span><span class=cF0> (l=0;l&lt;i;l++)
<a name="l91"></a> dst[j+l*256]=m.u8[l];
<a name="l92"></a> }
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l94"></a>}
<a name="l95"></a>
<a name="l96"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics/Scrn;Windows&quot;</span><span class=cF0>
<a name="l97"></a>
<a name="l98"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinZBufFill</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
<a name="l99"></a>{</span><span class=cF2>//Not public</span><span class=cF0>
<a name="l100"></a> </span><span class=cF9>I64</span><span class=cF0> y,t,b,l,r,w;
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;display_flags,</span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_top-1&gt;0)
<a name="l103"></a> t=task-&gt;win_top-1;
<a name="l104"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l105"></a> t=0;
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_bottom+1&lt;</span><span class=cF3>TEXT_ROWS</span><span class=cF0>)
<a name="l107"></a> b=task-&gt;win_bottom+1;
<a name="l108"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l109"></a> b=</span><span class=cF3>TEXT_ROWS</span><span class=cF0>-1;
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_left-1&gt;0)
<a name="l111"></a> l=task-&gt;win_left-1;
<a name="l112"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l113"></a> l=0;
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_right+1&lt;</span><span class=cF3>TEXT_COLS</span><span class=cF0>)
<a name="l115"></a> r=task-&gt;win_right+1;
<a name="l116"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l117"></a> r=</span><span class=cF3>TEXT_COLS</span><span class=cF0>-1;
<a name="l118"></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="l119"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_top&gt;0)
<a name="l120"></a> t=task-&gt;win_top;
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l122"></a> t=0;
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_bottom&lt;</span><span class=cF3>TEXT_ROWS</span><span class=cF0>)
<a name="l124"></a> b=task-&gt;win_bottom;
<a name="l125"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l126"></a> b=</span><span class=cF3>TEXT_ROWS</span><span class=cF0>-1;
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_left&gt;0)
<a name="l128"></a> l=task-&gt;win_left;
<a name="l129"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l130"></a> l=0;
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_right&lt;</span><span class=cF3>TEXT_COLS</span><span class=cF0>)
<a name="l132"></a> r=task-&gt;win_right;
<a name="l133"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l134"></a> r=</span><span class=cF3>TEXT_COLS</span><span class=cF0>-1;
<a name="l135"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l136"></a> t=</span><span class=cF5>ClampI64</span><span class=cF0>(t,0,</span><span class=cF3>TEXT_ROWS</span><span class=cF0>-1);
<a name="l137"></a> b=</span><span class=cF5>ClampI64</span><span class=cF0>(b,t,</span><span class=cF3>TEXT_ROWS</span><span class=cF0>-1);
<a name="l138"></a> l=</span><span class=cF5>ClampI64</span><span class=cF0>(l,0,</span><span class=cF3>TEXT_COLS</span><span class=cF0>-1);
<a name="l139"></a> r=</span><span class=cF5>ClampI64</span><span class=cF0>(r,l,</span><span class=cF3>TEXT_COLS</span><span class=cF0>-1);
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (w=r-l+1)
<a name="l141"></a> </span><span class=cF1>for</span><span class=cF0> (y=t;y&lt;=b;y++)
<a name="l142"></a> </span><span class=cF5>MemSetU16</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.win_z_buf</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF7>(</span><span class=cF0>y*</span><span class=cF3>TEXT_COLS</span><span class=cF0>+l</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>U16</span><span class=cF7>)</span><span class=cF0>,
<a name="l143"></a> task-&gt;win_z_num,w);
<a name="l144"></a>}
<a name="l145"></a>
<a name="l146"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>()
<a name="l147"></a>{</span><span class=cF2>//Might have to call if doing graphics outside winmgr callback routines.</span><span class=cF0>
<a name="l148"></a></span><span class=cF2>//Call it if, for example, when a pop-up window closes and you need to refresh</span><span class=cF0>
<a name="l149"></a> </span><span class=cF2>//before graphics.</span><span class=cF0>
<a name="l150"></a> </span><span class=cF9>I64</span><span class=cF0> i,z=1;
<a name="l151"></a> </span><span class=cF9>U16</span><span class=cF0> *ptr;
<a name="l152"></a> </span><span class=cF9>CTask</span><span class=cF0> *task,*task1;
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>gr</span><span class=cF0>.win_z_buf) </span><span class=cF7>{</span><span class=cF0>
<a name="l154"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_UPDATE_WIN_Z_BUF</span><span class=cF0>],0);
<a name="l155"></a> task1=task=</span><span class=cFB>sys_winmgr_task</span><span class=cF0>;
<a name="l156"></a> </span><span class=cF1>do</span><span class=cF0> {
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF1>break</span><span class=cF0>;
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l159"></a> task-&gt;win_z_num=z++;
<a name="l160"></a> </span><span class=cF5>WinZBufFill</span><span class=cF0>(task);
<a name="l161"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l162"></a> task=task-&gt;next_task;
<a name="l163"></a> } </span><span class=cF1>while</span><span class=cF0> (task!=task1 &amp;&amp; z&lt;0x10000);
<a name="l164"></a>
<a name="l165"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.win_uncovered_bitmap,0,</span><span class=cF7>(</span><span class=cFB>gr</span><span class=cF0>.highest_uncovered+7</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3+1);
<a name="l166"></a> </span><span class=cFB>gr</span><span class=cF0>.highest_uncovered=z-1;
<a name="l167"></a> </span><span class=cF1>for</span><span class=cF0> (ptr=</span><span class=cFB>gr</span><span class=cF0>.win_z_buf,i=</span><span class=cF3>TEXT_ROWS</span><span class=cF0>*</span><span class=cF3>TEXT_COLS</span><span class=cF0>;i;i--)
<a name="l168"></a> </span><span class=cF5>Bts</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.win_uncovered_bitmap,*ptr++);
<a name="l169"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l170"></a>}
<a name="l171"></a>
<a name="l172"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics&quot;</span><span class=cF0>
<a name="l173"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrInit2</span><span class=cF0>()
<a name="l174"></a>{
<a name="l175"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;</span><span class=cFB>gr</span><span class=cF0>,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CGrGlbls</span><span class=cF7>)</span><span class=cF0>);
<a name="l176"></a> </span><span class=cFB>gr</span><span class=cF0>.sprite_hash=</span><span class=cF5>HashTableNew</span><span class=cF0>(512);
<a name="l177"></a> </span><span class=cF5>HashDefineLstAdd</span><span class=cF0>(</span><span class=cF6>&quot;ST_SPRITE_ELEM_CODES&quot;</span><span class=cF0>,</span><span class=cF3>SPHT_ELEM_CODE</span><span class=cF0>,</span><span class=cFB>gr</span><span class=cF0>.sprite_hash);
<a name="l178"></a> </span><span class=cFB>gr</span><span class=cF0>.scrn_zoom=1;
<a name="l179"></a>
<a name="l180"></a> </span><span class=cF5>PaletteSetStd</span><span class=cF0>;
<a name="l181"></a> </span><span class=cFB>fp_set_std_palette</span><span class=cF0>=&amp;</span><span class=cF5>PaletteSetStd</span><span class=cF0>;
<a name="l182"></a> </span><span class=cF5>GrPaletteIndicesSet</span><span class=cF0>;
<a name="l183"></a>
<a name="l184"></a> </span><span class=cFB>gr</span><span class=cF0>.to_8_bits =</span><span class=cF5>MAlloc</span><span class=cF0>(256*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l185"></a> </span><span class=cFB>gr</span><span class=cF0>.to_8_colors=</span><span class=cF5>MAlloc</span><span class=cF0>(256*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l186"></a>
<a name="l187"></a> </span><span class=cFB>gr</span><span class=cF0>.text_base=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>TEXT_ROWS</span><span class=cF0>*</span><span class=cF3>TEXT_COLS</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>U32</span><span class=cF7>)</span><span class=cF0>);
<a name="l188"></a> </span><span class=cFB>gr</span><span class=cF0>.vga_text_cache=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF3>TEXT_ROWS</span><span class=cF0>*</span><span class=cF3>TEXT_COLS</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>U16</span><span class=cF7>)</span><span class=cF0>);
<a name="l189"></a> </span><span class=cFB>gr</span><span class=cF0>.win_uncovered_bitmap=</span><span class=cF5>CAlloc</span><span class=cF0>(65536/8);
<a name="l190"></a> </span><span class=cFB>gr</span><span class=cF0>.highest_uncovered=0;
<a name="l191"></a> </span><span class=cFB>gr</span><span class=cF0>.win_z_buf=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF3>TEXT_ROWS</span><span class=cF0>*</span><span class=cF3>TEXT_COLS</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>U16</span><span class=cF7>)</span><span class=cF0>);
<a name="l192"></a>
<a name="l193"></a> </span><span class=cFB>gr</span><span class=cF0>.dc2=</span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF3>GR_HEIGHT</span><span class=cF0>);
<a name="l194"></a> </span><span class=cFB>gr</span><span class=cF0>.dc2-&gt;flags|=</span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>;
<a name="l195"></a> </span><span class=cFB>gr</span><span class=cF0>.dc_cache=</span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF3>GR_HEIGHT</span><span class=cF0>);
<a name="l196"></a>
<a name="l197"></a> </span><span class=cFB>gr</span><span class=cF0>.dc=</span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF3>GR_HEIGHT</span><span class=cF0>);
<a name="l198"></a> </span><span class=cFB>gr</span><span class=cF0>.dc-&gt;flags|=</span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>|</span><span class=cF3>DCF_ON_TOP</span><span class=cF0>;
<a name="l199"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
<a name="l200"></a>
<a name="l201"></a> </span><span class=cFB>gr</span><span class=cF0>.dc1=</span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF3>GR_HEIGHT</span><span class=cF0>);
<a name="l202"></a> </span><span class=cFB>gr</span><span class=cF0>.dc1-&gt;flags|=</span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>;
<a name="l203"></a>
<a name="l204"></a> </span><span class=cFB>gr</span><span class=cF0>.scrn_image=</span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF3>GR_HEIGHT</span><span class=cF0>); </span><span class=cF2>//4-bit</span><span class=cF0>
<a name="l205"></a> </span><span class=cFB>gr</span><span class=cF0>.zoomed_dc =</span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF3>GR_HEIGHT</span><span class=cF0>); </span><span class=cF2>//4-bit</span><span class=cF0>
<a name="l206"></a> </span><span class=cFB>gr</span><span class=cF0>.zoomed_dc-&gt;flags|=</span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>;
<a name="l207"></a>}
<a name="l208"></a>
<a name="l209"></a></span><span class=cF5>GrInit2</span><span class=cF0>;
</span></pre></body>
</html>