En_Elfgrp (#654)

* En_Elforg

* PR

* PR

* PR
This commit is contained in:
Maide 2022-03-25 01:11:43 +00:00 committed by GitHub
parent f87c8290c8
commit 0a8fd53273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 554 additions and 30 deletions

3
spec
View File

@ -2790,8 +2790,7 @@ beginseg
name "ovl_En_Elfgrp"
compress
include "build/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.o"
include "build/data/ovl_En_Elfgrp/ovl_En_Elfgrp.data.o"
include "build/data/ovl_En_Elfgrp/ovl_En_Elfgrp.reloc.o"
include "build/src/overlays/actors/ovl_En_Elfgrp/ovl_En_Elfgrp_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_en_elfgrp.h"
#include "overlays/actors/ovl_En_Elforg/z_en_elforg.h"
#define FLAGS (ACTOR_FLAG_10)
@ -14,7 +15,24 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx);
void EnElfgrp_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnElfgrp_Update(Actor* thisx, GlobalContext* globalCtx);
#if 0
s32 func_80A39BD0(GlobalContext* globalCtx, s32 arg2);
s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1);
void func_80A39DC8(EnElfgrp* this, GlobalContext* globalCtx, s32 arg2, s32 arg3);
void func_80A3A0AC(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A0F4(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A210(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A274(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A398(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A484(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A4AC(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A520(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A600(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A610(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A6F4(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A77C(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A7FC(EnElfgrp* this, GlobalContext* globalCtx);
void func_80A3A8F8(EnElfgrp* this, GlobalContext* globalCtx);
const ActorInit En_Elfgrp_InitVars = {
ACTOR_EN_ELFGRP,
ACTORCAT_PROP,
@ -27,54 +45,546 @@ const ActorInit En_Elfgrp_InitVars = {
(ActorFunc)NULL,
};
#endif
void func_80A396B0(EnElfgrp* this, s32 arg1) {
while (arg1 > 0) {
if (this->actor.cutscene == -1) {
break;
}
this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A396B0.s")
arg1--;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/EnElfgrp_Init.s")
void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnElfgrp* this = THIS;
s32 sp24;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/EnElfgrp_Destroy.s")
this->unk_147 = ENELFGRP_GET(&this->actor);
this->unk_148 = 0;
this->unk_14A = 0;
this->actor.focus.pos.y += 40.0f;
this->actor.flags &= ~ACTOR_FLAG_1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A39BD0.s")
switch (this->unk_147) {
case ENELFGRP_1:
case ENELFGRP_2:
case ENELFGRP_3:
case ENELFGRP_4:
this->unk_148 = this->unk_147 - 1;
sp24 = func_80A39C1C(globalCtx, this->unk_147);
this->unk_146 = 1 << this->unk_147;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A39C1C.s")
if (sp24 < 25) {
func_80A39DC8(this, globalCtx, sp24, 0);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A39CD4.s")
if (sp24 >= 25) {
this->actionFunc = func_80A3A520;
func_80A396B0(this, 2);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A39DC8.s")
if ((func_80A39BD0(globalCtx, this->unk_147) + sp24) >= 25) {
this->actionFunc = func_80A3A398;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A39F50.s")
switch (this->unk_147) {
case ENELFGRP_1:
if (gSaveContext.weekEventReg[23] & 2) {
func_80A396B0(this, 1);
} else {
this->unk_14A |= 4;
}
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A39FBC.s")
case ENELFGRP_2:
if (gSaveContext.doubleMagic == true) {
func_80A396B0(this, 1);
}
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A044.s")
case ENELFGRP_3:
if (gSaveContext.doubleDefense) {
func_80A396B0(this, 1);
}
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A0AC.s")
case ENELFGRP_4:
if (INV_CONTENT(ITEM_SWORD_GREAT_FAIRY) == ITEM_SWORD_GREAT_FAIRY) {
func_80A396B0(this, 1);
} else {
this->unk_14A |= 0x10;
}
break;
}
} else if (func_80A39BD0(globalCtx, this->unk_147)) {
this->actionFunc = func_80A3A7FC;
this->actor.textId = (this->unk_147 * 3) + 0x581;
} else {
this->actionFunc = func_80A3A8F8;
if ((gSaveContext.weekEventReg[9] & this->unk_146)) {
this->actor.textId = (this->unk_147 * 3) + 0x580;
} else {
this->actor.textId = (this->unk_147 * 3) + 0x57F;
}
}
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A0F4.s")
default:
sp24 = func_80A39C1C(globalCtx, 0);
this->unk_146 = ENELFGRP_1;
if (sp24 >= 25) {
this->actionFunc = func_80A3A520;
if ((this->actor.home.rot.z != 0) && Flags_GetSwitch(globalCtx, this->actor.home.rot.z)) {
this->actionFunc = func_80A3A600;
} else if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) {
func_80A396B0(this, 4);
} else if (INV_CONTENT(ITEM_MASK_DEKU) != ITEM_MASK_DEKU) {
func_80A396B0(this, 5);
} else {
this->unk_14A |= 2;
func_80A396B0(this, 6);
}
} else if ((gSaveContext.weekEventReg[8] & 0x80)) {
func_80A39DC8(this, globalCtx, 24, 0);
this->actionFunc = func_80A3A398;
if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) {
if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) {
func_80A396B0(this, 2);
} else {
func_80A396B0(this, 3);
this->unk_14A |= 2;
}
} else if (gSaveContext.magicAcquired == true) {
func_80A396B0(this, 1);
}
} else {
func_80A39DC8(this, globalCtx, 24, 0);
this->actionFunc = func_80A3A8F8;
if ((gSaveContext.weekEventReg[9] & this->unk_146)) {
this->actor.textId = 0x580;
} else {
this->actor.textId = 0x578;
}
this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8);
}
break;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A210.s")
void EnElfgrp_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A274.s")
s32 func_80A39BD0(GlobalContext* globalCtx, s32 arg2) {
s8 sp1F;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A398.s")
if ((arg2 < 1) || (arg2 >= 5)) {
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A484.s")
sp1F = gSaveContext.inventory.strayFairies[arg2 - 1];
return (sp1F - func_80A39C1C(globalCtx, arg2)) + 10;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A4AC.s")
s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1) {
// the permanentSceneFlags access here is in the form
// struct {
// u32 clockTown : 1;
// u32 fountains[4] : 5;
// } FairyFountains;
// where arg1 is:
// 0: clocktown
// 1: woodfall,
// 2: snowhead,
// 3: great bay,
// 4: stone tower
// clocktown is handled separately, and then the fountains are looked up as array indexing
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A520.s")
s32 temp_v1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A600.s")
if ((arg1 < 0) || (arg1 >= 5)) {
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A610.s")
if (arg1 == 0) {
if (gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1) {
return 25;
}
return 24;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A6F4.s")
temp_v1 = (gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F;
if (temp_v1 < 10) {
temp_v1 = 10;
} else if (temp_v1 > 25) {
temp_v1 = 25;
}
return temp_v1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A77C.s")
void func_80A39CD4(GlobalContext* globalCtx, s32 arg1, s32 arg2) {
if ((arg1 < 0) || (arg1 > 4) || (arg2 < 10) || (arg2 > 25)) {
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A7FC.s")
if (arg1 == 0) {
if (arg2 == 25) {
gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 1;
} else {
gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~1;
}
} else {
gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~(0x1F << ((arg1 * 5) - 4));
gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= arg2 << ((arg1 * 5) - 4);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/func_80A3A8F8.s")
void func_80A39DC8(EnElfgrp* this, GlobalContext* globalCtx, s32 arg2, s32 arg3) {
s32 pad;
s32 i;
Actor* elforg;
s32 temp;
Vec3f sp6C;
Player* player = GET_PLAYER(globalCtx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfgrp/EnElfgrp_Update.s")
if (arg3 == 0) {
this->unk_14A |= 8;
}
if (arg3 == 0) {
sp6C = this->actor.world.pos;
sp6C.y += 20.0f;
temp = ((this->unk_147 & 7) << 6) | STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN;
} else {
sp6C = player->actor.world.pos;
sp6C.y += 20.0f;
temp = ((this->unk_147 & 7) << 6) | STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN;
}
for (i = 0; i < arg2; i++) {
elforg =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, randPlusMinusPoint5Scaled(20.0f) + sp6C.x,
sp6C.y, randPlusMinusPoint5Scaled(20.0f) + sp6C.z, 0, 0, 0, temp);
if (elforg == NULL) {
continue;
}
elforg->home.pos.x = this->actor.home.pos.x;
elforg->home.pos.y = this->actor.home.pos.y + 20.0f;
elforg->home.pos.z = this->actor.home.pos.z;
}
}
s32 func_80A39F50(GlobalContext* globalCtx) {
Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first;
EnElforg* elfOrg;
while (itemAction != NULL) {
if ((itemAction->id != ACTOR_EN_ELFORG) ||
((STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN) &&
(STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN))) {
itemAction = itemAction->next;
continue;
}
elfOrg = (EnElforg*)itemAction;
if (!(elfOrg->flags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME)) {
elfOrg->flags |= STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME;
}
itemAction = itemAction->next;
}
return 0;
}
s32 func_80A39FBC(GlobalContext* globalCtx) {
Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first;
EnElforg* elfOrg;
s32 phi_v1 = 30;
while (itemAction != NULL) {
if ((itemAction->id != ACTOR_EN_ELFORG) ||
((STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN) &&
(STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN))) {
itemAction = itemAction->next;
continue;
}
elfOrg = (EnElforg*)itemAction;
if (!(elfOrg->flags & STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN)) {
elfOrg->flags |= STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN;
if (phi_v1 >= 100) {
return phi_v1;
}
elfOrg->secondaryTimer = phi_v1;
phi_v1 += 5;
}
itemAction = itemAction->next;
}
return phi_v1;
}
void func_80A3A044(GlobalContext* globalCtx) {
Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first;
EnElforg* elfOrg;
while (itemAction != NULL) {
if ((itemAction->id != ACTOR_EN_ELFORG) ||
((STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN) &&
(STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN))) {
itemAction = itemAction->next;
continue;
}
elfOrg = (EnElforg*)itemAction;
elfOrg->actor.home.rot.x = 0x14;
elfOrg->flags |= STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS;
itemAction = itemAction->next;
}
}
void func_80A3A0AC(EnElfgrp* this, GlobalContext* globalCtx) {
if (!Cutscene_CheckActorAction(globalCtx, 0x64)) {
this->actionFunc = func_80A3A600;
ActorCutscene_Stop(this->actor.cutscene);
}
}
void func_80A3A0F4(EnElfgrp* this, GlobalContext* globalCtx) {
if (this->unk_144 == 10) {
play_sound(NA_SE_SY_WHITE_OUT_T);
if (ENELFGRP_GET(&this->actor) < ENELFGRP_4) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x,
this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0,
ENELFGRP_GET(&this->actor) + ENELFGRP_4);
} else {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x,
this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, 4);
}
}
if ((this->unk_144 > 10) && (this->unk_14A & 1)) {
func_800B9010(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG);
}
if (this->unk_144 == 0) {
this->actionFunc = func_80A3A0AC;
}
}
void func_80A3A210(EnElfgrp* this, GlobalContext* globalCtx) {
if (this->unk_144 == 0) {
this->actionFunc = func_80A3A0F4;
func_80A3A044(globalCtx);
this->unk_144 = 30;
}
if (this->unk_14A & 1) {
func_800B9010(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG);
}
}
void func_80A3A274(EnElfgrp* this, GlobalContext* globalCtx) {
if (Cutscene_CheckActorAction(globalCtx, 0x64)) {
if (this->unk_14A & 1) {
func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG);
}
switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x64)]->action) {
case 2:
if (!(this->unk_14A & 1)) {
if (this->unk_147 == ENELFGRP_0) {
func_80A39DC8(this, globalCtx, 1, 1);
} else {
func_80A39DC8(this, globalCtx, func_80A39BD0(globalCtx, this->unk_147), 1);
}
this->unk_14A |= 1;
func_80A39CD4(globalCtx, this->unk_147, 25);
}
break;
case 3:
func_80A39F50(globalCtx);
this->actionFunc = func_80A3A210;
this->unk_144 = 90;
break;
}
}
}
void func_80A3A398(EnElfgrp* this, GlobalContext* globalCtx) {
if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
this->actionFunc = func_80A3A274;
Flags_UnsetSwitch(globalCtx, ENELFGRP_GET_FE00(&this->actor));
if (this->unk_14A & 2) {
Item_Give(globalCtx, ITEM_MASK_GREAT_FAIRY);
}
if ((this->unk_14A & 4) != 0) {
gSaveContext.weekEventReg[23] |= 2;
}
if (this->unk_14A & 0x10) {
Item_Give(globalCtx, ITEM_SWORD_GREAT_FAIRY);
}
this->unk_14A &= ~8;
} else if (this->actor.xzDistToPlayer < 350.0f) {
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
}
}
void func_80A3A484(EnElfgrp* this, GlobalContext* globalCtx) {
if (this->unk_144 == 0) {
this->actionFunc = func_80A3A0F4;
this->unk_144 = 30;
}
}
void func_80A3A4AC(EnElfgrp* this, GlobalContext* globalCtx) {
if (Cutscene_CheckActorAction(globalCtx, 0x64)) {
s32 temp = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x64)]->action;
if (temp == 3) {
this->actionFunc = func_80A3A484;
this->unk_144 = 90;
}
}
}
void func_80A3A520(EnElfgrp* this, GlobalContext* globalCtx) {
if (Cutscene_CheckActorAction(globalCtx, 0x67)) {
this->actionFunc = func_80A3A600;
} else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
this->actionFunc = func_80A3A4AC;
Flags_SetSwitch(globalCtx, ENELFGRP_GET_FE00(&this->actor));
if (this->unk_14A & 2) {
Item_Give(globalCtx, ITEM_MASK_GREAT_FAIRY);
}
if (this->actor.home.rot.z != 0) {
Flags_SetSwitch(globalCtx, this->actor.home.rot.z);
}
} else if (this->actor.xzDistToPlayer < 350.0f) {
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
}
}
void func_80A3A600(EnElfgrp* this, GlobalContext* globalCtx) {
}
void func_80A3A610(EnElfgrp* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
if (this->unk_144 == 60) {
Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.doubleMagic * 0x30) + 0x30);
gSaveContext.healthAccumulator = 320;
}
if (this->unk_144 > 0) {
player->actor.freezeTimer = 100;
player->stateFlags1 |= 0x20000000;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_GROUP_HEAL - SFX_FLAG);
} else {
player->actor.freezeTimer = 0;
player->stateFlags1 &= ~0x20000000;
this->actionFunc = func_80A3A600;
this->unk_14A |= 8;
}
}
void func_80A3A6F4(EnElfgrp* this, GlobalContext* globalCtx) {
s32 pad;
Player* player = GET_PLAYER(globalCtx);
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
player->actor.freezeTimer = 100;
player->stateFlags1 |= 0x20000000;
this->unk_144 = func_80A39FBC(globalCtx);
this->actionFunc = func_80A3A610;
this->unk_14A &= ~8;
}
}
void func_80A3A77C(EnElfgrp* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
player->actor.freezeTimer = 100;
player->stateFlags1 |= 0x20000000;
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
this->unk_144 = func_80A39FBC(globalCtx);
this->actionFunc = func_80A3A610;
this->unk_14A &= ~8;
}
}
void func_80A3A7FC(EnElfgrp* this, GlobalContext* globalCtx) {
s32 temp_s0;
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
gSaveContext.weekEventReg[9] |= this->unk_146;
this->actionFunc = func_80A3A6F4;
temp_s0 = func_80A39BD0(globalCtx, this->unk_147);
func_80A39DC8(this, globalCtx, temp_s0, 1);
temp_s0 += func_80A39C1C(globalCtx, this->unk_147);
if (temp_s0 > 25) {
temp_s0 = 25;
}
func_80A39CD4(globalCtx, this->unk_147, temp_s0);
} else if (this->actor.xzDistToPlayer < 280.0f) {
this->actor.flags |= ACTOR_FLAG_10000;
func_800B8614(&this->actor, globalCtx, 300.0f);
}
}
void func_80A3A8F8(EnElfgrp* this, GlobalContext* globalCtx) {
s32 pad;
Player* player = GET_PLAYER(globalCtx);
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
gSaveContext.weekEventReg[9] |= this->unk_146;
this->actionFunc = func_80A3A6F4;
return;
}
if (this->unk_147 != ENELFGRP_0) {
if (func_80A39BD0(globalCtx, this->unk_147) > 0) {
this->actionFunc = func_80A3A7FC;
return;
}
}
if (this->actor.xzDistToPlayer < 30.0f) {
if (gSaveContext.playerForm == PLAYER_FORM_DEKU) {
this->actor.flags &= ~ACTOR_FLAG_10000;
player->actor.freezeTimer = 100;
player->stateFlags1 |= 0x20000000;
Message_StartTextbox(globalCtx, this->actor.textId, &this->actor);
this->actionFunc = func_80A3A77C;
gSaveContext.weekEventReg[9] |= this->unk_146;
} else {
this->actor.flags |= ACTOR_FLAG_10000;
func_800B8614(&this->actor, globalCtx, 100.0f);
}
} else {
this->actor.flags &= ~ACTOR_FLAG_10000;
}
}
void EnElfgrp_Update(Actor* thisx, GlobalContext* globalCtx) {
EnElfgrp* this = THIS;
this->actionFunc(this, globalCtx);
if (this->unk_14A & 8) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG);
}
if (this->unk_144 != 0) {
this->unk_144--;
}
}

View File

@ -7,9 +7,24 @@ struct EnElfgrp;
typedef void (*EnElfgrpActionFunc)(struct EnElfgrp*, GlobalContext*);
#define ENELFGRP_GET(thisx) ((thisx)->params & 0xF)
#define ENELFGRP_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9)
enum {
/* 0 */ ENELFGRP_0,
/* 2 */ ENELFGRP_1,
/* 2 */ ENELFGRP_2,
/* 3 */ ENELFGRP_3,
/* 4 */ ENELFGRP_4,
};
typedef struct EnElfgrp {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x8];
/* 0x0144 */ s16 unk_144;
/* 0x0146 */ u8 unk_146;
/* 0x0147 */ u8 unk_147;
/* 0x0148 */ s8 unk_148;
/* 0x014A */ u16 unk_14A;
/* 0x014C */ EnElfgrpActionFunc actionFunc;
} EnElfgrp; // size = 0x150