In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Changes

Jump to navigation Jump to search
Line 401: Line 401:  
=== Hair ===
 
=== Hair ===
 
Hair is probably the most complicated one.  Due to the large number of hair styles and file size limitations (1024 x 1024), the tiles had to be put onto two separate images (mii_hairs1.png and mii_hairs2.png). Hair also contains multiple layers with longer hair style having parts that I call background hair that goes behind the head (pony tails, long hair, etc) and then foreground hair which goes on top and in front of the head (most hair styles including bangs etc). ALL of the tiles in mii_hairs1.png are foreground hair parts as are the first 16 tiles of mii_hairs2.png.  The rest of mii_hairs2.png is background hair.
 
Hair is probably the most complicated one.  Due to the large number of hair styles and file size limitations (1024 x 1024), the tiles had to be put onto two separate images (mii_hairs1.png and mii_hairs2.png). Hair also contains multiple layers with longer hair style having parts that I call background hair that goes behind the head (pony tails, long hair, etc) and then foreground hair which goes on top and in front of the head (most hair styles including bangs etc). ALL of the tiles in mii_hairs1.png are foreground hair parts as are the first 16 tiles of mii_hairs2.png.  The rest of mii_hairs2.png is background hair.
The first array is for foreground hair and is called hairfg[72]. It has 72 elements and is defined as follows:
  −
int hairfg[72] = {59,42,65,49,40,44,52,47,45,63,51,54,36,37,48,70,61,56,64,43,53,58,50,27,69,41,39,46,66,71,33,11,12,0,35,57,30,14,25,4,1,31,26,24,3,6,62,13,15,7,19,2,17,67,29,20,9,34,18,8,22,60,23,55,21,32,16,28,10,38,5,68};
  −
The second array is for background hair and is called hairbg[72]. It has 72 elements and is defined as follows:
  −
int hairbg[72]={56,56,56,56,56,56,56,56,56,56,56,56,16,56,56,56,56,56,17,18,56,19,20,56,56,56,21,56,56,56,56,56,56,56,56,56,22,23,56,56,24,25,56,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,56,56,48,49,50,51,52,53,56};
     −
The purpose of hairfg is to translate the mii.hairType variable into the correct foreground hair sprite. For example: if mii.hairType returns 32 then we would use hairfg[mii.hairType] to get the proper tile which would be tile 12 (hairfg[32]=12). This would draw the correct fg hair tile from the mii.hairType variable.
+
* The first array is for foreground hair and is called hairfg[72]. It has 72 elements and is defined as follows:
 +
** int hairfg[72] = {59,42,65,49,40,44,52,47,45,63,51,54,36,37,48,70,61,56,64,43,53,58,50,27,69,41,39,46,66,71,33,11,12,0,35,57,30,14,25,4,1,31,26,24,3,6,62,13,15,7,19,2,17,67,29,20,9,34,18,8,22,60,23,55,21,32,16,28,10,38,5,68};
   −
The purpose of hairbg is to then take whatever foreground hair was drawn and add any corresponding background hair. For example we would use hairbg[hairfg[mii.hairType]] to get the correct background hair drawn.  So, using our above example mii.hairType 32 corresponds foreground hair 12 which has a corresponding background hair of 16 (hairbg[hairfg[32]]=16).
+
* The second array is for background hair and is called hairbg[72]. It has 72 elements and is defined as follows:
 +
** int hairbg[72]={56,56,56,56,56,56,56,56,56,56,56,56,16,56,56,56,56,56,17,18,56,19,20,56,56,56,21,56,56,56,56,56,56,56,56,56,22,23,56,56,24,25,56,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,56,56,48,49,50,51,52,53,56};
   −
SO the value mii.hairType returns a foreground hair tile of 12 and a background hair tile of 16 thus allowing us to draw the proper hair style.
+
* The purpose of hairfg is to translate the mii.hairType variable into the correct foreground hair sprite. For example: if mii.hairType returns 32 then we would use hairfg[mii.hairType] to get the proper tile which would be tile 12 (hairfg[32]=12). This would draw the correct fg hair tile from the mii.hairType variable.
   −
You'll notice that hairbg array has the number 56 repeat alotTile 56 is a blank tile so all the foreground hairs that correspond to that slot have no background hair therefore none is drawn.
+
* The purpose of hairbg is to then take whatever foreground hair was drawn and add any corresponding background hair. For example we would use hairbg[hairfg[mii.hairType]] to get the correct background hair drawnSo, using our above example mii.hairType 32 corresponds foreground hair 12 which has a corresponding background hair of 16 (hairbg[hairfg[32]]=16).
   −
Because the foreground hair parts are split into two files, we use an if statement to make sure we draw from the correct img file.  If hairfg[mii.hairType] is < 56 we draw from the first image file using the hairfg[mii.hairType] tile number.
+
* SO the value mii.hairType returns a foreground hair tile of 12 and a background hair tile of 16 thus allowing us to draw the proper hair style.
If hairfg[mii.hairType] is => 56 we draw from the second image file using the hairfg[mii.hairType]-56 tile number.
     −
Background hair is always pulled from the second image file.
+
* You'll notice that hairbg array has the number 56 repeat alot.  Tile 56 is a blank tile so all the foreground hairs that correspond to that slot have no background hair therefore none is drawn.
    +
* Because the foreground hair parts are split into two files, we use an if statement to make sure we draw from the correct img file. ** If hairfg[mii.hairType] is < 56 we draw from the first image file using the hairfg[mii.hairType] tile number.
 +
** If hairfg[mii.hairType] is => 56 we draw from the second image file using the hairfg[mii.hairType]-56 tile number.
    +
* Background hair is always pulled from the second image file.
    
== Putting it all together ==
 
== Putting it all together ==
221

edits

Navigation menu