ZealOS/docs/Apps/GrModels/ManGen.html
2021-07-03 02:51:43 -04:00

337 lines
37 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.05">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:courier;font-size:10pt">
<a name="l1"></a><span class=cF2>//Makes a mesh man.</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> VERTICES_NUM </span><span class=cFE>1024</span><span class=cF0>
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> TRIS_NUM </span><span class=cFE>1024</span><span class=cF0>
<a name="l5"></a>
<a name="l6"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF5>Man</span><span class=cF0>
<a name="l7"></a>{
<a name="l8"></a> </span><span class=cF9>I32</span><span class=cF0> vertex_count;
<a name="l9"></a> </span><span class=cF9>I32</span><span class=cF0> tri_count;
<a name="l10"></a> </span><span class=cF9>CD3I32</span><span class=cF0> v[VERTICES_NUM];
<a name="l11"></a> </span><span class=cF9>CMeshTri</span><span class=cF0> t[TRIS_NUM];
<a name="l12"></a>
<a name="l13"></a>} *m;
<a name="l14"></a>
<a name="l15"></a></span><span class=cF1>class</span><span class=cF0> ManDefineStruct
<a name="l16"></a>{
<a name="l17"></a> </span><span class=cF1>F64</span><span class=cF0> head_rad format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Head Radius :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l18"></a>
<a name="l19"></a> </span><span class=cF1>F64</span><span class=cF0> torso_len format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Torso Length :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l20"></a> </span><span class=cF1>F64</span><span class=cF0> arm_len format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Arm Length :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l21"></a> </span><span class=cF1>F64</span><span class=cF0> hand_len format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Hand Length :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF1>F64</span><span class=cF0> leg_len format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Leg Length :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF1>F64</span><span class=cF0> foot_len format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Foot Length :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l24"></a> </span><span class=cF1>F64</span><span class=cF0> torso_width format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Torso Width :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l25"></a> </span><span class=cF1>F64</span><span class=cF0> torso_depth format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Torso Depth :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l26"></a> </span><span class=cF1>F64</span><span class=cF0> arm_rad format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Arm Radius :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l27"></a> </span><span class=cF1>F64</span><span class=cF0> hand_rad format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Hand Radius :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l28"></a> </span><span class=cF1>F64</span><span class=cF0> leg_rad format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Leg Radius :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l29"></a> </span><span class=cF1>F64</span><span class=cF0> foot_rad format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Foot Radius :%8.3f\&quot;$\n\n&quot;</span><span class=cF0>;
<a name="l30"></a>
<a name="l31"></a> </span><span class=cF1>F64</span><span class=cF0> r_shoulder_a1 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Shoulder Front/Back Angle:%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l32"></a> </span><span class=cF1>F64</span><span class=cF0> l_shoulder_a1 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Shoulder Front/Back Angle:%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l33"></a> </span><span class=cF1>F64</span><span class=cF0> r_hip_a1 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Hip Front/Back Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l34"></a> </span><span class=cF1>F64</span><span class=cF0> l_hip_a1 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Hip Front/Back Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l35"></a>
<a name="l36"></a> </span><span class=cF1>F64</span><span class=cF0> r_shoulder_a2 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Shoulder Side Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l37"></a> </span><span class=cF1>F64</span><span class=cF0> l_shoulder_a2 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Shoulder Side Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l38"></a> </span><span class=cF1>F64</span><span class=cF0> r_hip_a2 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Hip Side Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l39"></a> </span><span class=cF1>F64</span><span class=cF0> l_hip_a2 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Hip Side Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l40"></a>
<a name="l41"></a> </span><span class=cF1>F64</span><span class=cF0> r_elbow_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Elbow Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l42"></a> </span><span class=cF1>F64</span><span class=cF0> l_elbow_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Elbow Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l43"></a> </span><span class=cF1>F64</span><span class=cF0> r_knee_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Knee Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l44"></a> </span><span class=cF1>F64</span><span class=cF0> l_knee_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Knee Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l45"></a>
<a name="l46"></a> </span><span class=cF1>F64</span><span class=cF0> r_wrist_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Wrist Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l47"></a> </span><span class=cF1>F64</span><span class=cF0> l_wrist_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Wrist Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l48"></a> </span><span class=cF1>F64</span><span class=cF0> r_ankle_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;R.Ankle Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l49"></a> </span><span class=cF1>F64</span><span class=cF0> l_ankle_a format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;L.Ankle Angle :%8.3f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l50"></a>
<a name="l51"></a>};
<a name="l52"></a>
<a name="l53"></a></span><span class=cF1>U0</span><span class=cF0> MDInit(ManDefineStruct *md)
<a name="l54"></a>{
<a name="l55"></a> </span><span class=cF5>MemSet</span><span class=cF0>(md,</span><span class=cFE>0</span><span class=cF0>,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>ManDefineStruct</span><span class=cF7>)</span><span class=cF0>);
<a name="l56"></a>
<a name="l57"></a> md-&gt;head_rad = </span><span class=cFE>5</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l58"></a>
<a name="l59"></a> md-&gt;torso_len = </span><span class=cFE>35</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l60"></a> md-&gt;arm_len = </span><span class=cFE>30</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l61"></a> md-&gt;hand_len = </span><span class=cFE>8</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l62"></a> md-&gt;leg_len = </span><span class=cFE>32</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l63"></a> md-&gt;foot_len = </span><span class=cFE>16</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l64"></a> md-&gt;torso_width = </span><span class=cFE>20</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l65"></a> md-&gt;torso_depth = </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l66"></a> md-&gt;arm_rad = </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>;
<a name="l67"></a> md-&gt;hand_rad = </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l68"></a> md-&gt;leg_rad = </span><span class=cFE>4</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l69"></a> md-&gt;foot_rad = </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l70"></a>
<a name="l71"></a> md-&gt;r_shoulder_a1 = </span><span class=cFE>30</span><span class=cF0>;
<a name="l72"></a> md-&gt;l_shoulder_a1 = -</span><span class=cFE>30</span><span class=cF0>;
<a name="l73"></a> md-&gt;r_hip_a1 = -</span><span class=cFE>45</span><span class=cF0>;
<a name="l74"></a> md-&gt;l_hip_a1 = </span><span class=cFE>45</span><span class=cF0>;
<a name="l75"></a>
<a name="l76"></a> md-&gt;r_shoulder_a2 = </span><span class=cFE>10</span><span class=cF0>;
<a name="l77"></a> md-&gt;l_shoulder_a2 = </span><span class=cFE>10</span><span class=cF0>;
<a name="l78"></a> md-&gt;r_hip_a2 = -</span><span class=cFE>5</span><span class=cF0>;
<a name="l79"></a> md-&gt;l_hip_a2 = -</span><span class=cFE>5</span><span class=cF0>;
<a name="l80"></a>
<a name="l81"></a> md-&gt;r_elbow_a = </span><span class=cFE>30</span><span class=cF0>;
<a name="l82"></a> md-&gt;l_elbow_a = </span><span class=cFE>0</span><span class=cF0>;
<a name="l83"></a> md-&gt;r_knee_a = </span><span class=cFE>0</span><span class=cF0>;
<a name="l84"></a> md-&gt;l_knee_a = </span><span class=cFE>30</span><span class=cF0>;
<a name="l85"></a>
<a name="l86"></a> md-&gt;r_wrist_a = </span><span class=cFE>0</span><span class=cF0>;
<a name="l87"></a> md-&gt;l_wrist_a = </span><span class=cFE>0</span><span class=cF0>;
<a name="l88"></a> md-&gt;r_ankle_a = </span><span class=cFE>0</span><span class=cF0>;
<a name="l89"></a> md-&gt;l_ankle_a = </span><span class=cFE>0</span><span class=cF0>;
<a name="l90"></a>}
<a name="l91"></a>
<a name="l92"></a></span><span class=cF1>U0</span><span class=cF0> MDCorrect(ManDefineStruct *md)
<a name="l93"></a>{
<a name="l94"></a> md-&gt;r_ankle_a = -md-&gt;r_ankle_a;
<a name="l95"></a> md-&gt;l_ankle_a = -md-&gt;l_ankle_a;
<a name="l96"></a> md-&gt;r_knee_a = -md-&gt;r_knee_a;
<a name="l97"></a> md-&gt;l_knee_a = -md-&gt;l_knee_a;
<a name="l98"></a> md-&gt;r_hip_a2 = -md-&gt;r_hip_a2;
<a name="l99"></a> md-&gt;r_shoulder_a2 = -md-&gt;r_shoulder_a2;
<a name="l100"></a> md-&gt;r_ankle_a += </span><span class=cFE>90</span><span class=cF0>;
<a name="l101"></a> md-&gt;l_ankle_a += </span><span class=cFE>90</span><span class=cF0>;
<a name="l102"></a>
<a name="l103"></a> md-&gt;foot_len -= md-&gt;leg_rad;
<a name="l104"></a>
<a name="l105"></a> md-&gt;r_elbow_a += md-&gt;r_shoulder_a1;
<a name="l106"></a> md-&gt;l_elbow_a += md-&gt;l_shoulder_a1;
<a name="l107"></a> md-&gt;r_knee_a += md-&gt;r_hip_a1;
<a name="l108"></a> md-&gt;l_knee_a += md-&gt;l_hip_a1;
<a name="l109"></a>
<a name="l110"></a> md-&gt;r_wrist_a += md-&gt;r_elbow_a;
<a name="l111"></a> md-&gt;l_wrist_a += md-&gt;l_elbow_a;
<a name="l112"></a> md-&gt;r_ankle_a += md-&gt;r_knee_a;
<a name="l113"></a> md-&gt;l_ankle_a += md-&gt;l_knee_a;
<a name="l114"></a>}
<a name="l115"></a>
<a name="l116"></a></span><span class=cF9>I64</span><span class=cF0> AddVertex(ManDefineStruct *md, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>I64</span><span class=cF0> z)
<a name="l117"></a>{
<a name="l118"></a> </span><span class=cF9>I64</span><span class=cF0> res = m-&gt;vertex_count++;
<a name="l119"></a>
<a name="l120"></a> m-&gt;v[res].x = -x;
<a name="l121"></a> m-&gt;v[res].y = -y - md-&gt;leg_len - md-&gt;foot_rad * </span><span class=cFE>2</span><span class=cF0>;
<a name="l122"></a> m-&gt;v[res].z = -z;
<a name="l123"></a>
<a name="l124"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l125"></a>}
<a name="l126"></a>
<a name="l127"></a></span><span class=cF9>I64</span><span class=cF0> AddTri(ManDefineStruct *, </span><span class=cF9>I64</span><span class=cF0> c, </span><span class=cF9>I64</span><span class=cF0> n0, </span><span class=cF9>I64</span><span class=cF0> n1, </span><span class=cF9>I64</span><span class=cF0> n2)
<a name="l128"></a>{
<a name="l129"></a> </span><span class=cF9>I64</span><span class=cF0> res = m-&gt;tri_count++;
<a name="l130"></a>
<a name="l131"></a> m-&gt;t[res].color = c;
<a name="l132"></a> m-&gt;t[res].nums[</span><span class=cFE>0</span><span class=cF0>] = n1;
<a name="l133"></a> m-&gt;t[res].nums[</span><span class=cFE>1</span><span class=cF0>] = n0;
<a name="l134"></a> m-&gt;t[res].nums[</span><span class=cFE>2</span><span class=cF0>] = n2;
<a name="l135"></a>
<a name="l136"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l137"></a>}
<a name="l138"></a>
<a name="l139"></a></span><span class=cF1>U0</span><span class=cF0> AddBox(ManDefineStruct *md, </span><span class=cF9>I64</span><span class=cF0> c,
<a name="l140"></a> </span><span class=cF9>I64</span><span class=cF0> x1, </span><span class=cF9>I64</span><span class=cF0> y1, </span><span class=cF9>I64</span><span class=cF0> z1, </span><span class=cF1>F64</span><span class=cF0> w, </span><span class=cF1>F64</span><span class=cF0> h, </span><span class=cF1>F64</span><span class=cF0> d, </span><span class=cF1>F64</span><span class=cF0> h2, </span><span class=cF1>F64</span><span class=cF0> h3, </span><span class=cF1>F64</span><span class=cF0> az, </span><span class=cF1>F64</span><span class=cF0> ay, </span><span class=cF1>F64</span><span class=cF0> ax, </span><span class=cF9>I64</span><span class=cF0> *ox, </span><span class=cF9>I64</span><span class=cF0> *oy, </span><span class=cF9>I64</span><span class=cF0> *oz)
<a name="l141"></a>{
<a name="l142"></a> </span><span class=cF9>I64</span><span class=cF0> *r;
<a name="l143"></a> </span><span class=cF9>I64</span><span class=cF0> p1a, p2a, p3a, p4a;
<a name="l144"></a> </span><span class=cF9>I64</span><span class=cF0> p1b, p2b, p3b, p4b;
<a name="l145"></a> </span><span class=cF9>I64</span><span class=cF0> wx = w / </span><span class=cFE>2</span><span class=cF0>, wy = </span><span class=cFE>0</span><span class=cF0>, wz = </span><span class=cFE>0</span><span class=cF0>, hx = </span><span class=cFE>0</span><span class=cF0>, hy = h, hz = </span><span class=cFE>0</span><span class=cF0>, h2x = </span><span class=cFE>0</span><span class=cF0>, h2y = h2, h2z = </span><span class=cFE>0</span><span class=cF0>,
<a name="l146"></a> h3x = </span><span class=cFE>0</span><span class=cF0>, h3y = h3, h3z = </span><span class=cFE>0</span><span class=cF0>, dx = </span><span class=cFE>0</span><span class=cF0>, dy = </span><span class=cFE>0</span><span class=cF0>, dz = d / </span><span class=cFE>2</span><span class=cF0>;
<a name="l147"></a>
<a name="l148"></a> r = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
<a name="l149"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r, az * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l150"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r, ay * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l151"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r, ax * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l152"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;wx, &amp;wy, &amp;wz);
<a name="l153"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;hx, &amp;hy, &amp;hz);
<a name="l154"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;h2x, &amp;h2y, &amp;h2z);
<a name="l155"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;h3x, &amp;h3y, &amp;h3z);
<a name="l156"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &amp;dx, &amp;dy, &amp;dz);
<a name="l157"></a>
<a name="l158"></a> p1a = AddVertex(md, x1 + dx - wx + h2x, y1 + dy - wy + h2y, z1 + dz - wz + h2z);
<a name="l159"></a> p2a = AddVertex(md, x1 + dx + wx + h2x, y1 + dy + wy + h2y, z1 + dz + wz + h2z);
<a name="l160"></a> p3a = AddVertex(md, x1 + dx + hx - wx, y1 + dy + hy - wy, z1 + dz + hz - wz);
<a name="l161"></a> p4a = AddVertex(md, x1 + dx + hx + wx, y1 + dy + hy + wy, z1 + dz + hz + wz);
<a name="l162"></a> AddTri(md, c, p1a, p2a, p3a);
<a name="l163"></a> AddTri(md, c, p4a, p3a, p2a);
<a name="l164"></a>
<a name="l165"></a> p1b = AddVertex(md, x1 - dx - wx + h2x, y1 - dy - wy + h2y, z1 - dz - wz + h2z);
<a name="l166"></a> p2b = AddVertex(md, x1 - dx + wx + h2x, y1 - dy + wy + h2y, z1 - dz + wz + h2z);
<a name="l167"></a> p3b = AddVertex(md, x1 - dx + hx - wx, y1 - dy + hy - wy, z1 - dz + hz - wz);
<a name="l168"></a> p4b = AddVertex(md, x1 - dx + hx + wx, y1 - dy + hy + wy, z1 - dz + hz + wz);
<a name="l169"></a> AddTri(md, c, p1b, p2b, p3b);
<a name="l170"></a> AddTri(md, c, p4b, p3b, p2b);
<a name="l171"></a>
<a name="l172"></a> AddTri(md, c, p1a, p2a, p1b);
<a name="l173"></a> AddTri(md, c, p2b, p1b, p2a);
<a name="l174"></a> AddTri(md, c, p3a, p4a, p3b);
<a name="l175"></a> AddTri(md, c, p4b, p3b, p4a);
<a name="l176"></a> AddTri(md, c, p1a, p3a, p1b);
<a name="l177"></a> AddTri(md, c, p3b, p1b, p3a);
<a name="l178"></a> AddTri(md, c, p2a, p4a, p2b);
<a name="l179"></a> AddTri(md, c, p4b, p2b, p4a);
<a name="l180"></a>
<a name="l181"></a> *ox = x1 + hx - h3x;
<a name="l182"></a> *oy = y1 + hy - h3y;
<a name="l183"></a> *oz = z1 + hz - h3z;
<a name="l184"></a>
<a name="l185"></a> </span><span class=cF5>Free</span><span class=cF0>(r);
<a name="l186"></a>}
<a name="l187"></a>
<a name="l188"></a></span><span class=cF1>U8</span><span class=cF0> *Man2CSprite()
<a name="l189"></a>{
<a name="l190"></a></span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/Gr/GrSpritePlot.html#l1"><span class=cF4>::/System/Gr/GrSpritePlot.CC</span></a><span class=cF2> for how CSprite are stored.</span><span class=cF0>
<a name="l191"></a> </span><span class=cF1>U8</span><span class=cF0> *res = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CSpriteMeshU8s</span><span class=cF7>)</span><span class=cF0> +
<a name="l192"></a> m-&gt;vertex_count * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0> + m-&gt;tri_count * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshTri</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFB>sprite_elem_base_sizes</span><span class=cF0>[</span><span class=cF3>SPT_END</span><span class=cF0>]),
<a name="l193"></a> *dst = res;
<a name="l194"></a>
<a name="l195"></a> *dst++ = </span><span class=cF3>SPT_MESH</span><span class=cF0>;
<a name="l196"></a> *dst(</span><span class=cF9>I32</span><span class=cF0> *)++ = m-&gt;vertex_count;
<a name="l197"></a> *dst(</span><span class=cF9>I32</span><span class=cF0> *)++ = m-&gt;tri_count;
<a name="l198"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(dst, &amp;m-&gt;v, m-&gt;vertex_count * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
<a name="l199"></a> dst += m-&gt;vertex_count * </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CD3I32</span><span class=cF0>);
<a name="l200"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(dst, &amp;m-&gt;t, m-&gt;tri_count * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMeshTri</span><span class=cF7>)</span><span class=cF0>);
<a name="l201"></a> dst += m-&gt;tri_count * </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CMeshTri</span><span class=cF0>);
<a name="l202"></a> *dst++ = </span><span class=cF3>SPT_END</span><span class=cF0>;
<a name="l203"></a>
<a name="l204"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l205"></a>}
<a name="l206"></a>
<a name="l207"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *ManGen()
<a name="l208"></a>{
<a name="l209"></a> </span><span class=cF1>U8</span><span class=cF0> *res;
<a name="l210"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, z, c1, c2, c3, c4;
<a name="l211"></a> ManDefineStruct md1, md2;
<a name="l212"></a>
<a name="l213"></a> MDInit(&amp;md1);
<a name="l214"></a>
<a name="l215"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l216"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>DocForm</span><span class=cF7>(</span><span class=cF0>&amp;md1</span><span class=cF7>)</span><span class=cF0>)
<a name="l218"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l219"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;md2, &amp;md1, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>ManDefineStruct</span><span class=cF7>)</span><span class=cF0>);
<a name="l220"></a> MDCorrect(&amp;md2);
<a name="l221"></a>
<a name="l222"></a> c1 = </span><span class=cF5>PopUpColorLighting</span><span class=cF0>(</span><span class=cF6>&quot;$BK,1$Shirt$BK,0$\n&quot;</span><span class=cF0>);
<a name="l223"></a> </span><span class=cF1>if</span><span class=cF0> (c1 &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l224"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l225"></a> c2 = </span><span class=cF5>PopUpColorLighting</span><span class=cF0>(</span><span class=cF6>&quot;$BK,1$Pants$BK,0$\n&quot;</span><span class=cF0>);
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (c2 &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l227"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l228"></a> c3 = </span><span class=cF5>PopUpColorLighting</span><span class=cF0>(</span><span class=cF6>&quot;$BK,1$Skin$BK,0$\n&quot;</span><span class=cF0>);
<a name="l229"></a> </span><span class=cF1>if</span><span class=cF0> (c3 &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l230"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l231"></a> c4 = </span><span class=cF5>PopUpColorLighting</span><span class=cF0>(</span><span class=cF6>&quot;$BK,1$Shoes$BK,0$\n&quot;</span><span class=cF0>);
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (c4 &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l233"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l234"></a>
<a name="l235"></a> m = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF5>Man</span><span class=cF7>)</span><span class=cF0>);
<a name="l236"></a>
<a name="l237"></a> </span><span class=cF2>//Head</span><span class=cF0>
<a name="l238"></a> AddBox(&amp;md2, c3, </span><span class=cFE>0</span><span class=cF0>, md2.torso_len+md2.head_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l239"></a> md2.head_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.head_rad * </span><span class=cFE>2</span><span class=cF0>, md2.head_rad * </span><span class=cFE>2</span><span class=cF0>, </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>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l240"></a>
<a name="l241"></a> </span><span class=cF2>//Torso</span><span class=cF0>
<a name="l242"></a> AddBox(&amp;md2, c1, </span><span class=cFE>0</span><span class=cF0>, md2.torso_len, </span><span class=cFE>0</span><span class=cF0>, md2.torso_width, -md2.torso_len, md2.torso_depth, </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>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, &amp;x, &amp;y, &amp;z);
<a name="l243"></a>
<a name="l244"></a> </span><span class=cF2>//Right Arm</span><span class=cF0>
<a name="l245"></a> AddBox(&amp;md2, c1, -md2.torso_width / </span><span class=cFE>2</span><span class=cF0> - md2.arm_rad, md2.torso_len - md2.arm_rad, </span><span class=cFE>0</span><span class=cF0>,
<a name="l246"></a> md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.arm_len / </span><span class=cFE>2</span><span class=cF0>, md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, md2.arm_rad, </span><span class=cFE>0</span><span class=cF0>,
<a name="l247"></a> md2.r_shoulder_a2, </span><span class=cFE>0</span><span class=cF0>, md2.r_shoulder_a1, &amp;x, &amp;y, &amp;z);
<a name="l248"></a>
<a name="l249"></a> AddBox(&amp;md2, c3, x, y, z,
<a name="l250"></a> md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.arm_len / </span><span class=cFE>2</span><span class=cF0>, md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l251"></a> md2.r_shoulder_a2, </span><span class=cFE>0</span><span class=cF0>, md2.r_elbow_a, &amp;x, &amp;y, &amp;z);
<a name="l252"></a>
<a name="l253"></a> AddBox(&amp;md2, c3, x, y, z,
<a name="l254"></a> md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.hand_len, md2.hand_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l255"></a> md2.r_shoulder_a2, </span><span class=cFE>0</span><span class=cF0>, md2.r_wrist_a, &amp;x, &amp;y, &amp;z);
<a name="l256"></a>
<a name="l257"></a> </span><span class=cF2>//Left Arm</span><span class=cF0>
<a name="l258"></a> AddBox(&amp;md2, c1, md2.torso_width / </span><span class=cFE>2</span><span class=cF0> + md2.arm_rad, md2.torso_len - md2.arm_rad, </span><span class=cFE>0</span><span class=cF0>,
<a name="l259"></a> md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.arm_len / </span><span class=cFE>2</span><span class=cF0>, md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, md2.arm_rad, </span><span class=cFE>0</span><span class=cF0>,
<a name="l260"></a> md2.l_shoulder_a2, </span><span class=cFE>0</span><span class=cF0>, md2.l_shoulder_a1, &amp;x, &amp;y, &amp;z);
<a name="l261"></a>
<a name="l262"></a> AddBox(&amp;md2, c3, x, y, z,
<a name="l263"></a> md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.arm_len / </span><span class=cFE>2</span><span class=cF0>, md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l264"></a> md2.l_shoulder_a2, </span><span class=cFE>0</span><span class=cF0>, md2.l_elbow_a, &amp;x, &amp;y, &amp;z);
<a name="l265"></a>
<a name="l266"></a> AddBox(&amp;md2, c3, x, y, z,
<a name="l267"></a> md2.arm_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.hand_len, md2.hand_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l268"></a> md2.l_shoulder_a2, </span><span class=cFE>0</span><span class=cF0>, md2.l_wrist_a, &amp;x, &amp;y, &amp;z);
<a name="l269"></a>
<a name="l270"></a> </span><span class=cF2>//Right Leg</span><span class=cF0>
<a name="l271"></a> AddBox(&amp;md2, c2, -md2.torso_width / </span><span class=cFE>2</span><span class=cF0> + md2.leg_rad, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l272"></a> md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.leg_len / </span><span class=cFE>2</span><span class=cF0>, md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l273"></a> md2.r_hip_a2, </span><span class=cFE>0</span><span class=cF0>, md2.r_hip_a1, &amp;x, &amp;y, &amp;z);
<a name="l274"></a>
<a name="l275"></a> AddBox(&amp;md2, c3, x, y, z,
<a name="l276"></a> md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.leg_len / </span><span class=cFE>2</span><span class=cF0>, md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, md2.foot_rad,
<a name="l277"></a> md2.r_hip_a2, </span><span class=cFE>0</span><span class=cF0>, md2.r_knee_a, &amp;x, &amp;y, &amp;z);
<a name="l278"></a>
<a name="l279"></a> AddBox(&amp;md2, c4, x, y, z,
<a name="l280"></a> md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.foot_len, md2.foot_rad * </span><span class=cFE>2</span><span class=cF0>, md2.leg_rad, </span><span class=cFE>0</span><span class=cF0>,
<a name="l281"></a> md2.r_hip_a2, </span><span class=cFE>0</span><span class=cF0>, md2.r_ankle_a, &amp;x, &amp;y, &amp;z);
<a name="l282"></a>
<a name="l283"></a> </span><span class=cF2>//Left Leg</span><span class=cF0>
<a name="l284"></a> AddBox(&amp;md2, c2, md2.torso_width / </span><span class=cFE>2</span><span class=cF0> - md2.leg_rad, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l285"></a> md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.leg_len / </span><span class=cFE>2</span><span class=cF0>, md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l286"></a> md2.l_hip_a2, </span><span class=cFE>0</span><span class=cF0>, md2.l_hip_a1, &amp;x, &amp;y, &amp;z);
<a name="l287"></a>
<a name="l288"></a> AddBox(&amp;md2, c3, x, y, z,
<a name="l289"></a> md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.leg_len / </span><span class=cFE>2</span><span class=cF0>, md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, md2.foot_rad,
<a name="l290"></a> md2.l_hip_a2, </span><span class=cFE>0</span><span class=cF0>, md2.l_knee_a, &amp;x, &amp;y, &amp;z);
<a name="l291"></a>
<a name="l292"></a> AddBox(&amp;md2, c4, x, y, z,
<a name="l293"></a> md2.leg_rad * </span><span class=cFE>2</span><span class=cF0>, -md2.foot_len, md2.foot_rad * </span><span class=cFE>2</span><span class=cF0>, md2.leg_rad, </span><span class=cFE>0</span><span class=cF0>,
<a name="l294"></a> md2.l_hip_a2, </span><span class=cFE>0</span><span class=cF0>, md2.l_ankle_a, &amp;x, &amp;y, &amp;z);
<a name="l295"></a>
<a name="l296"></a> res = Man2CSprite;
<a name="l297"></a> </span><span class=cF6>&quot;%h7c&quot;</span><span class=cF0>, </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF5>Sprite</span><span class=cF0>(res, </span><span class=cF6>&quot;\t\t$SP,\&quot;&lt;1&gt;\&quot;,BI=%d$&quot;</span><span class=cF0>);
<a name="l299"></a> </span><span class=cF6>&quot;%h7c&quot;</span><span class=cF0>, </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l300"></a> </span><span class=cF5>Free</span><span class=cF0>(m);
<a name="l301"></a> </span><span class=cF6>&quot;Do another&quot;</span><span class=cF0>;
<a name="l302"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>YorN</span><span class=cF0>)
<a name="l303"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
<a name="l304"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l305"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l306"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l307"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l308"></a>}
</span></pre></body>
</html>