summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/assets/xml/GC_US/objects/object_link_child.xml16
-rw-r--r--mm/assets/xml/GC_US/objects/object_link_zora.xml16
-rw-r--r--mm/assets/xml/GC_US/objects/object_test3.xml24
-rw-r--r--mm/assets/xml/GC_US/objects/object_zm.xml6
-rw-r--r--mm/assets/xml/N64_US/objects/object_link_child.xml16
-rw-r--r--mm/assets/xml/N64_US/objects/object_link_zora.xml16
-rw-r--r--mm/assets/xml/N64_US/objects/object_test3.xml24
-rw-r--r--mm/assets/xml/N64_US/objects/object_zm.xml6
-rw-r--r--mm/include/face_change.h13
-rw-r--r--mm/include/z64actor.h10
-rw-r--r--mm/include/z64player.h71
-rw-r--r--mm/src/code/game.c2
-rw-r--r--mm/src/code/z_actor.c99
-rw-r--r--mm/src/code/z_player_lib.c205
-rw-r--r--mm/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c4
-rw-r--r--mm/src/overlays/actors/ovl_En_Test3/z_en_test3.c79
-rw-r--r--mm/src/overlays/actors/ovl_En_Toto/z_en_toto.c8
-rw-r--r--mm/src/overlays/actors/ovl_En_Toto/z_en_toto.h3
-rw-r--r--mm/src/overlays/actors/ovl_En_Zod/z_en_zod.c4
-rw-r--r--mm/src/overlays/actors/ovl_player_actor/z_player.c28
-rw-r--r--mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c2
21 files changed, 387 insertions, 265 deletions
diff --git a/mm/assets/xml/GC_US/objects/object_link_child.xml b/mm/assets/xml/GC_US/objects/object_link_child.xml
index 3a1998458..f4ce8ec76 100644
--- a/mm/assets/xml/GC_US/objects/object_link_child.xml
+++ b/mm/assets/xml/GC_US/objects/object_link_child.xml
@@ -3,16 +3,16 @@
<Texture Name="gLinkHumanEyesOpenTex" OutName="eyes_open" Format="ci8" Width="64" Height="32" Offset="0x0" TlutOffset="0x5000" />
<Texture Name="gLinkHumanEyesHalfTex" OutName="eyes_half" Format="ci8" Width="64" Height="32" Offset="0x800" TlutOffset="0x5000" />
<Texture Name="gLinkHumanEyesClosedTex" OutName="eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x1000" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollRightTex" OutName="eyes_roll_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollLeftTex" OutName="eyes_roll_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollUpTex" OutName="eyes_roll_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollDownTex" OutName="eyes_roll_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5000" />
- <Texture Name="object_link_child_Tex_003800" OutName="tex_003800" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesRightTex" OutName="eyes_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesLeftTex" OutName="eyes_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesUpTex" OutName="eyes_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesDownTex" OutName="eyes_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesWincingTex" OutName="eyes_wincing" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5000" />
<Texture Name="gLinkHumanMouthClosedTex" OutName="mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x4000" TlutOffset="0x5200" />
- <Texture Name="gLinkHumanMouthTeethTex" OutName="mouth_teeth" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
- <Texture Name="gLinkHumanMouthAngryTex" OutName="mouth_angry" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
- <Texture Name="gLinkHumanMouthHappyTex" OutName="mouth_happy" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
+ <Texture Name="gLinkHumanMouthHalfTex" OutName="mouth_half" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
+ <Texture Name="gLinkHumanMouthOpenTex" OutName="mouth_open" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
+ <Texture Name="gLinkHumanMouthSmileTex" OutName="mouth_smile" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
<Texture Name="gLinkHumanSkinTLUT" OutName="skin_tlut" Format="rgba16" Width="16" Height="16" Offset="0x5000" />
<Texture Name="gLinkHumanMouthTLUT" OutName="mouth_tlut" Format="rgba16" Width="16" Height="16" Offset="0x5200" />
diff --git a/mm/assets/xml/GC_US/objects/object_link_zora.xml b/mm/assets/xml/GC_US/objects/object_link_zora.xml
index be4c54274..08936791a 100644
--- a/mm/assets/xml/GC_US/objects/object_link_zora.xml
+++ b/mm/assets/xml/GC_US/objects/object_link_zora.xml
@@ -3,16 +3,16 @@
<Texture Name="gLinkZoraEyesOpenTex" OutName="eyes_open" Format="ci8" Width="64" Height="32" Offset="0x0" TlutOffset="0x5200" />
<Texture Name="gLinkZoraEyesHalfTex" OutName="eyes_half" Format="ci8" Width="64" Height="32" Offset="0x800" TlutOffset="0x5200" />
<Texture Name="gLinkZoraEyesClosedTex" OutName="eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x1000" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollRightTex" OutName="eyes_roll_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollLeftTex" OutName="eyes_roll_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollUpTex" OutName="eyes_roll_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollDownTex" OutName="eyes_roll_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5200" />
- <Texture Name="object_link_zora_Tex_003800" OutName="tex_003800" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesRightTex" OutName="eyes_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesLeftTex" OutName="eyes_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesUpTex" OutName="eyes_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesDownTex" OutName="eyes_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesWincingTex" OutName="eyes_wincing" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5200" />
<Texture Name="gLinkZoraMouthClosedTex" OutName="mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x4000" TlutOffset="0x5200" />
- <Texture Name="object_link_zora_Tex_004400" OutName="tex_004400" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraMouthAngryTex" OutName="mouth_angry" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraMouthHappyTex" OutName="mouth_happy" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraMouthHalfTex" OutName="mouth_half" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraMouthOpenTex" OutName="mouth_open" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraMouthSmileTex" OutName="mouth_smile" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
<Texture Name="object_link_zora_TLUT_005000" OutName="tlut_005000" Format="rgba16" Width="16" Height="16" Offset="0x5000" />
<Texture Name="gLinkZoraSkinTLUT" OutName="skin_tlut" Format="rgba16" Width="16" Height="16" Offset="0x5200" />
diff --git a/mm/assets/xml/GC_US/objects/object_test3.xml b/mm/assets/xml/GC_US/objects/object_test3.xml
index c32732b35..133fe458a 100644
--- a/mm/assets/xml/GC_US/objects/object_test3.xml
+++ b/mm/assets/xml/GC_US/objects/object_test3.xml
@@ -9,8 +9,8 @@
<Texture Name="gKafeiSkinTex" OutName="kafei_skin" Format="ci8" Width="8" Height="8" Offset="0x800" />
<Texture Name="gKafeiHairTex" OutName="kafei_hair" Format="ci8" Width="8" Height="16" Offset="0x840" />
<Texture Name="gKafeiNoseTex" OutName="kafei_nose" Format="ci8" Width="16" Height="16" Offset="0x8C0" />
- <Texture Name="gKafeiMouthClosedTex" OutName="kafei_mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x9C0" />
- <Texture Name="gKafeiEyesOpenTex" OutName="kafei_eyes_open" Format="ci8" Width="64" Height="32" Offset="0xDC0" />
+ <Texture Name="gKafeiMouthClosedTex" OutName="kafei_mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x9C0" TlutOffset="0x400" />
+ <Texture Name="gKafeiEyesOpenTex" OutName="kafei_eyes_open" Format="ci8" Width="64" Height="32" Offset="0xDC0" TlutOffset="0x600" />
<Texture Name="gKafeiHairPartAndUndersideTex" OutName="kafei_hair_part_and_underside" Format="ci8" Width="8" Height="16" Offset="0x15C0" />
<Texture Name="gKafeiFingersTex" OutName="kafei_fingers" Format="ci8" Width="16" Height="16" Offset="0x1640" />
<Texture Name="gKafeiBootTex" OutName="kafei_boot" Format="ci8" Width="32" Height="32" Offset="0x1740" />
@@ -20,16 +20,16 @@
<Texture Name="gKafeiPendantOfMemoriesTex" OutName="kafei_pendant_of_memories" Format="rgba16" Width="32" Height="64" Offset="0x2180" />
<Texture Name="gKafeiClothesPatternTex" OutName="kafei_clothes_pattern" Format="ci8" Width="16" Height="64" Offset="0x3180" />
<Texture Name="gKafeiTrouserHemTex" OutName="kafei_trouser_hem" Format="ci8" Width="16" Height="16" Offset="0x3580" />
- <Texture Name="gKafeiEyesHalfTex" OutName="kafei_eyes_half" Format="ci8" Width="64" Height="32" Offset="0x3680" />
- <Texture Name="gKafeiEyesClosedTex" OutName="kafei_eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x3E80" />
- <Texture Name="gKafeiEyesRollRightTex" OutName="kafei_eyes_roll_right" Format="ci8" Width="64" Height="32" Offset="0x4680" />
- <Texture Name="gKafeiEyesRollLeftTex" OutName="kafei_eyes_roll_left" Format="ci8" Width="64" Height="32" Offset="0x4E80" />
- <Texture Name="gKafeiEyesRollUpTex" OutName="kafei_eyes_roll_up" Format="ci8" Width="64" Height="32" Offset="0x5680" />
- <Texture Name="gKafeiEyesRollDownTex" OutName="kafei_eyes_roll_down" Format="ci8" Width="64" Height="32" Offset="0x5E80" />
- <Texture Name="object_test3_Tex_006680" OutName="tex_006680" Format="ci8" Width="64" Height="32" Offset="0x6680" /> <!-- TODO: name it after object_link_child_Tex_003800 -->
- <Texture Name="gKafeiMouthTeethTex" OutName="kafei_mouth_teeth" Format="ci8" Width="32" Height="32" Offset="0x6E80" />
- <Texture Name="gKafeiMouthAngryTex" OutName="kafei_mouth_angry" Format="ci8" Width="32" Height="32" Offset="0x7280" />
- <Texture Name="gKafeiMouthHappyTex" OutName="kafei_mouth_happy" Format="ci8" Width="32" Height="32" Offset="0x7680" />
+ <Texture Name="gKafeiEyesHalfTex" OutName="kafei_eyes_half" Format="ci8" Width="64" Height="32" Offset="0x3680" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesClosedTex" OutName="kafei_eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x3E80" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesRightTex" OutName="kafei_eyes_right" Format="ci8" Width="64" Height="32" Offset="0x4680" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesLeftTex" OutName="kafei_eyes_left" Format="ci8" Width="64" Height="32" Offset="0x4E80" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesUpTex" OutName="kafei_eyes_up" Format="ci8" Width="64" Height="32" Offset="0x5680" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesDownTex" OutName="kafei_eyes_down" Format="ci8" Width="64" Height="32" Offset="0x5E80" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesWincingTex" OutName="kafei_eyes_wincing" Format="ci8" Width="64" Height="32" Offset="0x6680" TlutOffset="0x600" />
+ <Texture Name="gKafeiMouthHalfTex" OutName="kafei_mouth_half" Format="ci8" Width="32" Height="32" Offset="0x6E80" TlutOffset="0x400" />
+ <Texture Name="gKafeiMouthOpenTex" OutName="kafei_mouth_open" Format="ci8" Width="32" Height="32" Offset="0x7280" TlutOffset="0x400" />
+ <Texture Name="gKafeiMouthSmileTex" OutName="kafei_mouth_smile" Format="ci8" Width="32" Height="32" Offset="0x7680" TlutOffset="0x400" />
<!-- Kafei Dlists -->
<DList Name="gKafeiRightThighDL" Offset="0xBF10" />
diff --git a/mm/assets/xml/GC_US/objects/object_zm.xml b/mm/assets/xml/GC_US/objects/object_zm.xml
index 1848aa222..61163d50b 100644
--- a/mm/assets/xml/GC_US/objects/object_zm.xml
+++ b/mm/assets/xml/GC_US/objects/object_zm.xml
@@ -28,7 +28,7 @@
<Texture Name="object_zm_Tex_0082A8" OutName="tex_0082A8" Format="ci8" Width="8" Height="8" Offset="0x82A8" />
<Texture Name="object_zm_Tex_0082E8" OutName="tex_0082E8" Format="ci8" Width="32" Height="32" Offset="0x82E8" />
<Texture Name="object_zm_Tex_0086E8" OutName="tex_0086E8" Format="ci8" Width="32" Height="32" Offset="0x86E8" />
- <Texture Name="object_zm_Tex_008AE8" OutName="tex_008AE8" Format="ci8" Width="32" Height="32" Offset="0x8AE8" />
+ <Texture Name="gTotoEyesOpenTex" OutName="toto_eyes_open" Format="ci8" Width="32" Height="32" Offset="0x8AE8" TlutOffset="0x80A8" />
<Texture Name="object_zm_Tex_008EE8" OutName="tex_008EE8" Format="ci8" Width="16" Height="16" Offset="0x8EE8" />
<Texture Name="object_zm_Tex_008FE8" OutName="tex_008FE8" Format="rgba16" Width="32" Height="32" Offset="0x8FE8" />
<Texture Name="object_zm_Tex_0097E8" OutName="tex_0097E8" Format="rgba16" Width="8" Height="8" Offset="0x97E8" />
@@ -36,8 +36,8 @@
<Texture Name="object_zm_Tex_009968" OutName="tex_009968" Format="ci8" Width="16" Height="16" Offset="0x9968" />
<Texture Name="object_zm_Tex_009A68" OutName="tex_009A68" Format="rgba16" Width="16" Height="16" Offset="0x9A68" />
<Texture Name="object_zm_Tex_009C68" OutName="tex_009C68" Format="ci8" Width="32" Height="32" Offset="0x9C68" />
- <Texture Name="object_zm_Tex_00A068" OutName="tex_00A068" Format="ci8" Width="32" Height="32" Offset="0xA068" />
- <Texture Name="object_zm_Tex_00A468" OutName="tex_00A468" Format="ci8" Width="32" Height="32" Offset="0xA468" />
+ <Texture Name="gTotoEyesHalfTex" OutName="toto_eyes_half" Format="ci8" Width="32" Height="32" Offset="0xA068" TlutOffset="0x80A8" />
+ <Texture Name="gTotoEyesClosedTex" OutName="toto_eyes_closed" Format="ci8" Width="32" Height="32" Offset="0xA468" TlutOffset="0x80A8" />
<Limb Name="object_zm_Standardlimb_00A868" Type="Standard" EnumName="OBJECT_ZM_LIMB_01" Offset="0xA868" />
<Limb Name="object_zm_Standardlimb_00A874" Type="Standard" EnumName="OBJECT_ZM_LIMB_02" Offset="0xA874" />
<Limb Name="object_zm_Standardlimb_00A880" Type="Standard" EnumName="OBJECT_ZM_LIMB_03" Offset="0xA880" />
diff --git a/mm/assets/xml/N64_US/objects/object_link_child.xml b/mm/assets/xml/N64_US/objects/object_link_child.xml
index dd045c1d8..800d6ea9d 100644
--- a/mm/assets/xml/N64_US/objects/object_link_child.xml
+++ b/mm/assets/xml/N64_US/objects/object_link_child.xml
@@ -3,16 +3,16 @@
<Texture Name="gLinkHumanEyesOpenTex" OutName="eyes_open" Format="ci8" Width="64" Height="32" Offset="0x0" TlutOffset="0x5000" />
<Texture Name="gLinkHumanEyesHalfTex" OutName="eyes_half" Format="ci8" Width="64" Height="32" Offset="0x800" TlutOffset="0x5000" />
<Texture Name="gLinkHumanEyesClosedTex" OutName="eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x1000" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollRightTex" OutName="eyes_roll_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollLeftTex" OutName="eyes_roll_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollUpTex" OutName="eyes_roll_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5000" />
- <Texture Name="gLinkHumanEyesRollDownTex" OutName="eyes_roll_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5000" />
- <Texture Name="object_link_child_Tex_003800" OutName="tex_003800" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesRightTex" OutName="eyes_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesLeftTex" OutName="eyes_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesUpTex" OutName="eyes_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesDownTex" OutName="eyes_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5000" />
+ <Texture Name="gLinkHumanEyesWincingTex" OutName="eyes_wincing" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5000" />
<Texture Name="gLinkHumanMouthClosedTex" OutName="mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x4000" TlutOffset="0x5200" />
- <Texture Name="gLinkHumanMouthTeethTex" OutName="mouth_teeth" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
- <Texture Name="gLinkHumanMouthAngryTex" OutName="mouth_angry" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
- <Texture Name="gLinkHumanMouthHappyTex" OutName="mouth_happy" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
+ <Texture Name="gLinkHumanMouthHalfTex" OutName="mouth_half" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
+ <Texture Name="gLinkHumanMouthOpenTex" OutName="mouth_open" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
+ <Texture Name="gLinkHumanMouthSmileTex" OutName="mouth_smile" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
<Texture Name="gLinkHumanSkinTLUT" OutName="skin_tlut" Format="rgba16" Width="16" Height="16" Offset="0x5000" />
<Texture Name="gLinkHumanMouthTLUT" OutName="mouth_tlut" Format="rgba16" Width="16" Height="16" Offset="0x5200" />
diff --git a/mm/assets/xml/N64_US/objects/object_link_zora.xml b/mm/assets/xml/N64_US/objects/object_link_zora.xml
index be4c54274..08936791a 100644
--- a/mm/assets/xml/N64_US/objects/object_link_zora.xml
+++ b/mm/assets/xml/N64_US/objects/object_link_zora.xml
@@ -3,16 +3,16 @@
<Texture Name="gLinkZoraEyesOpenTex" OutName="eyes_open" Format="ci8" Width="64" Height="32" Offset="0x0" TlutOffset="0x5200" />
<Texture Name="gLinkZoraEyesHalfTex" OutName="eyes_half" Format="ci8" Width="64" Height="32" Offset="0x800" TlutOffset="0x5200" />
<Texture Name="gLinkZoraEyesClosedTex" OutName="eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x1000" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollRightTex" OutName="eyes_roll_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollLeftTex" OutName="eyes_roll_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollUpTex" OutName="eyes_roll_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraEyesRollDownTex" OutName="eyes_roll_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5200" />
- <Texture Name="object_link_zora_Tex_003800" OutName="tex_003800" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesRightTex" OutName="eyes_right" Format="ci8" Width="64" Height="32" Offset="0x1800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesLeftTex" OutName="eyes_left" Format="ci8" Width="64" Height="32" Offset="0x2000" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesUpTex" OutName="eyes_up" Format="ci8" Width="64" Height="32" Offset="0x2800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesDownTex" OutName="eyes_down" Format="ci8" Width="64" Height="32" Offset="0x3000" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraEyesWincingTex" OutName="eyes_wincing" Format="ci8" Width="64" Height="32" Offset="0x3800" TlutOffset="0x5200" />
<Texture Name="gLinkZoraMouthClosedTex" OutName="mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x4000" TlutOffset="0x5200" />
- <Texture Name="object_link_zora_Tex_004400" OutName="tex_004400" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraMouthAngryTex" OutName="mouth_angry" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
- <Texture Name="gLinkZoraMouthHappyTex" OutName="mouth_happy" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraMouthHalfTex" OutName="mouth_half" Format="ci8" Width="32" Height="32" Offset="0x4400" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraMouthOpenTex" OutName="mouth_open" Format="ci8" Width="32" Height="32" Offset="0x4800" TlutOffset="0x5200" />
+ <Texture Name="gLinkZoraMouthSmileTex" OutName="mouth_smile" Format="ci8" Width="32" Height="32" Offset="0x4C00" TlutOffset="0x5200" />
<Texture Name="object_link_zora_TLUT_005000" OutName="tlut_005000" Format="rgba16" Width="16" Height="16" Offset="0x5000" />
<Texture Name="gLinkZoraSkinTLUT" OutName="skin_tlut" Format="rgba16" Width="16" Height="16" Offset="0x5200" />
diff --git a/mm/assets/xml/N64_US/objects/object_test3.xml b/mm/assets/xml/N64_US/objects/object_test3.xml
index c32732b35..133fe458a 100644
--- a/mm/assets/xml/N64_US/objects/object_test3.xml
+++ b/mm/assets/xml/N64_US/objects/object_test3.xml
@@ -9,8 +9,8 @@
<Texture Name="gKafeiSkinTex" OutName="kafei_skin" Format="ci8" Width="8" Height="8" Offset="0x800" />
<Texture Name="gKafeiHairTex" OutName="kafei_hair" Format="ci8" Width="8" Height="16" Offset="0x840" />
<Texture Name="gKafeiNoseTex" OutName="kafei_nose" Format="ci8" Width="16" Height="16" Offset="0x8C0" />
- <Texture Name="gKafeiMouthClosedTex" OutName="kafei_mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x9C0" />
- <Texture Name="gKafeiEyesOpenTex" OutName="kafei_eyes_open" Format="ci8" Width="64" Height="32" Offset="0xDC0" />
+ <Texture Name="gKafeiMouthClosedTex" OutName="kafei_mouth_closed" Format="ci8" Width="32" Height="32" Offset="0x9C0" TlutOffset="0x400" />
+ <Texture Name="gKafeiEyesOpenTex" OutName="kafei_eyes_open" Format="ci8" Width="64" Height="32" Offset="0xDC0" TlutOffset="0x600" />
<Texture Name="gKafeiHairPartAndUndersideTex" OutName="kafei_hair_part_and_underside" Format="ci8" Width="8" Height="16" Offset="0x15C0" />
<Texture Name="gKafeiFingersTex" OutName="kafei_fingers" Format="ci8" Width="16" Height="16" Offset="0x1640" />
<Texture Name="gKafeiBootTex" OutName="kafei_boot" Format="ci8" Width="32" Height="32" Offset="0x1740" />
@@ -20,16 +20,16 @@
<Texture Name="gKafeiPendantOfMemoriesTex" OutName="kafei_pendant_of_memories" Format="rgba16" Width="32" Height="64" Offset="0x2180" />
<Texture Name="gKafeiClothesPatternTex" OutName="kafei_clothes_pattern" Format="ci8" Width="16" Height="64" Offset="0x3180" />
<Texture Name="gKafeiTrouserHemTex" OutName="kafei_trouser_hem" Format="ci8" Width="16" Height="16" Offset="0x3580" />
- <Texture Name="gKafeiEyesHalfTex" OutName="kafei_eyes_half" Format="ci8" Width="64" Height="32" Offset="0x3680" />
- <Texture Name="gKafeiEyesClosedTex" OutName="kafei_eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x3E80" />
- <Texture Name="gKafeiEyesRollRightTex" OutName="kafei_eyes_roll_right" Format="ci8" Width="64" Height="32" Offset="0x4680" />
- <Texture Name="gKafeiEyesRollLeftTex" OutName="kafei_eyes_roll_left" Format="ci8" Width="64" Height="32" Offset="0x4E80" />
- <Texture Name="gKafeiEyesRollUpTex" OutName="kafei_eyes_roll_up" Format="ci8" Width="64" Height="32" Offset="0x5680" />
- <Texture Name="gKafeiEyesRollDownTex" OutName="kafei_eyes_roll_down" Format="ci8" Width="64" Height="32" Offset="0x5E80" />
- <Texture Name="object_test3_Tex_006680" OutName="tex_006680" Format="ci8" Width="64" Height="32" Offset="0x6680" /> <!-- TODO: name it after object_link_child_Tex_003800 -->
- <Texture Name="gKafeiMouthTeethTex" OutName="kafei_mouth_teeth" Format="ci8" Width="32" Height="32" Offset="0x6E80" />
- <Texture Name="gKafeiMouthAngryTex" OutName="kafei_mouth_angry" Format="ci8" Width="32" Height="32" Offset="0x7280" />
- <Texture Name="gKafeiMouthHappyTex" OutName="kafei_mouth_happy" Format="ci8" Width="32" Height="32" Offset="0x7680" />
+ <Texture Name="gKafeiEyesHalfTex" OutName="kafei_eyes_half" Format="ci8" Width="64" Height="32" Offset="0x3680" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesClosedTex" OutName="kafei_eyes_closed" Format="ci8" Width="64" Height="32" Offset="0x3E80" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesRightTex" OutName="kafei_eyes_right" Format="ci8" Width="64" Height="32" Offset="0x4680" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesLeftTex" OutName="kafei_eyes_left" Format="ci8" Width="64" Height="32" Offset="0x4E80" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesUpTex" OutName="kafei_eyes_up" Format="ci8" Width="64" Height="32" Offset="0x5680" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesDownTex" OutName="kafei_eyes_down" Format="ci8" Width="64" Height="32" Offset="0x5E80" TlutOffset="0x600" />
+ <Texture Name="gKafeiEyesWincingTex" OutName="kafei_eyes_wincing" Format="ci8" Width="64" Height="32" Offset="0x6680" TlutOffset="0x600" />
+ <Texture Name="gKafeiMouthHalfTex" OutName="kafei_mouth_half" Format="ci8" Width="32" Height="32" Offset="0x6E80" TlutOffset="0x400" />
+ <Texture Name="gKafeiMouthOpenTex" OutName="kafei_mouth_open" Format="ci8" Width="32" Height="32" Offset="0x7280" TlutOffset="0x400" />
+ <Texture Name="gKafeiMouthSmileTex" OutName="kafei_mouth_smile" Format="ci8" Width="32" Height="32" Offset="0x7680" TlutOffset="0x400" />
<!-- Kafei Dlists -->
<DList Name="gKafeiRightThighDL" Offset="0xBF10" />
diff --git a/mm/assets/xml/N64_US/objects/object_zm.xml b/mm/assets/xml/N64_US/objects/object_zm.xml
index 1848aa222..61163d50b 100644
--- a/mm/assets/xml/N64_US/objects/object_zm.xml
+++ b/mm/assets/xml/N64_US/objects/object_zm.xml
@@ -28,7 +28,7 @@
<Texture Name="object_zm_Tex_0082A8" OutName="tex_0082A8" Format="ci8" Width="8" Height="8" Offset="0x82A8" />
<Texture Name="object_zm_Tex_0082E8" OutName="tex_0082E8" Format="ci8" Width="32" Height="32" Offset="0x82E8" />
<Texture Name="object_zm_Tex_0086E8" OutName="tex_0086E8" Format="ci8" Width="32" Height="32" Offset="0x86E8" />
- <Texture Name="object_zm_Tex_008AE8" OutName="tex_008AE8" Format="ci8" Width="32" Height="32" Offset="0x8AE8" />
+ <Texture Name="gTotoEyesOpenTex" OutName="toto_eyes_open" Format="ci8" Width="32" Height="32" Offset="0x8AE8" TlutOffset="0x80A8" />
<Texture Name="object_zm_Tex_008EE8" OutName="tex_008EE8" Format="ci8" Width="16" Height="16" Offset="0x8EE8" />
<Texture Name="object_zm_Tex_008FE8" OutName="tex_008FE8" Format="rgba16" Width="32" Height="32" Offset="0x8FE8" />
<Texture Name="object_zm_Tex_0097E8" OutName="tex_0097E8" Format="rgba16" Width="8" Height="8" Offset="0x97E8" />
@@ -36,8 +36,8 @@
<Texture Name="object_zm_Tex_009968" OutName="tex_009968" Format="ci8" Width="16" Height="16" Offset="0x9968" />
<Texture Name="object_zm_Tex_009A68" OutName="tex_009A68" Format="rgba16" Width="16" Height="16" Offset="0x9A68" />
<Texture Name="object_zm_Tex_009C68" OutName="tex_009C68" Format="ci8" Width="32" Height="32" Offset="0x9C68" />
- <Texture Name="object_zm_Tex_00A068" OutName="tex_00A068" Format="ci8" Width="32" Height="32" Offset="0xA068" />
- <Texture Name="object_zm_Tex_00A468" OutName="tex_00A468" Format="ci8" Width="32" Height="32" Offset="0xA468" />
+ <Texture Name="gTotoEyesHalfTex" OutName="toto_eyes_half" Format="ci8" Width="32" Height="32" Offset="0xA068" TlutOffset="0x80A8" />
+ <Texture Name="gTotoEyesClosedTex" OutName="toto_eyes_closed" Format="ci8" Width="32" Height="32" Offset="0xA468" TlutOffset="0x80A8" />
<Limb Name="object_zm_Standardlimb_00A868" Type="Standard" EnumName="OBJECT_ZM_LIMB_01" Offset="0xA868" />
<Limb Name="object_zm_Standardlimb_00A874" Type="Standard" EnumName="OBJECT_ZM_LIMB_02" Offset="0xA874" />
<Limb Name="object_zm_Standardlimb_00A880" Type="Standard" EnumName="OBJECT_ZM_LIMB_03" Offset="0xA880" />
diff --git a/mm/include/face_change.h b/mm/include/face_change.h
new file mode 100644
index 000000000..2e7010c3e
--- /dev/null
+++ b/mm/include/face_change.h
@@ -0,0 +1,13 @@
+#ifndef FACE_CHANGE_H
+#define FACE_CHANGE_H
+
+typedef struct FaceChange {
+ /* 0x0 */ s16 face;
+ /* 0x2 */ s16 timer;
+} FaceChange; // size = 0x4
+
+s16 FaceChange_UpdateBlinking(FaceChange* faceChange, s16 blinkIntervalBase, s16 blinkIntervalRandRange, s16 blinkDuration);
+s16 FaceChange_UpdateBlinkingNonHuman(FaceChange* faceChange, s16 blinkIntervalBase, s16 blinkIntervalRandRange, s16 blinkDuration);
+s16 FaceChange_UpdateRandomSet(FaceChange* faceChange, s16 changeTimerBase, s16 changeTimerRandRange, s16 faceSetRange);
+
+#endif
diff --git a/mm/include/z64actor.h b/mm/include/z64actor.h
index a7ac50797..77173993c 100644
--- a/mm/include/z64actor.h
+++ b/mm/include/z64actor.h
@@ -87,7 +87,7 @@ typedef void (*ActorShadowFunc)(struct Actor* actor, struct Lights* mapper, stru
typedef struct {
/* 0x00 */ Vec3s rot; // Current actor shape rotation
- /* 0x06 */ s16 face; // Used to index eyebrow/eye/mouth textures. Only used by player
+ /* 0x06 */ s16 face; // Used to index eyes and mouth textures. Only used by player
/* 0x08 */ f32 yOffset; // Model y axis offset. Represents model space units
/* 0x0C */ ActorShadowFunc shadowDraw; // Shadow draw function
/* 0x10 */ f32 shadowScale; // Changes the size of the shadow
@@ -806,11 +806,6 @@ typedef struct NpcInteractInfo {
/* 0x24 */ UNK_TYPE1 unk_24[0x4];
} NpcInteractInfo; // size = 0x28
-typedef struct BlinkInfo {
- /* 0x0 */ s16 eyeTexIndex;
- /* 0x2 */ s16 blinkTimer;
-} BlinkInfo; // size = 0x4
-
extern AttentionRangeParams gAttentionRanges[ATTENTION_RANGE_MAX];
extern s16 D_801AED48[8];
// extern Gfx D_801AEF88[];
@@ -958,9 +953,6 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, struct PlayStat
f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params);
void Actor_SpawnTransitionActors(struct PlayState* play, ActorContext* actorCtx);
void Enemy_StartFinishingBlow(struct PlayState* play, Actor* actor);
-s16 func_800BBAC0(BlinkInfo* info, s16 arg1, s16 arg2, s16 arg3);
-s16 func_800BBB74(BlinkInfo* info, s16 arg1, s16 arg2, s16 arg3);
-s16 func_800BBC20(BlinkInfo* info, s16 arg1, s16 arg2, s16 arg3);
void Actor_SpawnBodyParts(Actor* actor, struct PlayState* play, s32 partParams, Gfx** dList);
void Actor_SpawnFloorDustRing(struct PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 countMinusOne,
f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting);
diff --git a/mm/include/z64player.h b/mm/include/z64player.h
index 17b8b0e05..8c075119e 100644
--- a/mm/include/z64player.h
+++ b/mm/include/z64player.h
@@ -12,6 +12,7 @@ extern "C" {
#include "z64interface.h"
#include "z64item.h"
#include "z64light.h"
+#include "face_change.h"
struct Player;
struct PlayState;
@@ -476,44 +477,50 @@ typedef enum PlayerModelGroup {
/* 15 */ PLAYER_MODELGROUP_MAX
} PlayerModelGroup;
-typedef enum PlayerEyeIndex {
+typedef struct PlayerFaceIndices {
+ /* 0x0 */ u8 eyeIndex;
+ /* 0x1 */ u8 mouthIndex;
+} PlayerFaceIndices; // size = 0x2
+
+typedef enum PlayerEyes {
/* 0 */ PLAYER_EYES_OPEN,
/* 1 */ PLAYER_EYES_HALF,
/* 2 */ PLAYER_EYES_CLOSED,
- /* 3 */ PLAYER_EYES_ROLL_RIGHT,
- /* 4 */ PLAYER_EYES_ROLL_LEFT,
- /* 5 */ PLAYER_EYES_ROLL_UP,
- /* 6 */ PLAYER_EYES_ROLL_DOWN,
- /* 7 */ PLAYER_EYES_7,
+ /* 3 */ PLAYER_EYES_RIGHT,
+ /* 4 */ PLAYER_EYES_LEFT,
+ /* 5 */ PLAYER_EYES_UP,
+ /* 6 */ PLAYER_EYES_DOWN,
+ /* 7 */ PLAYER_EYES_WINCING, // For Goron, this is a surprised eye
/* 8 */ PLAYER_EYES_MAX
-} PlayerEyeIndex;
+} PlayerEyes;
-typedef enum PlayerMouthIndex {
+typedef enum PlayerMouth {
/* 0 */ PLAYER_MOUTH_CLOSED,
- /* 1 */ PLAYER_MOUTH_TEETH,
- /* 2 */ PLAYER_MOUTH_ANGRY,
- /* 3 */ PLAYER_MOUTH_HAPPY,
+ /* 1 */ PLAYER_MOUTH_HALF,
+ /* 2 */ PLAYER_MOUTH_OPEN,
+ /* 3 */ PLAYER_MOUTH_SMILE,
/* 4 */ PLAYER_MOUTH_MAX
-} PlayerMouthIndex;
-
-typedef enum PlayerFacialExpression {
- /* 0 */ PLAYER_FACE_0,
- /* 1 */ PLAYER_FACE_1,
- /* 2 */ PLAYER_FACE_2,
- /* 3 */ PLAYER_FACE_3,
- /* 4 */ PLAYER_FACE_4,
- /* 5 */ PLAYER_FACE_5,
- /* 6 */ PLAYER_FACE_6,
- /* 7 */ PLAYER_FACE_7,
- /* 8 */ PLAYER_FACE_8,
- /* 9 */ PLAYER_FACE_9,
- /* 10 */ PLAYER_FACE_10,
- /* 11 */ PLAYER_FACE_11,
- /* 12 */ PLAYER_FACE_12,
- /* 13 */ PLAYER_FACE_13,
- /* 14 */ PLAYER_FACE_14,
- /* 15 */ PLAYER_FACE_15
-} PlayerFacialExpression;
+} PlayerMouth;
+
+typedef enum PlayerFace {
+ /* 0 */ PLAYER_FACE_NEUTRAL,
+ /* 1 */ PLAYER_FACE_NEUTRAL_BLINKING_HALF,
+ /* 2 */ PLAYER_FACE_NEUTRAL_BLINKING_CLOSED,
+ /* 3 */ PLAYER_FACE_NEUTRAL_2,
+ /* 4 */ PLAYER_FACE_NEUTRAL_BLINKING_HALF_2,
+ /* 5 */ PLAYER_FACE_NEUTRAL_BLINKING_CLOSED_2,
+ /* 6 */ PLAYER_FACE_LOOK_LEFT,
+ /* 7 */ PLAYER_FACE_SURPRISED,
+ /* 8 */ PLAYER_FACE_HURT,
+ /* 9 */ PLAYER_FACE_GASP,
+ /* 10 */ PLAYER_FACE_LOOK_RIGHT,
+ /* 11 */ PLAYER_FACE_LOOK_LEFT_2,
+ /* 12 */ PLAYER_FACE_EYES_CLOSED_MOUTH_OPEN,
+ /* 13 */ PLAYER_FACE_OPENING,
+ /* 14 */ PLAYER_FACE_EYES_AND_MOUTH_OPEN,
+ /* 15 */ PLAYER_FACE_SMILE,
+ /* 16 */ PLAYER_FACE_MAX
+} PlayerFace;
typedef enum PlayerLimb {
/* 0x00 */ PLAYER_LIMB_NONE,
@@ -1168,7 +1175,7 @@ typedef struct Player {
/* 0x2C8 */ SkelAnime unk_2C8;
/* 0x30C */ Vec3s jointTable[5];
/* 0x32A */ Vec3s morphTable[5];
- /* 0x348 */ BlinkInfo blinkInfo;
+ /* 0x348 */ FaceChange faceChange;
/* 0x34C */ Actor* heldActor;
/* 0x350 */ PosRot leftHandWorld;
/* 0x364 */ Actor* rightHandActor;
diff --git a/mm/src/code/game.c b/mm/src/code/game.c
index 085f9ed87..362fb03ad 100644
--- a/mm/src/code/game.c
+++ b/mm/src/code/game.c
@@ -14,6 +14,8 @@
#include "2s2h/GameInteractor/GameInteractor.h"
+#pragma increment_block_number "n64-us:128"
+
s32 gFramerateDivisor = 1;
f32 gFramerateDivisorF = 1.0f;
f32 gFramerateDivisorHalf = 1.0f / 2.0f;
diff --git a/mm/src/code/z_actor.c b/mm/src/code/z_actor.c
index e7416d435..adb7ee7c6 100644
--- a/mm/src/code/z_actor.c
+++ b/mm/src/code/z_actor.c
@@ -4118,51 +4118,90 @@ void Enemy_StartFinishingBlow(PlayState* play, Actor* actor) {
SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE);
}
-// blinking routine
-s16 func_800BBAC0(BlinkInfo* info, s16 arg1, s16 arg2, s16 arg3) {
- if (DECR(info->blinkTimer) == 0) {
- info->blinkTimer = Rand_S16Offset(arg1, arg2);
- }
-
- if (info->blinkTimer - arg3 > 0) {
- info->eyeTexIndex = 0;
- } else if ((info->blinkTimer - arg3 >= -1) || (info->blinkTimer < 2)) {
- info->eyeTexIndex = 1;
+/**
+ * Updates `FaceChange` data for a blinking pattern.
+ * This system expects that the actor using the system has defined 3 faces in this exact order:
+ * "eyes open", "eyes half open", "eyes closed".
+ *
+ * @param faceChange pointer to an actor's faceChange data
+ * @param blinkIntervalBase The base number of frames between blinks
+ * @param blinkIntervalRandRange The range for a random number of frames that can be added to `blinkIntervalBase`
+ * @param blinkDuration The number of frames it takes for a single blink to occur
+ */
+s16 FaceChange_UpdateBlinking(FaceChange* faceChange, s16 blinkIntervalBase, s16 blinkIntervalRandRange,
+ s16 blinkDuration) {
+ if (DECR(faceChange->timer) == 0) {
+ faceChange->timer = Rand_S16Offset(blinkIntervalBase, blinkIntervalRandRange);
+ }
+
+ if (faceChange->timer - blinkDuration > 0) {
+ // `timer - duration` is positive so this is the default state: "eyes open" face
+ faceChange->face = 0;
+ } else if ((faceChange->timer - blinkDuration >= -1) || (faceChange->timer < 2)) {
+ // This condition aims to catch both cases where the "eyes half open" face is needed.
+ // Note that the comparison assumes the duration of the "eyes half open" phase is 2 frames, irrespective of the
+ // value of `blinkDuration`. The duration for the "eyes closed" phase is `blinkDuration - 4`.
+ // For Player's use case `blinkDuration` is 6, so the "eyes closed" phase happens to have
+ // the same duration as each "eyes half open" phase.
+ faceChange->face = 1;
} else {
- info->eyeTexIndex = 2;
+ // If both conditions above fail, the only possibility left is the "eyes closed" face
+ faceChange->face = 2;
}
- return info->eyeTexIndex;
+ return faceChange->face;
}
-// blinking routine
-s16 func_800BBB74(BlinkInfo* info, s16 arg1, s16 arg2, s16 arg3) {
- if (DECR(info->blinkTimer) == 0) {
- info->blinkTimer = Rand_S16Offset(arg1, arg2);
+/**
+ * Updates `FaceChange` data for a blinking pattern.
+ * This system expects that the actor using the system has defined 3 faces in this exact order:
+ * "eyes open", "eyes half open", "eyes closed".
+ *
+ * @param faceChange pointer to an actor's faceChange data
+ * @param blinkIntervalBase The base number of frames between blinks
+ * @param blinkIntervalRandRange The range for a random number of frames that can be added to `blinkIntervalBase`
+ * @param blinkDuration The number of frames it takes for a single blink to occur
+ */
+s16 FaceChange_UpdateBlinkingNonHuman(FaceChange* faceChange, s16 blinkIntervalBase, s16 blinkIntervalRandRange,
+ s16 blinkDuration) {
+ if (DECR(faceChange->timer) == 0) {
+ faceChange->timer = Rand_S16Offset(blinkIntervalBase, blinkIntervalRandRange);
}
- if (info->blinkTimer - arg3 > 0) {
- info->eyeTexIndex = 0;
- } else if (info->blinkTimer - arg3 == 0) {
- info->eyeTexIndex = 1;
+ if (faceChange->timer - blinkDuration > 0) {
+ // `timer - duration` is positive so this is the default state: "eyes open" face
+ faceChange->face = 0;
+ } else if (faceChange->timer - blinkDuration == 0) {
+ faceChange->face = 1;
} else {
- info->eyeTexIndex = 2;
+ // If both conditions above fail, the only possibility left is the "eyes closed" face
+ faceChange->face = 2;
}
- return info->eyeTexIndex;
+ return faceChange->face;
}
-// unused blinking routine
-s16 func_800BBC20(BlinkInfo* info, s16 arg1, s16 arg2, s16 arg3) {
- if (DECR(info->blinkTimer) == 0) {
- info->blinkTimer = Rand_S16Offset(arg1, arg2);
- info->eyeTexIndex++;
- if ((info->eyeTexIndex % 3) == 0) {
- info->eyeTexIndex = (s32)(Rand_ZeroOne() * arg3) * 3;
+/**
+ * Updates `FaceChange` data for randomly selected face sets.
+ * Each set contains 3 faces. After the timer runs out, the next face in the set is used.
+ * After the third face in a set is used, a new face set is randomly chosen.
+ *
+ * @param faceChange pointer to an actor's faceChange data
+ * @param changeTimerBase The base number of frames between each face change
+ * @param changeTimerRandRange The range for a random number of frames that can be added to `changeTimerBase`
+ * @param faceSetRange The max number of face sets that will be chosen from
+ */
+s16 FaceChange_UpdateRandomSet(FaceChange* faceChange, s16 changeTimerBase, s16 changeTimerRandRange,
+ s16 faceSetRange) {
+ if (DECR(faceChange->timer) == 0) {
+ faceChange->timer = Rand_S16Offset(changeTimerBase, changeTimerRandRange);
+ faceChange->face++;
+ if ((faceChange->face % 3) == 0) {
+ faceChange->face = (s32)(Rand_ZeroOne() * faceSetRange) * 3;
}
}
- return info->eyeTexIndex;
+ return faceChange->face;
}
void Actor_SpawnBodyParts(Actor* actor, PlayState* play, s32 partParams, Gfx** dList) {
diff --git a/mm/src/code/z_player_lib.c b/mm/src/code/z_player_lib.c
index 54a045bc8..16a520154 100644
--- a/mm/src/code/z_player_lib.c
+++ b/mm/src/code/z_player_lib.c
@@ -1889,109 +1889,136 @@ Gfx gCullFrontDList[] = {
gsSPEndDisplayList(),
};
-TexturePtr sPlayerEyesTextures[PLAYER_FORM_MAX][PLAYER_EYES_MAX] = {
+/**
+ * Link's eyes and mouth textures are placed at the exact same place in all player form's respective object files.
+ * This allows the array to only contain the symbols for one file and have it apply to all of them. This is a problem
+ * for shiftability, and changes will need to be made in the code to account for this in a modding scenario. The symbols
+ * from human Link's object are used here.
+ *
+ * Note that some player forms do not use the eyes and mouth textures loaded into segments 0x08 and 0x09 respectively.
+ * Therefore, the segment will point at garbage data, but this does not cause issues as the data is not read from.
+ */
+static TexturePtr sEyeTextures[PLAYER_FORM_MAX][PLAYER_EYES_MAX] = {
+ // PLAYER_FORM_FIERCE_DEITY
{
- // It doesn't seem to matter since it always has the same eyes
- gLinkFierceDeityEyesTex,
- gLinkFierceDeityEyesTex,
- gLinkFierceDeityEyesTex,
- gLinkFierceDeityEyesTex,
- gLinkFierceDeityEyesTex,
- gLinkFierceDeityEyesTex,
- gLinkFierceDeityEyesTex,
+ NULL, // PLAYER_EYES_OPEN
+ NULL, // PLAYER_EYES_HALF
+ NULL, // PLAYER_EYES_CLOSED
+ NULL, // PLAYER_EYES_RIGHT
+ NULL, // PLAYER_EYES_LEFT
+ NULL, // PLAYER_EYES_UP
+ NULL, // PLAYER_EYES_DOWN
+ NULL, // PLAYER_EYES_WINCING
},
+ // PLAYER_FORM_GORON
+ // Note: use PLAYER_EYES_WINCING to access `gLinkGoronEyesSurprisedTex`. See `Player_DrawImpl`.
{
- gLinkGoronEyesOpenTex,
- gLinkGoronEyesHalfTex,
- gLinkGoronEyesClosedTex,
- gLinkGoronEyesSurprisedTex,
- NULL,
- NULL,
- NULL,
- NULL,
+ gLinkGoronEyesOpenTex, // PLAYER_EYES_OPEN
+ gLinkGoronEyesHalfTex, // PLAYER_EYES_HALF
+ gLinkGoronEyesClosedTex, // PLAYER_EYES_CLOSED
+ gLinkGoronEyesSurprisedTex, // PLAYER_EYES_RIGHT
+ NULL, // PLAYER_EYES_LEFT
+ NULL, // PLAYER_EYES_UP
+ NULL, // PLAYER_EYES_DOWN
+ NULL, // PLAYER_EYES_WINCING
},
+ // PLAYER_FORM_ZORA
{
- gLinkZoraEyesOpenTex,
- gLinkZoraEyesHalfTex,
- gLinkZoraEyesClosedTex,
- gLinkZoraEyesRollRightTex,
- gLinkZoraEyesRollLeftTex,
- gLinkZoraEyesRollUpTex,
- gLinkZoraEyesRollDownTex,
- object_link_zora_Tex_003800,
+ gLinkZoraEyesOpenTex, // PLAYER_EYES_OPEN
+ gLinkZoraEyesHalfTex, // PLAYER_EYES_HALF
+ gLinkZoraEyesClosedTex, // PLAYER_EYES_CLOSED
+ gLinkZoraEyesRightTex, // PLAYER_EYES_RIGHT
+ gLinkZoraEyesLeftTex, // PLAYER_EYES_LEFT
+ gLinkZoraEyesUpTex, // PLAYER_EYES_UP
+ gLinkZoraEyesDownTex, // PLAYER_EYES_DOWN
+ gLinkZoraEyesWincingTex, // PLAYER_EYES_WINCING
},
+ // PLAYER_FORM_DEKU
{
- object_link_nuts_Tex_0048B0,
- object_link_nuts_Tex_0048B0,
- object_link_nuts_Tex_0048B0,
- object_link_nuts_Tex_0048B0,
- object_link_nuts_Tex_0048B0,
- object_link_nuts_Tex_0048B0,
- object_link_nuts_Tex_0048B0,
- object_link_nuts_Tex_0048B0,
+ NULL, // PLAYER_EYES_OPEN
+ NULL, // PLAYER_EYES_HALF
+ NULL, // PLAYER_EYES_CLOSED
+ NULL, // PLAYER_EYES_RIGHT
+ NULL, // PLAYER_EYES_LEFT
+ NULL, // PLAYER_EYES_UP
+ NULL, // PLAYER_EYES_DOWN
+ NULL, // PLAYER_EYES_WINCING
},
+ // PLAYER_FORM_HUMAN
{
- gLinkHumanEyesOpenTex, // PLAYER_EYES_OPEN
- gLinkHumanEyesHalfTex, // PLAYER_EYES_HALF
- gLinkHumanEyesClosedTex, // PLAYER_EYES_CLOSED
- gLinkHumanEyesRollRightTex, // PLAYER_EYES_ROLL_RIGHT
- gLinkHumanEyesRollLeftTex, // PLAYER_EYES_ROLL_LEFT
- gLinkHumanEyesRollUpTex, // PLAYER_EYES_ROLL_UP
- gLinkHumanEyesRollDownTex, // PLAYER_EYES_ROLL_DOWN
- object_link_child_Tex_003800, // PLAYER_EYES_7
+ gLinkHumanEyesOpenTex, // PLAYER_EYES_OPEN
+ gLinkHumanEyesHalfTex, // PLAYER_EYES_HALF
+ gLinkHumanEyesClosedTex, // PLAYER_EYES_CLOSED
+ gLinkHumanEyesRightTex, // PLAYER_EYES_RIGHT
+ gLinkHumanEyesLeftTex, // PLAYER_EYES_LEFT
+ gLinkHumanEyesUpTex, // PLAYER_EYES_UP
+ gLinkHumanEyesDownTex, // PLAYER_EYES_DOWN
+ gLinkHumanEyesWincingTex, // PLAYER_EYES_WINCING
},
};
-TexturePtr sPlayerMouthTextures[PLAYER_FORM_MAX][PLAYER_MOUTH_MAX] = {
+static TexturePtr sMouthTextures[PLAYER_FORM_MAX][PLAYER_MOUTH_MAX] = {
+ // PLAYER_FORM_FIERCE_DEITY
+ {
+ NULL, // PLAYER_MOUTH_CLOSED
+ NULL, // PLAYER_MOUTH_HALF
+ NULL, // PLAYER_MOUTH_OPEN
+ NULL, // PLAYER_MOUTH_SMILE
+ },
+ // PLAYER_FORM_GORON
{
- gLinkFierceDeityMouthTex,
- gLinkFierceDeityMouthTex,
- gLinkFierceDeityMouthTex,
- gLinkFierceDeityMouthTex,
+ NULL, // PLAYER_MOUTH_CLOSED
+ NULL, // PLAYER_MOUTH_HALF
+ NULL, // PLAYER_MOUTH_OPEN
+ NULL, // PLAYER_MOUTH_SMILE
},
+ // PLAYER_FORM_ZORA
{
- NULL,
- NULL,
- NULL,
- NULL,
+ gLinkZoraMouthClosedTex, // PLAYER_MOUTH_CLOSED
+ gLinkZoraMouthHalfTex, // PLAYER_MOUTH_HALF
+ gLinkZoraMouthOpenTex, // PLAYER_MOUTH_OPEN
+ gLinkZoraMouthSmileTex, // PLAYER_MOUTH_SMILE
},
+ // PLAYER_FORM_DEKU
{
- gLinkZoraMouthClosedTex,
- object_link_zora_Tex_004400,
- gLinkZoraMouthAngryTex,
- gLinkZoraMouthHappyTex,
+ NULL, // PLAYER_MOUTH_CLOSED
+ NULL, // PLAYER_MOUTH_HALF
+ NULL, // PLAYER_MOUTH_OPEN
+ NULL, // PLAYER_MOUTH_SMILE
},
- { NULL, NULL, NULL, NULL },
+ // PLAYER_FORM_HUMAN
{
gLinkHumanMouthClosedTex, // PLAYER_MOUTH_CLOSED
- gLinkHumanMouthTeethTex, // PLAYER_MOUTH_TEETH
- gLinkHumanMouthAngryTex, // PLAYER_MOUTH_ANGRY
- gLinkHumanMouthHappyTex, // PLAYER_MOUTH_HAPPY
+ gLinkHumanMouthHalfTex, // PLAYER_MOUTH_HALF
+ gLinkHumanMouthOpenTex, // PLAYER_MOUTH_OPEN
+ gLinkHumanMouthSmileTex, // PLAYER_MOUTH_SMILE
},
};
-typedef struct PlayerFaceIndices {
- /* 0x0 */ u8 eyeIndex;
- /* 0x1 */ u8 mouthIndex;
-} PlayerFaceIndices; // size = 0x2
-
-PlayerFaceIndices sPlayerFaces[] = {
- { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_0
- { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_1
- { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_2
- { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_3
- { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_4
- { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_5
- { PLAYER_EYES_ROLL_LEFT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_6
- { PLAYER_EYES_ROLL_UP, PLAYER_MOUTH_TEETH }, // PLAYER_FACE_7
- { PLAYER_EYES_7, PLAYER_MOUTH_ANGRY }, // PLAYER_FACE_8
- { PLAYER_EYES_OPEN, PLAYER_MOUTH_ANGRY }, // PLAYER_FACE_9
- { PLAYER_EYES_ROLL_RIGHT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_10
- { PLAYER_EYES_ROLL_LEFT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_11
- { PLAYER_EYES_CLOSED, PLAYER_MOUTH_ANGRY }, // PLAYER_FACE_12
- { PLAYER_EYES_HALF, PLAYER_MOUTH_TEETH }, // PLAYER_FACE_13
- { PLAYER_EYES_OPEN, PLAYER_MOUTH_ANGRY }, // PLAYER_FACE_14
- { PLAYER_EYES_OPEN, PLAYER_MOUTH_HAPPY }, // PLAYER_FACE_15
+PlayerFaceIndices sPlayerFaces[PLAYER_FACE_MAX] = {
+ // The first 6 faces defined must be default blinking faces. See relevant code in `Player_UpdateCommon`.
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL
+ { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_HALF
+ { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_CLOSED
+
+ // This duplicate set of blinking faces is defined because Player will choose between the first and second set
+ // based on gameplayFrames. See relevant code in `Player_UpdateCommon`.
+ // This, in theory, allows for psuedo-random variance in the faces used. But in practice, duplicate faces are used.
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_2
+ { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_HALF_2
+ { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_CLOSED_2
+
+ // Additional faces. Most faces are encoded within animations.
+ { PLAYER_EYES_LEFT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_LEFT
+ { PLAYER_EYES_UP, PLAYER_MOUTH_HALF }, // PLAYER_FACE_SURPRISED
+ { PLAYER_EYES_WINCING, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_HURT
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_GASP
+ { PLAYER_EYES_RIGHT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_RIGHT
+ { PLAYER_EYES_LEFT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_LEFT_2
+ { PLAYER_EYES_CLOSED, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_EYES_CLOSED_MOUTH_OPEN
+ { PLAYER_EYES_HALF, PLAYER_MOUTH_HALF }, // PLAYER_FACE_OPENING
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_EYES_AND_MOUTH_OPEN
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_SMILE }, // PLAYER_FACE_SMILE
};
// Note the correct pointer to pass as the jointTable is the jointTable pointer from the SkelAnime struct, not the
@@ -2013,19 +2040,24 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL
eyeIndex = 0;
}
+ // If the eyes index provided by the animation is negative, use the value provided by the `face` argument instead
if (eyeIndex < 0) {
eyeIndex = sPlayerFaces[face].eyeIndex;
}
if (playerForm == PLAYER_FORM_GORON) {
- if ((eyeIndex >= PLAYER_EYES_ROLL_RIGHT) && (eyeIndex <= PLAYER_EYES_ROLL_DOWN)) {
+ // Goron does not have the eye textures to look in different directions
+ if ((eyeIndex >= PLAYER_EYES_RIGHT) && (eyeIndex <= PLAYER_EYES_DOWN)) {
eyeIndex = PLAYER_EYES_OPEN;
- } else if (eyeIndex == PLAYER_EYES_7) {
- eyeIndex = PLAYER_EYES_ROLL_RIGHT;
+ } else if (eyeIndex == PLAYER_EYES_WINCING) {
+ // Goron form puts a surpised expression where the eyes-right normally goes
+ eyeIndex = PLAYER_EYES_RIGHT;
}
}
- gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sPlayerEyesTextures[playerForm][eyeIndex]));
+ // Only Human, Zora, and Goron will read the eye textures in the head limb display list.
+ // Fierce Deity and Deku will point this segment to garbage data, but it will be unread from.
+ gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sEyeTextures[eyeIndex]));
// 2S2H [Port] Hess crash fix
if (mouthIndex >= PLAYER_MOUTH_MAX) {
@@ -2033,11 +2065,14 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL
mouthIndex = 0;
}
+ // If the mouth index provided by the animation is negative, use the value provided by the `face` argument instead
if (mouthIndex < 0) {
mouthIndex = sPlayerFaces[face].mouthIndex;
}
- gSPSegment(&gfx[1], 0x09, Lib_SegmentedToVirtual(sPlayerMouthTextures[playerForm][mouthIndex]));
+ // Only Human and Zora will read the mouth textures in the head limb display list.
+ // Goron, Fierce Deity, and Deku will point this segment to garbage data, but it will be unread from.
+ gSPSegment(&gfx[1], 0x09, Lib_SegmentedToVirtual(sMouthTextures[mouthIndex]));
POLY_OPA_DISP = &gfx[2];
diff --git a/mm/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/mm/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
index c95df251e..8fb8bea32 100644
--- a/mm/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
+++ b/mm/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
@@ -169,7 +169,7 @@ static TexturePtr sMouthTextures[] = {
gCremiaMouthHangingOpenTex,
};
-static TexturePtr sEyesTextures[] = {
+static TexturePtr sEyeTextures[] = {
gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex,
};
@@ -1526,7 +1526,7 @@ void EnMaYto_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sMouthTextures[this->mouthTexIndex]));
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyesTextures[this->eyeTexIndex]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnMaYto_OverrideLimbDraw, EnMaYto_PostLimbDraw, &this->actor);
diff --git a/mm/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/mm/src/overlays/actors/ovl_En_Test3/z_en_test3.c
index 649309f3e..621c53a13 100644
--- a/mm/src/overlays/actors/ovl_En_Test3/z_en_test3.c
+++ b/mm/src/overlays/actors/ovl_En_Test3/z_en_test3.c
@@ -1304,33 +1304,56 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL
}
}
-static TexturePtr sEyeTextures[] = {
- gKafeiEyesOpenTex, gKafeiEyesHalfTex, gKafeiEyesClosedTex, gKafeiEyesRollRightTex,
- gKafeiEyesRollLeftTex, gKafeiEyesRollUpTex, gKafeiEyesRollDownTex, object_test3_Tex_006680,
+static TexturePtr sEyeTextures[PLAYER_EYES_MAX] = {
+ gKafeiEyesOpenTex, // PLAYER_EYES_OPEN
+ gKafeiEyesHalfTex, // PLAYER_EYES_HALF
+ gKafeiEyesClosedTex, // PLAYER_EYES_CLOSED
+ gKafeiEyesRightTex, // PLAYER_EYES_RIGHT
+ gKafeiEyesLeftTex, // PLAYER_EYES_LEFT
+ gKafeiEyesUpTex, // PLAYER_EYES_UP
+ gKafeiEyesDownTex, // PLAYER_EYES_DOWN
+ gKafeiEyesWincingTex, // PLAYER_EYES_WINCING
};
-static TexturePtr sMouthTextures[] = {
- gKafeiMouthClosedTex,
- gKafeiMouthTeethTex,
- gKafeiMouthAngryTex,
- gKafeiMouthHappyTex,
+static TexturePtr sMouthTextures[PLAYER_MOUTH_MAX] = {
+ gKafeiMouthClosedTex, // PLAYER_MOUTH_CLOSED
+ gKafeiMouthHalfTex, // PLAYER_MOUTH_HALF
+ gKafeiMouthOpenTex, // PLAYER_MOUTH_OPEN
+ gKafeiMouthSmileTex, // PLAYER_MOUTH_SMILE
};
-typedef struct {
- /* 0x0 */ u8 eyeIndex;
- /* 0x1 */ u8 mouthIndex;
-} KafeiFace; // size = 0x2
-
-static KafeiFace sFaceExpressions[] = {
- { 0, 0 }, { 1, 0 }, { 2, 0 }, { 0, 0 }, { 1, 0 }, { 2, 0 }, { 4, 0 }, { 5, 1 }, { 7, 2 }, { 0, 2 },
- { 3, 0 }, { 4, 0 }, { 2, 2 }, { 1, 1 }, { 0, 2 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+static PlayerFaceIndices sKafeiFaces[PLAYER_FACE_MAX] = {
+ // The first 6 faces defined must be default blinking faces. See relevant code in `Player_UpdateCommon`.
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL
+ { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_HALF
+ { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_CLOSED
+
+ // This duplicate set of blinking faces is defined because Player will choose between the first and second set
+ // based on gameplayFrames. See relevant code in `Player_UpdateCommon`.
+ // This, in theory, allows for psuedo-random variance in the faces used. But in practice, duplicate faces are used.
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_2
+ { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_HALF_2
+ { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_CLOSED_2
+
+ // Additional faces. Most faces are encoded within animations.
+ { PLAYER_EYES_LEFT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_LEFT
+ { PLAYER_EYES_UP, PLAYER_MOUTH_HALF }, // PLAYER_FACE_SURPRISED
+ { PLAYER_EYES_WINCING, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_HURT
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_GASP
+ { PLAYER_EYES_RIGHT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_RIGHT
+ { PLAYER_EYES_LEFT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_LEFT_2
+ { PLAYER_EYES_CLOSED, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_EYES_CLOSED_MOUTH_OPEN
+ { PLAYER_EYES_HALF, PLAYER_MOUTH_HALF }, // PLAYER_FACE_OPENING
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_EYES_AND_MOUTH_OPEN
+ // The mouth in this entry deviates from player. Similar to OoT's `sPlayerFaces`.
+ { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_EYES_AND_MOUTH_OPEN
};
void EnTest3_Draw(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
EnTest3* this = (EnTest3*)thisx;
- s32 eyeTexIndex = GET_EYE_INDEX_FROM_JOINT_TABLE(this->player.skelAnime.jointTable);
- s32 mouthTexIndex = GET_MOUTH_INDEX_FROM_JOINT_TABLE(this->player.skelAnime.jointTable);
+ s32 eyeIndex = GET_EYE_INDEX_FROM_JOINT_TABLE(this->player.skelAnime.jointTable);
+ s32 mouthIndex = GET_MOUTH_INDEX_FROM_JOINT_TABLE(this->player.skelAnime.jointTable);
Gfx* gfx;
OPEN_DISPS(play->state.gfxCtx);
@@ -1356,26 +1379,34 @@ void EnTest3_Draw(Actor* thisx, PlayState* play2) {
gfx = POLY_OPA_DISP;
- if (eyeTexIndex < 0) {
- eyeTexIndex = sFaceExpressions[this->player.actor.shape.face].eyeIndex;
+ // If the eyes index provided by the animation is negative, use the value provided by the `face` argument instead
+ if (eyeIndex < 0) {
+ eyeIndex = sKafeiFaces[this->player.actor.shape.face].eyeIndex;
}
- gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sEyeTextures[eyeTexIndex]));
- if (mouthTexIndex < 0) {
- mouthTexIndex = sFaceExpressions[this->player.actor.shape.face].mouthIndex;
+
+ gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sEyeTextures[eyeIndex]));
+
+ // If the mouth index provided by the animation is negative, use the value provided by the `face` argument instead
+ if (mouthIndex < 0) {
+ mouthIndex = sKafeiFaces[this->player.actor.shape.face].mouthIndex;
}
- gSPSegment(&gfx[1], 0x09, Lib_SegmentedToVirtual(sMouthTextures[mouthTexIndex]));
+
+ gSPSegment(&gfx[1], 0x09, Lib_SegmentedToVirtual(sMouthTextures[mouthIndex]));
POLY_OPA_DISP = &gfx[2];
SkelAnime_DrawFlexLod(play, this->player.skelAnime.skeleton, this->player.skelAnime.jointTable,
this->player.skelAnime.dListCount, EnTest3_OverrideLimbDraw, EnTest3_PostLimbDraw,
&this->player.actor, 0);
+
if (this->player.invincibilityTimer > 0) {
POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
+
if ((this->player.getItemDrawIdPlusOne - 1) != GID_NONE) {
Player_DrawGetItem(play, &this->player);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.c
index f4e87f80c..cd79ad471 100644
--- a/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.c
+++ b/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.c
@@ -199,7 +199,7 @@ void func_80BA383C(EnToto* this, PlayState* play) {
}
Animation_PlayOnce(&this->skelAnime, sAnimations[this->animIndex]);
}
- func_800BBB74(&this->blinkInfo, 20, 80, 3);
+ FaceChange_UpdateBlinkingNonHuman(&this->faceChange, 20, 80, 3);
}
void func_80BA3930(EnToto* this, PlayState* play) {
@@ -300,7 +300,7 @@ void func_80BA3D38(EnToto* this, PlayState* play) {
this->text = ENTOTO_WEEK_EVENT_FLAGS ? &D_80BA5088[13] : &D_80BA5088[0];
func_80BA4C0C(this, play);
play->actorCtx.flags |= ACTORCTX_FLAG_5;
- this->blinkInfo.eyeTexIndex = 0;
+ this->faceChange.face = 0;
}
void func_80BA3DBC(EnToto* this, PlayState* play) {
@@ -704,14 +704,14 @@ void EnToto_Update(Actor* thisx, PlayState* play) {
}
void EnToto_Draw(Actor* thisx, PlayState* play) {
- static TexturePtr sp4C[] = { object_zm_Tex_008AE8, object_zm_Tex_00A068, object_zm_Tex_00A468 };
+ static TexturePtr eyeTextures[] = { gTotoEyesOpenTex, gTotoEyesHalfTex, gTotoEyesClosedTex };
EnToto* this = (EnToto*)thisx;
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL25_Opa(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp4C[this->blinkInfo.eyeTexIndex]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(eyeTextures[this->faceChange.face]));
Scene_SetRenderModeXlu(play, 0, 1);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL,
NULL, &this->actor);
diff --git a/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.h b/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.h
index 11578cd23..81f9f015c 100644
--- a/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.h
+++ b/mm/src/overlays/actors/ovl_En_Toto/z_en_toto.h
@@ -2,6 +2,7 @@
#define Z_EN_TOTO_H
#include "global.h"
+#include "face_change.h"
#include "objects/object_zm/object_zm.h"
struct EnToto;
@@ -31,7 +32,7 @@ typedef struct EnToto {
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[OBJECT_ZM_LIMB_MAX];
/* 0x1F4 */ Vec3s morphTable[OBJECT_ZM_LIMB_MAX];
- /* 0x260 */ BlinkInfo blinkInfo;
+ /* 0x260 */ FaceChange faceChange;
/* 0x264 */ ColliderCylinder collider;
/* 0x2B0 */ u8 actionFuncIndex;
/* 0x2B1 */ u8 unk2B1;
diff --git a/mm/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/mm/src/overlays/actors/ovl_En_Zod/z_en_zod.c
index 1dc9657e4..a1e022db7 100644
--- a/mm/src/overlays/actors/ovl_En_Zod/z_en_zod.c
+++ b/mm/src/overlays/actors/ovl_En_Zod/z_en_zod.c
@@ -626,7 +626,7 @@ void EnZod_DrawDrums(EnZod* this, PlayState* play) {
}
void EnZod_Draw(Actor* thisx, PlayState* play) {
- static TexturePtr sTijoEyesTextures[] = { &gTijoEyesOpenTex, &gTijoEyesHalfOpenTex, &gTijoEyesClosedTex };
+ static TexturePtr sTijoEyeTextures[] = { &gTijoEyesOpenTex, &gTijoEyesHalfOpenTex, &gTijoEyesClosedTex };
EnZod* this = (EnZod*)thisx;
Gfx* gfx;
@@ -640,7 +640,7 @@ void EnZod_Draw(Actor* thisx, PlayState* play) {
gfx = POLY_OPA_DISP;
- gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sTijoEyesTextures[this->eyeIndex]));
+ gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sTijoEyeTextures[this->eyeIndex]));
gSPSegment(&gfx[1], 0x09, Lib_SegmentedToVirtual(&gTijoMouthClosedTex));
POLY_OPA_DISP = &gfx[2];
diff --git a/mm/src/overlays/actors/ovl_player_actor/z_player.c b/mm/src/overlays/actors/ovl_player_actor/z_player.c
index 7f746aadc..5eea8c026 100644
--- a/mm/src/overlays/actors/ovl_player_actor/z_player.c
+++ b/mm/src/overlays/actors/ovl_player_actor/z_player.c
@@ -12696,12 +12696,12 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
}
if ((this->transformation >= PLAYER_FORM_GORON) && (this->transformation <= PLAYER_FORM_DEKU)) {
- func_800BBB74(&this->blinkInfo, 20, 80, 3);
+ FaceChange_UpdateBlinkingNonHuman(&this->faceChange, 20, 80, 3);
} else {
- func_800BBAC0(&this->blinkInfo, 20, 80, 6);
+ FaceChange_UpdateBlinking(&this->faceChange, 20, 80, 6);
}
- this->actor.shape.face = ((play->gameplayFrames & 0x20) ? 0 : 3) + this->blinkInfo.eyeTexIndex;
+ this->actor.shape.face = ((play->gameplayFrames & 0x20) ? 0 : 3) + this->faceChange.face;
if (GameInteractor_Should(VB_CONSIDER_BUNNY_HOOD_EQUIPPED, this->currentMask == PLAYER_MASK_BUNNY, this)) {
Player_UpdateBunnyEars(this);
@@ -17737,7 +17737,7 @@ void func_80852290(PlayState* play, Player* this) {
this->unk_B8A = 8;
} else {
f32 sp3C;
- s16 var_a1_3;
+ s16 upperLimbRotX;
s16 sp38;
if ((play->msgCtx.ocarinaMode == OCARINA_MODE_ACTIVE) &&
@@ -17768,20 +17768,20 @@ void func_80852290(PlayState* play, Player* this) {
sp38 = 0x2EE0;
}
- var_a1_3 = (sp3C * -100.0f);
- var_a1_3 = CLAMP_MAX(var_a1_3, 0xFA0);
- Math_SmoothStepToS(&this->upperLimbRot.x, var_a1_3, 4, 0x7D0, 0);
+ upperLimbRotX = (sp3C * -100.0f);
+ upperLimbRotX = CLAMP_MAX(upperLimbRotX, 0xFA0);
+ Math_SmoothStepToS(&this->upperLimbRot.x, upperLimbRotX, 4, 0x7D0, 0);
Math_SmoothStepToS(&this->upperLimbRot.y, sp38, 4, 0x7D0, 0);
this->headLimbRot.x = -this->upperLimbRot.x;
this->unk_AA6_rotFlags |= UNKAA6_ROT_HEAD_X | UNKAA6_ROT_UPPER_X | UNKAA6_ROT_UPPER_Y;
- var_a1_3 = ABS_ALT(this->upperLimbRot.x);
- if (var_a1_3 < 0x7D0) {
- this->actor.shape.face = 0;
- } else if (var_a1_3 < 0xFA0) {
- this->actor.shape.face = 13;
+ upperLimbRotX = ABS_ALT(this->upperLimbRot.x);
+ if (upperLimbRotX < 0x7D0) {
+ this->actor.shape.face = PLAYER_FACE_NEUTRAL;
+ } else if (upperLimbRotX < 0xFA0) {
+ this->actor.shape.face = PLAYER_FACE_OPENING;
} else {
- this->actor.shape.face = 8;
+ this->actor.shape.face = PLAYER_FACE_HURT;
}
}
@@ -20981,7 +20981,7 @@ void Player_CsAction_11(PlayState* play, Player* this, CsCmdActorCue* cue) {
}
void Player_CsAction_12(PlayState* play, Player* this, CsCmdActorCue* cue) {
- this->actor.shape.face = 0xF;
+ this->actor.shape.face = PLAYER_FACE_SMILE;
func_80840F90(play, this, cue, 0.0f, 0, 0);
}
diff --git a/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
index ff832aed5..d0f8f9ee1 100644
--- a/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
+++ b/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
@@ -28,6 +28,8 @@
#include "2s2h/Enhancements/Songs/Songs.h"
#include "public/bridge/consolevariablebridge.h"
+#pragma increment_block_number "n64-us:128"
+
// Page Textures (Background of Page):
// Broken up into multiple textures.
// Numbered by column/row.