mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-23 22:19:53 +00:00
En_pst OK (#983)
* first matches * pst OK * fix to be OK * cleaning stuff up * feedback * updating names, PR feedback * PR 3 * whoopsie on the object * 4got 2 update the name * fixing anim name * PR comment
This commit is contained in:
parent
1afeaaf734
commit
b14656c529
@ -1,14 +1,15 @@
|
||||
<Root>
|
||||
<!-- This is the object for the Postbox Prop -->
|
||||
<File Name="object_pst" Segment="6">
|
||||
<Animation Name="object_pst_Anim_000018" Offset="0x18" />
|
||||
<DList Name="object_pst_DL_0004A0" Offset="0x4A0" />
|
||||
<DList Name="object_pst_DL_000638" Offset="0x638" />
|
||||
<Texture Name="object_pst_Tex_000760" OutName="tex_000760" Format="rgba16" Width="32" Height="32" Offset="0x760" />
|
||||
<Texture Name="object_pst_Tex_000F60" OutName="tex_000F60" Format="rgba16" Width="32" Height="32" Offset="0xF60" />
|
||||
<Texture Name="object_pst_Tex_001760" OutName="tex_001760" Format="rgba16" Width="16" Height="16" Offset="0x1760" />
|
||||
<Texture Name="object_pst_Tex_001960" OutName="tex_001960" Format="i4" Width="32" Height="16" Offset="0x1960" />
|
||||
<Limb Name="object_pst_Standardlimb_001A60" Type="Standard" EnumName="OBJECT_PST_LIMB_01" Offset="0x1A60" />
|
||||
<Limb Name="object_pst_Standardlimb_001A6C" Type="Standard" EnumName="OBJECT_PST_LIMB_02" Offset="0x1A6C" />
|
||||
<Skeleton Name="object_pst_Skel_001A80" Type="Flex" LimbType="Standard" LimbNone="OBJECT_PST_LIMB_NONE" LimbMax="OBJECT_PST_LIMB_MAX" EnumName="object_pst_Limbs" Offset="0x1A80" />
|
||||
<Animation Name="gPostboxOpenSlotAnim" Offset="0x18" />
|
||||
<DList Name="gPostboxFrameDL" Offset="0x4A0" />
|
||||
<DList Name="gPostboxMailSlotDL" Offset="0x638" />
|
||||
<Texture Name="gPostboxWoodRoofTex" OutName="postbox_wood_roof" Format="rgba16" Width="32" Height="32" Offset="0x760" />
|
||||
<Texture Name="gPostboxWoodBodyTex" OutName="postbox_wood_body" Format="rgba16" Width="32" Height="32" Offset="0xF60" />
|
||||
<Texture Name="gPostboxMetalTex" OutName="postbox_metal" Format="rgba16" Width="16" Height="16" Offset="0x1760" />
|
||||
<Texture Name="gPostboxSlotHoleTex" OutName="postbox_slot_hole" Format="i4" Width="32" Height="16" Offset="0x1960" />
|
||||
<Limb Name="gPostboxFrameLimb" Type="Standard" EnumName="POSTBOX_LIMB_FRAME" Offset="0x1A60" />
|
||||
<Limb Name="gPostboxMailSlotLimb" Type="Standard" EnumName="POSTBOX_LIMB_MAIL_SLOT" Offset="0x1A6C" />
|
||||
<Skeleton Name="gPostboxSkel" Type="Flex" LimbType="Standard" LimbNone="POSTBOX_LIMB_NONE" LimbMax="POSTBOX_LIMB_MAX" EnumName="PostboxLimb" Offset="0x1A80" />
|
||||
</File>
|
||||
</Root>
|
||||
|
3
spec
3
spec
@ -3793,8 +3793,7 @@ beginseg
|
||||
name "ovl_En_Pst"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Pst/z_en_pst.o"
|
||||
include "build/data/ovl_En_Pst/ovl_En_Pst.data.o"
|
||||
include "build/data/ovl_En_Pst/ovl_En_Pst.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Pst/ovl_En_Pst_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -15,10 +15,109 @@ void EnPst_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnPst_Update(Actor* thisx, PlayState* play);
|
||||
void EnPst_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80B2BD98(EnPst* this, PlayState* play);
|
||||
void func_80B2BE54(EnPst* this, PlayState* play);
|
||||
void EnPst_FollowSchedule(EnPst* this, PlayState* play);
|
||||
void EnPst_Talk(EnPst* this, PlayState* play);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ POSTBOX_SCH_NONE,
|
||||
/* 1 */ POSTBOX_SCH_AVAILABLE,
|
||||
/* 2 */ POSTBOX_SCH_CHECKED_BY_POSTMAN
|
||||
} PostboxScheduleResult;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ POSTBOX_BEHAVIOUR_WAIT_FOR_ITEM,
|
||||
/* 1 */ POSTBOX_BEHAVIOUR_TAKE_ITEM,
|
||||
} PostboxBehaviour;
|
||||
|
||||
static u8 D_80B2C200[] = {
|
||||
/* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(9, 31, 9, 35, 0x9 - 0x6),
|
||||
/* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE),
|
||||
/* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN),
|
||||
};
|
||||
|
||||
static u8 D_80B2C20C[] = {
|
||||
/* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 3, 10, 7, 0x9 - 0x6),
|
||||
/* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE),
|
||||
/* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN),
|
||||
};
|
||||
|
||||
static u8 D_80B2C218[] = {
|
||||
/* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 35, 10, 39, 0x9 - 0x6),
|
||||
/* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE),
|
||||
/* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN),
|
||||
};
|
||||
|
||||
static u8 D_80B2C224[] = {
|
||||
/* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 53, 10, 57, 0x9 - 0x6),
|
||||
/* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE),
|
||||
/* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN),
|
||||
};
|
||||
|
||||
static u8 D_80B2C230[] = {
|
||||
/* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(11, 25, 11, 29, 0x9 - 0x6),
|
||||
/* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE),
|
||||
/* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN),
|
||||
};
|
||||
|
||||
s32 D_80B2C23C[] = {
|
||||
0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012,
|
||||
0x2C27870C, 0x2F00000C, 0x111B022A, 0x002F001B, 0x4000080F, 0x27882D00, 0x180C100F,
|
||||
0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10,
|
||||
};
|
||||
|
||||
s32 D_80B2C288[] = {
|
||||
0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012,
|
||||
0x2C27870C, 0x2F00000C, 0x111B042A, 0x002F001B, 0x8000080F, 0x27882D00, 0x180C100F,
|
||||
0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10,
|
||||
};
|
||||
|
||||
s32 D_80B2C2D4[] = {
|
||||
0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012,
|
||||
0x2C27870C, 0x2F00000C, 0x111B082A, 0x002F001C, 0x0100080F, 0x27882D00, 0x180C100F,
|
||||
0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10,
|
||||
};
|
||||
|
||||
s32 D_80B2C320[] = {
|
||||
0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012,
|
||||
0x2C27870C, 0x2F00000C, 0x111B102A, 0x002F001C, 0x0200080F, 0x27882D00, 0x180C100F,
|
||||
0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10,
|
||||
};
|
||||
|
||||
s32 D_80B2C36C[] = {
|
||||
0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012,
|
||||
0x2C27870C, 0x2F00000C, 0x111B202A, 0x002F001C, 0x0400080F, 0x27882D00, 0x180C100F,
|
||||
0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10,
|
||||
};
|
||||
|
||||
s32 D_80B2C3B8[] = {
|
||||
0x0E27A10C, 0x0F27A20C, 0x12005108, 0x000F0600, 0x0C000013, 0x000C0C11,
|
||||
0x51080700, 0x0C060001, 0x00001300, 0x010C0700, 0x000E27A3, 0x0C161000,
|
||||
};
|
||||
|
||||
s32 D_80B2C3E8[] = {
|
||||
0x2C27870C, 0x111B022A, 0x002F001B, 0x4000080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000,
|
||||
};
|
||||
|
||||
s32 D_80B2C408[] = {
|
||||
0x2C27870C, 0x111B042A, 0x002F001B, 0x8000080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000,
|
||||
};
|
||||
|
||||
s32 D_80B2C428[] = {
|
||||
0x2C27870C, 0x111B082A, 0x002F001C, 0x0100080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000,
|
||||
};
|
||||
|
||||
s32 D_80B2C448[] = {
|
||||
0x2C27870C, 0x111B102A, 0x002F001C, 0x0200080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000,
|
||||
};
|
||||
|
||||
s32 D_80B2C468[] = {
|
||||
0x2C27870C, 0x111B202A, 0x002F001C, 0x0400080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000,
|
||||
};
|
||||
|
||||
s32 D_80B2C488[] = { 0x2C27A40C, 0x10000000 };
|
||||
|
||||
s32 D_80B2C490[] = { 0x2C27850C, 0x10000000 };
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Pst_InitVars = {
|
||||
ACTOR_EN_PST,
|
||||
ACTORCAT_PROP,
|
||||
@ -31,51 +130,315 @@ const ActorInit En_Pst_InitVars = {
|
||||
(ActorFunc)EnPst_Draw,
|
||||
};
|
||||
|
||||
// static ColliderCylinderInit sCylinderInit = {
|
||||
static ColliderCylinderInit D_80B2C4B8 = {
|
||||
{ COLTYPE_HIT1, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
|
||||
{ ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, },
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
COLTYPE_HIT1,
|
||||
AT_NONE,
|
||||
AC_NONE,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_CYLINDER,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK1,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_NONE,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 28, 72, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
// sColChkInfoInit
|
||||
static CollisionCheckInfoInit2 D_80B2C4E4 = { 1, 0, 0, 0, MASS_IMMOVABLE };
|
||||
static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE };
|
||||
|
||||
#endif
|
||||
static AnimationInfoS sAnimationInfo[] = { { &gPostboxOpenSlotAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 } };
|
||||
|
||||
extern ColliderCylinderInit D_80B2C4B8;
|
||||
extern CollisionCheckInfoInit2 D_80B2C4E4;
|
||||
void EnPst_UpdateCollision(EnPst* this, PlayState* play) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
extern UNK_TYPE D_06001A80;
|
||||
s32 EnPst_HandleLetterDay1(EnPst* this) {
|
||||
switch (this->actor.params) {
|
||||
case POSTBOX_SOUTH_UPPER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[27] & 0x2;
|
||||
case POSTBOX_NORTH_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[27] & 0x4;
|
||||
case POSTBOX_EAST_UPPER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[27] & 0x8;
|
||||
case POSTBOX_EAST_LOWER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[27] & 0x10;
|
||||
case POSTBOX_SOUTH_LOWER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[27] & 0x20;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B830.s")
|
||||
s32 EnPst_HandleLetterDay2(EnPst* this) {
|
||||
switch (this->actor.params) {
|
||||
case POSTBOX_SOUTH_UPPER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[27] & 0x40;
|
||||
case POSTBOX_NORTH_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[27] & 0x80;
|
||||
case POSTBOX_EAST_UPPER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[28] & 0x1;
|
||||
case POSTBOX_EAST_LOWER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[28] & 0x2;
|
||||
case POSTBOX_SOUTH_LOWER_CLOCKTOWN:
|
||||
return gSaveContext.save.weekEventReg[28] & 0x4;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B874.s")
|
||||
s32 EnPst_ChooseBehaviour(Actor* thisx, PlayState* play) {
|
||||
s32 itemActionParam = 0;
|
||||
s32 scriptBranch = 0;
|
||||
EnPst* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B8F4.s")
|
||||
switch (this->behaviour) {
|
||||
case POSTBOX_BEHAVIOUR_WAIT_FOR_ITEM:
|
||||
switch (Message_GetState(&play->msgCtx)) {
|
||||
case TEXT_STATE_CHOICE:
|
||||
case TEXT_STATE_5:
|
||||
if (Message_ShouldAdvance(play)) {
|
||||
case TEXT_STATE_16:
|
||||
itemActionParam = func_80123810(play);
|
||||
scriptBranch = 0;
|
||||
if ((itemActionParam == PLAYER_AP_LETTER_TO_KAFEI) ||
|
||||
(itemActionParam == PLAYER_AP_LETTER_MAMA)) {
|
||||
this->exchangeItemId = itemActionParam;
|
||||
this->behaviour++;
|
||||
scriptBranch = 1;
|
||||
} else if (itemActionParam < PLAYER_AP_NONE) {
|
||||
this->behaviour++;
|
||||
scriptBranch = 3;
|
||||
} else if (itemActionParam != PLAYER_AP_NONE) {
|
||||
this->behaviour++;
|
||||
scriptBranch = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case POSTBOX_BEHAVIOUR_TAKE_ITEM:
|
||||
if (this->exchangeItemId == EXCH_ITEM_LETTER_TO_KAFEI) {
|
||||
scriptBranch = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return scriptBranch;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B974.s")
|
||||
s32* EnPst_GetMsgEventScript(EnPst* this, PlayState* play) {
|
||||
if (Player_GetMask(play) == PLAYER_MASK_POSTMAN) {
|
||||
return D_80B2C3B8;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BAA4.s")
|
||||
if (this->stateFlags & 0x10) {
|
||||
switch (this->actor.params) {
|
||||
case POSTBOX_SOUTH_UPPER_CLOCKTOWN:
|
||||
return D_80B2C3E8;
|
||||
case POSTBOX_NORTH_CLOCKTOWN:
|
||||
return D_80B2C408;
|
||||
case POSTBOX_EAST_UPPER_CLOCKTOWN:
|
||||
return D_80B2C428;
|
||||
case POSTBOX_EAST_LOWER_CLOCKTOWN:
|
||||
return D_80B2C448;
|
||||
case POSTBOX_SOUTH_LOWER_CLOCKTOWN:
|
||||
return D_80B2C468;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
} else if (this->stateFlags & 0x20) {
|
||||
if (this->exchangeItemId == EXCH_ITEM_LETTER_MAMA) {
|
||||
return D_80B2C488;
|
||||
} else {
|
||||
return D_80B2C490;
|
||||
}
|
||||
} else {
|
||||
this->msgEventCallback = EnPst_ChooseBehaviour;
|
||||
switch (this->actor.params) {
|
||||
case POSTBOX_SOUTH_UPPER_CLOCKTOWN:
|
||||
return D_80B2C23C;
|
||||
case POSTBOX_NORTH_CLOCKTOWN:
|
||||
return D_80B2C288;
|
||||
case POSTBOX_EAST_UPPER_CLOCKTOWN:
|
||||
return D_80B2C2D4;
|
||||
case POSTBOX_EAST_LOWER_CLOCKTOWN:
|
||||
return D_80B2C320;
|
||||
case POSTBOX_SOUTH_LOWER_CLOCKTOWN:
|
||||
return D_80B2C36C;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BBFC.s")
|
||||
s32 EnPst_CheckTalk(EnPst* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
s32 ret = false;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BCF8.s")
|
||||
if (this->stateFlags & 7) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
|
||||
this->stateFlags &= ~0x30;
|
||||
if (player->exchangeItemId == EXCH_ITEM_LETTER_TO_KAFEI) {
|
||||
this->stateFlags |= 0x10;
|
||||
this->exchangeItemId = player->exchangeItemId;
|
||||
} else if (player->exchangeItemId != EXCH_ITEM_NONE) {
|
||||
this->stateFlags |= 0x20;
|
||||
this->exchangeItemId = player->exchangeItemId;
|
||||
}
|
||||
// If Letter to Kafei is deposited, value is set to 2
|
||||
this->isLetterToKafeiDeposited = EnPst_HandleLetterDay1(this);
|
||||
SubS_UpdateFlags(&this->stateFlags, 0, 7);
|
||||
this->behaviour = 0;
|
||||
this->msgEventCallback = NULL;
|
||||
this->stateFlags |= 0x40;
|
||||
this->msgEventScript = EnPst_GetMsgEventScript(this, play);
|
||||
this->actionFunc = EnPst_Talk;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD30.s")
|
||||
s32 EnPst_UpdateFlagsSubs(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) {
|
||||
SubS_UpdateFlags(&this->stateFlags, 3, 7);
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD88.s")
|
||||
s32 EnPst_ProcessScheduleOutput(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) {
|
||||
s32 ret = false;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD98.s")
|
||||
this->stateFlags = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BE54.s")
|
||||
switch (scheduleOutput->result) {
|
||||
case POSTBOX_SCH_AVAILABLE:
|
||||
ret = EnPst_UpdateFlagsSubs(this, play, scheduleOutput);
|
||||
break;
|
||||
case POSTBOX_SCH_CHECKED_BY_POSTMAN:
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Init.s")
|
||||
/* The postbox does not have any necessary custom logic when following their schedule,
|
||||
* instead it is all done in the process step. This is why this function is empty
|
||||
*/
|
||||
void EnPst_HandleSchedule(EnPst* this, PlayState* play) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Destroy.s")
|
||||
void EnPst_FollowSchedule(EnPst* this, PlayState* play) {
|
||||
static u8* sScheduleScripts[] = {
|
||||
D_80B2C200, D_80B2C20C, D_80B2C218, D_80B2C224, D_80B2C230,
|
||||
};
|
||||
s16 params = this->actor.params;
|
||||
ScheduleOutput scheduleOutput;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Update.s")
|
||||
if (!Schedule_RunScript(play, sScheduleScripts[params], &scheduleOutput) ||
|
||||
((this->scheduleResult != scheduleOutput.result) &&
|
||||
!EnPst_ProcessScheduleOutput(this, play, &scheduleOutput))) {
|
||||
this->actor.shape.shadowDraw = NULL;
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
scheduleOutput.result = POSTBOX_SCH_NONE;
|
||||
} else {
|
||||
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
|
||||
this->actor.flags |= ACTOR_FLAG_1;
|
||||
}
|
||||
this->scheduleResult = scheduleOutput.result;
|
||||
EnPst_HandleSchedule(this, play);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2C11C.s")
|
||||
void EnPst_Talk(EnPst* this, PlayState* play) {
|
||||
if (func_8010BF58(&this->actor, play, this->msgEventScript, this->msgEventCallback, &this->msgEventArg4)) {
|
||||
if (EnPst_HandleLetterDay1(this) != this->isLetterToKafeiDeposited) {
|
||||
switch (gSaveContext.save.day) {
|
||||
case 1:
|
||||
gSaveContext.save.weekEventReg[91] |= 4;
|
||||
break;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Draw.s")
|
||||
case 2:
|
||||
if (EnPst_HandleLetterDay2(this)) {
|
||||
gSaveContext.save.weekEventReg[91] |= 8;
|
||||
} else {
|
||||
gSaveContext.save.weekEventReg[91] |= 4;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
gSaveContext.save.weekEventReg[91] |= 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SubS_UpdateFlags(&this->stateFlags, 3, 7);
|
||||
this->msgEventArg4 = 0;
|
||||
this->actionFunc = EnPst_FollowSchedule;
|
||||
}
|
||||
}
|
||||
|
||||
void EnPst_Init(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnPst* this = THIS;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f);
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &gPostboxSkel, NULL, this->jointTable, this->morphTable,
|
||||
POSTBOX_LIMB_MAX);
|
||||
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
|
||||
SubS_UpdateFlags(&this->stateFlags, 3, 7);
|
||||
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0);
|
||||
this->actor.targetMode = 0;
|
||||
Actor_SetScale(&this->actor, 0.02f);
|
||||
this->actionFunc = EnPst_FollowSchedule;
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
}
|
||||
|
||||
void EnPst_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnPst* this = THIS;
|
||||
|
||||
Collider_DestroyCylinder(play, &this->collider);
|
||||
}
|
||||
|
||||
void EnPst_Update(Actor* thisx, PlayState* play) {
|
||||
EnPst* this = THIS;
|
||||
|
||||
EnPst_CheckTalk(this, play);
|
||||
this->actionFunc(this, play);
|
||||
if (this->scheduleResult != POSTBOX_SCH_NONE) {
|
||||
if (Actor_IsFacingPlayer(&this->actor, 0x1FFE)) {
|
||||
this->unk214 = 0;
|
||||
func_8013C964(&this->actor, play, 60.0f, 20.0f, 0, this->stateFlags & 7);
|
||||
}
|
||||
Actor_SetFocus(&this->actor, 20.0f);
|
||||
EnPst_UpdateCollision(this, play);
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnPst_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
|
||||
EnPst* this = THIS;
|
||||
f32 yTranslation;
|
||||
|
||||
if (limbIndex == POSTBOX_LIMB_MAIL_SLOT) {
|
||||
if (this->stateFlags & 0x40) {
|
||||
yTranslation = -100.0f;
|
||||
} else {
|
||||
yTranslation = 0.0f;
|
||||
}
|
||||
Matrix_Translate(0.0f, yTranslation, 0.0f, MTXMODE_APPLY);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnPst_Draw(Actor* thisx, PlayState* play) {
|
||||
EnPst* this = THIS;
|
||||
|
||||
if (this->scheduleResult != POSTBOX_SCH_NONE) {
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
EnPst_OverrideLimbDraw, NULL, &this->actor);
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,38 @@
|
||||
#define Z_EN_PST_H
|
||||
|
||||
#include "global.h"
|
||||
#include "objects/object_pst/object_pst.h"
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ POSTBOX_SOUTH_UPPER_CLOCKTOWN,
|
||||
/* 1 */ POSTBOX_NORTH_CLOCKTOWN,
|
||||
/* 2 */ POSTBOX_EAST_UPPER_CLOCKTOWN,
|
||||
/* 3 */ POSTBOX_EAST_LOWER_CLOCKTOWN,
|
||||
/* 4 */ POSTBOX_SOUTH_LOWER_CLOCKTOWN,
|
||||
} PostboxType;
|
||||
|
||||
struct EnPst;
|
||||
|
||||
typedef void (*EnPstActionFunc)(struct EnPst*, PlayState*);
|
||||
typedef s32 (*MsgEventFunc)(Actor*, PlayState*);
|
||||
|
||||
typedef struct EnPst {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x44];
|
||||
/* 0x144 */ SkelAnime skelAnime;
|
||||
/* 0x188 */ EnPstActionFunc actionFunc;
|
||||
/* 0x18C */ char unk_18C[0x94];
|
||||
/* 0x18C */ ColliderCylinder collider;
|
||||
/* 0x1D8 */ u8 scheduleResult;
|
||||
/* 0x1DC */ s32* msgEventScript;
|
||||
/* 0x1E0 */ s32 msgEventArg4;
|
||||
/* 0x1E4 */ Vec3s jointTable[POSTBOX_LIMB_MAX];
|
||||
/* 0x1F6 */ Vec3s morphTable[POSTBOX_LIMB_MAX];
|
||||
/* 0x208 */ u16 stateFlags;
|
||||
/* 0x20A */ UNK_TYPE1 pad20A[4];
|
||||
/* 0x20E */ s16 behaviour;
|
||||
/* 0x210 */ MsgEventFunc msgEventCallback;
|
||||
/* 0x214 */ s32 unk214; // Set and not used
|
||||
/* 0x218 */ s32 exchangeItemId;
|
||||
/* 0x21C */ s32 isLetterToKafeiDeposited;
|
||||
} EnPst; // size = 0x220
|
||||
|
||||
extern const ActorInit En_Pst_InitVars;
|
||||
|
@ -13372,21 +13372,21 @@
|
||||
0x80B2ADB0:("func_80B2ADB0",),
|
||||
0x80B2AF80:("func_80B2AF80",),
|
||||
0x80B2B180:("func_80B2B180",),
|
||||
0x80B2B830:("func_80B2B830",),
|
||||
0x80B2B874:("func_80B2B874",),
|
||||
0x80B2B8F4:("func_80B2B8F4",),
|
||||
0x80B2B974:("func_80B2B974",),
|
||||
0x80B2BAA4:("func_80B2BAA4",),
|
||||
0x80B2BBFC:("func_80B2BBFC",),
|
||||
0x80B2BCF8:("func_80B2BCF8",),
|
||||
0x80B2BD30:("func_80B2BD30",),
|
||||
0x80B2BD88:("func_80B2BD88",),
|
||||
0x80B2BD98:("func_80B2BD98",),
|
||||
0x80B2BE54:("func_80B2BE54",),
|
||||
0x80B2B830:("EnPst_UpdateCollision",),
|
||||
0x80B2B874:("EnPst_HandleLetterDay1",),
|
||||
0x80B2B8F4:("EnPst_HandleLetterDay2",),
|
||||
0x80B2B974:("EnPst_ChooseBehaviour",),
|
||||
0x80B2BAA4:("EnPst_GetMsgEventScript",),
|
||||
0x80B2BBFC:("EnPst_CheckTalk",),
|
||||
0x80B2BCF8:("EnPst_UpdateFlagsSubs",),
|
||||
0x80B2BD30:("EnPst_ProcessScheduleOutput",),
|
||||
0x80B2BD88:("EnPst_Idle",),
|
||||
0x80B2BD98:("EnPst_FollowSchedule",),
|
||||
0x80B2BE54:("EnPst_Talk",),
|
||||
0x80B2BF3C:("EnPst_Init",),
|
||||
0x80B2C04C:("EnPst_Destroy",),
|
||||
0x80B2C078:("EnPst_Update",),
|
||||
0x80B2C11C:("func_80B2C11C",),
|
||||
0x80B2C11C:("EnPst_OverrideLimbDraw",),
|
||||
0x80B2C18C:("EnPst_Draw",),
|
||||
0x80B2C6F0:("EnPoh_Init",),
|
||||
0x80B2C8B8:("EnPoh_Destroy",),
|
||||
|
Loading…
Reference in New Issue
Block a user