From 9cfbb3a27a4c8be6adad1ab060db777b30d52ec2 Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 4 Nov 2021 20:56:03 -0700 Subject: entity changes, textbox changes --- src/arm_proxy.c | 32 +- src/code_0805436C.c | 2 +- src/code_0805F9A0.c | 2 +- src/debugScreen.c | 6 +- src/enemy/acroBandits.c | 10 +- src/enemy/beetle.c | 10 +- src/enemy/bobomb.c | 6 +- src/enemy/bombPeahat.c | 2 +- src/enemy/businessScrub.c | 16 +- src/enemy/chuchu.c | 6 +- src/enemy/cuccoChickAggr.c | 6 +- src/enemy/fallingBoulder.c | 4 +- src/enemy/fireballGuy.c | 2 +- src/enemy/gibdo.c | 2 +- src/enemy/helmasaur.c | 4 +- src/enemy/lakitu.c | 4 +- src/enemy/likeLike.c | 10 +- src/enemy/mazaalBracelet.c | 10 +- src/enemy/mazaalHead.c | 2 +- src/enemy/miniFireballGuy.c | 2 +- src/enemy/moldworm.c | 8 +- src/enemy/peahat.c | 4 +- src/enemy/pesto.c | 6 +- src/enemy/puffstool.c | 10 +- src/enemy/rollobite.c | 6 +- src/enemy/rupeeLike.c | 4 +- src/enemy/spikedBeetle.c | 4 +- src/enemy/spinyChuchu.c | 2 +- src/enemy/tektite.c | 8 +- src/enemy/tektiteGolden.c | 8 +- src/enemy/vaatiArm.c | 6 +- src/enemy/vaatiProjectile.c | 2 +- src/enemy/vaatiTransfigured.c | 6 +- src/enemy/vaatiTransfiguredEye.c | 4 +- src/enemy/vaatiWrath.c | 6 +- src/enemy/wallMaster2.c | 2 +- src/enemy/waterDrop.c | 2 +- src/enemy/wisp.c | 2 +- src/ezloNag.c | 2 +- src/fileScreen.c | 42 +- src/game.c | 4 +- src/intro.c | 12 +- src/item/itemLantern.c | 12 +- src/item/itemOcarina.c | 4 +- src/item/itemPegasusBoots.c | 6 +- src/item/itemRocsCape.c | 8 +- src/item/itemSword.c | 12 +- src/main.c | 18 +- src/manager/manager1.c | 18 +- src/manager/manager1A.c | 8 +- src/manager/manager26.c | 2 +- src/manager/manager3.c | 4 +- src/manager/manager37.c | 4 +- src/manager/manager39.c | 2 +- src/manager/manager6.c | 2 +- src/manager/managerA.c | 6 +- src/manager/managerF.c | 4 +- src/npc/beedle.c | 4 +- src/npc/bigGoron.c | 2 +- src/npc/bladeBrothers.c | 20 +- src/npc/brocco.c | 2 +- src/npc/carpenter.c | 2 +- src/npc/castleMaid.c | 4 +- src/npc/cat.c | 4 +- src/npc/cow.c | 4 +- src/npc/cucco.c | 2 +- src/npc/cuccoChick.c | 6 +- src/npc/dampe.c | 4 +- src/npc/dog.c | 18 +- src/npc/drLeft.c | 2 +- src/npc/epona.c | 6 +- src/npc/forestMinish.c | 6 +- src/npc/ghostBrothers.c | 2 +- src/npc/gorman.c | 2 +- src/npc/goron.c | 4 +- src/npc/goronMerchant.c | 12 +- src/npc/guard.c | 4 +- src/npc/kid.c | 8 +- src/npc/kingDaltus.c | 2 +- src/npc/kingGustaf.c | 4 +- src/npc/librari.c | 4 +- src/npc/librarians.c | 2 +- src/npc/mailbox.c | 2 +- src/npc/marcy.c | 2 +- src/npc/melari.c | 2 +- src/npc/ministerPotho.c | 2 +- src/npc/mountainMinish.c | 4 +- src/npc/mutoh.c | 2 +- src/npc/npc23.c | 2 +- src/npc/npc5.c | 4 +- src/npc/npc9.c | 4 +- src/npc/percy.c | 12 +- src/npc/picolyteBottle.c | 6 +- src/npc/pina.c | 2 +- src/npc/pita.c | 2 +- src/npc/postman.c | 8 +- src/npc/rem.c | 2 +- src/npc/smallTownMinish.c | 2 +- src/npc/smith.c | 2 +- src/npc/stamp.c | 4 +- src/npc/stockwell.c | 18 +- src/npc/sturgeon.c | 4 +- src/npc/talon.c | 4 +- src/npc/tingleSiblings.c | 2 +- src/npc/townMinish.c | 16 +- src/npc/townsperson.c | 10 +- src/npc/vaatiReborn.c | 2 +- src/npc/windTribespeople.c | 16 +- src/npc/zelda.c | 4 +- src/object/bird.c | 6 +- src/object/book.c | 6 +- src/object/button.c | 4 +- src/object/fileScreenObjects.c | 2 +- src/object/heartContainer.c | 2 +- src/object/itemOnGround.c | 12 +- src/object/jarPortal.c | 12 +- src/object/lilypadSmall.c | 2 +- src/object/mask.c | 2 +- src/object/minecart.c | 22 +- src/object/minishSizedEntrance.c | 4 +- src/object/object1A.c | 2 +- src/object/object1C.c | 2 +- src/object/object86.c | 2 +- src/object/objectA2.c | 2 +- src/object/pot.c | 8 +- src/object/swordsmanNewsletter.c | 2 +- src/object/warpPoint.c | 2 +- src/player.c | 210 ++++---- src/projectile/arrowProjectile.c | 4 +- src/projectile/boneProjectile.c | 4 +- src/projectile/cannonballProjectile.c | 2 +- src/projectile/dirtBallProjectile.c | 2 +- src/projectile/gleerokProjectile.c | 6 +- src/projectile/octorokBossProjectile.c | 2 +- src/projectile/rockProjectile.c | 4 +- src/projectile/stalfosProjectile.c | 6 +- src/projectile/v1FireProjectile.c | 4 +- src/room.c | 6 +- src/save.c | 6 +- src/script.c | 92 ++-- src/sub_0807CA18.c | 6 +- src/textbox.c | 884 +++++++++++++++++---------------- src/utils.c | 6 +- 143 files changed, 1015 insertions(+), 991 deletions(-) (limited to 'src') diff --git a/src/arm_proxy.c b/src/arm_proxy.c index d61749d7..d8efb2a0 100644 --- a/src/arm_proxy.c +++ b/src/arm_proxy.c @@ -129,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 { @@ -171,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); @@ -190,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; @@ -243,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(); @@ -263,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) diff --git a/src/code_0805436C.c b/src/code_0805436C.c index c8a446c8..f92478de 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -255,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_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/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 5edc7d1d..4644e620 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -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 09224225..15535172 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -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 3d107aa3..67bb138b 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -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 730f1aa7..ec33bb58 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -246,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); @@ -285,7 +285,7 @@ void sub_08028CE8(Entity* this) { } } else { /* Not enough money. */ - TextboxNoOverlapFollow(0x2903); + MessageFromTarget(0x2903); sub_08078A90(0); } } @@ -303,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; @@ -315,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); @@ -383,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/fallingBoulder.c b/src/enemy/fallingBoulder.c index 5195b542..29446667 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -32,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) { @@ -190,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 42916d3e..2103e19f 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -101,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 923ebbdc..d1773a7d 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -350,7 +350,7 @@ void sub_08037A58(Entity* this) { } void sub_08037ACC(Entity* this) { - gPlayerState.flags.all &= 0xFFFFFEFF; + gPlayerState.flags &= 0xFFFFFEFF; gPlayerEntity.flags |= 0x80; gPlayerEntity.iframes = 0x1e; gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState); diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 2385b12e..41f0ed85 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -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/lakitu.c b/src/enemy/lakitu.c index b35d9540..1353d489 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -57,7 +57,7 @@ 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 { @@ -353,7 +353,7 @@ void sub_0803CC08(Entity* this) { return; } - if (this->field_0x20 >= 0) { + if (this->hVelocity >= 0) { return; } diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 6824d4eb..70f5ea3f 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -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); } @@ -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/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index a0f50903..96ded54d 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -916,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 { @@ -982,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; } @@ -1227,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; @@ -1257,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 04b80eff..a4b000e8 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -816,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/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/moldworm.c b/src/enemy/moldworm.c index 8f805aaf..88ad48bf 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -84,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); @@ -266,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]; } @@ -401,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 597ab1da..9a96a72d 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -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 b7139173..4225a61f 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -72,8 +72,8 @@ 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->knockbackDuration = 0; @@ -200,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); } } @@ -213,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); } @@ -242,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); } } diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index d8774285..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; @@ -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/spikedBeetle.c b/src/enemy/spikedBeetle.c index 4c458a14..4884f873 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -49,7 +49,7 @@ 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->knockbackDirection; this->knockbackDuration = 0; @@ -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 c4d7037b..98e5298a 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -952,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; @@ -979,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; @@ -1352,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/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 94d7935a..757d6544 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -313,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; @@ -379,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; @@ -1061,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); } } 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 9e319d8c..310827cf 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -456,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; @@ -626,7 +626,7 @@ void sub_08041CD0(Entity* this) { } else { this->subAction = 2; this->actionDelay = 0x3c; - TextboxNoOverlapFollow(0x1651); + MessageFromTarget(0x1651); } } else { UpdateAnimationSingleFrame(this); @@ -637,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 { 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 213665c3..05fdc4e0 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -37,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) { 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/game.c b/src/game.c index ee37c155..baea4764 100644 --- a/src/game.c +++ b/src/game.c @@ -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 55e7cad6..bd179898 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(); 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 bb4c6d34..c84ac6b9 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 54c3db73..b572d2f6 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -23,7 +23,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { 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, FX_GREEN_SPLASH, 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/main.c b/src/main.c index 08a6f0fc..e8f1e0ed 100644 --- a/src/main.c +++ b/src/main.c @@ -80,7 +80,7 @@ void AgbMain(void) { gMain.ticks++; sScreenHandlers[gMain.screen](); - MessageUpdate(); + 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,14 @@ 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/manager1A.c b/src/manager/manager1A.c index c006ddaf..838fd898 100644 --- a/src/manager/manager1A.c +++ b/src/manager/manager1A.c @@ -139,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; } } @@ -157,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 2a6a4c24..99884daa 100644 --- a/src/manager/manager3.c +++ b/src/manager/manager3.c @@ -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()) { @@ -94,7 +94,7 @@ void CreateMagicSparkles(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 f7b56dfa..e69d7f65 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 3f1b841e..6003f891 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 76e49700..2648b0f0 100644 --- a/src/manager/managerF.c +++ b/src/manager/managerF.c @@ -343,7 +343,7 @@ void SetDirtTile(u32 tile) { 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(); } @@ -360,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 34a336ff..d5320463 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -184,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 6567e840..d6069c99 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -87,7 +87,7 @@ void sub_08068A4C(Entity* this) { if (this->interactType != 0) { this->interactType = 0; this->action = 2; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } } @@ -307,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 dc513e2e..7030b4ce 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/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/dog.c b/src/npc/dog.c index 97486431..2902c5be 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) @@ -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) 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/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 31bedabb..e3ca2a68 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 (gUnk_0811033C[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 441a80a6..a2498d86 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -41,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); 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 0f6470ad..736625cd 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -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 6309b2bd..43b87eb8 100644 --- a/src/npc/mailbox.c +++ b/src/npc/mailbox.c @@ -42,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); } } 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 99c04122..9f1df856 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -50,7 +50,7 @@ void sub_08068730(Entity* this) { } if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(this->actionDelay + 0x1200); + MessageFromTarget(this->actionDelay + 0x1200); } } 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 1317fce2..16578b58 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -49,7 +49,7 @@ void sub_0806B3CC(Entity* this) { GetNextFrame(this); if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); } sub_0806ED78(this); } @@ -107,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) { @@ -116,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; } @@ -124,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 3d61962e..8a378f79 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -65,7 +65,7 @@ void sub_0806045C(Entity* this) { case 1: case 2: this->action = 2; - TextboxNoOverlapFollow(0); + MessageFromTarget(0); break; default: bVar1 = this->knockbackDirection; @@ -140,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; @@ -156,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); @@ -165,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 55471f6c..cdeff498 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -91,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 54cc7ec6..b983f9c5 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -41,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); 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 3db8fd02..eb86baed 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -70,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); } } @@ -141,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); } @@ -254,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) { @@ -270,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) { @@ -283,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/bird.c b/src/object/bird.c index 0dad159f..758a3564 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -29,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; @@ -85,7 +85,7 @@ void sub_0809D084(Entity* this) { PositionRelative(this->parent, this, 0, 0x80000); } else { this->subAction++; - this->field_0x20 = temp; + this->hVelocity = temp; } } } @@ -119,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 356b85d9..3c60630c 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -97,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; @@ -143,7 +143,7 @@ void sub_0809B56C(Entity* this) { } 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); @@ -197,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 52876a45..8bbd7bca 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -153,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)) { 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 index 9d85f282..a3f2541d 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -63,7 +63,7 @@ void sub_0808BF58(Entity* this) { sub_08003FC4(this, 0x2000); switch (this->subAction) { case 0: - if (this->field_0x20 <= 98303) { + if (this->hVelocity <= 98303) { ++this->subAction; InitAnimationForceUpdate(this, 2); } @@ -72,7 +72,7 @@ void sub_0808BF58(Entity* this) { UpdateAnimationSingleFrame(this); if (!this->height.HALF.HI) { ++this->subAction; - this->field_0x20 = 0x8000; + this->hVelocity = 0x8000; } break; case 2: @@ -111,7 +111,7 @@ void sub_0808C01C(Entity* this, u32 r1) { type = 2; gArea.curPortalType = type; if (r1 == 1) { - if (((gPlayerState.flags.all & 0x20) != 0) && (gPlayerState.jumpStatus == 0)) { + if (((gPlayerState.flags & 0x20) != 0) && (gPlayerState.jumpStatus == 0)) { gArea.field_0x18 = 2; } else { if (sub_08057810() != 0) { @@ -131,7 +131,7 @@ void sub_0808C0AC(Entity* this) { sub_08003FC4(this, 0x2000); switch (this->subAction) { case 0: - if (this->field_0x20 <= 98303) { + if (this->hVelocity <= 98303) { this->subAction = 1; InitAnimationForceUpdate(this, 3); } @@ -140,7 +140,7 @@ void sub_0808C0AC(Entity* this) { UpdateAnimationSingleFrame(this); if (!this->height.HALF.HI) { ++this->subAction; - this->field_0x20 = 0x8000; + this->hVelocity = 0x8000; } break; case 2: @@ -160,7 +160,7 @@ u32 sub_0808C128(Entity* this) { void sub_0808C13C(Entity* this) { this->subAction = 0; - this->field_0x20 = 163840; + this->hVelocity = 163840; } void sub_0808C148(Entity* this, u32 a2) { 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/mask.c b/src/object/mask.c index 05a49fb7..cd94a1b5 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -47,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; 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 73cb101f..a2092bb7 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -46,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; diff --git a/src/object/pot.c b/src/object/pot.c index f3423433..79d0a38f 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -67,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; @@ -85,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; } @@ -184,7 +184,7 @@ void sub_08082614(Entity* this) { } this->action = 1; - if (gPlayerState.flags.all & 0x80) { + if (gPlayerState.flags & 0x80) { this->speed <<= 1; } @@ -251,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; } 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/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/player.c b/src/player.c index 655f4a28..0f68f9e3 100644 --- a/src/player.c +++ b/src/player.c @@ -155,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; @@ -179,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; @@ -205,13 +205,13 @@ void sub_08070D38(Entity* this) { 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; @@ -242,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; } @@ -259,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 @@ -275,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; @@ -287,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; @@ -298,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(); } @@ -327,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 { @@ -362,7 +362,7 @@ 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) { @@ -384,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; @@ -406,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(); @@ -455,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; @@ -472,7 +472,7 @@ void sub_08071130(Entity* this) { void sub_08071208(Entity* this) { if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { - if ((gPlayerState.flags.all & 0x80) == 0) { + if ((gPlayerState.flags & 0x80) == 0) { UpdateAnimationSingleFrame(this); } } @@ -485,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); } @@ -494,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, FX_WATER_SPLASH, 0); - if ((gPlayerState.flags.all & 8) == 0) + if ((gPlayerState.flags & 8) == 0) gPlayerState.field_0x8 = 0x72c; else gPlayerState.field_0x8 = 0x44c; @@ -519,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) { @@ -536,7 +536,7 @@ void sub_080712F0(Entity* this) { this->iframes = 32; this->spritePriority.b1 = 1; this->spriteSettings.b.draw = FALSE; - gPlayerState.flags.all &= ~0x4; + gPlayerState.flags &= ~0x4; RespawnPlayer(); } @@ -548,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) @@ -584,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; @@ -615,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; @@ -657,7 +657,7 @@ void PortalActivateUpdate(Entity* this) { UpdateAnimationSingleFrame(this); - if (gPlayerState.flags.all & 0x80) + if (gPlayerState.flags & 0x80) this->subAction = 4; } @@ -670,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); } @@ -724,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; @@ -747,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(); @@ -791,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 @@ -806,7 +806,7 @@ void sub_08071990(Entity* this) { return; } - if (gPlayerState.flags.all & 0x80) + if (gPlayerState.flags & 0x80) return; if (this->animationState == 2) @@ -850,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); } @@ -886,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->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); @@ -909,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; @@ -921,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(); @@ -929,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; @@ -949,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; @@ -983,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; @@ -1025,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; } @@ -1123,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; @@ -1143,7 +1143,7 @@ void sub_08072008(Entity* this) { this->knockbackDuration = 0; this->flags |= 0x80; this->spriteOffsetX = 0; - gPlayerState.flags.all &= ~(0x800 | 0x1); + gPlayerState.flags &= ~(0x800 | 0x1); CreateFx(this, FX_ICE, 0); sub_080791BC(); } @@ -1194,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; @@ -1237,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); } @@ -1251,8 +1251,8 @@ 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; @@ -1273,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; @@ -1286,7 +1286,7 @@ void sub_080722DC(Entity* this) { this->subAction = 3; this->knockbackDuration = 10; } - gPlayerState.flags.all |= (0x400 | 0x1); + gPlayerState.flags |= (0x400 | 0x1); ResetPlayer(); SoundReq(SFX_124); SoundReq(SFX_PLY_VO6); @@ -1304,7 +1304,7 @@ void sub_08072354(Entity* this) { this->subAction = 2; this->actionDelay = 0x3c; gPlayerState.field_0x8 = 0x2c1; - gPlayerState.flags.all &= ~0x400; + gPlayerState.flags &= ~0x400; UpdateSpriteForCollisionLayer(this); CreateFx(this, FX_LAVA_SPLASH, 0); SoundReq(SFX_1A6); @@ -1324,7 +1324,7 @@ void sub_0807240C(Entity* this) { if (--this->knockbackDuration == 0xff) { this->spriteSettings.b.draw = 3; this->iframes = 0x14; - gPlayerState.flags.all &= ~0x400; + gPlayerState.flags &= ~0x400; ModHealth(-2); RespawnPlayer(); } @@ -1377,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; @@ -1421,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 { @@ -1440,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 { @@ -1450,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)) { + 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; } @@ -1480,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; } @@ -1508,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) { @@ -1518,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(); } } @@ -1563,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; @@ -1590,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; @@ -1606,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; @@ -1636,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); @@ -1651,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); @@ -1667,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(); } } @@ -1704,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; @@ -1783,12 +1783,12 @@ 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; @@ -1899,7 +1899,7 @@ void sub_08073094(Entity* this) { case 0x2a: case 0x2c: this->knockbackDuration = 0; - gPlayerState.flags.all |= 0x20000000; + gPlayerState.flags |= 0x20000000; UpdateAnimationSingleFrame(this); if ((this->frames.all & 0x40) != 0) { sub_0807A1B8(); diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c index d2f4f45e..fc6d3305 100644 --- a/src/projectile/arrowProjectile.c +++ b/src/projectile/arrowProjectile.c @@ -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,7 +106,7 @@ void sub_080A9488(Entity* this) { this->action = 4; this->flags &= 0x7f; this->actionDelay = 2; - this->field_0x20 = 0x18000; + 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 150d5fe3..2f4c8339 100644 --- a/src/projectile/cannonballProjectile.c +++ b/src/projectile/cannonballProjectile.c @@ -78,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)) { diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index 371473da..fd5909b8 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -48,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) { diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index d8eeff71..d48820b0 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -36,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); @@ -63,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; diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 6f677525..5b1f8e44 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -40,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; diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index 265a1e5b..72d34a73 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -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 0c48006f..fb75691e 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -33,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; } } @@ -77,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: @@ -117,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) { 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/room.c b/src/room.c index 227073c2..548e1cdc 100644 --- a/src/room.c +++ b/src/room.c @@ -2240,7 +2240,7 @@ u32 sub_0804CD0C() { #ifdef DEMO void nullsub_251() { - if (gUnk_02000000->saveFileId != 0 && GetInventoryValue(0x40) == 0) { + if (gSaveHeader->saveFileId != 0 && GetInventoryValue(0x40) == 0) { SetTileType(0x365, 0x349, 1); SetTileType(0x365, 0x34a, 1); SetTileType(0x365, 0x34b, 1); @@ -4866,7 +4866,7 @@ extern EntityData gUnk_080F30CC; void sub_0804E7A4(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); } } @@ -4890,7 +4890,7 @@ void sub_0804E7DC(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); } } diff --git a/src/save.c b/src/save.c index 9dd07459..9b8222af 100644 --- a/src/save.c +++ b/src/save.c @@ -109,14 +109,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 16cdac39..4b30e004 100644 --- a/src/script.c +++ b/src/script.c @@ -106,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_0807EA94(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); @@ -159,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*); @@ -253,11 +253,11 @@ const ScriptCommand gScriptCommands[] = { ScriptCommandNop, ScriptCommand_0807EA4C, ScriptCommand_0807EA88, ScriptCommand_0807EA94, - 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, @@ -406,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); @@ -602,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(); } @@ -806,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)); } @@ -890,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; } @@ -1131,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; @@ -1195,36 +1195,36 @@ void ScriptCommand_0807EA88(Entity* entity, ScriptExecutionContext* context) { } void ScriptCommand_0807EA94(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) { @@ -1267,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) { @@ -1438,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 { @@ -1583,7 +1583,7 @@ void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F1C4(Entity* entity, ScriptExecutionContext* context) { - if ((gPlayerState.flags.all & 8) != 0) { + if ((gPlayerState.flags & 8) != 0) { gPlayerState.field_0x8 = 0x459; } else { gPlayerState.field_0x8 = 0x1bc; @@ -1591,7 +1591,7 @@ void sub_0807F1C4(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F1E8(Entity* entity, ScriptExecutionContext* context) { - if ((gPlayerState.flags.all & 8) != 0) { + if ((gPlayerState.flags & 8) != 0) { gPlayerState.field_0x8 = 0x45a; } else { gPlayerState.field_0x8 = 0x2bd; @@ -1599,7 +1599,7 @@ void sub_0807F1E8(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F210(Entity* entity, ScriptExecutionContext* context) { - if ((gPlayerState.flags.all & 8) != 0) { + if ((gPlayerState.flags & 8) != 0) { gPlayerState.field_0x8 = 0x41c; } else { gPlayerState.field_0x8 = 0x80c; @@ -1843,11 +1843,11 @@ void sub_0807F6B4(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F6E8(Entity* entity, ScriptExecutionContext* context) { - gPlayerState.flags.all |= context->intVariable; + gPlayerState.flags |= context->intVariable; } void sub_0807F6F8(Entity* entity, ScriptExecutionContext* context) { - gPlayerState.flags.all &= ~context->intVariable; + gPlayerState.flags &= ~context->intVariable; } void sub_0807F708(Entity* entity, ScriptExecutionContext* context) { @@ -1887,8 +1887,8 @@ void sub_0807F78C(Entity* entity, ScriptExecutionContext* context) { msg = GetSaleItemConfirmMessageID(item); price = GetItemPrice(item); - TextboxNoOverlap(msg, entity); - gTextBox.field_0x10 = (u16)price; + MessageNoOverlap(msg, entity); + gMessage.field_0x10 = (u16)price; } void sub_0807F7C4(Entity* entity, ScriptExecutionContext* context) { @@ -1936,16 +1936,16 @@ void sub_0807F854(Entity* entity, ScriptExecutionContext* context) { switch (idx) { case 0: case 1: - gTextBox.field_0x10 = value; + gMessage.field_0x10 = value; break; case 2: - gTextBox.field_0x14 = value; + gMessage.field_0x14 = value; break; case 3: - gTextBox.field_0x18 = value; + gMessage.field_0x18 = value; break; case 4: - gTextBox.field_0x1c = value; + gMessage.field_0x1c = value; break; } } @@ -1997,7 +1997,7 @@ void sub_0807F950(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F970(Entity* entity, ScriptExecutionContext* context) { - context->condition = context->intVariable == gCurrentTextBox._28; + context->condition = context->intVariable == gTextRender.curToken.textIndex; } void sub_0807F98C(Entity* entity, ScriptExecutionContext* context) { diff --git a/src/sub_0807CA18.c b/src/sub_0807CA18.c index 9a359467..6fc1cbca 100644 --- a/src/sub_0807CA18.c +++ b/src/sub_0807CA18.c @@ -24,8 +24,8 @@ u8 sub_0807CA18() { #ifdef DEMO { const u8* tmp; - MemCopy(demoPointers[gUnk_02000000->saveFileId], &gSave, 0x4B4); - if (gUnk_02000000->gameLanguage == 0) { + MemCopy(demoPointers[gSaveHeader->saveFileId], &gSave, 0x4B4); + if (gSaveHeader->gameLanguage == 0) { gSave.playerName[0] = 0x97; gSave.playerName[1] = 0x7F; gSave.playerName[2] = 0xDD; @@ -34,7 +34,7 @@ u8 sub_0807CA18() { ModHealth(0xA0); ModRupees(-9999); tmp = demoUnknown1 + gUnk_02000010.field_0x7 * 3; - gSave.unk_4a8 = tmp[gUnk_02000000->saveFileId] * 3600; + gSave.unk_4a8 = tmp[gSaveHeader->saveFileId] * 3600; } #endif return 1; diff --git a/src/textbox.c b/src/textbox.c index 01b7bbae..41440d78 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; - -extern u8 gUnk_020227A0; -extern u8 gUnk_02000D00[0xD00]; +} gMessageChoices; -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 (param_1->_95 != 0) { - param_1->_95--; + if (this->delay != 0) { + this->delay--; + return; + } + + 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; -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; + if (this->typeSpeed > 0) { + return; + } + + numCharsToRead = 0; + do { + numCharsToRead++; + this->typeSpeed += speeds[this->message.textSpeed]; + } while (this->typeSpeed <= 0); + + 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; - #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; + + static const u8 arr1[] = { 0x8, 0x1e, 0x4, 0x12, 0x0 }; + static const u8 arr2[] = { 0x8, 0x1e, 0x8, 0xFE, 0x0 }; - 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 = arr2; } 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 = arr1; } - 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 b88fb9cd..2c13f52b 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; -- cgit v1.2.3