mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-23 12:59:44 +00:00
ovl_En_Stone_heishi OK (#1046)
* problem importing data * OK + Data imported, clean up pending * Documenting * documenting progress * Documenting progress * ovl_En_Stone_heishi OK and Documented * player * EN_STONE_DRINK_BOTTLE * detail * ACTION enum * changeAnim * Style and sfx * pr review * NA_BGM_GET_ITEM | 0x900 * pr review * Empty-Commit * lensMaskSize * Audio_PlayFanfare * Head Rotation members
This commit is contained in:
parent
d745cccf87
commit
d364b80da3
3
spec
3
spec
@ -4364,8 +4364,7 @@ beginseg
|
||||
name "ovl_En_Stone_heishi"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.o"
|
||||
include "build/data/ovl_En_Stone_heishi/ovl_En_Stone_heishi.data.o"
|
||||
include "build/data/ovl_En_Stone_heishi/ovl_En_Stone_heishi.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Stone_heishi/ovl_En_Stone_heishi_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -17,12 +17,16 @@ void EnStoneheishi_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80BC9560(EnStoneheishi* this, PlayState* play);
|
||||
void func_80BC9680(EnStoneheishi* this, PlayState* play);
|
||||
void func_80BC9908(EnStoneheishi* this, PlayState* play);
|
||||
void func_80BC9A2C(EnStoneheishi* this, PlayState* play);
|
||||
void EnStoneheishi_CheckGivenItem(EnStoneheishi* this, PlayState* play);
|
||||
void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play);
|
||||
void func_80BC9D28(EnStoneheishi* this, PlayState* play);
|
||||
void func_80BC9E50(EnStoneheishi* this, PlayState* play);
|
||||
void func_80BC94B0(EnStoneheishi* this);
|
||||
void func_80BC9660(EnStoneheishi* this);
|
||||
void EnStoneheishi_SetupCheckGivenItem(EnStoneheishi*);
|
||||
void EnStoneheishi_GiveItemReward(EnStoneheishi* this, PlayState* play);
|
||||
void EnStoneheishi_SetupDrinkBottleProcess(EnStoneheishi* this);
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Stone_heishi_InitVars = {
|
||||
ACTOR_EN_STONE_HEISHI,
|
||||
ACTORCAT_NPC,
|
||||
@ -35,54 +39,496 @@ const ActorInit En_Stone_heishi_InitVars = {
|
||||
(ActorFunc)EnStoneheishi_Draw,
|
||||
};
|
||||
|
||||
// static ColliderCylinderInit sCylinderInit = {
|
||||
static ColliderCylinderInit D_80BCA3A0 = {
|
||||
{ COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, },
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, },
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
AC_NONE,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_2,
|
||||
COLSHAPE_CYLINDER,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_NONE,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 15, 70, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#endif
|
||||
static u16 sEnStoneHeishiTextIds[] = { 0x1473, 0x1474, 0x1475, 0x1476, 0x1477, 0x1478, 0x1479, 0x147A, 0x1472 };
|
||||
|
||||
extern ColliderCylinderInit D_80BCA3A0;
|
||||
static AnimationHeader* sAnimations[] = {
|
||||
&gSoldierStandHandOnHip, &gSoldierDrink, &gSoldierCheerWithSpear, &gSoldierWave,
|
||||
&gSoldierSitAndReach, &gSoldierDrink, &gSoldierStandUp,
|
||||
};
|
||||
|
||||
extern UNK_TYPE D_06000768;
|
||||
extern UNK_TYPE D_06003BFC;
|
||||
static u8 sAnimationModes[] = {
|
||||
ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/EnStoneheishi_Init.s")
|
||||
typedef enum {
|
||||
/* 0 */ EN_STONE_ACTION_0,
|
||||
/* 1 */ EN_STONE_ACTION_1,
|
||||
/* 2 */ EN_STONE_ACTION_CHECK_ITEM,
|
||||
/* 3 */ EN_STONE_ACTION_DRINK_BOTTLE,
|
||||
/* 4 */ EN_STONE_ACTION_4
|
||||
} EnStoneHeishiAction;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/EnStoneheishi_Destroy.s")
|
||||
typedef enum {
|
||||
/* 0 */ EN_STONE_DRINK_BOTTLE_INITIAL,
|
||||
/* 1 */ EN_STONE_DRINK_BOTTLE_DRINKING,
|
||||
/* 2 */ EN_STONE_DRINK_BOTTLE_EMPTY,
|
||||
/* 3 */ EN_STONE_DRINK_BOTTLE_STAND_UP,
|
||||
/* 4 */ EN_STONE_DRINK_BOTTLE_STANDING
|
||||
} EnStoneHeishiDrinkBottle;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC935C.s")
|
||||
typedef enum {
|
||||
/* 0 */ EN_STONE_BOTTLE_NONE,
|
||||
/* 1 */ EN_STONE_BOTTLE_RED_POTION,
|
||||
/* 2 */ EN_STONE_BOTTLE_EMPTY,
|
||||
/* 3 */ EN_STONE_BOTTLE_BLUE_POTION,
|
||||
} EnStoneHeishiBottle;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC941C.s")
|
||||
typedef enum {
|
||||
/* 0 */ EN_STONE_HEISHI_ANIM_STAND_HAND_ON_HIP,
|
||||
/* 1 */ EN_STONE_HEISHI_ANIM_DRINK_1,
|
||||
/* 2 */ EN_STONE_HEISHI_ANIM_CHEER_WITH_SPEAR,
|
||||
/* 3 */ EN_STONE_HEISHI_ANIM_WAVE,
|
||||
/* 4 */ EN_STONE_HEISHI_ANIM_SIT_AND_REACH,
|
||||
/* 5 */ EN_STONE_HEISHI_ANIM_DRINK_2,
|
||||
/* 6 */ EN_STONE_HEISHI_ANIM_STAND_UP,
|
||||
} EnStoneHeishiAnimations;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC94B0.s")
|
||||
void EnStoneheishi_Init(Actor* thisx, PlayState* play) {
|
||||
EnStoneheishi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9560.s")
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f);
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWave, this->jointTable, this->morphTable,
|
||||
SOLDIER_LIMB_MAX);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9660.s")
|
||||
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
||||
this->actor.targetMode = 6;
|
||||
this->actor.gravity = -3.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9680.s")
|
||||
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC98EC.s")
|
||||
this->collider.dim.radius = 40;
|
||||
this->collider.dim.height = 40;
|
||||
this->collider.dim.yShift = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9908.s")
|
||||
func_80BC94B0(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9A10.s")
|
||||
void EnStoneheishi_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnStoneheishi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9A2C.s")
|
||||
Collider_DestroyCylinder(play, &this->collider);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9C88.s")
|
||||
void EnStoneheishi_ChangeAnim(EnStoneheishi* this, s32 animIndex) {
|
||||
f32 startFrame = 0.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9D28.s")
|
||||
this->animIndex = animIndex;
|
||||
this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BC9E50.s")
|
||||
// This will never pass since this animation index is never used.
|
||||
if (animIndex == EN_STONE_HEISHI_ANIM_DRINK_2) {
|
||||
startFrame = 55.0f;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/EnStoneheishi_Update.s")
|
||||
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, startFrame, this->endFrame,
|
||||
sAnimationModes[this->animIndex], -10.0f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BCA0AC.s")
|
||||
void EnStoneheishi_TrackPlayer(EnStoneheishi* this) {
|
||||
s32 yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y));
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/func_80BCA104.s")
|
||||
this->targetHeadRot.y = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stone_heishi/EnStoneheishi_Draw.s")
|
||||
if ((this->actor.xzDistToPlayer < 200.0f) && (yawDiff < 0x4E20)) {
|
||||
this->targetHeadRot.y = this->actor.yawTowardsPlayer - this->actor.world.rot.y;
|
||||
if (this->targetHeadRot.y > 0x2710) {
|
||||
this->targetHeadRot.y = 0x2710;
|
||||
} else if (this->targetHeadRot.y < -0x2710) {
|
||||
this->targetHeadRot.y = -0x2710;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80BC94B0(EnStoneheishi* this) {
|
||||
this->textIdIndex = 0;
|
||||
if (gSaveContext.save.weekEventReg[41] & 0x40) { // After drinking bottle
|
||||
EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_CHEER_WITH_SPEAR);
|
||||
this->textIdIndex = 8;
|
||||
this->actor.flags &= ~ACTOR_FLAG_80;
|
||||
} else { // Initial configuration
|
||||
EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_WAVE);
|
||||
if (gSaveContext.save.weekEventReg[41] & 0x80) {
|
||||
this->textIdIndex = 2;
|
||||
}
|
||||
}
|
||||
this->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex];
|
||||
this->action = EN_STONE_ACTION_0;
|
||||
this->actionFunc = func_80BC9560;
|
||||
}
|
||||
|
||||
void func_80BC9560(EnStoneheishi* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
s32 yawDiff;
|
||||
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
|
||||
func_80BC9660(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(gSaveContext.save.weekEventReg[41] & 0x40) && (play->actorCtx.lensMaskSize != 100)) {
|
||||
this->actor.flags |= ACTOR_FLAG_8000000;
|
||||
return;
|
||||
}
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
||||
this->actor.flags &= ~ACTOR_FLAG_8000000;
|
||||
|
||||
yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y));
|
||||
|
||||
if ((yawDiff <= 0x18F0) && !(player->stateFlags1 & PLAYER_STATE1_800000)) {
|
||||
func_800B8614(&this->actor, play, 70.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80BC9660(EnStoneheishi* this) {
|
||||
this->textIdSet = false;
|
||||
this->action = EN_STONE_ACTION_1;
|
||||
this->actionFunc = func_80BC9680;
|
||||
}
|
||||
|
||||
void func_80BC9680(EnStoneheishi* this, PlayState* play) {
|
||||
f32 currentFrame = this->skelAnime.curFrame;
|
||||
|
||||
if ((this->textIdIndex == 0) || (this->textIdIndex == 2)) {
|
||||
if (this->animIndex != EN_STONE_HEISHI_ANIM_SIT_AND_REACH) {
|
||||
if (fabsf(this->headRot.x - this->targetHeadRot.x) < 50.0f) {
|
||||
EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_SIT_AND_REACH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (this->textIdIndex == 3) {
|
||||
if (this->animIndex != EN_STONE_HEISHI_ANIM_WAVE) {
|
||||
if ((this->timer == 0) && (fabsf(this->headRot.x - this->targetHeadRot.x) < 50.0f)) {
|
||||
EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_WAVE);
|
||||
}
|
||||
return;
|
||||
} else if (!this->textIdSet && (this->endFrame <= currentFrame)) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
this->textIdSet = true;
|
||||
player->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex];
|
||||
|
||||
func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]);
|
||||
func_80151BB4(play, 0x12);
|
||||
}
|
||||
}
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
|
||||
func_801477B4(play);
|
||||
|
||||
if (this->textIdIndex == 2) {
|
||||
func_80151938(play, 0xFF);
|
||||
EnStoneheishi_SetupCheckGivenItem(this);
|
||||
} else if (this->textIdIndex == 3) {
|
||||
func_80BC94B0(this);
|
||||
} else if (this->textIdIndex == 6) {
|
||||
EnStoneheishi_GiveItemReward(this, play);
|
||||
} else {
|
||||
if (this->textIdIndex < 7) {
|
||||
this->textIdIndex++;
|
||||
} else {
|
||||
func_80151BB4(play, 0x12);
|
||||
func_80BC94B0(this);
|
||||
return;
|
||||
}
|
||||
func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnStoneheishi_SetupCheckGivenItem(EnStoneheishi* this) {
|
||||
this->action = EN_STONE_ACTION_CHECK_ITEM;
|
||||
this->actionFunc = EnStoneheishi_CheckGivenItem;
|
||||
}
|
||||
|
||||
void EnStoneheishi_CheckGivenItem(EnStoneheishi* this, PlayState* play) {
|
||||
s32 itemActionParam;
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
||||
if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) {
|
||||
itemActionParam = func_80123810(play);
|
||||
if (itemActionParam > PLAYER_AP_NONE) {
|
||||
this->timer = 40;
|
||||
func_801477B4(play);
|
||||
|
||||
if ((itemActionParam == PLAYER_AP_BOTTLE_POTION_RED) || (itemActionParam == PLAYER_AP_BOTTLE_POTION_BLUE)) {
|
||||
this->playerGivesBluePotion = false;
|
||||
if (itemActionParam == PLAYER_AP_BOTTLE_POTION_BLUE) {
|
||||
this->playerGivesBluePotion = true;
|
||||
}
|
||||
EnStoneheishi_SetupDrinkBottleProcess(this);
|
||||
} else {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
this->textIdIndex = 3;
|
||||
player->actor.textId = 0;
|
||||
gSaveContext.save.weekEventReg[41] |= 0x80;
|
||||
this->action = EN_STONE_ACTION_1;
|
||||
this->actionFunc = func_80BC9680;
|
||||
}
|
||||
} else if (itemActionParam < PLAYER_AP_NONE) {
|
||||
func_801477B4(play);
|
||||
func_80151BB4(play, 0x12);
|
||||
func_80BC94B0(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnStoneheishi_SetupDrinkBottleProcess(EnStoneheishi* this) {
|
||||
this->action = EN_STONE_ACTION_DRINK_BOTTLE;
|
||||
this->actionFunc = EnStoneheishi_DrinkBottleProcess;
|
||||
}
|
||||
|
||||
void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play) {
|
||||
f32 currentFrame = this->skelAnime.curFrame;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
||||
switch (this->drinkBottleState) {
|
||||
case EN_STONE_DRINK_BOTTLE_INITIAL:
|
||||
if (this->timer == 0) {
|
||||
this->textIdIndex = 4;
|
||||
func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]);
|
||||
player->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex];
|
||||
this->drinkBottleState++;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
case EN_STONE_DRINK_BOTTLE_DRINKING:
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
play->msgCtx.msgLength = 0;
|
||||
player->actor.textId = 0;
|
||||
player->exchangeItemId = PLAYER_AP_NONE;
|
||||
this->bottleDisplay = EN_STONE_BOTTLE_RED_POTION;
|
||||
|
||||
if (this->playerGivesBluePotion) {
|
||||
this->bottleDisplay = EN_STONE_BOTTLE_BLUE_POTION;
|
||||
}
|
||||
|
||||
Player_SetModels(player, 3);
|
||||
EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_DRINK_1);
|
||||
this->timer = 30;
|
||||
this->drinkBottleState++;
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_STONE_DRINK_BOTTLE_EMPTY:
|
||||
if (this->timer != 0) {
|
||||
if ((this->timer < 10) && (this->bottleDisplay != EN_STONE_BOTTLE_EMPTY)) {
|
||||
this->bottleDisplay = EN_STONE_BOTTLE_EMPTY;
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_NP_DRINK);
|
||||
func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE);
|
||||
}
|
||||
} else {
|
||||
this->drinkBottleState++;
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_STONE_DRINK_BOTTLE_STAND_UP:
|
||||
if (this->endFrame <= currentFrame) {
|
||||
Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900);
|
||||
this->bottleDisplay = EN_STONE_BOTTLE_NONE;
|
||||
EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_STAND_UP);
|
||||
this->drinkBottleState++;
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_STONE_DRINK_BOTTLE_STANDING:
|
||||
if (this->endFrame <= currentFrame) {
|
||||
this->textIdIndex = 5;
|
||||
func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]);
|
||||
player->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex];
|
||||
EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_STAND_HAND_ON_HIP);
|
||||
this->action = EN_STONE_ACTION_1;
|
||||
this->actionFunc = func_80BC9680;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void EnStoneheishi_GiveItemReward(EnStoneheishi* this, PlayState* play) {
|
||||
func_801477B4(play);
|
||||
|
||||
if (INV_CONTENT(ITEM_MASK_STONE) == ITEM_MASK_STONE) {
|
||||
Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 300.0f, 300.0f);
|
||||
} else {
|
||||
Actor_PickUp(&this->actor, play, GI_MASK_STONE, 300.0f, 300.0f);
|
||||
}
|
||||
|
||||
this->action = EN_STONE_ACTION_4;
|
||||
this->actionFunc = func_80BC9D28;
|
||||
}
|
||||
|
||||
void func_80BC9D28(EnStoneheishi* this, PlayState* play) {
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
this->actor.parent = NULL;
|
||||
this->textIdIndex++;
|
||||
this->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex];
|
||||
gSaveContext.save.weekEventReg[41] |= 0x40;
|
||||
Actor_ProcessTalkRequest(&this->actor, &play->state);
|
||||
func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1);
|
||||
this->actionFunc = func_80BC9E50;
|
||||
} else if (INV_CONTENT(ITEM_MASK_STONE) == ITEM_MASK_STONE) {
|
||||
Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 300.0f, 300.0f);
|
||||
} else {
|
||||
Actor_PickUp(&this->actor, play, GI_MASK_STONE, 300.0f, 300.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80BC9E50(EnStoneheishi* this, PlayState* play) {
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
|
||||
func_80151BB4(play, 0x35);
|
||||
func_80151BB4(play, 0x12);
|
||||
this->action = EN_STONE_ACTION_1;
|
||||
this->actionFunc = func_80BC9680;
|
||||
} else {
|
||||
func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1);
|
||||
}
|
||||
}
|
||||
|
||||
void EnStoneheishi_Update(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnStoneheishi* this = THIS;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (this->timer != 0) {
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
this->actionFunc(this, play);
|
||||
|
||||
Actor_MoveWithGravity(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
|
||||
if (((gSaveContext.save.weekEventReg[41] & 0x40) || (play->actorCtx.lensMaskSize == 100)) &&
|
||||
!(player->stateFlags1 & PLAYER_STATE1_800000)) {
|
||||
if ((this->animIndex != EN_STONE_HEISHI_ANIM_WAVE) &&
|
||||
((((this->action == EN_STONE_ACTION_0) || (this->action == EN_STONE_ACTION_1)) ||
|
||||
(this->action == EN_STONE_ACTION_CHECK_ITEM)) ||
|
||||
((this->action == EN_STONE_ACTION_DRINK_BOTTLE) &&
|
||||
(this->drinkBottleState <= EN_STONE_DRINK_BOTTLE_DRINKING)))) {
|
||||
EnStoneheishi_TrackPlayer(this);
|
||||
} else {
|
||||
this->targetHeadRot.y = 0;
|
||||
}
|
||||
|
||||
if (!(gSaveContext.save.weekEventReg[41] & 0x40)) {
|
||||
Actor_SetFocus(&this->actor, 30.0f);
|
||||
} else {
|
||||
Actor_SetFocus(&this->actor, 60.0f);
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->headRot.y, this->targetHeadRot.y, 1, 0xBB8, 0);
|
||||
Math_SmoothStepToS(&this->headRot.x, this->targetHeadRot.x, 1, 0x3E8, 0);
|
||||
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnStoneheishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx,
|
||||
Gfx** gfxp) {
|
||||
EnStoneheishi* this = THIS;
|
||||
|
||||
if (limbIndex == SOLDIER_LIMB_HEAD) {
|
||||
rot->x += this->headRot.y;
|
||||
rot->y += this->headRot.x;
|
||||
rot->z += this->headRot.z;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnStoneheishi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfxp) {
|
||||
static Vec3f sLeftHandPos = { 0.0f, 0.0f, 0.0f };
|
||||
EnStoneheishi* this = THIS;
|
||||
Gfx* gfx;
|
||||
|
||||
if ((limbIndex == SOLDIER_LIMB_LEFT_HAND) && (this->bottleDisplay != EN_STONE_BOTTLE_NONE)) {
|
||||
gfx = func_8012C2B4(*gfxp);
|
||||
|
||||
sLeftHandPos.x = 320.0f;
|
||||
sLeftHandPos.y = 210.0f;
|
||||
sLeftHandPos.z = 440.0f;
|
||||
|
||||
Matrix_Translate(sLeftHandPos.x, sLeftHandPos.y, sLeftHandPos.z, MTXMODE_APPLY);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
Matrix_RotateYS(-0x1770, MTXMODE_APPLY);
|
||||
Matrix_RotateXS(0x7D0, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(-0x7530, MTXMODE_APPLY);
|
||||
|
||||
if (this->bottleDisplay != EN_STONE_BOTTLE_EMPTY) {
|
||||
if (this->bottleDisplay == EN_STONE_BOTTLE_BLUE_POTION) {
|
||||
gDPSetEnvColor(gfx++, 0, 0, 200, 0); // Blue Potion
|
||||
} else {
|
||||
gDPSetEnvColor(gfx++, 200, 0, 0, 0); // Red Potion
|
||||
}
|
||||
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfx++, gSoldierBottleContentsDL);
|
||||
}
|
||||
|
||||
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfx++, gSoldierBottleDL);
|
||||
|
||||
*gfxp = gfx++;
|
||||
}
|
||||
}
|
||||
|
||||
void EnStoneheishi_Draw(Actor* thisx, PlayState* play) {
|
||||
EnStoneheishi* this = THIS;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (!(gSaveContext.save.weekEventReg[41] & 0x40)) {
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
|
||||
POLY_XLU_DISP =
|
||||
SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
EnStoneheishi_OverrideLimbDraw, EnStoneheishi_PostLimbDraw, &this->actor, POLY_XLU_DISP);
|
||||
} else {
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
|
||||
POLY_OPA_DISP =
|
||||
SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
EnStoneheishi_OverrideLimbDraw, EnStoneheishi_PostLimbDraw, &this->actor, POLY_OPA_DISP);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define Z_EN_STONE_HEISHI_H
|
||||
|
||||
#include "global.h"
|
||||
#include "assets/objects/object_sdn/object_sdn.h"
|
||||
|
||||
struct EnStoneheishi;
|
||||
|
||||
@ -9,9 +10,22 @@ typedef void (*EnStoneheishiActionFunc)(struct EnStoneheishi*, PlayState*);
|
||||
|
||||
typedef struct EnStoneheishi {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x110];
|
||||
/* 0x144 */ SkelAnime skelAnime;
|
||||
/* 0x188 */ Vec3s jointTable[SOLDIER_LIMB_MAX];
|
||||
/* 0x1EE */ Vec3s morphTable[SOLDIER_LIMB_MAX];
|
||||
/* 0x254 */ EnStoneheishiActionFunc actionFunc;
|
||||
/* 0x258 */ char unk_258[0x6C];
|
||||
/* 0x258 */ Vec3s headRot;
|
||||
/* 0x25E */ Vec3s targetHeadRot;
|
||||
/* 0x264 */ s32 animIndex;
|
||||
/* 0x268 */ s16 timer;
|
||||
/* 0x26A */ s16 drinkBottleState;
|
||||
/* 0x26C */ f32 endFrame;
|
||||
/* 0x270 */ s16 action;
|
||||
/* 0x272 */ s16 textIdIndex;
|
||||
/* 0x274 */ s16 textIdSet;
|
||||
/* 0x276 */ u8 bottleDisplay;
|
||||
/* 0x277 */ u8 playerGivesBluePotion;
|
||||
/* 0x278 */ ColliderCylinder collider;
|
||||
} EnStoneheishi; // size = 0x2C4
|
||||
|
||||
extern const ActorInit En_Stone_heishi_InitVars;
|
||||
|
@ -15595,22 +15595,22 @@
|
||||
0x80BC7BBC:("OceffWipe5_Draw",),
|
||||
0x80BC9270:("EnStoneheishi_Init",),
|
||||
0x80BC9330:("EnStoneheishi_Destroy",),
|
||||
0x80BC935C:("func_80BC935C",),
|
||||
0x80BC941C:("func_80BC941C",),
|
||||
0x80BC935C:("EnStoneheishi_ChangeAnim",),
|
||||
0x80BC941C:("EnStoneheishi_TrackPlayer",),
|
||||
0x80BC94B0:("func_80BC94B0",),
|
||||
0x80BC9560:("func_80BC9560",),
|
||||
0x80BC9660:("func_80BC9660",),
|
||||
0x80BC9680:("func_80BC9680",),
|
||||
0x80BC98EC:("func_80BC98EC",),
|
||||
0x80BC9908:("func_80BC9908",),
|
||||
0x80BC9A10:("func_80BC9A10",),
|
||||
0x80BC9A2C:("func_80BC9A2C",),
|
||||
0x80BC9C88:("func_80BC9C88",),
|
||||
0x80BC98EC:("EnStoneheishi_SetupCheckGivenItem",),
|
||||
0x80BC9908:("EnStoneheishi_CheckGivenItem",),
|
||||
0x80BC9A10:("EnStoneheishi_SetupDrinkBottleProcess",),
|
||||
0x80BC9A2C:("EnStoneheishi_DrinkBottleProcess",),
|
||||
0x80BC9C88:("EnStoneheishi_GiveItemReward",),
|
||||
0x80BC9D28:("func_80BC9D28",),
|
||||
0x80BC9E50:("func_80BC9E50",),
|
||||
0x80BC9EE4:("EnStoneheishi_Update",),
|
||||
0x80BCA0AC:("func_80BCA0AC",),
|
||||
0x80BCA104:("func_80BCA104",),
|
||||
0x80BCA0AC:("EnStoneheishi_OverrideLimbDraw",),
|
||||
0x80BCA104:("EnStoneheishi_PostLimbDraw",),
|
||||
0x80BCA2AC:("EnStoneheishi_Draw",),
|
||||
0x80BCA5A0:("OceffWipe6_Init",),
|
||||
0x80BCA5F8:("OceffWipe6_Destroy",),
|
||||
|
Loading…
Reference in New Issue
Block a user