Line 438:
Line 438:
* The purpose of eyes is to translate the '''mii.eyeType''' variable into the correct right and left eyebrow tile. For example if mii.eyeType returns 9, we would use '''eyes[mii.eyeType]''' to draw the left eye (tile 16) and '''95-eyes[mii.eyeType]''' to draw the right eye (tile 79).
* The purpose of eyes is to translate the '''mii.eyeType''' variable into the correct right and left eyebrow tile. For example if mii.eyeType returns 9, we would use '''eyes[mii.eyeType]''' to draw the left eye (tile 16) and '''95-eyes[mii.eyeType]''' to draw the right eye (tile 79).
* These tiles are used for all three image files to build up a full eye.
* These tiles are used for all three image files to build up a full eye.
+
+
+
=== Noses ===
+
The nose tile set contains the noses in tiles 0 thru 11.
+
+
* The nose array is called '''noses[12]'''. It has 12 elements and is defined as follows:
+
** int noses[12] = {5,0,2,3,7,6,4,10,8,9,1,11};
+
* The purpose of noses is to translate the '''mii.noseType''' variable into the correct nose tile. For example if mii.noseType returns 4, we would use '''noses[mii.noseType]''' to draw the correct nose (tile 7).
+
+
+
=== Mouth ===
+
The mouth tile set contains the lips in tiles 0 thru 23.
+
+
* The mouth array is called '''lips[24]'''. It has 24 elements and is defined as follows:
+
** int lips[24] = {6,1,14,16,17,5,10,12,7,13,8,19,23,11,22,18,9,15,21,2,20,3,4,0};
+
* The purpose of lips is to translate the '''mii.lipType''' variable into the correct lip tile. For example if mii.lipType returns 2, we would use '''lips[mii.lipType]''' to draw the correct mouth (tile 14).
+
* There is an additional check to see if lips[mii.lipType] = 1, 6, 11, 17, or 19 because those tiles have lip colors associated with them.
+
+
+
=== Facial Features ===
+
Like the hair tiles, this is also somewhat of a complicated animal! The facial features are stored in ''mii_features.png''. Some facial features depend on the type of head used and some do not. Therefore those features that are faceShape dependent have multiple tiles drawn to line up with the correct faceShape. Features that are the same for all faceShapes are drawn just once.
+
+
* An IF statement is used to determine what tile to draw based on each facial feature.
+
** if(mii.facialFeature==0) feature=39;
+
:: else if(mii.facialFeature==1) feature=mii.faceShape;
+
:: else if(mii.facialFeature==2) feature=mii.faceShape;
+
:: else if(mii.facialFeature==3) feature=33;
+
:: else if(mii.facialFeature==4) feature=34;
+
:: else if(mii.facialFeature==5) feature=35;
+
:: else if(mii.facialFeature==6) feature=36;
+
:: else if(mii.facialFeature==7) feature=40+mii.faceShape;
+
:: else if(mii.facialFeature==8) feature=38;
+
:: else if(mii.facialFeature==9) feature=8+mii.faceShape;
+
:: else if(mii.facialFeature==10) feature=16+mii.faceShape;
+
:: else if(mii.facialFeature==11) feature=24+mii.faceShape;
+
+
* As you can see, if mii.facialFeature returns a 0, there is no feature (tile 39 is a blank tile).
+
* If mii.facialFeature returns a 1, 2, 7, 9, 10, or 11: those are the features that are faceShape dependent so the proper tile number depends on the mii.faceShape variable.
+
* If mii.facialFeature is something else... then it just sets the tile to the correct number.
+
* There is a further check later on that if mii.facialFeature=2, then it is the makeup feature and makeup color is also needed.
== Putting it all together ==
== Putting it all together ==