mutoh.c OK

This commit is contained in:
theo3
2020-07-12 22:27:28 -07:00
parent 4f20b61b70
commit d429f7f9cb
6 changed files with 130 additions and 233 deletions
+19 -21
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "main.h"
#ifdef NON_MATCHING
#if 0
typedef struct {
u8 interruptFlag;
@@ -52,6 +52,7 @@ void MainLoop(void) {
bool32 codeInputted;
u8 cVar1;
u32 uVar2;
MainStruct *s;
sub_08055F70();
sub_080A3204();
@@ -66,45 +67,42 @@ void MainLoop(void) {
sub_08056418();
sub_080ADD30();
gRand = 0x1234567;
sub_0801D630(&gUnk_03001000, 16);
s = &gUnk_03001000;
sub_0801D630(s, 16);
sub_08056010(0);
do {
while (1) {
ReadKeyInput();
codeInputted = sub_08055FF4();
if (codeInputted) {
sub_080560A8();
}
if ((gUnk_03001000.field_0x1 == 0) || (gUnk_03001000.field_0x1 != 1)) {
if (gUnk_03001000.field_0x8 != '\0') {
while (codeInputted) {
if ((s->field_0x1 != 0) || (s->field_0x1 == 1)) {
sub_08056260();
} else if (s->field_0x8 != 0) {
while (--s->field_0x8) {
VBlankInterruptWait();
cVar1 = gUnk_03001000.field_0x8 + -1;
codeInputted = gUnk_03001000.field_0x8 != '\x01';
gUnk_03001000.field_0x8 = cVar1;
}
}
if (gUnk_03001000.countdown != '\0') {
gUnk_03001000.countdown = gUnk_03001000.countdown + -1;
uVar2 = gUnk_03001000.field_0xa;
while (0 < uVar2) {
if (s->countdown != 0) {
s->countdown--;
uVar2 = s->field_0xa;
while (uVar2 > 0) {
VBlankIntrWait();
uVar2 = uVar2 - 1;
uVar2--;
}
}
gUnk_03001000.ticks = gUnk_03001000.ticks + 1;
gUnk_08100CBC[gUnk_03001000.loadType]();
s->ticks++;
gUnk_08100CBC[s->loadType]();
sub_08056458();
sub_08050154();
sub_080A3480();
} else {
sub_08056260();
}
sub_08016E78();
} while (TRUE);
}
#else
#endif
NAKED
void MainLoop(void) {
asm(".include \"asm/non_matching/mainLoop.inc\"");
}
#endif
+99
View File
@@ -0,0 +1,99 @@
#include "global.h"
#include "entity.h"
#include "link.h"
#include "flags.h"
#include "textbox.h"
#include "npc.h"
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern u32 UpdateFuseInteraction(Entity*);
extern void sub_0807000C(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32);
extern SpriteLoadData gUnk_08110C00;
extern u16 gUnk_08110C0C[];
extern u32 gUnk_08110C10[];
void Mutoh(Entity* this)
{
if (*(u32*)&this->cutsceneBeh == 0) {
DeleteThisEntity();
}
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_08110C00)) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4);
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
break;
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
}
}
void Mutoh_Head(Entity *this)
{
SetExtraSpriteFrame(this, 0, (this->frames.all & -0x81));
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this,1,0);
sub_0807000C(this);
}
void sub_080670B4(Entity *this)
{
u32 uVar1;
u32 uVar2;
uVar2 = 0;
if (GetInventoryValue(0x11) == 0) {
uVar1 = CheckGlobalFlag(0x15);
uVar2 = (-uVar1 | uVar1) >> 0x1f;
}
TextboxNoOverlap(gUnk_08110C0C[uVar2],this);
}
void sub_080670E4(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08110C10[gUnk_02002A40.unk * 2]);
}
void sub_08067100(Entity *this)
{
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
}
void Mutoh_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08110C00) != 0) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 2);
}
}
else {
GetNextFrame(this);
}
}
+2 -9
View File
@@ -4,11 +4,6 @@
#include "textbox.h"
#include "flags.h"
typedef struct {
u8 filler[8];
u8 unk;
} struct_02002A40;
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern void sub_0807DD50(Entity*);
extern void sub_0806C7D4(Entity*);
@@ -21,15 +16,13 @@ extern void SetExtraSpriteFrame(Entity*, u32, u32);
extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
extern void SetSpriteSubEntryOffsetData1(Entity*, u32, u32);
extern void sub_0807000C(Entity*);
extern void ShowNPCDialogue(Entity*, u16*);
extern void (*const gUnk_08113A7C[])(Entity*);
extern void (*const gUnk_08113A8C[])(Entity*, Entity*);
extern SpriteLoadData gUnk_08113A1C[];
extern u32 gUnk_08014A80;
extern u16 gUnk_08113ABC[];
extern struct_02002A40 gUnk_02002A40;
extern u32 gUnk_08113ABC[];
extern u16 gUnk_08113B0C[];
void WindTribespeople(Entity* this) {
@@ -129,7 +122,7 @@ void sub_0806C90C(Entity *param_1,Entity *param_2)
void sub_0806C928(Entity *this)
{
ShowNPCDialogue(this, gUnk_08113ABC + (gUnk_02002A40.unk * 4));
ShowNPCDialogue(this, &gUnk_08113ABC[gUnk_02002A40.unk * 2]);
}
void sub_0806C944(Entity *this)