Split npc files

This commit is contained in:
octorock
2021-05-27 22:14:22 +02:00
parent 54ae9dfa85
commit fce61af0b8
175 changed files with 8281 additions and 14307 deletions
+4 -4
View File
@@ -4,7 +4,7 @@
// clang-format off
void (*const gEnemyFunctions[])(Entity* ent) = {
[OCTOROCK] = Octorok,
[OCTOROK] = Octorok,
[CHUCHU] = Chuchu,
[LEEVER] = Leever,
[PEAHAT] = Peahat,
@@ -61,10 +61,10 @@ void (*const gEnemyFunctions[])(Entity* ent) = {
[MAZAAL_HEAD] = MazaalHead,
[MAZAAL_MACRO] = MazaalMacro,
[MAZAAL_HAND] = MazaalHand,
[OCTOROCK_BOSS] = OctorokBoss,
[OCTOROK_BOSS] = OctorokBoss,
[FLYING_POT] = FlyingPot,
[GOBDO] = Gibdo,
[OCTOROCK_GOLDEN] = OctorokGolden,
[OCTOROK_GOLDEN] = OctorokGolden,
[TEKTITE_GOLDEN] = TektiteGolden,
[ROPE_GOLDEN] = RopeGolden,
[CLOUD_PIRANHA] = CloudPiranha,
@@ -89,7 +89,7 @@ void (*const gEnemyFunctions[])(Entity* ent) = {
[VAATI_ARM] = VaatiArm,
[DUST] = Dust,
[VAATI_BALL] = VaatiBall,
[OCTOROCK2] = Octorok,
[OCTOROK2] = Octorok,
[SLIME] = Slime,
[MINI_SLIME] = MiniSlime,
[FIREBALL_GUY] = FireballGuy,
+6 -10
View File
@@ -223,8 +223,8 @@ void sub_080377B0(Entity* this) {
this->animationState = this->direction / 8;
InitAnimationForceUpdate(this, this->animationState + 4);
}
// Nonmatching
NONMATCH("asm/non_matching/gibdo/sub_08037810.inc", u32 sub_08037810(Entity* this)) {
u32 sub_08037810(Entity* this) {
u32 x;
u32 y;
if (this->field_0x76.HALF.LO == 0) {
@@ -236,9 +236,8 @@ NONMATCH("asm/non_matching/gibdo/sub_08037810.inc", u32 sub_08037810(Entity* thi
this->actionDelay = 0x18;
this->field_0xf = 0x8;
this->speed = 0xc0;
y = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0));
this->direction = y;
this->animationState = y / 8;
this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0));
this->animationState = this->direction >> 3;
this->field_0x74.HWORD = 300;
this->field_0x78.HWORD = gUnk_020000B0->x.HALF.HI;
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF.HI;
@@ -252,7 +251,6 @@ NONMATCH("asm/non_matching/gibdo/sub_08037810.inc", u32 sub_08037810(Entity* thi
}
return 0;
}
END_NONMATCH
u32 sub_080378B0(Entity* this) {
if (this->field_0x76.HALF.HI == 0) {
@@ -333,12 +331,11 @@ void sub_08037A14(Entity* this) {
CopyPosition(this, this->field_0x4c);
InitAnimationForceUpdate(this, this->animationState + 0xc);
}
// Not match
// Take Damage maybe?
NONMATCH("asm/non_matching/gibdo/sub_08037A58.inc", void sub_08037A58(Entity* this)) {
void sub_08037A58(Entity* this) {
sub_08037ACC(this);
this->action = 7;
this->spritePriority.b0 = (this->spritePriority.b0 & 0xf8) | 4;
this->spritePriority.b0 = 4;
if (this->iframes == 0) {
this->iframes = 0xec;
}
@@ -351,7 +348,6 @@ NONMATCH("asm/non_matching/gibdo/sub_08037A58.inc", void sub_08037A58(Entity* th
this->field_0x76.HALF.LO = 0x3c;
InitAnimationForceUpdate(this, this->animationState + 0x10);
}
END_NONMATCH
void sub_08037ACC(Entity* this) {
gPlayerState.flags.all &= 0xFFFFFEFF;
-1
View File
@@ -1,6 +1,5 @@
#include "global.h"
#include "gba/m4a.h"
#include "gba/gba.h"
// ASCII encoding of 'Smsh' in reverse
+6 -1
View File
@@ -278,17 +278,22 @@ void sub_08058CFC() {
}
NONMATCH("asm/non_matching/managerC/sub_08058D34.inc", void sub_08058D34()) {
u16 tmp;
LoadPaletteGroup(0x28);
MemCopy(gUnk_02017700, gUnk_02017700 + 0x240, 0x20);
gUsedPalettes |= 0x200000;
LoadGfxGroup(0x16);
tmp = gScreen.lcd.displayControl;
gScreen.lcd.displayControl |= 1;
gScreen.affine.bg2Control = 0xBC82;
gScreen.bg.bg1xOffset = 0x5E86;
gScreen.bg.bg1Control = 0x5E86;
gScreen.bg.bg1xOffset = 0;
gScreen.bg.bg1yOffset = 0;
gScreen.bg.bg1Tilemap = 0;
gScreen.controls.layerFXControl = 0x3456;
gScreen.controls.alphaBlend = 0x909;
gArea.musicIndex = gArea.pMusicIndex;
gUnk_02000070 = 0;
if (CheckGlobalFlag(LV1TARU_OPEN)) {
+332 -5
View File
@@ -6,11 +6,36 @@
#include "random.h"
#include "audio.h"
#include "functions.h"
#include "script.h"
#include "save.h"
#include "screen.h"
#include "utils.h"
#include "textbox.h"
extern void (*gUnk_081140D4[])(Entity*);
extern u16 gUnk_081140CC[];
void sub_0806D520(Entity*, u32);
void sub_0806D41C(Entity* this);
extern u8 gMapDataTopSpecial[];
void sub_0806D138(u8* param_1, u8* param_2);
extern void sub_08053500(void);
extern u32 gUnk_0200B650;
void sub_0806D110(void);
void sub_0806D164(Entity* this);
extern Hitbox gUnk_080FD180;
Entity* sub_0806D00C(Entity* this);
void sub_0806D4C0(Entity*, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
void BigGoron(Entity* this) {
gUnk_081140D4[this->type](this);
}
@@ -54,11 +79,313 @@ void sub_0806CF30(Entity* this) {
sub_0806D02C(this);
}
void sub_0806D00C(Entity* this) {
Entity* pEVar1;
Entity* sub_0806D00C(Entity* this) {
Entity* entity = FindEntity(7, 76, 7, 0, 0);
if (entity != NULL) {
this->parent = entity;
}
return entity;
}
pEVar1 = FindEntity(7, 76, 7, 0, 0);
if (pEVar1 != NULL) {
this->parent = pEVar1;
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D02C.inc", void sub_0806D02C(Entity* this))
void sub_0806D0B0(Entity* this) {
gUnk_0200B650 = 0;
LoadGfxGroup(0x30);
sub_0806D110();
MemClear(&gMapDataTopSpecial, 0x2000);
if (this != NULL) {
sub_0806D164(this);
}
gScreen.bg.bg1Control = 0x1d47;
gScreen.bg.bg1Tilemap = &gMapDataTopSpecial;
gScreen.bg.bg1Updated = 1;
}
void sub_0806D0F8(void) {
Entity* entity = FindEntityByID(7, 0x4c, 7);
if (entity != NULL) {
sub_0806D0B0(entity);
}
}
void sub_0806D110(void) {
u8* tmp = gMapDataTopSpecial;
u8* tmp2 = tmp + 0x4000;
sub_0806D138(tmp, tmp2);
tmp += 0x800;
tmp2 += 0x40;
sub_0806D138(tmp, tmp2);
}
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D138.inc", void sub_0806D138(u8* param_1, u8* param_2))
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D164.inc", void sub_0806D164(Entity* this))
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D1D0.inc", void sub_0806D1D0(Entity* this))
void sub_0806D274(Entity* this) {
Entity* npc;
if (this->action == 0) {
if (sub_0806D00C(this) == NULL) {
DeleteThisEntity();
}
this->action = 1;
this->spriteOrientation.flipY = 3;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
this->frameIndex = 2;
this->actionDelay = 8;
sub_0805E3A0(this, 2);
npc = CreateNPC(0x4c, 3, 0);
if (npc != NULL) {
npc->attachedEntity = this;
}
}
switch (this->subAction) {
case 0:
case 1:
default:
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->frameIndex = 2;
break;
}
if (--this->actionDelay == 0) {
this->actionDelay = 8;
this->frameIndex ^= 1;
}
break;
case 2:
if (--this->actionDelay == 0) {
this->actionDelay = 8;
this->frameIndex ^= 1;
}
break;
case 3:
this->frameIndex = 4;
break;
case 4:
this->frameIndex = 2;
break;
}
this->x.HALF.HI = this->parent->x.HALF.HI;
this->y.HALF.HI = this->parent->y.HALF.HI;
}
void sub_0806D348(Entity* this) {
if (this->action == 0) {
if (sub_0806D00C(this) == NULL) {
DeleteThisEntity();
}
this->action = 1;
this->spriteOrientation.flipY = 3;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 6;
this->spriteSettings.b.draw = 0;
this->frameIndex = 5;
sub_0805E3A0(this, 2);
}
if (this->attachedEntity->frameIndex == 4) {
this->spriteSettings.b.draw = 3;
} else {
this->spriteSettings.b.draw = 0;
}
this->x.HALF.HI = this->parent->x.HALF.HI;
this->y.HALF.HI = this->parent->y.HALF.HI;
}
void sub_0806D3C0(Entity* this) {
if (this->action == 0) {
if (sub_0806D00C(this) == NULL) {
DeleteThisEntity();
}
this->action = 1;
this->hitbox = &gUnk_080FD180;
sub_0805E3A0(this, 2);
sub_0807DD64(this);
} else {
this->x.HALF.HI = this->parent->x.HALF.HI;
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
}
}
void sub_0806D40C(Entity* this) {
this->spriteSettings.b.flipX = 1;
sub_0806D41C(this);
}
void sub_0806D41C(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->frameIndex = 6;
sub_0807DD64(this);
sub_0806D4C0(this, 0);
sub_0806D4C0(this, 1);
sub_0806D4C0(this, 2);
sub_0806D4C0(this, 3);
sub_0805E3A0(this, 2);
} else {
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
}
if ((gScreenTransition.frameCount & 1) == 0) {
if (CheckPlayerProximity(this->x.HALF.HI - 0x20, this->y.HALF.HI, 0x40, 0x40) != 0) {
if (this->spriteOffsetY > -8) {
this->spriteOffsetY -= 1;
}
} else {
if (this->spriteOffsetY < 0) {
this->spriteOffsetY += 1;
}
}
}
}
void sub_0806D4C0(Entity* this, u32 param) {
Entity* npc = CreateNPC(0x4c, param + 6, 0);
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
ResolveEntityOnTop(this, npc);
sub_0805E3A0(npc, 2);
}
}
void sub_0806D4F0(Entity* this) {
sub_0806D520(this, 0);
}
void sub_0806D4FC(Entity* this) {
sub_0806D520(this, 1);
}
void sub_0806D508(Entity* this) {
sub_0806D520(this, 2);
}
void sub_0806D514(Entity* this) {
sub_0806D520(this, 3);
}
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D520.inc", void sub_0806D520(Entity* this, u32 param))
// TODO itemOnA and itemOnB would need to be in array?
NONMATCH("asm/non_matching/bigGoron/sub_0806D5D4.inc", void sub_0806D5D4(void)) {
u32 itemSlot;
sub_08053500();
itemSlot = IsItemEquipped(0xd);
if (itemSlot != 2) {
((u8*)&gSave.stats.itemOnA)[itemSlot] = 0;
}
sub_0807CAA0(0xd, 0);
}
END_NONMATCH
void sub_0806D600(Entity* this, ScriptExecutionContext* context) {
context->condition = gSave.unk494 == 0;
}
void sub_0806D620(void) {
sub_0807CAA0(0xd, 0);
sub_080A7C18(0xe, 0, 0);
}
void sub_0806D638(Entity* this) {
this->y.HALF.HI -= 0x20;
}
void sub_0806D640(Entity* this) {
this->y.HALF.HI += 0x20;
this->interactType = 0;
}
void sub_0806D650(Entity* this) {
this->subAction = 2;
}
void sub_0806D658(Entity* this, ScriptExecutionContext* context) {
this->subAction = context->intVariable;
}
void sub_0806D660(Entity* this) {
this->spriteOrientation.flipY = 3;
}
void sub_0806D66C(Entity* this) {
this->spriteOrientation.flipY = 2;
}
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D67C.inc", void sub_0806D67C(Entity* this))
void sub_0806D6D0(void) {
Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 2;
}
entity = FindEntity(7, 0x4c, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 1;
}
}
void sub_0806D70C(void) {
Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 0;
}
entity = FindEntity(7, 0x4c, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 0;
entity->spriteSettings.b.draw = 3;
}
}
void sub_0806D74C(void) {
Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 3;
}
entity = FindEntity(7, 0x4c, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 2;
}
}
void sub_0806D788(void) {
Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 4;
}
entity = FindEntity(7, 0x4c, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 1;
}
}
void sub_0806D7C4(Entity* this, ScriptExecutionContext* context) {
Entity* entity;
this->x.HALF.HI = gPlayerEntity.x.HALF.HI;
this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18;
entity = FindEntity(7, 0x4c, 7, 2, 0);
if (entity != NULL) {
sub_0807DEDC(this, context, entity->x.HALF.HI, entity->y.HALF.HI);
}
}
void sub_0806D804(Entity* this, ScriptExecutionContext* context) {
Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
if (entity != NULL) {
this->x.HALF.HI = entity->x.HALF.HI;
this->y.HALF.HI = entity->y.HALF.HI - 0x10;
this->spritePriority.b1 = 0;
}
sub_0807DEDC(this, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0x10);
}
void sub_0806D858(Entity* this) {
this->spritePriority.b1 = 1;
}
+93
View File
@@ -0,0 +1,93 @@
#include "entity.h"
#include "functions.h"
#include "textbox.h"
#include "save.h"
#include "npc.h"
#include "script.h"
void sub_08063544(Entity*);
void sub_0806362C(Entity*);
extern void (*gUnk_0810CAA0[])(Entity*);
extern Dialog gUnk_0810CAAC[];
void Brocco(Entity* this) {
if ((this->flags & 2) != 0) {
sub_0806362C(this);
} else {
sub_08063544(this);
}
}
void sub_08063544(Entity* this) {
gUnk_0810CAA0[this->action](this);
}
void sub_0806355C(Entity* this) {
this->action = this->action + 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 4);
sub_08078778(this);
}
ASM_FUNC("asm/non_matching/brocco/sub_08063584.inc", void sub_08063584(Entity* this))
void sub_08063608(Entity* this) {
u8 tmp = gTextBox.doTextBox & 0x7f;
if (tmp == 0) {
this->action = 1;
this->field_0xf = tmp;
InitAnimationForceUpdate(this, 4);
}
}
void sub_0806362C(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.HI = 0;
sub_0807DD64(this);
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
sub_0806F118(this);
} else {
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
UpdateAnimationSingleFrame(this);
}
break;
case 2:
if (UpdateFuseInteraction(this) == 0) {
return;
}
this->action = 1;
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
break;
}
}
void sub_080636D8(Entity* this) {
ShowNPCDialogue(this, &gUnk_0810CAAC[gSave.unk8]);
}
void sub_080636F4(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Brocco_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
this->y.HALF.HI -= 4;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);
}
}
+114
View File
@@ -0,0 +1,114 @@
#include "entity.h"
#include "script.h"
#include "save.h"
#include "functions.h"
#include "flags.h"
#include "textbox.h"
extern Dialog gUnk_0810F894[];
void sub_08064570(Entity* this);
extern u16 gUnk_0810F88C[];
extern SpriteLoadData gUnk_0810F874[];
extern u32 _call_via_r0(u32*);
void Maid(Entity* this) {
if ((this->flags & 2) != 0) {
sub_08064570(this);
} else {
DeleteThisEntity();
}
}
void Maid_Head(Entity* this) {
u32 uVar2;
u32 uVar3;
uVar2 = this->frames.all & 0x7f;
uVar3 = this->frameIndex;
if (this->id == 0x16) {
if ((this->frames.all & 0x7f) != 0) {
uVar2 += 10;
}
} else {
if ((this->frames.all & 0x7f) != 0) {
uVar2 += 0x1a;
}
uVar3 += 0x10;
}
SetExtraSpriteFrame(this, 0, uVar2 - 1);
SetExtraSpriteFrame(this, 1, uVar3);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
NONMATCH("asm/non_matching/castleMaid/sub_08064570.inc", void sub_08064570(Entity* this)) {
u8 bVar1;
u32 tmp;
switch (this->action) {
case 0:
// (&gUnk_0810F874[((s32)-(this->id ^ 0x16) >> 0x1f) * -0xc]))
// TODO fix this array access
tmp = -(this->id ^ 0x16);
if (LoadExtraSpriteData(this, &gUnk_0810F874[(BOOLCAST(tmp)) * 2 + tmp]) == 0) {
return;
}
this->action += 1;
this->actionDelay = 0;
tmp = sub_0805ACC0(this);
if (tmp == 0) {
this->field_0x6c.HWORD = this->x.HALF.HI;
this->field_0x6e.HWORD = this->y.HALF.HI;
} else {
this->field_0x6c.HWORD = tmp >> 0x10;
this->field_0x6e.HWORD = tmp;
}
*(u32*)&this->field_0x68 = 0;
sub_0807DD50(this);
case 1:
sub_0807DD94(this, NULL);
if (this->interactType != 0) {
this->action += 1;
this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
if (*(void**)&this->field_0x68 != NULL) {
_call_via_r0(*(void**)&this->field_0x68);
}
}
break;
case 2:
if ((gTextBox.doTextBox & 0x7f) != 0) {
return;
}
this->action = 1;
break;
}
}
END_NONMATCH
void sub_08064644(Entity* this, ScriptExecutionContext* context) {
*(u32*)&this->field_0x68 = context->intVariable;
}
void sub_0806464C(Entity* this) {
s32 tmp;
if (CheckGlobalFlag(0x15) != 0) {
tmp = 2;
} else if (CheckLocalFlag(0xa0) == 0) {
tmp = 0;
SetLocalFlag(0xa0);
} else {
tmp = 1;
}
TextboxNoOverlap(gUnk_0810F88C[tmp], this);
}
void sub_08064688(Entity* this) {
ShowNPCDialogue(this, &gUnk_0810F894[gSave.unk8]);
}
ASM_FUNC("asm/non_matching/castleMaid/sub_080646A4.inc",
void sub_080646A4(Entity* this, ScriptExecutionContext* context))
+128
View File
@@ -0,0 +1,128 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "flags.h"
extern Hitbox gUnk_08110E94;
extern void (*gUnk_08110E4C[])(Entity*);
extern void (*gUnk_08110E5C[])(Entity*);
extern s8 gUnk_08110E64[];
extern u32 gUnk_08110E68[];
void CastorWildsStatue(Entity* this) {
if ((this->flags & 2) != 0) {
gUnk_08110E5C[this->action](this);
} else {
gUnk_08110E4C[this->action](this);
sub_0806ED78(this);
}
}
void sub_080673C0(Entity* this) {
if (gScreenTransition.field_0x24[8] != 0) {
this->action = 3;
} else {
this->action = 1;
}
this->frameIndex = this->type & 1;
if ((this->type & 1) == 0) {
this->hitbox = &gUnk_08110E94;
}
}
void sub_080673F4(Entity* this) {
if (this->interactType != 0) {
this->action = 2;
this->interactType = 0;
}
}
void sub_08067410(Entity* this) {
this->action = 1;
}
void sub_08067418(Entity* this) {
this->action = 1;
this->field_0x74.HWORD = COORD_TO_TILE(this);
if (this->type == 0) {
this->hitbox = &gUnk_08110E94;
SetTile(0x4022, this->field_0x74.HWORD - 1, this->collisionLayer);
SetTile(0x4022, this->field_0x74.HWORD, this->collisionLayer);
SetTile(0x4022, this->field_0x74.HWORD + 0x3f, this->collisionLayer);
SetTile(0x4022, this->field_0x74.HWORD + 0x40, this->collisionLayer);
} else {
this->collisionLayer = 3;
this->spriteOrientation.flipY = 1;
this->spriteRendering.b3 = 1;
this->spritePriority.b0 = 2;
if (CheckLocalFlag(0x1d) == 0) {
SetTile(0x4022, 0xe81, 1);
SetTile(0x4022, 0xe82, 1);
SetTile(0x4022, 0xe83, 1);
SetTile(0x4022, 0xec3, 1);
}
}
sub_0807DD50(this);
}
void sub_08067514(Entity* this) {
sub_0807DD94(this, NULL);
if (this->type == 0) {
sub_0806ED78(this);
}
}
void sub_0806752C(Entity* this) {
sub_0806FD3C(this);
}
void sub_08067534(Entity* this) {
Entity* entity;
s32 i;
for (i = 0; i < 2; ++i) {
entity = CreateFx(this, 2, 0);
if (entity != NULL) {
entity->x.HALF.HI += gUnk_08110E64[i];
entity->y.HALF.HI += 0x1c;
}
}
EnqueueSFX(0x14c);
sub_08080964(0x28, 4);
}
void sub_0806757C(Entity* this) {
if (this->subAction != 0) {
if (this->subAction >= 3) {
sub_0807BA8C(0xe81, 1);
sub_0807BA8C(0xe82, 1);
sub_0807BA8C(0xe83, 1);
sub_0807BA8C(0xec3, 1);
} else {
LoadFixedGFX(this, gUnk_08110E68[this->subAction]);
}
}
}
ASM_FUNC("asm/non_matching/castorWildsStatue/sub_080675D4.inc", void sub_080675D4(Entity* this))
void sub_080676D8(Entity* this) {
this->subAction += 1;
}
ASM_FUNC("asm/non_matching/castorWildsStatue/sub_080676E0.inc",
void sub_080676E0(Entity* this, ScriptExecutionContext* context))
void CastorWildsStatue_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
this->y.HALF.HI -= 0x18;
InitializeAnimation(this, 1);
sub_0801D2B4(this, 0x17b);
} else {
GetNextFrame(this);
}
}
+6
View File
@@ -6,3 +6,9 @@ extern void (*gUnk_0811423C[])(Entity*);
void ClothesRack(Entity* this) {
gUnk_0811423C[this->action](this);
}
ASM_FUNC("asm/non_matching/clothesRack/sub_0806DD90.inc", void sub_0806DD90(Entity* this))
void sub_0806DEC8(Entity* this) {
GetNextFrame(this);
}
+87
View File
@@ -0,0 +1,87 @@
#include "entity.h"
#include "functions.h"
#include "npc.h"
#include "audio.h"
#include "random.h"
extern void (*const gUnk_081145B4[])(Entity*);
void sub_0806E4EC(Entity*);
void sub_0806E6A8(Entity*);
extern u16 gUnk_081145C8[];
void sub_0806E65C(Entity* this);
void Cucco(Entity* this) {
gUnk_081145B4[this->action](this);
}
void sub_0806E4B8(Entity* this) {
this->action += 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_080787A8(this, this->field_0x68.HALF.LO);
sub_0805E3A0(this, 2);
this->subAction = 0;
sub_0806E4EC(this);
}
void sub_0806E4EC(Entity* this) {
if (this->subAction == 0) {
this->subAction += 1;
this->actionDelay = (Random() & 0x1f) + 0x3c;
InitAnimationForceUpdate(this, 0);
}
if (--this->actionDelay == 0) {
if ((Random() & 1) != 0) {
this->action = 3;
} else {
this->action = 2;
}
this->subAction = 0;
if ((Random() & 1) != 0) {
EnqueueSFX(gUnk_081145C8[Random() & 3]);
}
}
sub_0806E65C(this);
UpdateAnimationSingleFrame(this);
}
ASM_FUNC("asm/non_matching/cucco/sub_0806E564.inc", void sub_0806E564(Entity* this))
ASM_FUNC("asm/non_matching/cucco/sub_0806E5E4.inc", void sub_0806E5E4(Entity* this))
void sub_0806E648(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_0806E65C(Entity* this) {
if (this->interactType != 0) {
if ((gPlayerState.flags.all & 0x80) != 0) {
if (this->interactType == 2) {
this->action = 4;
sub_0806F118(this);
} else {
sub_0806E6A8(this);
}
} else {
sub_080791D0();
}
SoundReq(SFX_VO_CUCCO_CALL);
this->interactType = 0;
}
}
ASM_FUNC("asm/non_matching/cucco/sub_0806E6A8.inc", void sub_0806E6A8(Entity* this))
void Cucco_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 1);
} else {
UpdateAnimationSingleFrame(this);
}
}
+85
View File
@@ -0,0 +1,85 @@
#include "entity.h"
#include "textbox.h"
#include "npc.h"
#include "functions.h"
#include "random.h"
#include "audio.h"
extern void (*const gUnk_081145D4[])(Entity*);
void sub_0806E764(Entity*);
void sub_0806E838(Entity* this);
void sub_0806E884(Entity* this);
void CuccoChick(Entity* this) {
gUnk_081145D4[this->action](this);
sub_0806ED78(this);
}
void sub_0806E730(Entity* this) {
this->action += 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_080787A8(this, this->field_0x68.HALF.LO);
sub_0805E3A0(this, 2);
this->subAction = 0;
sub_0806E764(this);
}
void sub_0806E764(Entity* this) {
if (this->subAction == 0) {
this->subAction += 1;
this->actionDelay = (Random() & 0x1f) + 0x1e;
this->frameIndex = 0;
}
if (--this->actionDelay == 0) {
this->action = 2;
this->subAction = 0;
if ((Random() & 1) != 0) {
EnqueueSFX(0xd6);
}
}
sub_0806E838(this);
}
ASM_FUNC("asm/non_matching/cuccoChick/sub_0806E7B0.inc", void sub_0806E7B0(Entity* this))
void sub_0806E824(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_0806E838(Entity* this) {
if (this->interactType != 0) {
if ((gPlayerState.flags.all & 0x80) != 0) {
if (this->interactType == 2) {
this->action = 3;
sub_0806F118(this);
} else {
sub_0806E884(this);
}
} else {
sub_080791D0();
}
SoundReq(SFX_VO_CHEEP);
this->interactType = 0;
}
}
void sub_0806E884(Entity* this) {
TextboxNoOverlap(0xdb6, this);
}
void CuccoChick_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
this->frameIndex = 1;
} else {
if (sub_08003FC4(this, 0x3000) == 0) {
this->field_0x20 = 0x10000;
}
}
}
+85
View File
@@ -0,0 +1,85 @@
#include "entity.h"
#include "script.h"
#include "random.h"
#include "functions.h"
#include "save.h"
#include "textbox.h"
#include "flags.h"
extern void sub_08078850(Entity*, u32, u8, u32*);
extern u32 gUnk_081133B4;
void sub_0806BFD8(Entity* this);
extern u16 gUnk_081133A4[];
void DrLeft(Entity* this) {
if (this->type == 0) {
if (this->action == 0) {
this->action += 1;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
GetNextFrame(this);
sub_0806BFD8(this);
} else {
if (this->action == 0) {
this->action += 1;
this->frameIndex = 0;
sub_0806FAD8(this, this);
}
}
}
void sub_0806BFD8(Entity* this) {
switch (this->frameSpriteSettings & 3) {
case 1:
InitializeAnimation(this, (Random() & 3) + 0xc);
break;
case 2:
InitializeAnimation(this, 0);
break;
}
}
void sub_0806C00C(Entity* this, ScriptExecutionContext* context) {
if ((this->frames.all & 0x80) != 0) {
context->condition = 1;
} else {
context->condition = 0;
}
}
void sub_0806C028(Entity* this, ScriptExecutionContext* context) {
InitializeAnimation(this, context->intVariable + this->animationState / 2);
}
void sub_0806C038(Entity* this) {
s32 index;
index = gSave.unk8 - 5;
if (index != 0) {
index = 0;
}
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(0x3a) == 0) {
index = 6;
if (CheckLocalFlag(0xaf) == 0) {
index = 5;
SetLocalFlag(0xaf);
}
} else {
index = 7;
if (GetInventoryValue(0x3a) > 1) {
index = 0;
}
}
}
TextboxNoOverlap(gUnk_081133A4[index], this);
}
void sub_0806C09C(Entity* this) {
sub_08078850(this, 1, 0, &gUnk_081133B4);
}
+58
View File
@@ -0,0 +1,58 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
extern Dialog gUnk_08113158[];
extern void sub_0806F188(Entity*);
extern SpriteLoadData gUnk_08113140[];
void sub_0806BC58(Entity* this);
ASM_FUNC("asm/non_matching/farmers/Farmers.inc", void Farmers(Entity* this))
void sub_0806BC58(Entity* this) {
sub_0805E3A0(this, 2);
}
void Farmers_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, this->frames.all & 0x7f);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
ASM_FUNC("asm/non_matching/farmers/sub_0806BC94.inc", void sub_0806BC94(Entity* this, ScriptExecutionContext* context))
void sub_0806BCB8(Entity* this) {
this->animationState = this->actionDelay;
}
void sub_0806BCC0(Entity* this) {
if (this->type == 0) {
sub_0806F188(this);
}
}
void sub_0806BCD4(Entity* this) {
sub_08078784(this, sub_0801E99C(this));
}
void sub_0806BCE8(Entity* this) {
ShowNPCDialogue(this, &gUnk_08113158[this->type]);
}
void Farmers_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08113140[this->type * 3]) != 0) {
this->action = this->action + 1;
this->spriteSettings.b.draw = 1;
this->spriteSettings.b.flipX = 0;
sub_0806BC58(this);
InitAnimationForceUpdate(this, 3);
}
} else {
UpdateAnimationSingleFrame(this);
}
}
+143
View File
@@ -0,0 +1,143 @@
#include "entity.h"
#include "functions.h"
#include "save.h"
#include "screen.h"
#include "textbox.h"
#include "npc.h"
#include "script.h"
extern void (*const gUnk_0811017C[])(Entity*);
extern void (*const gUnk_08110274[])(Entity*);
extern Dialog gUnk_08110280[];
extern u32 gUnk_0811022E;
extern u32 gUnk_0811033C[];
extern u32 gUnk_08110188;
ASM_FUNC("asm/non_matching/ghostBrothers/GhostBrothers.inc", void GhostBrothers(Entity* this))
void sub_08065BF4(Entity* this) {
gUnk_0811017C[this->action](this);
}
NONMATCH("asm/non_matching/ghostBrothers/sub_08065C0C.inc", void sub_08065C0C(Entity* this)) {
u8 bVar1;
u32 uVar2;
u16* puVar3;
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this);
} else {
sub_0807DD94(this, NULL);
}
break;
case 2:
if (UpdateFuseInteraction(this) == 0) {
return;
}
this->action = 1;
break;
case 3:
if (--this->actionDelay != 0) {
return;
}
// TODO this is still wrong!
puVar3 = *(u16**)&this->field_0x6c.HWORD;
if (*puVar3 != 0xffff) {
gScreen.controls.alphaBlend = *puVar3;
this->actionDelay = (u8)puVar3[1];
*(u16**)&this->field_0x6c = puVar3 + 2;
return;
}
this->spriteSettings.b.draw = 0;
this->action = 1;
break;
}
}
END_NONMATCH
void sub_08065CCC(Entity* this) {
this->action = 3;
this->actionDelay = 0x1e;
this->spriteRendering.alphaBlend = 1;
*(u32**)&this->field_0x6c = &gUnk_0811022E;
gScreen.controls.layerFXControl = 0x3f40;
gScreen.controls.alphaBlend = 0x10;
}
void sub_08065D00(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void sub_08065D18(Entity* this) {
this->action = 1;
this->actionDelay = 0x1e;
this->field_0xf = 0;
this->spriteSettings.b.draw = 1;
this->spriteRendering.alphaBlend = 1;
*(u32**)&this->field_0x6c = &gUnk_08110188;
sub_0805E3A0(this, 2);
InitAnimationForceUpdate(this, 2);
gScreen.controls.layerFXControl = 0x3f40;
gScreen.controls.alphaBlend = 0x1000;
}
ASM_FUNC("asm/non_matching/ghostBrothers/sub_08065D74.inc", void sub_08065D74(Entity* this))
ASM_FUNC("asm/non_matching/ghostBrothers/sub_08065DB8.inc", void sub_08065DB8(Entity* this))
void sub_08065EBC(Entity* this) {
gUnk_08110274[this->action](this);
sub_0806ED78(this);
}
ASM_FUNC("asm/non_matching/ghostBrothers/sub_08065EDC.inc", void sub_08065EDC(Entity* this))
void sub_08065F20(Entity* this) {
UpdateAnimationSingleFrame(this);
if (this->interactType != 0) {
this->interactType = 0;
TextboxNoOverlapFollow(0);
this->animIndex += 1;
if (gUnk_0811033C[this->animIndex] == 0) {
this->animIndex = 0;
}
InitAnimationForceUpdate(this, this->animIndex);
}
}
void sub_08065F64(Entity* this) {
s32 tmp = gSave.unk8 - 2;
if (tmp < 0) {
tmp = 0;
}
ShowNPCDialogue(this, gUnk_08110280 + this->type * 8 + tmp);
}
void GhostBrothers_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);
}
}
+138
View File
@@ -0,0 +1,138 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "random.h"
#include "flags.h"
#include "textbox.h"
extern void (*const gUnk_08111C48[])(Entity*);
void sub_080697A4(Entity* this);
void sub_08069838(Entity* this);
extern SpriteLoadData gUnk_08111C3C;
extern u8 gUnk_08111C9C[];
extern u8 gUnk_08111CA8[];
extern u8 gUnk_08111CB4[];
extern u8 gUnk_08111CB8[];
void sub_08069888(Entity* this);
extern u16 gUnk_08111C50[];
void Gorman(Entity* this) {
if ((this->flags & 2) != 0) {
sub_08069838(this);
} else {
sub_080697A4(this);
}
}
void sub_080697A4(Entity* this) {
gUnk_08111C48[this->action](this);
sub_0806ED78(this);
}
void sub_080697C4(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_08111C3C) != 0) {
this->action = 1;
InitializeAnimation(this, 2);
sub_08078778(this);
}
}
void sub_080697EC(Entity* this) {
s32 tmp;
tmp = sub_0806ED9C(this, 0x20, 0x20);
if (tmp >= 0) {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
if (this->animIndex != tmp) {
InitializeAnimation(this, tmp);
}
} else {
this->field_0xf -= 1;
}
}
if (this->interactType != 0) {
this->interactType = 0;
sub_08069888(this);
}
}
void sub_08069838(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08111C3C) == 0) {
return;
}
this->action += 1;
this->field_0x68.HALF.LO = 0;
this->field_0x68.HALF.HI = 0;
sub_0807DD64(this);
}
sub_0807DD94(this, NULL);
if (this->interactType != 0) {
this->interactType = 0;
sub_08069888(this);
}
}
void sub_08069888(Entity* this) {
s32 index;
if (CheckGlobalFlag(0x47) == 0) {
index = 0;
SetGlobalFlag(0x47);
} else if (((CheckGlobalFlag(0x2b) == 0) && (CheckGlobalFlag(0x2c) == 0)) && (CheckGlobalFlag(0x2d) == 0)) {
index = 1;
} else if (CheckGlobalFlag(0x18) == 0) {
index = 2;
} else if (CheckGlobalFlag(0x48) == 0) {
index = 3;
SetGlobalFlag(0x48);
} else if ((CheckGlobalFlag(0x2e) == 0) && (CheckGlobalFlag(0x2f) == 0)) {
index = CheckGlobalFlag(0x30) ? 5 : 4;
} else {
index = 5;
}
TextboxNoOverlap(gUnk_08111C50[index], this);
}
ASM_FUNC("asm/non_matching/gorman/sub_0806991C.inc", void sub_0806991C(Entity* this, ScriptExecutionContext* context))
ASM_FUNC("asm/non_matching/gorman/sub_080699AC.inc", void sub_080699AC(Entity* this, ScriptExecutionContext* context))
void sub_08069A3C(Entity* this) {
this->field_0x68.HALF.HI = gUnk_08111C9C[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
}
void sub_08069A60(Entity* this) {
this->field_0x68.HALF.HI = gUnk_08111CA8[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
}
void sub_08069A84(Entity* this) {
this->field_0x68.HALF.HI = gUnk_08111CB4[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
}
void sub_08069AA8(Entity* this) {
this->field_0x68.HALF.HI = gUnk_08111CB8[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
}
void sub_08069ACC(Entity* this, ScriptExecutionContext* context) {
if (--this->field_0x68.HALF.LO * 0x1000000 < 1) {
context->condition = 1;
} else {
context->condition = 0;
}
}
void Gorman_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (this->frames.all & 7) + 0xf);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
+162
View File
@@ -0,0 +1,162 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "npc.h"
void sub_0801D2B4(Entity*, u32);
extern void (*gUnk_08113D8C[])(Entity*);
extern void sub_08078850(Entity*, u32, u8, u32*);
extern u32 gUnk_08113D84[];
void Gregal(Entity* this) {
gUnk_08113D8C[this->type](this);
}
void sub_0806CAF4(Entity* this) {
Entity* npc;
if (this->action == 0) {
this->action += 1;
sub_0805E3A0(this, 2);
npc = CreateNPC(0x4a, 1, 0);
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
sub_0806FAD8(this, npc);
}
npc = CreateNPC(0x4a, 2, 0);
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
ResolveEntityOnTop(this, npc);
}
sub_0807DD64(this);
sub_08078778(this);
sub_08078850(this, 1, gUnk_08113D84[1], gUnk_08113D84);
}
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
GetNextFrame(this);
}
void sub_0806CB80(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->animationState = 2;
this->frameIndex = 0;
sub_0805E3A0(this, 2);
}
if (this->parent != NULL) {
this->frameIndex = (this->parent->frames.all & 3) + 0x21;
}
}
void sub_0806CBB4(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->animationState = 2;
sub_0805E3A0(this, 2);
InitializeAnimation(this, 0x11);
}
GetNextFrame(this);
if (this->parent != NULL) {
this->spriteSettings.b.draw = 0;
if ((this->parent->frames.all & 4) != 0) {
this->spriteSettings.b.draw = 1;
}
}
}
void sub_0806CC08(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0805E3A0(this, 2);
sub_0807DD64(this);
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8);
sub_0806F118(this);
} else {
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
GetNextFrame(this);
}
break;
case 2:
if (UpdateFuseInteraction(this) == 0) {
return;
}
this->action = 1;
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
break;
}
}
void sub_0806CCB4(Entity* this, ScriptExecutionContext* context) {
if ((this->frames.all & 0x80) != 0) {
context->condition = 1;
} else {
context->condition = 0;
}
}
void sub_0806CCD0(Entity* this, ScriptExecutionContext* context) {
u32 tmp = this->frameSpriteSettings & 0x3f;
if ((this->frameSpriteSettings & 0x3f) != 0) {
InitializeAnimation(this, tmp + (this->animationState >> 1));
context->condition = 1;
} else {
context->condition = tmp;
}
}
void sub_0806CCF8(Entity* this) {
sub_0801D2B4(this, 0x10a);
}
void sub_0806CD04(Entity* this) {
sub_0801D2B4(this, 0x10b);
}
void sub_0806CD14(Entity* this) {
sub_0801D2B4(this, 0x10c);
}
void sub_0806CD20(Entity* this) {
sub_0801D2B4(this, 0x10d);
}
void sub_0806CD30(Entity* this) {
sub_0801D2B4(this, 0x10e);
}
void sub_0806CD3C(Entity* this) {
sub_0801D2B4(this, 0x10f);
}
void sub_0806CD4C(Entity* this) {
sub_0801D2B4(this, 0x110);
}
void sub_0806CD58(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Gregal_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
sub_0805E3A0(this, 2);
InitAnimationForceUpdate(this, 6);
} else {
UpdateAnimationSingleFrame(this);
}
}
+45
View File
@@ -0,0 +1,45 @@
#include "entity.h"
#include "script.h"
#include "player.h"
ASM_FUNC("asm/non_matching/guardWithSpear/sub_0806407C.inc",
void sub_0806407C(Entity* this, ScriptExecutionContext* context))
void sub_08064180(void) {
Entity* entity = FindEntityByID(7, 0x15, 7);
if (entity != NULL) {
DeleteEntity(entity);
}
}
ASM_FUNC("asm/non_matching/guardWithSpear/sub_08064198.inc", void sub_08064198(Entity* this))
ASM_FUNC("asm/non_matching/guardWithSpear/sub_080642B8.inc", void sub_080642B8(Entity* this))
ASM_FUNC("asm/non_matching/guardWithSpear/sub_080643D8.inc", void sub_080643D8(Entity* this))
ASM_FUNC("asm/non_matching/guardWithSpear/sub_08064428.inc", void sub_08064428(Entity* this))
void sub_08064470(Entity* this, ScriptExecutionContext* context) {
if (gPlayerState.field_0xab == 1) {
context->condition = 1;
} else {
context->condition = 0;
}
}
void sub_08064488(void) {
if (gPlayerState.field_0xa8 != 2) {
gPlayerState.field_0xab = 0;
}
}
void sub_080644A4(void) {
gPlayerState.field_0xab = 0;
}
void sub_080644B4(Entity* this, ScriptExecutionContext* context) {
context->condition = this->animationState == context->intVariable;
}
ASM_FUNC("asm/non_matching/guardWithSpear/sub_080644C8.inc", void sub_080644C8(Entity* this))
+88
View File
@@ -0,0 +1,88 @@
#include "entity.h"
#include "functions.h"
#include "save.h"
#include "npc.h"
#include "script.h"
extern Dialog gUnk_081144FC[];
extern SpriteLoadData gUnk_081144F0;
extern u32 sub_08002632(Entity*);
extern u16* gUnk_08001A7C[];
void HurdyGurdyMan(Entity* this) {
u32 index;
u16* pointerToArray;
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_081144F0) != 0) {
this->action = 1;
this->field_0x68.HALF.HI = 0;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
index = sub_08002632(this);
pointerToArray = gUnk_08001A7C[index];
if (this->field_0x68.HALF.LO == 0x32) {
pointerToArray = pointerToArray + 3;
}
sub_0801DFB4(this, (u32)*pointerToArray, (u32)pointerToArray[1], (u32)pointerToArray[2]);
gPlayerState.field_0x8b = 3;
} else {
sub_0807DD94(this, NULL);
}
break;
case 2:
if ((UpdateFuseInteraction(this) != 0)) {
this->action = 1;
InitializeAnimation(this, this->field_0x68.HALF.HI);
}
break;
}
}
void HurdyGurdyMan_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (this->frames.all & 0xffffff7f) + 8);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
void sub_0806E418(Entity* this) {
s32 tmp = gSave.unk8 - 2;
if (tmp < 0) {
tmp = 0;
}
ShowNPCDialogue(this, &gUnk_081144FC[tmp]);
}
void sub_0806E440(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void HurdyGurdyMan_Fusion(Entity* this) {
u32 uVar1;
if (this->action == 0) {
uVar1 = LoadExtraSpriteData(this, &gUnk_081144F0);
if (uVar1 != 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
sub_0805E3A0(this, 2);
InitializeAnimation(this, 10);
}
} else {
GetNextFrame(this);
}
}
+3 -4
View File
@@ -201,10 +201,9 @@ NONMATCH("asm/non_matching/kid/sub_0806252C.inc", void sub_0806252C(Entity* this
END_NONMATCH
NONMATCH("asm/non_matching/kid/sub_08062634.inc", void sub_08062634(Entity* this)) {
u8 arr = this->type2;
u32 arr2 = arr * 2 + (Random() & 1);
u16 id = gUnk_0810BDE8[arr2];
TextboxNoOverlap(id, this);
u32 a = this->type2;
u32 b = (Random() & 1);
TextboxNoOverlap(*((u16*)gUnk_0810BDE8 + b + a * 2), this);
}
END_NONMATCH
+104
View File
@@ -0,0 +1,104 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "npc.h"
#include "flags.h"
#include "textbox.h"
extern u16 gUnk_081104F8[];
extern void (*const gUnk_081104E0[])(Entity*);
extern void (*const gUnk_081104EC[])(Entity*);
void KingDaltus(Entity* this) {
if ((this->flags & 2) != 0) {
if (this->interactType == 2) {
this->interactType = 0;
this->action = 2;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this);
}
gUnk_081104EC[this->action](this);
} else {
gUnk_081104E0[this->action](this);
sub_0806ED78(this);
}
}
void sub_08066654(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
InitAnimationForceUpdate(this, 2);
}
void sub_08066688(Entity* this) {
s32 tmp = sub_0806ED9C(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
} else {
this->field_0xf -= 1;
tmp = this->animIndex;
}
}
if (sub_0806F078(this, tmp) == 0) {
UpdateAnimationSingleFrame(this);
}
if (this->interactType != 0) {
this->action = 2;
this->interactType = 0;
}
}
void sub_080666DC(Entity* this) {
this->action = 1;
}
void sub_080666E4(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0807DD50(this);
}
void sub_0806670C(Entity* this) {
sub_0807DD94(this, NULL);
}
void sub_08066718(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_0806672C(Entity* this) {
sub_08078784(this, this->field_0x68.HALF.LO);
}
void sub_0806673C(Entity* this) {
u32 index;
if (CheckGlobalFlag(2) == 0) {
index = 0;
} else if (GetInventoryValue(2) == 0) {
index = 1;
} else if (GetInventoryValue(3) == 0) {
index = 2;
} else {
index = 3;
}
TextboxNoOverlap(gUnk_081104F8[index], this);
}
void KingDaltus_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
} else {
UpdateAnimationSingleFrame(this);
}
}
+61
View File
@@ -0,0 +1,61 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "flags.h"
#include "textbox.h"
#include "audio.h"
extern u16 gUnk_08113078[];
extern void sub_08095BE0(Entity*, u32);
ASM_FUNC("asm/non_matching/librarians/Librarians.inc", void Librarians(Entity* this))
ASM_FUNC("asm/non_matching/librarians/sub_0806BA34.inc",
void sub_0806BA34(Entity* this, ScriptExecutionContext* context))
void sub_0806BB1C(Entity* this, ScriptExecutionContext* context) {
s32 tmp;
tmp = 0xffffffff;
if (GetInventoryValue(0x39) == 1) {
tmp = 0x39;
} else if (GetInventoryValue(0x3a) == 1) {
tmp = 0x3a;
} else {
if (GetInventoryValue(0x3b) == 1) {
tmp = 0x3b;
}
if (tmp < 1) {
return;
}
}
if (context->intVariable == 0) {
sub_08095BE0(this, tmp);
InitializeAnimation(this, 0xc);
SoundReq(SFX_TASK_COMPLETE);
} else {
sub_0807CAA0(tmp, 2);
}
}
void sub_0806BB7C(Entity* this, ScriptExecutionContext* context) {
context->condition = 0;
if ((GetInventoryValue(0x39) == 2) && (GetInventoryValue(0x3a) == 2) && (GetInventoryValue(0x3b) == 2)) {
SetLocalFlag(0x73);
context->condition = 1;
}
}
void sub_0806BBB0(Entity* this) {
u32 flag;
u32 tmp;
if (GetInventoryValue(0x46) == 0) {
flag = CheckGlobalFlag(0x29);
tmp = BOOLCAST(flag);
} else {
tmp = 2;
}
TextboxNoOverlap(gUnk_08113078[tmp], this);
}
+98
View File
@@ -0,0 +1,98 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "save.h"
#include "npc.h"
extern Dialog gUnk_08113760[];
extern SpriteLoadData gUnk_08113754;
bool32 sub_0806C454(Entity* this);
void Mama(Entity* this) {
switch (this->action) {
case 0:
if (sub_0806C454(this) != 0) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->animationState = this->actionDelay;
this->field_0x68.HALF.HI = 0;
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this);
} else {
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
GetNextFrame(this);
}
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitializeAnimation(this, this->field_0x68.HALF.HI);
}
break;
}
}
bool32 sub_0806C454(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_08113754) == 0) {
return FALSE;
} else {
sub_0805E3A0(this, 2);
return TRUE;
}
}
void Mama_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, this->frames.all & 0x7f);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
void sub_0806C4A8(Entity* this, ScriptExecutionContext* context) {
s32 tmp;
if ((this->frames.all & 0x80) != 0) {
tmp = GetAnimationState(this);
if (tmp < 0) {
tmp = 3;
}
this->animationState = tmp * 2;
InitAnimationForceUpdate(this, tmp);
context->condition = 1;
} else {
context->condition = 0;
}
}
void sub_0806C4DC(Entity* this) {
ShowNPCDialogue(this, &gUnk_08113760[gSave.unk8]);
}
void sub_0806C4F8(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Mama_Fusion(Entity* this) {
if (this->action == 0) {
if (sub_0806C454(this) != 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
this->y.HALF.HI -= 4;
InitializeAnimation(this, 2);
}
} else {
GetNextFrame(this);
}
}
+44
View File
@@ -0,0 +1,44 @@
#include "entity.h"
#include "functions.h"
#include "script.h"
#include "audio.h"
extern SpriteLoadData gUnk_0810C48C;
void MinishEzlo(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810C48C) == 0) {
return;
}
this->action += 1;
this->animationState = this->actionDelay * 2;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
GetNextFrame(this);
if ((this->frameSpriteSettings & 0x10) != 0) {
this->frameSpriteSettings &= 0xef;
EnqueueSFX(SFX_ELEMENT_CHARGE);
}
if ((this->frameSpriteSettings & 0x20) != 0) {
this->frameSpriteSettings &= 0xdf;
EnqueueSFX(SFX_220);
}
}
ASM_FUNC("asm/non_matching/minishEzlo/MinishEzlo_Head.inc", void MinishEzlo_Head(Entity* this))
void sub_0806305C(Entity* this) {
this->spritePriority.b1 = 0;
this->spriteRendering.b0 = 3;
*(u32*)&this->field_0x6c = 0x100;
this->field_0x70.WORD = 0x100;
sub_0805EC9C(this, 0x100, 0x100, 0x0);
InitAnimationForceUpdate(this, 0x10);
this->field_0x80.HWORD = 0x10;
SoundReq(SFX_PLY_SHRINKING);
}
ASM_FUNC("asm/non_matching/minishEzlo/sub_080630A4.inc", void sub_080630A4(Entity* this))
+106
View File
@@ -0,0 +1,106 @@
#include "entity.h"
#include "functions.h"
#include "flags.h"
#include "textbox.h"
#include "script.h"
#include "npc.h"
extern void (*const gUnk_08110644[])(Entity*);
void sub_08066864(Entity*);
extern u16 gUnk_08110650[];
void MinisterPotho(Entity* this) {
if ((this->flags & 2) != 0) {
sub_08066864(this);
} else {
gUnk_08110644[this->action](this);
sub_0806ED78(this);
}
}
void sub_080667E4(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
sub_08078778(this);
}
void sub_08066808(Entity* this) {
s32 tmp = sub_0806ED9C(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
} else {
this->field_0xf -= 1;
tmp = this->animIndex;
}
}
if (sub_0806F078(this, tmp) == 0) {
UpdateAnimationSingleFrame(this);
}
if (this->interactType != 0) {
this->action = 2;
this->interactType = 0;
}
}
void sub_0806685C(Entity* this) {
this->action = 1;
}
void sub_08066864(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0807DD50(this);
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this);
} else {
sub_0807DD94(this, NULL);
}
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
break;
}
}
void sub_080668F0(Entity* this) {
sub_08078784(this, sub_0801E99C(this));
}
void sub_08066904(Entity* this) {
u32 index;
if (CheckGlobalFlag(2) == 0) {
index = 0;
} else if (GetInventoryValue(2) == 0) {
index = 1;
} else if (GetInventoryValue(3) == 0) {
index = 2;
} else {
index = 3;
}
TextboxNoOverlap(gUnk_08110650[index], this);
}
void MinisterPotho_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
} else {
UpdateAnimationSingleFrame(this);
}
}
+109
View File
@@ -0,0 +1,109 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "textbox.h"
#include "flags.h"
extern SpriteLoadData gUnk_08111358;
extern void (*const gUnk_08111368[])(Entity*);
void sub_08067EF0(Entity*);
extern SpriteLoadData gUnk_08111358;
extern u16 gUnk_0811130E[];
void MountainMinish(Entity* this) {
if ((this->flags & 2) == 0) {
gUnk_08111368[this->action](this);
sub_0806ED78(this);
} else {
sub_08067EF0(this);
}
}
void sub_08067E60(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_08111358) != 0) {
this->action = 1;
sub_08078778(this);
InitializeAnimation(this, 2);
}
}
void sub_08067E88(Entity* this) {
s32 tmp;
tmp = sub_0806ED9C(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
} else {
this->field_0xf = this->field_0xf - 1;
tmp = this->animIndex;
}
}
if (sub_0806F078(this, tmp) == 0) {
GetNextFrame(this);
}
if (this->interactType != 0) {
this->interactType = 0;
this->action = 2;
TextboxNoOverlapFollow(this->actionDelay + 0x1200);
}
}
void sub_08067EE8(Entity* this) {
this->action = 1;
}
ASM_FUNC("asm/non_matching/mountainMinish/sub_08067EF0.inc", void sub_08067EF0(Entity* this))
void sub_08068104(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
ASM_FUNC("asm/non_matching/mountainMinish/sub_0806811C.inc", void sub_0806811C(Entity* this))
NONMATCH("asm/non_matching/mountainMinish/sub_08068190.inc", void sub_08068190(Entity* this)) {
u32 uVar1;
u32 uVar2;
u32 uVar3;
uVar3 = this->type2;
if (uVar3 > 8) {
uVar3 = 8;
}
uVar1 = CheckLocalFlag(0x7e);
uVar2 = BOOLCAST(uVar1);
if (GetInventoryValue(0x41) != 0) {
uVar2 = 2;
}
if (GetInventoryValue(2) != 0) {
uVar2 = 3;
}
// TODO unable to devide the array access variables by two without breaking everything
TextboxNoOverlap(gUnk_0811130E[uVar2 * 2 + uVar3 * 8], this);
}
END_NONMATCH
void sub_080681D8(Entity* this, ScriptExecutionContext* context) {
this->type = context->intVariable;
}
ASM_FUNC("asm/non_matching/mountainMinish/MountainMinish_Head.inc", void MountainMinish_Head(Entity* this))
void MountainMinish_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08111358) != 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 6);
}
} else {
GetNextFrame(this);
}
}
+108
View File
@@ -0,0 +1,108 @@
#include "entity.h"
#include "script.h"
#include "player.h"
#include "structures.h"
#include "functions.h"
#include "structures.h"
#include "textbox.h"
extern void (*const gUnk_081104C8[])(Entity*);
bool32 sub_0806650C(Entity*);
extern void sub_08078AC0(u32, u32, u32);
void sub_08066490(Entity*, Entity*);
void sub_08066570(Entity* this);
void NPC23(Entity* this) {
gUnk_081104C8[this->action](this);
sub_0806ED78(this);
}
void sub_080662F8(Entity* this) {
this->action = 1;
this->subAction = 0;
this->spriteSettings.b.draw = 1;
this->animationState = this->type << 1;
InitializeAnimation(this, this->type);
this->field_0x7c.HALF.HI = this->x.HALF.HI;
this->field_0x80.HWORD = this->y.HALF.HI;
this->field_0x86.HWORD = 0;
this->field_0x82.HWORD = this->actionDelay;
this->parent = &gPlayerEntity;
this->cutsceneBeh.HWORD = 0;
sub_08066490(this, this->parent);
sub_08078778(this);
}
void sub_08066358(Entity* this) {
if (this->interactType != 0) {
this->interactType = 0;
TextboxNoOverlapFollow(0);
if ((this->type2 & 0x10) != 0) {
this->action = 3;
this->subAction = 0;
if ((this->field_0x7c.HALF_U.HI - this->x.HALF.HI) > 8) {
this->direction = 8;
} else {
this->direction = 0x18;
}
this->speed = 0x80;
this->cutsceneBeh.HWORD = 1;
gUnk_02034490[0] = 1;
sub_080788E0(this);
}
} else {
sub_08066490(this, this->parent);
}
GetNextFrame(this);
sub_08066570(this);
}
void nullsub_110(void) {
}
void sub_080663D4(Entity* this) {
if (this->x.HALF.HI == this->field_0x7c.HALF_U.HI - 8) {
if (gPlayerEntity.action != 0xf) {
this->action = 4;
this->direction = 0;
this->speed = 0;
this->cutsceneBeh.HWORD = 0;
InitializeAnimation(this, 2);
}
} else {
if (this->subAction == 0) {
InitializeAnimation(this, (this->direction >> 3) + 4);
this->subAction = this->subAction + 1;
}
ProcessMovement(this);
}
sub_08078B48();
GetNextFrame(this);
}
void sub_0806643C(Entity* this) {
bool32 tmp = sub_0806650C(this);
if (tmp == FALSE) {
this->action = 5;
gRoomControls.cameraTarget = NULL;
sub_08078AC0(0x40, 0, 0);
gPlayerEntity.animationState = 0;
gPlayerEntity.direction = 0;
}
GetNextFrame(this);
}
void sub_08066474(void) {
if (gPlayerEntity.action != 0xf) {
gUnk_02034490[0] = 0;
}
}
ASM_FUNC("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(Entity* this, Entity* entity))
ASM_FUNC("asm/non_matching/npc23/sub_0806650C.inc", bool32 sub_0806650C(Entity* this))
ASM_FUNC("asm/non_matching/npc23/sub_08066570.inc", void sub_08066570(Entity* this))
+54
View File
@@ -0,0 +1,54 @@
#include "entity.h"
#include "functions.h"
extern void sub_0806FFBC(Entity*, u32, u32, u32);
extern SpriteLoadData gUnk_081146D0;
void NPC58(Entity* this) {
s32 sVar1;
s32 uVar2;
s32 uVar4;
Entity* entity;
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_081146D0) == 0) {
return;
}
this->action += 1;
this->spriteSettings.b.draw = 2;
this->spriteRendering.b3 = 0;
this->spritePriority.b0 = 0;
this->spriteOrientation.flipY = 1;
this->x.HALF.HI = 0x78;
this->y.HALF.HI = 0x10;
}
entity = this->parent;
if (entity != NULL) {
sVar1 = *(s16*)&entity->field_0x68.HWORD;
uVar2 = (s32)sVar1 / 600;
this->field_0x68.HWORD = uVar2;
uVar4 = (s32)sVar1 % 600;
this->field_0x6a.HWORD = uVar4 / 0x3c;
uVar4 = uVar4 % 0x3c;
uVar2 = uVar4 / 6;
this->field_0x6c.HWORD = uVar2;
if (entity->next == NULL) {
DeleteThisEntity();
}
} else {
DeleteThisEntity();
}
}
void NPC58_Head(Entity* this) {
this->frameIndex = 0xff;
SetExtraSpriteFrame(this, 0, (s16)this->field_0x68.HWORD);
SetExtraSpriteFrame(this, 1, (s16)this->field_0x6a.HWORD);
SetExtraSpriteFrame(this, 2, (s16)this->field_0x6c.HWORD);
SetExtraSpriteFrame(this, 3, 10);
sub_0806FFBC(this, 0, 0xfffffff4, 0);
sub_0806FFBC(this, 1, 0xfffffffc, 0);
sub_0806FFBC(this, 2, 0xc, 0);
sub_0807000C(this);
}
+61
View File
@@ -5,6 +5,7 @@
#include "functions.h"
#include "flags.h"
#include "script.h"
#include "save.h"
extern void sub_0806B41C(Entity*);
extern void sub_0806B3CC(Entity*);
@@ -16,6 +17,8 @@ extern u16 gUnk_08112E54[4];
extern Dialog gUnk_08112E2C[5];
extern SpriteLoadData gUnk_08112E1C;
extern SpriteLoadData gUnk_08112E1C;
void Percy_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (this->frameSpriteSettings & 0x3f) + 0x13);
SetExtraSpriteFrame(this, 1, (this->frames.all & 0x7f) + 0xb);
@@ -105,3 +108,61 @@ void sub_0806B504(Entity* this) {
TextboxNoOverlap(gUnk_08112E54[idx], this);
}
void sub_0806B540(Entity* this) {
ScriptExecutionContext* context;
context = *(ScriptExecutionContext**)&this->cutsceneBeh;
switch (context->unk_18) {
case 0:
TextboxNoOverlap(0x2312, this);
if (CheckLocalFlag(0x3f) != 0) {
return;
}
context->unk_18 += 1;
SetLocalFlag(0x3f);
break;
case 1:
if ((gTextBox.doTextBox & 0x7f) == 0) {
context->unk_18 = 2;
TextboxNoOverlap(0x2315, this);
}
break;
case 2:
if ((gTextBox.doTextBox & 0x7f) == 0) {
context->unk_18 = 3;
if (gSave.stats.filler3[0] != 0) {
sub_080A7C18(0x58, 0, 0);
} else {
sub_080A7C18(0x3f, 100, 0);
}
SetRoomFlag(0xf);
}
break;
case 3:
if ((gPlayerEntity.action != 8)) {
context->wait = 0x2d;
return;
}
break;
}
gActiveScriptInfo.commandSize = 0;
}
void sub_0806B60C(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Percy_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08112E1C) != 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 2);
}
} else {
GetNextFrame(this);
}
}
+33
View File
@@ -0,0 +1,33 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
#include "fileScreen.h"
#include "screen.h"
extern void sub_08057044(u32, struct_020227E8*, u32);
extern u32 gUnk_081146B8;
extern u16 gBG0Settings[];
void Phonograph(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HWORD = 1;
this->field_0x6a.HWORD = 0xffff;
sub_0807DD64(this);
this->frameIndex = 0;
}
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
}
ASM_FUNC("asm/non_matching/phonograph/sub_0806E964.inc",
void sub_0806E964(Entity* this, ScriptExecutionContext* context))
void sub_0806EABC(Entity* this, u32 param) {
sub_08050384();
sub_08057044(param, &gUnk_020227E8, 0x202020);
sub_0805F46C(0x3302, &gUnk_081146B8);
gScreen.bg.bg0Updated = 1;
}
+132
View File
@@ -0,0 +1,132 @@
#include "entity.h"
#include "script.h"
#include "structures.h"
#include "functions.h"
#include "textbox.h"
extern void DoExitTransition(ScreenTransitionData*);
extern ScreenTransitionData gUnk_0813AD4C;
void sub_0806E014(Entity* this);
void sub_0806E0DC(Entity* this);
extern void (*const gUnk_081142BC[])(Entity*);
extern void sub_08078828(Entity*);
extern Hitbox gUnk_080FD150;
void PicolyteBottle(Entity* this) {
gUnk_081142BC[this->action](this);
if (this->type == 0) {
gPlayerState.field_0x1a[0] |= 0x80;
}
}
void sub_0806DF00(Entity* this) {
Entity* npc;
if (this->type == 0) {
this->action = 1;
npc = CreateNPC(0x51, 1, 0);
*(Entity**)&this->field_0x68 = npc;
npc->parent = this;
npc = CreateNPC(0x51, 1, 1);
*(Entity**)&this->field_0x6c = npc;
npc->parent = this;
npc = CreateNPC(0x51, 1, 2);
*(Entity**)&this->field_0x70 = npc;
npc->parent = this;
this->field_0x74.HWORD = 0;
this->field_0x76.HWORD = 10;
gScreenTransition.field_0x8 = 10;
sub_0806E014(this);
sub_0807DD50(this);
} else {
this->hitbox = &gUnk_080FD150;
this->collisionLayer = 1;
sub_0806E0DC(this);
}
}
ASM_FUNC("asm/non_matching/picolyteBottles/sub_0806DF74.inc", void sub_0806DF74(Entity* this))
void sub_0806DFB4(Entity* this) {
Entity* obj;
if (this->interactType != 0) {
this->interactType = 0;
this->parent->actionDelay = this->type2;
this->parent->type2 = this->field_0xf;
} else {
if (this->actionDelay != 0) {
this->actionDelay = 0;
obj = CreateObject(0x35, 2, this->field_0xf);
if (obj != NULL) {
obj->parent = this;
this->attachedEntity = obj;
CopyPosition(this, obj);
}
sub_080788E0(this);
sub_0807B7D8(0x74, this->field_0x76.HWORD, 2);
}
}
}
void nullsub_111(void) {
}
ASM_FUNC("asm/non_matching/picolyteBottles/sub_0806E014.inc", void sub_0806E014(Entity* this))
void sub_0806E0DC(Entity* this) {
this->actionDelay = 0;
if (this->field_0xf != 0xff) {
this->action = 2;
this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
if (this->attachedEntity != NULL) {
DeleteEntity(this->attachedEntity);
this->attachedEntity = NULL;
}
sub_08078828(this);
sub_0807B7D8(0x73, this->field_0x76.HWORD, 2);
} else {
this->action = 3;
}
}
ASM_FUNC("asm/non_matching/picolyteBottles/sub_0806E140.inc",
void sub_0806E140(Entity* this, ScriptExecutionContext* context))
void sub_0806E1E0(Entity* this) {
sub_0806E014(this);
sub_0806E0DC(*(Entity**)&this->field_0x68);
sub_0806E0DC(*(Entity**)&this->field_0x6c);
sub_0806E0DC(*(Entity**)&this->field_0x70);
}
void sub_0806E1FC(Entity* this) {
DoExitTransition(&gUnk_0813AD4C);
}
void sub_0806E20C(void) {
if (gScreenTransition.field_0x8 != 0) {
TextboxNoOverlapFollow(0x421f);
gTextBox.field_0x10 = gScreenTransition.field_0x8;
} else {
TextboxNoOverlapFollow(0x4220);
}
}
void sub_0806E23C(void) {
if (gScreenTransition.field_0x8 != 0) {
ModRupees(gScreenTransition.field_0x8);
}
}
void sub_0806E250(Entity* this, ScriptExecutionContext* context) {
context->condition = 0;
if (CheckKinstoneFused(0x31) != 0) {
context->condition = 1;
}
gActiveScriptInfo.flags |= 1;
}
+130
View File
@@ -0,0 +1,130 @@
#include "entity.h"
#include "functions.h"
#include "textbox.h"
#include "save.h"
#include "script.h"
#include "npc.h"
void sub_08063B68(Entity* this);
void sub_08063A80(Entity* this);
extern void (*gUnk_0810CDF8[])(Entity*);
extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32);
extern Dialog gUnk_0810CE04[];
void Pina(Entity* this) {
if ((this->flags & 2) != 0) {
sub_08063B68(this);
} else {
sub_08063A80(this);
}
}
void sub_08063A80(Entity* this) {
gUnk_0810CDF8[this->action](this);
}
void sub_08063A98(Entity* this) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 4);
sub_08078778(this);
}
ASM_FUNC("asm/non_matching/pina/sub_08063AC0.inc", void sub_08063AC0(Entity* this))
void sub_08063B44(Entity* this) {
u8 tmp = gTextBox.doTextBox & 0x7f;
if (tmp == 0) {
this->action = 1;
this->field_0xf = tmp;
InitAnimationForceUpdate(this, 4);
}
}
void sub_08063B68(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.HI = 0;
sub_0807DD64(this);
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
sub_0806F118(this);
} else {
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
UpdateAnimationSingleFrame(this);
}
break;
case 2:
if (UpdateFuseInteraction(this) == 0) {
return;
}
this->action = 1;
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
break;
}
}
void sub_08063C14(void) {
Entity* entity = DeepFindEntityByID(7, 0x14);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 8);
}
}
void sub_08063C2C(void) {
Entity* entity = DeepFindEntityByID(7, 0x14);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 4);
}
}
void sub_08063C44(void) {
Entity* entity = DeepFindEntityByID(7, 0x14);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 0);
}
}
void sub_08063C5C(void) {
Entity* entity = DeepFindEntityByID(7, 0x14);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 9);
}
}
void sub_08063C74(void) {
Entity* entity = DeepFindEntityByID(7, 0x14);
if (entity != NULL) {
CreateSpeechBubbleExclamationMark(entity, 8, 0xffffffe8);
}
}
void sub_08063C90(Entity* this) {
ShowNPCDialogue(this, &gUnk_0810CE04[gSave.unk8]);
}
void sub_08063CAC(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Pina_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
this->y.HALF.HI -= 4;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);
}
}
+27
View File
@@ -8,6 +8,7 @@
#include "structures.h"
#include "save.h"
#include "script.h"
#include "flags.h"
extern void sub_08060528(Entity*);
extern void sub_0806EE04(Entity*, void*, u32);
@@ -202,3 +203,29 @@ void sub_0806075C(Entity* this) {
this->field_0x68.HALF.LO = 0xb;
this->field_0x68.HALF.HI = 0xff;
}
ASM_FUNC("asm/non_matching/postman/sub_0806076C.inc", void sub_0806076C(Entity* this, ScriptExecutionContext* context))
ASM_FUNC("asm/non_matching/postman/sub_080608E4.inc", void sub_080608E4(Entity* this, ScriptExecutionContext* context))
void Postman_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);
}
}
void CreateZeldaFollower(void) {
Entity* npc;
if (CheckGlobalFlag(0x1c) != 0) {
npc = CreateNPC(0x2e, 0, 0);
if (npc != NULL) {
CopyPosition(&gPlayerEntity, npc);
npc->flags |= 0x20;
npc->animationState = GetAnimationState(npc);
}
}
}
+274
View File
@@ -3,6 +3,9 @@
#include "script.h"
#include "audio.h"
#include "functions.h"
#include "random.h"
#include "flags.h"
#include "textbox.h"
extern void sub_0806A8C8(Entity*);
@@ -11,6 +14,17 @@ extern void (*gUnk_08112278[])(Entity*);
extern void script_08012F0C;
extern void sub_08078850(Entity*, u32, u32, u32*);
extern u32 gUnk_0811229C;
extern void sub_0807F950(Entity* this, ScriptExecutionContext* context);
extern u8 gUnk_081122A0[];
void sub_0806A9B0(Entity*, ScriptExecutionContext*);
void sub_0806A914(Entity* this);
void Rem(Entity* this) {
gUnk_08112260[this->type](this);
}
@@ -47,3 +61,263 @@ void sub_0806A3D8(Entity* this) {
*(ScriptExecutionContext**)&this->cutsceneBeh = uVar1;
sub_0807DD94(this, NULL);
}
void sub_0806A410(Entity* this) {
switch (this->subAction) {
case 0:
if (--this->actionDelay == 0) {
this->subAction = this->subAction + 1;
InitializeAnimation(this, 8);
}
break;
case 1:
if (((this->frames.all & 0x80) != 0)) {
sub_0806A9B0(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
}
break;
}
}
void sub_0806A458(Entity* this) {
switch (this->subAction) {
case 0:
if (--this->actionDelay == 0) {
this->subAction += 1;
}
break;
case 1:
if ((this->frames.all & 0x80) != 0) {
this->subAction = 2;
InitializeAnimation(this, 10);
ClearLocalFlag(0x62);
}
break;
case 2:
if (((this->frames.all & 0x80) != 0)) {
this->action = 1;
this->subAction = 0;
this->actionDelay = 0x3c;
InitializeAnimation(this, 2);
}
break;
}
}
void sub_0806A4CC(Entity* this) {
switch (this->subAction) {
case 0:
if ((this->frames.all & 0x80) != 0) {
if ((u8)(this->animIndex - 8) < 2) {
this->subAction = 1;
this->field_0x6a.HWORD = 1;
InitializeAnimation(this, 10);
} else {
this->subAction = 2;
this->field_0x6a.HWORD = 0;
InitializeAnimation(this, GetAnimationState(this));
}
break;
case 1:
if ((this->frames.all & 0x80) != 0) {
this->subAction = 2;
InitializeAnimation(this, GetAnimationState(this));
}
break;
default:
this->actionDelay = 0xb4;
break;
}
}
}
void sub_0806A550(Entity* this) {
if (this->subAction == 0) {
this->subAction = 1;
InitializeAnimation(this, 0xc);
} else {
if (this->frames.all == 1) {
this->frames.all = 0;
sub_08080964(8, 2);
gActiveScriptInfo.unk_00 |= 0x100;
SoundReq(SFX_11B);
}
if ((this->frames.all & 0x80) != 0) {
this->action = 5;
this->subAction = 0;
InitializeAnimation(this, 0xd);
sub_0806A914(this);
}
}
}
void nullsub_503(void) {
}
void sub_0806A5C0(Entity* this) {
GetNextFrame(this);
if ((this->frames.all & 0x80) != 0) {
InitializeAnimation(this, (Random() & 3) + 4);
}
}
void sub_0806A5E8(Entity* this) {
if (this->action == 0) {
this->action = 1;
InitializeAnimation(this, 0x10);
this->actionDelay = (Random() & 0x3f) + 0x3c;
}
this->actionDelay -= 1;
if (this->actionDelay == 0) {
this->actionDelay = (Random() & 0x3f) + 0x78;
SoundReq(SFX_REM_SLEEP);
}
GetNextFrame(this);
}
void sub_0806A630(Entity* this) {
if (this->action == 0) {
this->action = 1;
InitializeAnimation(this, 0x12);
}
if ((gActiveScriptInfo.unk_00 & 0x100) != 0) {
GetNextFrame(this);
}
if (this->frames.all == 1) {
this->frames.all = 0;
SoundReq(SFX_SECRET);
}
}
ASM_FUNC("asm/non_matching/rem/sub_0806A674.inc", void sub_0806A674(Entity* this))
void sub_0806A830(Entity* this) {
Entity* npc;
if (this->action == 0) {
this->action = 1;
InitializeAnimation(this, 0x14);
sub_0805E3A0(this, 2);
}
if ((gActiveScriptInfo.unk_00 & 0x200) != 0) {
DeleteThisEntity();
}
GetNextFrame(this);
if (this->frames.all == 1) {
this->frames.all = 0;
npc = CreateNPC(0x37, 5, 0);
if (npc != NULL) {
PositionEntityOnTop(this, npc);
}
}
}
void sub_0806A890(Entity* this) {
if (this->action == 0) {
this->action = 1;
InitializeAnimation(this, 0x15);
sub_0805E3A0(this, 2);
}
GetNextFrame(this);
if ((this->frames.all & 0x80) != 0) {
DeleteThisEntity();
}
}
void sub_0806A8C8(Entity* this) {
Entity* entity;
if ((CheckLocalFlag(0x60) == 0) && (entity = CreateNPC(0x37, 2, 0), entity != NULL)) {
CopyPosition(this, entity);
entity->parent = this;
}
entity = CreateNPC(0x37, 3, 0);
if (entity != NULL) {
CopyPosition(this, entity);
entity->y.HALF.HI += 2;
entity->parent = this;
}
}
void sub_0806A914(Entity* this) {
Entity* npc = CreateNPC(0x37, 1, 0);
if (npc != NULL) {
CopyPosition(this, npc);
ResolveEntityOnTop(this, npc);
}
}
void sub_0806A93C(Entity* this) {
sub_08078778(this);
sub_08078850(this, 0, 0, &gUnk_0811229C);
}
void sub_0806A958(Entity* this) {
if (this->action != 5) {
gActiveScriptInfo.commandSize = 0;
}
}
void sub_0806A96C(Entity* this, ScriptExecutionContext* context) {
context->condition = 0;
if (this->interactType != 0) {
if (this->action != 3) {
this->action = 3;
this->subAction = 0;
} else {
if (this->subAction > 1) {
this->interactType = 0;
context->condition = 1;
gActiveScriptInfo.flags |= 1;
}
}
}
}
void sub_0806A9B0(Entity* this, ScriptExecutionContext* context) {
this->action = 2;
this->subAction = 0;
this->actionDelay = gUnk_081122A0[Random() & 7];
this->field_0x80.HWORD = 9;
InitializeAnimation(this, 9);
SetLocalFlag(0x62);
}
void sub_0806A9E8(Entity* this) {
Entity* npc = CreateNPC(0x37, 4, 0);
if (npc != NULL) {
CopyPosition(this, npc);
sub_0806FAD8(this, npc);
}
}
void sub_0806AA10(Entity* this) {
sub_0806A914(this);
}
void sub_0806AA18(Entity* this) {
u32 index;
if (this->field_0x6a.HWORD != 0) {
index = 0x4408;
} else if ((gScreenTransition.frameCount & 1U) == 0) {
index = 0x4407;
} else {
index = 0x440d;
}
TextboxNoOverlap(index, this);
}
ASM_FUNC("asm/non_matching/rem/sub_0806AA50.inc", void sub_0806AA50(Entity* this, ScriptExecutionContext* context))
void sub_0806AB74(Entity* this) {
gRoomVars.filler[3] = 1;
if ((s32)(this->y.HALF.HI - (u32)gRoomControls.roomOriginY) < 0xa8) {
this->y.HALF.HI = gRoomControls.roomOriginY + 0xa8;
}
}
void sub_0806AB9C(Entity* this, ScriptExecutionContext* context) {
Entity* entity = FindEntity(7, 0x37, 7, 1, 0);
if (entity != NULL) {
DeleteEntity(entity);
}
sub_0807F950(this, context);
}
+95
View File
@@ -0,0 +1,95 @@
#include "entity.h"
#include "script.h"
#include "npc.h"
#include "functions.h"
#include "save.h"
#include "random.h"
extern void (*gUnk_0810CBD8[])(Entity*);
extern Dialog gUnk_0810CC08[];
extern SpriteLoadData gUnk_0810CB78[];
extern void sub_08096208(Entity*, u32);
void SittingPerson(Entity* this) {
gUnk_0810CBD8[this->action](this);
}
ASM_FUNC("asm/non_matching/sittingPerson/sub_08063758.inc", void sub_08063758(Entity* this))
void sub_080637B8(Entity* this) {
u32 tmp;
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
tmp = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
if ((this->spriteSettings.raw * 0x2000000) < 0) {
tmp += 4;
}
InitializeAnimation(this, tmp);
sub_0806F118(this);
} else {
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
if (this->frameDuration == 0xfe) {
this->frameDuration = (Random() & 0x1f) + 0x1e;
}
GetNextFrame(this);
}
}
void sub_08063830(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitializeAnimation(this, this->field_0x68.HALF.HI);
}
}
ASM_FUNC("asm/non_matching/sittingPerson/sub_08063850.inc", void sub_08063850(Entity* this))
void sub_08063874(Entity* this) {
this->animationState = this->actionDelay;
}
ASM_FUNC("asm/non_matching/sittingPerson/sub_0806387C.inc", void sub_0806387C(Entity* this))
ASM_FUNC("asm/non_matching/sittingPerson/sub_0806390C.inc", void sub_0806390C(Entity* this))
void sub_08063944(Entity* this, ScriptExecutionContext* context) {
s32 tmp;
context->condition = 0;
tmp = gSave.unk8 - 2;
if (tmp < 0) {
tmp = 0;
}
ShowNPCDialogue(this, gUnk_0810CC08 + this->type2 * 8 + tmp);
}
ASM_FUNC("asm/non_matching/sittingPerson/SittingPerson_Head.inc", void SittingPerson_Head(Entity* this))
void sub_080639D0(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void SittingPerson_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810CB78[this->type * 3]) != 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
this->spriteSettings.b.flipX = 0;
this->y.HALF.HI -= 4;
InitializeAnimation(this, 2);
sub_08096208(this, this->type);
}
} else {
if (this->frameDuration == 0xfe) {
this->frameDuration = (Random() & 0x1f) + 0x1e;
}
GetNextFrame(this);
}
}
+156
View File
@@ -0,0 +1,156 @@
#include "entity.h"
#include "script.h"
#include "room.h"
#include "textbox.h"
#include "functions.h"
extern void CreateSpeechBubbleQuestionMark(Entity*, u32, u32);
extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32);
extern void (*const gUnk_0810FDC8[])(Entity*);
extern void (*const gUnk_0810FDA4[])(Entity*);
extern bool32 sub_08056338(void);
extern void sub_08078850(Entity*, u32, u8, u32*);
extern u32 gUnk_0810FDA0;
extern u16 script_080142B0;
void Stockwell(Entity* this) {
gUnk_0810FDA4[this->action](this);
ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
sub_0806ED78(this);
}
void sub_08065080(Entity* this) {
ScriptExecutionContext* context;
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0805E3A0(this, 2);
InitializeAnimation(this, 4);
sub_08078778(this);
sub_08078850(this, 0, 0, &gUnk_0810FDA0);
context = StartCutscene(this, &script_080142B0);
*(ScriptExecutionContext**)&this->cutsceneBeh = context;
}
ASM_FUNC("asm/non_matching/stockwell/sub_080650CC.inc", void sub_080650CC(Entity* this))
void sub_080651AC(Entity* this) {
GetNextFrame(this);
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->interactType = gTextBox.doTextBox & 0x7f;
this->action = 1;
InitializeAnimation(this, 4);
}
}
void sub_080651D8(Entity* this) {
GetNextFrame(this);
gUnk_0810FDC8[this->subAction](this);
}
void sub_080651F8(Entity* this) {
if ((this->frames.all & 0x20) == 0) {
this->subAction = 1;
this->actionDelay = 0x3c;
InitializeAnimation(this, 1);
CreateSpeechBubbleExclamationMark(this, 8, 0xffffffe8);
sub_08078A90(1);
}
}
void sub_0806522C(Entity* this) {
if (--this->actionDelay == 0) {
++this->subAction;
TextboxNoOverlap(0x2c16, this);
}
}
void sub_08065250(Entity* this) {
switch (sub_08056338()) {
case 0:
this->subAction += 1;
this->actionDelay = 0x1e;
this->field_0xf = 0;
CreateSpeechBubbleExclamationMark(this, 8, 0xffffffe8);
break;
case 1:
this->subAction = 7;
this->actionDelay = 0;
this->field_0xf = 2;
break;
}
}
void sub_0806528C(Entity* this) {
if (--this->actionDelay == 0) {
++this->subAction;
TextboxNoOverlap(0x2c18, this);
}
}
void sub_080652B0(Entity* this) {
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->subAction += 1;
this->actionDelay = 10;
gRoomVars.greatFairyState = this->field_0xf;
CreateItemEntity(0x36, 0, 0);
}
}
void sub_080652E4(Entity* this) {
if (this->actionDelay != 0) {
this->actionDelay -= 1;
} else {
if (gPlayerEntity.action != 8) {
this->subAction += 1;
TextboxNoOverlap(0x2c19, this);
}
}
}
void sub_08065314(Entity* this) {
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->subAction += 1;
MenuFadeIn(3, 3);
}
}
void sub_08065338(Entity* this) {
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->action = 1;
this->subAction = gTextBox.doTextBox & 0x7f;
gRoomVars.greatFairyState = this->field_0xf;
InitializeAnimation(this, 4);
}
}
void sub_08065368(Entity* this) {
GetNextFrame(this);
}
ASM_FUNC("asm/non_matching/stockwell/sub_08065370.inc",
void sub_08065370(Entity* this, ScriptExecutionContext* context))
void sub_080654DC(Entity* this) {
CreateSpeechBubbleQuestionMark(this, 8, 0xffffffe8);
}
void sub_080654EC(Entity* this) {
CreateSpeechBubbleExclamationMark(this, 8, 0xffffffe8);
}
void sub_080654FC(Entity* this) {
if ((this->frames.all & 0x20) != 0) {
gActiveScriptInfo.commandSize = 0;
} else {
gActiveScriptInfo.flags |= 1;
}
}
void sub_08065528(Entity* this, ScriptExecutionContext* context) {
gRoomVars.greatFairyState = context->intVariable;
}
+128
View File
@@ -0,0 +1,128 @@
#include "entity.h"
#include "functions.h"
#include "npc.h"
#include "textbox.h"
#include "createObject.h"
#include "flags.h"
#include "script.h"
extern u16 gUnk_0810FA54[];
extern SpriteLoadData gUnk_0810FA38;
extern void sub_0806EE04(Entity*, void*, u32);
extern u32 gUnk_0810FA5A;
void sub_08064CC0(Entity* this);
extern void (*const gUnk_0810FA44[])(Entity*);
void sub_08064C9C(Entity* this);
NONMATCH("asm/non_matching/sturgeon/Sturgeon.inc", void Sturgeon(Entity* this)) {
u8 uVar2;
if ((this->flags & 2) == 0) {
gUnk_0810FA44[this->action](this);
sub_0806ED78(this);
} else {
uVar2 = this->action;
if (uVar2 == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810FA38) != 0) {
this->action = 1;
this->actionDelay = 0;
sub_0807DD50(this);
}
} else {
if ((uVar2 & 0x80) != 0) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
} else {
if (this->interactType == 2) {
this->action = 0xff;
this->interactType = uVar2 & 0x80;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this);
} else {
sub_0807DD94(this, NULL);
sub_08064C9C(this);
}
}
}
}
}
END_NONMATCH
void sub_08064B44(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_0810FA38) != 0) {
InitializeAnimation(this, 2);
sub_0806EE04(this, &gUnk_0810FA5A, 0);
sub_08064CC0(this);
this->action = 1;
this->subAction = 0;
this->spriteSettings.b.draw = 1;
}
}
ASM_FUNC("asm/non_matching/sturgeon/sub_08064B88.inc", void sub_08064B88(Entity* this))
void sub_08064C2C(Entity* this) {
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->action = 1;
InitializeAnimation(this, (u32)this->field_0xf);
}
}
void sub_08064C50(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitializeAnimation(this, this->field_0xf);
}
}
void Sturgeon_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (u8)this->frames.all & 0x3f);
SetExtraSpriteFrame(this, 1, (u32)this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
void sub_08064C9C(Entity* this) {
if ((this->actionDelay != 0) && ((gScreenTransition.frameCount & 3U) == 0)) {
CreateDust(this);
}
}
void sub_08064CC0(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void sub_08064CD8(Entity* this) {
u32 flag;
u32 tmp = 2;
if (GetInventoryValue(0x46) == 0) {
flag = CheckLocalFlag(0x73);
tmp = BOOLCAST(flag);
}
TextboxNoOverlap(gUnk_0810FA54[tmp], this);
}
void sub_08064D08(Entity* this) {
this->actionDelay = 1;
}
void sub_08064D10(Entity* this) {
this->actionDelay = 0;
}
void Sturgeon_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810FA38) != 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 6);
}
} else {
GetNextFrame(this);
}
}
+2
View File
@@ -60,3 +60,5 @@ NONMATCH("asm/non_matching/syrup/sub_0806A26C.inc", void sub_0806A26C(Entity* th
}
}
END_NONMATCH
ASM_FUNC("asm/non_matching/syrup/Syrup_Head.inc", void Syrup_Head(Entity* this))
+42
View File
@@ -2,6 +2,8 @@
#include "entity.h"
#include "npc.h"
#include "textbox.h"
#include "script.h"
#include "functions.h"
extern void sub_08064DE4(Entity*);
extern void sub_08064D78(Entity*);
@@ -79,3 +81,43 @@ void sub_08064DE4(Entity* this) {
}
}
}*/
ASM_FUNC("asm/non_matching/tingleSiblings/sub_08064DE4.inc", void sub_08064DE4(Entity* this))
void sub_08064EA4(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
switch (this->type) {
case 0:
if ((CheckKinstoneFused(0x59) != 0) && (GetInventoryValue(0xc) == 0)) {
this->field_0x68.HALF.LO = 0;
}
break;
case 3:
if ((CheckKinstoneFused(0x5a) != 0) && (GetInventoryValue(0xc) == 0)) {
this->field_0x68.HALF.LO = 0;
}
break;
default:
break;
}
sub_08078784(this, this->field_0x68.HALF.LO);
}
ASM_FUNC("asm/non_matching/tingleSiblings/sub_08064EE8.inc", void sub_08064EE8(Entity* this))
ASM_FUNC("asm/non_matching/tingleSiblings/sub_08064F28.inc",
void sub_08064F28(Entity* this, ScriptExecutionContext* context))
void TingleSiblings_Fusion(Entity* this) {
u32 tmp;
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
tmp = 6;
if (this->type == 0) {
tmp = 10;
}
InitAnimationForceUpdate(this, tmp);
} else {
sub_08064EE8(this);
}
}
+90
View File
@@ -18,6 +18,22 @@ extern u16 script_08014A80;
extern Dialog gUnk_08113ABC[];
extern u16 gUnk_08113B0C[];
extern Dialog gUnk_08113B28;
extern Dialog gUnk_08113B30;
extern u16 gUnk_08113B12[];
extern u16 gUnk_08113B22[];
extern u16 gUnk_08113B1E[];
extern u16 gUnk_08113B16[];
extern u8 gUnk_08113B38[];
extern SpriteLoadData gUnk_08113A1C[];
void WindTribespeople(Entity* this) {
gUnk_08113A7C[this->action](this);
}
@@ -126,3 +142,77 @@ void sub_0806C944(Entity* this) {
}
TextboxNoOverlap(gUnk_08113B0C[iVar2], this);
}
void sub_0806C978(Entity* this) {
u32 flag;
u32 flagAsBool;
flag = CheckGlobalFlag(0x58);
flagAsBool = BOOLCAST(flag);
TextboxNoOverlap(gUnk_08113B12[flagAsBool], this);
}
void sub_0806C99C(Entity* this) {
s32 flag;
u32 flagAsBool;
flag = CheckGlobalFlag(0x58);
flagAsBool = BOOLCAST(flag) & 2;
if (CheckLocalFlag(99) != 0) {
flagAsBool += 1;
}
TextboxNoOverlap(gUnk_08113B16[flagAsBool], this);
}
void sub_0806C9D0(Entity* this) {
u32 tmp = 0;
if (CheckLocalFlag(100) == 0) {
tmp = 1;
}
TextboxNoOverlap(gUnk_08113B1E[tmp], this);
}
void sub_0806C9F8(Entity* this) {
u32 flag;
u32 flagAsBool;
flag = CheckGlobalFlag(0x58);
flagAsBool = BOOLCAST(flag);
TextboxNoOverlap(gUnk_08113B22[flagAsBool], this);
}
void sub_0806CA1C(Entity* this) {
TextboxNoOverlap(0x251b, this);
}
void sub_0806CA2C(Entity* this) {
TextboxNoOverlap(0x2527, this);
}
void sub_0806CA3C(Entity* this) {
ShowNPCDialogue(this, &gUnk_08113B28);
}
void sub_0806CA4C(Entity* this) {
ShowNPCDialogue(this, &gUnk_08113B30);
}
void sub_0806CA5C(Entity* this, ScriptExecutionContext* context) {
context->wait = gUnk_08113B38[context->unk_18++];
if (this->type2 == 10) {
EnqueueSFX(0xe8);
}
if (context->wait != 0) {
gActiveScriptInfo.commandSize = 0;
}
}
void WindTribespeople_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08113A1C[this->type * 4]) != 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 6);
}
} else {
GetNextFrame(this);
}
}
+38 -2
View File
@@ -1,9 +1,13 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "script.h"
#include "utils.h"
extern void sub_08068318(Entity*);
extern void sub_0806854C(Entity*, u32);
extern void sub_0806854C(Entity*, u32*);
void sub_08068578(Entity* this);
void ZeldaFollower(Entity* this) {
if (this->action == 0) {
@@ -14,7 +18,7 @@ void ZeldaFollower(Entity* this) {
this->field_0x68.HALF.HI = 0;
sub_0805E3A0(this, 2);
InitAnimationForceUpdate(this, 0);
sub_0806854C(this, 0);
sub_0806854C(this, NULL);
}
if ((s8)this->field_0x68.HALF.LO != 0) {
sub_08068318(this);
@@ -22,3 +26,35 @@ void ZeldaFollower(Entity* this) {
this->spriteSettings.b.draw = FALSE;
}
}
ASM_FUNC("asm/non_matching/zeldaFollower/sub_08068318.inc", void sub_08068318(Entity* this))
void sub_0806854C(Entity* this, u32* none) {
this->myHeap = zMalloc(0xa0);
if (this->myHeap != NULL) {
this->field_0x68.HALF.LO = 1;
sub_080788E0(this);
this->hitbox = NULL;
sub_08068578(this);
}
}
ASM_FUNC("asm/non_matching/zeldaFollower/sub_08068578.inc", void sub_08068578(Entity* this))
void sub_08068680(Entity* this, Entity* entity) {
entity->field_0x68.HALF.LO = 0;
entity->spriteSettings.b.draw = 0;
}
void sub_08068694(Entity* this, Entity* entity) {
entity->field_0x68.HALF.LO = 1;
entity->spriteSettings.b.draw = 1;
entity->animationState = this->animationState;
sub_08068578(entity);
InitAnimationForceUpdate(entity, entity->animationState / 2);
}
void sub_080686C4(Entity* this, Entity* entity) {
entity->y.HALF.HI -= 0x10;
sub_08068578(entity);
}