mirror of https://github.com/zeldaret/mm.git
Document object_cow (#650)
* Document object_cow * Respond to reviews * Reorder flags
This commit is contained in:
parent
a5e631d03f
commit
18e714e098
|
|
@ -1,38 +1,57 @@
|
|||
<Root>
|
||||
<!-- Assets for cows -->
|
||||
<File Name="object_cow" Segment="6">
|
||||
<Animation Name="gCowBodyChewAnim" Offset="0x1CC" />
|
||||
<DList Name="object_cow_DL_001A80" Offset="0x1A80" />
|
||||
<DList Name="object_cow_DL_001FE8" Offset="0x1FE8" />
|
||||
<DList Name="object_cow_DL_002368" Offset="0x2368" />
|
||||
<DList Name="object_cow_DL_002628" Offset="0x2628" />
|
||||
<DList Name="object_cow_DL_002760" Offset="0x2760" />
|
||||
<Texture Name="object_cow_TLUT_002880" OutName="tlut_002880" Format="rgba16" Width="16" Height="16" Offset="0x2880" />
|
||||
<Texture Name="object_cow_Tex_002A80" OutName="tex_002A80" Format="ci8" Width="16" Height="16" Offset="0x2A80" />
|
||||
<Texture Name="object_cow_Tex_002B80" OutName="tex_002B80" Format="ci8" Width="8" Height="8" Offset="0x2B80" />
|
||||
<Texture Name="object_cow_Tex_002BC0" OutName="tex_002BC0" Format="ci8" Width="16" Height="16" Offset="0x2BC0" />
|
||||
<Texture Name="object_cow_Tex_002CC0" OutName="tex_002CC0" Format="i8" Width="64" Height="64" Offset="0x2CC0" />
|
||||
<Texture Name="object_cow_Tex_003CC0" OutName="tex_003CC0" Format="ci8" Width="8" Height="16" Offset="0x3CC0" />
|
||||
<Texture Name="object_cow_Tex_003D40" OutName="tex_003D40" Format="rgba16" Width="16" Height="16" Offset="0x3D40" />
|
||||
<Texture Name="object_cow_Tex_003F40" OutName="tex_003F40" Format="ci8" Width="8" Height="16" Offset="0x3F40" />
|
||||
<Limb Name="object_cow_Standardlimb_003FC0" Type="Standard" Offset="0x3FC0" />
|
||||
<Limb Name="object_cow_Standardlimb_003FCC" Type="Standard" Offset="0x3FCC" />
|
||||
<Limb Name="object_cow_Standardlimb_003FD8" Type="Standard" Offset="0x3FD8" />
|
||||
<Limb Name="object_cow_Standardlimb_003FE4" Type="Standard" Offset="0x3FE4" />
|
||||
<Limb Name="object_cow_Standardlimb_003FF0" Type="Standard" Offset="0x3FF0" />
|
||||
<Skeleton Name="gCowBodySkel" Type="Flex" LimbType="Standard" Offset="0x4010" />
|
||||
<Animation Name="gCowBodyMoveHeadAnim" Offset="0x4264" />
|
||||
<Animation Name="gCowTailIdleAnim" Offset="0x4348" />
|
||||
<DList Name="object_cow_DL_0046F0" Offset="0x46F0" />
|
||||
<DList Name="object_cow_DL_0047D0" Offset="0x47D0" />
|
||||
<DList Name="object_cow_DL_0048D0" Offset="0x48D0" />
|
||||
<DList Name="object_cow_DL_0049D0" Offset="0x49D0" />
|
||||
<DList Name="object_cow_DL_004AD0" Offset="0x4AD0" />
|
||||
<Limb Name="object_cow_Standardlimb_004BE0" Type="Standard" Offset="0x4BE0" />
|
||||
<Limb Name="object_cow_Standardlimb_004BEC" Type="Standard" Offset="0x4BEC" />
|
||||
<Limb Name="object_cow_Standardlimb_004BF8" Type="Standard" Offset="0x4BF8" />
|
||||
<Limb Name="object_cow_Standardlimb_004C04" Type="Standard" Offset="0x4C04" />
|
||||
<Limb Name="object_cow_Standardlimb_004C10" Type="Standard" Offset="0x4C10" />
|
||||
<Skeleton Name="gCowTailSkel" Type="Flex" LimbType="Standard" Offset="0x4C30" />
|
||||
<Animation Name="gCowTailSwishAnim" Offset="0x4E98" />
|
||||
<Animation Name="gCowChewAnim" Offset="0x1CC" /> <!-- Original name is "usi_mogmog" (onomatopoeia for chewing) -->
|
||||
|
||||
<!-- Cow Limb DisplayLists -->
|
||||
<DList Name="gCowBodyDL" Offset="0x1A80" />
|
||||
<DList Name="gCowHeadDL" Offset="0x1FE8" />
|
||||
<DList Name="gCowNoseDL" Offset="0x2368" />
|
||||
<DList Name="gCowNoseRingDL" Offset="0x2628" />
|
||||
<DList Name="gCowJawDL" Offset="0x2760" />
|
||||
|
||||
<!-- Cow Palettes -->
|
||||
<Texture Name="gCowTLUT" OutName="cow_tlut" Format="rgba16" Width="16" Height="16" Offset="0x2880" />
|
||||
|
||||
<!-- Cow Textures -->
|
||||
<Texture Name="gCowUdderTex" OutName="cow_udder" Format="ci8" Width="16" Height="16" Offset="0x2A80" />
|
||||
<Texture Name="gCowNoseRingTex" OutName="cow_nose_ring" Format="ci8" Width="8" Height="8" Offset="0x2B80" />
|
||||
<Texture Name="gCowNoseTex" OutName="cow_nose" Format="ci8" Width="16" Height="16" Offset="0x2BC0" />
|
||||
<Texture Name="gCowSpotsTex" OutName="cow_spots" Format="i8" Width="64" Height="64" Offset="0x2CC0" />
|
||||
<Texture Name="gCowEarTex" OutName="cow_ear" Format="ci8" Width="8" Height="16" Offset="0x3CC0" />
|
||||
<Texture Name="gCowEyelidTex" OutName="cow_eyelid" Format="rgba16" Width="16" Height="16" Offset="0x3D40" />
|
||||
<Texture Name="gCowLegAndTailTex" OutName="cow_leg_and_tail" Format="ci8" Width="8" Height="16" Offset="0x3F40" />
|
||||
|
||||
<!-- Cow Limb DisplayLists -->
|
||||
<Limb Name="gCowBodyLimb" Type="Standard" EnumName="COW_LIMB_BODY" Offset="0x3FC0" />
|
||||
<Limb Name="gCowHeadLimb" Type="Standard" EnumName="COW_LIMB_HEAD" Offset="0x3FCC" />
|
||||
<Limb Name="gCowJawLimb" Type="Standard" EnumName="COW_LIMB_JAW" Offset="0x3FD8" />
|
||||
<Limb Name="gCowNoseLimb" Type="Standard" EnumName="COW_LIMB_NOSE" Offset="0x3FE4" />
|
||||
<Limb Name="gCowNoseRingLimb" Type="Standard" EnumName="COW_LIMB_NOSE_RING" Offset="0x3FF0" />
|
||||
|
||||
<!-- Cow Skeleton -->
|
||||
<Skeleton Name="gCowSkel" Type="Flex" LimbType="Standard" LimbNone="COW_LIMB_NONE" LimbMax="COW_LIMB_MAX" EnumName="CowLimbs" Offset="0x4010" />
|
||||
|
||||
<Animation Name="gCowMooAnim" Offset="0x4264" /> <!-- Original name is "usi_mooo" -->
|
||||
<Animation Name="gCowTailIdleAnim" Offset="0x4348" /> <!-- Original name is "ust_daran" ("loosely") -->
|
||||
|
||||
<!-- Cow Tail Limb DisplayLists -->
|
||||
<DList Name="gCowTailBaseDL" Offset="0x46F0" />
|
||||
<DList Name="gCowTailUpperDL" Offset="0x47D0" />
|
||||
<DList Name="gCowTailMiddleDL" Offset="0x48D0" />
|
||||
<DList Name="gCowTailLowerDL" Offset="0x49D0" />
|
||||
<DList Name="gCowTailEndDL" Offset="0x4AD0" />
|
||||
|
||||
<!-- Cow Tail Limbs -->
|
||||
<Limb Name="gCowTailBaseLimb" Type="Standard" EnumName="COW_TAIL_LIMB_BASE" Offset="0x4BE0" />
|
||||
<Limb Name="gCowTailUpperLimb" Type="Standard" EnumName="COW_TAIL_LIMB_UPPER" Offset="0x4BEC" />
|
||||
<Limb Name="gCowTailMiddleLimb" Type="Standard" EnumName="COW_TAIL_LIMB_MIDDLE" Offset="0x4BF8" />
|
||||
<Limb Name="gCowTailLowerLimb" Type="Standard" EnumName="COW_TAIL_LIMB_LOWER" Offset="0x4C04" />
|
||||
<Limb Name="gCowTailEndLimb" Type="Standard" EnumName="COW_TAIL_LIMB_END" Offset="0x4C10" />
|
||||
|
||||
<!-- Cow Tail Skeleton -->
|
||||
<Skeleton Name="gCowTailSkel" Type="Flex" LimbType="Standard" LimbNone="COW_TAIL_LIMB_NONE" LimbMax="COW_TAIL_LIMB_MAX" EnumName="CowTailLimbs"Offset="0x4C30" />
|
||||
|
||||
<Animation Name="gCowTailSwishAnim" Offset="0x4E98" /> <!-- Original name is "ust_furifuri" ("fluttery") -->
|
||||
</File>
|
||||
</Root>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@
|
|||
*/
|
||||
|
||||
#include "z_en_cow.h"
|
||||
#include "objects/object_cow/object_cow.h"
|
||||
|
||||
#define FLAGS 0x00000009
|
||||
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8)
|
||||
|
||||
#define THIS ((EnCow*)thisx)
|
||||
|
||||
|
|
@ -107,9 +106,9 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
switch (EN_COW_TYPE(thisx)) {
|
||||
case EN_COW_TYPE_DEFAULT:
|
||||
case EN_COW_TYPE_ABDUCTED:
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowBodySkel, NULL, this->jointTable, this->morphTable,
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable,
|
||||
COW_LIMB_MAX);
|
||||
Animation_PlayLoop(&this->skelAnime, &gCowBodyChewAnim);
|
||||
Animation_PlayLoop(&this->skelAnime, &gCowChewAnim);
|
||||
|
||||
Collider_InitAndSetCylinder(globalCtx, &this->colliders[0], &this->actor, &sCylinderInit);
|
||||
Collider_InitAndSetCylinder(globalCtx, &this->colliders[1], &this->actor, &sCylinderInit);
|
||||
|
|
@ -136,7 +135,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
break;
|
||||
case EN_COW_TYPE_TAIL:
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable,
|
||||
COW_LIMB_MAX);
|
||||
COW_TAIL_LIMB_MAX);
|
||||
Animation_PlayLoop(&this->skelAnime, &gCowTailIdleAnim);
|
||||
|
||||
this->actor.update = EnCow_UpdateTail;
|
||||
|
|
@ -145,7 +144,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
EnCow_SetTailPos(this);
|
||||
|
||||
this->actor.flags &= ~EN_COW_FLAG_IS_TAIL;
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
this->animationTimer = Rand_ZeroFloat(1000.0f) + 40.0f;
|
||||
break;
|
||||
}
|
||||
|
|
@ -171,13 +170,13 @@ void EnCow_UpdateAnimation(EnCow* this, GlobalContext* globalCtx) {
|
|||
this->animationTimer--;
|
||||
} else {
|
||||
this->animationTimer = Rand_ZeroFloat(500.0f) + 40.0f;
|
||||
Animation_Change(&this->skelAnime, &gCowBodyChewAnim, 1.0f, this->skelAnime.curFrame,
|
||||
Animation_GetLastFrame(&gCowBodyChewAnim), ANIMMODE_ONCE, 1.0f);
|
||||
Animation_Change(&this->skelAnime, &gCowChewAnim, 1.0f, this->skelAnime.curFrame,
|
||||
Animation_GetLastFrame(&gCowChewAnim), ANIMMODE_ONCE, 1.0f);
|
||||
}
|
||||
if (this->actor.xzDistToPlayer < 150.0f) {
|
||||
if (!(this->flags & EN_COW_FLAG_PLAYER_HAS_APPROACHED)) {
|
||||
this->flags |= EN_COW_FLAG_PLAYER_HAS_APPROACHED;
|
||||
if (this->skelAnime.animation == &gCowBodyChewAnim) {
|
||||
if (this->skelAnime.animation == &gCowChewAnim) {
|
||||
this->animationTimer = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -202,7 +201,7 @@ void EnCow_UpdateAnimation(EnCow* this, GlobalContext* globalCtx) {
|
|||
|
||||
void EnCow_TalkEnd(EnCow* this, GlobalContext* globalCtx) {
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
|
||||
this->actor.flags &= ~0x10000;
|
||||
this->actor.flags &= ~ACTOR_FLAG_10000;
|
||||
func_801477B4(globalCtx);
|
||||
this->actionFunc = EnCow_Idle;
|
||||
}
|
||||
|
|
@ -210,7 +209,7 @@ void EnCow_TalkEnd(EnCow* this, GlobalContext* globalCtx) {
|
|||
|
||||
void EnCow_GiveMilkEnd(EnCow* this, GlobalContext* globalCtx) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
|
||||
this->actor.flags &= ~0x10000;
|
||||
this->actor.flags &= ~ACTOR_FLAG_10000;
|
||||
this->actionFunc = EnCow_Idle;
|
||||
}
|
||||
}
|
||||
|
|
@ -226,7 +225,7 @@ void EnCow_GiveMilkWait(EnCow* this, GlobalContext* globalCtx) {
|
|||
|
||||
void EnCow_GiveMilk(EnCow* this, GlobalContext* globalCtx) {
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
|
||||
this->actor.flags &= ~0x10000;
|
||||
this->actor.flags &= ~ACTOR_FLAG_10000;
|
||||
func_801477B4(globalCtx);
|
||||
this->actionFunc = EnCow_GiveMilkWait;
|
||||
Actor_PickUp(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f);
|
||||
|
|
@ -255,7 +254,7 @@ void EnCow_Talk(EnCow* this, GlobalContext* globalCtx) {
|
|||
this->actionFunc = EnCow_TalkEnd;
|
||||
}
|
||||
} else {
|
||||
this->actor.flags |= 0x10000;
|
||||
this->actor.flags |= ACTOR_FLAG_10000;
|
||||
func_800B8614(&this->actor, globalCtx, 170.0f);
|
||||
this->actor.textId = 0x32C8; //! @bug textId is reset to this no matter the intial value
|
||||
}
|
||||
|
|
@ -273,7 +272,7 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) {
|
|||
ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 25000) {
|
||||
D_801BDAA4 = 0;
|
||||
this->actionFunc = EnCow_Talk;
|
||||
this->actor.flags |= 0x10000;
|
||||
this->actor.flags |= ACTOR_FLAG_10000;
|
||||
func_800B8614(&this->actor, globalCtx, 170.0f);
|
||||
this->actor.textId = 0x32C8; // Text to give milk after playing Epona's Song.
|
||||
|
||||
|
|
@ -297,7 +296,7 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
this->actor.textId = 0x32CA; // Text if you don't have an empty bottle.
|
||||
}
|
||||
this->actor.flags |= 0x10000;
|
||||
this->actor.flags |= ACTOR_FLAG_10000;
|
||||
func_800B8614(&this->actor, globalCtx, 170.0f);
|
||||
this->actionFunc = EnCow_Talk;
|
||||
}
|
||||
|
|
@ -344,12 +343,12 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
|
||||
if (SkelAnime_Update(&this->skelAnime)) {
|
||||
if (this->skelAnime.animation == &gCowBodyChewAnim) {
|
||||
if (this->skelAnime.animation == &gCowChewAnim) {
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_COW_CRY);
|
||||
Animation_Change(&this->skelAnime, &gCowBodyMoveHeadAnim, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(&gCowBodyMoveHeadAnim), ANIMMODE_ONCE, 1.0f);
|
||||
Animation_Change(&this->skelAnime, &gCowMooAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCowMooAnim),
|
||||
ANIMMODE_ONCE, 1.0f);
|
||||
} else {
|
||||
Animation_Change(&this->skelAnime, &gCowBodyChewAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCowBodyChewAnim),
|
||||
Animation_Change(&this->skelAnime, &gCowChewAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCowChewAnim),
|
||||
ANIMMODE_LOOP, 1.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
#define Z_EN_COW_H
|
||||
|
||||
#include "global.h"
|
||||
#include "objects/object_cow/object_cow.h"
|
||||
|
||||
#define EN_COW_TYPE(thisx) ((thisx)->params & 0xF)
|
||||
|
||||
#define EN_COW_FLAG_IS_TAIL (1 << 0) // This is never set but it is cleared for tail types
|
||||
#define EN_COW_FLAG_PLAYER_HAS_APPROACHED (1 << 1)
|
||||
#define EN_COW_FLAG_WONT_GIVE_MILK (1 << 2)
|
||||
|
||||
|
|
@ -19,16 +19,6 @@ struct EnCow;
|
|||
|
||||
typedef void (*EnCowActionFunc)(struct EnCow*, GlobalContext*);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ COW_LIMB_NONE,
|
||||
/* 1 */ COW_LIMB_ROOT,
|
||||
/* 2 */ COW_LIMB_HEAD,
|
||||
/* 3 */ COW_LIMB_JAW,
|
||||
/* 4 */ COW_LIMB_NOSE,
|
||||
/* 5 */ COW_LIMB_NOSE_RING,
|
||||
/* 6 */ COW_LIMB_MAX,
|
||||
} ObjectCowLimbs;
|
||||
|
||||
typedef struct EnCow {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ ColliderCylinder colliders[2];
|
||||
|
|
|
|||
|
|
@ -2364,8 +2364,9 @@ void func_80B47FA8(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Actor_SetObjectDependency(globalCtx, thisx);
|
||||
this->actor.update = func_80B48060;
|
||||
this->actor.draw = func_80B4E158;
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowBodySkel, NULL, this->jointTable, this->morphTable, 6);
|
||||
Animation_PlayLoop(&this->skelAnime, &gCowBodyMoveHeadAnim);
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable,
|
||||
COW_LIMB_MAX);
|
||||
Animation_PlayLoop(&this->skelAnime, &gCowMooAnim);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2407,7 +2408,8 @@ void func_80B481C4(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Actor_SetObjectDependency(globalCtx, &this->actor);
|
||||
this->actor.update = func_80B4827C;
|
||||
this->actor.draw = func_80B4E1B0;
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, 6);
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable,
|
||||
COW_TAIL_LIMB_MAX);
|
||||
Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue