diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2021-11-06 00:33:07 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2021-11-06 00:33:07 +0100 |
| commit | a6d133e42dfec121b42028eb0d3a38fa4345d18d (patch) | |
| tree | ac7d0d5684c7b236bfbc996cf5a01a530f123e16 /src | |
| parent | 1a0f416bacbd8ceefa3197fcb71015ee721e43fb (diff) | |
| parent | 3592e47cd6167082e866b1a391781995df253c3b (diff) | |
Merge branch 'master' into asset-extraction
Diffstat (limited to 'src')
197 files changed, 3601 insertions, 1270 deletions
diff --git a/src/arm_proxy.c b/src/arm_proxy.c index e1f13c74..d8efb2a0 100644 --- a/src/arm_proxy.c +++ b/src/arm_proxy.c @@ -10,6 +10,7 @@ #include "manager.h" #include "utils.h" #include "npc.h" +#include "effects.h" extern u8 gUnk_03003DE0; extern u8 gUnk_03000C30; @@ -21,7 +22,7 @@ extern u8 gUnk_03003DF0[]; extern u8 gUnk_03003BE0; extern Entity* gUnk_03004040[3]; extern u8 gUnk_020342F8; -extern u8 gHitboxCount; +extern u8 gCollidableCount; extern void gDoCollision(void); extern void sub_080ADD70(); @@ -128,16 +129,16 @@ void PrepNextFrame(void) { void PlayerUpdate(Entity* this) { if (gSave.stats.effect != 0) - gPlayerState.flags.all |= 0x4000; + gPlayerState.flags |= 0x4000; else - gPlayerState.flags.all &= ~0x4000; + gPlayerState.flags &= ~0x4000; if (sub_0805E3B0(this) == 0) { - if ((gPlayerState.flags.all & 0x80000) != 0) { + if ((gPlayerState.flags & 0x80000) != 0) { sub_08077B20(); - if ((gPlayerState.flags.all & 0x200000) != 0) { + if ((gPlayerState.flags & 0x200000) != 0) { gPlayerState.playerAction = 0x18; - gPlayerState.flags.all &= ~0x80000; + gPlayerState.flags &= ~0x80000; gPlayerState.hurtBlinkSpeed = 0xf0; this->flags |= 0x80; } else { @@ -170,10 +171,10 @@ void HandlePlayerLife(Entity* this) { if ((gPlayerEntity.bitfield & 0x80) && (gPlayerEntity.iframes > 0)) SoundReq(SFX_86); - gPlayerState.flags.all &= ~(0x2000000 | 0x200); - if (gPlayerState.flags.all & 0x400) + gPlayerState.flags &= ~(0x2000000 | 0x200); + if (gPlayerState.flags & 0x400) ResetPlayer(); - if ((gPlayerState.flags.all & 0x400000) && !gPlayerState.field_0xa0[0]) + if ((gPlayerState.flags & 0x400000) && !gPlayerState.field_0xa0[0]) sub_0807A108(); if (sub_08079B24() == 0) sub_08079708(this); @@ -189,10 +190,10 @@ void HandlePlayerLife(Entity* this) { return; } - if ((gPlayerState.field_0x8b != 0) || (gTextBox.doTextBox & 0x7f)) + if ((gPlayerState.field_0x8b != 0) || (gMessage.doTextBox & 0x7f)) return; - gRoomVars.unk2 = gTextBox.doTextBox & 0x7f; + gRoomVars.unk2 = gMessage.doTextBox & 0x7f; temp = gSave.stats.maxHealth / 4; if (temp > 24) temp = 24; @@ -227,7 +228,7 @@ void HandlePlayerLife(Entity* this) { } else if ((gSave.stats.effectTimer == 0) || --gSave.stats.effectTimer == 0) { gSave.stats.effect = 0; } else if ((gSave.stats.effectTimer & 0x3f) == 0) { - CreateFx(this, 0x55 + gSave.stats.effect, 0); + CreateFx(this, FX_AURA_BASE + gSave.stats.effect, 0); } } #endif @@ -242,12 +243,12 @@ void sub_080171F0(void) { gPlayerEntity.bitfield &= ~0x80; if (gPlayerEntity.action != 0x14) - gPlayerState.flags.all = (gPlayerState.flags.all & ~0x10000) | (0x10000 * (gPlayerState.flags.all & 2) / 2); + gPlayerState.flags = (gPlayerState.flags & ~0x10000) | (0x10000 * (gPlayerState.flags & 2) / 2); - gPlayerState.flags.all &= ~2; + gPlayerState.flags &= ~2; sub_080028E0(&gPlayerEntity); - if (gPlayerState.flags.all & 0x400000) + if (gPlayerState.flags & 0x400000) gUnk_0200AF00.filler25[10] = 1; sub_08078180(); @@ -262,13 +263,13 @@ void sub_080171F0(void) { gPlayerState.field_0x3f = 0; sub_0807B0C8(); - if (gPlayerState.flags.all & 0x400000) + if (gPlayerState.flags & 0x400000) gUnk_03004040[0]->spriteOffsetY = gUnk_03004040[1]->spriteOffsetY = gUnk_03004040[2]->spriteOffsetY = 0; if (gPlayerEntity.action == 0x1d) - gPlayerState.flags.all |= 0x20000000; + gPlayerState.flags |= 0x20000000; else - gPlayerState.flags.all &= ~0x20000000; + gPlayerState.flags &= ~0x20000000; sub_0807A8D8(&gPlayerEntity); if (gPlayerState.jumpStatus & 0xc0) @@ -370,7 +371,7 @@ NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this END_NONMATCH void ClearHitboxList(void) { - gHitboxCount = 0; + gCollidableCount = 0; } void CollisionMain(void) { diff --git a/src/audio.c b/src/audio.c index e6b1da5a..5889a0eb 100644 --- a/src/audio.c +++ b/src/audio.c @@ -198,7 +198,6 @@ s32 fade(s32 target, s32 current) { void doPlaySound(u32 sound) { u32 volume; - u32 iVar2; MusicPlayerInfo* musicPlayerInfo; if (sound == 0) @@ -209,8 +208,7 @@ void doPlaySound(u32 sound) { } else { volume = gSoundPlayingInfo.volumeSfx; } - iVar2 = gSoundPlayingInfo.volumeMaster; - volume = iVar2 * volume / 0x100; + volume = gSoundPlayingInfo.volumeMaster * volume / 0x100; musicPlayerInfo = gMusicPlayers[gSongTable[sound].musicPlayerIndex].info; m4aMPlayImmInit(musicPlayerInfo); m4aMPlayVolumeControl(musicPlayerInfo, 0xffff, volume); @@ -535,7 +533,7 @@ extern const SongHeader sfx14E; extern const SongHeader sfx14F; extern const SongHeader sfx150; extern const SongHeader sfx151; -extern const SongHeader sfx152; +extern const SongHeader sfxNearPortal; extern const SongHeader sfx153; extern const SongHeader sfx154; extern const SongHeader sfx155; @@ -1167,7 +1165,7 @@ const Song gSongTable[] = { [SFX_14F] = { &sfx14F, MUSIC_PLAYER_15, MUSIC_PLAYER_15 }, [SFX_150] = { &sfx150, MUSIC_PLAYER_14, MUSIC_PLAYER_14 }, [SFX_151] = { &sfx151, MUSIC_PLAYER_13, MUSIC_PLAYER_13 }, - [SFX_152] = { &sfx152, MUSIC_PLAYER_18, MUSIC_PLAYER_18 }, + [SFX_NEAR_PORTAL] = { &sfxNearPortal, MUSIC_PLAYER_18, MUSIC_PLAYER_18 }, [SFX_153] = { &sfx153, MUSIC_PLAYER_11, MUSIC_PLAYER_11 }, [SFX_154] = { &sfx154, MUSIC_PLAYER_10, MUSIC_PLAYER_10 }, [SFX_155] = { &sfx155, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F }, diff --git a/src/code_08018C58.c b/src/code_08018C58.c index 14caf9cd..04d39a04 100644 --- a/src/code_08018C58.c +++ b/src/code_08018C58.c @@ -15,12 +15,10 @@ void CreateMinishEntrance(u32 tilePos) { } void sub_08018C58(u32 tilePos) { - u32 i = 0; + u32 i; - for (; i < 6;) { + for (i = 0; i < 6; i += 2, tilePos += 0x40) { SetTileType(0x260 + i, tilePos, 1); SetTileType(0x261 + i, tilePos + 1, 1); - i += 2; - tilePos += 0x40; } } diff --git a/src/code_0805436C.c b/src/code_0805436C.c index c2625d5b..7ec445b3 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -4,22 +4,14 @@ #include "menu.h" #include "area.h" #include "utils.h" - -typedef struct { - u8 filler[0xa8]; - Stats stats; -} SaveFile; +#include "structures.h" +#include "save.h" typedef struct { u8 unk; u8 filler[7]; } struct_080FD5B4; -typedef struct { - u8 filler[0x2e]; - u8 unk; -} ScreenTransition; - extern SaveFile gSave; extern struct_080FD5B4 gUnk_080FD5B4[]; extern ScreenTransition gScreenTransition; @@ -105,7 +97,7 @@ u32 SetBottleContents(u32 itemID, u32 bottleIndex) { return bottleIndex; } -u32 sub_0805449C(u32 arg0) { +u32 ItemIsSword(u32 arg0) { switch (arg0) { case 1: case 2: @@ -118,8 +110,8 @@ u32 sub_0805449C(u32 arg0) { } } -u32 sub_080544B4(u32 arg0) { - switch (arg0) { +u32 ItemIsShield(u32 id) { + switch (id) { case 13: case 14: return 1; @@ -128,8 +120,8 @@ u32 sub_080544B4(u32 arg0) { } } -u32 sub_080544C8(u32 arg0) { - switch (arg0) { +u32 ItemIsBottle(u32 id) { + switch (id) { case 28: case 29: case 30: @@ -140,14 +132,14 @@ u32 sub_080544C8(u32 arg0) { } } -u32 GetBottleContaining(u32 arg0) { - if (arg0 == gSave.stats.bottles[0]) { +u32 GetBottleContaining(u32 id) { + if (id == gSave.stats.bottles[0]) { return 1; - } else if (arg0 == gSave.stats.bottles[1]) { + } else if (id == gSave.stats.bottles[1]) { return 2; - } else if (arg0 == gSave.stats.bottles[2]) { + } else if (id == gSave.stats.bottles[2]) { return 3; - } else if (arg0 == gSave.stats.bottles[3]) { + } else if (id == gSave.stats.bottles[3]) { return 4; } else { return 0; @@ -160,7 +152,7 @@ NONMATCH("asm/non_matching/sub_08054524.inc", void sub_08054524(void)) { bVar1 = gArea.locationIndex; if (gArea.locationIndex == 0) { - bVar1 = gScreenTransition.unk; + bVar1 = gScreenTransition.field_0x24[0xa]; } if (bVar1 > 0x16) { bVar1 = 0; @@ -263,7 +255,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) { } else if (arg0->id == 0x1e) { itemEntity->direction = arg0->animationState << 3 | 0x80; itemEntity->speed = 0xc0; - itemEntity->field_0x20 = 0x18000; + itementity->hVelocity = 0x18000; } } CopyPosition(arg0, itemEntity); diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c index bd38cac5..d49bb996 100644 --- a/src/code_0805EC04.c +++ b/src/code_0805EC04.c @@ -10,7 +10,8 @@ typedef struct { } VStruct; typedef struct { - u8 filler[0x420]; + u8 _0[0x20]; + struct OamData oam[0x80]; VStruct unk[0x100]; } UStruct; diff --git a/src/code_0805F9A0.c b/src/code_0805F9A0.c index 120a7625..a921491e 100644 --- a/src/code_0805F9A0.c +++ b/src/code_0805F9A0.c @@ -141,7 +141,7 @@ void sub_0805F918(u32 idx, u32 idx2, void* dest) { u32 sub_0805F9A0(u32 r0) { - if (gUnk_02000000->gameLanguage == 0) { + if (gSaveHeader->gameLanguage == 0) { u16* val = &gUnk_081092D4; u32 i = 0; diff --git a/src/code_08077DF4.c b/src/code_08077DF4.c index 84a360f2..ac1d61e5 100644 --- a/src/code_08077DF4.c +++ b/src/code_08077DF4.c @@ -44,7 +44,6 @@ void sub_08077E54(ItemBehavior* beh) { } void sub_08077E78(ItemBehavior* arg0, u32 bits) { - u8* pbVar1; u32 not ; if (bits == 0) { diff --git a/src/code_080A29BC.c b/src/code_080A29BC.c index c085a684..17fb9fba 100644 --- a/src/code_080A29BC.c +++ b/src/code_080A29BC.c @@ -2,6 +2,7 @@ #include "entity.h" #include "room.h" #include "object.h" +#include "effects.h" void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) { Entity* pEVar1; @@ -15,15 +16,15 @@ void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) { } void sub_080A29FC(Entity* parent) { - CreateFx(parent, 0x11, 0); + CreateFx(parent, FX_DASH, 0); } void sub_080A2A08(Entity* parent) { - CreateFx(parent, 0x6, 0); + CreateFx(parent, FX_6, 0); } void sub_080A2A14(Entity* parent) { - CreateFx(parent, 0xb, 0); + CreateFx(parent, FX_WATER_SPLASH, 0); } Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) { @@ -50,7 +51,7 @@ Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) { Entity* sub_080A2A64(Entity* parent) { Entity* pEVar1; - pEVar1 = CreateFx(parent, 0x20, 0); + pEVar1 = CreateFx(parent, FX_SPARKLE2, 0); if (pEVar1 != NULL) { pEVar1->spritePriority.b0 = 7; } diff --git a/src/createObject.c b/src/createObject.c index cf3655c9..0d18f6b1 100644 --- a/src/createObject.c +++ b/src/createObject.c @@ -4,6 +4,7 @@ #include "room.h" #include "createObject.h" #include "object.h" +#include "effects.h" Entity* CreateObject(u32 subtype, u32 form, u32 parameter) { Entity* entity; @@ -36,13 +37,13 @@ Entity* CreateFx(Entity* parentEnt, u32 form, u32 parameter) { } void CreateDust(Entity* parent) { - CreateFx(parent, 2, 0); + CreateFx(parent, FX_DEATH, 0); } void CreateDustAt(s32 xOff, s32 yOff, u32 layer) { Entity* ent; - ent = CreateObject(SPECIAL_FX, 2, 0); + ent = CreateObject(SPECIAL_FX, FX_DEATH, 0); if (ent != NULL) { ent->x.HALF.HI = gRoomControls.roomOriginX + xOff; ent->y.HALF.HI = gRoomControls.roomOriginY + yOff; @@ -51,15 +52,15 @@ void CreateDustAt(s32 xOff, s32 yOff, u32 layer) { } void CreateDustSmall(Entity* parent) { - CreateFx(parent, 0x11, 0); + CreateFx(parent, FX_DASH, 0); } void CreateExplosionBroken(Entity* parent) { - CreateFx(parent, 0x6, 0); + CreateFx(parent, FX_6, 0); } void CreateWaterSplash(Entity* parent) { - CreateFx(parent, 0xb, 0); + CreateFx(parent, FX_WATER_SPLASH, 0); } Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) { @@ -86,7 +87,7 @@ Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) { Entity* CreateWaterTrace(Entity* parent) { Entity* ent; - ent = CreateFx(parent, 0x20, 0); + ent = CreateFx(parent, FX_RIPPLE, 0); if (ent != NULL) { ent->spritePriority.b0 = 7; } diff --git a/src/debugScreen.c b/src/debugScreen.c index b75181f2..9e290ae2 100644 --- a/src/debugScreen.c +++ b/src/debugScreen.c @@ -27,7 +27,7 @@ void sub_0805FA04(void) { MessageInitialize(); MemClear((void*)&gUnk_02032EC0, sizeof(UI)); MemClear((void*)&gMenu, sizeof(Menu)); - gMenu.unk16 = gUnk_02000000->gameLanguage; + gMenu.unk16 = gSaveHeader->gameLanguage; sub_08053320(); sub_0801D79C(0, 0x1144); gMain.funcIndex = 1; @@ -56,8 +56,8 @@ void sub_0805FA98(void) { } break; case 0x100: - gUnk_02000000->gameLanguage = gMenu.unk16; - TextboxNoOverlapFollow(gMenu.unk14 * 0x100 + gMenu.unk15); + gSaveHeader->gameLanguage = gMenu.unk16; + MessageFromTarget(gMenu.unk14 * 0x100 + gMenu.unk15); break; case 0x2: MessageInitialize(); diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index e506a605..4644e620 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -52,7 +52,7 @@ void sub_080318DC(Entity* this) { if (this->bitfield != 0x80 && this->bitfield != 0x81) { if (this->type == 1) { - if (this->action < 7 && this->field_0x42) { + if (this->action < 7 && this->knockbackDuration != 0) { brother = this->attachedEntity; if (brother) { brother->parent = this->parent; @@ -72,7 +72,7 @@ void sub_080318DC(Entity* this) { this->action = 9; this->spritePriority.b1 = 1; - if (this->field_0x3e < 0x10) { + if (this->knockbackDirection < 0x10) { this->spriteSettings.b.flipX = 0; } else { this->spriteSettings.b.flipX = 1; @@ -81,19 +81,19 @@ void sub_080318DC(Entity* this) { } if (this->currentHealth == 0) { - this->field_0x3e = ((this->field_0x3e + (7 & Random())) - 4) & 0x1f; - this->field_0x42 += this->type2 * 3; + this->knockbackDirection = ((this->knockbackDirection + (7 & Random())) - 4) & 0x1f; + this->knockbackDuration += this->type2 * 3; sub_08032338(this); } } - if (this->field_0x42 && this->frames.all & 0x10) { + if (this->knockbackDuration != 0 && this->frames.all & 0x10) { if (this->type == 0) { this->action = 8; } else { this->action = 9; } - if (this->field_0x3e < 0x10) { + if (this->knockbackDirection < 0x10) { this->spriteSettings.b.flipX = 0; } else { this->spriteSettings.b.flipX = 1; @@ -323,7 +323,7 @@ void sub_08031E90(Entity* this) { void sub_08031EA8(Entity* this) { this->action = 1; this->spritePriority.b1 = 1; - this->field_0x20 = 0x40000; + this->hVelocity = 0x40000; this->height.HALF.HI = (4 - this->type2) * 0xe; this->field_0x78.HALF.HI = Random(); InitializeAnimation(this, 4); @@ -332,8 +332,8 @@ void sub_08031EA8(Entity* this) { void sub_08031EE8(Entity* this) { int draw; - this->height.WORD -= this->field_0x20; - this->field_0x20 -= 0x1800; + this->height.WORD -= this->hVelocity; + this->hVelocity -= 0x1800; if (this->height.HALF.HI < 1) { draw = this->spriteSettings.b.draw; @@ -347,7 +347,7 @@ void sub_08031EE8(Entity* this) { if (draw == 1) GetNextFrame(this); - if (this->field_0x20 < 1) { + if (this->hVelocity < 1) { this->action = 2; this->flags |= 0x80; InitializeAnimation(this, 5); @@ -450,7 +450,7 @@ void sub_08032160(Entity* this) { this->spriteSettings.b.flipX = 0; } this->speed = 0xf0; - this->field_0x20 = 0x12000; + this->hVelocity = 0x12000; this->spritePriority.b1 = 1; InitializeAnimation(this, 12); } diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 8ce4858b..15535172 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -48,7 +48,7 @@ void sub_08021780(Entity* this) { } if (this->currentHealth == 0) - this->field_0x42 = 0; + this->knockbackDuration = 0; sub_0804AA30(this, gUnk_080CB590); } @@ -105,7 +105,7 @@ void sub_080218CC(Entity* this) { this->spriteSettings.b.draw = 1; this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; this->speed = 0x100; - this->field_0x20 = 0x12000; + this->hVelocity = 0x12000; } GetNextFrame(this); @@ -216,7 +216,7 @@ void sub_08021AD8(Entity* this) { } void sub_08021B64(Entity* this) { - if (gPlayerState.flags.all & 4) { + if (gPlayerState.flags & 4) { this->action = 3; this->height.WORD = 0; InitializeAnimation(this, 2); @@ -233,12 +233,12 @@ void sub_08021B64(Entity* this) { this->actionDelay = (u8)iVar4; } - if (gPlayerState.flags.all & 0x110) + if (gPlayerState.flags & 0x110) iVar4 = 0; if (iVar4 == 0) { this->action = 6; - this->field_0x20 = 0x10000; + this->hVelocity = 0x10000; ((u8*)&this->field_0x86)[1] = 0; if (gPlayerEntity.direction != 0xff) { this->direction = 0x10 ^ gPlayerEntity.direction; @@ -299,7 +299,7 @@ u32 sub_08021D00(Entity* this) { } else { this->action = 4; this->actionDelay = 1; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; InitializeAnimation(this, 4); ret = 1; } diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 77bf64da..67bb138b 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -30,8 +30,8 @@ void sub_0802C688(Entity* this) { case 0: case 1: if (this->field_0x82.HALF.LO) { - this->field_0x42 = 0; - gPlayerEntity.field_0x42 = 4; + this->knockbackDuration = 0; + gPlayerEntity.knockbackDuration = 4; } return; case 0xe: @@ -39,7 +39,7 @@ void sub_0802C688(Entity* this) { case 0x15: case 0x16: this->action = 3; - this->field_0x42 = 0; + this->knockbackDuration = 0; sub_0802CBC4(this); return; } @@ -54,7 +54,7 @@ void sub_0802C688(Entity* this) { this->action = 3; this->damageType = 0x6e; this->field_0xf = 1; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->speed = 0; this->field_0x80.HALF.HI = 1; InitializeAnimation(this, this->direction >> 4 | 6); @@ -72,7 +72,7 @@ void sub_0802C7AC(Entity* this) { if (this->field_0x82.HALF.LO != 2) { this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80; } - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; } else { @@ -225,7 +225,7 @@ void sub_0802CA94(Entity* this) { this->flags &= ~0x80; this->field_0xf = 1; this->spritePriority.b1 = 1; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->speed = 0; this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index e096feda..d5220c6d 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -381,7 +381,7 @@ void sub_0802ADDC(Entity* this) { void sub_0802AE24(Entity* this) { this->action = 1; this->actionDelay = 0xf0; - this->field_0x20 = 0x8000; + this->hVelocity = 0x8000; this->hitbox = (Hitbox*)&gUnk_080CD174; this->field_0x3c = 3; this->field_0x16 = 0; diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 3d592781..989c6bea 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -6,6 +6,7 @@ #include "random.h" #include "npc.h" #include "functions.h" +#include "effects.h" extern void sub_0801D040(Entity*, u32); extern Entity* sub_08049DF4(u32); @@ -60,7 +61,7 @@ void sub_08028934(Entity* this) { this->actionDelay = 0x28; this->flags &= ~0x80; sub_080290E0(this, 4); - pEVar1 = CreateFx(this, 3, 0); + pEVar1 = CreateFx(this, FX_BUSH, 0); if (pEVar1 != NULL) { pEVar1->height.HALF.HI -= 8; } @@ -245,11 +246,11 @@ void sub_08028CE8(Entity* this) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; u32 subtype; - if ((gTextBox.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) { + if ((gMessage.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) { if (offer->price <= gSave.stats.rupees) { if (sub_080291DC(this)) { /* Bag full. */ - TextboxNoOverlapFollow(0x2904); + MessageFromTarget(0x2904); sub_08078A90(0); } else { ModRupees(-offer->price); @@ -284,7 +285,7 @@ void sub_08028CE8(Entity* this) { } } else { /* Not enough money. */ - TextboxNoOverlapFollow(0x2903); + MessageFromTarget(0x2903); sub_08078A90(0); } } @@ -302,7 +303,7 @@ void sub_08028DE8(Entity* this) { this->field_0x80.HALF.HI = 1; } } else { - TextboxNoOverlapFollow(0x2902); + MessageFromTarget(0x2902); this->action = 4; this->field_0x80.HALF.HI = 0; this->actionDelay = 1; @@ -314,11 +315,11 @@ void sub_08028DE8(Entity* this) { } void sub_08028E40(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; this->action = 4; - this->subAction = gTextBox.doTextBox & 0x7f; + this->subAction = gMessage.doTextBox & 0x7f; this->actionDelay = 1; if (CheckLocalFlag(offer->field_0xa) == 0) { SetLocalFlag(offer->field_0xa); @@ -382,8 +383,8 @@ void sub_08028F0C(Entity* this) { dialog = offer->field_0x4; sub_08078A90(1); } - TextboxNoOverlapFollow(dialog); - gTextBox.field_0x10 = offer->price; + MessageFromTarget(dialog); + gMessage.field_0x10 = offer->price; } } diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 7c891a9f..56e23b75 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -117,7 +117,7 @@ void sub_0801EF40(Entity* this) { } } else { sub_0804AA1C(this); - this->field_0x20 = 0; + this->hVelocity = 0; InitializeAnimation(this, 9); } this->field_0x80.HALF.LO = this->currentHealth; @@ -698,7 +698,7 @@ void sub_0801FB68(Entity* this) { break; } - this->field_0x20 = 0; + this->hVelocity = 0; } u32 sub_0801FBD0(Entity* this) { @@ -711,7 +711,7 @@ u32 sub_0801FBD0(Entity* this) { void Chuchu_JumpAtPlayer(Entity* this) { this->speed = 0x180; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; this->direction = sub_08049F84(this, 1); InitializeAnimation(this, 3); } diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index 683ba4b8..2ae41b08 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -49,7 +49,7 @@ void sub_08022988(Entity* this) { return; this->frameIndex = 1; - this->field_0x20 = 0x10000; + this->hVelocity = 0x10000; EnqueueSFX(0xd6); } @@ -75,7 +75,7 @@ void sub_080229F8(Entity* this) { this->speed = 0xc0; sub_08022B44(this); } else { - this->field_0x20 = 0x10000; + this->hVelocity = 0x10000; EnqueueSFX(0xd6); } } @@ -138,7 +138,7 @@ u32 sub_08022B20(Entity* this) { } void sub_08022B44(Entity* this) { - this->field_0x20 = 0xc000; + this->hVelocity = 0xc000; this->direction = GetFacingDirection(this, &gPlayerEntity); if (this->direction & 0xf) diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index 4ede2e2d..d28e3b15 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -64,7 +64,7 @@ void sub_08020BB8(Entity* this) { this->action = 11; this->actionDelay = gUnk_080CAB0C[this->type]; this->damageType = 81; - sub_08021218(this, 8, DirectionToAnimationState(this->field_0x3e ^ 0x10)); + sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10)); sub_08021588(this); sub_0804A9FC(this, 0x1c); break; @@ -72,7 +72,7 @@ void sub_08020BB8(Entity* this) { this->action = 11; this->actionDelay = gUnk_080CAB10[this->type]; this->damageType = 81; - sub_08021218(this, 8, DirectionToAnimationState(this->field_0x3e ^ 0x10)); + sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10)); sub_08021588(this); sub_0804A9FC(this, 0x1c); break; diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index 2bfc1fc4..c3fd44ee 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -1,10 +1,10 @@ #include "enemy.h" #include "entity.h" #include "functions.h" +#include "effects.h" extern s16 sub_080001DA(u32, u32); // ? extern void sub_08049CF4(); -extern u32 CheckPlayerProximity(u32, u32, u32, u32); void sub_080221C0(); typedef struct { @@ -37,7 +37,7 @@ void sub_08021FF4(Entity* this) { void sub_08022004(Entity* this) { SetTile((u16)this->field_0x7c.HALF.LO, (u16)this->field_0x7c.HALF.HI, this->collisionLayer); - CreateFx(this, 5, 0); + CreateFx(this, FX_POT_SHATTER, 0); sub_08049CF4(this); DeleteThisEntity(); } @@ -80,7 +80,7 @@ void sub_080220F0(Entity* this) { this->field_0x44 = 0; off = gUnk_080CB76C[this->type2]; for (i = 0; i < 6; i++, off++) { - Entity* fx = CreateFx(this, 0x11, 0); + Entity* fx = CreateFx(this, FX_DASH, 0); if (fx) { fx->x.HALF.HI += off->h; fx->y.HALF.HI += off->v; diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 74135810..29446667 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -1,6 +1,7 @@ #include "enemy.h" #include "random.h" #include "functions.h" +#include "effects.h" void sub_0802C4B0(Entity*); void sub_0802C62C(Entity*); @@ -31,7 +32,7 @@ void sub_0802C254(Entity* this) { void sub_0802C258(Entity* this) { sub_0804A720(this); - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; this->actionDelay = 2; this->field_0x7a.HWORD = Random() & 0x70; switch (this->type) { @@ -92,7 +93,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E u32 diff = 0; s32 i; for (i = 1; i > -1; i--) { - Entity* ent = CreateFx(this, 0x15, 0); + Entity* ent = CreateFx(this, FX_ROCK2, 0); if (ent) { ent->x.HALF.HI += 12; ent->x.HALF.HI -= diff; @@ -189,7 +190,7 @@ void sub_0802C4B0(Entity* this) { } rand = Random() & 7; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; if (rand & 4) { if (rand & 3) { *(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 1]; diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index f7851aad..2103e19f 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -3,6 +3,7 @@ #include "enemy.h" #include "random.h" #include "functions.h" +#include "effects.h" typedef struct { s8 h, v; @@ -88,7 +89,7 @@ void sub_08045454(Entity* this) { off++; } - ent = CreateFx(this, 2, 0); + ent = CreateFx(this, FX_DEATH, 0); if (ent) CopyPosition(this, ent); @@ -100,7 +101,7 @@ u32 sub_0804A024(Entity*, u32, u32); void sub_08045524(Entity* this) { u32 tmp, tmp1, tmp2; - this->field_0x20 = 0x1c000; + this->hVelocity = 0x1c000; tmp = sub_0804A024(this, 1, 8); if (tmp != 0xff && (Random() & 3) == 0) { this->actionDelay = Random() & 3; diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 7f6d04e6..d1773a7d 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -58,7 +58,7 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th } else { if ((u8)(this->action - 1) < 2) { this->action = 1; - x = DirectionTurnAround(this->field_0x3e); + x = DirectionTurnAround(this->knockbackDirection); this->direction = x; this->animationState = x >> 3; InitAnimationForceUpdate(this, this->animationState); @@ -342,19 +342,19 @@ void sub_08037A58(Entity* this) { this->damageType = 0x26; this->flags2 |= 1; this->iframes = 0xf4; - this->field_0x3e = (this->animationState << 3) ^ 0x10; - this->field_0x42 = 8; + this->knockbackDirection = DirectionFromAnimationState(this->animationState) ^ 0x10; + this->knockbackDuration = 8; this->field_0x46 = 0x180; this->field_0x76.HALF.LO = 0x3c; InitAnimationForceUpdate(this, this->animationState + 0x10); } void sub_08037ACC(Entity* this) { - gPlayerState.flags.all &= 0xFFFFFEFF; + gPlayerState.flags &= 0xFFFFFEFF; gPlayerEntity.flags |= 0x80; gPlayerEntity.iframes = 0x1e; - gPlayerEntity.field_0x3e = DirectionFromAnimationState(this->animationState); - gPlayerEntity.field_0x42 = 4; + gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState); + gPlayerEntity.knockbackDuration = 4; gPlayerEntity.field_0x46 = 0x180; } // Damage player maybe? diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index effceb3b..7aaa2153 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -6,6 +6,7 @@ #include "fileScreen.h" #include "random.h" #include "functions.h" +#include "effects.h" void (*const gUnk_080D1AFC[8])(Entity*); void (*const gUnk_080D1B1C[7])(Entity*); @@ -935,7 +936,7 @@ void sub_08047BF0(Entity* this) { sub_08047E48(this); if (this->actionDelay == 0) { if ((this->field_0xf++ & 0xF) == 0) { - tmp = CreateFx(this, 0x51, 0); + tmp = CreateFx(this, FX_GIANT_EXPLOSION4, 0); if (tmp) { u32 rand = Random(); tmp->x.HALF.HI += (rand & 0x1E) + 0xFFF1; @@ -960,17 +961,17 @@ void sub_08047BF0(Entity* this) { if (this->actionDelay == 0x5A) { tmp = this->attachedEntity; tmp->spriteSettings.b.draw = 0; - CreateFx(tmp, 0x51, 0); + CreateFx(tmp, FX_GIANT_EXPLOSION4, 0); } else { if (this->actionDelay == 0x3C) { tmp = this->attachedEntity->attachedEntity; tmp->spriteSettings.b.draw = 0; - CreateFx(tmp, 0x51, 0); + CreateFx(tmp, FX_GIANT_EXPLOSION4, 0); } else { if (this->actionDelay == 0x1E) { tmp = this->attachedEntity->attachedEntity->attachedEntity; tmp->spriteSettings.b.draw = 0; - CreateFx(tmp, 0x51, 0); + CreateFx(tmp, FX_GIANT_EXPLOSION4, 0); } } } diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index fe6fe0fc..95593f7b 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -1,6 +1,7 @@ #include "entity.h" #include "enemy.h" #include "functions.h" +#include "effects.h" extern void (*const gHangingSeedFunctions[])(Entity*); extern void (*const gUnk_080CB588[])(Entity*); @@ -15,7 +16,7 @@ void HangingSeed_OnTick(Entity* this) { void sub_080216FC(Entity* this) { if (this->bitfield & 0x80) { - CreateFx(this, 3, 0x80); + CreateFx(this, FX_BUSH, 0x80); DeleteThisEntity(); } } diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 169f9db2..41f0ed85 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -48,7 +48,7 @@ void sub_0802BBC4(Entity* this) { case 2: case 3: if (this->action == 4) { - this->field_0x42 = 0; + this->knockbackDuration = 0; sub_0802C218(this); } break; @@ -89,7 +89,7 @@ void sub_0802BCA8(Entity* this) { this->action = 7; this->actionDelay = 0x5a; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->damageType = 0x19; this->field_0x3a = this->field_0x3a & 0xfb; this->field_0x1c = 0x12; @@ -369,7 +369,7 @@ void sub_0802C1CC(Entity* this) { void sub_0802C218(Entity* this) { this->action = 6; this->speed = 0xe0; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; } // clang-format off diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index df748792..1b4f20c0 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -3,6 +3,7 @@ #include "enemy.h" #include "random.h" #include "functions.h" +#include "effects.h" extern Entity* gUnk_020000B0; @@ -39,7 +40,7 @@ void sub_080323F4(Entity* this) { if (this->action != 3 && this->action != 4) { this->action = 3; this->actionDelay = 0xC; - this->direction = DirectionTurnAround(this->field_0x3e); + this->direction = DirectionTurnAround(this->knockbackDirection); InitAnimationForceUpdate(this, this->direction >> 3); } else if (this->bitfield == 0xCC) { if (this->field_0x43 == 0) { @@ -222,7 +223,7 @@ void sub_08032794(Entity* this) { Entity* target; s8* temp; - target = CreateFx(this, 0x11, 0x40); + target = CreateFx(this, FX_DASH, 0x40); if (target != NULL) { temp = &gUnk_080CE810[this->animationState * 2]; PositionRelative(this, target, temp[0] << 0x10, temp[1] << 0x10); diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index d97bec40..1353d489 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -5,6 +5,7 @@ #include "coord.h" #include "random.h" #include "player.h" +#include "effects.h" extern void (*const LakituActionFuncs[])(Entity*); @@ -56,15 +57,15 @@ void Lakitu_DoAction(Entity* this) { void sub_0803C784(Entity* this) { if ((this->bitfield & 0x7f) == 0x1d) { - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; sub_0803CBAC(this); } else { if (this->damageType == 0x43) { - Entity* fx = CreateFx(this, 2, 0); + Entity* fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { - u32 angle = (this->field_0x3e ^ 0x10) << 3; + u32 angle = (this->knockbackDirection ^ 0x10) << 3; s32 sine; sine = gSineTable[angle]; @@ -352,7 +353,7 @@ void sub_0803CC08(Entity* this) { return; } - if (this->field_0x20 >= 0) { + if (this->hVelocity >= 0) { return; } @@ -360,25 +361,25 @@ void sub_0803CC08(Entity* this) { return; } - fx = CreateFx(this, 2, 0); + fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI += 6; fx->y.HALF.HI += 6; } - fx = CreateFx(this, 2, 0); + fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI -= 6; fx->y.HALF.HI += 6; } - fx = CreateFx(this, 2, 0); + fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI += 6; fx->y.HALF.HI -= 6; } - fx = CreateFx(this, 2, 0); + fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI -= 6; fx->y.HALF.HI -= 6; diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 5ce140c5..b7301df7 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -2,6 +2,7 @@ #include "entity.h" #include "player.h" #include "functions.h" +#include "effects.h" extern u32 GetNextFunction(Entity*); @@ -24,7 +25,7 @@ void sub_0803CCD4(Entity* this) { } void sub_0803CCEC(Entity* this) { - this->field_0x42 = 0; + this->knockbackDuration = 0; sub_0803CCD4(this); } @@ -126,7 +127,7 @@ void sub_0803CE14(Entity* this) { } void sub_0803CE3C(Entity* this) { - CreateFx(this, 2, 0); + CreateFx(this, FX_DEATH, 0); this->action = 2; this->actionDelay = 60; diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index b6a5988f..70f5ea3f 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -6,7 +6,7 @@ #include "createObject.h" #include "functions.h" -extern bool32 sub_080544B4(u32); +extern bool32 ItemIsShield(u32); void sub_0802810C(Entity*); void sub_080281A0(Entity*); @@ -207,9 +207,9 @@ void sub_0802805C(Entity* this) { NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* this)) { gPlayerState.jumpStatus = 0x41; gPlayerState.field_0xa = 0; - gPlayerState.flags.all &= 0xffffffef; + gPlayerState.flags &= 0xffffffef; gPlayerEntity.flags |= 0x80; - gPlayerEntity.field_0x20 = 0x18000; + gPlayerEntity.hVelocity = 0x18000; gPlayerEntity.iframes = -60; gPlayerEntity.direction = gPlayerEntity.animationState << 2; gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI; @@ -229,10 +229,10 @@ void sub_080281A0(Entity* this) { this->field_0xf = 0x19; if (sub_080281E0(0xe)) { this->field_0x80.HALF.LO = 0xe; - TextboxNoOverlapFollow(0x578); + MessageFromTarget(0x578); } else if (sub_080281E0(0xd)) { this->field_0x80.HALF.LO = 0xd; - TextboxNoOverlapFollow(0x578); + MessageFromTarget(0x578); } else { ModHealth(-1); } @@ -241,11 +241,11 @@ void sub_080281A0(Entity* this) { bool32 sub_080281E0(u32 param_1) { bool32 ret = FALSE; if (GetInventoryValue(param_1) == 1) { - if (sub_080544B4(gSave.stats.itemOnA)) { + if (ItemIsShield(gSave.stats.itemOnA)) { gSave.stats.itemOnA = 0; } - if (sub_080544B4(gSave.stats.itemOnB)) { + if (ItemIsShield(gSave.stats.itemOnB)) { gSave.stats.itemOnB = 0; } @@ -262,7 +262,7 @@ void sub_08028224(u32 param_1) { #else sub_080A7C18(param_1, 0, 1); #endif - TextboxNoOverlapFollow(0x579); + MessageFromTarget(0x579); } void (*const gUnk_080CC6FC[])(Entity*) = { diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 7d1fa2ee..513848d9 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -2,6 +2,7 @@ #include "entity.h" #include "random.h" #include "functions.h" +#include "effects.h" extern u8 gEntCount; extern Hitbox gUnk_080FD298; @@ -163,7 +164,7 @@ void sub_08029B2C(Entity* this) { if (sub_0802A14C(this)) { if (this->field_0x86.HALF.LO) { if (--this->actionDelay == 0) { - CreateFx(this, 0x48, 0); + CreateFx(this, FX_GIANT_EXPLOSION3, 0); DeleteEntity(this); } } else { @@ -241,7 +242,7 @@ void sub_08029C6C(Entity* this) { void sub_08029C98(Entity* this) { if (sub_0802A14C(this)) { - CreateFx(this, 0x48, 0); + CreateFx(this, FX_GIANT_EXPLOSION3, 0); DeleteEntity(this); } else { gUnk_080CCDA8[this->action](this); diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index be47d87f..96ded54d 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -4,6 +4,7 @@ #include "random.h" #include "object.h" #include "functions.h" +#include "effects.h" void sub_0803B538(Entity*); u32 sub_0803B4E4(Entity*); @@ -915,7 +916,7 @@ void sub_0803B100(Entity* this) { Entity* temp; this->action = 0x29; - this->field_0x20 = 0x14000; + this->hVelocity = 0x14000; if (this->type == 0) { this->hitbox = &gUnk_080FD364; } else { @@ -962,7 +963,7 @@ void sub_0803B1B8(Entity* this) { this->field_0x7c.HALF.HI = 0x5dc; this->spriteSettings.b.draw = 0; this->damageType = 0x14; - temp = CreateFx(this, 0x51, 0); + temp = CreateFx(this, FX_GIANT_EXPLOSION4, 0); if (temp != (Entity*)0x0) { temp->x.HALF.HI += this->hitbox->offset_x; temp->y.HALF.HI += this->hitbox->offset_y; @@ -981,7 +982,7 @@ void sub_0803B1B8(Entity* this) { if ((temp->field_0x80.HALF.LO & 0xc) == 0xc) { temp->action = 0xb; temp->actionDelay = 0x78; - temp->field_0x20 = 0; + temp->hVelocity = 0; (*(Entity**)&temp->field_0x74)->field_0x7c.HALF_U.HI = 0x708; (*(Entity**)&temp->field_0x78)->field_0x7c.HALF_U.HI = 0x708; } @@ -1226,9 +1227,9 @@ void sub_0803B724(Entity* param_1) { void sub_0803B798(void) { gPlayerState.jumpStatus = 0x41; gPlayerState.field_0xa = 0; - gPlayerState.flags.all &= 0xffef; + gPlayerState.flags &= 0xffef; gPlayerEntity.flags |= 0x80; - gPlayerEntity.field_0x20 = 0x18000; + gPlayerEntity.hVelocity = 0x18000; gPlayerEntity.height.HALF.HI = -10; gPlayerEntity.direction = 0x10; gPlayerEntity.animationState = 4; @@ -1256,7 +1257,7 @@ u32 sub_0803B870(Entity* this) { Entity* entity; entity = this->attachedEntity; - if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags.all & 0x10) != 0) { + if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & 0x10) != 0) { this->action = 0x18; this->actionDelay = 0x44; this->spriteSettings.b.draw = 0; diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index bfa45e69..a4b000e8 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -6,6 +6,7 @@ #include "random.h" #include "object.h" #include "functions.h" +#include "effects.h" extern void UnloadOBJPalette(Entity*); @@ -78,7 +79,7 @@ void (*const gUnk_080CECB4[])(Entity*) = { }; const u8 gUnk_080CECEC[] = { 0xff, 0xfe, 0xff, 0x00, 0x01, 0x02, 0x01, 0x00 }; const s8 gUnk_080CECF4[] = { -2, 0x01, -8, -4, -0x14, 0x08, 0x0e, -0x10, -6, 0x0c, 0x12, -2, 0x00, 0x00 }; -const u8 gUnk_080CED02[] = { 0x46, 0x46, 0x47, 0x48 }; +const u8 gUnk_080CED02[] = { FX_GIANT_EXPLOSION, FX_GIANT_EXPLOSION, FX_GIANT_EXPLOSION2, FX_GIANT_EXPLOSION3 }; const u8 gUnk_080CED06[] = { 0xff, 0x00, 0x01, 0x00, 0x00, 0x00 }; void (*const gUnk_080CED0C[])(Entity*) = { sub_08034578, sub_080344E0, sub_0803451C, sub_080344E0, sub_08034558, sub_080344E0, sub_0803451C, sub_080346A0, @@ -815,7 +816,7 @@ void sub_08034BC8(Entity* this) { } void sub_08034C00(Entity* this) { - if (((gPlayerState.flags.all & 0x80) != 0) && + if (((gPlayerState.flags & 0x80) != 0) && CheckPlayerInRegion(this->x.HALF.HI - gRoomControls.roomOriginX, this->y.HALF.HI - gRoomControls.roomOriginY + 0xd, 3, 3) != 0) { if (gScreenTransition.field_0x39 >= 0x3d) { diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index 0e32a810..e9cf7191 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -5,6 +5,7 @@ #include "script.h" #include "structures.h" #include "functions.h" +#include "effects.h" extern void sub_0807B600(u32); @@ -43,7 +44,7 @@ void (*const gUnk_080CEEB0[])(Entity*) = { sub_08034E30, sub_08034E68, sub_08034EC0, sub_08034ED8, sub_08034EE4, sub_08034F58, }; -const u8 gUnk_080CEEC8[] = { 0x46, 0x46, 0x47, 0x48 }; +const u8 gUnk_080CEEC8[] = { FX_GIANT_EXPLOSION, FX_GIANT_EXPLOSION, FX_GIANT_EXPLOSION2, FX_GIANT_EXPLOSION3 }; const u8 gUnk_080CEECC[] = { 0x58, 0x68, 0x88, 0x68, 0xb8, 0x68, 0x58, 0xa8, 0x88, 0xa8, 0xb8, 0xa8 }; const s16 gUnk_080CEED8[] = { -0x82, -0x81, -0x80, -0x7f, -0x7e, -0x42, -0x41, -0x40, -0x3f, -0x3e, -2, -1, 1, 2, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x7e, 0x7f, 0x80, 0x81, 0x82 }; @@ -113,7 +114,7 @@ void sub_08034D4C(Entity* this) { void sub_08034DC8(Entity* this) { if (gScreenTransition.field_0x39 == 0) { - CreateFx(this, 0x51, 0); + CreateFx(this, FX_GIANT_EXPLOSION4, 0); sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer); DeleteThisEntity(); } diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c index 3210aeeb..930ed8f0 100644 --- a/src/enemy/miniFireballGuy.c +++ b/src/enemy/miniFireballGuy.c @@ -53,7 +53,7 @@ void sub_08045654(Entity* this) { void sub_08045678(Entity* this) { - this->field_0x20 = 0x1c000; + this->hVelocity = 0x1c000; if (this->actionDelay != 0) { this->actionDelay--; } else { diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index 2fc1f67f..1ee92567 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -36,7 +36,7 @@ void sub_08022BEC(Entity* this) { this->field_0x7a.HALF.LO = this->currentHealth; this->actionDelay = 1; - this->direction = this->field_0x3e; + this->direction = this->knockbackDirection; this->animationState = ((this->direction + 2) & 0x1c) >> 2; this->frameIndex = this->animationState; diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index cb27ab6d..88ad48bf 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -2,6 +2,7 @@ #include "entity.h" #include "random.h" #include "functions.h" +#include "effects.h" extern void sub_0800449C(Entity*, u32); extern bool32 sub_08023A38(u32); @@ -83,11 +84,11 @@ void sub_080230E4(Entity* this) { CopyPosition(this, &gPlayerEntity); gPlayerEntity.flags = gPlayerEntity.flags | 0x80; gPlayerEntity.spriteSettings.b.draw = 1; - gPlayerEntity.field_0x20 = 0x18000; + gPlayerEntity.hVelocity = 0x18000; gPlayerEntity.direction = 0xff; gPlayerEntity.iframes = -0x14; gPlayerState.jumpStatus = 0x41; - gPlayerState.flags.all &= 0xfff7ffff; + gPlayerState.flags &= 0xfff7ffff; } sub_0804AA30(this, gUnk_080CBC38); @@ -177,7 +178,7 @@ void sub_08023330(Entity* this) { this->field_0x7c.BYTES.byte3 = 0; sub_08023A88(this, this->animationState); CopyPosition(this, this->attachedEntity); - CreateFx(this, 4, 0); + CreateFx(this, FX_ROCK, 0); } } @@ -199,7 +200,7 @@ void sub_08023398(Entity* this) { this->damageType = 0x85; this->attachedEntity->actionDelay = 1; sub_08023A68(this); - CreateFx(this, 4, 0); + CreateFx(this, FX_ROCK, 0); return; } this->field_0x78.HWORD = 0x28; @@ -265,7 +266,7 @@ void sub_0802351C(Entity* this) { if (this->field_0x7c.BYTES.byte3 == 0) { if (this->type2 == 0) { gPlayerEntity.animationState = this->animationState & 7; - gPlayerState.flags.all |= 0x80000; + gPlayerState.flags |= 0x80000; PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10); gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7]; } @@ -400,7 +401,7 @@ void sub_08023894(Entity* this) { this->parent->field_0x7c.BYTES.byte3 = 1; InitializeAnimation(this, this->animationState); if (this->parent->type2 == 0) { - gPlayerState.flags.all |= 0x200000; + gPlayerState.flags |= 0x200000; gPlayerEntity.x.HALF.HI = this->x.HALF.HI; gPlayerEntity.y.HALF.HI = this->y.HALF.HI; gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(*(Entity**)&this->field_0x74, this)); diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index adcbea9d..9a96a72d 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -234,7 +234,7 @@ void Peahat_Stunned(Entity* this) { } if (this->direction == 0xff) - this->direction = this->field_0x3e; + this->direction = this->knockbackDirection; ProcessMovement(this); GetNextFrame(this); @@ -260,7 +260,7 @@ void Peahat_RepairPropeller(Entity* this) { return; this->action = 9; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->direction = Random() & 0x1f; sub_0804AA1C(this); this->animationState = PeahatAnimation_RepairPropeller; @@ -286,7 +286,7 @@ void Peahat_Hop(Entity* this) { if (--this->actionDelay == 0) { if (this->frames.all & 0x80) { this->action = 9; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->animationState = PeahatAnimation_NewPropeller; InitializeAnimation(this, this->animationState); } else { diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 698edc94..b8247e34 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -395,7 +395,7 @@ void sub_080244E8(Entity* this) { sub_080249DC(this); this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1; gPlayerEntity.flags &= 0x7f; - gPlayerState.flags.all |= 0x100; + gPlayerState.flags |= 0x100; gPlayerState.field_0xa |= 0x80; if (gPlayerState.swimState != 0) { gPlayerState.swimState = 0; @@ -809,7 +809,7 @@ NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* th Entity* player = &gPlayerEntity; ResetPlayer(); - gPlayerState.flags.all |= 0x100; + gPlayerState.flags |= 0x100; gPlayerState.field_0xa |= 0x80; gPlayerState.playerAction = 0xe; gPlayerState.field_0x38 = 0x14; @@ -832,7 +832,7 @@ END_NONMATCH void sub_08024F50(Entity* this) { gPlayerState.field_0xa = 0; - gPlayerState.flags.all &= 0xfffffeff; + gPlayerState.flags &= 0xfffffeff; CopyPosition(this, &gPlayerEntity); gPlayerEntity.action = 1; gPlayerEntity.flags |= 0x80; diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index c3b02ae4..4225a61f 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -3,6 +3,7 @@ #include "random.h" #include "object.h" #include "functions.h" +#include "effects.h" extern u32 sub_080002E0(u32, u32); extern u32 sub_080002C8(u16, u8); @@ -71,11 +72,11 @@ void sub_08025020(Entity* this) { } this->action = 7; this->actionDelay = 0x3c; - if (0 < this->field_0x20) { - this->field_0x20 = 0; + if (0 < this->hVelocity) { + this->hVelocity = 0; } this->iframes = -0xc; - this->field_0x42 = 0; + this->knockbackDuration = 0; if (this->field_0x80.HALF.LO == 0) { this->animationState = (*(Entity**)&this->field_0x4c)->direction >> 3; InitializeAnimation(this, this->animationState + 4); @@ -199,7 +200,7 @@ void sub_080252E0(Entity* this) { this->action = 3; this->actionDelay = 0x1e; this->field_0xf = 0; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; InitializeAnimation(this, 1); } } @@ -212,7 +213,7 @@ void sub_0802538C(Entity* this) { GetNextFrame(this); } else { sub_08003FC4(this, 0x2000); - if (this->field_0x20 < 0x2000) { + if (this->hVelocity < 0x2000) { this->action = 4; InitializeAnimation(this, 2); } @@ -241,7 +242,7 @@ void sub_0802541C(Entity* this) { if (this->frames.all & 0x80) { this->action = 3; this->field_0xf = 1; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; InitializeAnimation(this, 1); } } @@ -520,12 +521,12 @@ bool32 sub_08025AB8(u32 tile, u32 layer) { void sub_08025AE8(Entity* this) { Entity* ent; - ent = CreateFx(this, 0x22, 0); + ent = CreateFx(this, FX_BROWN_SMOKE, 0); if (ent) { ent->y.WORD--; } - ent = CreateFx(this, 0x23, 0); + ent = CreateFx(this, FX_BROWN_SMOKE_LARGE, 0); if (ent) { ent->y.WORD++; } diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index c7b0dbe1..e4f2bf30 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -2,6 +2,7 @@ #include "entity.h" #include "random.h" #include "functions.h" +#include "effects.h" extern void sub_0804A4E4(Entity*, Entity*); @@ -40,7 +41,7 @@ void sub_08022254(Entity* this) { break; case 0x16: case 0x1c: - CreateFx(this, 4, 0); + CreateFx(this, FX_ROCK, 0); ent = CreateEnemy(CHUCHU, 1); if (ent) { ent->type2 = 1; @@ -51,7 +52,7 @@ void sub_08022254(Entity* this) { this->action = 2; this->flags &= ~0x80; this->spriteSettings.b.draw = 0; - this->direction = this->field_0x3e; + this->direction = this->knockbackDirection; this->attachedEntity = ent; } } @@ -101,8 +102,8 @@ void sub_080223E4(Entity* this) { ent->bitfield = 0x94; ent->iframes = 0x10; #ifndef EU - ent->field_0x42 = 0xc; - ent->field_0x3e = this->direction; + ent->knockbackDuration = 0xc; + ent->knockbackDirection = this->direction; #endif } diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index 0e6ee1bb..cafa618d 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -32,7 +32,7 @@ void Rollobite_OnTick(Entity* this) { void sub_08020668(Entity* this) { if (this->damageType == 34 && this->currentHealth != 0xff) { this->action = 4; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; this->direction = 0xff; this->currentHealth = 0xff; this->damageType = 35; @@ -54,11 +54,11 @@ void sub_08020668(Entity* this) { void sub_080206E0(Entity* this) { if (Rollobite_TryToHoleUp(this)) { - this->field_0x42 = 0; + this->knockbackDuration = 0; } else if (Rollobite_IsRolledUp(this)) { - this->field_0x42--; - sub_080AE58C(this, this->field_0x3e, 10); - sub_080AE7E8(this, this->field_0x46, this->field_0x3e, 10); + this->knockbackDuration--; + sub_080AE58C(this, this->knockbackDirection, 10); + sub_080AE7E8(this, this->field_0x46, this->knockbackDirection, 10); } else { sub_08001324(this); } @@ -102,7 +102,7 @@ void sub_080207A8(Entity* this) { this->spritePriority.b0 = 4; this->field_0x3a &= 0xfb; this->direction ^= 0x10; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->speed = 0x80; InitializeAnimation(this, this->animationState + 0x10); } @@ -262,7 +262,7 @@ bool32 Rollobite_TryToHoleUp(Entity* this) { this->x.HALF.HI += 8; this->y.HALF.HI &= 0xfff0; this->y.HALF.HI += 13; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; InitializeAnimation(this, this->animationState + 0x14); SetTile(0x4034, tile, this->collisionLayer); return TRUE; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 0f29065a..fd72c272 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -231,9 +231,9 @@ void sub_080296C8(Entity* this) { void sub_080296D8(Entity* this) { gPlayerState.jumpStatus = 0x41; - gPlayerState.flags.all &= 0xffffffef; + gPlayerState.flags &= 0xffffffef; gPlayerEntity.flags |= 0x80; - gPlayerEntity.field_0x20 = 0x18000; + gPlayerEntity.hVelocity = 0x18000; gPlayerEntity.iframes = 0xa6; gPlayerEntity.height.HALF.HI = -2; gPlayerEntity.direction = gPlayerEntity.animationState << 2; diff --git a/src/enemy/slime.c b/src/enemy/slime.c index cd79f8f7..34f9cb55 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -4,6 +4,7 @@ #include "room.h" #include "random.h" #include "functions.h" +#include "effects.h" typedef struct { s8 h, v; @@ -115,7 +116,7 @@ void sub_080450A8(Entity* this) { off++; } - ent = CreateFx(this, 2, 0); + ent = CreateFx(this, FX_DEATH, 0); if (ent) CopyPosition(this, ent); diff --git a/src/enemy/spark.c b/src/enemy/spark.c index e11228e6..71e913c5 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -2,6 +2,7 @@ #include "entity.h" #include "object.h" #include "functions.h" +#include "effects.h" extern void (*const gUnk_080CD234[])(Entity*); extern void (*const gUnk_080CD24C[])(Entity*); @@ -23,7 +24,7 @@ void sub_0802B2E0(Entity* this) { this->iframes = 0; this->spriteSettings.b.draw = 0; this->action = 2; - ent = CreateFx(this, 2, 0); + ent = CreateFx(this, FX_DEATH, 0); if (ent) { this->attachedEntity = ent; this->actionDelay = 14; diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 68f52f04..34beba3a 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -2,6 +2,7 @@ #include "entity.h" #include "random.h" #include "functions.h" +#include "effects.h" extern bool32 sub_0806FC80(Entity*, Entity*, u32); extern Entity* sub_08049DF4(u32); @@ -224,7 +225,7 @@ void sub_08028528(Entity* this) { if ((this->actionDelay & 7) == 0) { EnqueueSFX(0xf0); - CreateFx(this, 2, 0x40); + CreateFx(this, FX_DEATH, 0x40); } if (++this->field_0x7a.HALF.HI == 0x80) { @@ -379,11 +380,11 @@ bool32 sub_080288A4(Entity* this) { void sub_080288C0(Entity* this) { Entity* ent = this->attachedEntity; if (ent && (ent->bitfield & 0x80)) { - this->field_0x3e = ent->field_0x3e; + this->knockbackDirection = ent->knockbackDirection; this->iframes = -ent->iframes; this->field_0x46 = ent->field_0x46; - this->field_0x42 = ent->field_0x42; - ent->field_0x42 = 0; + this->knockbackDuration = ent->knockbackDuration; + ent->knockbackDuration = 0; } } diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index 46c87653..4884f873 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -49,10 +49,10 @@ void sub_0802B628(Entity* this) { case 0x1d: if (this->action < 6) { this->action = 6; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->speed = 0xc0; - this->direction = this->field_0x3e; - this->field_0x42 = 0; + this->direction = this->knockbackDirection; + this->knockbackDuration = 0; this->iframes = -8; this->damageType = 100; InitializeAnimation(this, 9); @@ -166,7 +166,7 @@ void sub_0802B8E0(Entity* this) { } } else { this->action = 8; - this->field_0x20 = 0x10000; + this->hVelocity = 0x10000; this->speed = 0x60; this->damageType = 99; InitializeAnimation(this, this->animationState); diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index bd0ca141..5f928636 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -159,7 +159,7 @@ void sub_080226EC(Entity* this) { if (sub_080228F0(this)) { this->action = 6; - this->field_0x20 = 0x12000; + this->hVelocity = 0x12000; this->speed = 0x140; this->direction = GetFacingDirection(this, gUnk_020000B0); this->damageType = 0x5a; diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index ab5da752..0a2367bd 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -39,9 +39,9 @@ void sub_0802F150(Entity* this) { this->field_0xf = 0; *(u8*)&this->field_0x7c = 0; if (this->height.HALF.HI != 0) { - this->field_0x20 >>= 2; + this->hVelocity >>= 2; } else { - this->field_0x20 = 0; + this->hVelocity = 0; } InitializeAnimation(this, 0); break; @@ -95,7 +95,7 @@ void sub_0802F284(Entity* this) { this->action = 2; this->actionDelay = 0x10; this->field_0xf = this->type; - this->field_0x20 = this->field_0x82.HWORD << 4; + this->hVelocity = this->field_0x82.HWORD << 4; sub_0802F45C(this); InitializeAnimation(this, 2); } @@ -166,7 +166,7 @@ void sub_0802F3F4(Entity* this) { this->action = 2; this->actionDelay = 0x10; this->field_0xf = this->type; - this->field_0x20 = this->field_0x82.HWORD << 4; + this->hVelocity = this->field_0x82.HWORD << 4; (*(u8*)&this->field_0x7c.HALF.LO)++; sub_0802F45C(this); InitializeAnimation(this, 2); diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index 2567c463..f5b7103a 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -33,9 +33,9 @@ void sub_08037F00(Entity* this) { this->field_0xf = 0; this->field_0x80.HALF.LO = 0; if (this->height.HALF.HI != 0) { - this->field_0x20 >>= 2; + this->hVelocity >>= 2; } else { - this->field_0x20 = 0; + this->hVelocity = 0; } InitializeAnimation(this, 0); @@ -86,7 +86,7 @@ void sub_08037Fe0(Entity* this) { this->action = 2; this->actionDelay = 6; this->field_0xf = 0; - this->field_0x20 = 0x38000; + this->hVelocity = 0x38000; sub_08038168(this); InitializeAnimation(this, 2); } @@ -142,7 +142,7 @@ void sub_08038110(Entity* this) { if (this->field_0x80.HALF.LO < 5) { this->action = 2; this->actionDelay = 8; - this->field_0x20 = 0x38000; + this->hVelocity = 0x38000; sub_08038168(this); InitializeAnimation(this, 2); } else { diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index 66aa67c9..bd5d18f8 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -6,6 +6,7 @@ #include "random.h" #include "utils.h" #include "functions.h" +#include "effects.h" extern void DoExitTransition(ScreenTransitionData*); @@ -951,7 +952,7 @@ NONMATCH("asm/non_matching/vaati/sub_08043490.inc", void sub_08043490(Entity* th entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; if (entity->height.HALF.HI < -4) { - entity->field_0x20 = 0x18000; + entity->hVelocity = 0x18000; this->subAction = 2; this->field_0x7c.BYTES.byte2 = 0; ((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2; @@ -978,7 +979,7 @@ void sub_08043520(Entity* this) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; sub_08003FC4(entity, 0x1a00); - if ((entity->field_0x20 < 0) && (-6 < entity->height.HALF.HI)) { + if ((entity->hVelocity < 0) && (-6 < entity->height.HALF.HI)) { entity->height.HALF.HI = -6; this->subAction = 3; this->field_0x7a.HWORD = 900; @@ -1064,7 +1065,7 @@ static inline void deleteThing(Entity* this, const u32 index) { if (index == 1) { this->spriteSettings.b.draw = 0; } - CreateFx(((VaatiArm_HeapStruct*)this->myHeap)->entities[index], 0x51, 0); + CreateFx(((VaatiArm_HeapStruct*)this->myHeap)->entities[index], FX_GIANT_EXPLOSION4, 0); ((VaatiArm_HeapStruct*)this->myHeap)->entities[index]->myHeap = NULL; DeleteEntity(((VaatiArm_HeapStruct*)this->myHeap)->entities[index]); } @@ -1331,7 +1332,7 @@ void sub_08043D08(Entity* this) { entity->spriteSettings.b.draw = 0; InitializeAnimation(entity, 0x13); sub_0804AA1C(entity); - fx = CreateFx(entity, 0x51, 0); + fx = CreateFx(entity, FX_GIANT_EXPLOSION4, 0); if (fx != NULL) { fx->x.HALF.HI += gUnk_080D13E9[this->type2]; fx->y.HALF.HI -= 6; @@ -1351,7 +1352,7 @@ void sub_08043DB0(Entity* this) { Entity* pEVar3; Entity* pEVar4; - if (((gPlayerState.flags.all & 0x80) != 0)) { + if (((gPlayerState.flags & 0x80) != 0)) { pEVar3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.roomOriginX, pEVar3->y.HALF.HI - gRoomControls.roomOriginY + 2, 3, 3)) { diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index 1d77249e..a74de388 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -74,7 +74,7 @@ void VaatiProjectileFunction1(Entity* this) { entity->flags = entity->flags & 0x7f; } } else { - gPlayerState.flags.all &= 0xfffffeff; // using b.unk8 does not match + gPlayerState.flags &= 0xfffffeff; // using b.unk8 does not match entity = &gPlayerEntity; entity->flags = gPlayerEntity.flags | 0x80; } diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index 9df23058..f96527e9 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -6,6 +6,7 @@ #include "audio.h" #include "area.h" #include "functions.h" +#include "effects.h" extern void sub_080AEFB4(Entity*); extern u8 gEntCount; @@ -477,7 +478,7 @@ void VaatiRebornEnemyType0Action7(Entity* this) { SetRoomFlag(1); } else { if ((this->actionDelay & 7) == 0) { - fx = CreateFx(this, 2, 0); + fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { tmp = Random() & 0x3f3f; fx->x.HALF.HI = ((tmp & 0xff) - 0x20) + fx->x.HALF.HI; diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 399f511b..757d6544 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -5,6 +5,7 @@ #include "flags.h" #include "audio.h" #include "functions.h" +#include "effects.h" void sub_080409B0(Entity*); void sub_080408EC(Entity*); @@ -312,7 +313,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { if (this->actionDelay != 0) { if (--this->actionDelay == 0) { this->flags &= 0x7f; - this->field_0x20 = 0x38000; + this->hVelocity = 0x38000; this->field_0xf = 0x10; } break; @@ -378,7 +379,7 @@ void VaatiTransfiguredType0Action4(Entity* this) { this->field_0x74.HALF.LO = 0; this->actionDelay = 0x80; this->field_0xf = 0; - this->field_0x20 = 0x24000; + this->hVelocity = 0x24000; SoundReq(SFX_12B); } break; @@ -567,7 +568,7 @@ void VaatiTransfiguredType0Action7(Entity* this) { } this->field_0xf = (this->field_0xf + 1) & 7; if (this->field_0xf == 0) { - pEVar3 = CreateFx(this, 0x55, 0); + pEVar3 = CreateFx(this, FX_AURA_BASE, 0); if (pEVar3 != NULL) { uVar4 = Random() & 0x3f3f; pEVar3->x.HALF.HI += (uVar4 & 0xff) - 0x20; @@ -1060,7 +1061,7 @@ void sub_080409B0(Entity* this) { this->field_0x80.HALF.HI = 3; this->flags &= 0x7f; this->damageType = 0x36; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; SoundReq(SFX_164); } } @@ -1068,7 +1069,7 @@ void sub_080409B0(Entity* this) { } if (this->field_0x80.HALF.HI < 3) { - if (this->field_0x42 != 0) { + if (this->knockbackDuration != 0) { sub_080AF18C(this); } } else { diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index ab0bd34a..a4cf8999 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -93,8 +93,8 @@ void VaatiTransfiguredEyeFunction0Action0(Entity* this) { Entity* child; u8 bVar2; - bVar2 = gTextBox.doTextBox & 0x7f; - if ((gTextBox.doTextBox & 0x7f) == 0) { + bVar2 = gMessage.doTextBox & 0x7f; + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; this->spriteSettings.b.draw = 0; this->field_0x80.HALF.LO = bVar2; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 1beef337..08b5cb85 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -10,6 +10,7 @@ #include "structures.h" #include "functions.h" #include "save.h" +#include "effects.h" extern u8 gEntCount; @@ -455,7 +456,7 @@ void VaatiWrathType0ActionA(Entity* this) { this->subAction = 0; this->direction = 0; this->speed = 0x100; - this->field_0x20 = 0x12000; + this->hVelocity = 0x12000; sub_0801D2B4(this, 0x16b); InitAnimationForceUpdate(this, 5); type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; @@ -625,7 +626,7 @@ void sub_08041CD0(Entity* this) { } else { this->subAction = 2; this->actionDelay = 0x3c; - TextboxNoOverlapFollow(0x1651); + MessageFromTarget(0x1651); } } else { UpdateAnimationSingleFrame(this); @@ -636,7 +637,7 @@ void sub_08041D14(Entity* this) { Entity* pEVar1; GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { if (this->actionDelay != 0) { this->actionDelay--; } else { @@ -708,7 +709,7 @@ void sub_08041E78(Entity* this) { const s8* temp; if ((this->field_0xf & 0xf) == 0) { - fx = CreateFx(this, 0x51, 0); + fx = CreateFx(this, FX_GIANT_EXPLOSION4, 0); if (fx != NULL) { temp = &gUnk_080D0E90[this->field_0xf >> 3 & 0xe]; fx->x.HALF.HI += *temp++; diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c index 53434faa..2fd855f5 100644 --- a/src/enemy/vaatiWrathEye.c +++ b/src/enemy/vaatiWrathEye.c @@ -2,6 +2,7 @@ #include "audio.h" #include "structures.h" #include "functions.h" +#include "effects.h" void sub_080485D8(Entity*); void sub_080485FC(Entity*); @@ -158,7 +159,7 @@ void VaatiWrathEyeAction7(Entity* this) { this->actionDelay = 0x3c; this->flags &= 0x7f; this->spriteSettings.b.draw = 0; - CreateFx(this, 0x1f, 0x40); + CreateFx(this, FX_REFLECT2, 0x40); this->parent->field_0x7a.HALF.HI |= 0x10 << this->type; } else { if (--this->actionDelay != 0) { diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 663c3612..9a3ae8d2 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -37,9 +37,9 @@ void sub_0802A454(Entity* this) { } } - if (this->field_0x42) - if (this->field_0x42 > 4) - this->field_0x42 -= 4; + if (this->knockbackDuration != 0) + if (this->knockbackDuration > 4) + this->knockbackDuration -= 4; if (this->field_0x43 != 0) { sub_0804A9FC(this, 0x1c); diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index a0c79d74..26074c7d 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -118,7 +118,7 @@ void sub_0802CE68(Entity* this) { gPlayerState.field_0xa |= 0x80; gPlayerState.field_0x1a[0] |= 0x80; - gPlayerState.flags.all |= 0x100; + gPlayerState.flags |= 0x100; if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) { this->direction = GetFacingDirection(this, &gPlayerEntity); sub_0806F69C(this); diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index e469cd03..73fc59eb 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -22,7 +22,7 @@ void sub_0802A250(Entity* this) { this->action = 1; this->actionDelay = 0; - this->field_0x20 = -0x30000; + this->hVelocity = -0x30000; this->speed = gUnk_080CD03C[Random() & 3]; this->direction = gUnk_080CD040[Random() & 3] + 0x18; this->collisionLayer = 2; diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index 247cf0a0..05fdc4e0 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -6,6 +6,7 @@ #include "random.h" #include "createObject.h" #include "functions.h" +#include "effects.h" extern void (*const gUnk_080CEB74[])(Entity*); extern void (*const gUnk_080CEB8C[])(Entity*); @@ -36,7 +37,7 @@ void sub_08033564(Entity* this) { this->spriteSettings.b.draw = FALSE; this->flags &= 0x7f; this->field_0x7c.HALF.LO = 0x27c; - gPlayerState.flags.all |= 0x4000; + gPlayerState.flags |= 0x4000; gSave.stats.effect = this->type + 1; gSave.stats.effectTimer = 600; if (this->type == 0) { @@ -52,7 +53,7 @@ void sub_08033564(Entity* this) { this->flags &= 0x7f; this->iframes = 0; this->spriteSettings.b.draw = FALSE; - ent = CreateFx(this, 2, 0); + ent = CreateFx(this, FX_DEATH, 0); if (ent != NULL) { this->attachedEntity = ent; this->actionDelay = 0xe; diff --git a/src/entity.c b/src/entity.c index 60e571ff..cd9361f4 100644 --- a/src/entity.c +++ b/src/entity.c @@ -102,7 +102,7 @@ void DeleteEntity(Entity* ent) { ent->spriteSettings.b.draw = 0; ent->field_0x3c = 0; ent->bitfield = 0; - ent->field_0x42 = 0; + ent->knockbackDuration = 0; ent->currentHealth = 0; UnlinkEntity(ent); ent->next = NULL; diff --git a/src/ezloNag.c b/src/ezloNag.c index aa45634e..584b13fa 100644 --- a/src/ezloNag.c +++ b/src/ezloNag.c @@ -66,7 +66,7 @@ void sub_0801CF18(Element* arg0) { void sub_0801CF60(Element* arg0) { - if ((gUnk_0200AF00.ezloNagFuncIndex >= 5) || (gTextBox.doTextBox & 0x7f)) { + if ((gUnk_0200AF00.ezloNagFuncIndex >= 5) || (gMessage.doTextBox & 0x7f)) { arg0->unk4 = 0; arg0->unk0 &= -3; return; diff --git a/src/fileScreen.c b/src/fileScreen.c index b1e990be..0c8d4e6c 100644 --- a/src/fileScreen.c +++ b/src/fileScreen.c @@ -113,7 +113,7 @@ void CreateDialogBox(u32 arg0, u32 arg1) { } void sub_08050384(void) { - sub_0801C4A0(0, 0); + RecoverUI(0, 0); MemClear(&gBG0Buffer, sizeof(gBG0Buffer)); gScreen.bg.bg0Updated = 1; } @@ -144,14 +144,14 @@ void LoadOptionsFromSave(u32 idx) { brightnessPref = saveFile->brightnessPref; } - gUnk_02000000->messageSpeed = messageSpeed; - gUnk_02000000->brightnessPref = brightnessPref; + gSaveHeader->messageSpeed = messageSpeed; + gSaveHeader->brightnessPref = brightnessPref; gUsedPalettes = 0xFFFFFFFF; } void SetActiveSave(u32 idx) { if (idx < NUM_SAVE_SLOTS) { - gUnk_02000000->saveFileId = idx; + gSaveHeader->saveFileId = idx; MemCopy(&gUnk_02019EE0.saves[idx], &gSave, sizeof(gUnk_02019EE0.saves[idx])); } LoadOptionsFromSave(idx); @@ -181,8 +181,8 @@ void HandleChooseFileScreen(void) { sub_0801C208(); sub_080AD9B0(); sub_080AD918(); - if (gUnk_02019EE0.unk3 != gUnk_02000000->gameLanguage) { - gUnk_02019EE0.unk3 = gUnk_02000000->gameLanguage; + if (gUnk_02019EE0.unk3 != gSaveHeader->gameLanguage) { + gUnk_02019EE0.unk3 = gSaveHeader->gameLanguage; sub_080503A8(0x6); sub_080503A8(0xF); } @@ -202,7 +202,7 @@ static void HandleFileScreenEnter(void) { MemClear(&gUnk_0200AF00, sizeof(gUnk_0200AF00)); MemClear(&gUnk_02019EE0, sizeof(gUnk_02019EE0)); gUnk_02019EE0.unk3 = 7; - gUnk_02019EE0.unk6 = gUnk_02000000->gameLanguage > LANGUAGE_EN ? 3 : 0; + gUnk_02019EE0.unk6 = gSaveHeader->gameLanguage > LANGUAGE_EN ? 3 : 0; MemClear(&gUnk_02032EC0, sizeof(gUnk_02032EC0)); gUnk_02032EC0.lastState = 8; SetFileSelectState(STATE_NONE); @@ -297,7 +297,7 @@ void sub_0805070C(void) { var0->bgColor = 5; var0->unk1 = 1; var0->unk4 = 0x30; - var0->unk8 = gUnk_02000D00; + var0->unk8 = gTextGfxBuffer; for (i = 0; i < NUM_SAVE_SLOTS; i++) { var0->unk6 = 0; MemClear(var0->unk8, 0x200); @@ -323,7 +323,7 @@ void sub_08050790(void) { var0->bgColor = 5; var0->unk1 = 1; var0->unk4 = 0x80; - var0->unk8 = gUnk_02000D00; + var0->unk8 = gTextGfxBuffer; for (i = 0; i < 16; i++) { var0->unk6 = 0; var1 = i * 16; @@ -331,7 +331,7 @@ void sub_08050790(void) { sub_0805F7DC(var1, var0); var1++; } - MemCopy(gUnk_02000D00, (void*)(BG_VRAM + i * 0x400), 0x400); + MemCopy(gTextGfxBuffer, (void*)(BG_VRAM + i * 0x400), 0x400); } sub_0805F300(var0); } @@ -420,7 +420,7 @@ void sub_08050940(void) { keys &= ~(DPAD_UP | DPAD_DOWN); } - num_rows = gUnk_02000000->gameLanguage > 1 ? NUM_SAVE_SLOTS + 1 : NUM_SAVE_SLOTS; + num_rows = gSaveHeader->gameLanguage > 1 ? NUM_SAVE_SLOTS + 1 : NUM_SAVE_SLOTS; mode = gUnk_02032EC0.lastState; switch (keys) { case DPAD_UP: @@ -679,7 +679,7 @@ void HandleFileLanguageSelect(void) { void sub_08050DB8(void) { MemClear(&gBG2Buffer, sizeof(gBG2Buffer)); sub_080503A8(0xc); - gMenu.field_0x4 = gUnk_02000000->gameLanguage; + gMenu.field_0x4 = gSaveHeader->gameLanguage; sub_080A7114(1); } @@ -689,7 +689,7 @@ void sub_08050DE4(void) { if (gUnk_02019EE0.isTransitioning) return; - row_idx = gUnk_02000000->gameLanguage; + row_idx = gSaveHeader->gameLanguage; switch (gInput.newKeys) { case DPAD_UP: row_idx--; @@ -709,7 +709,7 @@ void sub_08050DE4(void) { break; case B_BUTTON: row_idx = gMenu.field_0x4; - gUnk_02000000->gameLanguage = gMenu.field_0x4; + gSaveHeader->gameLanguage = gMenu.field_0x4; SoundReq(SFX_MENU_CANCEL); SetFileSelectState(STATE_NONE); break; @@ -722,8 +722,8 @@ void sub_08050DE4(void) { if (row_idx > 6) { row_idx = 6; } - if (gUnk_02000000->gameLanguage != row_idx) { - gUnk_02000000->gameLanguage = row_idx; + if (gSaveHeader->gameLanguage != row_idx) { + gSaveHeader->gameLanguage = row_idx; SoundReq(SFX_TEXTBOX_CHOICE); } } @@ -869,7 +869,7 @@ NONMATCH("asm/non_matching/fileScreen/sub_080610B8.inc", void sub_080610B8(void) END_NONMATCH void sub_08051358(void) { - gMenu.field_0x12 = gUnk_02000000->gameLanguage == 0 ? 4 : 3; + gMenu.field_0x12 = gSaveHeader->gameLanguage == 0 ? 4 : 3; if (gMenu.focusCoords[0] != 0x0b || gMenu.focusCoords[1] != 0x5) { gMenu.focusCoords[1] = 0x5; @@ -958,7 +958,7 @@ u32 sub_080514BC(u32 a1) { u32 c; u32 idx; - if (gUnk_02000000->gameLanguage != 0) + if (gSaveHeader->gameLanguage != 0) return 1; switch (a1) { @@ -1169,7 +1169,7 @@ void sub_080517EC(void) { void sub_08051874(void) { s32 temp; - gUnk_02000000->saveFileId = gUnk_02019EE0.unk7; + gSaveHeader->saveFileId = gUnk_02019EE0.unk7; temp = HandleSave(0); gUnk_02019EE0.saveStatus[gUnk_02019EE0.unk7] = temp; switch (temp) { @@ -1202,8 +1202,8 @@ void sub_080518E4(void) { void HandleFileStart(void) { if (gMenu.menuType == 0) { gMenu.menuType = 1; - gUnk_02000000->messageSpeed = gSave.messageSpeed; - gUnk_02000000->brightnessPref = gSave.brightnessPref; + gSaveHeader->messageSpeed = gSave.messageSpeed; + gSaveHeader->brightnessPref = gSave.brightnessPref; gMain.funcIndex = 2; DoFade(5, 8); } diff --git a/src/flagDebug.c b/src/flagDebug.c new file mode 100644 index 00000000..e65edcf4 --- /dev/null +++ b/src/flagDebug.c @@ -0,0 +1,1236 @@ +// #define DEF_FLAGS( name, ... ) \ +// const char* const name##_flags[] = { \ +// "BEGIN", \ +// __VA_ARGS__ \ +// "END" \ +// }; + +// DEF_FLAGS(global, "a", +// "b"); + +const char* const globalFlagNames[] = { + "BEGIN", + "LV0_CLEAR", + "LV1_CLEAR", + "LV2_CLEAR", + "LV3_CLEAR", + "LV4_CLEAR", + "LV5_CLEAR", + "LV6_CLEAR", + "LV7_CLEAR", + "LV8_CLEAR", + "MACHI_SET_1", + "MACHI_SET_2", + "MACHI_SET_3", + "MACHI_SET_4", + "MACHI_SET_5", + "MACHI_SET_6", + "MACHI_SET_7", + "MACHI_SET_8", + "MACHI_MACHIHOKORI", + "START", + "EZERO_1ST", + "TABIDACHI", + "LV1TARU", + "LV1TARU_OPEN", + "TATEKAKE_HOUSE", + "TATEKAKE_TOCHU", + "WATERBEAN_OUT", + "WATERBEAN_PUT", + "ZELDA_CHASE", + "INLOCK", + "DASHBOOTS", + "LEFT_DOOR_OPEN", + "HAKA_KEY_LOST", + "HAKA_KEY_FOUND", + "ENTRANCE_OK", + "TATSUMAKI", + "KUMOTATSUMAKI", + "KAITENGIRI", + "DAIKAITENGIRI", + "GATOTSU", + "KABUTOWARI", + "MIZUKAKI_START", + "MIZUKAKI_HARIFALL", + "RENTED_HOUSE_DIN", + "RENTED_HOUSE_NAYRU", + "RENTED_HOUSE_FARORE", + "NEW_HOUSE_DIN", + "NEW_HOUSE_NAYRU", + "NEW_HOUSE_FARORE", + "OUGONTEKI_A", + "OUGONTEKI_B", + "OUGONTEKI_C", + "OUGONTEKI_D", + "OUGONTEKI_E", + "OUGONTEKI_F", + "OUGONTEKI_G", + "OUGONTEKI_H", + "OUGONTEKI_I", + "KAKERA_COMPLETE", + "DRUG_1", + "DRUG_2", + "DRUG_3", + "GORON_KAKERA_LV2", + "GORON_KAKERA_LV3", + "GORON_KAKERA_LV4", + "GORON_KAKERA_LV5", + "GORON_KAKERA_L", + "GORON_KAKERA_M", + "GORON_KAKERA_R", + "CHIKATSURO_SHUTTER", + "ENTRANCE_USED", + "GOMAN_RENTED_HOUSE", + "GOMAN_NEW_HOUSE", + "OUTDOOR", + "POWERGLOVE_HINT", + "ANJU_LV_BIT0", + "ANJU_LV_BIT1", + "ANJU_LV_BIT2", + "ANJU_LV_BIT3", + "ANJU_HEART", + "MAROYA_WAKEUP", + "ENDING", + "WARP_1ST", + "WARP_MONUMENT", + "DRUG_COUNT", + "GAMECLEAR", + "WHITE_SWORD_END", + "SOUGEN_06_HASHIGO", + "WARP_EVENT_END", + "FIGURE_ALLCOMP", + "AKINDO_BOTTLE_SELL", +#ifdef EU + "BIN_DOOGFOOD", +#else + "BIN_DOGFOOD", +#endif + "TINGLE_TALK1ST", + "SEIIKI_BGM", + "ENTRANCE_0", + "ENTRANCE_1", + "ENTRANCE_2", + "MIZUKAKI_NECHAN", + "MAZE_CLEAR", + "TINY_ENTRANCE", +#ifndef EU + "CASTLE_BGM", +#endif + "END", +}; + +const char* const localFlags1Names[] = { + "BEGIN", + "LV1_CLEAR_MES", + "LV2_CLEAR_MES", + "LV3_CLEAR_MES", + "LV4_CLEAR_MES", + "LV5_CLEAR_MES", + "MIZUUMI_00_BENT", + "MIZUUMI_00_00", + "MIZUUMI_00_H00", + "MIZUUMI_00_H01", + "MIZUUMI_00_H02", +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) + "MIZUUMI_00_CAP_0", +#else + "HIKYOU_00_T0", + "HIKYOU_00_T1", +#endif + "MAENIWA_00_00", + "MAENIWA_00_01", + "MAENIWA_00_02", + "MAENIWA_00_BENT", + "MAENIWA_00_WARP", + "MAENIWA_00_T0", + "MAENIWA_00_T1", + "MAENIWA_00_CAP_0", + "NAKANIWA_00_EZERO", + "HIKYOU_00_00", + "HIKYOU_00_01", + "HIKYOU_00_02", + "HIKYOU_00_03", + "HIKYOU_00_04", + "HIKYOU_00_CAP_0", + "HIKYOU_00_CAP_1", + "HIKYOU_00_CAP_2", + "HIKYOU_00_SEKIZOU", + "HIKYOU_00_14", + "HIKYOU_00_BOSEKI", +#if defined(EU) || defined(JP) || defined(DEMO_JP) + "HIKYOU_00_H00", +#endif + "HIKYOU_00_M0", + "HIKYOU_00_M1", + "HIKYOU_00_M2", +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) + "HIKYOU_00_T1", +#endif + "LOST_00_ENTER", + "LOST_00_00", + "LOST_00_01", + "LOST_02_00", + "LOST_03_00", + "LOST_03_T0", + "LOST_04_00", + "LOST_04_SIBA0", + "LOST_04_SIBA1", + "LOST_04_SIBA2", + "LOST_04_SIBA3", + "LOST_04_SIBA4", + "LOST_05_00", + "LOST_05_01", +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) + "LOST_05_02", + "LOST_05_03", +#endif + "LOST_05_T0", + "LOST_05_T1", + "MORI_00_HIBI_0", + "MORI_00_HIBI_1", + "MORI_00_HIBI_2", + "MORI_00_HIBI_3", + "MORI_00_HIBI_4", + "MORI_00_KOBITO", + "MORI_00_H0", + "MORI_00_H1", + "MORI_ENTRANCE_1ST", + "YAMA_00_00", + "YAMA_00_01", + "YAMA_01_BW00", + "YAMA_02_00", + "YAMA_03_00", + "YAMA_03_01", + "YAMA_03_02", + "YAMA_03_DOKU_0", + "YAMA_03_DOKU_1", + "YAMA_03_DOKU_2", + "YAMA_04_CAP_0", +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) + "YAMA_04_CAP_1", +#endif + "YAMA_04_R00", + "YAMA_04_HIBI_0", + "YAMA_04_HIBI_1", + "YAMA_04_00", + "YAMA_04_01", + "YAMA_04_04", + "YAMA_04_05", + "YAMA_04_06", + "YAMA_04_ENTHOUSHI", + "YAMA_04_ANAHOUSHI", + "YAMA_04_BOMBWALL0", + "HAKA_BUNSHIN_00", + "HAKA_BOSEKI_00", + "HAKA_BOSEKI_01", + "HAKA_BOSEKI_02", + "HAKA_00_CAP_0", + "HAKA_00_BW00", + "HAKA_01_T0", + "HAKA_KEY_GET", + "SOUGEN_01_WAKAGI_0", + "SOUGEN_01_WAKAGI_1", + "SOUGEN_01_WAKAGI_2", + "SOUGEN_01_WAKAGI_3", + "SOUGEN_01_WAKAGI_4", + "SOUGEN_01_WAKAGI_5", + "SOUGEN_01_WAKAGI_6", + "SOUGEN_01_WAKAGI_7", + "SOUGEN_01_WAKAGI_8", + "SOUGEN_01_WAKAGI_9", + "SOUGEN_01_WAKAGI_10", + "SOUGEN_01_WAKAGI_11", + "SOUGEN_01_WAKAGI_12", + "SOUGEN_01_00", + "SOUGEN_01_BENT", + "SOUGEN_01_ZELDA", + "SOUGEN_02_HIBI_0", + "SOUGEN_02_HIBI_1", + "SOUGEN_03_BOMBWALL", + "SOUGEN_04_HIBI_0", + "SOUGEN_04_HIBI_1", + "SOUGEN_04_HIBI_2", + "SOUGEN_04_HIBI_3", + "SOUGEN_05_HIBI_0", + "SOUGEN_05_HIBI_1", + "SOUGEN_05_HIBI_2", + "SOUGEN_05_HIBI_3", + "SOUGEN_05_BOMB_00", + "SOUGEN_05_00", + "SOUGEN_05_01", + "SOUGEN_05_IWA02", + "SOUGEN_05_BENT", + "SOUGEN_05_H00", + "SOUGEN_05_R0", + "SOUGEN_05_CAP_0", + "SOUGEN_06_WAKAGI_0", + "SOUGEN_06_WAKAGI_1", + "SOUGEN_06_WAKAGI_2", + "SOUGEN_06_WAKAGI_3", + "SOUGEN_06_HIBI_0", + "SOUGEN_06_HIBI_1", + "SOUGEN_06_HIBI_2", + "SOUGEN_06_HIBI_3", + "SOUGEN_06_HIBI_4", + "SOUGEN_06_IWA_0", + "SOUGEN_06_AKINDO", + "SOUGEN_06_SAIKAI", + "SOUGEN_06_BENT", + "SOUGEN_06_SLIDE", + "SOUGEN_06_R1", + "SOUGEN_07_00", + "SOUGEN_07_01", + "SOUGEN_07_02", +#if defined(JP) || defined(EU) || defined(DEMO_JP) + "SOUGEN_07_H00", +#endif + "SOUGEN_08_00", + "SOUGEN_08_01", + "SOUGEN_08_02", + "SOUGEN_08_03", + "SOUGEN_08_04", + "SOUGEN_08_05", + "SOUGEN_08_06", + "SOUGEN_08_07", + "SOUGEN_08_08", + "SOUGEN_08_TORITSUKI", + "SOUGEN_08_T00", + "CASTLE_00_00", + "CASTLE_04_MEZAME", + "CASTLE_04_MAID_TALK", + "SUIGEN_00_h0", + "SUIGEN_00_T0", + "SUIGEN_00_r0", + "SUIGEN_00_r1", + "SUIGEN_00_r2", + "SUIGEN_00_CAP_0", + "SUIGEN_00_CAP_1", + "SUIGEN_00_R0", + "SUIGEN_00_R1", +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) + "SUIGEN_00_R2", +#endif + "SUIGEN_00_h1", + "SUIGENGORON_00_CAP_0", + "DAIGORON_SHIELD", + "DAIGORON_EXCHG", + "BEANDEMO_00", + "BEANDEMO_01", + "BEANDEMO_02", + "BEANDEMO_03", + "BEANDEMO_04", + "KAKERA_TAKARA_A", + "KAKERA_TAKARA_E", +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) + "KAKERA_TAKARA_J", +#endif + "KAKERA_TAKARA_K", + "KAKERA_TAKARA_L", + "KAKERA_TAKARA_M", + "KAKERA_TAKARA_N", + "KAKERA_TAKARA_O", + "KAKERA_TAKARA_P", + "KAKERA_TAKARA_Q", + "KAKERA_TAKARA_R", + "KAKERA_TAKARA_S", + "KAKERA_TAKARA_T", + "KAKERA_TAKARA_U", + "KAKERA_TAKARA_V", + "KAKERA_TAKARA_W", + "KAKERA_TAKARA_X", + "KAKERA_TAKARA_Y", + "KAKERA_TAKARA_Z", + "MACHI_02_HEISHI_TALK", + "MACHI00_00", + "MACHI00_02", + "MACHI00_03", + "MACHI_00_T00", + "MACHI_00_T01", + "MACHI_01_DEMO", + "MACHI_02_HEISHI", + "MACHI_02_DOG", + "MACHI_07_BELL", + "SHOP05_OPEN", + "MACHI_MES_20", + "MACHI_MES_21", + "MACHI_MES_22", + "MACHI_MES_23", + "MACHI_MES_24", + "MACHI_MES_30", + "MACHI_MES_40", + "MACHI_MES_60", + "MACHI_MES_50", + "MACHI_DOG_C", + "KUMOUE_00_CAP_0", + "KUMOUE_01_CAP_0", + "KUMOUE_01_T0", + "KUMOUE_01_T1", + "KUMOUE_01_T2", + "KUMOUE_01_T3", + "KUMOUE_01_T4", + "KUMOUE_01_T5", + "KUMOUE_01_T6", + "KUMOUR_01_K0", + "KUMOUR_01_K1", + "KUMOUR_01_K2", + "KUMOUR_01_K3", + "KUMOUR_01_K4", + "KUMOUR_01_K5", + "KUMOUR_01_K6", + "KUMONOUE_01_KAKERA", + "KUMOUE_02_CAP_0", + "KUMOUE_02_AWASE_01", + "KUMOUE_02_AWASE_02", + "KUMOUE_02_AWASE_03", + "KUMOUE_02_AWASE_04", + "KUMOUE_02_AWASE_05", + "KUMOUE_02_00", + "KUMOUE_02_01", + "KUMOUE_02_02", + "KUMOUE_02_03", + "KUMOUE_UNCLE_TALK", + "KUMOUE_GIRL_TALK", +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) + "KS_A06", + "KS_B18", + "KS_C21", + "KS_C25", +#else + "MIZUUMI_00_CAP_0", + "SUIGEN_00_R2", + "YAMA_04_CAP_1", + "LOST_05_02", + "LOST_05_03", + "KAKERA_TAKARA_J", +#endif +#ifdef DEMO_JP + "KS_WARPUSE", +#endif + "END", +}; + +const char* const localFlags2Names[] = { + "BEGIN", + "BILL05_YADO1F_MATSU_T0", + "BILL06_YADO1F_TAKE_T0", + "BILL07_YADO1F_UME_T0", + "BILL0A_YADO_TAKARA_T0", + "SHOUSE_00_T0", + "SHOUSE_00_T1", + "SHOUSE_01_T0", + "SHOUSE_02_T0", + "SHOUSE_02_T1", + "SHOUSE_02_T2", + "SHOUSE_02_XXXX0", + "SHOUSE_02_XXXX1", + "SHOUSE_02_XXXX2", + "SHOUSE_03_T0", + "SHOUSE_03_T1", + "KOBITOANA_06_T0", + "KOBITOANA_03_T0", + "KOBITOANA_07_T0", + "KOBITOANA_09_T0", + "KOBITOANA_0A_T0", + "KOBITOANA_0B_T0", + "MHOUSE11_T0", + "URO_08_T0", + "URO_0A_T0", + "URO_0B_T0", + "BILL00_SHICHOU_00", + "BILL00_SHICHOU_01", + "BILL00_SHICHOU_02", + "BILL00_SHICHOU_03", + "BILL00_SHICHOU_04", + "BILL01_TESSIN_1", + "BILL01_TESSIN_2", + "BILL01_TESSIN_3", + "BILL01_TESSIN_4", + "BILL01_TESSIN_5", + "BILL01_TESSIN_6", + "BILL01_TESSIN_7", + "BILL01_TESSIN_8", + "BILL09_YADO2F_POEMN", + "BILL0A_YADO_TAKARA_00", + "BILL0B_SCHOOLL_00", + "BILL0C_SCHOOLR_00", + "MHOUSE00_00", + "MHOUSE00_01", + "MHOUSE00_02", + "MHOUSE00_03", + "MHOUSE00_04", + "MHOUSE00_05", + "MHOUSE01_00", + "MHOUSE01_01", + "MHOUSE01_02", + "MHOUSE01_03", + "MHOUSE03_00", + "MHOUSE03_01", + "MHOUSE04_00", + "MHOUSE04_01", + "MHOUSE04_02", + "MHOUSE04_03", + "MHOUSE04_04", + "MHOUSE06_00", + "MHOUSE07_00", + "MHOUSE07_01", + "MHOUSE08_00", + "MHOUSE08_01", + "MHOUSE08_02", + "MHOUSE08_03", + "MHOUSE08_04", + "MHOUSE0C_00", + "MHOUSE14_00", + "MHOUSE15_OP1ST", + "MHOUSE2_00_00", + "MHOUSE2_00_01", + "MHOUSE2_00_02", + "MHOUSE2_00_03", + "MHOUSE2_01_T0", + "MHOUSE2_02_KAME", + "MHOUSE2_02_KEY", + "MHOUSE2_03_00", + "MHOUSE2_05_00", + "SHOP00_ITEM_00", + "SHOP00_ITEM_01", + "SHOP00_ITEM_02", + "SHOP00_ITEM_03", + "SHOP00_ITEM_04", + "SHOP00_SAIFU", + "SHOP00_YAZUTSU", + "SHOP01_CAFE_00", + "SHOP01_CAFE_01", + "SHOP01_TALK", + "HOUSE_XXXXX", + "SHOP03_PAN_1ST", + "SHOP07_TALK1ST", + "SHOP07_GACHAPON", + "SHOP07_TANA", + "SHOP07_COMPLETE", + "SHOP02_KUTSU_00", + "NPC37_REM_TALK1ST", + "NPC37_REM_SLEEP", + "SORA_ELDER_RECOVER", + "SORA_CHIEF_TALK", + "SORA_ELDER_TALK1ST", + "SORA_ELDER_TALK2ND", + "NPC06_19GUY_QUESTION", + "NPC06_19GUY_ANSWER", + "DANPEI_TALK1ST", + "MIZUKAKI_KOBITO", + "MIZUKAKI_HINT1", + "MIZUKAKI_BOOK1_FALL", + "MIZUKAKI_HINT2", + "MIZUKAKI_HINT2_2ND", + "MIZUKAKI_BOOK2_FALL", + "MIZUKAKI_HINT3", + "MIZUKAKI_HINT3_MAYOR", + "MIZUKAKI_BOOK3_FALL", + "MIZUKAKI_BOOK_ALLBACK", + "MIZUKAKI_STAIR", + "MIZUKAKI_STAIR_WARP_OK", + "KHOUSE27_00", + "NO_USE_00", + "KHOUSE51_00", + "NO_USE_01", + "KHOUSE51_02", + "KHOUSE42_00", + "NO_USE_02", + "NO_USE_03", + "OYAKATA_DEMO", + "YAMAKOBITO_OPEN", + "M_PRIEST_TALK", + "M_ELDER_TALK1ST", + "M_PRIEST_MOVE", + "M_ELDER_TALK2ND", + "MHOUSE04_DANRO", + "MHOUSE06_DANRO", + "URO_POEMN_TALK", + "MHOUSE06_MES_20", + "MHOUSE07_MES_20", + "MAYOR_2_TALK1ST", + "MAYOR_4_TALK1ST", + "BILL01_TESSIN_RESERVED", + "BILL01_TESSIN_BRANDNEW", + "KOBITO_MORI_1ST", + "KOBITO_YAMA_ENTER", + "KHOUSE52_KINOKO", + "SORA_YAKATA_ENTER", + "YADO_CHECKIN", + "MINIGAME_GAMEEND", + "MINIGAME_LEVEL2", + "MHOUSE_DIN_TALK", + "MHOUSE_NAYRU_TALK", + "MHOUSE_FARORE_TALK", + "URO_12_H0", + "URO_19_H0", + "URO_1F_H0", + "BILL09_TSW0", + "BILL09_TSW1", + "KHOUSE41_TALK1ST", + "TAIMA_SAIBAI_1ST", + "IZUMI_00_FAIRY", + "IZUMI_01_FAIRY", + "IZUMI_02_FAIRY", + "BILL0B_DOUZOU_L", + "BILL0B_DOUZOU_R", + "KOBITOANA_08_T0", + "KOBITOANA_0C_T0", + "KOBITOANA_0D_T0", + "KOBITOHOUSE_23_H0", + "MHOUSE08_DANRO", + "MHOUSE09_DANRO", + "MHOUSE0A_DANRO", + "MHOUSE0B_DANRO", + "MHOUSE0C_DANRO", + "MHOUSE12_DANRO", + "SORA_DANRO", + "MIZUKAKI_HINT3_MAP", + "LEFT_TALK", + "KHOUSE26_REMOCON", + "SORA_KIDS_MOVE", + "KOBITOANA_00_T0", + "KHOUSE23_TALK1ST", + "SHOP05_ELEMENT_H00", + "SHOP05_ELEMENT_T00", + "SHOP05_ELEMENT_T01", + "SHOP05_ELEMENT_T02", + "BILL0a_YADO_TAKARA_H00", + "KOBITOYAMA_00_R00", + "KOBITOYAMA_00_R01", + "KOBITOYAMA_00_R02", + "KOBITOYAMA_00_R03", + "KOBITOYAMA_00_R04", + "KOBITOYAMA_00_R05", + "KOBITOYAMA_00_R06", + "KOBITOYAMA_00_R07", + "KOBITO_MORI_00_H00", + "KOBITO_MORI_00_H0", + "CAFE_01_CAP_0", + "BILL_00_CAP_0", + "BILL_02_CAP_0", + "MHOUSE_07_CAP_0", + "MHOUSE_07_CAP_1", + "MHOUSE_10_CAP_0", + "MHOUSE_15_CAP_0", + "MHOUSE_15_CAP_1", + "SHOP_03_CAP_0", + "MHOUSE_07_CAP_2", +#ifndef EU + "SHOP00_BOMBBAG", + "CAFE_01_CAP_1", +#endif +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) + "KS_A02", + "KS_A09", + "KS_A18", + "KS_B07", + "KS_B16", +#endif +#ifdef DEMO_JP + "MH01_KS_KUSURI", + "MH09_KS_KUSURI", +#endif + "END", +}; + +const char* const localFlags3Names[] = { + "BEGIN", + "MAROYA_TAKARA", + "MACHI_CHIKA_00_00", + "MACHI_CHIKA_00_01", + "MACHI_CHIKA_00_02", + "MACHI_CHIKA_00_03", + "MACHI_CHIKA_00_T0", + "MACHI_CHIKA_00_T1", + "MACHI_CHIKA_00_T2", + "MACHI_CHIKA_00_T3", + "MACHI_CHIKA_00_T4", + "MACHI_CHIKA2_00_T0", + "MACHI_CHIKA2_01_T0", + "MACHI_CHIKA2_03_00", + "MACHI_CHIKA2_03_01", + "MACHI_CHIKA2_03_T0", + "MACHI_CHIKA2_04_T0", + "MACHI_CHIKA2_10_00", + "MACHI_CHIKA2_10_01", + "MACHI_CHIKA2_10_02", + "MACHI_CHIKA2_10_T0", + "MACHI_CHIKA2_12_T0", + "LV4_HAKA_05_T0", + "LV4_HAKA_04_T0", + "LV4_HAKA_04_T1", + "LV4_HAKA_01_00", + "LV4_HAKA_01_01", + "LV4_HAKA_03_00", + "LV4_HAKA_04_R0", + "LV4_HAKA_04_R1", + "LV4_HAKA_04_R2", + "LV4_HAKA_04_R3", + "LV4_HAKA_04_R4", + "LV4_HAKA_04_R5", + "LV4_HAKA_04_R6", + "LV4_HAKA_04_R8", + "LV4_HAKA_04_R9", + "LV4_HAKA_04_R10", + "LV4_HAKA_04_R11", + "LV4_HAKA_04_KB0", + "LV4_HAKA_04_KB1", + "LV4_HAKA_05_H0", + "LV4_HAKA_05_H1", + "LV4_HAKA_05_H2", + "LV4_HAKA_05_H3", + "OUBO_02_BW0", + "OUBO_02_BW1", + "OUBO_06_BW0", + "OUBO_06_BW1", + "OUBO_07_ENTER", + "OUBO_KAKERA", + "MOGURA_00_T0", + "MOGURA_00_T1", + "MOGURA_00_T2", + "MOGURA_01_T0", + "MOGURA_02_T0", + "MOGURA_02_T1", + "MOGURA_02_T2", + "MOGURA_02_T3", + "MOGURA_02_T4", + "MOGURA_02_T5", + "MOGURA_02_T6", + "MOGURA_02_T7", + "MOGURA_02_T8", + "MOGURA_09_T0", + "MOGURA_09_T1", + "MOGURA_10_T0", + "MOGURA_10_T1", + "MOGURA_10_T2", + "MOGURA_1c_T0", + "MOGURA_21_r0", + "MOGURA_27_T0", + "MOGURA_27_T1", + "MOGURA_27_T2", + "MOGURA_41_T0", + "MOGURA_41_T1", + "MOGURA_41_T2", + "MOGURA_41_T3", + "MOGURA_50_00", + "MOGURA_50_T0", + "MOGURA_51_T0", + "MOGURA_51_T1", + "MOGURA_51_T2", + "MOGURA_51_00", + "MOGURA_51_01", + "MOGURA_51_02", + "MOGURA_51_03", + "MOGURA_51_04", + "MOGURA_51_05", + "MOGURA_51_06", + "MOGURA_51_07", + "MOGURA_51_08", + "MOGURA_52_00", + "MOGURA_52_T0", + "MOGURA_52_T1", + "MOGURA_53_00", + "MOGURA_53_T0", + "MOGURA_53_T1", + "MOGURA_53_WALK", + "MOGURA_54_00", + "MOGURA_54_01", + "MOGURA_54_02", + "MOGURA_54_WALK", + "AMOS_00_00", + "AMOS_01_00", + "AMOS_02_00", + "AMOS_03_00", + "AMOS_04_00", + "AMOS_05_00", + "AMOS_06_00", + "AMOS_07_00", + "AMOS_08_00", + "AMOS_09_00", + "AMOS_0A_00", + "AMOS_0B_00", + "AMOS_0C_00", + "AMOS_0D_00", + "AMOS_0E_00", + "AMOS_0F_00", + "HARI_01_T0", + "SEIIKI_STAINED_GLASS", + "SEIIKI_ENTER", + "SEIIKI_SWORD_1ST", + "SEIIKI_SWORD_2ND", + "SEIIKI_SWORD_3RD", + "SEIIKI_BUNSHIN", + "BAGUZU_MORI_02_00", + "BAGUZU_MORI_02_T0", + "BAGUZU_MORI_02_T1", + "BAGUZU_MORI_02_T2", + "CHIKATSURO_01_BW00", + "SORA_10_H00", + "SORA_11_H00", + "SORA_11_T00", + "SORA_11_T01", + "SORA_12_T00", + "SORA_13_H00", + "SORA_13_T00", + "SORA_13_T01", + "SORA_14_T00", + "SORA_14_R00", + "SORA_14_R01", + "SORA_14_R02", + "SORA_14_R03", + "SORA_14_R04", + "SORA_14_R05", + "SORA_14_R06", + "SORA_14_R07", + "IZUMIGARE_00_H00", + "IZUMIGARE_00_H01", + "SORA_10_R00", + "SORA_10_R01", + "SORA_10_R02", + "SORA_10_R03", + "SORA_10_R04", + "SORA_10_R05", + "SORA_10_R06", + "SORA_10_R07", + "SORA_14_R08", + "SORA_14_R09", + "SORA_14_R0a", + "SORA_14_R0b", + "SORA_14_R0c", + "SORA_14_R0d", + "SORA_14_R0e", + "SORA_14_R0f", + "KAKERA_TAKARA_B", + "KAKERA_TAKARA_C", + "KAKERA_TAKARA_D", + "KAKERA_TAKARA_F", + "KAKERA_TAKARA_G", + "KAKERA_TAKARA_H", + "KAKERA_TAKARA_I", + "KAKERA_TAKARA_XXXX", + "TESTMAP00_00", + "TESTMAP01_00", + "TESTMAP01_01", + "TESTMAP02_00", + "LV4_HAKA_08_T0", + "LV4_HAKA_07_00", + "LV4_HAKA_04_00", + "LV4_HAKA_04_01", + "LV4_HAKA_04_K0", + "LV4_HAKA_04_K1", + "LV4_HAKA_01_02", + "LV4_HAKA_08_XX", + "BAGUZU_MORI_03_H00", + "MOGURAU_00_H00", + "HARI_01_H00", + "HARI_03_T00", + "MACHI_CHIKA2_00_CAP_0", + "MACHI_CHIKA2_11_CAP_0", + "LV4_HAKA_08_CAP_0", + "BAGUZUIWA_02_CAP_0", + "MACHI_CHIKA2_01_CAP_0", + "MACHI_CHIKA2_01_HK", + "LV4_HAKA_08_B0", + "LV4_HAKA_08_K0", + "MAROYA_1ST", +#ifndef EU + "MACHI_CHIKA2_10_CAP_0", +#endif +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) + "KS_C02", +#endif + "END", +}; + +const char* const localFlags4Names[] = { + "BEGIN", + "DOUKUTU_00_T0", + "DOUKUTU_00_T1", + "DOUKUTU_05_EVENT", + "SOUGEN_DOUKUTU_00_T0", + "SOUGEN_DOUKUTU_00_T1", + "SOUGEN_DOUKUTU_00_T2", + "SOUGEN_DOUKUTU_00_T3", + "SOUGEN_DOUKUTU_00_T4", + "SOUGEN_DOUKUTU_00_SW0", + "SOUGEN_DOUKUTU_00_SW1", + "SOUGEN_DOUKUTU_00_SW2", + "SOUGEN_DOUKUTU_00_SW3", + "SOUGEN_DOUKUTU_07_T0", + "SOUGEN_DOUKUTU_0B_T0", + "SOUGEN_DOUKUTU_0C_T0", + "SOUGEN_DOUKUTU_0C_BW00", + "SOUGEN_DOUKUTU_0D_00", + "SOUGEN_DOUKUTU_0D_T0", + "SOUGEN_DOUKUTU_0E_BW00", + "SOUGEN_DOUKUTU_0F_T00", + "SOUGEN_DOUKUTU_10_R00", + "SOUGEN_DOUKUTU_10_R01", + "SOUGEN_DOUKUTU_10_R02", + "SOUGEN_DOUKUTU_10_R03", + "SOUGEN_DOUKUTU_10_R04", + "SOUGEN_DOUKUTU_10_R05", + "SOUGEN_DOUKUTU_10_R06", + "SOUGEN_DOUKUTU_10_R07", + "SOUGEN_DOUKUTU_10_R08", + "SOUGEN_DOUKUTU_10_R09", + "SOUGEN_DOUKUTU_10_R0A", + "SOUGEN_DOUKUTU_10_R0B", + "SOUGEN_DOUKUTU_10_R0C", + "SOUGEN_DOUKUTU_10_R0D", + "SOUGEN_DOUKUTU_10_R0E", + "SOUGEN_DOUKUTU_11_R00", + "SOUGEN_DOUKUTU_11_R01", + "SOUGEN_DOUKUTU_11_R02", + "SOUGEN_DOUKUTU_11_R03", + "SOUGEN_DOUKUTU_11_R04", + "SOUGEN_DOUKUTU_11_R05", + "SOUGEN_DOUKUTU_11_R06", + "SOUGEN_DOUKUTU_11_R07", + "SOUGEN_DOUKUTU_11_R08", + "SOUGEN_DOUKUTU_11_R09", + "SOUGEN_DOUKUTU_11_R0A", + "SOUGEN_DOUKUTU_11_R0B", + "SOUGEN_DOUKUTU_11_R0C", + "SOUGEN_DOUKUTU_11_R0D", + "SOUGEN_DOUKUTU_11_R0E", + "SOUGEN_DOUKUTU_13_T0", + "HIKYOU_DOUKUTU0_00_T0", + "HIKYOU_DOUKUTU0_01_T0", + "HIKYOU_DOUKUTU0_01_T1", + "HIKYOU_DOUKUTU0_02_KAIGARA", + "HIKYOU_DOUKUTU0_04_H00", + "HIKYOU_DOUKUTU1_00_00", + "HIKYOU_DOUKUTU1_00_T0", + "YAMADOUKUTU_01_00", + "YAMADOUKUTU_02_00", + "YAMADOUKUTU_03_T0", + "YAMADOUKUTU_06_H0", + "YAMADOUKUTU_07_T0", + "YAMADOUKUTU_08_h0", + "YAMADOUKUTU_08_h1", + "YAMADOUKUTU_08_h2", + "YAMADOUKUTU_09_r0", + "YAMADOUKUTU_09_r1", + "YAMADOUKUTU_09_r2", + "YAMADOUKUTU_0F_00", + "YAMADOUKUTU_10_00", + "SUIGEN_DOUKUTU_00_T0", + "SUIGEN_DOUKUTU_01_BW00", + "SUIGEN_DOUKUTU_02_T0", + "SUIGEN_DOUKUTU_04_BW00", + "SUIGEN_DOUKUTU_05_T0", + "SUIGEN_DOUKUTU_08_R0", + "SUIGEN_DOUKUTU_08_R1", + "SUIGEN_DOUKUTU_08_R2", + "SUIGEN_DOUKUTU_08_R3", + "SUIGEN_DOUKUTU_08_R4", + "SUIGEN_DOUKUTU_08_R5", + "SUIGEN_DOUKUTU_08_R6", + "SUIGEN_DOUKUTU_08_R7", + "SUIGEN_DOUKUTU_08_R8", + "SUIGEN_DOUKUTU_08_R9", + "SUIGEN_DOUKUTU_08_R10", + "SUIGEN_DOUKUTU_08_R11", + "SUIGEN_DOUKUTU_08_R12", + "SUIGEN_DOUKUTU_08_R13", + "SUIGEN_DOUKUTU_08_R14", + "SUIGEN_DOUKUTU_09_H00", + "HAKA_DOUKUTU_00_H0", + "HAKA_DOUKUTU_01_T0", + "HAKA_DOUKUTU_01_GEENE", + "KOBITO_DOUKUTU_00_T0", + "KOBITO_DOUKUTU_02_T0", + "KOBITO_DOUKUTU_05_T0", + "KOBITO_SHIRO_DOUKUTU_00_H0", + "KOBITO_SHIRO_DOUKUTU_00_T0", + "KOBITO_SHIRO_DOUKUTU_01_T0", + "KOBITO_URA_DOUKUTU_00_T0", + "KOBITO_URA_DOUKUTU_01_T0", + "GORON_DOUKUTU_APPEAR", + "KOBITO_DOUKUTU_03_T0", + "HIKYOU_DOUKUTU0_01_AKINDO", + "SOUGEN_DOUKUTU_14_AKINDO", + "SOUGEN_DOUKUTU_17_AKINDO", + "YAMADOUKUTU_04_AKINDO", + "YAMADOUKUTU_0D_AKINDO", + "YAMADOUKUTU_0F_AKINDO", + "YAMADOUKUTU_0E_SENNIN", + "KOBITO_DOUKUTU_04_T0", + "KOBITO_DOUKUTU_07_T0", + "KOBITO_DOUKUTU_09_T0", + "KOBITO_DOUKUTU_09_T1", + "KOBITO_DOUKUTU_09_T2", + "GORON_DOUKUTU_01_T0", + "GORON_DOUKUTU_01_T1", + "GORON_DOUKUTU_01_T2", + "GORON_DOUKUTU_01_T3", + "KOBITO_DOUKUTU_09_H0", + "SOUGEN_DOUKUTU_15_H0", + "KOBITO_DOUKUTU_01_H00", + "YAMADOUKUTU_05_H00", + "KOBITO_DOUKUTU_03_H00", + "DOUKUTU_04_H00", + "DOUKUTU_00_H00", + "KOBITO_DOUKUTU_04_H00", + "DOUKUTU_06_H00", + "DOUKUTU_05_H00", + "KOBITO_DOUKUTU_02_H00", + "KOBITO_DOUKUTU_01_T0", + "YAMADOUKUTU_04_CAP_0", +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) + "KS_B06", + "KS_B15", + "KS_B01", + "KS_B12", + "KS_C12", + "KS_C37", +#endif + "END", +}; + +const char* const localFlags5Names[] = { + "BEGIN", "LV1_00_WALK", "LV1_01_WALK", "LV1_02_WALK", "LV1_03_WALK", "LV1_04_WALK", "LV1_05_WALK", + "LV1_06_WALK", "LV1_07_WALK", "LV1_08_WALK", "LV1_09_WALK", "LV1_0A_WALK", "LV1_0B_WALK", "LV1_10_WALK", + "LV1_11_WALK", "LV1_12_WALK", "LV1_13_WALK", "LV1_14_WALK", "LV1_15_WALK", "LV1_16_WALK", "LV1_17_WALK", + "LV1_TARU_0", "LV1_TARU_1", "LV1_00_00", "LV1_00_01", "LV1_00_02", "LV1_00_03", "LV1_00_T0", + "LV1_01_00", "LV1_01_01", "LV1_01_02", "LV1_01_03", "LV1_01_04", "LV1_01_T0", "LV1_01_T1", + "LV1_01_T2", "LV1_02_T0", "LV1_03_CAP_0", "LV1_04_02", "LV1_04_T0", "LV1_05_T0", "LV1_05_T1", + "LV1_06_03", "LV1_06_T0", "LV1_06_CAP_0", "LV1_07_00", "LV1_07_CAP_0", "LV1_08_00", "LV1_08_KEY", + "LV1_09_00", "LV1_0A_00", "LV1_0A_CAP_0", "LV1_0B_01", "LV1_0B_02", "LV1_0B_15", "LV1_0B_CAP_0", + "LV1_10_00", "LV1_10_01", "LV1_10_02", "LV1_10_03", "LV1_10_KEY", "LV1_10_T0", "LV1_11_01", + "LV1_11_T0", "LV1_12_15", "LV1_12_T0", "LV1_12_T1", "LV1_12_00", "LV1_12_01", "LV1_14_00", + "LV1_14_CAP_0", "LV1_16_UTSUWA", "LV1_16_1STEND", "LV1_17_00", "LV1_17_T0", "LV1_02_00", "LV1_02_01", + "LV1_10_04", "LV1_20_CAP_0 ", "LV1_01_HK ", "LV1_04_CAP_0", "LV1_03_00", "LV1_05_HK ", "LV1_08_01", + "LV1_01_05", "LV1_10_CAP_0 ", +#if !defined(EU) && !defined(JP) + "LV1_12_CAP_0 ", +#endif + "END", +}; + +const char* const localFlags6Names[] = { + "BEGIN", "LV2_00_WALK", "LV2_01_WALK", "LV2_02_WALK", "LV2_03_WALK", "LV2_04_WALK", "LV2_05_WALK", + "LV2_06_WALK", "LV2_07_WALK", "LV2_08_WALK", "LV2_09_WALK", "LV2_10_WALK", "LV2_11_WALK", "LV2_12_WALK", + "LV2_13_WALK", "LV2_14_WALK", "LV2_15_WALK", "LV2_16_WALK", "LV2_17_WALK", "LV2_BOSS_00_WALK", "LV2_00_00", + "LV2_00_01", "LV2_01_01", "LV2_01_02", "LV2_01_T0", "LV2_01_T1", "LV2_02_01", "LV2_03_CAP_0", + "LV2_04_00", "LV2_04_01", "LV2_04_CAP_0", "LV2_06_00", "LV2_06_T0", "LV2_06_CAP_0", "LV2_07_00", + "LV2_07_CAP_0", "LV2_08_00", "LV2_08_01", "LV2_08_T0", "LV2_08_T1", "LV2_09_00", "LV2_09_T0", + "LV2_09_T1", "LV2_10_00", "LV2_10_T0", "LV2_10_T1", "LV2_11_00", "LV2_11_01", "LV2_14_T0", + "LV2_15_01", "LV2_15_T0", "LV2_15_CAP_0", "LV2_16_00", "LV2_17_00", "LV2_17_15", "LV2_17_T0", + "LV2_17_T1", "LV2_17_T2", "LV2_20_UTSUWA", "LV2_00_02 ", "LV2_06_HK", "LV2_11_02", "LV2_05_R1", + "LV2_05_R2", "LV2_05_R3", "LV2_05_R4", "LV2_05_R5", "LV2_00_CAP_0", "LV2_09_CAP_0", "END", +}; + +const char* const localFlags7Names[] = { + "BEGIN", + "LV3_00_WALK", + "LV3_01_WALK", + "LV3_02_WALK", + "LV3_03_WALK", + "LV3_04_WALK", + "LV3_05_WALK", + "LV3_06_WALK", + "LV3_10_WALK", + "LV3_11_WALK", + "LV3_12_WALK", + "LV3_13_WALK", + "LV3_14_WALK", + "LV3_15_WALK", + "LV3_16_WALK", + "LV3_17_WALK", + "LV3_18_WALK", + "LV3_19_WALK", + "LV3_1A_WALK", + "LV3_1B_WALK", + "LV3_1C_WALK", + "LV3_1D_WALK", + "LV3_20_WALK", + "LV3_21_WALK", + "LV3_22_WALK", + "LV3_23_WALK", + "LV3_24_WALK", + "LV3_00_00", + "LV3_00_T0", + "LV3_02_00", + "LV3_02_01", + "LV3_02_02", + "LV3_02_KEYFALL", + "LV3_03_00", + "LV3_03_01", + "LV3_04_00", + "LV3_04_KEYFALL", + "LV3_04_WARP_0", + "LV3_04_BOSSDOOR", + "LV3_10_00", + "LV3_11_00", + "LV3_12_CAP_0", + "LV3_13_00", + "LV3_14_00", + "LV3_14_01", + "LV3_14_02", + "LV3_14_KEY", + "LV3_15_00", + "LV3_17_00", + "LV3_16_BOSSDIE", + "LV3_16_GETUTSUWA", + "LV3_18_00", + "LV3_18_00_BW00", + "LV3_19_01", + "LV3_19_02", + "LV3_19_03", + "LV3_19_04", + "LV3_19_T0", + "LV3_1B_T0", + "LV3_1D_00", + "LV3_1D_01", + "LV3_1D_T0", + "LV3_1D_T1", + "LV3_20_00", + "LV3_20_CAP_0", + "LV3_22_00", + "LV3_23_01", + "LV3_23_T0", + "LV3_24_T0", + "LV3_OCARINA_FALL", + "LV3_02_CAP_0 ", + "LV3_24_HK", + "LV3_10_01", + "LV3_17_01", + "END", +}; + +const char* const localFlags8Names[] = { + "BEGIN", "LV4_00_WALK", "LV4_01_WALK", + "LV4_02_WALK", "LV4_03_WALK", "LV4_04_WALK", + "LV4_05_WALK", "LV4_06_WALK", "LV4_07_WALK", + "LV4_08_WALK", "LV4_09_WALK", "LV4_0A_WALK", + "LV4_0B_WALK", "LV4_0C_WALK", "LV4_0D_WALK", + "LV4_0E_WALK", "LV4_0F_WALK", "LV4_10_WALK", + "LV4_11_WALK", "LV4_20_WALK", "LV4_21_WALK", + "LV4_22_WALK", "LV4_23_WALK", "LV4_24_WALK", + "LV4_25_WALK", "LV4_26_WALK", "LV4_27_WALK", + "LV4_28_WALK", "LV4_29_WALK", "LV4_2A_WALK", + "LV4_2B_WALK", "LV4_2C_WALK", "LV4_2D_WALK", + "LV4_2E_WALK", "LV4_2F_WALK", "LV4_30_WALK", + "LV4_31_WALK", "LV4_32_WALK", "LV4_33_WALK", + "LV4_34_WALK", "LV4_35_WALK", "LV4_INIT", + "LV4_01_00", "LV4_03_CAP_0", "LV4_03_BOSSDOOR", + "LV4_05_00", "LV4_05_01", "LV4_06_00", + "LV4_07_00", "LV4_08_00", "LV4_08_01", + "LV4_08_02", "LV4_08_RAY_HALF", "LV4_08_RAY_HALF_E", + "LV4_08_RAY_FULL", "LV4_08_RAY_FULL_E", "LV4_09_T0", + "LV4_0a_TSUBO", "LV4_0a_T0", "LV4_0c_00", + "LV4_0d_00", "LV4_0d_01", "LV4_0d_02", + "LV4_0d_T0", "LV4_0e_UTSUWA", "LV4_0f_00", + "LV4_0f_01", "LV4_0f_02", "LV4_0f_03", + "LV4_0f_04", "LV4_10_RAY", "LV4_10_T0", + "LV4_10_BOSSDIE", "LV4_11_00", "LV4_11_RAY_SP", + "LV4_11_RAY", "LV4_11_T0", "LV4_20_00", + "LV4_20_RAY", "LV4_20_BOSSKEY", "LV4_21_00", + "LV4_21_RAY", "LV4_21_KEY", "LV4_21_CAP_0", + "LV4_22_00", "LV4_23_00", "LV4_24_00", + "LV4_27_00", "LV4_28_00", "LV4_28_01", + "LV4_28_T0", "LV4_28_T1", "LV4_29_CAP_0", + "LV4_2b_T0", "LV4_2b_T1", "LV4_2b_T2", + "LV4_2b_BKABE", "LV4_2b_00", "LV4_2b_01", + "LV4_2b_02", "LV4_2b_03", "LV4_2b_04", + "LV4_2c_00", "LV4_2c_02", "LV4_2c_T0", + "LV4_2d_00", "LV4_2d_01", "LV4_2d_02", + "LV4_2e_RAY", "LV4_2f_00", "LV4_2f_01", + "LV4_2f_KEY", "LV4_30_00", "LV4_30_BKABE", + "LV4_31_00", "LV4_31_01", "LV4_32_00", + "LV4_32_01", "LV4_32_T0", "LV4_32_T1", + "LV4_33_01", "LV4_34_00", "LV4_34_01", + "LV4_35_00", "LV4_35_01", "LV4_22_01", + "LV4_2d_T0", "LV4_03_CAP_1 ", "LV4_08_CAP_0 ", + "LV4_08_CAP_1 ", "LV4_36_WALK", "LV4_36_T0", + "LV4_21_CAP_1 ", "LV4_0d_03", "LV4_0d_04", + "LV4_0d_05", "LV4_0d_06", "LV4_0d_07", + "LV4_25_00", "LV4_25_01", "LV4_25_02", + "LV4_25_03", "LV4_25_04", "LV4_31_02", + "LV4_31_03", "LV4_31_04", "LV4_31_05", + "LV4_31_06", "LV4_31_07", "LV4_06_01", + "LV4_06_02", "LV4_06_03", "LV4_06_04", + "LV4_06_05", "LV4_06_06", "LV4_08_OCT", + "LV4_05_02", "LV4_28_02", "LV4_2c_01", + "LV4_33_02", "LV4_31_08", "LV4_34_02", + "LV4_20_RAY_SW", "LV4_21_RAY_SW", "END", +}; + +const char* const localFlags9Names[] = { + "BEGIN", "LV5_00_WALK", "LV5_01_WALK", "LV5_02_WALK", "LV5_03_WALK", "LV5_04_WALK", + "LV5_05_WALK", "LV5_06_WALK", "LV5_07_WALK", "LV5_08_WALK", "LV5_09_WALK", "LV5_0A_WALK", + "LV5_0B_WALK", "LV5_0C_WALK", "LV5_0D_WALK", "LV5_0E_WALK", "LV5_0F_WALK", "LV5_10_WALK", + "LV5_11_WALK", "LV5_12_WALK", "LV5_13_WALK", "LV5_14_WALK", "LV5_15_WALK", "LV5_16_WALK", + "LV5_17_WALK", "LV5_18_WALK", "LV5_19_WALK", "LV5_1A_WALK", "LV5_1B_WALK", "LV5_1C_WALK", + "LV5_1D_WALK", "LV5_1E_WALK", "LV5_1F_WALK", "LV5_20_WALK", "LV5_21_WALK", "LV5_22_WALK", + "LV5_23_WALK", "LV5_24_WALK", "LV5_25_WALK", "LV5_26_WALK", "LV5_27_WALK", "LV5_28_WALK", + "LV5_29_WALK", "LV5_2A_WALK", "LV5_2B_WALK", "LV5_2C_WALK", "LV5_2D_WALK", "LV5_2E_WALK", + "LV5_2F_WALK", "LV5_30_WALK", "LV5_31_WALK", "LV5_32_WALK", "LV5_01_T0", "LV5_03_T0", + "LV5_03_BOSSDOOR", "LV5_04_T0", "LV5_05_00", "LV5_05_01", "LV5_05_02", "LV5_06_00", + "LV5_07_00", "LV5_07_01", "LV5_07_T0", "LV5_08_00", "LV5_08_01", "LV5_08_KEY", + "LV5_08_BOSSDOOR", "LV5_0b_B0", "LV5_0b_B1", "LV5_0d_00", "LV5_0e_00", "LV5_0f_T0", + "LV5_0f_T1", "LV5_10_T0", "LV5_15_00", "LV5_15_01", "LV5_15_02", "LV5_15_03", + "LV5_15_04", "LV5_15_T0", "LV5_15_B0", "LV5_15_B1", "LV5_1a_00", "LV5_1a_01", + "LV5_1b_00", "LV5_1b_T0", "LV5_1c_00", "LV5_1c_T0", "LV5_20_00", "LV5_20_01", + "LV5_21_00", "LV5_21_01", "LV5_21_02", "LV5_21_03", "LV5_21_04", "LV5_21_05", + "LV5_21_06", "LV5_21_07", "LV5_21_08", "LV5_21_09", "LV5_21_0a", "LV5_21_CAP_0", + "LV5_22_00", "LV5_22_01", "LV5_22_CAP_0", "LV5_23_00", "LV5_23_01", "LV5_27_00", + "LV5_29_00", "LV5_29_01", "LV5_29_T0", "LV5_2b_T0", "LV5_2c_00", "LV5_2c_01", + "LV5_2c_02", "LV5_2c_03", "LV5_2c_T0", "LV5_2c_CAP_0", "LV5_2d_T0", "LV5_31_CAP_0", + "LV5_32_CAP_0", "LV5_32_T0", "LV5_32_T1", "LV5_BOSSDIE", "LV5_MBOSSDIE", "LV5_00_UTSUWA", + "LV5_0c_00", "LV5_0A_CAP_0", "LV5_0f_HK", "LV5_05_03", "LV5_08_02", "LV5_0c_01", + "LV5_0c_02", "LV5_22_02", "LV5_15_05", "LV5_20_02", "END", +}; + +const char* const localFlags10Names[] = { + "BEGIN", "LV6_00_WALK", "LV6_01_WALK", "LV6_02_WALK", + "LV6_03_WALK", "LV6_04_WALK", "LV6_05_WALK", "LV6_06_WALK", + "LV6_07_WALK", "LV6_08_WALK", "LV6_09_WALK", "LV6_0A_WALK", + "LV6_0B_WALK", "LV6_0C_WALK", "LV6_0D_WALK", "LV6_0E_WALK", + "LV6_0F_WALK", "LV6_10_WALK", "LV6_11_WALK", "LV6_12_WALK", + "LV6_13_WALK", "LV6_14_WALK", "LV6_15_WALK", "LV6_16_WALK", + "LV6_17_WALK", "LV6_18_WALK", "LV6_19_WALK", "LV6_1A_WALK", + "LV6_1B_WALK", "LV6_1C_WALK", "LV6_1D_WALK", "LV6_1E_WALK", + "LV6_1F_WALK", "LV6_20_WALK", "LV6_21_WALK", "LV6_22_WALK", + "LV6_23_WALK", "LV6_24_WALK", "LV6_25_WALK", "LV6_26_WALK", + "LV6_27_WALK", "LV6_28_WALK", "LV6_29_WALK", "LV6_2A_WALK", + "LV6_2B_WALK", "LV6_2C_WALK", "LV6_2D_WALK", "LV6_2E_WALK", + "LV6_2F_WALK", "LV6_30_WALK", "LV6_31_WALK", "LV6_32_WALK", + "LV6_33_WALK", "LV6_34_WALK", "LV6_35_WALK", "LV6_36_WALK", + "LV6_37_WALK", "LV6_38_WALK", "LV6_39_WALK", "LV6_3A_WALK", + "LV6_3B_WALK", "LV6_00_00", "LV6_01_T0", "LV6_02_T0", + "LV6_03_T0", "LV6_04_T0", "LV6_07_00", "LV6_09_T0", + "LV6_09_KB0", "LV6_09_KB1", "LV6_09_KB2", "LV6_09_KB3", + "LV6_0a_01", "LV6_0b_00", "LV6_0c_00", "LV6_0c_01", + "LV6_0e_00", "LV6_10_00", "LV6_11_00", "LV6_11_01", + "LV6_11_B0", "LV6_11_B1", "LV6_11_B2", "LV6_13_00", + "LV6_14_00", "LV6_14_BOSSDOOR", "LV6_15_00", "LV6_16_00", + "LV6_17_00", "LV6_17_01", "LV6_18_00", "LV6_1a_00", + "LV6_1c_CAP_0", "LV6_1d_00", "LV6_1f_00", "LV6_20_T0", + "LV6_24_00", "LV6_26_00", "LV6_26_01", "LV6_26_CAP_0 ", + "LV6_27_00", "LV6_27_T0", "LV6_30_00", "LV6_32_00", + "LV6_34_00", "LV6_34_01", "LV6_35_00", "LV6_37_T0", + "LV6_39_00", "LV6_39_01", "LV6_39_02", "LV6_1f_CHAIR_L", + "LV6_1f_CHAIR_R", "LV6_1d_KEYGET", "LV6_1b_TAREMAKU", "LV6SOTO_01_KAIJO", + "LV6_SEKIKA_END", "LV6_GUFUU1_FIGURE", "LV6_GUFUU2_FIGURE", "LV6_GUFUU1_GISHIKI", + "LV6_GUFUU1_DEMO", "LV6_ZELDA_DISCURSE", "LV6_00_ESCAPE", "LV6_GUFUU2_DEAD", + "LV6_KANE_START", "LV6_KANE_1ST", "LV6_KANE_2ND", "LV6_SOTO_ENDING", + "LV6_08_00", "LV6_39_03", "LV6_SOTO_06_00", "LV6_SOTO_06_01", + "LV6_0A_CAP_0 ", "LV6SOTO_01_CAP_0 ", "LV6_0a_00", "LV6_0b_01", + "LV6_0e_01", "LV6_10_01", "LV6_13_01", "LV6_14_01", + "LV6_15_01", "LV6_1a_01", "LV6_1f_01", "LV6_39_04", + "LV6_17_02", "LV6_18_01", "LV6_08_01", "LV6_SOTO_01_00", + "LV6_SOTO_01_01", "LV6_SOTO_01_02", "LV6_39_KING", "END", +}; + +const char* const localFlags11Names[] = { + "BEGIN", + "END", +}; + +const char* const localFlags12Names[] = { + "BEGIN", + "END", +}; diff --git a/src/flags.c b/src/flags.c index 2129ae01..f1080cde 100644 --- a/src/flags.c +++ b/src/flags.c @@ -13,13 +13,13 @@ u32 CheckLocalFlag(u32 flag) { } u32 CheckFlags(u32 flags) { - s32 uVar1; + s32 type; s32 index; s32 length; index = flags & 0x3ff; length = (((flags & (0xf0) << 0x6) >> 0xa) + 1); - uVar1 = (flags & 0xc000) >> 0xe; - switch ((u32)uVar1) { + type = (flags & 0xc000) >> 0xe; + switch ((u32)type) { case 2: return CheckRoomFlags(index, length); case 0: @@ -67,7 +67,7 @@ void sub_0805212C(void) { #else sub_08052418(0, 0); gScreen.lcd.displayControl |= 0x600; - gFadeControl.field_0x4 = 0xffff; + gFadeControl.mask = 0x0000ffff; DoFade(4, 0x10); #endif } @@ -97,7 +97,7 @@ void sub_080521A0(void) { gMenu.field_0x3 = 0; sub_080A7114(1); sub_08052418(0, 0); - gFadeControl.field_0x4 = 0xffffffff; + gFadeControl.mask = 0xffffffff; break; case 1: if (gMenu.transitionTimer == 0) { @@ -245,7 +245,7 @@ NONMATCH("asm/non_matching/game/sub_08052418.inc", void sub_08052418(int param_1 gUnk_020227E8._0[param_2 * 2].BYTES.byte1 = 1; MemCopy(&gUnk_080FCA8C, &temp, sizeof(temp)); i = param_1 * 0xc; - // temp._0 = gBG1Buffer[gUnk_080FCAA4._8[param_1]][gUnk_080FCAA4._0[gUnk_02000000->gameLanguage + i]] * 2; + // temp._0 = gBG1Buffer[gUnk_080FCAA4._8[param_1]][gUnk_080FCAA4._0[gSaveHeader->gameLanguage + i]] * 2; temp._13 = ((temp._13 & 0xfe) | gUnk_080FCAA4._8[i + 1]) & 1; sub_0805F46C(gUnk_080FCAA4._a[param_1], &temp); gScreen.bg.bg1xOffset = 1; @@ -265,7 +265,7 @@ void InitializePlayer(void) { gRoomControls.cameraTarget = pl; gPlayerState.playerAction = gUnk_080FCAC8[gScreenTransition.field_0xf]; if (!CheckGlobalFlag(EZERO_1ST)) { - gPlayerState.flags.all |= 8; + gPlayerState.flags |= 8; } switch (gScreenTransition.field_0xf) { case 0x2: diff --git a/src/intro.c b/src/intro.c index 61d63686..04783e12 100644 --- a/src/intro.c +++ b/src/intro.c @@ -94,7 +94,7 @@ static void HandleNintendoCapcomLogos(void) { gIntroState.timer = 120; LoadGfxGroup(16); LoadGfxGroup(1); - if (gUnk_02000000->gameLanguage == 0) { + if (gSaveHeader->gameLanguage == 0) { paletteGroup = 1; } else { paletteGroup = 2; @@ -148,13 +148,13 @@ static void HandleTitlescreen(void) { sub_080ADD30(); gUnk_02024490.unk0 = 1; LoadGfxGroup(2); - if (gUnk_02000000->gameLanguage == 0) { + if (gSaveHeader->gameLanguage == 0) { paletteGroup = 3; } else { paletteGroup = 4; } LoadPaletteGroup(paletteGroup); - if (gUnk_02000000->gameLanguage == 0) { + if (gSaveHeader->gameLanguage == 0) { // Blend first and second layer gScreen.controls.layerFXControl = BLDCNT_TGT1_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_EFFECT_BLEND; gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9); @@ -183,7 +183,7 @@ static void HandleTitlescreen(void) { if (gFadeControl.active) { return; } - if (gUnk_02000000->gameLanguage == 0) { + if (gSaveHeader->gameLanguage == 0) { HandleJapaneseTitlescreenAnimationIntro(); } else { HandleTitlescreenAnimationIntro(); @@ -240,8 +240,8 @@ static void HandleTitlescreen(void) { #endif } } - if (gIntroState.gameLanguage != gUnk_02000000->gameLanguage) { - gIntroState.gameLanguage = gUnk_02000000->gameLanguage; + if (gIntroState.gameLanguage != gSaveHeader->gameLanguage) { + gIntroState.gameLanguage = gSaveHeader->gameLanguage; LoadGfxGroup(3); } UpdateLightRays(); @@ -285,7 +285,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) { gIntroState.subState++; gScreen.bg.bg1yOffset = 0; gScreen.bg.bg1Control = 0xc09; - gFadeControl.field_0x4 = 0x40; + gFadeControl.mask = 0x00000040; DoFade(6, 0x10); SoundReq(SFX_F8); } @@ -293,7 +293,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) { break; case 1: if (!gFadeControl.active) { - gFadeControl.field_0x4 = -1; + gFadeControl.mask = 0xFFFFFFFF; gIntroState.subState++; #if defined(JP) || defined(EU) || defined(DEMO_JP) gIntroState.timer = 120; diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index 51f52afe..652dd5e0 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -21,9 +21,9 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) { s8* tmp; itemSlot = IsItemEquipped(this->behaviorID); if (gPlayerState.heldObject != 0 || gPlayerState.playerAction == 0x18 || gPlayerState.jumpStatus != 0 || - gPlayerState.field_0x2c != NULL || (gPlayerState.flags.all & 0x80) != 0) { + gPlayerState.field_0x2c != NULL || (gPlayerState.flags & 0x80) != 0) { ForceEquipItem(0xf, itemSlot); - gPlayerState.flags.all &= 0xff7fffff; + gPlayerState.flags &= 0xff7fffff; ForceEquipItem(0xf, itemSlot); sub_08077E78(this, arg1); } else { @@ -50,11 +50,11 @@ ASM_FUNC("asm/non_matching/eu/sub_08075ADC.inc", void sub_08075ADC(ItemBehavior* void sub_08075ADC(ItemBehavior* this, u32 arg1) { u32 bVar1; - if (gPlayerState.field_0x2c != NULL || (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags.all & 0x110) != 0 || + if (gPlayerState.field_0x2c != NULL || (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags & 0x110) != 0 || sub_08079D48() == 0) { this->field_0xf = 0; this->stateID += 1; - gPlayerState.flags.all |= 0x800000; + gPlayerState.flags |= 0x800000; bVar1 = 8 >> arg1; gPlayerState.field_0x3[1] = gPlayerState.field_0x3[1] & ~((bVar1 << 4) | bVar1); bVar1 = ~bVar1; @@ -73,11 +73,11 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) { Entity* object; s8* tmp; - if ((gPlayerState.flags.all & 0x110) == 0) { + if ((gPlayerState.flags & 0x110) == 0) { itemSlot = IsItemEquipped(this->behaviorID); if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jumpStatus != 0))) { ForceEquipItem(0xf, itemSlot); - gPlayerState.flags.all &= 0xff7fffff; + gPlayerState.flags &= 0xff7fffff; sub_08077E78(this, arg1); SoundReq(SFX_ITEM_LANTERN_OFF); } else { diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index 84a147dc..8d126e23 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -24,7 +24,7 @@ void OcarinaUse(ItemBehavior* this, u32 arg1) { gPlayerEntity.spriteSettings.b.flipX = 0; gPlayerEntity.flags &= 0x7f; gPlayerEntity.field_0x7a.HWORD = 2; - gPlayerState.flags.all |= 0x10000000; + gPlayerState.flags |= 0x10000000; gPlayerState.field_0x27[0] = -1; gUnk_02034490[0] = 1; gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; @@ -41,7 +41,7 @@ NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBe UpdateItemAnim(this); if ((this->field_0x5[9] & 0x80) != 0) { gPlayerEntity.flags |= 0x80; - gPlayerState.flags.all &= 0xefffffff; + gPlayerState.flags &= 0xefffffff; gPlayerState.field_0x27[0] = 0; gUnk_02034490[0] = 0; CreateBird(); diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 0eca0fe9..b572d2f6 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -2,6 +2,7 @@ #include "audio.h" #include "random.h" #include "functions.h" +#include "effects.h" extern void (*const gUnk_0811BDCC[])(ItemBehavior* beh, u32); @@ -16,20 +17,19 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { gPlayerState.field_0x1d[1] = 0; gPlayerState.field_0xe = 0; sub_08077E78(this, arg1); - } else { bVar1 = this->field_0x5[2] - 1; this->field_0x5[2] = bVar1; if ((bVar1 & 7) == 0) { SoundReq(SFX_PLY_LAND); } - if (((gPlayerState.flags.all & 0x80) == 0) && ((this->field_0x5[2] & 7) == 0)) { + if (((gPlayerState.flags & 0x80) == 0) && ((this->field_0x5[2] & 7) == 0)) { if (gPlayerState.field_0x10[2] == 0x11) { if (gPlayerEntity.spriteOffsetY == 0) { - CreateFx(&gPlayerEntity, 0x52, 0); + CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); } } else { - fx = CreateFx(&gPlayerEntity, 0x11, 0x40); + fx = CreateFx(&gPlayerEntity, FX_DASH, 0x40); if ((fx != NULL) && (fx->y.HALF.HI = fx->y.HALF.HI + 2, this->stateID != 2)) { uVar4 = Random() & 3; if ((Random() & 1) != 0) { @@ -53,12 +53,12 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) { u32 bVar2; bVar1 = gPlayerState.field_0x1c | gPlayerState.field_0x3[1] | gPlayerState.heldObject | gPlayerState.jumpStatus; - bVar2 = (gPlayerState.flags.all & 0x1000); + bVar2 = (gPlayerState.flags & 0x1000); bVar1 |= bVar2; if (bVar1 == 0) { gPlayerState.field_0x1d[1] = 1; gPlayerState.field_0x1d[4] = bVar1; - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { this->field_0x5[2] = 0x10; } else { gPlayerState.field_0x8 = 0xc14; diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index ba98de91..d718e610 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -22,7 +22,7 @@ extern bool32 sub_08077EFC(ItemBehavior*); if ((gPlayerState.jumpStatus != 0) && ((gPlayerState.jumpStatus & 7) != 3)) goto _08076710; if (-1 < gPlayerEntity.height.WORD) { - gPlayerEntity.field_0x20 = 0x20000; + gPlayerEntity.hVelocity = 0x20000; gPlayerState.jumpStatus = 1; gPlayerState.field_0x2c = NULL; this->stateID += 1; @@ -45,7 +45,7 @@ extern bool32 sub_08077EFC(ItemBehavior*); gPlayerState.jumpStatus = 1; gPlayerState.field_0xe = -1; gPlayerState.field_0x2c = NULL; - gPlayerEntity.field_0x20 = 0x20000; + gPlayerEntity.hVelocity = 0x20000; _0807673C: sub_08077F84(); SoundReq(SFX_PLY_VO4); @@ -67,10 +67,10 @@ void sub_08076758(ItemBehavior* this, u32 arg1) { ((gPlayerState.jumpStatus & 7) != 3)) { if (sub_08077EFC(this)) { if (this->stateID < 2) { - if ((gPlayerEntity.field_0x20 < 1) && ((gPlayerState.jumpStatus & 0x10) == 0)) { + if ((gPlayerEntity.hVelocity < 1) && ((gPlayerState.jumpStatus & 0x10) == 0)) { this->stateID = 2; gPlayerEntity.field_0x7a.HWORD = 2; - gPlayerEntity.field_0x20 = 0x20000; + gPlayerEntity.hVelocity = 0x20000; gPlayerState.jumpStatus |= 0x10; gPlayerState.field_0x8 = 0x288; SoundReq(SFX_172); diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 951ef527..c18178f2 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -72,9 +72,9 @@ void sub_0807564C(ItemBehavior* this, u32 arg1) { void sub_08075694(ItemBehavior* this, u32 arg1) { this->field_0x5[2] = 1; - if ((gPlayerState.flags.all & 0x8000000) != 0) { - gPlayerState.flags.all &= 0xf7ffffff; - gPlayerState.flags.all &= 0xfffbffff; + if ((gPlayerState.flags & 0x8000000) != 0) { + gPlayerState.flags &= 0xf7ffffff; + gPlayerState.flags &= 0xfffbffff; sub_08077DF4(this, 300); } else { gPlayerState.field_0xab = 1; @@ -86,7 +86,7 @@ void sub_08075694(ItemBehavior* this, u32 arg1) { gPlayerEntity.field_0x40 = 0x1e; gPlayerState.field_0x1a[1] |= 0x40; gPlayerState.field_0x1a[1] &= 0xdf; - if ((gPlayerState.field_0xa0[0] == 0x04) && ((gPlayerState.flags.all & 0x400000) == 0)) { + if ((gPlayerState.field_0xa0[0] == 0x04) && ((gPlayerState.flags & 0x400000) == 0)) { gPlayerState.field_0xa0[0] = 0x01; sub_0807A108(); } @@ -121,10 +121,10 @@ void sub_080758B0(ItemBehavior* this, u32 arg1) { ASM_FUNC("asm/non_matching/itemSword/sub_08075900.inc", void sub_08075900(ItemBehavior* this, u32 arg1)) void sub_080759B8(ItemBehavior* this, u32 arg1) { - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { gPlayerEntity.field_0x40 = 0; } - gPlayerState.flags.all &= 0xf7ffffff; + gPlayerState.flags &= 0xf7ffffff; gPlayerState.field_0x1a[1] = 0; gPlayerState.field_0x2c = NULL; sub_08077E78(this, arg1); diff --git a/src/itemMenuTable.c b/src/itemMenuTable.c new file mode 100644 index 00000000..04622c7a --- /dev/null +++ b/src/itemMenuTable.c @@ -0,0 +1,53 @@ +#include "global.h" + +typedef enum { + SWORD, + GUST_JAR, + CANE, + BOOMERANG, + SHIELD, + MOLE_MITTS, + LANTERN, + BOMBS, + PEGASUS_BOOTS, + ROCS_CAPE, + OCARINA, + BOW, + BOTTLE0, + BOTTLE1, + BOTTLE2, + BOTTLE3, + SAVE_BUTTON, +} ItemMenuTableSlot; + +typedef struct { + u8 up; + u8 down; + u8 left; + u8 right; + u8 type; + u8 unk0; + u8 x; + u8 y; +} ItemMenuTableEntry; + +const ItemMenuTableEntry gItemMenuTable[] = { + [SWORD] = { BOTTLE0, SHIELD, BOOMERANG, GUST_JAR, 0x01, 0x0c, 0x42, 0x33 }, + [GUST_JAR] = { BOTTLE1, MOLE_MITTS, SWORD, CANE, 0x01, 0x10, 0x66, 0x33 }, + [CANE] = { BOTTLE3, LANTERN, GUST_JAR, BOOMERANG, 0x01, 0x14, 0x8a, 0x33 }, + [BOOMERANG] = { SAVE_BUTTON, BOMBS, CANE, SWORD, 0x01, 0x15, 0xae, 0x33 }, + [SHIELD] = { SWORD, PEGASUS_BOOTS, BOMBS, MOLE_MITTS, 0x01, 0x16, 0x42, 0x4b }, + [MOLE_MITTS] = { GUST_JAR, ROCS_CAPE, SHIELD, LANTERN, 0x01, 0x17, 0x66, 0x4b }, + [LANTERN] = { CANE, OCARINA, MOLE_MITTS, BOMBS, 0x01, 0x00, 0x8a, 0x4b }, + [BOMBS] = { BOOMERANG, BOW, LANTERN, SHIELD, 0x01, 0x00, 0xae, 0x4b }, + [PEGASUS_BOOTS] = { SHIELD, BOTTLE0, BOW, ROCS_CAPE, 0x01, 0x00, 0x42, 0x63 }, + [ROCS_CAPE] = { MOLE_MITTS, BOTTLE1, PEGASUS_BOOTS, OCARINA, 0x01, 0x00, 0x66, 0x63 }, + [OCARINA] = { LANTERN, BOTTLE3, ROCS_CAPE, BOW, 0x01, 0x00, 0x8a, 0x63 }, + [BOW] = { BOMBS, SAVE_BUTTON, OCARINA, PEGASUS_BOOTS, 0x01, 0x00, 0xae, 0x63 }, + [BOTTLE0] = { PEGASUS_BOOTS, SWORD, SAVE_BUTTON, BOTTLE1, 0x01, 0x00, 0x42, 0x7b }, + [BOTTLE1] = { ROCS_CAPE, GUST_JAR, BOTTLE0, BOTTLE2, 0x01, 0x00, 0x5a, 0x7b }, + [BOTTLE2] = { ROCS_CAPE, GUST_JAR, BOTTLE1, BOTTLE3, 0x01, 0x00, 0x72, 0x7b }, + [BOTTLE3] = { OCARINA, CANE, BOTTLE2, SAVE_BUTTON, 0x01, 0x00, 0x8a, 0x7b }, + [SAVE_BUTTON] = { BOW, BOOMERANG, BOTTLE3, BOTTLE0, 0x03, 0x00, 0xb5, 0x75 }, + { BOW, BOOMERANG, BOTTLE3, BOTTLE0, 0x05, 0x00, 0xb5, 0x75 }, +}; @@ -80,8 +80,8 @@ void AgbMain(void) { gMain.ticks++; sScreenHandlers[gMain.screen](); - MessageUpdate(); - sub_08050154(); + MessageMain(); + UpdateFade(); SoundLoop(); break; } @@ -191,7 +191,7 @@ NONMATCH("asm/non_matching/sub_080560B8.inc", static void sub_080560B8(void)) { case -1: default: MemCopy(&sDefaultSettings, (void*)0x2000000, 16); - Write_02000000(gUnk_02000000); + Write_02000000(gSaveHeader); break; } } @@ -211,14 +211,13 @@ END_NONMATCH u32 sub_08056134(void) { #ifdef EU - if ((gUnk_02000000->signature != SIGNATURE) || (gUnk_02000000->saveFileId >= NUM_SAVE_SLOTS) || - (gUnk_02000000->messageSpeed >= MAX_MSG_SPEED) || (gUnk_02000000->brightnessPref >= MAX_BRIGHTNESS) || - (gUnk_02000000->gameLanguage <= GAME_LANGUAGE) || (gUnk_02000000->gameLanguage >= 7) || - (gUnk_02000000->_e != 0)) + if ((gSaveHeader->signature != SIGNATURE) || (gSaveHeader->saveFileId >= NUM_SAVE_SLOTS) || + (gSaveHeader->messageSpeed >= MAX_MSG_SPEED) || (gSaveHeader->brightnessPref >= MAX_BRIGHTNESS) || + (gSaveHeader->gameLanguage <= GAME_LANGUAGE) || (gSaveHeader->gameLanguage >= 7) || (gSaveHeader->_e != 0)) #else - if ((gUnk_02000000->signature != SIGNATURE) || (gUnk_02000000->saveFileId >= NUM_SAVE_SLOTS) || - (gUnk_02000000->messageSpeed >= MAX_MSG_SPEED) || (gUnk_02000000->brightnessPref >= MAX_BRIGHTNESS) || - (gUnk_02000000->gameLanguage != GAME_LANGUAGE) || (gUnk_02000000->_e != 0)) + if ((gSaveHeader->signature != SIGNATURE) || (gSaveHeader->saveFileId >= NUM_SAVE_SLOTS) || + (gSaveHeader->messageSpeed >= MAX_MSG_SPEED) || (gSaveHeader->brightnessPref >= MAX_BRIGHTNESS) || + (gSaveHeader->gameLanguage != GAME_LANGUAGE) || (gSaveHeader->_e != 0)) #endif return FALSE; diff --git a/src/manager/manager1.c b/src/manager/manager1.c index 200fc720..59a9373f 100644 --- a/src/manager/manager1.c +++ b/src/manager/manager1.c @@ -17,10 +17,10 @@ void Manager1_Main(Entity* this) { u8* pbVar2; gUnk_08107C5C[this->action](this); - gUnk_08107C48[((u8*)&this->field_0x20)[1]](this); - bVar1 = gUnk_08107C40[((u8*)&this->field_0x20)[1]]; - if ((bVar1 != 0) && (*(u8*)&this->field_0x20 != bVar1)) { - ((u8*)&this->field_0x20)[0] = bVar1; + gUnk_08107C48[((u8*)&this->hVelocity)[1]](this); + bVar1 = gUnk_08107C40[((u8*)&this->hVelocity)[1]]; + if ((bVar1 != 0) && (*(u8*)&this->hVelocity != bVar1)) { + ((u8*)&this->hVelocity)[0] = bVar1; LoadGfxGroup(bVar1); } } @@ -28,9 +28,9 @@ void Manager1_Main(Entity* this) { void sub_080570B8(Entity* this) { u8* pbVar1; - LoadGfxGroup(((u8*)&this->field_0x20)[0]); + LoadGfxGroup(((u8*)&this->hVelocity)[0]); this->height.WORD = 0; - pbVar1 = ((u8*)&this->field_0x20 + 1); + pbVar1 = ((u8*)&this->hVelocity + 1); if (*pbVar1 == 3) { gScreen.affine.bg3Updated = 1; } else { @@ -46,9 +46,9 @@ void sub_080570F8(void) { void sub_08057118(Entity* this) { this->actionDelay = 0; - *(u8*)&this->field_0x20 = 0; - ((u8*)&this->field_0x20)[1] = 0; - ((u8*)&this->field_0x20)[2] = 0; + *(u8*)&this->hVelocity = 0; + ((u8*)&this->hVelocity)[1] = 0; + ((u8*)&this->hVelocity)[2] = 0; this->action = 1; gScreen.affine.bg3Control = 0x1e04; gScreen.lcd.displayControl |= 0x800; diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 24b214b5..b0ce0828 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -253,8 +253,6 @@ void sub_0805A664(Manager15* this) { sub_0805A68C(this); } -extern u32 CheckPlayerProximity(u32, u32, u32, u32); - void sub_0805A68C(Manager15* this) { if (CheckPlayerProximity(this->unk_38 - 0x18, this->unk_3a - 0x18, 0x30, 0x30)) { if (this->unk_2c <= 0x1007) { diff --git a/src/manager/manager1A.c b/src/manager/manager1A.c index 2b4027a2..838fd898 100644 --- a/src/manager/manager1A.c +++ b/src/manager/manager1A.c @@ -32,7 +32,6 @@ void Manager1A_Main(Manager1A* this) { } extern void sub_08052D74(void*, void*, void*); -extern u32 CheckPlayerProximity(u32, u32, u32, u32); typedef struct struct_08108764 { u8 unk_00; @@ -140,9 +139,9 @@ void sub_0805B168(Manager1A* this) { u32 sub_0805B1CC(Manager1A* this) { u32 re = 0; if (CheckPlayerProximity(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) { - if ((gPlayerState.flags.all & 0x4) && (gPlayerState.flags.all & 0x1)) { - gPlayerState.flags.all |= 0x8000; - } else if (gPlayerState.flags.all & 0x8000) { + if ((gPlayerState.flags & 0x4) && (gPlayerState.flags & 0x1)) { + gPlayerState.flags |= 0x8000; + } else if (gPlayerState.flags & 0x8000) { re = 1; } } @@ -158,7 +157,7 @@ void sub_0805B210(Manager1A* this) { gScreenTransition.areaID = tmp->unk_01; gScreenTransition.roomID = tmp->unk_02; gScreenTransition.playerLayer = tmp->unk_03; - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { gScreenTransition.field_0xf = 6; } else { gScreenTransition.field_0xf = 2; diff --git a/src/manager/manager26.c b/src/manager/manager26.c index 6fa80711..96d0d270 100644 --- a/src/manager/manager26.c +++ b/src/manager/manager26.c @@ -76,7 +76,7 @@ void sub_0805C7C4(Manager26* this) { } void sub_0805C7CC(Manager26* this) { - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x10) { this->manager.unk_0d = 1; } else { diff --git a/src/manager/manager3.c b/src/manager/manager3.c index 5652ad89..99884daa 100644 --- a/src/manager/manager3.c +++ b/src/manager/manager3.c @@ -7,6 +7,7 @@ #include "random.h" #include "audio.h" #include "object.h" +#include "functions.h" // Facilitates the usage of minish portals. @@ -25,10 +26,9 @@ typedef struct { } Manager3; extern s8 gUnk_08107C6C[]; -extern u32 CheckPlayerProximity(u32, u32, u32, u32); extern u32 sub_08057810(void); extern u32 sub_080002C0(u16, u16, u8); -extern void sub_080577AC(u32, u32, u32); +extern void CreateMagicSparkles(u32, u32, u32); void Manager3_Main(Manager3* this) { s8 tmp; @@ -47,7 +47,7 @@ void Manager3_Main(Manager3* this) { gArea.field_0x18 = 1; gArea.curPortalType = 5; } else { - if ((gPlayerState.flags.all & 0x20) && gPlayerState.jumpStatus == 0) { + if ((gPlayerState.flags & 0x20) && gPlayerState.jumpStatus == 0) { gArea.field_0x18 = 2; } else { if (sub_08057810()) { @@ -55,11 +55,11 @@ void Manager3_Main(Manager3* this) { } } if (sub_080002C0(this->unk_38, this->unk_3a, this->manager.unk_0e) == 0x3d) { - sub_080577AC(this->unk_38 + gRoomControls.roomOriginX, this->unk_3a + gRoomControls.roomOriginY, - this->manager.unk_0e); + CreateMagicSparkles(this->unk_38 + gRoomControls.roomOriginX, this->unk_3a + gRoomControls.roomOriginY, + this->manager.unk_0e); if (!this->manager.unk_0f) { this->manager.unk_0f = 1; - SoundReq(SFX_152); + SoundReq(SFX_NEAR_PORTAL); } } } @@ -69,15 +69,15 @@ void Manager3_Main(Manager3* this) { } } -void sub_080577AC(u32 baseX, u32 baseY, u32 layer) { +void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) { u32 r; int offsetX, offsetY; Entity* spark; r = Random(); - if ((r & 0x7) != 0) + if (r & 0x7) return; spark = CreateObject(SPECIAL_FX, 0x26, 0); - if (!spark) + if (spark == NULL) return; offsetX = (r >> 0x8) & 0xF; offsetY = ((r >> 0x10) & 0xF); @@ -94,7 +94,7 @@ void sub_080577AC(u32 baseX, u32 baseY, u32 layer) { } u32 sub_08057810(void) { - if ((gPlayerState.flags.all & 0x80) && !gPlayerState.field_0xaa && (gArea.curPortalType != 0x6) && + if ((gPlayerState.flags & 0x80) && !gPlayerState.field_0xaa && (gArea.curPortalType != 0x6) && (gPlayerState.heldObject == 0)) { switch (gPlayerState.field_0xa8) { case 0: diff --git a/src/manager/manager37.c b/src/manager/manager37.c index 35003011..c05425b0 100644 --- a/src/manager/manager37.c +++ b/src/manager/manager37.c @@ -79,13 +79,13 @@ void sub_0805DF4C(Manager* this) { if (--this->unk_0e == 0) { this->action = 3; this->unk_0e = 0x1e; - TextboxNoOverlapFollow(0x164f); + MessageFromTarget(0x164f); } } } void sub_0805DF98(Manager* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { if (this->unk_0e != 0) { this->unk_0e -= 1; } else { diff --git a/src/manager/manager39.c b/src/manager/manager39.c index d6018b42..d607b3c2 100644 --- a/src/manager/manager39.c +++ b/src/manager/manager39.c @@ -37,7 +37,7 @@ void sub_0805E1F8(u32, u32); void Manager39_Main(Manager39* this) { gUnk_08108E28[this->manager.action](this); - if ((gRoomControls.roomID != this->unk_20) || (gTextBox.doTextBox & 0x7F)) { + if ((gRoomControls.roomID != this->unk_20) || (gMessage.doTextBox & 0x7F)) { sub_0805E1D8(this); } } diff --git a/src/manager/manager6.c b/src/manager/manager6.c index 7c7f3cfb..d2a8fc66 100644 --- a/src/manager/manager6.c +++ b/src/manager/manager6.c @@ -18,7 +18,7 @@ void Manager6_Main(Manager6* this) { for (i = this->warpList; i->posX != 0xFFFF; i++) { tmp = (i->unk_07.all & 0x3); if (((tmp & (gPlayerEntity.collisionLayer)) != 0) && - (((gPlayerState.flags.all & 0x80) != 0) || ((i->unk_07.b.unk2) != 0)) && + (((gPlayerState.flags & 0x80) != 0) || ((i->unk_07.b.unk2) != 0)) && (CheckPlayerInRegion(i->posX, i->posY, i->width, i->height) != 0) && (gPlayerEntity.height.HALF.HI == 0)) { DoExitTransition(GetCurrentRoomProperty(i->unk_06)); diff --git a/src/manager/managerA.c b/src/manager/managerA.c index 3eaef479..456b087d 100644 --- a/src/manager/managerA.c +++ b/src/manager/managerA.c @@ -49,7 +49,7 @@ void sub_080585DC(ManagerA*); void sub_08058408(ManagerA* this) { u32 tmp2; - tmp2 = (gPlayerState.flags.all & 0x08); + tmp2 = (gPlayerState.flags & 0x08); if (tmp2 != 0) return; if (!CheckPlayerInRegion(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) @@ -59,7 +59,7 @@ void sub_08058408(ManagerA* this) { return; case 2: sub_080585DC(this); - if ((gPlayerState.flags.all & 0x80) == 0) + if ((gPlayerState.flags & 0x80) == 0) return; case 0: default: @@ -118,7 +118,7 @@ extern void UnfreezeTime(void); void sub_08058514(ManagerA* this) { switch (this->manager.unk_0d) { case 1: - if ((gPlayerState.flags.all & 0x1235) != 0) + if ((gPlayerState.flags & 0x1235) != 0) return; if (gPlayerEntity.height.HALF.HI != 0) return; diff --git a/src/manager/managerF.c b/src/manager/managerF.c index 97d732f7..69f8c369 100644 --- a/src/manager/managerF.c +++ b/src/manager/managerF.c @@ -9,6 +9,7 @@ #include "textbox.h" #include "script.h" #include "utils.h" +#include "tiles.h" void sub_08058ECC(ManagerF*); @@ -335,14 +336,14 @@ void sub_0805930C(ManagerF* this) { } void SetDirtTile(u32 tile) { - SetTileType(0x1d, tile, 1); + SetTileType(CUT_GRASS, tile, 1); SetTileType(0, tile, 2); SetTileType(0, tile - 0x40, 2); } void sub_08059368(ManagerF* this) { this->manager.action = 1; - if (this->unk_3c == gCurrentTextBox._28) { + if (this->unk_3c == gTextRender.curToken.textIndex) { SetFlag(this->unk_3e); DeleteThisEntity(); } @@ -359,7 +360,7 @@ void sub_0805938C(ManagerF* this) { } u32 sub_080593CC(ManagerF* this) { - if (!(gPlayerState.flags.all & 0x80) && gPlayerState.swimState != 0 && gPlayerEntity.animationState == 0 && + if (!(gPlayerState.flags & 0x80) && gPlayerState.swimState != 0 && gPlayerEntity.animationState == 0 && (gPlayerState.field_0x90.HALF.LO & 0xF00) == 0x400) { return sub_0806FCB8(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6); } diff --git a/src/npc/beedle.c b/src/npc/beedle.c index b4d25858..55d54a01 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -53,14 +53,14 @@ void sub_08063314(Entity* this) { InitializeAnimation(this, offset); } if (this->interactType != '\0') { - TextboxNoOverlapFollow(this->actionDelay + 0xA01); + MessageFromTarget(this->actionDelay + 0xA01); this->action++; } sub_0806ED78(this); } void sub_0806336C(Entity* this) { - if ((gTextBox.doTextBox & 0x7F) == 0) { + if ((gMessage.doTextBox & 0x7F) == 0) { this->action++; InitializeAnimation(this, 8); } diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 611f6b24..d5320463 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -34,7 +34,6 @@ 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); @@ -185,7 +184,7 @@ void sub_0806D274(Entity* this) { case 0: case 1: default: - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->frameIndex = 2; break; } diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 37067485..d6069c99 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -9,6 +9,7 @@ #include "npc.h" #include "audio.h" #include "functions.h" +#include "effects.h" extern void (*gUnk_081115C0[])(Entity*); extern void (*gUnk_081115D0[])(Entity*); @@ -86,7 +87,7 @@ void sub_08068A4C(Entity* this) { if (this->interactType != 0) { this->interactType = 0; this->action = 2; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } } @@ -165,7 +166,7 @@ void sub_08068BD0(Entity* this) { void sub_08068BEC(Entity* this, u32 unused) { Entity* target; - target = CreateFx(this, 0x44, 0); + target = CreateFx(this, FX_WHITE_SPLASH, 0); if (target) { target->spritePriority.b0 = 1; PositionRelative(this, target, 0, -0x100000); @@ -306,42 +307,42 @@ switchD_08068d12_caseD_0: // Introduction dialoague void sub_08068DB8(Entity* this) { - TextboxNoOverlap(gUnk_08111664[this->actionDelay], this); + MessageNoOverlap(gUnk_08111664[this->actionDelay], this); } // Ask to teach dialoague void sub_08068DD0(Entity* this) { - TextboxNoOverlap(gUnk_0811167A[this->actionDelay], this); + MessageNoOverlap(gUnk_0811167A[this->actionDelay], this); } // Technique Dialogue void sub_08068DE8(Entity* this) { - TextboxNoOverlap(gUnk_08111690[this->actionDelay], this); + MessageNoOverlap(gUnk_08111690[this->actionDelay], this); } // Posession dialogue void sub_08068E00(Entity* this) { - TextboxNoOverlap(gUnk_081116A6[this->actionDelay], this); + MessageNoOverlap(gUnk_081116A6[this->actionDelay], this); } void sub_08068E18(Entity* this) { - TextboxNoOverlap(gUnk_081116BC[this->actionDelay], this); + MessageNoOverlap(gUnk_081116BC[this->actionDelay], this); } void sub_08068E30(Entity* this) { - TextboxNoOverlap(gUnk_081116D2[this->actionDelay], this); + MessageNoOverlap(gUnk_081116D2[this->actionDelay], this); } void sub_08068E48(Entity* this) { - TextboxNoOverlap(gUnk_081116E8[this->actionDelay], this); + MessageNoOverlap(gUnk_081116E8[this->actionDelay], this); } void sub_08068E60(Entity* this) { - TextboxNoOverlap(gUnk_081116FE[this->actionDelay], this); + MessageNoOverlap(gUnk_081116FE[this->actionDelay], this); } void sub_08068E78(Entity* this) { - TextboxNoOverlap(gUnk_08111714[this->actionDelay], this); + MessageNoOverlap(gUnk_08111714[this->actionDelay], this); } void sub_08068E90(Entity* this) { diff --git a/src/npc/brocco.c b/src/npc/brocco.c index 46ec7aa5..e38053fa 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -34,7 +34,7 @@ void sub_0806355C(Entity* 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; + u8 tmp = gMessage.doTextBox & 0x7f; if (tmp == 0) { this->action = 1; this->field_0xf = tmp; diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index 9b1e5606..aa070e14 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -77,7 +77,7 @@ void sub_080672C8(Entity* this) { tmp = CheckGlobalFlag(TABIDACHI); dialog = BOOLCAST(tmp); } - TextboxNoOverlap(gUnk_08110CE8[(dialog * 2 + this->type * 6) / 2], this); + MessageNoOverlap(gUnk_08110CE8[(dialog * 2 + this->type * 6) / 2], this); } void sub_08067304(Entity* this) { diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index 425dd203..bf2289c8 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -80,7 +80,7 @@ NONMATCH("asm/non_matching/castleMaid/sub_08064570.inc", void sub_08064570(Entit } break; case 2: - if ((gTextBox.doTextBox & 0x7f) != 0) { + if ((gMessage.doTextBox & 0x7f) != 0) { return; } this->action = 1; @@ -111,7 +111,7 @@ void sub_0806464C(Entity* this) { } else { tmp = 1; } - TextboxNoOverlap(gUnk_0810F88C[tmp], this); + MessageNoOverlap(gUnk_0810F88C[tmp], this); } void sub_08064688(Entity* this) { diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c index 5e1861e7..390e86a1 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -2,6 +2,7 @@ #include "script.h" #include "functions.h" #include "flags.h" +#include "effects.h" extern Hitbox gUnk_08110E94; @@ -87,7 +88,7 @@ void sub_08067534(Entity* this) { Entity* entity; s32 i; for (i = 0; i < 2; ++i) { - entity = CreateFx(this, 2, 0); + entity = CreateFx(this, FX_DEATH, 0); if (entity != NULL) { entity->x.HALF.HI += gUnk_08110E64[i]; entity->y.HALF.HI += 0x1c; diff --git a/src/npc/cat.c b/src/npc/cat.c index b08369a0..30160f98 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -151,7 +151,7 @@ void sub_0806797C(Entity* this) { void sub_0806799C(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { sub_08067B08(this); sub_0805E3A0(this, 1); } @@ -272,7 +272,7 @@ void sub_08067C44(Entity* this) { s32 iVar4; u32 uVar5; - uVar5 = -((s32) - (gPlayerState.flags.all & 0x80) >> 0x1f); + uVar5 = -((s32) - (gPlayerState.flags & 0x80) >> 0x1f); if (uVar5 != this->field_0x68.HALF.HI) { if (uVar5 == 0) { sub_08078778(this); diff --git a/src/npc/cow.c b/src/npc/cow.c index 411b139f..0a1ec389 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -181,7 +181,7 @@ void Cow_ShowDialogue(Entity* ent) { void sub_0806920C(Entity* ent) { // TODO: figure out what bitfield flag this is - u32 var0 = gPlayerState.flags.all & 0x80; + u32 var0 = gPlayerState.flags & 0x80; u32 var1 = -var0 >> 0x1F; if (var1 != ent->field_0x6c.HALF.HI) { @@ -200,7 +200,7 @@ void sub_0806924C(Entity* ent) { s8 itype = ent->interactType; if (itype != 0) { // TODO: figure out what bitfield flag this is - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { if (itype == 2) { ent->action = 4; sub_0806F118(ent); diff --git a/src/npc/cucco.c b/src/npc/cucco.c index abfe0904..37d3efb4 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -59,7 +59,7 @@ void sub_0806E648(Entity* this) { void sub_0806E65C(Entity* this) { if (this->interactType != 0) { - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { if (this->interactType == 2) { this->action = 4; sub_0806F118(this); diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index a1963b41..faf90f6e 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -53,7 +53,7 @@ void sub_0806E824(Entity* this) { void sub_0806E838(Entity* this) { if (this->interactType != 0) { - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { if (this->interactType == 2) { this->action = 3; sub_0806F118(this); @@ -69,7 +69,7 @@ void sub_0806E838(Entity* this) { } void sub_0806E884(Entity* this) { - TextboxNoOverlap(0xdb6, this); + MessageNoOverlap(0xdb6, this); } void CuccoChick_Fusion(Entity* this) { @@ -79,7 +79,7 @@ void CuccoChick_Fusion(Entity* this) { this->frameIndex = 1; } else { if (sub_08003FC4(this, 0x3000) == 0) { - this->field_0x20 = 0x10000; + this->hVelocity = 0x10000; } } } diff --git a/src/npc/dampe.c b/src/npc/dampe.c index 6293bcd7..f42e3cce 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -66,7 +66,7 @@ void sub_0806BE84(Entity* this, ScriptExecutionContext* context) { if (GetInventoryValue(0x3C) >= 2) { msgIndex = 2; } - TextboxNoOverlap(gUnk_08113344[msgIndex], this); + MessageNoOverlap(gUnk_08113344[msgIndex], this); } void sub_0806BEC8(Entity* this, ScriptExecutionContext* context) { @@ -83,7 +83,7 @@ void sub_0806BEC8(Entity* this, ScriptExecutionContext* context) { msgIndex = 2; } - TextboxNoOverlap(gUnk_0811334A[msgIndex], this); + MessageNoOverlap(gUnk_0811334A[msgIndex], this); } void sub_0806BEFC() { diff --git a/src/npc/din.c b/src/npc/din.c index ec340fb1..d17d1dea 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -5,8 +5,6 @@ #include "functions.h" #include "save.h" -extern u32 sub_08002632(Entity*); - void Din(Entity* this) { switch (this->action) { case 0: diff --git a/src/npc/dog.c b/src/npc/dog.c index 6f9ed898..7f312ff4 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -71,7 +71,7 @@ void sub_08069B44(Entity* this) { if ((this->flags & 2) != 0) { sub_0807DD50(this); } - if (((this->type == 0) && ((gPlayerState.flags.all & 0x80) == 0)) && (GetInventoryValue(0x36) != 2)) { + if (((this->type == 0) && ((gPlayerState.flags & 0x80) == 0)) && (GetInventoryValue(0x36) != 2)) { this->action = 4; } #if defined(JP) || defined(EU) || defined(DEMO_JP) @@ -87,7 +87,7 @@ void sub_08069B44(Entity* this) { void sub_08069C40(Entity* this) { UpdateAnimationSingleFrame(this); if (sub_08069F90(this) != 0) { - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { sub_08069CB8(this); } else { this->animationState = GetAnimationState(this); @@ -282,14 +282,14 @@ u32 sub_08069F90(Entity* this) { } void sub_08069FBC(Entity* this) { - u32 tmp = (gPlayerState.flags.all & 0x80) != 0 ? 0x24 : 0x20; + u32 tmp = (gPlayerState.flags & 0x80) != 0 ? 0x24 : 0x20; if ((this->animationState == 1) || (this->animationState == 3)) { this->field_0x6a.HALF.HI = tmp; } } void sub_08069FE8(Entity* this) { - u32 tmp = -((s32) - (gPlayerState.flags.all & 0x80) >> 0x1f); + u32 tmp = -((s32) - (gPlayerState.flags & 0x80) >> 0x1f); if (tmp != this->field_0x6a.HALF.LO) { if (tmp == 0) { sub_08078778(this); @@ -302,7 +302,7 @@ void sub_08069FE8(Entity* this) { void sub_0806A028(Entity* this) { if (this->interactType != 0) { - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { if (this->interactType == 2) { this->action = 6; sub_0806F118(this); @@ -326,7 +326,7 @@ void sub_0806A080(Entity* this) { void sub_0806A0A4(Entity* this) { s32 dialog; - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { dialog = 4; #if defined(JP) || defined(EU) || defined(DEMO_JP) if (CheckLocalFlag(0xcc) == 0) { @@ -364,12 +364,12 @@ void sub_0806A0A4(Entity* this) { } } } - TextboxNoOverlap(gUnk_08111F74[(u32)gSave.unk8 * 5 + dialog], this); + MessageNoOverlap(gUnk_08111F74[(u32)gSave.unk8 * 5 + dialog], this); } void sub_0806A144(Entity* this) { s32 dialog = 4; - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { dialog = 3; if ((GetInventoryValue(0x46) == 0) && (CheckGlobalFlag(0x29) != 0)) { if (CheckLocalFlag(0x85) == 0) { @@ -379,7 +379,7 @@ void sub_0806A144(Entity* this) { } } } - TextboxNoOverlap(gUnk_08111FD8[dialog], this); + MessageNoOverlap(gUnk_08111FD8[dialog], this); } void Dog_Fusion(Entity* this) { diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index 65863d72..9a99a651 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -77,7 +77,7 @@ void sub_0806C038(Entity* this) { } } } - TextboxNoOverlap(gUnk_081133A4[index], this); + MessageNoOverlap(gUnk_081133A4[index], this); } void sub_0806C09C(Entity* this) { diff --git a/src/npc/epona.c b/src/npc/epona.c index 1846d4f9..4c0abc0f 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -38,7 +38,7 @@ void sub_08065A00(Entity* this) { } void sub_08065A10(Entity* this) { - if ((gTextBox.doTextBox & 0x7F) == 0) { + if ((gMessage.doTextBox & 0x7F) == 0) { this->action = 1; InitAnimationForceUpdate(this, this->animationState / 2); } @@ -58,7 +58,7 @@ void sub_08065A50(Entity* this) { void sub_08065A64(Entity* this) { u32 uVar2; - uVar2 = -(gPlayerState.flags.all & 0x80) >> 0x1f; + uVar2 = -(gPlayerState.flags & 0x80) >> 0x1f; if (uVar2 != this->field_0x68.HALF.HI) { if (uVar2 == 0) { sub_08078778(this); @@ -71,7 +71,7 @@ void sub_08065A64(Entity* this) { void sub_08065AA4(Entity* this) { if (this->interactType != 0) { - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { if (this->interactType == 2) { this->action = 4; sub_0806F118(this); diff --git a/src/npc/ezloCap.c b/src/npc/ezloCap.c index 6f1a16bd..3133fc00 100644 --- a/src/npc/ezloCap.c +++ b/src/npc/ezloCap.c @@ -3,6 +3,7 @@ #include "script.h" #include "audio.h" #include "functions.h" +#include "effects.h" const u8 gUnk_08114134[]; const u8 gUnk_08114144[]; @@ -55,7 +56,7 @@ void sub_0806D944(Entity* this) { // Ezlo Angry FX void sub_0806D96C(Entity* this) { - Entity* fx = CreateFx(this, 0x42, 0); + Entity* fx = CreateFx(this, FX_STEAM_EFC, 0); if (fx != NULL) { fx->spritePriority.b0 = 1; PositionRelative(this, fx, 0, 0xFFE80000); diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index e42500e8..48c5f42d 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -149,7 +149,7 @@ void sub_080601D4(Entity* this) { temp = CheckKinstoneFused(0x17); uVar2 = BOOLCAST(temp); } - TextboxNoOverlap(gUnk_0810A354[uVar2], this); + MessageNoOverlap(gUnk_0810A354[uVar2], this); } void sub_08060208(Entity* this) { @@ -197,7 +197,7 @@ void sub_08060270(Entity* this) { SetLocalFlag(0x76); } } - TextboxNoOverlap(gUnk_0810A35A[index], this); + MessageNoOverlap(gUnk_0810A35A[index], this); } void sub_080602BC(Entity* this) { @@ -213,7 +213,7 @@ void sub_080602BC(Entity* this) { index = 0; } } - TextboxNoOverlap(gUnk_0810A362[index], this); + MessageNoOverlap(gUnk_0810A362[index], this); } void sub_0806030C(Entity* this, ScriptExecutionContext* context) { diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index afdc774f..fddefb9c 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -115,7 +115,7 @@ void sub_08065F20(Entity* this) { UpdateAnimationSingleFrame(this); if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); this->animIndex += 1; if (gSpriteAnimations_GhostBrothers[this->animIndex] == 0) { this->animIndex = 0; diff --git a/src/npc/gorman.c b/src/npc/gorman.c index 861a29d8..8c45efdc 100644 --- a/src/npc/gorman.c +++ b/src/npc/gorman.c @@ -99,7 +99,7 @@ void sub_08069888(Entity* this) { } else { index = 5; } - TextboxNoOverlap(gUnk_08111C50[index], this); + MessageNoOverlap(gUnk_08111C50[index], this); } ASM_FUNC("asm/non_matching/gorman/sub_0806991C.inc", void sub_0806991C(Entity* this, ScriptExecutionContext* context)) diff --git a/src/npc/goron.c b/src/npc/goron.c index 46a6e940..a2498d86 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -3,6 +3,7 @@ #include "functions.h" #include "textbox.h" #include "script.h" +#include "effects.h" extern void (*gUnk_08111A80[])(Entity*); extern void (*gUnk_08111A8C[])(Entity*); @@ -40,13 +41,13 @@ void sub_08069328(Entity* this) { this->action = 2; sub_0805E47C(this); InitAnimationForceUpdate(this, 8); - TextboxNoOverlapFollow(this->actionDelay + (0x90 << 5)); + MessageFromTarget(this->actionDelay + (0x90 << 5)); } } void sub_08069390(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gTextBox.doTextBox & 0x7F) == 0) { + if ((gMessage.doTextBox & 0x7F) == 0) { this->action = 1; this->interactType = 0; sub_0805E584(this); @@ -79,13 +80,13 @@ void sub_080693D0(Entity* this) { } void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65) { - Entity* fx = CreateFx(this, 4, 0); + Entity* fx = CreateFx(this, FX_ROCK, 0); if (fx) { PositionRelative(this, fx, offsetX, 0xFFF00000); ResolveEntityOnTop(this, fx); } if (createFx65 != 0) { - fx = CreateFx(this, 65, 0); + fx = CreateFx(this, FX_REFLECT4, 0); if (fx) { PositionRelative(this, fx, offsetX, 0xFFF00000); ResolveEntityOnTop(this, fx); diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index ca41b899..f081cead 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -52,9 +52,9 @@ void sub_080695AC(Entity* this) { void sub_080695E8(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; - this->interactType = gTextBox.doTextBox & 0x7f; + this->interactType = gMessage.doTextBox & 0x7f; sub_0805E584(this); InitAnimationForceUpdate(this, this->animationState); } @@ -80,8 +80,8 @@ void sub_08069654(Entity* this) { void sub_08069660(Entity* this) { u32 uVar1; - TextboxNoOverlap(0x2c1c, this); - gTextBox.field_0x10 = (u16)GoronMerchant_GetSalePrice(this); + MessageNoOverlap(0x2c1c, this); + gMessage.field_0x10 = (u16)GoronMerchant_GetSalePrice(this); } void sub_08069684(void) { @@ -142,11 +142,11 @@ void GoronMerchant_TryToBuyKinstone(Entity* this, ScriptExecutionContext* contex gRoomVars.field_0x7 = 0; context->condition = 1; } else { - TextboxNoOverlap(0x2c1f, this); + MessageNoOverlap(0x2c1f, this); context->condition = 0; } } else { - TextboxNoOverlap(0x2c1e, this); + MessageNoOverlap(0x2c1e, this); context->condition = 0; } gActiveScriptInfo.flags = gActiveScriptInfo.flags | 1; diff --git a/src/npc/guard.c b/src/npc/guard.c index 7e9b0034..736625cd 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -85,8 +85,8 @@ void sub_08063DC8(Entity* this) { InitAnimationForceUpdate(this, this->animationState + 4); } else { sub_0806EE20(this); - if (this->field_0x3e != this->animationState) { - this->animationState = this->field_0x3e; + if (this->knockbackDirection != this->animationState) { + this->animationState = this->knockbackDirection; InitializeAnimation(this, this->animationState + 4); } else { GetNextFrame(this); @@ -107,7 +107,7 @@ void sub_08063E54(Entity* this) { } void sub_08063E6C(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; InitializeAnimation(this, this->animationState + 4); } @@ -160,7 +160,7 @@ void sub_08063F20(Entity* this) { } void sub_08063F78(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = this->action - 1; InitializeAnimation(this, (this->animationState >> 1) + 4 + *(s8*)&this->field_0x70); } diff --git a/src/npc/kid.c b/src/npc/kid.c index e4c4c80a..459e545d 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -70,7 +70,7 @@ void sub_08062130(Entity* this) { } void sub_08062194(Entity* this) { - TextboxNoOverlapFollow(0); + MessageFromTarget(0); this->action = 1; this->interactType = 0; } @@ -132,7 +132,7 @@ NONMATCH("asm/non_matching/kid/sub_080621AC.inc", void sub_080621AC(Entity* this break; case 2: GetNextFrame(this); - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; } break; @@ -203,13 +203,13 @@ END_NONMATCH NONMATCH("asm/non_matching/kid/sub_08062634.inc", void sub_08062634(Entity* this)) { u32 a = this->type2; u32 b = (Random() & 1); - TextboxNoOverlap(*((u16*)gUnk_0810BDE8 + b + a * 2), this); + MessageNoOverlap(*((u16*)gUnk_0810BDE8 + b + a * 2), this); } END_NONMATCH NONMATCH("asm/non_matching/kid/sub_0806265C.inc", void sub_0806265C(Entity* this, ScriptExecutionContext* context)) { if (gSave.unk8 == 0) { - TextboxNoOverlap(0, this); + MessageNoOverlap(0, this); } else { ShowNPCDialogue(this, &gUnk_0810BE10[this->type * 9 + gSave.unk8]); } diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index 714ed1f6..f296cd4b 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -90,7 +90,7 @@ void sub_0806673C(Entity* this) { } else { index = 3; } - TextboxNoOverlap(gUnk_081104F8[index], this); + MessageNoOverlap(gUnk_081104F8[index], this); } void KingDaltus_Fusion(Entity* this) { diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c index cd0d3722..97388682 100644 --- a/src/npc/kingGustaf.c +++ b/src/npc/kingGustaf.c @@ -16,12 +16,12 @@ void KingGustaf(Entity* this) { gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x1000; this->speed = 0x1000; - this->field_0x20 = 0; + this->hVelocity = 0; } else { sub_0807DD94(this, 0); speed = 0x100; speed *= this->speed; - speed += this->field_0x20; + speed += this->hVelocity; speed >>= 0x10; if (speed > 0x10) { speed = 0x10; diff --git a/src/npc/librari.c b/src/npc/librari.c index 992a920c..f5e1b629 100644 --- a/src/npc/librari.c +++ b/src/npc/librari.c @@ -55,7 +55,7 @@ void sub_0806B260(Entity* this, ScriptExecutionContext* context) { } else { index = 3; } - TextboxNoOverlap(gUnk_08112D48[index], this); + MessageNoOverlap(gUnk_08112D48[index], this); } extern u16 gUnk_08112D50[]; @@ -82,7 +82,7 @@ void sub_0806B2B4(Entity* this) { } else { index = 0; } - TextboxNoOverlap(gUnk_08112D50[index], this); + MessageNoOverlap(gUnk_08112D50[index], this); } void Librari_Fusion(Entity* this) { diff --git a/src/npc/librarians.c b/src/npc/librarians.c index f88ecc6d..9b134e7a 100644 --- a/src/npc/librarians.c +++ b/src/npc/librarians.c @@ -57,5 +57,5 @@ void sub_0806BBB0(Entity* this) { } else { tmp = 2; } - TextboxNoOverlap(gUnk_08113078[tmp], this); + MessageNoOverlap(gUnk_08113078[tmp], this); } diff --git a/src/npc/mailbox.c b/src/npc/mailbox.c index bab9a8ba..43b87eb8 100644 --- a/src/npc/mailbox.c +++ b/src/npc/mailbox.c @@ -2,6 +2,7 @@ #include "entity.h" #include "textbox.h" #include "functions.h" +#include "effects.h" extern void sub_08063280(); @@ -41,7 +42,7 @@ void sub_08063254(Entity* this, u32 unused) { sub_08063280(this, unused); if ((this->frames.all & 0x80) != 0) { this->action = 3; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } } @@ -58,5 +59,5 @@ void sub_08063280(Entity* this, u32 unused) { var = e->frames.all & 0x7F; e->frames.all ^= var; if (var == 2) - CreateFx(e, 49, 0); + CreateFx(e, FX_MAILBOX_UNUSED, 0); } diff --git a/src/npc/marcy.c b/src/npc/marcy.c index 35e66f8f..89937936 100644 --- a/src/npc/marcy.c +++ b/src/npc/marcy.c @@ -50,7 +50,7 @@ void sub_08062D18(Entity* this, ScriptExecutionContext* context) { tmp = 3; } - TextboxNoOverlap(gUnk_0810C34C[tmp], this); + MessageNoOverlap(gUnk_0810C34C[tmp], this); if (tmp == 0) { context->condition = TRUE; } else { diff --git a/src/npc/melari.c b/src/npc/melari.c index 1e911439..9f1df856 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -6,6 +6,7 @@ #include "random.h" #include "audio.h" #include "functions.h" +#include "effects.h" extern void sub_08068780(Entity*); extern s32 sub_0806EDD8(Entity*, u32, u32); @@ -49,7 +50,7 @@ void sub_08068730(Entity* this) { } if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(this->actionDelay + 0x1200); + MessageFromTarget(this->actionDelay + 0x1200); } } @@ -91,7 +92,7 @@ void sub_08068780(Entity* this) { } else { EnqueueSFX(gUnk_08111538[(s32)Random() % 3]); } - ent = CreateFx(this, 0x3d, 0x20); + ent = CreateFx(this, FX_STARS2, 0x20); if (ent != NULL) { PositionRelative(this, ent, 0x180000, -0xa0000); } diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index 5beb9499..6c3bfb29 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -92,7 +92,7 @@ void sub_08066904(Entity* this) { } else { index = 3; } - TextboxNoOverlap(gUnk_08110650[index], this); + MessageNoOverlap(gUnk_08110650[index], this); } void MinisterPotho_Fusion(Entity* this) { diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index b295b57d..fa4ab4c8 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -50,7 +50,7 @@ void sub_08067E88(Entity* this) { if (this->interactType != 0) { this->interactType = 0; this->action = 2; - TextboxNoOverlapFollow(this->actionDelay + 0x1200); + MessageFromTarget(this->actionDelay + 0x1200); } } @@ -86,7 +86,7 @@ NONMATCH("asm/non_matching/mountainMinish/sub_08068190.inc", void sub_08068190(E } // TODO unable to devide the array access variables by two without breaking everything - TextboxNoOverlap(gUnk_0811130E[uVar2 * 2 + uVar3 * 8], this); + MessageNoOverlap(gUnk_0811130E[uVar2 * 2 + uVar3 * 8], this); } END_NONMATCH diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index 5391ac8d..3f66dd26 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -60,7 +60,7 @@ void sub_080670B4(Entity* this) { uVar1 = CheckGlobalFlag(TABIDACHI); uVar2 = BOOLCAST(uVar1); } - TextboxNoOverlap(gUnk_08110C0C[uVar2], this); + MessageNoOverlap(gUnk_08110C0C[uVar2], this); } void sub_080670E4(Entity* this) { diff --git a/src/npc/npc23.c b/src/npc/npc23.c index 6320a7fe..fbb6e943 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -39,7 +39,7 @@ void sub_080662F8(Entity* this) { void sub_08066358(Entity* this) { if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); if ((this->type2 & 0x10) != 0) { this->action = 3; this->subAction = 0; diff --git a/src/npc/npc5.c b/src/npc/npc5.c index d64e5c77..f90e709b 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -392,7 +392,7 @@ NONMATCH("asm/non_matching/npc5/sub_08061170.inc", bool32 sub_08061170(Entity* t this->action = 6; tmp = (sub_08079FD4(this, 1) * 0x10 - 4); // tmp <<= 0xc; - this->field_0x20 = tmp; + this->hVelocity = tmp; this->speed = 0x100; this->direction = direction; this->animationState = direction >> 2; @@ -867,7 +867,7 @@ NONMATCH("asm/non_matching/npc5/sub_08061B18.inc", void sub_08061B18(Entity* thi if ((((Tmp**)&this->field_0x68))[++this->actionDelay]->unk_2 == 0) { this->actionDelay = 0; } - TextboxNoOverlap((u32)*puVar2, this); + MessageNoOverlap((u32)*puVar2, this); break; } } diff --git a/src/npc/npc9.c b/src/npc/npc9.c index 23a0bd3e..f0924a9b 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -30,13 +30,13 @@ void sub_08062B14(Entity* this) { void sub_08062B48(Entity* this) { GetNextFrame(this); if ((this->frames.b.f3) != 0) { - TextboxNoOverlapFollow(0xa01); + MessageFromTarget(0xa01); this->action++; } } void sub_08062B70(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { InitializeAnimation(this, 2); this->action = 1; sub_0805E584(this); diff --git a/src/npc/percy.c b/src/npc/percy.c index 5bd1fc37..16578b58 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -6,6 +6,7 @@ #include "flags.h" #include "script.h" #include "save.h" +#include "effects.h" extern void sub_0806B41C(Entity*); extern void sub_0806B3CC(Entity*); @@ -48,7 +49,7 @@ void sub_0806B3CC(Entity* this) { GetNextFrame(this); if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } sub_0806ED78(this); } @@ -63,7 +64,7 @@ void sub_0806B41C(Entity* this) { this->action = 1; this->spriteSettings.b.draw = 1; if (this->type2 == 2) { - CreateFx(this, 0x25, 0); + CreateFx(this, FX_SWEAT, 0); } sub_0807DD50(this); } @@ -106,7 +107,7 @@ void sub_0806B504(Entity* this) { SetLocalFlag(0x86); } - TextboxNoOverlap(gUnk_08112E54[idx], this); + MessageNoOverlap(gUnk_08112E54[idx], this); } void sub_0806B540(Entity* this) { @@ -115,7 +116,7 @@ void sub_0806B540(Entity* this) { context = *(ScriptExecutionContext**)&this->cutsceneBeh; switch (context->unk_18) { case 0: - TextboxNoOverlap(0x2312, this); + MessageNoOverlap(0x2312, this); if (CheckLocalFlag(0x3f) != 0) { return; } @@ -123,13 +124,13 @@ void sub_0806B540(Entity* this) { SetLocalFlag(0x3f); break; case 1: - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { context->unk_18 = 2; - TextboxNoOverlap(0x2315, this); + MessageNoOverlap(0x2315, this); } break; case 2: - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { context->unk_18 = 3; if (gSave.stats.filler3[0] != 0) { sub_080A7C18(0x58, 0, 0); diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index 73c99b40..f95ef7d3 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -109,10 +109,10 @@ void sub_0806E1FC(Entity* this) { void sub_0806E20C(void) { if (gScreenTransition.field_0x6 != 0) { - TextboxNoOverlapFollow(0x421f); - gTextBox.field_0x10 = gScreenTransition.field_0x6; + MessageFromTarget(0x421f); + gMessage.field_0x10 = gScreenTransition.field_0x6; } else { - TextboxNoOverlapFollow(0x4220); + MessageFromTarget(0x4220); } } diff --git a/src/npc/pina.c b/src/npc/pina.c index 0acf265f..53c31486 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -36,7 +36,7 @@ void sub_08063A98(Entity* 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; + u8 tmp = gMessage.doTextBox & 0x7f; if (tmp == 0) { this->action = 1; this->field_0xf = tmp; diff --git a/src/npc/pita.c b/src/npc/pita.c index ebd369bc..90c28687 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -61,7 +61,7 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) { tmp = sub_080028F4(gUnk_0810C435); tmp2 = gUnk_0810C43D[tmp]; sub_080A7C18(0x5c, tmp2, 1); - TextboxNoOverlap(0x3c05, this); + MessageNoOverlap(0x3c05, this); context->condition = TRUE; return TRUE; } diff --git a/src/npc/postman.c b/src/npc/postman.c index 40a482e4..8a378f79 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -9,6 +9,7 @@ #include "save.h" #include "script.h" #include "flags.h" +#include "effects.h" extern void sub_08060528(Entity*); extern void sub_0806EE04(Entity*, void*, u32); @@ -64,10 +65,10 @@ void sub_0806045C(Entity* this) { case 1: case 2: this->action = 2; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); break; default: - bVar1 = this->field_0x3e; + bVar1 = this->knockbackDirection; if (bVar1 != this->animationState) { this->animationState = bVar1; InitAnimationForceUpdate(this, 4 + bVar1); @@ -99,7 +100,7 @@ void sub_080604DC(Entity* this) { if (((u32)(this->spriteSettings.raw << 0x1e) >> 0x1e == 1) && sub_080040A8(this)) { if ((this->frames.all & 1) != 0) { this->frames.all &= 0xfe; - ent = CreateFx(this, 0x11, 0x40); + ent = CreateFx(this, FX_DASH, 0x40); if (ent != NULL) { ent->y.HALF.HI++; sub_0805E3A0(ent, 3); @@ -139,7 +140,7 @@ void sub_08060528(Entity* this) { break; case 2: UpdateAnimationSingleFrame(this); - if ((gTextBox.doTextBox & 0x7f) != 0) { + if ((gMessage.doTextBox & 0x7f) != 0) { break; } this->action = 1; @@ -155,7 +156,7 @@ void sub_08060528(Entity* this) { if (0 < (s16)this->field_0x6a.HWORD) { if ((s16)this->field_0x6a.HWORD > 0x12b) { this->field_0x6a.HWORD = 0; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; this->field_0x6c.HALF.HI = 1; sub_080788E0(this); EnqueueSFX(0x7c); @@ -164,7 +165,7 @@ void sub_08060528(Entity* this) { } } sub_08003FC4(this, 0x1800); - if (((this->field_0x6c.HALF.HI != 0) && (this->field_0x20 == 0)) && this->height.WORD == 0) { + if (((this->field_0x6c.HALF.HI != 0) && (this->hVelocity == 0)) && this->height.WORD == 0) { this->field_0x6c.HALF.HI = 0; sub_080606C0(this); } diff --git a/src/npc/rem.c b/src/npc/rem.c index 974640a1..cc172a52 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -302,7 +302,7 @@ void sub_0806AA18(Entity* this) { } else { index = 0x440d; } - TextboxNoOverlap(index, this); + MessageNoOverlap(index, this); } ASM_FUNC("asm/non_matching/rem/sub_0806AA50.inc", void sub_0806AA50(Entity* this, ScriptExecutionContext* context)) diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index a51772c1..eee7d9e8 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -20,7 +20,7 @@ void SmallTownMinish(Entity* this) { } else { sub_0807DD94(this, NULL); } - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { this->spriteSettings.b.draw = 1; } else { this->spriteSettings.b.draw = 0; diff --git a/src/npc/smith.c b/src/npc/smith.c index c15b1219..cdeff498 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -7,6 +7,7 @@ #include "npc.h" #include "audio.h" #include "functions.h" +#include "effects.h" extern void sub_08078850(Entity*, u32, u32, u32*); @@ -43,7 +44,7 @@ void Smith(Entity* this) { } if ((this->frames.all & 1) != 0) { this->frames.all &= 0xfe; - CreateFx(this, 0x3d, 0x20); + CreateFx(this, FX_STARS2, 0x20); SoundReq(gUnk_08110380[(Random() & 7)]); } } @@ -90,7 +91,7 @@ void sub_08066118(Entity* this) { } if (this->interactType != 0) { this->action = 2; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } } diff --git a/src/npc/stamp.c b/src/npc/stamp.c index 51b209b3..b983f9c5 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -3,6 +3,7 @@ #include "textbox.h" #include "functions.h" #include "script.h" +#include "effects.h" extern void sub_08062CA4(); @@ -40,13 +41,13 @@ void sub_08062C24(Entity* ent) { GetNextFrame(ent); if ((ent->frames.all & 128) != 0) { InitializeAnimation(ent, 4); - TextboxNoOverlapFollow(2561); + MessageFromTarget(2561); ent->action++; } } void sub_08062C54(Entity* ent) { - if ((gTextBox.doTextBox & 127) == 0) { + if ((gMessage.doTextBox & 127) == 0) { ent->action = 1; InitializeAnimation(ent, 0); sub_0805E584(ent); @@ -57,7 +58,7 @@ void sub_08062C7C(Entity* ent) { ent->action = 1; sub_0807DD64(ent); InitializeAnimation(ent, 0); - CreateFx(ent, 37, 0); + CreateFx(ent, FX_SWEAT, 0); sub_08062CA4(ent); } diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 3977a633..91e4a53c 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -42,8 +42,8 @@ ASM_FUNC("asm/non_matching/stockwell/sub_080650CC.inc", void sub_080650CC(Entity void sub_080651AC(Entity* this) { GetNextFrame(this); - if ((gTextBox.doTextBox & 0x7f) == 0) { - this->interactType = gTextBox.doTextBox & 0x7f; + if ((gMessage.doTextBox & 0x7f) == 0) { + this->interactType = gMessage.doTextBox & 0x7f; this->action = 1; InitializeAnimation(this, 4); } @@ -67,7 +67,7 @@ void sub_080651F8(Entity* this) { void sub_0806522C(Entity* this) { if (--this->actionDelay == 0) { ++this->subAction; - TextboxNoOverlap(0x2c16, this); + MessageNoOverlap(0x2c16, this); } } @@ -90,12 +90,12 @@ void sub_08065250(Entity* this) { void sub_0806528C(Entity* this) { if (--this->actionDelay == 0) { ++this->subAction; - TextboxNoOverlap(0x2c18, this); + MessageNoOverlap(0x2c18, this); } } void sub_080652B0(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->subAction += 1; this->actionDelay = 10; gRoomVars.greatFairyState = this->field_0xf; @@ -109,22 +109,22 @@ void sub_080652E4(Entity* this) { } else { if (gPlayerEntity.action != 8) { this->subAction += 1; - TextboxNoOverlap(0x2c19, this); + MessageNoOverlap(0x2c19, this); } } } void sub_08065314(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->subAction += 1; MenuFadeIn(3, 3); } } void sub_08065338(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; - this->subAction = gTextBox.doTextBox & 0x7f; + this->subAction = gMessage.doTextBox & 0x7f; gRoomVars.greatFairyState = this->field_0xf; InitializeAnimation(this, 4); } diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 7f2ce06b..0e317696 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -66,7 +66,7 @@ void sub_08064B44(Entity* this) { ASM_FUNC("asm/non_matching/sturgeon/sub_08064B88.inc", void sub_08064B88(Entity* this)) void sub_08064C2C(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; InitializeAnimation(this, (u32)this->field_0xf); } @@ -104,7 +104,7 @@ void sub_08064CD8(Entity* this) { flag = CheckLocalFlag(0x73); tmp = BOOLCAST(flag); } - TextboxNoOverlap(gUnk_0810FA54[tmp], this); + MessageNoOverlap(gUnk_0810FA54[tmp], this); } void sub_08064D08(Entity* this) { diff --git a/src/npc/talon.c b/src/npc/talon.c index f9c7d66f..841d9467 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -92,7 +92,7 @@ void sub_08065680(Entity* this) { } void sub_080656A4(Entity* this) { - if ((gTextBox.doTextBox & 0x7F) == 0) { + if ((gMessage.doTextBox & 0x7F) == 0) { this->action = this->field_0x68.HALF.HI; InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO); } @@ -115,7 +115,7 @@ void sub_080656D4(Entity* this) { this->field_0x68.HALF.HI = this->action; this->action = 3; this->interactType = 0; - TextboxNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this); + MessageNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this); label: sub_0806574C(this); } diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index f5bcaf5b..f4111b05 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -33,7 +33,7 @@ void sub_08064DA0(Entity* this) { if (this->interactType != 0) { this->action = 2; InitAnimationForceUpdate(this, 6); - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } } diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index 79f35176..b5103040 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -122,7 +122,7 @@ void sub_0806ACC4(Entity* this) { } break; case 2: - if (gTextBox.doTextBox & 0x7f) + if (gMessage.doTextBox & 0x7f) break; this->action = 1; @@ -223,12 +223,12 @@ void sub_0806AF60(Entity* this, ScriptExecutionContext* context) { } void sub_0806AF70(Entity* this, ScriptExecutionContext* context) { - this->field_0x20 = 0x24000; + this->hVelocity = 0x24000; } void sub_0806AF78(Entity* this, ScriptExecutionContext* context) { sub_08003FC4(this, 0x1800); - if (0 <= this->height.WORD && this->field_0x20 < 1) { + if (0 <= this->height.WORD && this->hVelocity < 1) { this->height.WORD = 0; sub_0806AF70(this, context); } @@ -273,7 +273,7 @@ void sub_0806B004(Entity* this, ScriptExecutionContext* context) { SetLocalFlag(0x6a); } } - TextboxNoOverlap(gUnk_08112C40[idx], this); + MessageNoOverlap(gUnk_08112C40[idx], this); } void sub_0806B064(Entity* this) { @@ -285,7 +285,7 @@ void sub_0806B064(Entity* this) { idx = 2; } } - TextboxNoOverlap(gUnk_08112C4A[idx], this); + MessageNoOverlap(gUnk_08112C4A[idx], this); } void sub_0806B098(Entity* this) { @@ -299,7 +299,7 @@ void sub_0806B098(Entity* this) { idx = BOOLCAST(f); } } - TextboxNoOverlap(gUnk_08112C50[(this->type2 - 7) * 3 + idx], this); + MessageNoOverlap(gUnk_08112C50[(this->type2 - 7) * 3 + idx], this); } void sub_0806B0E0(Entity* this) { @@ -310,7 +310,7 @@ void sub_0806B0E0(Entity* this) { idx = 1; } - TextboxNoOverlap(gUnk_08112C5C[idx], this); + MessageNoOverlap(gUnk_08112C5C[idx], this); } void sub_0806B134(Entity* this) { @@ -329,7 +329,7 @@ void sub_0806B134(Entity* this) { if (5 < gSave.unk8) { idx = 3; } - TextboxNoOverlap(gUnk_08112C60[idx], this); + MessageNoOverlap(gUnk_08112C60[idx], this); } void TownMinish_Fusion(Entity* this) { diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index de089fbe..eb86baed 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -9,6 +9,7 @@ #include "random.h" #include "structures.h" #include "functions.h" +#include "effects.h" typedef struct { u8 frame1; @@ -69,7 +70,7 @@ void sub_08061C00(Entity* this) { sub_0806ED78(this); if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(this->type2 + 0xa01); + MessageFromTarget(this->type2 + 0xa01); } } @@ -140,7 +141,7 @@ void sub_08061D64(Entity* this) { void sub_08061E24(Entity* this) { GetNextFrame(this); - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; InitializeAnimation(this, this->field_0x68.HALF.HI); } @@ -228,7 +229,7 @@ void sub_08061E90(Entity* this, Entity* arg1) { void sub_08061F94(Entity* this) { Entity* ent; - ent = CreateFx(this, 0x35, 0); + ent = CreateFx(this, FX_BIG_EXPLOSION, 0); if (ent != NULL) { ResolveEntityOnTop(this, ent); } @@ -253,7 +254,7 @@ void sub_08061FE4(Entity* this) { } void sub_08061FF4(Entity* this) { - TextboxNoOverlap(gUnk_0810B790[this->type], this); + MessageNoOverlap(gUnk_0810B790[this->type], this); } void sub_0806200C(Entity* this) { @@ -269,7 +270,7 @@ void sub_0806200C(Entity* this) { index = 1; } } - TextboxNoOverlap(gUnk_0810B7BA[index], this); + MessageNoOverlap(gUnk_0810B7BA[index], this); } void sub_08062048(Entity* this) { @@ -282,7 +283,7 @@ void sub_08062048(Entity* this) { } ShowNPCDialogue(this, gUnk_0810B7C0 + this->type * 0x8 + iVar1); } else { - TextboxNoOverlap(0, this); + MessageNoOverlap(0, this); } } diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c index b3555aeb..61c88c55 100644 --- a/src/npc/vaatiReborn.c +++ b/src/npc/vaatiReborn.c @@ -103,7 +103,7 @@ void VaatiRebornAction1(Entity* this) { break; } CopyPosition(this, entity); - TextboxNoOverlapFollow(0x1634); + MessageFromTarget(0x1634); this->subAction = this->subAction + 1; DeleteThisEntity(); return; diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index 677ce4f3..789e5b2c 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -69,7 +69,7 @@ void sub_0806C7D4(Entity* this) { } void sub_0806C834(Entity* this) { - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { --this->action; InitializeAnimation(this, (this->animationState / 2) + 4); } @@ -140,7 +140,7 @@ void sub_0806C944(Entity* this) { iVar2 = 1; } } - TextboxNoOverlap(gUnk_08113B0C[iVar2], this); + MessageNoOverlap(gUnk_08113B0C[iVar2], this); } void sub_0806C978(Entity* this) { @@ -148,7 +148,7 @@ void sub_0806C978(Entity* this) { u32 flagAsBool; flag = CheckGlobalFlag(0x58); flagAsBool = BOOLCAST(flag); - TextboxNoOverlap(gUnk_08113B12[flagAsBool], this); + MessageNoOverlap(gUnk_08113B12[flagAsBool], this); } void sub_0806C99C(Entity* this) { @@ -160,7 +160,7 @@ void sub_0806C99C(Entity* this) { if (CheckLocalFlag(99) != 0) { flagAsBool += 1; } - TextboxNoOverlap(gUnk_08113B16[flagAsBool], this); + MessageNoOverlap(gUnk_08113B16[flagAsBool], this); } void sub_0806C9D0(Entity* this) { @@ -168,7 +168,7 @@ void sub_0806C9D0(Entity* this) { if (CheckLocalFlag(100) == 0) { tmp = 1; } - TextboxNoOverlap(gUnk_08113B1E[tmp], this); + MessageNoOverlap(gUnk_08113B1E[tmp], this); } void sub_0806C9F8(Entity* this) { @@ -176,15 +176,15 @@ void sub_0806C9F8(Entity* this) { u32 flagAsBool; flag = CheckGlobalFlag(0x58); flagAsBool = BOOLCAST(flag); - TextboxNoOverlap(gUnk_08113B22[flagAsBool], this); + MessageNoOverlap(gUnk_08113B22[flagAsBool], this); } void sub_0806CA1C(Entity* this) { - TextboxNoOverlap(0x251b, this); + MessageNoOverlap(0x251b, this); } void sub_0806CA2C(Entity* this) { - TextboxNoOverlap(0x2527, this); + MessageNoOverlap(0x2527, this); } void sub_0806CA3C(Entity* this) { diff --git a/src/npc/zelda.c b/src/npc/zelda.c index c9a50cfb..13045c51 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -129,7 +129,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) { UpdateAnimationSingleFrame(this); if (this->frames.all & 1) { context->unk_18++; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; this->frames.all &= 0xFE; SoundReq(SFX_PLY_JUMP); } @@ -140,7 +140,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) { if (!(this->frames.all & 1)) { UpdateAnimationSingleFrame(this); } - if (this->field_0x20 < 0) { + if (this->hVelocity < 0) { context->unk_18++; } break; diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index f9de2600..13cb6627 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -66,8 +66,8 @@ void sub_0809CD0C(Entity* this) { ModHealth(-2); sub_0800449C(&gPlayerEntity, 0x7a); gPlayerEntity.iframes = 16; - gPlayerEntity.field_0x3e = 16; - gPlayerEntity.field_0x42 = 12; + gPlayerEntity.knockbackDirection = 16; + gPlayerEntity.knockbackDuration = 12; gPlayerEntity.field_0x46 = 16; } } diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 866309ae..9a06d4ff 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -3,6 +3,7 @@ #include "flags.h" #include "object.h" #include "functions.h" +#include "effects.h" extern void sub_08098E3C(Entity*); extern void sub_08098E88(Entity*); @@ -43,7 +44,7 @@ void sub_08098D6C(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { this->action = 2; this->actionDelay = 0x2d; - ent = CreateFx(this, 0x43, 0); + ent = CreateFx(this, FX_BIG_EXPLOSION2, 0); if (ent != NULL) { ent->y.HALF.HI += 8; } diff --git a/src/object/bird.c b/src/object/bird.c index 3d1558e3..758a3564 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -6,6 +6,7 @@ #include "random.h" #include "object.h" #include "functions.h" +#include "effects.h" extern void (*const gUnk_08123EC0[])(Entity*); extern void (*const gUnk_08123EEC[])(Entity*); @@ -28,7 +29,7 @@ void sub_0809CF54(Entity* this) { this->spriteSettings.b.draw = TRUE; this->actionDelay = 0x31; this->field_0xf = 1; - this->field_0x20 = -0x18000; + this->hVelocity = -0x18000; this->height.WORD = -0x38C000; this->field_0x68.HWORD = -0x800; this->speed = 0x280; @@ -84,7 +85,7 @@ void sub_0809D084(Entity* this) { PositionRelative(this->parent, this, 0, 0x80000); } else { this->subAction++; - this->field_0x20 = temp; + this->hVelocity = temp; } } } @@ -99,7 +100,7 @@ void sub_0809D0AC(Entity* this) { this->collisionLayer = 1; SetLocalFlag(0x45); SoundReq(SFX_SECRET); - fx = CreateFx(this, 0x11, 0); + fx = CreateFx(this, FX_DASH, 0); if (fx != NULL) { sub_0806FAD8(this, fx); } @@ -118,7 +119,7 @@ void sub_0809D10C(Entity* this) { } void sub_0809D130(Entity* this) { - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { sub_0800445C(this); } else if (sub_08017850(this) != 0) { CreateItemEntity(0x17, 0, 0); diff --git a/src/object/book.c b/src/object/book.c index b51c4716..3c60630c 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -5,6 +5,7 @@ #include "flags.h" #include "room.h" #include "textbox.h" +#include "effects.h" extern void (*const BookActionFuncs[])(Entity*); extern s8 const gUnk_08123D94[]; @@ -96,7 +97,7 @@ void sub_0809B4A8(Entity* this) { gPlayerState.pushedObject = 0x9e; gPlayerState.playerAction = 5; - gPlayerState.flags.all |= 1; + gPlayerState.flags |= 1; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; @@ -135,14 +136,14 @@ void sub_0809B56C(Entity* this) { SetFlag(this->field_0x86.HWORD); - fx = CreateFx(this, 2, 0); + fx = CreateFx(this, FX_DEATH, 0); if (fx) { ResolveEntityOnTop(this, fx); } } void sub_0809B5B4(Entity* this) { - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { sub_0800445C(this); } else if (sub_08017850(this)) { CreateItemEntity(this->type + 0x39, 0, 0); @@ -196,7 +197,7 @@ void sub_0809B5EC(Entity* this) { break; } case 1: { - u8 doTextBox = gTextBox.doTextBox & 0x7f; + u8 doTextBox = gMessage.doTextBox & 0x7f; if (!doTextBox) { this->spriteSettings.b.draw = 1; this->subAction = doTextBox; diff --git a/src/object/button.c b/src/object/button.c index 5111575e..8bbd7bca 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -4,6 +4,7 @@ #include "room.h" #include "audio.h" #include "functions.h" +#include "effects.h" extern void (*const gUnk_0811EE38[])(Entity*); @@ -152,11 +153,11 @@ Entity* sub_08081D74(Entity* this) { } ent = 0; if (sub_08081E0C(this)) { - if (!(gPlayerState.flags.all & 0x10) && !(gPlayerState.flags.all & 0x80)) { + if (!(gPlayerState.flags & 0x10) && !(gPlayerState.flags & 0x80)) { ent = &gPlayerEntity; } } else { - if (gPlayerState.flags.all & 0x400000) { + if (gPlayerState.flags & 0x400000) { if (sub_080041A0(this, gUnk_03004040[0], 5, 6)) { ent = gUnk_03004040[0]; } else if (sub_080041A0(this, gUnk_03004040[1], 5, 6)) { @@ -231,13 +232,13 @@ u32 sub_08081F00(u32* unk1, u32* unk2) { } void sub_08081F24(Entity* this) { - Entity* fx = CreateFx(this, 0x11, 0x40); + Entity* fx = CreateFx(this, FX_DASH, 0x40); if (fx) { fx->scriptedScene = 3; fx->x.HALF.HI += 7; fx->y.HALF.HI += 5; } - fx = CreateFx(this, 0x11, 0x40); + fx = CreateFx(this, FX_DASH, 0x40); if (fx) { fx->scriptedScene = 3; fx->x.HALF.HI -= 7; diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index bff3a5d8..5c5e419e 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -181,7 +181,7 @@ void sub_0808EA28(Entity* this) { u32 var1; if (this->type == 3) { - if (gUnk_02000000->gameLanguage > LANGUAGE_EN) { + if (gSaveHeader->gameLanguage > LANGUAGE_EN) { this->spriteSettings.b.draw = 2; } else { this->spriteSettings.b.draw = 0; diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index 046eb0aa..1821a27b 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -59,7 +59,7 @@ static void sub_0808E714(Entity* this) { static void sub_0808E764(Entity* this) { sub_08080CB4(this); - if (!(gPlayerState.flags.all & 0x80) && sub_08017850(this)) { + if (!(gPlayerState.flags & 0x80) && sub_08017850(this)) { SetFlag(this->cutsceneBeh.HWORD); CreateItemEntity(0x62, 0, 0); DeleteThisEntity(); diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index ee77e759..2e4f555a 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -150,8 +150,8 @@ void sub_080810A8(Entity* this) { this->direction |= 0xFF; } - if (this->field_0x20 == 0) { - this->field_0x20 = 0x1E000; + if (this->hVelocity == 0) { + this->hVelocity = 0x1E000; } if (this->collisionLayer == 2) { @@ -218,7 +218,7 @@ void sub_080811EC(Entity* this) { } sub_08003FC4(this, 0x2800); - if (this->field_0x20 <= 0) { + if (this->hVelocity <= 0) { this->action = 2; this->flags |= 0x80; sub_080814A4(this); @@ -273,7 +273,7 @@ void sub_080812E8(Entity* this) { #ifdef EU if ((playerState->swimState & 0x80) && sub_080177A0(this, &gPlayerEntity)) { #else - if ((playerState->swimState & 0x80) && !(playerState->flags.all & 0x80) && sub_080177A0(this, &gPlayerEntity)) { + if ((playerState->swimState & 0x80) && !(playerState->flags & 0x80) && sub_080177A0(this, &gPlayerEntity)) { #endif sub_080810FC(this); } @@ -413,7 +413,7 @@ void sub_0808153C(Entity* this) { if (this->field_0x68.HALF.LO == 0) { if (!sub_08003FC4(this, 0x1000) && !sub_0800442E(this)) { this->field_0x68.HALF.LO = 1; - this->field_0x20 = 0x1E000; + this->hVelocity = 0x1E000; sub_0808148C(this->type); UpdateSpriteForCollisionLayer(this); } @@ -433,7 +433,7 @@ void sub_08081598(Entity* this) { this->flags &= 0x7F; this->action = 4; this->actionDelay = 14; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; this->spriteSettings.b.draw = 1; this->spritePriority.b1 = 2; this->spritePriority.b0 = 3; diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c new file mode 100644 index 00000000..a3f2541d --- /dev/null +++ b/src/object/jarPortal.c @@ -0,0 +1,181 @@ +#include "global.h" +#include "entity.h" +#include "flags.h" +#include "functions.h" +#include "area.h" +#include "audio.h" + +extern void (*gUnk_08121488[])(Entity*); + +extern u32 sub_08057810(void); +extern void CreateMagicSparkles(u32, u32, u32); + +u32 sub_0808C128(Entity*); +void sub_0808C13C(Entity*); +void sub_0808C148(Entity*, u32); +void sub_0808C01C(Entity*, u32); + +void JarPortal(Entity* this) { + gUnk_08121488[this->action](this); +} + +void sub_0808BE9C(Entity* this) { + this->flags |= 0x80; + this->damageType = 1; + this->field_0x3c = 0x47; + this->field_0x40 = 0x44; + this->flags2 = 0x80; + this->field_0x68.HALF.LO = 0; + if (CheckLocalFlag(this->type)) { + if (this->field_0x7c.BYTES.byte0 != 0) { + this->action = 1; + InitAnimationForceUpdate(this, 0); + } else { + this->action = 3; + InitAnimationForceUpdate(this, 1); + } + } else { + if (this->field_0x7c.BYTES.byte0 == 0) { + this->action = 1; + InitAnimationForceUpdate(this, 0); + } else { + this->action = 3; + InitAnimationForceUpdate(this, 1); + } + } +} + +void sub_0808BF14(Entity* this) { + if (sub_0808C128(this)) { + this->action++; + sub_0808C13C(this); + if (this->field_0x7c.BYTES.byte0 == 0) { + SetLocalFlag(this->type); + } else { + ClearLocalFlag(this->type); + } + sub_0808C148(this, 0); + } + sub_0808C01C(this, 0); +} + +void sub_0808BF58(Entity* this) { + sub_08003FC4(this, 0x2000); + switch (this->subAction) { + case 0: + if (this->hVelocity <= 98303) { + ++this->subAction; + InitAnimationForceUpdate(this, 2); + } + break; + case 1: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + ++this->subAction; + this->hVelocity = 0x8000; + } + break; + case 2: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + ++this->action; + this->field_0xf = 0; + InitAnimationForceUpdate(this, 1); + sub_0808C148(this, 1); + } + break; + } +} + +void sub_0808BFD8(Entity* this) { + if (sub_0808C128(this)) { + ++this->action; + sub_0808C13C(this); + if (!this->field_0x7c.BYTES.byte0) + ClearLocalFlag(this->type); + else + SetLocalFlag(this->type); + sub_0808C148(this, 0); + } + sub_0808C01C(this, 1); +} + +void sub_0808C01C(Entity* this, u32 r1) { + if (CheckPlayerProximity(this->x.HALF.HI - 0x18, this->y.HALF.HI - 0x18, 0x30, 0x30)) { + u32 type; + gArea.curPortalX = this->x.HALF.HI; + gArea.curPortalY = this->y.HALF.HI; + gArea.curPortalExitDirection = 2; + type = 4; + if (r1 != 0) + type = 2; + gArea.curPortalType = type; + if (r1 == 1) { + if (((gPlayerState.flags & 0x20) != 0) && (gPlayerState.jumpStatus == 0)) { + gArea.field_0x18 = 2; + } else { + if (sub_08057810() != 0) { + gArea.field_0x18 = 3; + } + } + CreateMagicSparkles(this->x.HALF.HI, this->y.HALF.HI, this->collisionLayer); + if (this->field_0xf == 0) { + this->field_0xf = 1; + SoundReq(SFX_NEAR_PORTAL); + } + } + } +} + +void sub_0808C0AC(Entity* this) { + sub_08003FC4(this, 0x2000); + switch (this->subAction) { + case 0: + if (this->hVelocity <= 98303) { + this->subAction = 1; + InitAnimationForceUpdate(this, 3); + } + break; + case 1: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + ++this->subAction; + this->hVelocity = 0x8000; + } + break; + case 2: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + this->action = 1; + InitAnimationForceUpdate(this, 0); + sub_0808C148(this, 1); + } + break; + } +} + +u32 sub_0808C128(Entity* this) { + return this->bitfield == 157; +} + +void sub_0808C13C(Entity* this) { + this->subAction = 0; + this->hVelocity = 163840; +} + +void sub_0808C148(Entity* this, u32 a2) { + u32 pos; + + pos = COORD_TO_TILE(this); + if (!a2) { + SetTile(16530, pos - 1, this->collisionLayer); + SetTile(16531, pos, this->collisionLayer); + SetTile(16532, pos + 63, this->collisionLayer); + SetTile(16533, pos + 64, this->collisionLayer); + } else { + sub_0807BA8C(pos - 1, this->collisionLayer); + sub_0807BA8C(pos, this->collisionLayer); + sub_0807BA8C(pos + 63, this->collisionLayer); + sub_0807BA8C(pos + 64, this->collisionLayer); + } +} diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index ce0d8c08..37f78580 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -32,7 +32,7 @@ void LilypadSmall(Entity* this) { } u32 sub_08097ADC(Entity* this) { - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { return 0; } else if (sub_080041A0(this, &gPlayerEntity, 8, 8) == 0) { return 0; diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index f7918284..d82a3e3d 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -4,6 +4,7 @@ #include "game.h" #include "audio.h" #include "functions.h" +#include "effects.h" void sub_08083338(Entity*); void sub_080834B4(Entity*); @@ -315,12 +316,12 @@ u32 sub_080837B0(Entity* this) { void sub_08083814(Entity* this, u32 unk0) { Entity* fx; const struct_0811F730* tmp = &gUnk_0811F730[unk0]; - fx = CreateFx(this, 0x11, 0x40); + fx = CreateFx(this, FX_DASH, 0x40); if (fx) { fx->x.HALF.HI += tmp->unk_00.x; fx->y.HALF.HI += tmp->unk_00.y; } - fx = CreateFx(this, 0x11, 0x40); + fx = CreateFx(this, FX_DASH, 0x40); if (fx) { fx->x.HALF.HI += tmp->unk_02.x; fx->y.HALF.HI += tmp->unk_02.y; diff --git a/src/object/mask.c b/src/object/mask.c index b6d06206..cd94a1b5 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -6,6 +6,7 @@ #include "player.h" #include "flags.h" #include "functions.h" +#include "effects.h" extern void (*MaskActionFuncs[])(Entity*); @@ -46,7 +47,7 @@ void sub_080929A4(Entity* this) { } this->action = 1; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; this->field_0x78.HWORD = ((Random() & 7) << 10) | 0x2000; @@ -111,7 +112,7 @@ void sub_08092B0C(Entity* this) { break; } - CreateFx(this, 5, 0); + CreateFx(this, FX_POT_SHATTER, 0); sub_0805457C(this, 3); } else { diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index 475a35ac..a65cf709 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -4,6 +4,7 @@ #include "flags.h" #include "audio.h" #include "functions.h" +#include "effects.h" extern u32 sub_08083734(Entity*, u32); extern void sub_080A080C(Entity*); @@ -56,12 +57,12 @@ void sub_080A074C(Entity* this) { this->height.HALF.HI = 0; this->x.HALF.HI = this->field_0x70.HALF.LO; this->y.HALF.HI = this->field_0x70.HALF.HI; - ent = CreateFx(this, 0x11, 0x40); + ent = CreateFx(this, FX_DASH, 0x40); if (ent != NULL) { ent->x.HALF.HI += 0xc; ent->y.HALF.HI -= 0xc; } - ent = CreateFx(this, 0x11, 0x40); + ent = CreateFx(this, FX_DASH, 0x40); if (ent != NULL) { ent->x.HALF.HI -= 0xc; ent->y.HALF.HI -= 0xc; diff --git a/src/object/minecart.c b/src/object/minecart.c index 7578a6b2..01d7d1ac 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -36,7 +36,7 @@ void sub_080916EC(Entity* this) { struct_030010EC* unk = &gUnk_030010EC[this->actionDelay]; *(struct_030010EC**)&this->cutsceneBeh.HWORD = unk; - if ((gRoomControls.roomID != unk->field_0x4) || (gPlayerState.flags.all & 0x1000) != 0) { + if ((gRoomControls.roomID != unk->field_0x4) || (gPlayerState.flags & 0x1000) != 0) { DeleteThisEntity(); } this->x.HALF.HI = gRoomControls.roomOriginX + ((unk->field_0x0 & 0x3f) << 4) + 8; @@ -60,13 +60,13 @@ void sub_080916EC(Entity* this) { void sub_080917DC(Entity* this) { if ((this->bitfield & 0x7f) == 0x1d) { - this->field_0x20 = 0x2a000; + this->hVelocity = 0x2a000; this->action = 7; InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState); SoundReq(SFX_13B); } else { if (sub_0800445C(this) != 0) { - if (((gPlayerState.flags.all & 0x40080) == 0) && (gPlayerState.field_0x1c == 0) && + if (((gPlayerState.flags & 0x40080) == 0) && (gPlayerState.field_0x1c == 0) && (gPlayerState.heldObject == 0) && (gPlayerState.jumpStatus == 0)) { this->actionDelay++; } else { @@ -79,8 +79,8 @@ void sub_080917DC(Entity* this) { if (8 < this->actionDelay) { this->action = this->action + 1; gPlayerState.jumpStatus = 0x81; - gPlayerState.flags.all |= 0x4000000; - gPlayerEntity.field_0x20 = 0x20000; + gPlayerState.flags |= 0x4000000; + gPlayerEntity.hVelocity = 0x20000; gPlayerEntity.speed = 0x100; gPlayerEntity.flags &= 0x7f; ResetPlayer(); @@ -98,11 +98,11 @@ void sub_080918A4(Entity* this) { gPlayerEntity.x.HALF.HI = this->x.HALF.HI; gPlayerEntity.y.HALF.HI = this->y.HALF.HI; if (gPlayerEntity.height.HALF.HI > -0x10) { - if ((s32)gPlayerEntity.field_0x20 > -1) { + if ((s32)gPlayerEntity.hVelocity > -1) { return; } gPlayerEntity.animationState = this->animationState << 1; - gPlayerState.flags.all = (gPlayerState.flags.all ^ 0x4000000) | 0x1000; + gPlayerState.flags = (gPlayerState.flags ^ 0x4000000) | 0x1000; this->action++; this->field_0xf = 1; this->flags |= 0x20; @@ -118,7 +118,7 @@ void sub_080918A4(Entity* this) { } else { gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, this); } - if (gPlayerEntity.field_0x20 < 0) { + if (gPlayerEntity.hVelocity < 0) { gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1; } } @@ -128,7 +128,7 @@ void sub_080919AC(Entity* this) { u32 uVar3; gRoomControls.unk5 = 7; - if ((gPlayerState.flags.all & 0x1000) == 0) { + if ((gPlayerState.flags & 0x1000) == 0) { this->action = 1; return; } @@ -174,8 +174,8 @@ void sub_080919AC(Entity* this) { this->action = 6; sub_08017744(this); gPlayerState.jumpStatus = 0x41; - gPlayerState.flags.all = (gPlayerState.flags.all ^ 0x1000) | 0x4000000; - gPlayerEntity.field_0x20 = 0x20000; + gPlayerState.flags = (gPlayerState.flags ^ 0x1000) | 0x4000000; + gPlayerEntity.hVelocity = 0x20000; gPlayerEntity.speed = 0x200; gPlayerEntity.animationState = this->animationState << 1; gPlayerEntity.direction = this->direction; diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index ce5ab316..ddd776ae 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -27,11 +27,11 @@ void sub_08090F00(Entity* this) { if (this->type == 1) { Entity* parent = this->parent; u32 mask = 1 << this->field_0xf; - if (!(parent->field_0x20 & mask)) { + if (!(parent->hVelocity & mask)) { DeleteThisEntity(); } } - if ((gPlayerState.flags.all & 0x80) && sub_080041A0(this, &gPlayerEntity, 4, 4) && + if ((gPlayerState.flags & 0x80) && sub_080041A0(this, &gPlayerEntity, 4, 4) && (gPlayerEntity.height.HALF.HI == 0) && (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) { DoExitTransition(GetCurrentRoomProperty(this->actionDelay)); } diff --git a/src/object/object1A.c b/src/object/object1A.c index ad3b1389..494ba821 100644 --- a/src/object/object1A.c +++ b/src/object/object1A.c @@ -54,7 +54,7 @@ void sub_08086A6C(Entity* ent) { u32 uVar1; uVar1 = Random(); - ent->field_0x20 = 163840; + ent->hVelocity = 163840; ent->direction = (uVar1 >> 16) & 31; ent->speed = uVar1 & 480; } diff --git a/src/object/object1C.c b/src/object/object1C.c index 3ca965c6..3bd9af76 100644 --- a/src/object/object1C.c +++ b/src/object/object1C.c @@ -13,7 +13,7 @@ void Object1C(Entity* this) { this->action = 1; } if (CheckRectOnScreen(this->field_0x80.HWORD, this->field_0x82.HWORD, 0x10, 0x10) == 0) { - this->parent->field_0x20 &= ~(1 << this->type2); + this->parent->hVelocity &= ~(1 << this->type2); DeleteThisEntity(); } } diff --git a/src/object/object86.c b/src/object/object86.c index 02e0b480..717e3ad0 100644 --- a/src/object/object86.c +++ b/src/object/object86.c @@ -75,5 +75,5 @@ void sub_08099ECC(Entity* this) { CopyPosition(this, &gPlayerEntity); gPlayerState.playerAction = 3; gPlayerState.field_0x34[4] = 0; - gPlayerState.flags.all |= 0x8000; + gPlayerState.flags |= 0x8000; } diff --git a/src/object/objectA2.c b/src/object/objectA2.c index 2cc132fe..a2092bb7 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -5,6 +5,7 @@ #include "audio.h" #include "structures.h" #include "functions.h" +#include "effects.h" void sub_0809F318(Entity*); void sub_0809F374(Entity*); @@ -45,7 +46,7 @@ void sub_0809F318(Entity* this) { void sub_0809F374(Entity* this) { sub_0806F69C(this); #ifndef EU - if (gUnk_02000000->gameLanguage < 2) { + if (gSaveHeader->gameLanguage < 2) { if (sub_080044EC(this, 0x2000) < 2) { this->height.WORD = 0; this->action = 2; @@ -85,7 +86,7 @@ void sub_0809F408(Entity* this) { switch (this->frames.all) { case 9: this->frames.all = 0; - CreateFx(this, 0x43, 0); + CreateFx(this, FX_BIG_EXPLOSION2, 0); gMenu.field_0x0 = 1; break; case 0x80: diff --git a/src/object/pot.c b/src/object/pot.c index 7aff3672..79d0a38f 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -5,6 +5,7 @@ #include "room.h" #include "object.h" #include "functions.h" +#include "effects.h" void sub_08082824(Entity*); static void sub_08082850(Entity*, Entity*); @@ -66,7 +67,7 @@ void sub_08082310(Entity* this) { case 0x1D: SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); this->action = 5; - this->field_0x20 = 0x2A000; + this->hVelocity = 0x2A000; this->spriteOffsetY = 0; this->spriteSettings.b.shadow = 1; this->spritePriority.b1 = 3; @@ -84,7 +85,7 @@ void sub_08082310(Entity* this) { this->direction = (tileType - 0x4001) * 8; this->actionDelay = 32; this->action = 4; - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { this->speed >>= 1; this->actionDelay = 64; } @@ -97,7 +98,7 @@ void sub_08082310(Entity* this) { break; default: if (sub_080002B8(this) == 13) { - CreateFx(this, 0, 0); + CreateFx(this, FX_FALL_DOWN, 0); } else if (tileType == 0x4005) { gPlayerState.field_0xab = 4; SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); @@ -137,13 +138,13 @@ void sub_08082588(Entity* this) { void sub_0808259C(Entity* this) { switch (sub_080043E8(this)) { case 2: - CreateFx(this, 11, 0); + CreateFx(this, FX_WATER_SPLASH, 0); break; case 1: - CreateFx(this, 0, 0); + CreateFx(this, FX_FALL_DOWN, 0); break; case 3: - CreateFx(this, 12, 0); + CreateFx(this, FX_LAVA_SPLASH, 0); break; default: sub_08082850(this, &gPlayerEntity); @@ -183,7 +184,7 @@ void sub_08082614(Entity* this) { } this->action = 1; - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { this->speed <<= 1; } @@ -250,7 +251,7 @@ void sub_08082818(Entity* this) { } void sub_08082824(Entity* this) { - if (this->field_0x20 < 0) { + if (this->hVelocity < 0) { this->spriteSettings.b.flipY = 1; } @@ -261,7 +262,7 @@ void sub_08082824(Entity* this) { static void sub_08082850(Entity* this, Entity* parent) { u32 parameter = sub_0808288C(this, this->type, this->field_0x7c.BYTES.byte1, this->type2); - Entity* fxEntity = CreateFx(this, 5, parameter); + Entity* fxEntity = CreateFx(this, FX_POT_SHATTER, parameter); if (fxEntity) { fxEntity->parent = parent; } diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c index e74d2ee1..1cca2ba0 100644 --- a/src/object/swordsmanNewsletter.c +++ b/src/object/swordsmanNewsletter.c @@ -24,6 +24,6 @@ void sub_080933D8(Entity* this) { void sub_080933FC(Entity* this) { if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlap(gUnk_081228B8[this->type], this); + MessageNoOverlap(gUnk_081228B8[this->type], this); } } diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 53f593bb..dcaf3ebc 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -6,6 +6,7 @@ #include "room.h" #include "structures.h" #include "functions.h" +#include "effects.h" extern void sub_0809E96C(Entity*); extern void CreateSparkle(Entity*); @@ -70,7 +71,7 @@ void sub_0809E918(Entity* this) { Entity* fx; s16* i = gUnk_08124364; while (*i != -1000) { - fx = CreateFx(this, 3, 0); + fx = CreateFx(this, FX_BUSH, 0); if (fx != NULL) { fx->x.HALF.HI += i[0]; fx->y.HALF.HI += i[1]; diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index 287a2e70..69ed1fdc 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -206,7 +206,7 @@ void sub_0808B73C(Entity* this) { } u32 sub_0808B7C8(Entity* this) { - if (!(gPlayerState.flags.all & 0x80) && gPlayerState.field_0xa8 != 0x12 && gPlayerEntity.currentHealth != 0 && + if (!(gPlayerState.flags & 0x80) && gPlayerState.field_0xa8 != 0x12 && gPlayerEntity.currentHealth != 0 && sub_08079F8C() && sub_080041A0(this, &gPlayerEntity, 5, 5) && gPlayerEntity.height.HALF.HI == 0) { if (this->actionDelay == 0 && gPlayerEntity.action == 0x1b) { sub_080791D0(); diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 91bdb37a..3ebaef24 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -4,6 +4,7 @@ #include "save.h" #include "script.h" #include "functions.h" +#include "effects.h" extern void sub_08078850(Entity*, u32, u32, u8*); @@ -26,5 +27,5 @@ void sub_080A2124(Entity* this) { void Windcrest_Unlock(Entity* this) { SoundReq(SFX_SECRET); gSave.windcrests = gSave.windcrests | 1 << (this->type2 + 0x18); - CreateFx(this, 0x46, 0); + CreateFx(this, FX_GIANT_EXPLOSION, 0); } diff --git a/src/player.c b/src/player.c index f53077c6..ac3bd614 100644 --- a/src/player.c +++ b/src/player.c @@ -10,6 +10,7 @@ #include "object.h" #include "functions.h" #include "object.h" +#include "effects.h" static void (*const sPlayerActions[])(Entity*); extern void (*const gUnk_0811BA60[])(Entity*); @@ -154,14 +155,14 @@ void PlayerFall(Entity* this) { void sub_08070C3C(Entity* this) { sub_08004168(this); - gPlayerState.flags.all |= 0x1 | 0x4; - gPlayerState.flags.all &= ~0x400; + gPlayerState.flags |= 0x1 | 0x4; + gPlayerState.flags &= ~0x400; gPlayerState.jumpStatus = 0; - if ((gPlayerState.flags.all & 0x80) != 0) + if ((gPlayerState.flags & 0x80) != 0) gPlayerState.field_0x8 = 0x1ba; - else if ((gPlayerState.flags.all & 8) != 0) + else if ((gPlayerState.flags & 8) != 0) gPlayerState.field_0x8 = 0x458; else gPlayerState.field_0x8 = 0x1b8; @@ -178,11 +179,11 @@ void sub_08070C3C(Entity* this) { void sub_08070CB4(Entity* this) { UpdateAnimationSingleFrame(this); if ((this->frames.all & 0x80) != 0) { - if ((gSave.stats.health != 0) && ((gPlayerState.flags.all & 0x8000) != 0)) { - gPlayerState.flags.all &= ~(0x1 | 0x4); + if ((gSave.stats.health != 0) && ((gPlayerState.flags & 0x8000) != 0)) { + gPlayerState.flags &= ~(0x1 | 0x4); this->spriteSettings.b.draw = 0; } else { - gPlayerState.flags.all &= ~(0x4 | 0x8000); + gPlayerState.flags &= ~(0x4 | 0x8000); RespawnPlayer(); gPlayerState.field_0xa = 0; this->iframes = 32; @@ -199,18 +200,18 @@ void sub_08070D38(Entity* this) { this->flags &= ~0x80; this->direction = ((this->animationState & 0xe) << 2) ^ 0x10; this->speed = 0x100; - this->field_0x42 = 0; + this->knockbackDuration = 0; this->subAction++; this->actionDelay = gPlayerState.field_0x38; this->spriteIndex = 1; - if ((gPlayerState.flags.all & 0x80) == 0) { - this->field_0x20 = 0x20000; + if ((gPlayerState.flags & 0x80) == 0) { + this->hVelocity = 0x20000; gPlayerState.field_0x8 = 0x114; sub_08080964(16, 0); } else { gPlayerState.field_0x8 = 0xc18; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; } gPlayerState.jumpStatus = 0x80; @@ -241,7 +242,7 @@ NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(Entity* t } if (--this->actionDelay != 0xFF) { - this->field_0x20 = 0x10000; + this->hVelocity = 0x10000; return; } @@ -258,7 +259,7 @@ NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(Entity* t this->actionDelay = 8; this->subAction++; - if ((gPlayerState.flags.all & 0x80) == 0) + if ((gPlayerState.flags & 0x80) == 0) gPlayerState.field_0x8 = 0x100; } END_NONMATCH @@ -274,7 +275,7 @@ void sub_08070E7C(Entity* this) { void sub_08070E9C(Entity* this) { if (sub_08078EFC() != 0) { - sub_08056360(); + MessageClose(); } else { gPlayerState.field_0x27[0] = 4; gPlayerState.field_0xa8 = 0x13; @@ -286,10 +287,10 @@ void sub_08070E9C(Entity* this) { void sub_08070EDC(Entity* this) { this->scriptedScene = 2; - if ((gTextBox.doTextBox & 0x7f) != 0) + if ((gMessage.doTextBox & 0x7f) != 0) this->subAction = 1; - if ((gPlayerState.flags.all & 0x80) == 0) + if ((gPlayerState.flags & 0x80) == 0) sub_08079938(); else gPlayerState.field_0x8 = 0xc18; @@ -297,7 +298,7 @@ void sub_08070EDC(Entity* this) { void sub_08070f24(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->scriptedScene = this->scriptedScene2; sub_080791D0(); } @@ -326,11 +327,11 @@ void sub_08070FA4(Entity* this) { this->spriteSettings.b.flipX = FALSE; this->animationState = 4; - gPlayerState.flags.all |= 1; + gPlayerState.flags |= 1; gPlayerState.jumpStatus = 0; - if ((gPlayerState.flags.all & 0x80) == 0) { - if (gPlayerState.flags.all & 0x8) { + if ((gPlayerState.flags & 0x80) == 0) { + if (gPlayerState.flags & 0x8) { if (sub_080542AC(gPlayerState.field_0x38)) { temp = 0x45e; } else { @@ -361,12 +362,12 @@ void sub_08071038(Entity* this) { UpdateAnimationSingleFrame(this); - if (sub_08078EFC() || (gTextBox.doTextBox & 0x7f)) + if (sub_08078EFC() || (gMessage.doTextBox & 0x7f)) return; if (this->frames.all & 0x80) { this->attachedEntity = 0; - this->field_0x42 = 0; + this->knockbackDuration = 0; this->iframes = 248; gPlayerState.jumpStatus = 0; sub_080791D0(); @@ -383,16 +384,16 @@ void sub_080710A8(Entity* this) { this->subAction++; - gPlayerState.flags.all |= 1; - gPlayerState.flags.all &= ~(0x400 | 0x800); + gPlayerState.flags |= 1; + gPlayerState.flags &= ~(0x400 | 0x800); gPlayerState.playerAction = 0; if ((gPlayerState.heldObject | gPlayerState.field_0x1a[1]) == 0) { - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { ResetPlayer(); - if ((gPlayerState.flags.all & 0x8) != 0) { + if ((gPlayerState.flags & 0x8) != 0) { gPlayerState.field_0x8 = 0x420; } else { gPlayerState.field_0x8 = 0x810; @@ -405,7 +406,7 @@ void sub_080710A8(Entity* this) { temp = sub_08079FC4(1); asm("lsl r0, r0, #0x4"); - this->field_0x20 = (temp - 4) * 64 * 64; + this->hVelocity = (temp - 4) * 64 * 64; this->speed = 256; sub_0807A108(); @@ -454,8 +455,8 @@ void sub_08071130(Entity* this) { this->actionDelay = 6; - if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags.all & 0x80) == 0)) { - if (gPlayerState.flags.all & 0x8) { + if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags & 0x80) == 0)) { + if (gPlayerState.flags & 0x8) { gPlayerState.field_0x8 = 0x424; } else { gPlayerState.field_0x8 = 0x820; @@ -465,13 +466,13 @@ void sub_08071130(Entity* this) { this->subAction++; sub_08078F60(); - this->field_0x42 = 0; + this->knockbackDuration = 0; SoundReq(SFX_PLY_LAND); } void sub_08071208(Entity* this) { if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { UpdateAnimationSingleFrame(this); } } @@ -484,7 +485,7 @@ void sub_08071208(Entity* this) { void PlayerDrown(Entity* this) { gPlayerState.field_0xa8 = 0x16; - gPlayerState.flags.all |= 4; + gPlayerState.flags |= 4; this->flags &= ~0x80; gUnk_0811BA94[this->subAction](this); } @@ -493,17 +494,17 @@ void sub_0807127C(Entity* this) { this->subAction = 1; this->spritePriority.b1 = 0; - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { this->actionDelay = 0x3c; gPlayerState.field_0x8 = 0xc19; SoundReq(SFX_WATER_SPLASH); } else { - if ((gPlayerState.flags.all & 0x10000) == 0) + if ((gPlayerState.flags & 0x10000) == 0) sub_08004168(this); - CreateFx(this, 11, 0); + CreateFx(this, FX_WATER_SPLASH, 0); - if ((gPlayerState.flags.all & 8) == 0) + if ((gPlayerState.flags & 8) == 0) gPlayerState.field_0x8 = 0x72c; else gPlayerState.field_0x8 = 0x44c; @@ -518,7 +519,7 @@ void sub_080712F0(Entity* this) { temp = FALSE; - if ((gPlayerState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags & 0x80) != 0) { if (--this->actionDelay == 0) temp = TRUE; } else if ((this->frames.all & 0x80) != 0) { @@ -531,11 +532,11 @@ void sub_080712F0(Entity* this) { if (temp == FALSE) return; - this->field_0x42 = 0; + this->knockbackDuration = 0; this->iframes = 32; this->spritePriority.b1 = 1; this->spriteSettings.b.draw = FALSE; - gPlayerState.flags.all &= ~0x4; + gPlayerState.flags &= ~0x4; RespawnPlayer(); } @@ -547,7 +548,7 @@ static void PlayerUsePortal(Entity* this) { if ((this->subAction == 7) || (this->subAction < 3)) return; - if ((gPlayerState.flags.all & 0x20) == 0) + if ((gPlayerState.flags & 0x20) == 0) return; if ((gInput.newKeys & (0x100 | 0x2)) == 0) @@ -568,7 +569,7 @@ void PortalJumpOnUpdate(Entity* this) { u16 y; this->flags &= ~0x80; - this->field_0x42 = 0; + this->knockbackDuration = 0; x = gArea.curPortalX; y = gArea.curPortalY; @@ -583,7 +584,7 @@ void PortalJumpOnUpdate(Entity* this) { UpdateAnimationSingleFrame(this); if (gPlayerState.jumpStatus == 0) { - gPlayerState.flags.all |= 0x20; + gPlayerState.flags |= 0x20; this->subAction = 1; this->animationState = 4; this->spriteSettings.b.flipX = FALSE; @@ -614,13 +615,13 @@ void PortalStandUpdate(Entity* this) { if (--this->actionDelay == 0xff) { this->direction = gPlayerState.field_0xd; this->animationState = this->direction >> 2; - this->field_0x20 = 0x20000; + this->hVelocity = 0x20000; this->speed = 256; this->action = 9; this->subAction = 7; this->field_0xf = 0; - gPlayerState.field_0x8 = (gPlayerState.flags.all & 8) ? 0x41C : 0x80C; - gPlayerState.flags.all &= ~0x20; + gPlayerState.field_0x8 = (gPlayerState.flags & 8) ? 0x41C : 0x80C; + gPlayerState.flags &= ~0x20; return; } this->direction = gPlayerState.field_0xd; @@ -656,7 +657,7 @@ void PortalActivateUpdate(Entity* this) { UpdateAnimationSingleFrame(this); - if (gPlayerState.flags.all & 0x80) + if (gPlayerState.flags & 0x80) this->subAction = 4; } @@ -669,7 +670,7 @@ void PortalShrinkInit(Entity* this) { *(u32*)&this->cutsceneBeh = 0x100; sub_0805EC9C(this, 0x100, 0x100, 0); gPlayerState.field_0x8 = 0x2c3; - gPlayerState.flags.all |= 0x80; + gPlayerState.flags |= 0x80; SoundReq(SFX_PLY_SHRINKING); } @@ -723,14 +724,14 @@ void sub_080717F8(Entity* this) { gUnk_02034490[0] = 0; this->action = 9; this->subAction = 0; - gPlayerState.flags.all = (gPlayerState.flags.all & ~0x20) | 0x80; + gPlayerState.flags = (gPlayerState.flags & ~0x20) | 0x80; sub_0805EC60(this); UnfreezeTime(); } void PlayerTalkEzlo(Entity* this) { if (sub_08078EFC()) { - sub_08056360(); + MessageClose(); sub_08071A6C(); } else { gPlayerState.field_0xa8 = 0x13; @@ -746,7 +747,7 @@ void sub_080718A0(Entity* this) { gUnk_03003DC0.unk0 = 6; this->scriptedScene = 6; - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { this->subAction = 2; this->spritePriority.b1 = 0; sub_08052BB8(); @@ -790,10 +791,10 @@ void sub_0807193C(Entity* this) { void sub_08071990(Entity* this) { u32 temp; - if ((gTextBox.doTextBox & 0x7f) == 0) { + if ((gMessage.doTextBox & 0x7f) == 0) { this->subAction++; - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { if (this->animationState == 2) gPlayerState.field_0x8 = 0x3cd; else @@ -805,7 +806,7 @@ void sub_08071990(Entity* this) { return; } - if (gPlayerState.flags.all & 0x80) + if (gPlayerState.flags & 0x80) return; if (this->animationState == 2) @@ -849,13 +850,13 @@ void sub_08071AB0(Entity* this) { u32 speed; this->subAction++; - gPlayerState.flags.all |= 1; + gPlayerState.flags |= 1; if (this->type == 1) { this->speed = 0; this->actionDelay = 0; this->field_0xf = 1; } else { - this->speed = (gPlayerState.flags.all & 0x80) ? 64 : 128; + this->speed = (gPlayerState.flags & 0x80) ? 64 : 128; } sub_08071AF0(this); } @@ -885,12 +886,12 @@ void sub_08071AF0(Entity* this) { void sub_08071B60(Entity* this) { gPlayerState.pushedObject = 2; - gPlayerState.flags.all &= ~0x1; + gPlayerState.flags &= ~0x1; this->type = 0; - this->field_0x42 = 0; + this->knockbackDuration = 0; sub_080728AC(this); this->field_0xf = 6; - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { gPlayerState.field_0x8 = 0x104; this->spriteIndex = 3; InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x3c); @@ -908,11 +909,11 @@ void PlayerMinishDie(Entity* this) { void sub_08071BDC(Entity* this) { u32 temp; - if (gPlayerState.flags.all & (0x10 | 0x100)) + if (gPlayerState.flags & (0x10 | 0x100)) return; if (sub_08003FC4(this, 0x2000)) { - if ((gPlayerState.flags.all & 8) != 0) + if ((gPlayerState.flags & 8) != 0) gPlayerState.field_0x8 = 0x420; else gPlayerState.field_0x8 = 0x810; @@ -920,7 +921,7 @@ void sub_08071BDC(Entity* this) { } gPlayerState.playerAction = 0; - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { if ((u8)(gPlayerState.field_0x10[2] - 8) < 3) { sub_0807A298(this); RespawnPlayer(); @@ -928,11 +929,11 @@ void sub_08071BDC(Entity* this) { } temp = 0xc1a; } else { - temp = (gPlayerState.flags.all & 8) ? 0x459 : 0x1bc; + temp = (gPlayerState.flags & 8) ? 0x459 : 0x1bc; } gPlayerState.field_0x8 = temp; - gPlayerState.flags.all &= ~(0x1000000 | 0x200000 | 0x40000 | 0x800 | 0x400 | 0x100 | 0x1); + gPlayerState.flags &= ~(0x1000000 | 0x200000 | 0x40000 | 0x800 | 0x400 | 0x100 | 0x1); this->subAction = 1; this->animationState = 4; this->spritePriority.b1 = 1; @@ -948,8 +949,8 @@ void sub_08071CAC(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frames.all & 0x80) { u32 temp; - if ((gPlayerState.flags.all & 0x80) == 0) - temp = (gPlayerState.flags.all & 8) ? 0x45a : 0x2bd; + if ((gPlayerState.flags & 0x80) == 0) + temp = (gPlayerState.flags & 8) ? 0x45a : 0x2bd; else temp = 0xc1b; gPlayerState.field_0x8 = temp; @@ -982,7 +983,7 @@ void sub_08071D04(Entity* this) { gPlayerState.field_0x3c[0] = 0; this->direction = 0xff; this->speed = 0; - this->field_0x20 = 0x18000; + this->hVelocity = 0x18000; gPlayerState.jumpStatus = 1; gPlayerState.swimState = 0; return; @@ -1024,7 +1025,7 @@ void sub_08071E04(Entity* this) { sub_0807A1B8(); if (gPlayerState.field_0x10[2] == 1) { gPlayerState.field_0x10[1] = 7; - gPlayerState.flags.all |= 0x200; + gPlayerState.flags |= 0x200; sub_080791BC(); return; } @@ -1122,7 +1123,7 @@ void sub_08071F80(Entity* this) { if (sub_08079B24() == 0) { sub_08079708(this); } else { - if (gPlayerState.flags.all & 0x800) { + if (gPlayerState.flags & 0x800) { if (sub_0807953C() != 0) { this->actionDelay -= 3; this->spriteOffsetX = 2; @@ -1139,11 +1140,11 @@ void sub_08071F80(Entity* this) { void sub_08072008(Entity* this) { this->iframes = 160; - this->field_0x42 = 0; + this->knockbackDuration = 0; this->flags |= 0x80; this->spriteOffsetX = 0; - gPlayerState.flags.all &= ~(0x800 | 0x1); - CreateFx(this, 0xd, 0); + gPlayerState.flags &= ~(0x800 | 0x1); + CreateFx(this, FX_ICE, 0); sub_080791BC(); } @@ -1193,7 +1194,7 @@ void sub_08072100(Entity* this) { if (gPlayerState.field_0x39) this->direction = 0xff; - if ((gPlayerState.flags.all & 8)) { + if ((gPlayerState.flags & 8)) { gPlayerState.field_0x8 = 0x404; } else { gPlayerState.field_0x8 = 0x104; @@ -1216,7 +1217,7 @@ void sub_08072168(Entity* this) { gPlayerState.field_0xd = this->direction; sub_08019840(); if (--this->actionDelay == 0xff) { - this->field_0x42 = 0; + this->knockbackDuration = 0; this->flags |= 0x80; UpdateSpriteForCollisionLayer(this); sub_080791BC(); @@ -1236,12 +1237,12 @@ void sub_08072214(Entity* this) { this->speed = 128; this->actionDelay = gPlayerState.field_0x38; this->direction = (this->animationState ^ 4) << 2; - if (!(gPlayerState.flags.all & 8)) { + if (!(gPlayerState.flags & 8)) { gPlayerState.field_0x8 = 0x34c; } else { gPlayerState.field_0x8 = 0x944; } - gPlayerState.flags.all |= 1; + gPlayerState.flags |= 1; sub_08072260(this); } @@ -1250,13 +1251,13 @@ void sub_08072260(Entity* this) { sub_08079E08(); UpdateAnimationSingleFrame(this); if (--this->actionDelay == 0) { - gPlayerState.flags.all &= ~0x1; - if (!(gPlayerState.flags.all & 8)) { + gPlayerState.flags &= ~0x1; + if (!(gPlayerState.flags & 8)) { gPlayerState.field_0x8 = 0x34c; } else { gPlayerState.field_0x8 = 0x944; } - this->field_0x42 = 0; + this->knockbackDuration = 0; sub_080791BC(); } } @@ -1272,9 +1273,9 @@ void sub_080722DC(Entity* this) { Entity* ent; this->flags &= ~0x80; - if (!(gPlayerState.flags.all & 0x80)) { + if (!(gPlayerState.flags & 0x80)) { this->subAction = 1; - this->field_0x20 = 0x28000; + this->hVelocity = 0x28000; ent = CreateObject(OBJECT_42, 0x80, 0); if (ent != NULL) { ent->attachedEntity = this; @@ -1283,9 +1284,9 @@ void sub_080722DC(Entity* this) { } else { this->spriteSettings.b.draw = 0; this->subAction = 3; - this->field_0x42 = 10; + this->knockbackDuration = 10; } - gPlayerState.flags.all |= (0x400 | 0x1); + gPlayerState.flags |= (0x400 | 0x1); ResetPlayer(); SoundReq(SFX_124); SoundReq(SFX_PLY_VO6); @@ -1299,13 +1300,13 @@ void sub_08072354(Entity* this) { return; this->spritePriority.b1 = 0; - this->field_0x42 = 0; + this->knockbackDuration = 0; this->subAction = 2; this->actionDelay = 0x3c; gPlayerState.field_0x8 = 0x2c1; - gPlayerState.flags.all &= ~0x400; + gPlayerState.flags &= ~0x400; UpdateSpriteForCollisionLayer(this); - CreateFx(this, 0xc, 0); + CreateFx(this, FX_LAVA_SPLASH, 0); SoundReq(SFX_1A6); } @@ -1320,10 +1321,10 @@ void sub_080723D0(Entity* this) { } void sub_0807240C(Entity* this) { - if (--this->field_0x42 == 0xff) { + if (--this->knockbackDuration == 0xff) { this->spriteSettings.b.draw = 3; this->iframes = 0x14; - gPlayerState.flags.all &= ~0x400; + gPlayerState.flags &= ~0x400; ModHealth(-2); RespawnPlayer(); } @@ -1360,7 +1361,7 @@ void PlayerRoomTransition(Entity* this) { } void sub_080724DC(Entity* this) { - this->field_0x42 = 0; + this->knockbackDuration = 0; sub_0807A108(); if (sub_080002B8(this) != 0x29) { if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) { @@ -1376,7 +1377,7 @@ void sub_080724DC(Entity* this) { this->spriteSettings.b.draw = 3; this->subAction = 1; if (gRoomVars.field_0x0 == 0) { - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { gPlayerState.field_0x8 = 0xc18; } else { gPlayerState.field_0x8 = 0x104; @@ -1420,15 +1421,15 @@ void PlayerRoll(Entity* this) { void sub_08072650(Entity* this) { u32 temp; - if ((gPlayerState.flags.all & 0x200000) == 0) { + if ((gPlayerState.flags & 0x200000) == 0) { sub_0806F948(&gPlayerEntity); this->direction = this->animationState << 2; } this->subAction = 1; this->actionDelay = 0; ResetPlayer(); - temp = gPlayerState.flags.all; - if (gPlayerState.flags.all & 0x80) { + temp = gPlayerState.flags; + if (gPlayerState.flags & 0x80) { this->spritePriority.b1 = 0; gPlayerState.field_0x8 = 0xc08; } else { @@ -1439,7 +1440,7 @@ void sub_08072650(Entity* this) { gPlayerState.field_0x8 = 0x2ac; } } - gPlayerState.flags.all |= 0x40000; + gPlayerState.flags |= 0x40000; if (Random() & 1) { SoundReq(SFX_PLY_VO5); } else { @@ -1449,29 +1450,29 @@ void sub_08072650(Entity* this) { } void sub_080726F4(Entity* this) { - if (((gPlayerState.flags.all & (0x40000 | 0x80000)) != 0x40000) || - (!(gPlayerState.flags.all & 0x200000) && (this->iframes != 0) && (this->bitfield & 0x80))) { - gPlayerState.flags.all &= ~0x40000; + if (((gPlayerState.flags & (0x40000 | 0x80000)) != 0x40000) || + (!(gPlayerState.flags & 0x200000) && (this->iframes != 0) && (this->bitfield & 0x80))) { + gPlayerState.flags &= ~0x40000; if (!sub_08078EFC()) sub_080728AC(this); return; } this->direction = (this->animationState & 6) << 2; - if (((gPlayerState.flags.all & 0x80) == 0) && (--this->actionDelay == 0xff)) { - CreateFx(&gPlayerEntity, 0x11, 0x40); + if (((gPlayerState.flags & 0x80) == 0) && (--this->actionDelay == 0xff)) { + CreateFx(&gPlayerEntity, FX_DASH, 0x40); this->actionDelay = 4; } - if ((gPlayerState.flags.all & 2) == 0) { + if ((gPlayerState.flags & 2) == 0) { sub_0807A1B8(); } if (sub_08078EFC()) { - gPlayerState.flags.all &= ~0x40000; + gPlayerState.flags &= ~0x40000; return; } - if ((gPlayerState.flags.all & 0x80000) != 0) { - gPlayerState.flags.all &= ~0x40000; + if ((gPlayerState.flags & 0x80000) != 0) { + gPlayerState.flags &= ~0x40000; return; } @@ -1479,8 +1480,8 @@ void sub_080726F4(Entity* this) { return; } - if (gPlayerState.flags.all & 0x250) { - gPlayerState.flags.all &= ~0x40000; + if (gPlayerState.flags & 0x250) { + gPlayerState.flags &= ~0x40000; sub_080728AC(this); return; } @@ -1507,7 +1508,7 @@ void sub_080726F4(Entity* this) { sub_08078F24(); sub_08079E08(); } - if (((this->frames.all & 0x10) == 0) && ((gPlayerState.flags.all & 0x80) == 0)) { + if (((this->frames.all & 0x10) == 0) && ((gPlayerState.flags & 0x80) == 0)) { *(u8*)&this->field_0x40 = 0; } if ((this->frames.all & 0x40) != 0) { @@ -1517,31 +1518,31 @@ void sub_080726F4(Entity* this) { sub_080791D0(); } if ((this->frames.all & 0x80) != 0) { - gPlayerState.flags.all &= ~(0x200000 | 0x40000); + gPlayerState.flags &= ~(0x200000 | 0x40000); } UpdateAnimationSingleFrame(this); } void sub_080728AC(Entity* this) { sub_08079938(); - if (gPlayerState.flags.all & 0x80) + if (gPlayerState.flags & 0x80) sub_0807B068(this); else sub_08078F60(); if (gPlayerState.swimState != 0) this->speed = 0; - if (!(gPlayerState.flags.all & 0x40)) + if (!(gPlayerState.flags & 0x40)) gPlayerEntity.spriteSettings.b.draw = 3; - if (!(gPlayerState.flags.all & 0x80)) + if (!(gPlayerState.flags & 0x80)) gPlayerEntity.spritePriority.b1 = 1; if (!(gRoomControls.unk6 & 4)) { - if ((gPlayerState.flags.all & 0x40)) + if ((gPlayerState.flags & 0x40)) this->flags |= 0x80; sub_080791D0(); } - if (!(gPlayerState.flags.all & 2)) { + if (!(gPlayerState.flags & 2)) { sub_0807A1B8(); } } @@ -1562,8 +1563,8 @@ void sub_08072970(Entity* this) { this->spritePriority.b0 = 7; this->spritePriority.b1 = 0; this->actionDelay = 0; - gPlayerState.flags.all |= 0x100000; - if (gPlayerState.flags.all & 8) { + gPlayerState.flags |= 0x100000; + if (gPlayerState.flags & 8) { gPlayerState.field_0x8 = 0x950; } else { gPlayerState.field_0x8 = 0x61c; @@ -1589,7 +1590,7 @@ void sub_08072A60(Entity* this) { } this->subAction = 2; - if (gPlayerState.flags.all & 8) { + if (gPlayerState.flags & 8) { gPlayerState.field_0x8 = 0x954; } else { gPlayerState.field_0x8 = 0x620; @@ -1605,7 +1606,7 @@ void sub_08072ACC(Entity* this) { } else if (this->field_0xf > 7) { this->flags |= 0x80; this->direction = gPlayerState.field_0xd; - this->field_0x20 = 0x1a000; + this->hVelocity = 0x1a000; this->speed = 0x78; this->spritePriority.b0 = 4; this->spritePriority.b1 = 1; @@ -1635,7 +1636,7 @@ void sub_08072B5C(Entity* this) { this->flags |= 0x80; this->spritePriority.b0 = 4; this->speed = 0x40; - this->field_0x20 = 0x39000; + this->hVelocity = 0x39000; this->height.WORD--; gPlayerState.jumpStatus = 0x41; sub_0806F854(this, 0, -12); @@ -1650,7 +1651,7 @@ void sub_08072B5C(Entity* this) { temp <<= 4; temp -= 4; temp <<= 12; - this->field_0x20 = temp; + this->hVelocity = temp; this->speed = 0x100; gPlayerState.field_0x8 = 0x810; SoundReq(0x7c); @@ -1666,7 +1667,7 @@ void sub_08072C48(Entity* this) { if (gPlayerState.field_0x14) { if (sub_08008B22()) { gPlayerState.field_0x10[1] = 7; - if (!(gPlayerState.flags.all & 0x80)) { + if (!(gPlayerState.flags & 0x80)) { sub_080791BC(); } } @@ -1703,7 +1704,7 @@ void sub_08072CFC(Entity* this) { if (gPlayerState.field_0x38 < 8) { gPlayerState.field_0x38 = 8; } - this->field_0x20 = gPlayerState.field_0x38 << 0xc; + this->hVelocity = gPlayerState.field_0x38 << 0xc; this->speed = 0x200; gPlayerState.field_0x8 = 0x810; this->actionDelay = 5; @@ -1782,19 +1783,19 @@ NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(Entity* t if (gPlayerState.field_0x14 != 0) { if (sub_08008B22() == 0) { gPlayerState.field_0x10[1] = 7; - if (!(gPlayerState.flags.all & 0x80)) { + if (!(gPlayerState.flags & 0x80)) { sub_080791BC(); } } } else { - if ((gPlayerState.flags.all & 8)) { + if ((gPlayerState.flags & 8)) { gPlayerState.field_0x8 = 0x424; } else { gPlayerState.field_0x8 = 0x820; } this->actionDelay = 6; this->subAction = 3; - this->field_0x42 = 0; + this->knockbackDuration = 0; SoundReq(0x7d); } } @@ -1816,9 +1817,9 @@ void sub_08072F34(Entity* this) { gPlayerState.field_0xa8 = 0x18; gPlayerState.field_0x10[2] = sub_0807A1E8(this, 0, 0); gUnk_0811BBE4[this->subAction](this); - if (this->field_0x42 != 0) { + if (this->knockbackDuration != 0) { sub_080792D8(); - if (this->field_0x42 == 0) { + if (this->knockbackDuration == 0) { this->action = 0x1d; this->subAction = 0; this->y.HALF.LO = 0; @@ -1897,8 +1898,8 @@ void sub_08073094(Entity* this) { switch (gPlayerState.field_0x10[2]) { case 0x2a: case 0x2c: - this->field_0x42 = 0; - gPlayerState.flags.all |= 0x20000000; + this->knockbackDuration = 0; + gPlayerState.flags |= 0x20000000; UpdateAnimationSingleFrame(this); if ((this->frames.all & 0x40) != 0) { sub_0807A1B8(); diff --git a/src/playerItem/playerItem10.c b/src/playerItem/playerItem10.c index 89f24d2e..9ffc8e2c 100644 --- a/src/playerItem/playerItem10.c +++ b/src/playerItem/playerItem10.c @@ -1,16 +1,77 @@ #include "entity.h" #include "player.h" #include "functions.h" +#include "random.h" extern void (*const gUnk_0812AA80[])(Entity*); -extern Hitbox* gUnk_0812AAD8[]; bool32 sub_080ACDB0(Entity*); void sub_080ACC78(Entity*); void sub_080ACECC(Entity*); -extern u8 gUnk_0812AAE8[]; +typedef struct { + u16 bits; + u8 type2; + u8 actionDelay; + u8 _4; + u8 type; + u16 tileID; +} Obj11; + +Obj11* sub_08008782(Entity*, u32, u32, u32); + +const s8 gUnk_0812AA88[] = { + -4, -4, 4, -4, -4, 4, 4, 4, 0, +}; + +const s8 gUnk_0812AA91[] = { + -5, -5, 5, -5, -5, 5, 5, 5, 0, +}; + +const s8 gUnk_0812AA9A[] = { + -9, -9, 1, -9, 9, -9, -9, 1, 9, 1, -9, 9, 1, 9, 9, 9, 0, 0, +}; + +const s8* const gUnk_0812AAAC[] = { + gUnk_0812AA88, + gUnk_0812AA91, + gUnk_0812AA91, + gUnk_0812AA9A, +}; + +const s8 gUnk_0812AABC[] = { + 0x78, + 0x50, + 0x28, + 0x4, +}; + +const Hitbox gUnk_0812AAC0 = { + 0, 0, 4, 2, 2, 4, 4, 4, +}; + +const Hitbox gUnk_0812AAC8 = { + 0, 0, 4, 3, 3, 4, 9, 9, +}; + +const Hitbox gUnk_0812AAD0 = { + 0, 0, 8, 7, 7, 8, 14, 14, +}; + +const Hitbox* const gUnk_0812AAD8[] = { + &gUnk_0812AAC0, + &gUnk_0812AAC8, + &gUnk_0812AAC8, + &gUnk_0812AAD0, +}; + +const u8 gUnk_0812AAE8[] = { + 0, + 12, + 16, + 16, +}; void PlayerItem10(Entity* this) { if ((gPlayerState.field_0x1c & 0x7f) != 1) { @@ -27,7 +88,7 @@ void sub_080ACC04(Entity* this) { this->speed = 0x200; this->flags |= 0xa0; this->field_0x3c = 2; - this->hitbox = gUnk_0812AAD8[this->type]; + this->hitbox = (Hitbox*)gUnk_0812AAD8[this->type]; this->field_0x70.WORD = 0x10; sub_080ACDB0(this); sub_0801766C(this); @@ -40,7 +101,72 @@ void sub_080ACC5C(Entity* this) { } } -ASM_FUNC("asm/non_matching/playerItem10/sub_080ACC78.inc", void sub_080ACC78(Entity* this)) +void sub_080ACC78(Entity* this) { + s32 width; + Obj11* o; + Entity* child; + s32 offset; + const s8* puVar8; + + if ((this->type + gScreenTransition.frameCount) & 1) { + puVar8 = gUnk_0812AAAC[this->type]; + if (puVar8[*(u32*)&this->field_0x74] == 0) { + *(u32*)&this->field_0x74 = 0; + } + o = sub_08008782(this, 0xe, puVar8[*(u32*)&this->field_0x74], puVar8[*(u32*)&this->field_0x74 + 1]); + if (o != NULL) { + child = CreateObject(0x11, o->type, o->type2); + if (child != NULL) { + child->actionDelay = o->actionDelay; + child->x.HALF.HI = puVar8[*(u32*)&this->field_0x74] + this->x.HALF.HI; + child->y.HALF.HI = puVar8[*(u32*)&this->field_0x74 + 1] + this->y.HALF.HI; + } + } + *(u32*)&this->field_0x74 += 2; + } + if (this->attachedEntity == NULL && (u32)this->field_0x70.WORD > 2) { + this->field_0x70.WORD = 1; + } + + if (--this->field_0x70.WORD != -1) { + return; + } + if (this->attachedEntity == NULL) { + this->field_0x70.WORD = 2; + } else { + this->field_0x70.WORD = gUnk_0812AABC[this->type]; + } + child = CreateObject(0x17, 0, 0); + if (child == NULL) { + return; + } + offset = Random() % 16; + width = this->hitbox->width; + if (width < offset) { + offset = width; + } + if (offset & 1) { + offset = -offset; + } + switch (this->animationState >> 1) { + case 0: + child->y.HALF.HI = this->y.HALF.HI - this->hitbox->height; + child->x.HALF.HI = this->x.HALF.HI + offset; + break; + case 2: + child->y.HALF.HI = this->y.HALF.HI + this->hitbox->height; + child->x.HALF.HI = this->x.HALF.HI + offset; + break; + case 1: + child->x.HALF.HI = this->x.HALF.HI + this->hitbox->width; + child->y.HALF.HI = this->y.HALF.HI + offset; + break; + case 3: + child->x.HALF.HI = this->x.HALF.HI - this->hitbox->width; + child->y.HALF.HI = this->y.HALF.HI + offset; + break; + } +} ASM_FUNC("asm/non_matching/playerItem10/sub_080ACDB0.inc", bool32 sub_080ACDB0(Entity* this)) diff --git a/src/playerItem/playerItem14.c b/src/playerItem/playerItem14.c index 5883ccc2..dca41640 100644 --- a/src/playerItem/playerItem14.c +++ b/src/playerItem/playerItem14.c @@ -3,6 +3,7 @@ #include "functions.h" #include "player.h" #include "room.h" +#include "effects.h" extern void (*const gUnk_08109AC8[])(Entity*); extern Hitbox gUnk_08109AD0; @@ -46,11 +47,11 @@ void sub_0805FC74(Entity* this) { } if (!sub_080002F0(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) && sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI)) { - CreateFx(this, 0x19, 0); + CreateFx(this, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } if (this->bitfield != 0) { - CreateFx(this, 0x19, 0); + CreateFx(this, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } } else { diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index 351a2907..7f6aaf22 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.h" #include "functions.h" +#include "effects.h" extern void (*const gUnk_080B3E30[])(Entity*); @@ -33,6 +34,6 @@ void sub_08019444(Entity* this) { void sub_08019468(Entity* this) { if (this->field_0x40 == 0x0e) { - CreateFx(this, 0x50, 0); + CreateFx(this, FX_REFLECT5, 0); } } diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index 7329b69b..8fb41232 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -3,6 +3,7 @@ #include "coord.h" #include "functions.h" #include "audio.h" +#include "effects.h" extern void (*const gUnk_080B43F4[])(Entity*); @@ -70,11 +71,11 @@ void sub_08019580(Entity* this) { } if ((sub_080002F0(TILE(this->x.HALF.HI, this->y.HALF.HI), gPlayerEntity.collisionLayer, 0x80) == 0) && (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) != 0)) { - CreateFx(this, 0x19, 0); + CreateFx(this, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } if (this->bitfield != 0) { - CreateFx(this, 0x19, 0); + CreateFx(this, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } if (sub_08008790(this, 0xc) != NULL) { diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c index 48db32b3..fc6d3305 100644 --- a/src/projectile/arrowProjectile.c +++ b/src/projectile/arrowProjectile.c @@ -34,7 +34,7 @@ void sub_080A9334(Entity* this) { if ((this->bitfield & 0x3f) != 0) { ModHealth(-2); sub_080A9488(this); - this->field_0x42 = 0; + this->knockbackDuration = 0; this->iframes = 0; } else { DeleteThisEntity(); @@ -48,7 +48,7 @@ void ArrowProjectile_Init(Entity* this) { this->flags &= 0x7f; this->actionDelay = 0x6a; this->field_0xf = 0; - this->field_0x20 = 0xa00; + this->hVelocity = 0xa00; sub_080A94C0(this, this->type); } @@ -106,8 +106,8 @@ void sub_080A9488(Entity* this) { this->action = 4; this->flags &= 0x7f; this->actionDelay = 2; - this->field_0x20 = 0x18000; - this->animationState = (this->field_0x3e & 0x18) >> 3; + this->hVelocity = 0x18000; + this->animationState = (this->knockbackDirection & 0x18) >> 3; EnqueueSFX(SFX_METAL_CLINK); sub_080A94C0(this, this->animationState); } diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index 61f60863..cfa5f3ed 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -59,7 +59,7 @@ void BoneProjectile_Action2(Entity* this) { this->action = 3; this->flags = this->flags & 0x7f; this->speed = 0xe0; - this->field_0x20 = 0xe000; + this->hVelocity = 0xe000; } } @@ -83,7 +83,7 @@ void BoneProjectile_Action4(Entity* this) { void sub_080A82D8(Entity* this) { this->action = 4; this->flags &= 0x7f; - this->field_0x20 = 0x10000; + this->hVelocity = 0x10000; this->direction ^= 0x10; this->speed = 0x80; } diff --git a/src/projectile/cannonballProjectile.c b/src/projectile/cannonballProjectile.c index 950b6159..2f4c8339 100644 --- a/src/projectile/cannonballProjectile.c +++ b/src/projectile/cannonballProjectile.c @@ -1,6 +1,7 @@ #include "entity.h" #include "enemy.h" #include "functions.h" +#include "effects.h" extern void CreateItemOnGround(Entity*); extern s32 sub_080AF090(Entity*); @@ -27,7 +28,7 @@ void sub_080AB544(Entity* this) { if (this->iframes < -4) { this->action = 2; - this->direction = this->field_0x3e; + this->direction = this->knockbackDirection; tmp = (this->type ^ 2) << 3; if (this->direction - tmp + 1 < 3) { this->direction = tmp; @@ -46,7 +47,7 @@ void CannonballProjectile_Init(Entity* this) { void CannonballProjectile_Action1(Entity* this) { GetNextFrame(this); if (sub_080AF090(this) == 0) { - CreateFx(this, 2, 0); + CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); } sub_080AB5F4(this); @@ -56,7 +57,7 @@ void CannonballProjectile_Action2(Entity* this) { GetNextFrame(this); sub_080AF090(this); if ((sub_080AB634(this) == 0) && (this->collisions != 0)) { - CreateFx(this, 2, 0); + CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); } } @@ -77,7 +78,7 @@ bool32 sub_080AB5F4(Entity* this) { } bool32 sub_080AB634(Entity* this) { - Entity** entities = ((Entity**)&this->parent->field_0x20); + Entity** entities = ((Entity**)&this->parent->hVelocity); u32 i; for (i = 0; i <= 3; ++i) { if (entities[i] != NULL && (sub_080177A0(this, entities[i]) != 0)) { @@ -85,7 +86,7 @@ bool32 sub_080AB634(Entity* this) { entities[i]->action = 3; entities[i]->actionDelay = 0x1e; entities[i]->spriteSettings.b.draw = 0; - CreateFx(entities[i], 0x45, 0); + CreateFx(entities[i], FX_WHITE_ROCK, 0); } DeleteEntity(this); return TRUE; diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c index e17caa58..40c51e69 100644 --- a/src/projectile/dekuSeedProjectile.c +++ b/src/projectile/dekuSeedProjectile.c @@ -30,7 +30,7 @@ void sub_080A8470(Entity* this) { } DeleteEntity(this); } else { - this->direction = (this->field_0x3e + 4) & 0x18; + this->direction = DirectionRoundUp(this->knockbackDirection); if ((u8)(this->bitfield + 0x7e) < 2) { sub_080A8680(this); } else { @@ -74,14 +74,14 @@ void DekuSeedProjectile_Action1(Entity* this) { parent = this->parent; if ((parent->next != NULL) && (sub_080177A0(this, parent) != 0)) { this->iframes = 0x10; - this->field_0x3e = -this->direction; + this->knockbackDirection = -this->direction; this->bitfield = -0x80; - this->field_0x42 = 0xc; + this->knockbackDuration = 0xc; this->field_0x46 = 0; parent->iframes = 0x10; - parent->field_0x3e = this->direction; + parent->knockbackDirection = this->direction; parent->bitfield = -0x3e; - parent->field_0x42 = 0xc; + parent->knockbackDuration = 0xc; parent->field_0x46 = 0; } } diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index fd2765e7..fd5909b8 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -3,6 +3,7 @@ #include "player.h" #include "coord.h" #include "functions.h" +#include "effects.h" extern void sub_08078954(Entity*); @@ -47,7 +48,7 @@ void DirtBallProjectile_Init(Entity* this) { this->action = 1; this->subAction = 0; this->spriteSettings.b.shadow = 1; - this->field_0x20 = 0x8000; + this->hVelocity = 0x8000; this->hitbox = (Hitbox*)&gUnk_08129764; this->field_0x3c |= 0x10; switch (this->type) { @@ -129,13 +130,13 @@ void DirtBallProjectile_Action2(Entity* this) { if (tmp != 0) { switch (tmp) { case 2: - CreateFx(this, 0xb, 0); + CreateFx(this, FX_WATER_SPLASH, 0); break; case 1: - CreateFx(this, 0, 0); + CreateFx(this, FX_FALL_DOWN, 0); break; case 3: - CreateFx(this, 0xc, 0); + CreateFx(this, FX_LAVA_SPLASH, 0); break; } DeleteThisEntity(); @@ -148,7 +149,7 @@ void DirtBallProjectile_Action2(Entity* this) { this->action = 3; return; case 2: - entity = CreateFx(this, 5, 0x80); + entity = CreateFx(this, FX_POT_SHATTER, 0x80); if (entity != NULL) { entity->parent = NULL; } diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index 287b0013..d48820b0 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -5,6 +5,7 @@ #include "functions.h" #include "random.h" #include "audio.h" +#include "effects.h" extern void sub_0806F5BC(Entity*, u32, u32); extern u32 sub_080041DC(Entity*, u32, u32); @@ -35,7 +36,7 @@ void GleerokProjectile_Init(Entity* this) { s32 iVar2; this->action = 1; - this->field_0x20 = -0x10000; + this->hVelocity = -0x10000; if (this->type != 3) { CopyPosition(this->parent, this); sub_0806F5BC(this, 0x1000, this->direction); @@ -62,11 +63,11 @@ void GleerokProjectile_Init(Entity* this) { } else if (0x400 < iVar2) { iVar2 = 0x400; } - this->field_0x20 = this->height.WORD / (iVar2 << 8) << 0xd; + this->hVelocity = this->height.WORD / (iVar2 << 8) << 0xd; this->field_0xf = 0x1e; break; case 2: - this->field_0x20 = (this->height.WORD / 0x18000) << 0xc; + this->hVelocity = (this->height.WORD / 0x18000) << 0xc; break; case 3: this->height.WORD = 0xff600000; @@ -90,7 +91,7 @@ void GleerokProjectile_Action1(Entity* this) { if (this->type == 3) { if (sub_08003FC4(this, 0x1800) == 0) { sub_08008790(this, 7); - CreateFx(this, 4, 0); + CreateFx(this, FX_ROCK, 0); DeleteThisEntity(); } } else { diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c index 9cbe3a22..2fff5c06 100644 --- a/src/projectile/guardLineOfSight.c +++ b/src/projectile/guardLineOfSight.c @@ -35,7 +35,7 @@ void GuardLineOfSight(Entity* this) { entity = CreateProjectile(0xc); if (entity != NULL) { entity->type = 1; - tmp = this->parent->field_0x3e; + tmp = this->parent->knockbackDirection; entity->direction = (gUnk_081299C8[(this->actionDelay >> 2 & 7)] + (tmp << 3)) & 0x1f; entity->parent = this->parent; CopyPosition(this, entity); diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c index 76ac9ea5..25599826 100644 --- a/src/projectile/lakituCloudProjectile.c +++ b/src/projectile/lakituCloudProjectile.c @@ -2,6 +2,7 @@ #include "enemy.h" #include "functions.h" #include "player.h" +#include "effects.h" extern void sub_0800449C(Entity*, u32); extern void sub_08079D84(void); @@ -26,7 +27,7 @@ void nullsub_539(Entity* this) { void sub_080A9CF0(Entity* this) { if (sub_0806F520() == 0) { - CreateFx(this, 2, 0); + CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); } LakituCloudProjectile_SubActions[this->subAction](this); @@ -46,7 +47,7 @@ void LakituCloudProjectile_SubAction2(Entity* this) { sub_0800449C(&gPlayerEntity, 0x7a); sub_08079D84(); } - CreateFx(this, 2, 0); + CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); } } diff --git a/src/projectile/lakituLightning.c b/src/projectile/lakituLightning.c index 8d055ba6..975491c2 100644 --- a/src/projectile/lakituLightning.c +++ b/src/projectile/lakituLightning.c @@ -1,5 +1,6 @@ #include "entity.h" #include "enemy.h" +#include "effects.h" extern s32 sub_080AF090(Entity*); extern s32 sub_080A7EB0(Entity*); @@ -35,7 +36,7 @@ void LakituLightning_Action1(Entity* this) { GetNextFrame(this); sub_080AF090(this); if ((this->collisions != 0) || (--this->actionDelay == 0)) { - CreateFx(this, 0x4f, 0); + CreateFx(this, FX_BLUE_EFC, 0); DeleteThisEntity(); } if (sub_080A7EB0(this) != 0) { diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c index 0ab5c3ad..1bcfd7cf 100644 --- a/src/projectile/mandiblesProjectile.c +++ b/src/projectile/mandiblesProjectile.c @@ -66,14 +66,14 @@ void sub_080A9EBC(Entity* this) { default: parent = this->parent; parent->iframes = this->iframes; - parent->field_0x3e = this->field_0x3e; - parent->field_0x42 = this->field_0x42; + parent->knockbackDirection = this->knockbackDirection; + parent->knockbackDuration = this->knockbackDuration; if (this->action == 1) { sub_080AA320(this); } break; } - this->field_0x42 = 0; + this->knockbackDuration = 0; } } diff --git a/src/projectile/moblinSpear.c b/src/projectile/moblinSpear.c index a4123e20..c24e3480 100644 --- a/src/projectile/moblinSpear.c +++ b/src/projectile/moblinSpear.c @@ -27,7 +27,7 @@ void sub_080A832C(Entity* this) { if (this->bitfield == 0x80) { this->iframes = 0x10; - this->field_0x42 = 0xc; + this->knockbackDuration = 0xc; this->field_0x46 = 0x180; this->parent->bitfield = this->bitfield; } @@ -37,10 +37,10 @@ void sub_080A832C(Entity* this) { } else { this->parent->iframes = -tmp; } - this->parent->field_0x42 = this->field_0x42; + this->parent->knockbackDuration = this->knockbackDuration; this->parent->field_0x46 = this->field_0x46; - this->parent->field_0x3e = this->field_0x3e; - this->field_0x42 = 0; + this->parent->knockbackDirection = this->knockbackDirection; + this->knockbackDuration = 0; } void MoblinSpear_Init(Entity* this) { diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index e927283e..5b1f8e44 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -3,6 +3,7 @@ #include "random.h" #include "functions.h" #include "audio.h" +#include "effects.h" void OctorokBossProjectile_Action2(Entity*); extern void sub_080AE58C(Entity*, u32, u32); @@ -39,7 +40,7 @@ void OctorokBossProjectile_Init(Entity* this) { this->spriteRendering.b3 = 3; this->spritePriority.b0 = 6; this->speed = (Random() & 0x1ff) + 0x200; - this->field_0x20 = (Random() & 0x1fff) + 0x18000; + this->hVelocity = (Random() & 0x1fff) + 0x18000; uVar1 = (((u8)Random() & 7) - 4); this->direction -= uVar1; *(u32*)&this->field_0x78 = 600; @@ -84,7 +85,7 @@ void OctorokBossProjectile_Action1(Entity* this) { if ((this->bitfield & 0x7f) == 0) { OctorokBossProjectile_Action2(this); } - this->direction = this->field_0x3e << 3; + this->direction = this->knockbackDirection << 3; this->speed = 0x400; this->type2 = 1; this->actionDelay = 0; @@ -98,9 +99,9 @@ void OctorokBossProjectile_Action1(Entity* this) { this->parent->currentHealth -= 1; this->parent->iframes = 0x1e; if (this->parent->field_0x7c.BYTES.byte0 != 0) { - this->parent->field_0x42 = 0x18; + this->parent->knockbackDuration = 0x18; this->parent->field_0x46 = 0x200; - this->parent->field_0x3e = this->direction >> 3; + this->parent->knockbackDirection = this->direction >> 3; } SoundReq(SFX_BOSS_HIT); OctorokBossProjectile_Action2(this); @@ -183,14 +184,14 @@ void OctorokBossProjectile_Action1(Entity* this) { if (sub_08003FC4(this, 0x1800) != 0) { return; } - CreateFx(this, 4, 0); + CreateFx(this, FX_ROCK, 0); DeleteThisEntity(); break; } } void OctorokBossProjectile_Action2(Entity* this) { - CreateFx(this, 4, 0); + CreateFx(this, FX_ROCK, 0); DeleteThisEntity(); } diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index e9e47b2c..72d34a73 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -23,7 +23,7 @@ void sub_080A8064(Entity* this) { if (this->bitfield == 0x80) { DeleteEntity(this); } else { - this->direction = this->field_0x3e; + this->direction = this->knockbackDirection; sub_080A8178(this); } } @@ -31,7 +31,7 @@ void sub_080A8064(Entity* this) { void RockProjectile_Init(Entity* this) { this->action = 1; this->actionDelay = 0x30; - this->field_0x20 = 0xa000; + this->hVelocity = 0xa000; InitializeAnimation(this, 0); } @@ -86,7 +86,7 @@ void sub_080A8178(Entity* this) { this->action = 2; this->flags &= 0x7f; this->speed = 0x40; - this->field_0x20 = 0x14000; + this->hVelocity = 0x14000; } void (*const RockProjectile_Functions[])(Entity*) = { diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c index c743fcbc..fb75691e 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -1,6 +1,7 @@ #include "entity.h" #include "enemy.h" #include "functions.h" +#include "effects.h" extern void (*const StalfosProjectile_Functions[])(Entity*); extern void (*const StalfosProjectile_Actions[])(Entity*); @@ -32,7 +33,7 @@ void sub_080A9A34(Entity* this) { if (this->bitfield == 0x9d) { this->action = 3; this->flags &= 0x7f; - this->field_0x20 = 0x2a000; + this->hVelocity = 0x2a000; this->spritePriority.b1 = 1; } } @@ -76,7 +77,7 @@ void StalfosProjectile_Init(Entity* this) { break; case 2: this->action = 3; - this->field_0x20 = 0x2a000; + this->hVelocity = 0x2a000; this->spritePriority.b1 = 1; break; default: @@ -116,7 +117,7 @@ void StalfosProjectile_Action2(Entity* this) { } void StalfosProjectile_Action3(Entity* this) { - if (this->field_0x20 < 0) { + if (this->hVelocity < 0) { this->spriteSettings.b.flipY = 1; } if (sub_08003FC4(this, 0x2000) == 0) { @@ -126,9 +127,9 @@ void StalfosProjectile_Action3(Entity* this) { void sub_080A9BA8(Entity* this) { if (this->type == 0) { - CreateFx(this, 5, 0); + CreateFx(this, FX_POT_SHATTER, 0); } else { - CreateFx(this, 0x3c, 0); + CreateFx(this, FX_BONE, 0); } DeleteThisEntity(); } diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index baa70ecb..dc9c97c3 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -49,8 +49,8 @@ void sub_080AAC44(Entity* this) { CopyPosition(this->parent, this); } } - if (this->field_0x42 != 0) { - this->field_0x42 = 0; + if (this->knockbackDuration != 0) { + this->knockbackDuration = 0; } } diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c index cad6d879..00dff22b 100644 --- a/src/projectile/v1FireProjectile.c +++ b/src/projectile/v1FireProjectile.c @@ -42,7 +42,7 @@ void V1FireProjectile_Init(Entity* this) { s8* data; this->action = 1; - this->field_0x20 = -0x10000; + this->hVelocity = -0x10000; this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); CopyPosition(this->parent, this); sub_0806F5BC(this, 0x1000, this->direction); @@ -68,7 +68,7 @@ void V1FireProjectile_Init(Entity* this) { iVar2 = 0x20; } } - this->field_0x20 = (this->height.WORD / (iVar2 << 8)) << 0xd; + this->hVelocity = (this->height.WORD / (iVar2 << 8)) << 0xd; this->direction = sub_080045B4(this, x, y); } diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c index 0420790b..ffb558a1 100644 --- a/src/projectile/v2Projectile.c +++ b/src/projectile/v2Projectile.c @@ -4,6 +4,7 @@ #include "functions.h" #include "random.h" #include "audio.h" +#include "effects.h" extern void (*const V2Projectile_Functions[])(Entity*); extern void (*const gUnk_0812A7EC[])(Entity*); @@ -26,7 +27,7 @@ ASM_FUNC("asm/non_matching/v2Projectile/sub_080ABBF4.inc", void sub_080ABBF4(Ent void sub_080ABC54(Entity* this) { if (sub_0806F520() == 0) { - CreateFx(this, 2, 0); + CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); } gUnk_0812A808[this->subAction](this); @@ -44,7 +45,7 @@ void sub_080ABC90(Entity* this) { ModHealth(-2); sub_0800449C(&gPlayerEntity, 0x7a); sub_08079D84(); - CreateFx(this, 2, 0); + CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); } } @@ -96,7 +97,7 @@ ASM_FUNC("asm/non_matching/v2Projectile/sub_080ABE04.inc", void sub_080ABE04(Ent void sub_080ABE88(Entity* this) { if (sub_08003FC4(this, 0x1800) == 0) { - CreateFx(this, 4, 0); + CreateFx(this, FX_ROCK, 0); DeleteThisEntity(); } } diff --git a/src/projectile/v3TennisBallProjectile.c b/src/projectile/v3TennisBallProjectile.c index 82d64a3c..d2c4ef74 100644 --- a/src/projectile/v3TennisBallProjectile.c +++ b/src/projectile/v3TennisBallProjectile.c @@ -2,6 +2,7 @@ #include "enemy.h" #include "audio.h" #include "functions.h" +#include "effects.h" extern s32 sub_080AF090(Entity*); extern s32 sub_080A7EB0(Entity*); @@ -56,7 +57,7 @@ void sub_080ACB90(Entity* this) { Entity* parent = this->parent; if ((this->x.HALF.HI == parent->x.HALF.HI) && (this->y.HALF.HI <= parent->y.HALF.HI)) { parent->field_0xf = 1; - CreateFx(this, 0x1f, 0x40); + CreateFx(this, FX_REFLECT2, 0x40); EnqueueSFX(SFX_ITEM_GLOVES_KNOCKBACK); DeleteThisEntity(); } @@ -13,6 +13,7 @@ #include "script.h" #include "random.h" #include "functions.h" +#include "effects.h" void sub_0804B3C4(void* arg0) { sub_0804B29C(arg0); @@ -2240,7 +2241,7 @@ u32 sub_unk3_DeepwoodShrine_Entrance() { #if defined(DEMO_USA) || defined(DEMO_JP) void sub_StateChange_DeepwoodShrine_Entrance() { #ifdef DEMO_USA - if (gUnk_02000000->saveFileId != 0 && GetInventoryValue(0x40) == 0) { + if (gSaveHeader->saveFileId != 0 && GetInventoryValue(0x40) == 0) { #else #ifdef DEMO_JP if (GetInventoryValue(0x40) == 0) { @@ -4871,7 +4872,7 @@ extern EntityData gUnk_080F30CC; void sub_StateChange_HouseInteriors2_Stockwell(void) { // dog food - if ((GetInventoryValue(0x36) == 1) && !CheckGlobalFlag(BIN_DOGFOOD) && (gPlayerState.flags.all & 0x80) == 0) { + if ((GetInventoryValue(0x36) == 1) && !CheckGlobalFlag(BIN_DOGFOOD) && (gPlayerState.flags & 0x80) == 0) { LoadRoomEntityList(&gUnk_080F30CC); } } @@ -4895,7 +4896,7 @@ void sub_StateChange_HouseInteriors2_LinksHouseBedroom(void) { gArea.musicIndex = gArea.pMusicIndex; SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP); } - if ((gPlayerState.flags.all & 8) == 0) { + if ((gPlayerState.flags & 8) == 0) { LoadRoomEntityList(&gUnk_080F31D8); } } @@ -5831,7 +5832,7 @@ void sub_0804F5E8(void) { void sub_0804F680(Entity* parent, s32 x, s32 y) { Entity* fx; - fx = CreateFx(parent, 2, 0); + fx = CreateFx(parent, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI = gRoomControls.roomOriginX + x; fx->y.HALF.HI = gRoomControls.roomOriginY + y; @@ -5872,13 +5873,13 @@ void sub_0804F760(Entity* this) { void sub_0804F79C(Entity* parent) { Entity* fx; - fx = CreateFx(parent, 0x35, 0); + fx = CreateFx(parent, FX_BIG_EXPLOSION, 0); if (fx != NULL) { fx->spriteRendering.b3 = 0; fx->x.HALF.HI = gRoomControls.roomOriginX + 0x1b8; fx->y.HALF.HI = gRoomControls.roomOriginY + 0x148; } - fx = CreateFx(parent, 0x35, 0); + fx = CreateFx(parent, FX_BIG_EXPLOSION, 0); if (fx != NULL) { fx->spriteRendering.b3 = 0; fx->x.HALF.HI = gRoomControls.roomOriginX + 0x238; @@ -63,13 +63,12 @@ asm("demoPointer1: .incbin \"baserom_demo.gba\", 0x11e010, 0x500"); asm("demoPointer2: .incbin \"baserom_demo.gba\", 0x11e510, 0x500"); asm("demoPointer3: .incbin \"baserom_demo.gba\", 0x11ea10, 0x500"); -extern const u32 demoPointer1; -extern const u32 demoPointer2; -extern const u32 demoPointer3; +extern const u8 demoPointer1[]; +extern const u8 demoPointer2[]; +extern const u8 demoPointer3[]; -const u32 demoPointers[] = { (u32)&demoPointer1, (u32)&demoPointer2, (u32)&demoPointer3 }; +const u8* const demoPointers[] = { demoPointer1, demoPointer2, demoPointer3 }; #endif - #else #if defined(JP) || defined(EU) @@ -116,14 +115,14 @@ SaveResult HandleSaveInProgress(u32 arg0) { InitDMA(); switch (arg0) { case 0: - temp = WriteSaveFile(gUnk_02000000->saveFileId, &gSave); + temp = WriteSaveFile(gSaveHeader->saveFileId, &gSave); break; case 1: - SetFileStatusDeleted(gUnk_02000000->saveFileId); + SetFileStatusDeleted(gSaveHeader->saveFileId); temp = 1; break; case 2: - temp = Write_02000000(gUnk_02000000); + temp = Write_02000000(gSaveHeader); break; } gMenu.field_0xa = temp; diff --git a/src/script.c b/src/script.c index 28b469b9..655eb3b5 100644 --- a/src/script.c +++ b/src/script.c @@ -11,6 +11,8 @@ #include "random.h" #include "audio.h" #include "functions.h" +#include "main.h" +#include "effects.h" void InitScriptForEntity(Entity*, ScriptExecutionContext*, u16*); void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script); @@ -73,7 +75,7 @@ void ScriptCommand_WaitForPlayerAction0x17(Entity* entity, ScriptExecutionContex void ScriptCommand_WaitFor_1(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_WaitFor_2(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807E778(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807E788(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_SetFadeMask(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context); void ScriptCommandNop2(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_DoFade4(Entity* entity, ScriptExecutionContext* context); @@ -104,11 +106,11 @@ void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807EA88(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_TextboxNoOverlapFollow(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_TextboxNoOverlap(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_TextboxNoOverlapFollowPos(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_TextboxNoOverlapFollowTable(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_TextboxNoOverlapVar(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_MessageFromTarget(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_MessageNoOverlap(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_MessageFromTargetPos(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_MessageFromTargetTable(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_MessageNoOverlapVar(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807EB28(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807EB38(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807EB44(Entity* entity, ScriptExecutionContext* context); @@ -157,7 +159,7 @@ void ScriptCommand_0807F0C8(Entity* entity, ScriptExecutionContext* context); extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32); extern void CreateSpeechBubbleQuestionMark(Entity*, u32, u32); -extern void sub_0801C4A0(u32); +extern void RecoverUI(u32); typedef void (*ScriptCommand)(Entity*, ScriptExecutionContext*); @@ -218,7 +220,7 @@ const ScriptCommand gScriptCommands[] = { ScriptCommandNop, ScriptCommand_WaitFor_1, ScriptCommand_WaitFor_2, ScriptCommand_0807E778, - ScriptCommand_0807E788, + ScriptCommand_SetFadeMask, ScriptCommand_0807E79C, ScriptCommandNop2, ScriptCommand_DoFade4, @@ -251,11 +253,11 @@ const ScriptCommand gScriptCommands[] = { ScriptCommandNop, ScriptCommand_0807EA4C, ScriptCommand_0807EA88, ScriptCommand_WaitUntilTextboxCloses, - ScriptCommand_TextboxNoOverlapFollow, - ScriptCommand_TextboxNoOverlap, - ScriptCommand_TextboxNoOverlapFollowPos, - ScriptCommand_TextboxNoOverlapFollowTable, - ScriptCommand_TextboxNoOverlapVar, + ScriptCommand_MessageFromTarget, + ScriptCommand_MessageNoOverlap, + ScriptCommand_MessageFromTargetPos, + ScriptCommand_MessageFromTargetTable, + ScriptCommand_MessageNoOverlapVar, ScriptCommand_0807EB28, ScriptCommand_0807EB38, ScriptCommand_0807EB44, @@ -301,6 +303,9 @@ const ScriptCommand gScriptCommands[] = { ScriptCommandNop, ScriptCommand_0807F0B4, ScriptCommand_0807F0C8 }; +extern u16* gUnk_08001A7C[]; +extern u8 gUnk_08114F30[]; +extern u8 gUnk_08114F34[]; extern const u16 gUnk_08016984; extern u8 gUnk_0811E514[]; extern u8 gUnk_0811E510[]; @@ -401,7 +406,7 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) { case 1 << 0x02: break; case 1 << 0x03: - entity->field_0x20 = 0x18000; + entity->hVelocity = 0x18000; break; case 1 << 0x04: CreateSpeechBubbleExclamationMark(entity, 8, -0x18); @@ -597,7 +602,7 @@ void sub_0807DF38(void) { void sub_0807DF50(void) { gUnk_02034490[0] = 0; gUnk_0200AF00.filler0[1] = 0; - sub_0801C4A0(0); + RecoverUI(0); sub_080791D0(); sub_08079184(); } @@ -801,7 +806,7 @@ void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContex } void ScriptCommand_0807E30C(Entity* entity, ScriptExecutionContext* context) { - if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags.all & 0x80) == 0 && + if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags & 0x80) == 0 && sub_080041A0(entity, &gPlayerEntity, 0x28, 0x28)) { entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity)); } @@ -885,12 +890,12 @@ void ScriptCommand_0807E514(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_CheckPlayerFlags(Entity* entity, ScriptExecutionContext* context) { context->condition = - !!(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer) & gPlayerState.flags.all); + !!(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer) & gPlayerState.flags); gActiveScriptInfo.flags |= 1; } void ScriptCommand_0807E564(Entity* entity, ScriptExecutionContext* context) { - context->condition = (gPlayerState.flags.all >> 7) & 1; + context->condition = (gPlayerState.flags >> 7) & 1; gActiveScriptInfo.flags |= 1; } @@ -1000,8 +1005,8 @@ void ScriptCommand_0807E778(Entity* entity, ScriptExecutionContext* context) { gActiveScriptInfo.unk_08 = context->scriptInstructionPointer[1]; } -void ScriptCommand_0807E788(Entity* entity, ScriptExecutionContext* context) { - gFadeControl.field_0x4 = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer); +void ScriptCommand_SetFadeMask(Entity* entity, ScriptExecutionContext* context) { + gFadeControl.mask = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer); } void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context) { @@ -1126,10 +1131,10 @@ void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context) { break; entity->interactType = 0; context->unk_18++; - TextboxNoOverlapFollow(context->scriptInstructionPointer[1]); + MessageFromTarget(context->scriptInstructionPointer[1]); break; case 1: - if (gTextBox.doTextBox & 0x7F) + if (gMessage.doTextBox & 0x7F) break; context->unk_18 = 2; context->unk_19 = 0xF; @@ -1190,36 +1195,36 @@ void ScriptCommand_0807EA88(Entity* entity, ScriptExecutionContext* context) { } void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context) { - if (gTextBox.doTextBox & 0x7F) { + if (gMessage.doTextBox & 0x7F) { gActiveScriptInfo.commandSize = 0; } } -void ScriptCommand_TextboxNoOverlapFollow(Entity* entity, ScriptExecutionContext* context) { - TextboxNoOverlapFollow(context->scriptInstructionPointer[1]); +void ScriptCommand_MessageFromTarget(Entity* entity, ScriptExecutionContext* context) { + MessageFromTarget(context->scriptInstructionPointer[1]); } -void ScriptCommand_TextboxNoOverlap(Entity* entity, ScriptExecutionContext* context) { - TextboxNoOverlap(context->scriptInstructionPointer[1], entity); +void ScriptCommand_MessageNoOverlap(Entity* entity, ScriptExecutionContext* context) { + MessageNoOverlap(context->scriptInstructionPointer[1], entity); } -void ScriptCommand_TextboxNoOverlapFollowPos(Entity* entity, ScriptExecutionContext* context) { - TextboxNoOverlapFollow(context->scriptInstructionPointer[1]); - gTextBox.textWindowPosX = 1; - gTextBox.textWindowPosY = context->scriptInstructionPointer[2]; +void ScriptCommand_MessageFromTargetPos(Entity* entity, ScriptExecutionContext* context) { + MessageFromTarget(context->scriptInstructionPointer[1]); + gMessage.textWindowPosX = 1; + gMessage.textWindowPosY = context->scriptInstructionPointer[2]; } -void ScriptCommand_TextboxNoOverlapFollowTable(Entity* entity, ScriptExecutionContext* context) { +void ScriptCommand_MessageFromTargetTable(Entity* entity, ScriptExecutionContext* context) { if (gActiveScriptInfo.commandSize > context->intVariable) { u16* tmp = context->scriptInstructionPointer + context->intVariable; - TextboxNoOverlapFollow(tmp[1]); + MessageFromTarget(tmp[1]); } else { - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } } -void ScriptCommand_TextboxNoOverlapVar(Entity* entity, ScriptExecutionContext* context) { - TextboxNoOverlap(context->intVariable, entity); +void ScriptCommand_MessageNoOverlapVar(Entity* entity, ScriptExecutionContext* context) { + MessageNoOverlap(context->intVariable, entity); } void ScriptCommand_0807EB28(Entity* entity, ScriptExecutionContext* context) { @@ -1262,7 +1267,7 @@ void ScriptCommand_SetEntitySpeed(Entity* entity, ScriptExecutionContext* contex } void ScriptCommand_SetEntity0x20(Entity* entity, ScriptExecutionContext* context) { - entity->field_0x20 = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer); + entity->hVelocity = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer); } void ScriptCommand_SetEntityPositionRelative(Entity* entity, ScriptExecutionContext* context) { @@ -1433,7 +1438,7 @@ void ScriptCommand_0807EEF4(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_0807EF3C(Entity* entity, ScriptExecutionContext* context) { if (!context->unk_18) { context->unk_18 = 1; - entity->field_0x20 = ((s16)context->scriptInstructionPointer[1]) << 8; + entity->hVelocity = ((s16)context->scriptInstructionPointer[1]) << 8; context->x.HALF.LO = context->scriptInstructionPointer[2] << 8; sub_08003FC4(entity, (u16)context->x.HALF.LO); } else { @@ -1524,3 +1529,627 @@ void ScriptCommand_0807F0B4(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_0807F0C8(Entity* entity, ScriptExecutionContext* context) { sub_08080964(context->scriptInstructionPointer[1], context->scriptInstructionPointer[2]); } + +extern u8 gUnk_0811E750[]; +extern u8 gUnk_0811E758[]; +extern u8 gUnk_0811E760[]; + +void sub_0807F0D8(Entity* entity, ScriptExecutionContext* context) { + context->condition = (-(u32)gInput.newKeys | ((u32)gInput.newKeys)) >> 0x1f; +} + +void sub_0807F0EC(Entity* entity, ScriptExecutionContext* context) { + context->intVariable = (s32)Random() % (s32)context->intVariable; +} + +void sub_0807F100(Entity* entity, ScriptExecutionContext* context) { + u32 rand; + + rand = Random(); + entity->animationState = rand & 6; + context->unk_1A = gUnk_0811E750[(rand >> 8) & 7]; +} + +void sub_0807F128(Entity* entity, ScriptExecutionContext* context) { + u32 rand; + + rand = Random(); + entity->animationState = gUnk_0811E758[rand & 7]; + context->unk_1A = gUnk_0811E760[(rand >> 8) & 7]; +} + +void sub_0807F158(Entity* entity, ScriptExecutionContext* context) { + entity->collisionLayer = 1; + UpdateSpriteForCollisionLayer(entity); +} + +void sub_0807F168(Entity* entity, ScriptExecutionContext* context) { + gPlayerEntity.collisionLayer = 1; + UpdateSpriteForCollisionLayer(&gPlayerEntity); +} + +void sub_0807F180(Entity* entity, ScriptExecutionContext* context) { + entity->collisionLayer = 2; + UpdateSpriteForCollisionLayer(entity); +} + +void sub_0807F190(Entity* entity, ScriptExecutionContext* context) { + DoFade(4, 256); +} + +void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) { + sub_0807DEDC(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + gActiveScriptInfo.flags |= 1; +} + +void sub_0807F1C4(Entity* entity, ScriptExecutionContext* context) { + if ((gPlayerState.flags & 8) != 0) { + gPlayerState.field_0x8 = 0x459; + } else { + gPlayerState.field_0x8 = 0x1bc; + } +} + +void sub_0807F1E8(Entity* entity, ScriptExecutionContext* context) { + if ((gPlayerState.flags & 8) != 0) { + gPlayerState.field_0x8 = 0x45a; + } else { + gPlayerState.field_0x8 = 0x2bd; + } +} + +void sub_0807F210(Entity* entity, ScriptExecutionContext* context) { + if ((gPlayerState.flags & 8) != 0) { + gPlayerState.field_0x8 = 0x41c; + } else { + gPlayerState.field_0x8 = 0x80c; + } +} + +void sub_0807F238(Entity* entity, ScriptExecutionContext* context) { + gPlayerState.field_0x8 = context->intVariable; +} + +void sub_0807F244(Entity* entity, ScriptExecutionContext* context) { + u32 slot; + u32 item; + + item = context->intVariable & 0xFFFF; + slot = context->intVariable >> 0x10; + item &= 0xFFFF; + switch (item) { + case 1: + case 2: + case 3: + case 4: + case 6: + // Pick greatest sword unlocked + item = 1; + if (GetInventoryValue(2)) + item = 2; + if (GetInventoryValue(3)) + item = 3; + if (GetInventoryValue(4)) + item = 4; + if (GetInventoryValue(6)) + item = 6; + break; + } + ForceEquipItem(item, slot); +} + +void sub_0807F29C(Entity* entity, ScriptExecutionContext* context) { + sub_0805ED14((void*)context->intVariable); +} + +void sub_0807F2A8(Entity* entity, ScriptExecutionContext* context) { + if (gPlayerState.field_0x9c == 0) { + gActiveScriptInfo.flags |= 1; + } else { + gActiveScriptInfo.commandSize = 0; + } +} + +void sub_0807F2D4(Entity* entity, ScriptExecutionContext* context) { + if ((entity->frames.all & 0x80) != 0) { + gActiveScriptInfo.flags |= 1; + } else { + gActiveScriptInfo.commandSize = 0; + } +} + +void sub_0807F304(Entity* entity, ScriptExecutionContext* context) { + if ((gPlayerEntity.frames.all & 0x80) != 0) { + gActiveScriptInfo.flags |= 1; + } else { + gActiveScriptInfo.commandSize = 0; + } +} + +void sub_0807F338(Entity* entity, ScriptExecutionContext* context) { + entity->hitbox = NULL; + entity->field_0x17 &= ~1; +} + +void sub_0807F348(Entity* entity, ScriptExecutionContext* context) { + sub_0805E3A0(entity, 2); +} + +void sub_0807F354(Entity* entity, ScriptExecutionContext* context) { + sub_0805E3A0(entity, 6); +} + +void sub_0807F360(Entity* entity, ScriptExecutionContext* context) { + sub_0805E3A0(entity, 3); +} + +void sub_0807F36C(Entity* entity, ScriptExecutionContext* context) { + Entity* fx; + fx = CreateFx(entity, FX_REFLECT4, 0); + if (fx != NULL) { + fx->spritePriority.b0 = 1; + PositionRelative(entity, fx, 0, -524288); + if (Random() & 1) + fx->spriteSettings.b.flipX = 1; + if (Random() & 1) + fx->spriteSettings.b.flipY = 1; + } +} + +void sub_0807F3C8(Entity* entity, ScriptExecutionContext* context) { + sub_0807F36C(entity, context); + SoundReq(SFX_BUTTON_DEPRESS); +} + +void sub_0807F3D8(Entity* entity, ScriptExecutionContext* context) { + InitAnimationForceUpdate(entity, context->intVariable + (entity->animationState >> 1)); + entity->field_0x80.HWORD = entity->animIndex; +} + +void sub_0807F3F8(Entity* entity, ScriptExecutionContext* context) { + CreateSpeechBubbleExclamationMark(&gPlayerEntity, 8, -24); +} + +void sub_0807F40C(Entity* entity, ScriptExecutionContext* context) { + CreateSpeechBubbleQuestionMark(&gPlayerEntity, 8, -24); +} + +void sub_0807F420(Entity* entity, ScriptExecutionContext* context) { + MenuFadeIn(context->intVariable & 0xff, (u8)(context->intVariable >> 8)); +} + +void sub_0807F434(Entity* entity, ScriptExecutionContext* context) { + switch (entity->interactType) { + case 1: + entity->interactType = 0; + context->intVariable = 1; + break; + case 2: + entity->interactType = 0; + context->intVariable = 2; + break; + default: + context->intVariable = 0; + break; + } + gActiveScriptInfo.flags |= 1; +} + +void sub_0807F464(Entity* entity, ScriptExecutionContext* context) { + s32 s32Var; + + if (!context->unk_18) { + context->unk_18++; + context->postScriptActions |= 2; + s32Var = context->intVariable; + context->x.HALF.HI = gRoomControls.roomOriginX + s32Var; + context->y.HALF.HI = entity->y.HALF.HI; + if (s32Var > entity->x.HALF.HI - gRoomControls.roomOriginX) { + entity->direction = 64; + entity->animationState = (entity->animationState & 0x80) | 2; + } else { + entity->direction = -64; + entity->animationState = (entity->animationState & 0x80) | 6; + } + } + sub_0806F62C(entity, entity->speed, entity->direction); + if (((context->x.HALF.HI - entity->x.HALF.HI) ^ ((entity->direction & 0x80) << 24)) < 0) + entity->x.HALF.HI = context->x.HALF.HI; + else + gActiveScriptInfo.commandSize = 0; +} + +void sub_0807F4F8(Entity* entity, ScriptExecutionContext* context) { + s32 s32Var; + + if (!context->unk_18) { + context->unk_18++; + context->postScriptActions |= 2; + s32Var = context->intVariable; + context->x.HALF.HI = entity->x.HALF.HI; + context->y.HALF.HI = gRoomControls.roomOriginY + s32Var; + if (s32Var > entity->y.HALF.HI - gRoomControls.roomOriginY) { + entity->direction = 128; + entity->animationState = (entity->animationState & 0x80) | 4; + } else { + entity->direction = 0; + entity->animationState = (entity->animationState & 0x80); + } + } + sub_0806F62C(entity, entity->speed, entity->direction); + if (((context->y.HALF.HI - entity->y.HALF.HI) ^ ((entity->direction & 0x80) << 24)) >= 0) + entity->y.HALF.HI = context->y.HALF.HI; + else + gActiveScriptInfo.commandSize = 0; +} + +void sub_0807F584(Entity* entity, ScriptExecutionContext* context) { + context->intVariable = gPlayerEntity.animationState >> 1; +} + +void sub_0807F594(Entity* entity, ScriptExecutionContext* context) { + if (gPlayerState.field_0xa8) + gActiveScriptInfo.commandSize = 0; +} + +void sub_0807F5B0(Entity* entity, ScriptExecutionContext* context) { + gPlayerState.field_0x27[0] = context->intVariable; +} + +void sub_0807F5C0(Entity* entity, ScriptExecutionContext* context) { + s32 left; + s32 bottom; + + if (gRoomControls.cameraTarget != NULL) { + left = gRoomControls.cameraTarget->x.HALF.HI - DISPLAY_WIDTH / 2; + bottom = gRoomControls.cameraTarget->y.HALF.HI - DISPLAY_HEIGHT / 2; + + if (left < gRoomControls.roomOriginX) + left = gRoomControls.roomOriginX; + if (left > gRoomControls.roomOriginX + gRoomControls.width - DISPLAY_WIDTH) + left = gRoomControls.roomOriginX + gRoomControls.width - DISPLAY_WIDTH; + if (bottom < gRoomControls.roomOriginY) + bottom = gRoomControls.roomOriginY; + if (bottom > gRoomControls.roomOriginY + gRoomControls.height - DISPLAY_HEIGHT) + bottom = gRoomControls.roomOriginY + gRoomControls.height - DISPLAY_HEIGHT; + + if (left == gRoomControls.roomScrollX && bottom == gRoomControls.roomScrollY) + gActiveScriptInfo.flags |= 1u; + else + gActiveScriptInfo.commandSize = 0; + } +} + +void sub_0807F634(Entity* entity, ScriptExecutionContext* context) { + u16* p = (u16*)context->intVariable; + sub_0801DFB4(entity, p[0], p[1], p[2]); + gPlayerState.field_0x8b = 3; +} + +void sub_0807F650(Entity* entity, ScriptExecutionContext* context) { + u32 p = sub_08002632(entity); + sub_0801DFB4(entity, gUnk_08001A7C[p][0], gUnk_08001A7C[p][1], gUnk_08001A7C[p][2]); + gPlayerState.field_0x8b = 3; +} + +void sub_0807F680(Entity* entity, ScriptExecutionContext* context) { + context->condition = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX > (s32)(context->intVariable & 0xffff); + gActiveScriptInfo.flags |= 1; +} + +void sub_0807F6B4(Entity* entity, ScriptExecutionContext* context) { + context->condition = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY > (s32)(context->intVariable & 0xffff); + gActiveScriptInfo.flags |= 1; +} + +void sub_0807F6E8(Entity* entity, ScriptExecutionContext* context) { + gPlayerState.flags |= context->intVariable; +} + +void sub_0807F6F8(Entity* entity, ScriptExecutionContext* context) { + gPlayerState.flags &= ~context->intVariable; +} + +void sub_0807F708(Entity* entity, ScriptExecutionContext* context) { + ShowNPCDialogue(entity, (Dialog*)context->intVariable); +} + +void sub_0807F714(Entity* entity, ScriptExecutionContext* context) { + entity->spriteRendering.b3 = gUnk_08114F30[entity->spriteRendering.b3]; + ResolveEntityOnTop(entity, entity); +} + +void sub_0807F738(Entity* entity, ScriptExecutionContext* context) { + entity->spriteRendering.b3 = gUnk_08114F34[entity->spriteRendering.b3]; + sub_0806FAD8(entity, entity); +} + +void sub_0807F75C(Entity* entity, ScriptExecutionContext* context) { + s32 s32Var = context->intVariable; + gPlayerEntity.x.HALF.HI = (s32Var >> 16) + gRoomControls.roomOriginX; + gPlayerEntity.y.HALF.HI = (s32Var & 0xffff) + gRoomControls.roomOriginY; +} + +void sub_0807F77C(Entity* entity, ScriptExecutionContext* context) { + if (context->condition) + context->intVariable = 1; + else + context->intVariable = 0; +} + +void sub_0807F78C(Entity* entity, ScriptExecutionContext* context) { + u32 item = context->intVariable; + u32 msg; + u32 price; + + if (context->intVariable == 0) + item = gRoomVars.itemForSaleIndex; + + msg = GetSaleItemConfirmMessageID(item); + price = GetItemPrice(item); + MessageNoOverlap(msg, entity); + gMessage.field_0x10 = (u16)price; +} + +void sub_0807F7C4(Entity* entity, ScriptExecutionContext* context) { + u32 item = context->intVariable; + u32 msg; + u32 price; + + if (context->intVariable == 0) + item = gRoomVars.itemForSaleIndex; + + context->condition = GetItemPrice(item) <= gSave.stats.rupees; + gActiveScriptInfo.flags |= 1; +} + +void sub_0807F800(Entity* entity, ScriptExecutionContext* context) { + u32 item = context->intVariable; + u32 msg; + u32 price; + + if (context->intVariable == 0) + item = gRoomVars.itemForSaleIndex; + + price = GetItemPrice(item); + ModRupees(-price); + sub_080A7C18(item, 0, 0); + gRoomVars.itemForSaleIndex = 0; + gActiveScriptInfo.flags |= 1; +} + +void sub_0807F83C(Entity* entity, ScriptExecutionContext* context) { + sub_08079184(); +} + +void sub_0807F844(Entity* entity, ScriptExecutionContext* context) { + gRoomControls.cameraTarget = entity; + sub_080809D4(); +} + +void sub_0807F854(Entity* entity, ScriptExecutionContext* context) { + u32 value; + u32 idx; + + idx = (context->intVariable >> 0x10) & 3; + value = context->intVariable & 0xffff; + switch (idx) { + case 0: + case 1: + gMessage.field_0x10 = value; + break; + case 2: + gMessage.field_0x14 = value; + break; + case 3: + gMessage.field_0x18 = value; + break; + case 4: + gMessage.field_0x1c = value; + break; + } +} + +void sub_0807F8BC(Entity* entity, ScriptExecutionContext* context) { + if (sub_080040A8(entity)) + context->condition = 1; + else + context->condition = 0; +} + +void sub_0807F8D0(Entity* entity, ScriptExecutionContext* context) { + sub_08003FC4(entity, context->intVariable); + gActiveScriptInfo.flags |= 1; +} + +void sub_0807F8E8(Entity* entity, ScriptExecutionContext* context) { + Entity* c = CreateObjectWithParent(entity, 0xA6, 0, 0); + if (c != NULL) { + c->parent = entity; + c->field_0x86.HWORD = (context->intVariable & 0x3ff) | 0x8000; + } +} + +void sub_0807F918(Entity* entity, ScriptExecutionContext* context) { + PutItemOnSlot(context->intVariable); +} + +void sub_0807F924(Entity* entity, ScriptExecutionContext* context) { + sub_0807879C(entity); +} + +void sub_0807F92C(Entity* entity, ScriptExecutionContext* context) { + sub_080787C0(entity); +} + +void sub_0807F934(Entity* entity, ScriptExecutionContext* context) { + sub_080787B4(entity); +} + +void sub_0807F93C(Entity* entity, ScriptExecutionContext* context) { + CreateSpeechBubbleSleep(entity, (context->intVariable >> 8) & 0xff, context->intVariable & 0xff); +} + +void sub_0807F950(Entity* entity, ScriptExecutionContext* context) { + Entity* c = FindEntity(6, 0x56, 6, 0, 2); + if (c != NULL) + DeleteEntity(c); +} + +void sub_0807F970(Entity* entity, ScriptExecutionContext* context) { + context->condition = context->intVariable == gTextRender.curToken.textIndex; +} + +void sub_0807F98C(Entity* entity, ScriptExecutionContext* context) { + entity->height.WORD = context->intVariable; +} + +void sub_0807F994(Entity* entity, ScriptExecutionContext* context) { + entity->spriteOffsetX = (s32)context->intVariable >> 0x10; + entity->spriteOffsetY = context->intVariable & 0xffff; +} + +void sub_0807F9A4(Entity* entity, ScriptExecutionContext* context) { + switch (gPlayerState.field_0xa8) { + case 5: + case 7: + case 8: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 27: + case 28: + gActiveScriptInfo.commandSize = 0; + break; + default: + gActiveScriptInfo.flags |= 1u; + break; + } +} + +void sub_0807FA40(Entity* entity, ScriptExecutionContext* context) { + switch (gPlayerState.field_0xa8) { + case 5: + case 7: + case 8: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 20: + case 21: + case 22: + case 23: + case 24: + case 27: + case 28: + gActiveScriptInfo.commandSize = 0; + break; + default: + gActiveScriptInfo.flags |= 1u; + break; + } +} + +void sub_0807FADC(Entity* entity, ScriptExecutionContext* context) { + switch (context->unk_18) { + case 0: + context->unk_18++; + sub_0808C650(entity, context->intVariable); + break; + case 1: + if (sub_0808C67C()) + context->unk_18++; + break; + case 2: + sub_0808C688(); + return; + } + gActiveScriptInfo.commandSize = 0; +} + +void sub_0807FB28(Entity* entity, ScriptExecutionContext* context) { + if (!context->unk_18) + sub_0801D7BC(0x7fff, 1); + + context->unk_18++; + if (context->unk_18 >= context->intVariable) + sub_0801D7BC(0, 0); + else + gActiveScriptInfo.commandSize = 0; +} + +void sub_0807FB64(Entity* entity, ScriptExecutionContext* context) { + gPlayerEntity.iframes = context->intVariable; +} + +void sub_0807FB74(Entity* entity, ScriptExecutionContext* context) { + gPlayerState.swimState = 0; + gPlayerEntity.field_0x3c &= ~4; +} + +void sub_0807FB94(Entity* entity, ScriptExecutionContext* context) { + InitScreen(SCREEN_CREDITS); +} + +void sub_0807FBA0(Entity* entity, ScriptExecutionContext* context) { + entity->x.HALF.HI = gRoomControls.roomScrollX + 120; + entity->y.HALF.HI = gRoomControls.roomScrollY + 80; +} + +void sub_0807FBB4(Entity* entity, ScriptExecutionContext* context) { + gPlayerState.field_0x1a[0] |= 0x80; +} + +void sub_0807FBC4(Entity* entity, ScriptExecutionContext* context) { + sub_0805E4A0(entity); +} + +void sub_0807FBCC(Entity* entity, ScriptExecutionContext* context) { + sub_0805E4CC(entity); +} + +void sub_0807FBD4(Entity* entity, ScriptExecutionContext* context) { + sub_0806F62C(entity, entity->speed, entity->direction); + if (sub_080040A8(entity)) + gActiveScriptInfo.commandSize = 0; +} + +#ifndef EU +void sub_0807FBFC(Entity* entity, ScriptExecutionContext* context) { + gSave.stats.charm = 0; + gSave.stats.charmTimer = 0; + gSave.stats.unkB = 0; + gSave.stats.unkTimer = 0; + gSave.stats.effect = 0; + gSave.stats.effectTimer = 0; +} + +#if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP) +void sub_0807FC24(Entity* entity, ScriptExecutionContext* context) { +#if defined(DEMO_JP) + u32 idx = gRoomControls.roomID == 1 ? 0xcf : 0xd0; +#else + u32 idx = gRoomControls.roomID == 1 ? 0xcf : 0xd1; +#endif + SetLocalFlag(idx); +} +#endif +#endif diff --git a/src/sub_08050008.c b/src/sub_08050008.c index df79883a..580c3a32 100644 --- a/src/sub_08050008.c +++ b/src/sub_08050008.c @@ -6,5 +6,5 @@ extern u32 gUnk_020354C0; void sub_08050008() { MemClear(&gUnk_020354C0, 128); - gFadeControl.field_0x4 = -1; + gFadeControl.mask = 0xFFFFFFFF; } diff --git a/src/sub_0805E374.c b/src/sub_0805E374.c index e035ce07..3ec3e287 100644 --- a/src/sub_0805E374.c +++ b/src/sub_0805E374.c @@ -9,7 +9,7 @@ Entity* sub_0805E374(Entity* param_1) { u8 r3 = gScreenTransition.field_0x24[8]; u8* array = gUnk_081091F8; - if (r3 != '\x02') { + if (r3 != 2) { array = gUnk_081091EE; } return sub_0805E3A0(param_1, array[param_1->kind]); diff --git a/src/sub_0807B820.c b/src/sub_0807B820.c index fabdc8d9..14da7b18 100644 --- a/src/sub_0807B820.c +++ b/src/sub_0807B820.c @@ -9,46 +9,46 @@ void sub_0807B7D8(u32 param_1, u32 param_2, u32 param_3) { sub_08000152(53); sub_0807B778(param_2, param_3); sub_0807B778(param_2 + 1, param_3); - sub_0807B778(param_2 + -1, param_3); + sub_0807B778(param_2 - 1, param_3); sub_0807B778(param_2 + 64, param_3); - sub_0807B778(param_2 + -64, param_3); + sub_0807B778(param_2 - 64, param_3); } else { SetTileType(param_1, param_2, param_3); } } void sub_0807B820(u32 param_1) { - SetTileType(620, param_1 + -65, 1); - SetTileType(627, param_1 + -65, 2); - SetTileType(621, param_1 + -64, 1); - SetTileType(628, param_1 + -64, 2); - SetTileType(622, param_1 + -63, 1); - SetTileType(629, param_1 + -63, 2); - SetTileType(623, param_1 + -1, 1); + SetTileType(620, param_1 - 65, 1); + SetTileType(627, param_1 - 65, 2); + SetTileType(621, param_1 - 64, 1); + SetTileType(628, param_1 - 64, 2); + SetTileType(622, param_1 - 63, 1); + SetTileType(629, param_1 - 63, 2); + SetTileType(623, param_1 - 1, 1); SetTileType(624, param_1, 1); SetTileType(626, param_1 + 1, 1); } void sub_0807B8A8(u32 param_1) { - SetTileType(636, param_1 + -65, 1); - SetTileType(643, param_1 + -65, 2); - SetTileType(637, param_1 + -64, 1); - SetTileType(644, param_1 + -64, 2); - SetTileType(638, param_1 + -63, 1); - SetTileType(645, param_1 + -63, 2); - SetTileType(639, param_1 + -1, 1); + SetTileType(636, param_1 - 65, 1); + SetTileType(643, param_1 - 65, 2); + SetTileType(637, param_1 - 64, 1); + SetTileType(644, param_1 - 64, 2); + SetTileType(638, param_1 - 63, 1); + SetTileType(645, param_1 - 63, 2); + SetTileType(639, param_1 - 1, 1); SetTileType(640, param_1, 1); SetTileType(642, param_1 + 1, 1); } void sub_0807B930(int param_1) { - SetTileType(652, param_1 + -65, 1); - SetTileType(659, param_1 + -65, 2); - SetTileType(653, param_1 + -64, 1); - SetTileType(660, param_1 + -64, 2); - SetTileType(654, param_1 + -63, 1); - SetTileType(661, param_1 + -63, 2); - SetTileType(655, param_1 + -1, 1); + SetTileType(652, param_1 - 65, 1); + SetTileType(659, param_1 - 65, 2); + SetTileType(653, param_1 - 64, 1); + SetTileType(660, param_1 - 64, 2); + SetTileType(654, param_1 - 63, 1); + SetTileType(661, param_1 - 63, 2); + SetTileType(655, param_1 - 1, 1); SetTileType(656, param_1, 1); SetTileType(658, param_1 + 1, 1); } diff --git a/src/sub_0807CA18.c b/src/sub_0807CA18.c new file mode 100644 index 00000000..7dd5603a --- /dev/null +++ b/src/sub_0807CA18.c @@ -0,0 +1,41 @@ +#include "global.h" +#include "structures.h" +#include "save.h" +#include "utils.h" + +u8 sub_0807CA18() { + if (gSave.unk_00 != 0x00 || gSave.unk_01 != 1) { + gSave.unk_00 = 0; + gSave.unk_01 = 1; + gSave.unk8 = 1; + gSave.stats.health = 0x18; + gSave.stats.maxHealth = 0x18; + gSave.unk_88 = 0x22; + gSave.unk_89 = 0x15; + gSave.unk_8A = 0; + gSave.unk_8B = 0; + gSave.unk_8F = 1; + gSave.unk_8C = 0x90; + gSave.unk_8E = 0x38; + } + if (gSave.playerName[0] == 0) { + MemCopy(gUnk_0811E470, &gSave.playerName, 5); + } +#ifdef DEMO_USA + { + const u8* tmp; + MemCopy(demoPointers[gSaveHeader->saveFileId], &gSave, 0x4B4); + if (gSaveHeader->gameLanguage == 0) { + gSave.playerName[0] = 0x97; + gSave.playerName[1] = 0x7F; + gSave.playerName[2] = 0xDD; + gSave.playerName[3] = 0; + } + ModHealth(0xA0); + ModRupees(-9999); + tmp = demoUnknown1 + gUnk_02000010.field_0x7 * 3; + gSave.unk_4a8 = tmp[gSaveHeader->saveFileId] * 3600; + } +#endif + return 1; +} diff --git a/src/sub_080A554C.c b/src/sub_080A554C.c index 4ec59e7f..dffcbab0 100644 --- a/src/sub_080A554C.c +++ b/src/sub_080A554C.c @@ -11,7 +11,7 @@ u32 sub_080A554C(u32 arg0) { if (arg0 != 0) { for (i = 0; i < 17; i++) { - if (arg0 == (&gUnk_02000090)[i]) + if (arg0 == gMenu.focusCoords[i]) return i; } } diff --git a/src/sub_08127D30.c b/src/sub_08127D30.c index 32887106..13b6839b 100644 --- a/src/sub_08127D30.c +++ b/src/sub_08127D30.c @@ -3,8 +3,5 @@ extern u8 gAreaMetadata[69]; u32 sub_08052654(u32 r0) { - // u32 r1 = gAreaMetadata; - // u32 r1 = gAreaMetadata; - return gAreaMetadata[r0 * 4] == 129; } diff --git a/src/textbox.c b/src/textbox.c index 01b7bbae..71da7228 100644 --- a/src/textbox.c +++ b/src/textbox.c @@ -8,74 +8,96 @@ #include "structures.h" #include "save.h" -#define TEXTBOX_ADVANCE_KEYS (A_BUTTON | B_BUTTON | DPAD_ANY | R_BUTTON) -#define TEXTBOX_PRESS_ANY_ADVANCE_KEYS ((gInput.newKeys & TEXTBOX_ADVANCE_KEYS) != 0) - -#define TEXTBOX_WIDTH 0x20 -#define TEXTBOX_POSITION_INDEX(window) ((window).yPos * TEXTBOX_WIDTH + (window).xPos) +#define MESSAGE_ADVANCE_KEYS (A_BUTTON | B_BUTTON | DPAD_ANY | R_BUTTON) +#define MESSAGE_PRESS_ANY_ADVANCE_KEYS ((gInput.newKeys & MESSAGE_ADVANCE_KEYS) != 0) + +#define MESSAGE_WIDTH 0x20 +#define MESSAGE_POSITION_INDEX(window) ((window).yPos * MESSAGE_WIDTH + (window).xPos) + +#define MESSAGE_PALETTE 0xF + +// todo: move this to a shared header for ui tiles +enum { + MSG_BORDER_CORNER = 0x7B, + MSG_BORDER_H_CORNER = 0x7C, + MSG_BORDER_H_STRAIGHT = 0x7D, + MSG_BORDER_V_CORNER = 0x7E, + MSG_BORDER_V_STRAIGHT = 0x7F, + MSG_CURSOR = 0x80, + MSG_BACKGROUND = 0x81, + MSG_TEXT_LINE1TOP = 0x82, + MSG_TEXT_LINE1BOTTOM = 0x83, + MSG_TEXT_LINE2TOP = 0xb6, + MSG_TEXT_LINE2BOTTOM = 0xb7, +}; extern void WriteBit(u32*, u32); -extern void sub_0805EF40(u8*, u8*); -extern void sub_0801C4A0(u32, u32); -extern void sub_0801C494(void); +extern void sub_0805EF40(Token* tok, const u8*); +extern void RecoverUI(u32 bottomPt, u32 topPt); +extern void RefreshUI(void); extern void sub_0805F918(u32, u32, u32); extern u32 sub_0801D51C(u32, u8*, u32); u32 sub_08056FEC(u32, u8*); - -u16 sub_08056750(CurrentTextBox*); -u32 sub_0805EFE8(u8*); -void sub_08056ABC(u32, u32); -void sub_080569C4(CurrentTextBox*, u32); +u32 GetCharacter(Token* tok); +extern void sub_0805EEB4(Token* tok, u32 textIdx); u16 sub_0805F7DC(u32, u8*); -u32 sub_GetFontStrWidth(u8*, u32); -void sub_08056FBC(CurrentTextBox*); -void SetDoTextBox(u32 doTextbox); -void Load_02000D00_Asyc(void); - -void DeleteWindow(void); -void CreateWindow(void); -u32 CalcWindowSize(u32 fade); - -void DispMessageFrame(u16*, u32, u32, u32); -void DispString(void); -void DispCursor(void); - -typedef u32 (*TextBoxFunction)(void); - -u32 TextBoxFunction0(void); -u32 TextBoxFunction1(void); -u32 HandleTextBox(void); -u32 TextBoxFunctionOpen(void); -u32 TextBoxFunctionClose(void); -u32 TextBoxFunction5(void); - -const TextBoxFunction gTextBoxFunctions[] = { - TextBoxFunction0, TextBoxFunction1, HandleTextBox, TextBoxFunctionOpen, TextBoxFunctionClose, TextBoxFunction5, -}; - -extern u8 gUnk_020227DC, gUnk_020227E8, gUnk_020227F0, gUnk_020227F8, gUnk_02022800; -u8* const gUnk_08107BE0[] = { - &gUnk_020227DC, &gUnk_020227E8, &gUnk_020227F0, &gUnk_020227F8, &gUnk_02022800, -}; - -typedef void (*TextBoxHandler)(CurrentTextBox*); - -void TextBoxHandler0(CurrentTextBox* this); -void TextBoxHandler1(CurrentTextBox* param_1); -void TextBoxHandlerAdvance(CurrentTextBox* ctb); -void TextBoxHandlerNextBox(CurrentTextBox* ctb); -void TextBoxHandler4(CurrentTextBox* ctb); -void TextBoxHandlerQuestion(CurrentTextBox* ctb); - -const TextBoxHandler gTextBoxHandlers[] = { - TextBoxHandler0, TextBoxHandler1, TextBoxHandlerAdvance, - TextBoxHandlerNextBox, TextBoxHandler4, TextBoxHandlerQuestion, -}; +u32 GetFontStrWith(u8*, u32); + +static void StatusUpdate(u32 status); + +static u16 RunTextCommand(TextRender* this); +static void PaletteChange(TextRender* this, u32 id); +static void SwitchChoice(u32 to, u32 from); + +static void MsgChangeLine(u32 lineNo); +static void SetDoTextBox(u32 doTextbox); + +static void DeleteWindow(void); +static u32 ChangeWindowSize(u32 delta); +static void CreateWindow(void); + +static void DispString(void); +static void DispCursor(void); +static void DrawCanvasLine(void); +static void sub_08056F88(u32, u32); +static void sub_08056FBC(TextRender*); + +typedef u32 (*MessageFunction)(void); +static u32 MsgIdle(void); +static u32 MsgInit(void); +static u32 MsgUpdate(void); +static u32 MsgOpen(void); +static u32 MsgClose(void); +static u32 MsgDie(void); +typedef enum { + MSG_IDLE, + MSG_INIT, + MSG_UPDATE, + MSG_OPEN, + MSG_CLOSE, + MSG_DIE, +} MessageStatus; + +typedef void (*TextRenderFunction)(TextRender*); +static void TextDispInit(TextRender* this); +static void TextDispUpdate(TextRender* this); +static void TextDispDie(TextRender* this); +static void TextDispWait(TextRender* this); +static void TextDispRoll(TextRender* this); +static void TextDispEnquiry(TextRender* this); +typedef enum { + RENDER_INIT, + RENDER_UPDATE, + RENDER_DIE, + RENDER_WAIT, + RENDER_ROLL, + RENDER_ENQUIRY, +} TextRenderStatus; typedef struct Window { u8 unk0; - u8 unk1; + u8 active; u8 unk2; u8 unk3; u8 xPos; @@ -89,658 +111,660 @@ extern Window gNewWindow; extern struct { u8 unk_00; u8 unk_01[1]; - s8 unk_02; - s8 unk_03; + s8 choiceCount; + s8 currentChoice; u8 unk_04[4]; u16 unk_08[4]; u16 unk_10[4]; -} gUnk_02024030; - -extern u32 gUnk_0200005C; +} gMessageChoices; -extern u8 gUnk_020227A0; -extern u8 gUnk_02000D00[0xD00]; - -extern const u8 gUnk_08107C0C[]; +extern u8 gTextGfxBuffer[0xD00]; s32 sub_08056338(void) { s32 result; result = -1; - if (((gTextBox.doTextBox & 0x7f) == 0) && (gUnk_02000040.unk_00 == 3)) + if (((gMessage.doTextBox & 0x7f) == 0) && (gUnk_02000040.unk_00 == 3)) result = gUnk_02000040.unk_01; return result; } -void sub_08056360(void) { - if ((gTextBox.doTextBox & 0x7f) != 0) { - gTextBox.doTextBox = 0x88; +void MessageClose(void) { + if ((gMessage.doTextBox & 0x7f) != 0) { + gMessage.doTextBox = 0x88; } } -void TextboxNoOverlapFollow(u32 index) { +void MessageFromTarget(u32 index) { if (gRoomControls.cameraTarget != NULL) { - TextboxNoOverlap(index, gRoomControls.cameraTarget); + MessageNoOverlap(index, gRoomControls.cameraTarget); } else { - ShowTextbox(index); + MessageRequest(index); } } -void TextboxNoOverlap(u32 index, Entity* entity) { +void MessageNoOverlap(u32 index, Entity* entity) { s16 y; s16 height; - ShowTextbox(index); + MessageRequest(index); y = entity->y.HALF.HI; height = entity->height.HALF.HI; if (((y + height) - gRoomControls.roomScrollY) > 0x58) { - gTextBox.textWindowPosY = 1; + gMessage.textWindowPosY = 1; } } -void TextBoxAtYPosition(u32 index, u32 y) { - TextboxAtPosition(index, 1, y); +void MessageAtHeight(u32 index, u32 y) { + MessageAtPos(index, 1, y); } -void TextboxAtPosition(u32 index, u32 x, u32 y) { - ShowTextbox(index); - gTextBox.textWindowPosX = x; - gTextBox.textWindowPosY = y; +void MessageAtPos(u32 index, u32 x, u32 y) { + MessageRequest(index); + gMessage.textWindowPosX = x; + gMessage.textWindowPosY = y; } -void ShowTextbox(u32 index) { - MemClear(&gTextBox, sizeof(gTextBox)); - gTextBox.textIndex = index; - gTextBox.textSpeed = 99; - gTextBox.textWindowWidth = 26; - gTextBox.textWindowHeight = 4; - gTextBox.textWindowPosX = 1; - gTextBox.textWindowPosY = 12; - gTextBox.doTextBox = 1; +void MessageRequest(u32 index) { + MemClear(&gMessage, sizeof(gMessage)); + gMessage.textIndex = index; + gMessage.textSpeed = 99; + gMessage.textWindowWidth = 26; + gMessage.textWindowHeight = 4; + gMessage.textWindowPosX = 1; + gMessage.textWindowPosY = 12; + gMessage.doTextBox = 1; } void MessageInitialize(void) { - MemClear(&gTextBox, sizeof(gTextBox)); - MemClear(&gCurrentTextBox, sizeof(gCurrentTextBox)); + MemClear(&gMessage, sizeof(gMessage)); + MemClear(&gTextRender, sizeof(gTextRender)); MemClear(&gNewWindow, sizeof(gNewWindow)); MemClear(&gCurrentWindow, sizeof(gCurrentWindow)); MemClear(&gUnk_02000040, 4); } -void MessageUpdate(void) { - int iVar1; +void MessageMain(void) { + static const MessageFunction gMessageFunctions[] = { + [MSG_IDLE] = MsgIdle, [MSG_INIT] = MsgInit, [MSG_UPDATE] = MsgUpdate, + [MSG_OPEN] = MsgOpen, [MSG_CLOSE] = MsgClose, [MSG_DIE] = MsgDie, + }; - if (gTextBox.doTextBox == 1) { - MemClear((u32*)&gCurrentTextBox, sizeof(gCurrentTextBox)); - sub_080564C8(1); + if (gMessage.doTextBox == 1) { + MemClear((u32*)&gTextRender, sizeof(gTextRender)); + StatusUpdate(MSG_INIT); } - if (gCurrentTextBox._8a != 0) { - gCurrentTextBox._8a--; + if (gTextRender.newlineDelay != 0) { + gTextRender.newlineDelay--; } else { + int result; do { - iVar1 = gTextBoxFunctions[gCurrentTextBox._88](); - } while (iVar1 != 0); + result = gMessageFunctions[gTextRender.msgStatus](); + } while (result != 0); } - if (gCurrentTextBox._9d != 0) { - gCurrentTextBox._9d = 0; - Load_02000D00_Asyc(); + if (gTextRender.updateDraw) { + gTextRender.updateDraw = 0; + DrawCanvasLine(); } DeleteWindow(); CreateWindow(); } -void sub_080564C8(u32 unk) { - gCurrentTextBox._88 = unk; - gCurrentTextBox.state = 0; +static void StatusUpdate(MessageStatus status) { + gTextRender.msgStatus = status; + gTextRender.renderStatus = RENDER_INIT; } -u32 TextBoxFunction0(void) { - gCurrentTextBox._98.bytes.b1 = 0; +static u32 MsgIdle(void) { + gTextRender._98.bytes.b1 = 0; return 0; } +extern u8 gUnk_020227DC, gUnk_020227E8, gUnk_020227F0, gUnk_020227F8, gUnk_02022800; +u8* const gUnk_08107BE0[] = { + &gUnk_020227DC, &gUnk_020227E8, &gUnk_020227F0, &gUnk_020227F8, &gUnk_02022800, +}; + // regalloc in loop -NONMATCH("asm/non_matching/textbox/TextBoxFunction1.inc", u32 TextBoxFunction1(void)) { - u32 uVar1; +NONMATCH("asm/non_matching/textbox/TextBoxFunction1.inc", static u32 MsgInit(void)) { char* dest; u32 i; - char c; - MemClear((void*)&gNewWindow, 8); - MemClear((void*)&gUnk_02024030, 0x18); - MemClear((void*)&gCurrentTextBox, sizeof(gCurrentTextBox)); - MemCopy(&gTextBox, &gCurrentTextBox, sizeof(gTextBox)); - if (gCurrentTextBox.textBox.textSpeed == 0x63) { - gCurrentTextBox.textBox.textSpeed = gUnk_02000000->messageSpeed; + MemClear((void*)&gNewWindow, sizeof(gNewWindow)); + MemClear((void*)&gMessageChoices, sizeof(gMessageChoices)); + MemClear((void*)&gTextRender, sizeof(gTextRender)); + MemCopy(&gMessage, &gTextRender, sizeof(gMessage)); + if (gTextRender.message.textSpeed == 99) { + gTextRender.message.textSpeed = gSaveHeader->messageSpeed; } - gCurrentTextBox._9c = 0xff; - sub_0805EEB4(&gCurrentTextBox._20, gCurrentTextBox.textBox.textIndex); - gCurrentTextBox.playerName[0] = 2; - gCurrentTextBox.playerName[1] = 0xe; - dest = &gCurrentTextBox.playerName[2]; + gTextRender._9c = 0xff; + sub_0805EEB4(&gTextRender.curToken, gTextRender.message.textIndex); + gTextRender.playerName[0] = 2; + gTextRender.playerName[1] = 0xe; // Green text color + dest = &gTextRender.playerName[2]; for (i = 0; i < FILENAME_LENGTH; ++i) { - c = gSave.playerName[i]; + char c = gSave.playerName[i]; if (c == '\0') break; - *dest = c; - dest++; + *dest++ = c; } dest[0] = 2; - dest[1] = 15; - dest[2] = 0; - sub_08056FBC(&gCurrentTextBox); - gCurrentTextBox._2c = &gUnk_08107BE0; - gCurrentTextBox._50.unk8 = gUnk_02000D00; - gCurrentTextBox._50.unk4 = 0xd0; + dest[1] = 0xf; // White text color + dest[2] = '\0'; + sub_08056FBC(&gTextRender); + gTextRender.curToken._c = &gUnk_08107BE0; + gTextRender._50.unk8 = gTextGfxBuffer; + gTextRender._50.unk4 = 0xd0; SetDoTextBox(2); - sub_08056BDC(0); - sub_080564C8(2); + MsgChangeLine(0); + StatusUpdate(MSG_UPDATE); return 1; } END_NONMATCH -u32 TextBoxFunctionOpen(void) { - if (gCurrentTextBox.state == 0) { - gCurrentTextBox.state = 1; - gCurrentTextBox._98.bytes.b1 = 1; - sub_08056F88(gCurrentTextBox.textBox.unk3, gCurrentTextBox._50.unk3); +static u32 MsgOpen(void) { + if (gTextRender.renderStatus == RENDER_INIT) { + gTextRender.renderStatus = RENDER_UPDATE; + gTextRender._98.bytes.b1 = 1; + sub_08056F88(gTextRender.message.unk3, gTextRender._50.unk3); SoundReq(SFX_TEXTBOX_OPEN); } - if (CalcWindowSize(1)) { - gCurrentTextBox._98.bytes.b1 = 2; - sub_080564C8(2); + if (ChangeWindowSize(1)) { + gTextRender._98.bytes.b1 = 2; + StatusUpdate(MSG_UPDATE); } return 0; } -u32 TextBoxFunctionClose(void) { - if (gCurrentTextBox.state == 0) { - gCurrentTextBox.state = 1; - gCurrentTextBox._98.bytes.b1 = 3; - sub_08056BDC(0); +static u32 MsgClose(void) { + if (gTextRender.renderStatus == RENDER_INIT) { + gTextRender.renderStatus = RENDER_UPDATE; + gTextRender._98.bytes.b1 = 3; + MsgChangeLine(0); SoundReq(SFX_TEXTBOX_CLOSE); } - if (CalcWindowSize(-1)) { - gCurrentTextBox._98.bytes.b1 = 0; - sub_080564C8(2); + if (ChangeWindowSize(-1)) { + gTextRender._98.bytes.b1 = 0; + StatusUpdate(MSG_UPDATE); } return 0; } -u32 TextBoxFunction5(void) { +static u32 MsgDie(void) { SetDoTextBox(0); - sub_080564C8(0); + StatusUpdate(MSG_IDLE); return 0; } -u32 HandleTextBox(void) { +static u32 MsgUpdate(void) { + static const TextRenderFunction gTextDispFunctions[] = { + [RENDER_INIT] = TextDispInit, [RENDER_UPDATE] = TextDispUpdate, [RENDER_DIE] = TextDispDie, + [RENDER_WAIT] = TextDispWait, [RENDER_ROLL] = TextDispRoll, [RENDER_ENQUIRY] = TextDispEnquiry, + }; + SetDoTextBox(4); - gTextBoxHandlers[gCurrentTextBox.state](&gCurrentTextBox); - CalcWindowSize(0); + gTextDispFunctions[gTextRender.renderStatus](&gTextRender); + ChangeWindowSize(0); return 0; } -void TextBoxHandler0(CurrentTextBox* this) { - if ((gCurrentTextBox._20 & 1) == 0) { - if (gCurrentTextBox._98.bytes.b1 == 0) { - sub_080564C8(5); +static void TextDispInit(TextRender* this) { + if ((gTextRender.curToken.flags & 1) == 0) { + if (gTextRender._98.bytes.b1 == 0) { + StatusUpdate(MSG_DIE); } } else { - this->state = 1; + this->renderStatus = RENDER_UPDATE; } } -void TextBoxHandler1(CurrentTextBox* param_1) { - u32 uVar3; - s32 iVar4; - int iVar5; - int iVar6; +static void TextDispUpdate(TextRender* this) { + static const u8 speeds[] = { 5, 3, 1 }; + u32 speedModifier; + s32 numCharsToRead, pxDrawn; + + if (this->delay != 0) { + this->delay--; + return; + } - if (param_1->_95 != 0) { - param_1->_95--; + if ((gInput.heldKeys & B_BUTTON) != 0) { + speedModifier = 8; } else { - if ((gInput.heldKeys & B_BUTTON) != 0) { - iVar4 = 8; - } else { - iVar4 = 1; - } - param_1->_92 -= iVar4; - if (param_1->_92 < 1) { - iVar5 = 0; - do { - iVar5++; - param_1->_92 += gUnk_08107C0C[param_1->textBox.textSpeed]; - } while (param_1->_92 < 1); - iVar6 = 0; - do { - uVar3 = sub_08056750(param_1); - if (((uVar3 == 0) || (param_1->_95 != 0)) || (param_1->_8a != 0)) - break; - iVar6 += uVar3; - iVar5--; - } while (0 < iVar5); - if (iVar6 != 0) { - gCurrentTextBox._9d = 1; - } else { - param_1->_92 = 0; - } - } + speedModifier = 1; } -} + this->typeSpeed -= speedModifier; + + if (this->typeSpeed > 0) { + return; + } + + numCharsToRead = 0; + do { + numCharsToRead++; + this->typeSpeed += speeds[this->message.textSpeed]; + } while (this->typeSpeed <= 0); -NONMATCH("asm/non_matching/textbox/sub_08056750.inc", u16 sub_08056750(CurrentTextBox* param_1)) { - s32 r0, r1, r2, r3; - u32 r7; - s32 tmp; - u32 t; - u32* t2; + pxDrawn = 0; + do { + u32 pxCnt = RunTextCommand(this); + if (pxCnt == 0 || this->delay != 0 || this->newlineDelay != 0) + break; + pxDrawn += pxCnt; + numCharsToRead--; + } while (0 < numCharsToRead); + + if (pxDrawn != 0) { + gTextRender.updateDraw = 1; + } else { + this->typeSpeed = 0; + } +} - r7 = param_1->_24; +NONMATCH("asm/non_matching/textbox/sub_08056750.inc", static u16 RunTextCommand(TextRender* this)) { + s32 palette; + u32 chr = this->curToken.extended; - if (r7 == 0) { - r7 = sub_0805EFE8(¶m_1->_20); - switch (r7) { + if (chr == 0) { + s32 r1; + chr = GetCharacter(&this->curToken); + switch (chr) { case 0: if (gUnk_02000040.unk_00 == 1) { - param_1->state = 5; - sub_08056ABC(0, 0); + this->renderStatus = RENDER_ENQUIRY; + SwitchChoice(0, 0); } else { - param_1->state = 2; + this->renderStatus = RENDER_DIE; } break; case 1: - param_1->_8a = 2; - if (param_1->_98.bytes.b0 == 0) { - sub_08056BDC(1); + this->newlineDelay = 2; + if (this->_98.bytes.lineNo == 0) { + MsgChangeLine(1); } else { - param_1->state = 3; + this->renderStatus = RENDER_WAIT; } break; case 2: - sub_080564C8(3); + StatusUpdate(MSG_OPEN); break; case 3: - sub_080564C8(4); + StatusUpdate(MSG_CLOSE); break; case 4: - param_1->_50.unk6 += - (param_1->_50.unk4 - param_1->_50.unk6 - sub_GetFontStrWidth(¶m_1->_20, 0)) / 2; + this->_50.unk6 += (this->_50.unk4 - this->_50.unk6 - GetFontStrWith(&this->curToken.flags, 0)) / 2; break; case 5: - gTextBox.unk = param_1->_22; + gMessage.unk = this->curToken.param; break; case 6: - t2 = &gUnk_0200005C; - t = param_1->_22; - WriteBit(t2, 0x1f & t); + WriteBit(&gMessage.field_0xc, this->curToken.param & 0x1f); break; case 7: - switch (param_1->_22) { + switch (this->curToken.param) { case 0xe: - param_1->_91 = param_1->_8f; - r3 = 2; + this->_91 = this->_8f; + palette = 2; break; case 0xf: - r3 = param_1->_91; + palette = this->_91; break; default: - r3 = param_1->_22; + palette = this->curToken.param; break; } - param_1->_90 = 0; - sub_080569C4(param_1, r3); + this->_90 = 0; + PaletteChange(this, palette); break; case 8: - SoundReq(param_1->_22); + SoundReq(this->curToken.param); break; case 9: - gCurrentTextBox.textBox.unk3 = param_1->_22; - sub_08056F88(param_1->_22, param_1->_50.unk3); + gTextRender.message.unk3 = this->curToken.param; + sub_08056F88(this->curToken.param, this->_50.unk3); break; case 10: - param_1->textBox.textWindowPosY = param_1->_22; + this->message.textWindowPosY = this->curToken.param; break; case 12: if (gUnk_02000040.unk_00 != 1) { MemClear(&gUnk_02000040, 4); - MemClear(&gUnk_02024030, sizeof(gUnk_02024030)); - gUnk_02024030.unk_00 = 1; + MemClear(&gMessageChoices, sizeof(gMessageChoices)); + gMessageChoices.unk_00 = 1; gUnk_02000040.unk_00 = 1; } - if (gUnk_02024030.unk_02 > 3) + if (gMessageChoices.choiceCount > 3) break; - gUnk_02024030.unk_10[gUnk_02024030.unk_02] = param_1->_26; - gUnk_02024030.unk_08[gUnk_02024030.unk_02] = param_1->_50.unk6; - gUnk_02024030.unk_02++; - param_1->_50.unk6 += 8; + gMessageChoices.unk_10[gMessageChoices.choiceCount] = this->curToken._6; + gMessageChoices.unk_08[gMessageChoices.choiceCount] = this->_50.unk6; + gMessageChoices.choiceCount++; + this->_50.unk6 += 8; break; case 13: - switch (param_1->_22) { + switch (this->curToken.param) { case 0xff: - param_1->_8e = 1; + this->_8e = 1; break; case 0xfe: - param_1->_8e = 2; + this->_8e = 2; break; default: - param_1->_95 = param_1->_22; + this->delay = this->curToken.param; break; } break; case 14: - r1 = param_1->_22; - param_1->_94 = r1; + r1 = this->curToken.param; + this->_94 = r1; break; default: break; } - if (r7 >> 8 == 0) + if (chr >> 8 == 0) return 0; } - if (gCurrentTextBox._98.bytes.b1 != 2) { - sub_080564C8(3); + if (gTextRender._98.bytes.b1 != 2) { + StatusUpdate(MSG_OPEN); return 0; } - if (gTextBox.unk == 0) { - gTextBox.unk = 0x80; + if (gMessage.unk == 0) { + gMessage.unk = 0x80; } - param_1->_24 = 0; - if (r7 >> 8 == 7) { - param_1->_90 = param_1->_8f | 0x80; - sub_080569C4(param_1, 0); + this->curToken.extended = '\0'; + if (chr >> 8 == 7) { + this->_90 = this->_8f | 0x80; + PaletteChange(this, 0); } else { - if ((param_1->_90 & 0x80) != 0) { - r3 = param_1->_90; - param_1->_90 = 0; - sub_080569C4(param_1, r3); + if ((this->_90 & 0x80) != 0) { + palette = this->_90; + this->_90 = 0; + PaletteChange(this, palette); } } - return sub_0805F7DC(r7, ¶m_1->_30[0x20]); + return sub_0805F7DC(chr, &this->_50.unk0); } END_NONMATCH -void sub_080569C4(CurrentTextBox* ctb, u32 unk) { - u32 temp = unk & 0x7; - ctb->_8f = temp; - ctb->_50.unk2 = temp; +static void PaletteChange(TextRender* this, u32 id) { + u32 temp = id % 8; + this->_8f = temp; + this->_50.unk2 = temp; } -extern u8 gUnk_08107C14; -extern u8 gUnk_08107C0F; +const u8 gUnk_08107C0F[] = { 0x8, 0x1e, 0x4, 0x12, 0x0 }; +const u8 gUnk_08107C14[] = { 0x8, 0x1e, 0x8, 0xFE, 0x0 }; #ifdef EU -ASM_FUNC("asm/non_matching/eu/TextBoxHandlerQuestion.inc", void TextBoxHandlerQuestion(CurrentTextBox* ctb)) +ASM_FUNC("asm/non_matching/eu/TextBoxHandlerQuestion.inc", static void TextDispEnquiry(TextRender* ctb)) #else -void TextBoxHandlerQuestion(CurrentTextBox* ctb) { - s32 r1, r5, r6; - u32 error; - u8* ptr1; - u8* ptr2; +static void TextDispEnquiry(TextRender* this) { + s32 nextTextIdx, choiceIdx, lastChoice; + u32 doSwitch; + const u8* src; - r5 = gUnk_02024030.unk_03; + choiceIdx = gMessageChoices.currentChoice; switch (gInput.newKeys) { case START_BUTTON: case A_BUTTON: - r1 = gUnk_02024030.unk_10[r5]; - if (r1 == 0) { - ptr2 = &gUnk_08107C14; - ptr1 = &ctb->_20; + nextTextIdx = gMessageChoices.unk_10[choiceIdx]; + if (nextTextIdx == 0) { + src = gUnk_08107C14; } else { - ctb->textBox.textIndex = r1; - sub_0805EEB4(&ctb->_20, r1); - ptr2 = &gUnk_08107C0F; - ptr1 = &ctb->_20; + this->message.textIndex = nextTextIdx; + sub_0805EEB4(&this->curToken, nextTextIdx); + src = gUnk_08107C0F; } - sub_0805EF40(ptr1, ptr2); - gUnk_02000040.unk_01 = gUnk_02024030.unk_03; + sub_0805EF40(&this->curToken, src); + gUnk_02000040.unk_01 = gMessageChoices.currentChoice; gUnk_02000040.unk_00 = 3; - MemClear(&gUnk_02024030, sizeof(gUnk_02024030)); - SoundReq(0x6a); // SFX_TEXTBOX_SELECT - ctb->state = 1; + MemClear(&gMessageChoices, sizeof(gMessageChoices)); + SoundReq(SFX_TEXTBOX_SELECT); + this->renderStatus = RENDER_UPDATE; break; case DPAD_LEFT: - r5--; + choiceIdx--; break; case DPAD_RIGHT: - r5++; + choiceIdx++; break; default: break; } - r5 = (r5 + gUnk_02024030.unk_02) % gUnk_02024030.unk_02; - r6 = gUnk_02024030.unk_03; - if (r5 != r6) { - gUnk_02024030.unk_03 = r5; - SoundReq(0x69); // SFX_TEXTBOX_CHOICE - error = 1; + choiceIdx = (choiceIdx + gMessageChoices.choiceCount) % gMessageChoices.choiceCount; + lastChoice = gMessageChoices.currentChoice; + if (choiceIdx != lastChoice) { + gMessageChoices.currentChoice = choiceIdx; + SoundReq(SFX_TEXTBOX_CHOICE); + doSwitch = 1; } else { - error = 0; + doSwitch = 0; } if (gUnk_02000040.unk_00 == 1) { - gUnk_02024030.unk_00 = gUnk_02000040.unk_00 = 2; - error = 1; + gMessageChoices.unk_00 = gUnk_02000040.unk_00 = 2; + doSwitch = 1; } - if (error != 0) { - sub_08056ABC(r5, r6); + if (doSwitch) { + SwitchChoice(choiceIdx, lastChoice); } } -void sub_08056ABC(u32 unk_0, u32 unk_1) { +static void SwitchChoice(u32 to, u32 from) { u16 t; - t = gCurrentTextBox._50.unk6; - gCurrentTextBox._50.unk6 = gUnk_02024030.unk_08[unk_1]; - sub_0805F8E4(0, &gCurrentTextBox._50); - gCurrentTextBox._50.unk6 = gUnk_02024030.unk_08[unk_0]; - sub_0805F8E4(1, &gCurrentTextBox._50); - gCurrentTextBox._50.unk6 = t; - gCurrentTextBox._9d = 1; + t = gTextRender._50.unk6; + gTextRender._50.unk6 = gMessageChoices.unk_08[from]; + sub_0805F8E4(0, &gTextRender._50); + gTextRender._50.unk6 = gMessageChoices.unk_08[to]; + sub_0805F8E4(1, &gTextRender._50); + gTextRender._50.unk6 = t; + gTextRender.updateDraw = 1; } #endif -void TextBoxHandlerNextBox(CurrentTextBox* ctb) { - u32 t; - u8* ptr; - gTextBox.unk = 0; - if (ctb->_94 != 0) { - ctb->_94--; - if (ctb->_94 != 0) - return; - ptr = &ctb->state; - t = 4; - } else { - if (TEXTBOX_PRESS_ANY_ADVANCE_KEYS) { - SoundReq(0x68); // SFX_TEXTBOX_SWAP - ctb->_98.bytes.b2 = 0; - ptr = &ctb->state; - t = 4; - } else { - ptr = &ctb->_98.bytes.b2; - t = *ptr + 1; +static void TextDispWait(TextRender* this) { + gMessage.unk = 0; + if (this->_94 != 0) { + if (--this->_94 == 0) { + this->renderStatus = RENDER_ROLL; } + } else if (MESSAGE_PRESS_ANY_ADVANCE_KEYS) { + SoundReq(SFX_TEXTBOX_SWAP); + this->_98.bytes.b2 = 0; + this->renderStatus = RENDER_ROLL; + } else { + this->_98.bytes.b2++; } - *ptr = t; } -void TextBoxHandler4(CurrentTextBox* ctb) { - sub_08056BDC(0); - sub_080569C4(ctb, ctb->_8f | 0x40); - ctb->state = 1; +static void TextDispRoll(TextRender* this) { + MsgChangeLine(0); + PaletteChange(this, this->_8f | 0x40); + this->renderStatus = RENDER_UPDATE; } -void TextBoxHandlerAdvance(CurrentTextBox* ctb) { - gTextBox.unk = 0; +static void TextDispDie(TextRender* this) { + gMessage.unk = 0; SetDoTextBox(7); - if ((ctb->_8e != 1) && (ctb->_8e == 2 || TEXTBOX_PRESS_ANY_ADVANCE_KEYS)) { - sub_080564C8(4); - } -} - -void sub_08056BDC(u32 unk) { - gCurrentTextBox._98.bytes.b0 = unk; - if (unk == 0) { - MemFill32(0xFFFFFFFF, gUnk_02000D00, sizeof(gUnk_02000D00)); - Load_02000D00_Asyc(); - gCurrentTextBox._9e = 0xf082; - gCurrentTextBox._a0 = 0xf083; - gCurrentTextBox._a2 = 0xf0b6; - gCurrentTextBox._a4 = 0xf0b7; - gCurrentTextBox._50.unk6 = 0; - gCurrentTextBox._50.unk4 = 0xd0; + if ((this->_8e != 1) && (this->_8e == 2 || MESSAGE_PRESS_ANY_ADVANCE_KEYS)) { + StatusUpdate(MSG_CLOSE); + } +} + +static void MsgChangeLine(u32 lineNo) { + gTextRender._98.bytes.lineNo = lineNo; + if (lineNo == 0) { + MemFill32(0xFFFFFFFF, gTextGfxBuffer, sizeof(gTextGfxBuffer)); + DrawCanvasLine(); + gTextRender.beginTiles[0] = (MESSAGE_PALETTE << 12) | MSG_TEXT_LINE1TOP; + gTextRender.beginTiles[1] = (MESSAGE_PALETTE << 12) | MSG_TEXT_LINE1BOTTOM; + gTextRender.beginTiles[2] = (MESSAGE_PALETTE << 12) | MSG_TEXT_LINE2TOP; + gTextRender.beginTiles[3] = (MESSAGE_PALETTE << 12) | MSG_TEXT_LINE2BOTTOM; + gTextRender._50.unk6 = 0; + gTextRender._50.unk4 = 0xd0; } else { - gCurrentTextBox._50.unk6 = 0xd0; - gCurrentTextBox._50.unk4 = 0x1a0; + gTextRender._50.unk6 = 0xd0; + gTextRender._50.unk4 = 0x1a0; } - sub_080569C4(&gCurrentTextBox, gCurrentTextBox._8f | 0x40); + PaletteChange(&gTextRender, gTextRender._8f | 0x40); } -void SetDoTextBox(u32 doTextbox) { - gTextBox.doTextBox = gCurrentTextBox.textBox.doTextBox = doTextbox; +static void SetDoTextBox(u32 doTextbox) { + gMessage.doTextBox = gTextRender.message.doTextBox = doTextbox; } -void DeleteWindow(void) { - u16* ptr; - int i, j; - +static void DeleteWindow(void) { Window* window = &gCurrentWindow; - - if (window->unk1 != 0) { - window->unk1 = 0; - ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(*window)]; + if (window->active) { + u16* ptr; + int i; + window->active = 0; + ptr = &gBG0Buffer[MESSAGE_POSITION_INDEX(*window)]; i = window->height + 2; do { - j = 0; + int j = 0; do { ptr[j] = 0; } while (j++, j < window->width + 2); - ptr += TEXTBOX_WIDTH; + ptr += MESSAGE_WIDTH; i--; } while (i > 0); - sub_0801C4A0(window->yPos, window->height); - sub_0801C494(); + RecoverUI(window->yPos, window->height); + RefreshUI(); } } -u32 CalcWindowSize(u32 fade) { - u32 scale; - u32 ret; +static u32 ChangeWindowSize(u32 delta) { Window* window; + u32 result = 0; - ret = 0; + gTextRender._98.bytes.sizeScale += delta; - gCurrentTextBox._98.bytes.sizeScale += fade; - if (gCurrentTextBox._98.bytes.sizeScale < 1) { - gCurrentTextBox._98.bytes.sizeScale = 0; - } else { - if (gCurrentTextBox._98.bytes.sizeScale < 8) - goto LAB_08056cee; - gCurrentTextBox._98.bytes.sizeScale = 8; + if (gTextRender._98.bytes.sizeScale < 1) { + gTextRender._98.bytes.sizeScale = 0; + result = 1; + } else if (gTextRender._98.bytes.sizeScale >= 8) { + gTextRender._98.bytes.sizeScale = 8; + result = 1; } - ret = 1; -LAB_08056cee: + window = &gNewWindow; - if (gCurrentTextBox._98.bytes.sizeScale != 0) { - scale = gCurrentTextBox._98.bytes.sizeScale; - window->width = (scale * (gCurrentTextBox.textBox.textWindowWidth << 1)) / 16; + if (gTextRender._98.bytes.sizeScale != 0) { + u32 scale = gTextRender._98.bytes.sizeScale; + window->width = (scale * (gTextRender.message.textWindowWidth << 1)) / 16; if ((window->width & 1) != 0) { window->width++; } - window->xPos = ((gCurrentTextBox.textBox.textWindowWidth / 2) + gCurrentTextBox.textBox.textWindowPosX) - - (window->width / 2); + window->xPos = + ((gTextRender.message.textWindowWidth / 2) + gTextRender.message.textWindowPosX) - (window->width / 2); - window->height = (scale * (gCurrentTextBox.textBox.textWindowHeight << 1)) / 16; + window->height = (scale * (gTextRender.message.textWindowHeight << 1)) / 16; if ((window->height & 1) != 0) { window->height++; } - window->yPos = ((gCurrentTextBox.textBox.textWindowHeight / 2) + gCurrentTextBox.textBox.textWindowPosY) - - (window->height / 2); + window->yPos = + ((gTextRender.message.textWindowHeight / 2) + gTextRender.message.textWindowPosY) - (window->height / 2); } else { window->yPos = -1; window->xPos = -1; window->height = -1; window->width = -1; } - window->unk1 = 1; - return ret; + window->active = 1; + return result; } -void CreateWindow(void) { - s32 r0, r3; +static void CreateWindow(void) { + s32 borderBeginTile; u16* ptr; - r0 = gCurrentTextBox._98.bytes.sizeScale; - if (r0 <= 0) + if (gTextRender._98.bytes.sizeScale <= 0) return; - ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(gNewWindow)]; - r3 = 0xf07b; - DispMessageFrame(ptr, gNewWindow.width, gNewWindow.height, r3); + ptr = &gBG0Buffer[MESSAGE_POSITION_INDEX(gNewWindow)]; + borderBeginTile = (MESSAGE_PALETTE << 12) | MSG_BORDER_CORNER; + DispMessageFrame(ptr, gNewWindow.width, gNewWindow.height, borderBeginTile); DispString(); DispCursor(); gCurrentWindow = gNewWindow; - sub_0801C494(); + RefreshUI(); } +// Also used by figurine menu ASM_FUNC("asm/non_matching/textbox/DispMessageFrame.inc", void DispMessageFrame(u16* buffer, u32 width_, u32 height_, u32 flags_)) extern u16 gUnk_02034CB2[]; extern u16 gUnk_0202281E[]; -void DispString(void) { - u32 r0, r2, r4; - u16 *ptr, *ptr2; - s32 i, j; +/* + Each character is two tiles tall. + They are stored in VRAM in the following order: + + 82 84 86 --> | | |\| |/ + 83 85 87 --> |_ | | \ |\ + + b6 b8 ba --> | | | + b7 b9 bb --> . . . + + There are 2 lines of text available, and each line is 20 chars long, + So the canvas is 20x4 tiles. +*/ + +static void DispString(void) { + u32 r0, tileAttr; + u16 *buf, *line; + s32 i, w, h; Window* window = &gNewWindow; if (window->width != 0) { if (window->height != 0) { - r4 = window->height; - ptr = &gUnk_02034CB2[TEXTBOX_POSITION_INDEX(*window)]; - i = (s32)(4 - r4) / 2; + h = window->height; + buf = &gBG0Buffer[MESSAGE_POSITION_INDEX(*window) + 1]; + i = (4 - h) / 2; do { - j = window->width; - r2 = gUnk_0202281E[i]; - ptr += TEXTBOX_WIDTH; + //! @bug abnormally big width causes tile idx to overwrite other tile attributes + w = window->width; + tileAttr = gTextRender.beginTiles[i]; + buf += MESSAGE_WIDTH; r0 = i + 1; - r4--; - ptr2 = ptr; + h--; + line = buf; do { - *ptr2 = r2; - ptr2++; - r2 += 2; - j--; - } while (j > 0); + *line = tileAttr; + line++; + tileAttr += 2; + w--; + } while (w > 0); i = r0; - } while (r4 != 0); + } while (h != 0); } } } -void DispCursor(void) { +static void DispCursor(void) { u32 offset; u16* ptr; - if ((gCurrentTextBox._98.word & 0x10ff00) == 0x100200) { - ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(gNewWindow)]; - offset = (((gNewWindow.height + 1) * TEXTBOX_WIDTH) - 2); + if ((gTextRender._98.word & 0x10ff00) == 0x100200) { + ptr = &gBG0Buffer[MESSAGE_POSITION_INDEX(gNewWindow)]; + offset = (((gNewWindow.height + 1) * MESSAGE_WIDTH) - 2); offset += gNewWindow.width; ptr += offset; *ptr = 0xf080; } } -void Load_02000D00_Asyc(void) { - LoadResourceAsync(gUnk_02000D00, 0x0600D040, sizeof(gUnk_02000D00)); +static void DrawCanvasLine(void) { + LoadResourceAsync(gTextGfxBuffer, 0x0600D040, sizeof(gTextGfxBuffer)); } void sub_08056F88(u32 unk_1, u32 unk_2) { @@ -750,27 +774,27 @@ void sub_08056F88(u32 unk_1, u32 unk_2) { unk_1 = 0; } uVar1 = unk_1 << 4 | unk_2; - if (gCurrentTextBox._9c != uVar1) { - gCurrentTextBox._9c = uVar1; + if (gTextRender._9c != uVar1) { + gTextRender._9c = uVar1; sub_0805F918(unk_1, unk_2, 0x0600CF60); } } -void sub_08056FBC(CurrentTextBox* ctb) { - sub_08056FEC(ctb->textBox.field_0x10, &ctb->_66[0x2]); - sub_08056FEC(ctb->textBox.field_0x14, &ctb->_66[0xa]); - sub_08056FEC(ctb->textBox.field_0x18, &ctb->_77[0x1]); - sub_08056FEC(ctb->textBox.field_0x1c, &ctb->_77[0x9]); +static void sub_08056FBC(TextRender* ctb) { + sub_08056FEC(ctb->message.field_0x10, &ctb->_66[0x2]); + sub_08056FEC(ctb->message.field_0x14, &ctb->_66[0xa]); + sub_08056FEC(ctb->message.field_0x18, &ctb->_77[0x1]); + sub_08056FEC(ctb->message.field_0x1c, &ctb->_77[0x9]); } -NONMATCH("asm/non_matching/textbox/sub_08056FEC.inc", u32 sub_08056FEC(u32 param_1, u8* param_2)) { +NONMATCH("asm/non_matching/textbox/sub_08056FEC.inc", u32 sub_08056FEC(u32 this, u8* param_2)) { u32 uVar1; int iVar2; int iVar3; int iVar4; u8 local_1c[8]; - uVar1 = sub_0801D51C(param_1, param_2, param_1); + uVar1 = sub_0801D51C(this, param_2, this); uVar1 = uVar1 & 0xfffffff; iVar4 = 0; do { diff --git a/src/utils.c b/src/utils.c index f4ad2bf0..76feb455 100644 --- a/src/utils.c +++ b/src/utils.c @@ -157,17 +157,17 @@ void LoadGfxGroup(u32 group) { case 0xD: return; case 0xE: - if (gUnk_02000000->gameLanguage != 0 && gUnk_02000000->gameLanguage != 1) { + if (gSaveHeader->gameLanguage != 0 && gSaveHeader->gameLanguage != 1) { loadGfx = TRUE; } break; case 0xF: - if (gUnk_02000000->gameLanguage != 0) { + if (gSaveHeader->gameLanguage != 0) { loadGfx = TRUE; } break; default: - if (ctrl == gUnk_02000000->gameLanguage) { + if (ctrl == gSaveHeader->gameLanguage) { loadGfx = TRUE; } break; |
