Document Player's Face and z_actor FaceChange functions (#1777)

* player face docs

* more docs

* cleanup

* toto

* more comments

* fix bss, names

* better comment

* PR, fix comment

* fix bss

* sEyeTextures comment

* FaceChange_UpdateBlinkingNonHuman

---------

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
engineer124 2025-06-04 11:59:25 +10:00 committed by GitHub
parent ace4043d1a
commit d31ceacfdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 405 additions and 192 deletions

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

13
include/face_change.h Normal file
View File

@ -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

View File

@ -54,7 +54,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
@ -759,11 +759,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[];
@ -911,9 +906,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);

View File

@ -9,6 +9,7 @@
#include "z64interface.h"
#include "z64item.h"
#include "z64light.h"
#include "face_change.h"
struct Player;
struct PlayState;
@ -473,44 +474,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;
} PlayerMouth;
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;
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,
@ -1165,7 +1172,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;

View File

@ -16,6 +16,8 @@
#include "z64vimode.h"
#include "z64vis.h"
#pragma increment_block_number "n64-us:128"
s32 gFramerateDivisor = 1;
f32 gFramerateDivisorF = 1.0f;
f32 gFramerateDivisorHalf = 1.0f / 2.0f;

View File

@ -3831,51 +3831,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);
/**
* 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 (info->blinkTimer - arg3 > 0) {
info->eyeTexIndex = 0;
} else if ((info->blinkTimer - arg3 >= -1) || (info->blinkTimer < 2)) {
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 >= -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) {

View File

@ -1837,46 +1837,156 @@ Gfx gCullFrontDList[] = {
gsSPEndDisplayList(),
};
TexturePtr sPlayerEyesTextures[PLAYER_EYES_MAX] = {
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
/**
* 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.
*/
#ifndef AVOID_UB
static TexturePtr sEyeTextures[PLAYER_EYES_MAX] = {
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_MOUTH_MAX] = {
static TexturePtr sMouthTextures[PLAYER_MOUTH_MAX] = {
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
};
#else
static TexturePtr sEyeTextures[PLAYER_FORM_MAX][PLAYER_EYES_MAX] = {
// PLAYER_FORM_FIERCE_DEITY
{
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, // 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, // 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
{
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
gLinkHumanEyesRightTex, // PLAYER_EYES_RIGHT
gLinkHumanEyesLeftTex, // PLAYER_EYES_LEFT
gLinkHumanEyesUpTex, // PLAYER_EYES_UP
gLinkHumanEyesDownTex, // PLAYER_EYES_DOWN
gLinkHumanEyesWincingTex, // PLAYER_EYES_WINCING
},
};
typedef struct PlayerFaceIndices {
/* 0x0 */ u8 eyeIndex;
/* 0x1 */ u8 mouthIndex;
} PlayerFaceIndices; // size = 0x2
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
{
NULL, // PLAYER_MOUTH_CLOSED
NULL, // PLAYER_MOUTH_HALF
NULL, // PLAYER_MOUTH_OPEN
NULL, // PLAYER_MOUTH_SMILE
},
// PLAYER_FORM_ZORA
{
gLinkZoraMouthClosedTex, // PLAYER_MOUTH_CLOSED
gLinkZoraMouthHalfTex, // PLAYER_MOUTH_HALF
gLinkZoraMouthOpenTex, // PLAYER_MOUTH_OPEN
gLinkZoraMouthSmileTex, // PLAYER_MOUTH_SMILE
},
// PLAYER_FORM_DEKU
{
NULL, // PLAYER_MOUTH_CLOSED
NULL, // PLAYER_MOUTH_HALF
NULL, // PLAYER_MOUTH_OPEN
NULL, // PLAYER_MOUTH_SMILE
},
// PLAYER_FORM_HUMAN
{
gLinkHumanMouthClosedTex, // PLAYER_MOUTH_CLOSED
gLinkHumanMouthHalfTex, // PLAYER_MOUTH_HALF
gLinkHumanMouthOpenTex, // PLAYER_MOUTH_OPEN
gLinkHumanMouthSmileTex, // PLAYER_MOUTH_SMILE
},
};
#endif
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
@ -1892,25 +2002,41 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL
gfx = POLY_OPA_DISP;
// 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[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.
#ifndef AVOID_UB
gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sEyeTextures[eyeIndex]));
#else
gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sEyeTextures[playerForm][eyeIndex]));
#endif
// 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[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.
#ifndef AVOID_UB
gSPSegment(&gfx[1], 0x09, Lib_SegmentedToVirtual(sMouthTextures[mouthIndex]));
#else
gSPSegment(&gfx[1], 0x09, Lib_SegmentedToVirtual(sMouthTextures[playerForm][mouthIndex]));
#endif
POLY_OPA_DISP = &gfx[2];

View File

@ -169,7 +169,7 @@ static TexturePtr sMouthTextures[] = {
gCremiaMouthHangingOpenTex,
};
static TexturePtr sEyesTextures[] = {
static TexturePtr sEyeTextures[] = {
gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex,
};
@ -1523,7 +1523,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);

View File

@ -1216,33 +1216,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 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
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 },
// 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);
@ -1268,25 +1291,33 @@ 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);
}

View File

@ -198,7 +198,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) {
@ -299,7 +299,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) {
@ -702,14 +702,14 @@ void EnToto_Update(Actor* thisx, PlayState* play) {
}
void EnToto_Draw(Actor* thisx, PlayState* play) {
TexturePtr sp4C[] = { object_zm_Tex_008AE8, object_zm_Tex_00A068, object_zm_Tex_00A468 };
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);

View File

@ -2,6 +2,7 @@
#define Z_EN_TOTO_H
#include "global.h"
#include "face_change.h"
#include "assets/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;

View File

@ -627,7 +627,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;
@ -641,7 +641,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];

View File

@ -12531,12 +12531,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 (this->currentMask == PLAYER_MASK_BUNNY) {
Player_UpdateBunnyEars(this);
@ -17329,7 +17329,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) &&
@ -17360,20 +17360,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;
}
}
@ -20526,7 +20526,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);
}

View File

@ -18,6 +18,8 @@
#include "assets/interface/icon_item_jpn_static/icon_item_jpn_static.h"
#include "assets/interface/icon_item_vtx_static/icon_item_vtx_static.h"
#pragma increment_block_number "n64-us:128"
// Page Textures (Background of Page):
// Broken up into multiple textures.
// Numbered by column/row.

View File

@ -844,9 +844,9 @@
0x800BB604:("Attention_FindActorInCategory",),
0x800BB8EC:("Attention_FindActor",),
0x800BBA88:("Enemy_StartFinishingBlow",),
0x800BBAC0:("func_800BBAC0",),
0x800BBB74:("func_800BBB74",),
0x800BBC20:("func_800BBC20",),
0x800BBAC0:("FaceChange_UpdateBlinking",),
0x800BBB74:("FaceChange_UpdateBlinkingNonHuman",),
0x800BBC20:("FaceChange_UpdateRandomSet",),
0x800BBCEC:("Actor_SpawnBodyParts",),
0x800BBDAC:("Actor_SpawnFloorDustRing",),
0x800BBFB0:("func_800BBFB0",),

View File

@ -1204,8 +1204,8 @@
0x801C0838:("D_801C0838","UNK_TYPE1","",0x1),
0x801C0850:("gCullBackDList","UNK_TYPE1","",0x1),
0x801C0860:("gCullFrontDList","UNK_TYPE1","",0x1),
0x801C0870:("sPlayerEyesTextures","UNK_PTR","",0x4),
0x801C0890:("sPlayerMouthTextures","UNK_TYPE1","",0x1),
0x801C0870:("sEyeTextures","UNK_PTR","",0x4),
0x801C0890:("sMouthTextures","UNK_TYPE1","",0x1),
0x801C08A0:("sPlayerFaces","UNK_TYPE1","",0x20),
0x801C08C0:("D_801C08C0","UNK_TYPE1","",0x1),
0x801C08FC:("D_801C08FC","UNK_TYPE1","",0x1),

View File

@ -358,9 +358,9 @@ asm/non_matchings/code/z_actor/Attention_ActorOnScreen.s,Attention_ActorOnScreen
asm/non_matchings/code/z_actor/Attention_FindActorInCategory.s,Attention_FindActorInCategory,0x800BB604,0xBA
asm/non_matchings/code/z_actor/Attention_FindActor.s,Attention_FindActor,0x800BB8EC,0x67
asm/non_matchings/code/z_actor/Enemy_StartFinishingBlow.s,Enemy_StartFinishingBlow,0x800BBA88,0xE
asm/non_matchings/code/z_actor/func_800BBAC0.s,func_800BBAC0,0x800BBAC0,0x2D
asm/non_matchings/code/z_actor/func_800BBB74.s,func_800BBB74,0x800BBB74,0x2B
asm/non_matchings/code/z_actor/func_800BBC20.s,func_800BBC20,0x800BBC20,0x33
asm/non_matchings/code/z_actor/FaceChange_UpdateBlinking.s,FaceChange_UpdateBlinking,0x800BBAC0,0x2D
asm/non_matchings/code/z_actor/FaceChange_UpdateBlinkingNonHuman.s,FaceChange_UpdateBlinkingNonHuman,0x800BBB74,0x2B
asm/non_matchings/code/z_actor/FaceChange_UpdateRandomSet.s,FaceChange_UpdateRandomSet,0x800BBC20,0x33
asm/non_matchings/code/z_actor/Actor_SpawnBodyParts.s,Actor_SpawnBodyParts,0x800BBCEC,0x30
asm/non_matchings/code/z_actor/Actor_SpawnFloorDustRing.s,Actor_SpawnFloorDustRing,0x800BBDAC,0x81
asm/non_matchings/code/z_actor/func_800BBFB0.s,func_800BBFB0,0x800BBFB0,0x69

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
358 asm/non_matchings/code/z_actor/Attention_FindActorInCategory.s Attention_FindActorInCategory 0x800BB604 0xBA
359 asm/non_matchings/code/z_actor/Attention_FindActor.s Attention_FindActor 0x800BB8EC 0x67
360 asm/non_matchings/code/z_actor/Enemy_StartFinishingBlow.s Enemy_StartFinishingBlow 0x800BBA88 0xE
361 asm/non_matchings/code/z_actor/func_800BBAC0.s asm/non_matchings/code/z_actor/FaceChange_UpdateBlinking.s func_800BBAC0 FaceChange_UpdateBlinking 0x800BBAC0 0x2D
362 asm/non_matchings/code/z_actor/func_800BBB74.s asm/non_matchings/code/z_actor/FaceChange_UpdateBlinkingNonHuman.s func_800BBB74 FaceChange_UpdateBlinkingNonHuman 0x800BBB74 0x2B
363 asm/non_matchings/code/z_actor/func_800BBC20.s asm/non_matchings/code/z_actor/FaceChange_UpdateRandomSet.s func_800BBC20 FaceChange_UpdateRandomSet 0x800BBC20 0x33
364 asm/non_matchings/code/z_actor/Actor_SpawnBodyParts.s Actor_SpawnBodyParts 0x800BBCEC 0x30
365 asm/non_matchings/code/z_actor/Actor_SpawnFloorDustRing.s Actor_SpawnFloorDustRing 0x800BBDAC 0x81
366 asm/non_matchings/code/z_actor/func_800BBFB0.s func_800BBFB0 0x800BBFB0 0x69