From 66fcdf618665694fb5f5c2d3788561f4e638f167 Mon Sep 17 00:00:00 2001 From: theo Date: Sat, 13 Jun 2020 17:02:27 -0700 Subject: clang-format --- src/_dmaFill32.c | 5 +- src/bell.c | 21 +-- src/bigGoron.c | 50 +++--- src/bitGetters.c | 12 +- src/bladeTrap.c | 43 +++-- src/cat.c | 9 +- src/cloud.c | 113 +++++------- src/copyPosition.c | 6 +- src/cow.c | 32 ++-- src/createEnemy.c | 15 +- src/createEntity.c | 76 ++++----- src/createNPC.c | 15 +- src/createObject.c | 14 +- src/createObjectWithParent.c | 17 +- src/emma.c | 19 +-- src/epona.c | 142 +++++++-------- src/getProgressFlag.c | 6 +- src/giantLeaf.c | 17 +- src/greatFairy.c | 399 +++++++++++++++++-------------------------- src/introSetTransition.c | 9 +- src/loadRoom.c | 36 ++-- src/loadRoomEntityList.c | 16 +- src/mailbox.c | 50 +++--- src/mainLoop.c | 22 ++- src/milkCart.c | 15 +- src/modHealth.c | 4 +- src/modRupees.c | 7 +- src/object1A.c | 36 ++-- src/ocarina.c | 24 ++- src/octorok.c | 79 ++++----- src/positionRelative.c | 26 +-- src/room.c | 15 +- src/slime.c | 104 ++++++----- src/stamp.c | 56 +++--- src/sub_0801D5EC.c | 5 +- src/sub_0801D754.c | 19 +-- src/sub_0804AA84.c | 32 ++-- src/sub_0804AFF4.c | 44 +++-- src/sub_08050008.c | 17 +- src/sub_08050024.c | 28 ++- src/sub_08052620.c | 3 +- src/sub_08052638.c | 9 +- src/sub_08055E08.c | 12 +- src/sub_0805E374.c | 13 +- src/sub_0805E3A0.c | 8 +- src/sub_0806F9EC.c | 6 +- src/sub_0806FA04.c | 11 +- src/sub_0806FA24.c | 6 +- src/sub_0806FA30.c | 34 ++-- src/sub_08070680.c | 11 +- src/sub_0807B7D8.c | 19 +-- src/sub_0807B820.c | 20 +-- src/sub_0807B8A8.c | 20 +-- src/sub_0807B930.c | 19 +-- src/sub_0807C998.c | 3 +- src/sub_080A554C.c | 2 +- src/sub_080AD644.c | 8 +- src/sub_08127D30.c | 9 +- src/textbox.c | 33 ++-- src/well.c | 19 +-- src/zelda.c | 107 ++++-------- 61 files changed, 876 insertions(+), 1151 deletions(-) (limited to 'src') diff --git a/src/_dmaFill32.c b/src/_dmaFill32.c index 1982d82c..5426ba31 100644 --- a/src/_dmaFill32.c +++ b/src/_dmaFill32.c @@ -1,6 +1,5 @@ #include "global.h" -void _DmaFill32(u32 a1, u32 a2, u32 a3) -{ +void _DmaFill32(u32 a1, u32 a2, u32 a3) { DmaFill32(3, a1, a2, a3); -} \ No newline at end of file +} diff --git a/src/bell.c b/src/bell.c index 589d0117..7dc1c864 100644 --- a/src/bell.c +++ b/src/bell.c @@ -7,22 +7,19 @@ extern void (*gUnk_08123384[])(Entity*); extern void UpdateSpriteOrderAndFlip(Entity*); extern void LoadAnimation(); -void sub_08097D78(Entity *ent) -{ +void sub_08097D78(Entity* ent) { gUnk_08123384[ent->action](ent); } -void sub_08097D90(Entity *ent) -{ - ent->action = 1; - ent->spriteSettings.b.ss0 = 1; - ent->collisionLayer = 1; - ent->ticks.b0 = 0; - UpdateSpriteOrderAndFlip(ent); - LoadAnimation(ent, 0); +void sub_08097D90(Entity* ent) { + ent->action = 1; + ent->spriteSettings.b.ss0 = 1; + ent->collisionLayer = 1; + ent->ticks.b0 = 0; + UpdateSpriteOrderAndFlip(ent); + LoadAnimation(ent, 0); } -void sub_08097DCC(Entity *ent) -{ +void sub_08097DCC(Entity* ent) { sub_080042B8(ent); } diff --git a/src/bigGoron.c b/src/bigGoron.c index f1755b8c..bc4da6bd 100644 --- a/src/bigGoron.c +++ b/src/bigGoron.c @@ -1,33 +1,31 @@ #include "global.h" #include "entity.h" -extern void (*gUnk_081140D4[])(Entity *); +extern void (*gUnk_081140D4[])(Entity*); extern u16 gUnk_081140CC[]; extern Entity gLinkEntity; extern u32 gUnk_030010A0; extern void sub_0805E3A0(Entity*, u32); -extern void sub_0806D0B0(Entity *); -extern void sub_0807DD64(Entity *); -extern void sub_0807DDAC(Entity *, u32); -extern void sub_0807DDE4(Entity *); +extern void sub_0806D0B0(Entity*); +extern void sub_0807DD64(Entity*); +extern void sub_0807DDAC(Entity*, u32); +extern void sub_0807DDE4(Entity*); extern u32 Random(void); extern void PlaySFX(u32); -extern void sub_0806D02C(Entity *); -extern Entity * sub_0805EB2C(u32, u32, u32, u32, u32); +extern void sub_0806D02C(Entity*); +extern Entity* sub_0805EB2C(u32, u32, u32, u32, u32); -void sub_0806CF18(Entity *this) -{ +void sub_0806CF18(Entity* this) { gUnk_081140D4[this->entityType.parameter1](this); } #ifdef NON_MATCHING -void sub_0806CF30(Entity *this) -{ +void sub_0806CF30(Entity* this) { u8 bVar1; u32 uVar2; int iVar3; - + if (this->action == 0) { this->action = 1; this->previousActionFlag = 1; @@ -35,19 +33,18 @@ void sub_0806CF30(Entity *this) sub_0805E3A0(this, 2); sub_0806D0B0(this); sub_0807DD64(this); - } - else { - sub_0807DDAC(this,0); + } else { + sub_0807DDAC(this, 0); sub_0807DDE4(this); } if (this->previousActionFlag != 2) { - + if (this->previousActionFlag < 3) { if ((gUnk_030010A0 & 3) == 0) { iVar3 = this->x.HALF.HI; if (gLinkEntity.x.HALF.HI < iVar3) { if ((this->field_0x68 - 32) < iVar3) { - this->x.HALF.HI =- 1; + this->x.HALF.HI = -1; } } if (this->x.HALF.HI > gLinkEntity.x.HALF.HI) { @@ -57,8 +54,7 @@ void sub_0806CF30(Entity *this) } } } - } - else { + } else { bVar1 = this->parameter3 -= 1; if (bVar1 == 0) { uVar2 = Random(); @@ -70,18 +66,16 @@ void sub_0806CF30(Entity *this) } #else NAKED -void sub_0806CF30(Entity *this) -{ - asm(".include \"asm/non_matching/bigGoron/sub_0806CF30.inc\""); +void sub_0806CF30(Entity* this) { + asm(".include \"asm/non_matching/bigGoron/sub_0806CF30.inc\""); } #endif -void sub_0806D00C(Entity *this) -{ - Entity *pEVar1; - - pEVar1 = sub_0805EB2C(7,76,7,0,0); +void sub_0806D00C(Entity* this) { + Entity* pEVar1; + + pEVar1 = sub_0805EB2C(7, 76, 7, 0, 0); if (pEVar1 != NULL) { this->parent = pEVar1; } -} \ No newline at end of file +} diff --git a/src/bitGetters.c b/src/bitGetters.c index 9eb5063c..4616248c 100644 --- a/src/bitGetters.c +++ b/src/bitGetters.c @@ -2,23 +2,19 @@ extern u8 gArea; -u32 sub_08052654() -{ +u32 sub_08052654() { return (gArea >> 7) & 1; } -u32 CheckIsDungeon() -{ +u32 CheckIsDungeon() { return (gArea >> 2) & 1; } -u32 sub_08052670() -{ +u32 sub_08052670() { return (gArea >> 4) & 1; } -u32 sub_08052680() -{ +u32 sub_08052680() { return (gArea >> 6) & 1; } diff --git a/src/bladeTrap.c b/src/bladeTrap.c index ba37b3ae..5d9ac081 100644 --- a/src/bladeTrap.c +++ b/src/bladeTrap.c @@ -5,29 +5,28 @@ extern void sub_080A2CC0(); extern void sub_0806F69C(); extern void sub_08004488(); -extern Entity * sub_0804B128(); +extern Entity* sub_0804B128(); -void sub_08032358(Entity *ent) -{ - u16 uVar1; - Entity *pEVar2; - u16 *puVar3; - if (ent->action == 0) { - ent->action = 1; - pEVar2 = sub_0804B128((u8)(ent->entityType).parameter1); - ent->attachedEntity = pEVar2; - sub_080A2CC0((EntityData *)ent,&ent->attachedEntity,&ent->heldObjectPtr); - } - if ((ent->direction & 0x80) == 0) { - sub_0806F69C(ent); - } - (u32)puVar3 = &(ent->heldObjectPtr); - uVar1 = *puVar3; - *puVar3 = uVar1 - 1; - if ((u16)(*puVar3) == 0) { +void sub_08032358(Entity* ent) { + u16 uVar1; + Entity* pEVar2; + u16* puVar3; + if (ent->action == 0) { + ent->action = 1; + pEVar2 = sub_0804B128((u8)(ent->entityType).parameter1); + ent->attachedEntity = pEVar2; + sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->heldObjectPtr); + } if ((ent->direction & 0x80) == 0) { - sub_08004488(0x74); + sub_0806F69C(ent); + } + (u32) puVar3 = &(ent->heldObjectPtr); + uVar1 = *puVar3; + *puVar3 = uVar1 - 1; + if ((u16)(*puVar3) == 0) { + if ((ent->direction & 0x80) == 0) { + sub_08004488(0x74); + } + sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, puVar3); } - sub_080A2CC0((EntityData *)ent,&ent->attachedEntity,puVar3); - } } diff --git a/src/cat.c b/src/cat.c index 493e5495..34ed8433 100644 --- a/src/cat.c +++ b/src/cat.c @@ -4,14 +4,13 @@ extern void sub_0806ED78(); extern void sub_08067C44(); -extern void (*gCat[9])(Entity *); +extern void (*gCat[9])(Entity*); -//Main -void sub_080677B4(Entity *ent) -{ +// Main +void sub_080677B4(Entity* ent) { gCat[ent->action](ent); sub_08067C44(ent); if (((ent->flags & 128) == 0) && ((ent->entityType).parameter1 != 5)) { sub_0806ED78(ent); } -} \ No newline at end of file +} diff --git a/src/cloud.c b/src/cloud.c index dccb3e62..2cf8200f 100644 --- a/src/cloud.c +++ b/src/cloud.c @@ -3,10 +3,10 @@ #include "room.h" #include "link.h" -extern void sub_0809F7BC(Entity *); +extern void sub_0809F7BC(Entity*); extern void PlaySFX(u32); extern void sub_0809F814(u32); -extern void sub_0809F7F4(Entity *); +extern void sub_0809F7F4(Entity*); extern void SetGlobalFlag(u32); extern void LoadRoomEntityList(); extern void DeleteThisEntity(); @@ -15,51 +15,46 @@ extern void sub_08078A90(u32); extern void sub_08078B48(void); extern u32 SetLocalFlag(u32); extern u32 Random(void); -extern void sub_0806F69C(Entity *); -extern void (*gUnk_08124798[])(Entity *); -extern void (*gUnk_081247A0[])(Entity *); -extern void (*gUnk_081247AC[])(Entity *); -extern Entity * CreateObject(u32, u32, u32); -extern void sub_0806FA30(Entity *, Entity *); -extern void sub_0807BB68(u32 *, u32, u32); +extern void sub_0806F69C(Entity*); +extern void (*gUnk_08124798[])(Entity*); +extern void (*gUnk_081247A0[])(Entity*); +extern void (*gUnk_081247AC[])(Entity*); +extern Entity* CreateObject(u32, u32, u32); +extern void sub_0806FA30(Entity*, Entity*); +extern void sub_0807BB68(u32*, u32, u32); extern u8 gUnk_02034490; extern u32 gUnk_030010A0; -extern void *gUnk_080DD750; +extern void* gUnk_080DD750; extern Entity gLinkEntity; extern LinkState gLinkState; extern u8 gUnk_081247C0[]; extern u16 gUnk_081247C8[]; extern u32 gUnk_081247D0; -void sub_0809F4C4(Entity *this) -{ +void sub_0809F4C4(Entity* this) { gUnk_08124798[(this->entityType).parameter1](this); } -void sub_0809F4DC(Entity *this) -{ +void sub_0809F4DC(Entity* this) { if ((this->entityType).parameter2 == 0) { gUnk_081247A0[this->action](this); - } - else { + } else { gUnk_081247AC[this->action](this); } } -void sub_0809F514(Entity *this) -{ +void sub_0809F514(Entity* this) { this->action = 1; this->parameter3 = 120; this->spriteSettings.b.ss0 = 0; - *(u8 *)&this->field_0x68 = 12; + *(u8*)&this->field_0x68 = 12; gRoomControls.cameraTarget = this; gUnk_02034490 = 255; sub_0809F7BC(this); } -void sub_0809F548(Entity *this) -{ +void sub_0809F548(Entity* this) { if (--this->parameter3 == 0) { this->action = 2; @@ -67,8 +62,7 @@ void sub_0809F548(Entity *this) PlaySFX(285); sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) | (((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6); - } - else { + } else { if ((gUnk_030010A0 & 7) == 0) { sub_0809F7BC(this); } @@ -76,8 +70,7 @@ void sub_0809F548(Entity *this) } } -void sub_0809F5B0(Entity *this) -{ +void sub_0809F5B0(Entity* this) { if (--this->parameter3 == 0) { PlaySFX(115); SetGlobalFlag(36); @@ -86,17 +79,15 @@ void sub_0809F5B0(Entity *this) } } -void sub_0809F5DC(Entity *this) -{ +void sub_0809F5DC(Entity* this) { this->action = 1; this->spriteSettings.b.ss0 = 0; - *(u8 *)&this->field_0x68 = 12; + *(u8*)&this->field_0x68 = 12; } -void sub_0809F5F0(Entity *this) -{ +void sub_0809F5F0(Entity* this) { u32 iVar1; - + iVar1 = CheckRoomFlag(this->parameter3); if (iVar1 != 0) { this->action = 2; @@ -107,9 +98,8 @@ void sub_0809F5F0(Entity *this) } } -void sub_0809F61C(Entity *this) -{ - +void sub_0809F61C(Entity* this) { + if ((gRoomControls.unk6 & 4) == 0) { if (this->parameter3 == 30) { SetLocalFlag(this->entityType.parameter2); @@ -119,8 +109,8 @@ void sub_0809F61C(Entity *this) this->parameter3 = 120; PlaySFX(285); sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) | - (((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6); } - else { + (((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6); + } else { if ((gUnk_030010A0 & 7) == 0) { sub_0809F7BC(this); } @@ -129,8 +119,7 @@ void sub_0809F61C(Entity *this) } } -void sub_0809F69C(Entity *this) -{ +void sub_0809F69C(Entity* this) { if (--this->parameter3 == 0) { this->parameter3 = 30; @@ -140,21 +129,18 @@ void sub_0809F69C(Entity *this) } } -void sub_0809F6CC(Entity *this) -{ - - if (((gRoomControls.unk6 & 4) == 0) && - (--this->parameter3 == 0)) { +void sub_0809F6CC(Entity* this) { + + if (((gRoomControls.unk6 & 4) == 0) && (--this->parameter3 == 0)) { gLinkState.unk7 = 1; DeleteThisEntity(); } } -void sub_0809F700(Entity *this) -{ +void sub_0809F700(Entity* this) { u8 bVar1; u32 uVar2; - + if (this->action == 0) { this->action = 1; this->parameter3 = (Random() & 30) + 8; @@ -172,12 +158,11 @@ void sub_0809F700(Entity *this) } #ifdef NON_MATCHING -Entity * sub_0809F770(Entity *this) -{ - Entity *cloud; +Entity* sub_0809F770(Entity* this) { + Entity* cloud; s32 uVar1; - - cloud = CreateObject(163,1,0); + + cloud = CreateObject(163, 1, 0); if (cloud != NULL) { sub_0806FA30(this, cloud); uVar1 = Random(); @@ -190,18 +175,16 @@ Entity * sub_0809F770(Entity *this) } #else NAKED -Entity * sub_0809F770(Entity *this) -{ - asm(".include \"asm/non_matching/cloud/sub_0809F770.inc\""); +Entity* sub_0809F770(Entity* this) { + asm(".include \"asm/non_matching/cloud/sub_0809F770.inc\""); } #endif -void sub_0809F7BC(Entity *this) -{ - Entity *cloud; +void sub_0809F7BC(Entity* this) { + Entity* cloud; u32 uVar1; u32 uVar2; - + for (uVar2 = 0; uVar2 < 8; uVar2++) { cloud = sub_0809F770(this); if (cloud != NULL) { @@ -212,12 +195,11 @@ void sub_0809F7BC(Entity *this) } } -void sub_0809F7F4(Entity *this) -{ +void sub_0809F7F4(Entity* this) { u8 cVar1; - u8 *puVar2; - - puVar2 = (u8 *)&this->field_0x68; + u8* puVar2; + + puVar2 = (u8*)&this->field_0x68; *puVar2 -= 1; if (*puVar2 == 0) { @@ -226,7 +208,6 @@ void sub_0809F7F4(Entity *this) } } -void sub_0809F814(u32 r0) -{ +void sub_0809F814(u32 r0) { sub_0807BB68(&gUnk_081247D0, r0, 1); -} \ No newline at end of file +} diff --git a/src/copyPosition.c b/src/copyPosition.c index cb70c380..3819d01b 100644 --- a/src/copyPosition.c +++ b/src/copyPosition.c @@ -3,9 +3,9 @@ extern void PositionRelative(); -void CopyPosition(Entity *param_1,Entity *param_2) +void CopyPosition(Entity* param_1, Entity* param_2) { - PositionRelative(param_1,param_2,0,0); + PositionRelative(param_1, param_2, 0, 0); return; -} \ No newline at end of file +} diff --git a/src/cow.c b/src/cow.c index 48d517ca..9dee1303 100644 --- a/src/cow.c +++ b/src/cow.c @@ -35,9 +35,9 @@ void sub_08068FC0(Entity* ent) { ent->action = 1; ent->animationState = ent->entityType.parameter2; ent->nonPlanarMovement = 0x40; - + ent->field_0x6d = 0xFF; - + r2 = sub_0805ACC0(ent); if (r2 == 0) { u16 x, y; @@ -49,7 +49,7 @@ void sub_08068FC0(Entity* ent) { ent->field_0x6a = y; } else { u32 var1 = r2 >> 16; - //0x68+0x69 probably a SplitWord + // 0x68+0x69 probably a SplitWord *(u16*)&ent->field_0x68 = var1; ent->field_0x6a = r2; } @@ -71,17 +71,17 @@ void sub_08069018(Entity* ent) { var0 = --ent->field_0xf; if (var0 == 0) { if (ent->parameter3 == 0) { - ent->action = 2; + ent->action = 2; } else { - ent->action = 3; + ent->action = 3; } ent->previousActionFlag = var0; } - + sub_0806924C(ent); } -void sub_08069068(Entity *ent) { +void sub_08069068(Entity* ent) { s32 var0; if (ent->previousActionFlag == 0) { @@ -103,7 +103,7 @@ void sub_08069068(Entity *ent) { { s32 x = ent->x.HALF.HI; - s16 *x2 = (s16 *)&ent->field_0x68; + s16* x2 = (s16*)&ent->field_0x68; x -= *x2; if (x > 16) { ent->x.HALF.HI = *x2 + 16; @@ -116,7 +116,7 @@ void sub_08069068(Entity *ent) { } { s32 y = ent->y.HALF.HI; - s16 *y2 = &ent->field_0x6a; + s16* y2 = &ent->field_0x6a; y -= *y2; if (y > 16) { ent->y.HALF.HI = *y2 + 16; @@ -159,10 +159,12 @@ void sub_08069168(Entity* ent) { } void sub_08069188(Entity* ent) { - if (ent->frames.b.f0 == 0) return; + if (ent->frames.b.f0 == 0) + return; ent->frames.all = 0; - if (((s8) --ent->field_0xf) != 0) return; + if (((s8)--ent->field_0xf) != 0) + return; ent->previousActionFlag = 3; LoadAnimation(ent, ent->animationState + 16); } @@ -182,7 +184,7 @@ void sub_080691E0(Entity* ent) { } } -//Show dialogue +// Show dialogue void sub_080691F8(Entity* ent) { u32 var0 = ent->entityType.parameter1; u32* var1 = gUnk_08111938 + (var0 * 2); @@ -190,7 +192,7 @@ void sub_080691F8(Entity* ent) { } void sub_0806920C(Entity* ent) { - //TODO: figure out what bitfield flag this is + // TODO: figure out what bitfield flag this is u32 var0 = gLinkState.flags.all & 0x80; u32 var1 = -var0 >> 0x1F; @@ -205,11 +207,11 @@ void sub_0806920C(Entity* ent) { ent->field_0x6d = var1; } -//Check if player interacting +// Check if player interacting void sub_0806924C(Entity* ent) { s8 itype = ent->interactType; if (itype != 0) { - //TODO: figure out what bitfield flag this is + // TODO: figure out what bitfield flag this is if ((gLinkState.flags.all & 0x80) != 0) { if (itype == 2) { ent->action = 4; diff --git a/src/createEnemy.c b/src/createEnemy.c index e570c13c..74df8f75 100644 --- a/src/createEnemy.c +++ b/src/createEnemy.c @@ -1,19 +1,18 @@ #include "entity.h" #include "global.h" -extern Entity * GetEmptyEntity(); -extern void sub_0805EA2C(Entity *, u8); +extern Entity* GetEmptyEntity(); +extern void sub_0805EA2C(Entity*, u8); + +Entity* CreateEnemy(u32 subtype, u32 param1) { + Entity* enemy; -Entity * CreateEnemy(u32 subtype, u32 param1) -{ - Entity *enemy; - enemy = GetEmptyEntity(); if (enemy != NULL) { (enemy->entityType).type = 3; (enemy->entityType).subtype = subtype; (enemy->entityType).parameter1 = param1; - sub_0805EA2C(enemy,4); + sub_0805EA2C(enemy, 4); } return enemy; -} \ No newline at end of file +} diff --git a/src/createEntity.c b/src/createEntity.c index 92fef210..b7eeb595 100644 --- a/src/createEntity.c +++ b/src/createEntity.c @@ -2,7 +2,7 @@ // #include "entityData.h" // #include "global.h" -// extern Entity * sub_0805EB9C(u32, u32); +// extern Entity * sub_0805EB9C(u32, u32); // extern Entity * sub_0805E768(); // extern void sub_0804AEB0(Entity *, EntityData *); // extern u32 sub_0804AF0C(Entity *, EntityData *); @@ -11,41 +11,41 @@ // Entity * CreateEntity(EntityData *param_1) // { - // Entity *preexisting; - // Entity *entity; - // s32 type; - - // type = param_1->entityType & 15; - // if (((param_1->field_0x1 & 240) == 80) && - // (preexisting = sub_0805EB9C(type,param_1->entitySubtype), preexisting != NULL)) { - // entity = NULL; - // } - // else { - // entity = sub_0805E768(); //Get empty entity - // if (entity != NULL) { - // (entity->entityType).type = type; - // (entity->entityType).subtype = param_1->entitySubtype; - // (entity->entityType).parameter1 = param_1->entityParameter1; - // sub_0804AEB0(entity,param_1); - // if ((param_1->field_0x1 & 240) != 16) { - // (entity->entityType).parameter2 = *(u8 *)¶m_1->entityParameter2; - // /* i suspect this is where the entity's behavior is defined. Not sure. */ - // entity->parameter3 = (u8)((u32)param_1->entityParameter2 >> 8); - // if ((type != 9) && (sub_0804AF0C(entity,param_1), entity->field_0x4 != NULL)) { - // if ((param_1->entityType & 16) == 0) { - // if ((param_1->entityType & 32) != 0) { - // entity->collisionLayer = 2; - // return entity; - // } - // if ((gRoomControls & 2) == 0) { - // sub_08016A30(entity); - // return entity; - // } - // } - // entity->collisionLayer = 1; - // } - // } - // } - // } - // return entity; +// Entity *preexisting; +// Entity *entity; +// s32 type; + +// type = param_1->entityType & 15; +// if (((param_1->field_0x1 & 240) == 80) && +// (preexisting = sub_0805EB9C(type,param_1->entitySubtype), preexisting != NULL)) { +// entity = NULL; +// } +// else { +// entity = sub_0805E768(); //Get empty entity +// if (entity != NULL) { +// (entity->entityType).type = type; +// (entity->entityType).subtype = param_1->entitySubtype; +// (entity->entityType).parameter1 = param_1->entityParameter1; +// sub_0804AEB0(entity,param_1); +// if ((param_1->field_0x1 & 240) != 16) { +// (entity->entityType).parameter2 = *(u8 *)¶m_1->entityParameter2; +// /* i suspect this is where the entity's behavior is defined. Not sure. */ +// entity->parameter3 = (u8)((u32)param_1->entityParameter2 >> 8); +// if ((type != 9) && (sub_0804AF0C(entity,param_1), entity->field_0x4 != NULL)) { +// if ((param_1->entityType & 16) == 0) { +// if ((param_1->entityType & 32) != 0) { +// entity->collisionLayer = 2; +// return entity; +// } +// if ((gRoomControls & 2) == 0) { +// sub_08016A30(entity); +// return entity; +// } +// } +// entity->collisionLayer = 1; +// } +// } +// } +// } +// return entity; // } diff --git a/src/createNPC.c b/src/createNPC.c index fc6b575e..d68253f0 100644 --- a/src/createNPC.c +++ b/src/createNPC.c @@ -1,22 +1,21 @@ #include "global.h" #include "entity.h" +extern Entity* GetEmptyEntity(); +extern void sub_0805EA2C(Entity*, u8); -extern Entity * GetEmptyEntity(); -extern void sub_0805EA2C(Entity *, u8); - -Entity * CreateNPC(u32 subtype,u32 parameter1,u32 parameter2) +Entity* CreateNPC(u32 subtype, u32 parameter1, u32 parameter2) { - Entity *pEVar1; - + Entity* pEVar1; + pEVar1 = GetEmptyEntity(); if (pEVar1 != NULL) { (pEVar1->entityType).type = 7; (pEVar1->entityType).subtype = subtype; (pEVar1->entityType).parameter1 = parameter1; (pEVar1->entityType).parameter2 = parameter2; - sub_0805EA2C(pEVar1,7); + sub_0805EA2C(pEVar1, 7); } return pEVar1; -} \ No newline at end of file +} diff --git a/src/createObject.c b/src/createObject.c index c6863ac9..702107f4 100644 --- a/src/createObject.c +++ b/src/createObject.c @@ -1,21 +1,21 @@ #include "global.h" #include "entity.h" -extern Entity * GetEmptyEntity(); -extern void sub_0805EA2C(Entity *,u8); +extern Entity* GetEmptyEntity(); +extern void sub_0805EA2C(Entity*, u8); -Entity * CreateObject(u32 subtype,u32 param1,u32 param2) +Entity* CreateObject(u32 subtype, u32 param1, u32 param2) { - Entity *newEnt; - + Entity* newEnt; + newEnt = GetEmptyEntity(); if (newEnt != NULL) { (newEnt->entityType).type = 6; (newEnt->entityType).subtype = subtype; (newEnt->entityType).parameter1 = param1; (newEnt->entityType).parameter2 = param2; - sub_0805EA2C(newEnt,6); + sub_0805EA2C(newEnt, 6); } return newEnt; -} \ No newline at end of file +} diff --git a/src/createObjectWithParent.c b/src/createObjectWithParent.c index f7eb9814..bee2c86c 100644 --- a/src/createObjectWithParent.c +++ b/src/createObjectWithParent.c @@ -1,18 +1,17 @@ #include "global.h" #include "entity.h" -extern Entity * CreateObject(); +extern Entity* CreateObject(); extern void CopyPosition(); -Entity * CreateObjectWithParent(Entity *parentEnt,u32 subtype,u32 param1, u32 param2) -{ - Entity *ent; - +Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 param1, u32 param2) { + Entity* ent; + ent = CreateObject(subtype, param1, param2); if (ent != NULL) { ent->parent = parentEnt; - CopyPosition(parentEnt,ent); + CopyPosition(parentEnt, ent); } - - return ent; -} \ No newline at end of file + + return ent; +} diff --git a/src/emma.c b/src/emma.c index 4e45083c..a65a67e4 100644 --- a/src/emma.c +++ b/src/emma.c @@ -5,21 +5,20 @@ extern u32 gUnk_0813AD10; extern u32 gUnk_0813AD24; extern u32 gUnk_0813AD38; -extern void sub_0805E3A0(Entity *, u32); -extern void sub_0807DD50(Entity *); -extern void sub_0807DD94(Entity *, u32); -extern void sub_08080840(u32 *); +extern void sub_0805E3A0(Entity*, u32); +extern void sub_0807DD50(Entity*); +extern void sub_0807DD94(Entity*, u32); +extern void sub_08080840(u32*); -void sub_0806C550(Entity *param_1) +void sub_0806C550(Entity* param_1) { if (param_1->action == 0) { param_1->action += 1; - sub_0805E3A0(param_1,2); + sub_0805E3A0(param_1, 2); sub_0807DD50(param_1); - } - else { - sub_0807DD94(param_1,0); + } else { + sub_0807DD94(param_1, 0); } return; } @@ -43,4 +42,4 @@ void FUN_0806c598(void) { sub_08080840(&gUnk_0813AD38); return; -} \ No newline at end of file +} diff --git a/src/epona.c b/src/epona.c index 044dd37d..be050c87 100644 --- a/src/epona.c +++ b/src/epona.c @@ -23,122 +23,96 @@ extern TextBox gTextBox; extern LinkState gLinkState; extern Entity gLinkEntity; -void sub_08065A64(Entity* ent); +void sub_08065A64(Entity* this); extern void (*gUnk_0811006C[])(Entity*); extern u64 gUnk_08110080[]; -void sub_08065990(Entity* ent) -{ - gUnk_0811006C[ent->action](ent); - sub_08065A64(ent); - sub_0806ED78(ent); +void sub_08065990(Entity* this) { + gUnk_0811006C[this->action](this); + sub_08065A64(this); + sub_0806ED78(this); } -void sub_080659B8(Entity* ent) -{ - ent->action = 1; - ent->spriteSettings.b.ss0 = 1; - ent->animationState = 6; - ent->field_0x69 = -1; - ent->field_0x68 = sub_0801E99C(ent); - LoadAnimation(ent, ent->animationState / 2); +void sub_080659B8(Entity* this) { + this->action = 1; + this->spriteSettings.b.ss0 = 1; + this->animationState = 6; + this->field_0x69 = -1; + this->field_0x68 = sub_0801E99C(this); + LoadAnimation(this, this->animationState / 2); } -void sub_080659F0(Entity* ent) -{ - sub_080042B8(ent); - sub_08065AA4(ent); +void sub_080659F0(Entity* this) { + sub_080042B8(this); + sub_08065AA4(this); } -void sub_08065A00(Entity* ent) -{ - sub_080042B8(ent); - sub_08065AA4(ent); +void sub_08065A00(Entity* this) { + sub_080042B8(this); + sub_08065AA4(this); } -void sub_08065A10(Entity* ent) -{ - if ((gTextBox.doTextBox & 0x7F) == 0) - { - ent->action = 1; - LoadAnimation(ent, ent->animationState / 2); +void sub_08065A10(Entity* this) { + if ((gTextBox.doTextBox & 0x7F) == 0) { + this->action = 1; + LoadAnimation(this, this->animationState / 2); } } -void sub_08065A34(Entity* ent) -{ - if (UpdateFuseInteraction() != 0) - { - ent->action = 1; - LoadAnimation(ent, ent->animationState / 2); +void sub_08065A34(Entity* this) { + if (UpdateFuseInteraction() != 0) { + this->action = 1; + LoadAnimation(this, this->animationState / 2); } } -void sub_08065A50(Entity* ent) -{ - ShowNPCDialogue(ent, &gUnk_08110080[ent->entityType.parameter1]); +void sub_08065A50(Entity* this) { + ShowNPCDialogue(this, &gUnk_08110080[this->entityType.parameter1]); } -void sub_08065A64(Entity* ent) -{ +void sub_08065A64(Entity* this) { u32 uVar2; - + uVar2 = -(gLinkState.flags.all & 0x80) >> 0x1f; - if (uVar2 != ent->field_0x69) - { - if (uVar2 == 0) - { - sub_08078778(ent); - } - else - { - sub_080787A8(ent, ent->field_0x68); + if (uVar2 != this->field_0x69) { + if (uVar2 == 0) { + sub_08078778(this); + } else { + sub_080787A8(this, this->field_0x68); } } - ent->field_0x69 = uVar2; + this->field_0x69 = uVar2; } -void sub_08065AA4(Entity* ent) -{ - if (ent->interactType != 0) - { - if (gLinkState.flags.all & 0x80) - { - if (ent->interactType == 2) - { - ent->action = 4; - sub_0806F118(ent); - } - else - { - ent->action = 3; - sub_0805E3A0(ent, 2); - sub_08065A50(ent); +void sub_08065AA4(Entity* this) { + if (this->interactType != 0) { + if (gLinkState.flags.all & 0x80) { + if (this->interactType == 2) { + this->action = 4; + sub_0806F118(this); + } else { + this->action = 3; + sub_0805E3A0(this, 2); + sub_08065A50(this); } - sub_080045C4(ent, &gLinkEntity); - LoadAnimation(ent, sub_0806F5A4()); - } - else - { - sub_08065A50(ent); + sub_080045C4(this, &gLinkEntity); + LoadAnimation(this, sub_0806F5A4()); + } else { + sub_08065A50(this); sub_080791D0(); } PlaySFX(0xD3); - ent->interactType = 0; + this->interactType = 0; } } -void sub_08065B1C(Entity* ent) -{ - if (ent->action == 0) - { - ent->action += 1; - ent->spriteSettings.b.ss0 = 1; - LoadAnimation(ent, 7); - } - else - { - sub_080042B8(ent); +void sub_08065B1C(Entity* this) { + if (this->action == 0) { + this->action += 1; + this->spriteSettings.b.ss0 = 1; + LoadAnimation(this, 7); + } else { + sub_080042B8(this); } } diff --git a/src/getProgressFlag.c b/src/getProgressFlag.c index fe9197fd..c2907340 100644 --- a/src/getProgressFlag.c +++ b/src/getProgressFlag.c @@ -2,6 +2,6 @@ u32 extern CheckLocalFlagByOffset(u32, u32); -u32 CheckGlobalFlag (u32 index) { - return CheckLocalFlagByOffset(0, index); -} \ No newline at end of file +u32 CheckGlobalFlag(u32 index) { + return CheckLocalFlagByOffset(0, index); +} diff --git a/src/giantLeaf.c b/src/giantLeaf.c index 6c6b4d47..d3d6ef02 100644 --- a/src/giantLeaf.c +++ b/src/giantLeaf.c @@ -9,10 +9,8 @@ extern RoomControls gRoomControls; extern s16 gUnk_08121750[]; extern s16 gUnk_0812176A[]; -void sub_0808D5DC(Entity* ent) -{ - if (ent->action == 0) - { +void sub_0808D5DC(Entity* ent) { + if (ent->action == 0) { ent->action = 1; ent->spriteSettings.b.ss0 = 1; ent->spriteOrder.b3 = 3; @@ -22,17 +20,16 @@ void sub_0808D5DC(Entity* ent) } } -void sub_0808D618(Entity *ent) -{ +void sub_0808D618(Entity* ent) { u32 tilePos; - s16 *arr; + s16* arr; u32 i; arr = (ent->entityType.parameter1 != 0) ? gUnk_0812176A : gUnk_08121750; - tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64); + tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | + ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64); - for (i = 0; i < 13; i++) - { + for (i = 0; i < 13; i++) { SetTile(16500, tilePos + arr[i], 1); } } diff --git a/src/greatFairy.c b/src/greatFairy.c index 64a90fb3..3cb6b186 100644 --- a/src/greatFairy.c +++ b/src/greatFairy.c @@ -4,11 +4,10 @@ #include "screen.h" #include "greatFairy.h" -//Main -void sub_08086A90(Entity *ent) -{ +// Main +void sub_08086A90(Entity* ent) { u8 bVar1; - + if (ent->action == 0) { bVar1 = __modsi3((ent->entityType).parameter1, 11); (ent->entityType).parameter2 = bVar1; @@ -16,38 +15,33 @@ void sub_08086A90(Entity *ent) gGreatFairy[(ent->entityType).parameter2](ent); } -//Behaviors -void sub_08086ABC(Entity *ent) -{ +// Behaviors +void sub_08086ABC(Entity* ent) { gGreatFairyBehaviors[ent->action](ent); - if ((gLinkEntity.y.HALF.HI - gRoomControls.roomOriginY) < 168) { - + gRoomControls.cameraTarget = ent; gRoomControls.unk5 = 2; - } - else { + } else { gRoomControls.cameraTarget = &gLinkEntity; gRoomControls.unk5 = 2; } } -//Init -void sub_08086AF8(Entity *ent) -{ +// Init +void sub_08086AF8(Entity* ent) { sub_08087380(); ent->parameter3 = 0; ent->cutsceneBeh.HWORD = 290; } -//Dormant update -void sub_08086B10(Entity *ent) -{ - u16 *pFrame; // r1@2 - s32 frame; // r1@4 - Entity *ripple; // r5@16 - u32 event; +// Dormant update +void sub_08086B10(Entity* ent) { + u16* pFrame; // r1@2 + s32 frame; // r1@4 + Entity* ripple; // r5@16 + u32 event; event = CheckRoomFlag(0); if (event == 0) { @@ -59,68 +53,52 @@ void sub_08086B10(Entity *ent) } frame = *pFrame; - if ( frame == 0x96 ) - { + if (frame == 0x96) { goto LABEL_16; } - - if ( frame < 0x97 ) - { - if (frame != 0) - { - if ( frame == 0x82 ) - { + + if (frame < 0x97) { + if (frame != 0) { + if (frame == 0x82) { goto LABEL_16; - } - else { + } else { return; } } goto LABEL_17; - } - else { - if (frame == 0xd2) - { + } else { + if (frame == 0xd2) { goto LABEL_16; } - if (frame < 0xd3) - { - if (frame == 0xaa) - { + if (frame < 0xd3) { + if (frame == 0xaa) { goto LABEL_16; - } - else return; + } else + return; } - if ( frame == 289 ) - { + if (frame == 289) { goto LABEL_16; - } - else { + } else { return; } } LABEL_17: - ent->action = 2; - return; + ent->action = 2; + return; LABEL_16: ripple = sub_080873AC(ent, 6, 0); - if ( ripple ) - { - PositionRelative( - ent, - ripple, - (s32)gGreatFairyRippleOffsets[ent->parameter3] << 16, - (s32)gGreatFairyRippleOffsets[ent->parameter3 + 1] << 16); + if (ripple) { + PositionRelative(ent, ripple, (s32)gGreatFairyRippleOffsets[ent->parameter3] << 16, + (s32)gGreatFairyRippleOffsets[ent->parameter3 + 1] << 16); ent->parameter3 += 2; } } -//Create Great Fairy -void sub_08086BA0(Entity *ent) -{ - Entity *gf; - +// Create Great Fairy +void sub_08086BA0(Entity* ent) { + Entity* gf; + gf = sub_080873AC(ent, 7, 0); if (gf != NULL) { PositionRelative(ent, gf, 0, 0x80000); @@ -128,17 +106,14 @@ void sub_08086BA0(Entity *ent) } } -//Great Fairy spawn-in update -void sub_08086BC4(Entity *ent) -{ - Entity *mini; +// Great Fairy spawn-in update +void sub_08086BC4(Entity* ent) { + Entity* mini; u32 var; - if (gRoomVars.greatFairyState & 1) - { + if (gRoomVars.greatFairyState & 1) { mini = sub_080873AC(ent, 2, 0); - if (mini != NULL) - { + if (mini != NULL) { CopyPosition(ent, mini); DoFade(6, 4); PlaySFX(325); @@ -150,20 +125,16 @@ void sub_08086BC4(Entity *ent) } } -//Mini Great Fairy update -void sub_08086C18(Entity *ent) -{ - Entity *target; - +// Mini Great Fairy update +void sub_08086C18(Entity* ent) { + Entity* target; + sub_08004274(ent); - if (ent->parameter3 != 0) - { + if (ent->parameter3 != 0) { ent->parameter3 = ent->parameter3 - 1; - } - else { + } else { target = sub_080873AC(ent, 1, 0); - if (target != NULL) - { + if (target != NULL) { PositionRelative(ent, target, 0, -0x140000); ent->action = 5; ent->parameter3 = 120; @@ -172,19 +143,14 @@ void sub_08086C18(Entity *ent) } } -//Final Great Fairy update -void sub_08086C58(Entity *ent) -{ - Entity *target; - - if (ent->parameter3 != 0) - { +// Final Great Fairy update +void sub_08086C58(Entity* ent) { + Entity* target; + + if (ent->parameter3 != 0) { ent->parameter3 = ent->parameter3 - 1; - } - else - { - if ((ent->field_0xf == 0) && (target = sub_080873AC(ent, 9, 0), target != NULL)) - { + } else { + if ((ent->field_0xf == 0) && (target = sub_080873AC(ent, 9, 0), target != NULL)) { PositionRelative(ent, target, 0, -0x4C0000); target->parent = ent; ent->field_0xf = 1; @@ -193,14 +159,12 @@ void sub_08086C58(Entity *ent) sub_08004274(ent); } -//Wings -void sub_08086C9C(Entity *ent) -{ +// Wings +void sub_08086C9C(Entity* ent) { gGreatFairyWings[ent->action](ent); } -void sub_08086CB4(Entity *ent) -{ +void sub_08086CB4(Entity* ent) { sub_08087380(); ent->ticks.b0 = 5; ent->spriteSettings.b.ss0 = 1; @@ -211,11 +175,10 @@ void sub_08086CB4(Entity *ent) sub_0805EC9C(ent, 1024, 256, 0); } -//Wings init -void sub_08086D18(Entity *ent) -{ +// Wings init +void sub_08086D18(Entity* ent) { s32 iVar1; - + iVar1 = (u16)ent->nonPlanarMovement - 32; ent->nonPlanarMovement = (short)iVar1; if (iVar1 * 65536 >> 16 == 256) { @@ -223,47 +186,40 @@ void sub_08086D18(Entity *ent) sub_0805EC60(ent); gRoomVars.greatFairyState = gRoomVars.greatFairyState | 32; gUnk_02033280 = gUnk_02033280 | 4; - } - else { + } else { sub_0805EC9C(ent, ent->nonPlanarMovement, 256, 0); } } -void nullsub_116(void) -{ +void nullsub_116(void) { } -//Wake -void sub_08086D6C(Entity *ent) -{ +// Wake +void sub_08086D6C(Entity* ent) { gGreatFairyWake[ent->action](ent); } -//Wake init -void sub_08086D84(Entity *ent) -{ +// Wake init +void sub_08086D84(Entity* ent) { sub_08087380(); ent->spriteSettings.b.ss0 = 1; ent->ticks.b0 = 6; } -//Wake update -void sub_08086DAC(Entity *ent) -{ +// Wake update +void sub_08086DAC(Entity* ent) { sub_08004274(ent); } -//Mini great fairy -void sub_08086DB4(Entity *ent) -{ +// Mini great fairy +void sub_08086DB4(Entity* ent) { gGreatFairyMini[ent->action](ent); } -//Mini great fairy init -void sub_08086DCC(Entity *ent) -{ - Entity *wake; - +// Mini great fairy init +void sub_08086DCC(Entity* ent) { + Entity* wake; + wake = sub_080873AC(ent, 4, 0); if (wake != NULL) { CopyPosition(ent, wake); @@ -274,28 +230,25 @@ void sub_08086DCC(Entity *ent) } } -//Mini great fairy pre-drip -void sub_08086E04(Entity *ent) -{ - Entity *target; - +// Mini great fairy pre-drip +void sub_08086E04(Entity* ent) { + Entity* target; + sub_08004274(ent); - ent->height.WORD = ent->height.WORD + -32768; + ent->height.WORD = ent->height.WORD + -0x8000; if (ent->height.HALF.HI == -20) { ent->action = 2; PlaySFX(321); - } - else { + } else { if (((ent->height.HALF.HI == -10) && (ent->field_0xf == 0)) && - (target = sub_080873AC(ent, 5, 0), target != NULL)) { + (target = sub_080873AC(ent, 5, 0), target != NULL)) { PositionRelative(ent, target, 0, 0x40000); ent->field_0xf = 1; } } } -void sub_08086E64(Entity *ent) -{ +void sub_08086E64(Entity* ent) { sub_08004274(ent); sub_080873D0(ent); if ((gRoomVars.greatFairyState & 1) != 0) { @@ -303,26 +256,23 @@ void sub_08086E64(Entity *ent) } } -//Mini great fairy behaviors -void sub_08086E8C(Entity *ent) -{ +// Mini great fairy behaviors +void sub_08086E8C(Entity* ent) { gGreatFairyMiniAnim[ent->action](ent); } -void sub_08086EA4(Entity *ent) -{ +void sub_08086EA4(Entity* ent) { sub_08087380(); ent->ticks.b0 = 6; ent->spriteSettings.b.ss0 = 1; } -//Mini great fairy translate -void sub_08086ED0(Entity *ent) -{ - Entity *parent = ent->parent; +// Mini great fairy translate +void sub_08086ED0(Entity* ent) { + Entity* parent = ent->parent; CopyPosition(parent, ent); - + if (ent->height.HALF.HI == -20) { ent->action = 2; ent->parameter3 = 90; @@ -332,35 +282,28 @@ void sub_08086ED0(Entity *ent) } } -//Mini great fairy stretch -void sub_08086F10(Entity *ent) -{ - u32 bVar1; +// Mini great fairy stretch +void sub_08086F10(Entity* ent) { s32 iVar2; - - bVar1 = ent->parameter3 -= 1; - if (bVar1 == 0) { + if (--ent->parameter3 == 0) { gRoomVars.greatFairyState = gRoomVars.greatFairyState | 1; ent->action = 3; sub_0805EC60(ent); - } - else { + } else { iVar2 = (u16)ent->nonPlanarMovement - 24; ent->nonPlanarMovement = iVar2; sub_0805EC9C(ent, 256, iVar2 * 65536 >> 20, 0); } } -//Drip -void sub_08086F54(Entity *ent) -{ +// Drip +void sub_08086F54(Entity* ent) { gGreatFairyDrip[ent->action](ent); } -//Drip init -void sub_08086F6C(Entity *ent) -{ +// Drip init +void sub_08086F6C(Entity* ent) { sub_08087380(); ent->spriteSettings.b.ss0 = 1; ent->height.HALF.HI = 0; @@ -368,49 +311,42 @@ void sub_08086F6C(Entity *ent) PlaySFX(320); } -//Drip update -void sub_08086FA0(Entity *ent) -{ +// Drip update +void sub_08086FA0(Entity* ent) { sub_08004274(ent); if ((ent->frames.all & 128) != 0) { DeleteEntity(ent); } } -//Ripple -void sub_08086FC0(Entity *ent) -{ +// Ripple +void sub_08086FC0(Entity* ent) { gGreatFairyRipple[ent->action](ent); } -//Ripple init -void sub_08086FD8(Entity *ent) -{ +// Ripple init +void sub_08086FD8(Entity* ent) { sub_08087380(); ent->spriteSettings.b.ss0 = 1; ent->ticks.b0 = 6; } -//Ripple update -void sub_08087000(Entity *ent) -{ +// Ripple update +void sub_08087000(Entity* ent) { if ((gRoomVars.greatFairyState & 2) != 0) { DeleteEntity(ent); - } - else { + } else { sub_08004274(ent); } } -//Big ripple -void sub_08087024(Entity *ent) -{ +// Big ripple +void sub_08087024(Entity* ent) { gGreatFairyBigRipple[ent->action](ent); } -//Big ripple init -void sub_0808703C(Entity *ent) -{ +// Big ripple init +void sub_0808703C(Entity* ent) { sub_08087380(); ent->parameter3 = 120; ent->spriteSettings.b.ss0 = 1; @@ -418,63 +354,54 @@ void sub_0808703C(Entity *ent) PlaySFX(249); } -//Big ripple update -void sub_0808706C(Entity *ent) -{ - Entity *target; - +// Big ripple update +void sub_0808706C(Entity* ent) { + Entity* target; + sub_08004274(ent); if (ent->parameter3 != 0) { - ent->parameter3 = ent->parameter3 - 1; - } - else { - target = sub_080873AC(ent,3,0); + ent->parameter3--; + } else { + target = sub_080873AC(ent, 3, 0); if (target != NULL) { - PositionRelative(ent,target,0,-524288); + PositionRelative(ent, target, 0, -0x80000); gRoomVars.greatFairyState = gRoomVars.greatFairyState | 2; DeleteEntity(ent); } } } -//Energy -void GreatFairyEnergy(Entity *ent) -{ +// Energy +void GreatFairyEnergy(Entity* ent) { gGreatFairyEnergy[ent->action](ent); } -//Energy init -void sub_080870CC(Entity *ent) -{ +// Energy init +void sub_080870CC(Entity* ent) { sub_08087380(); ent->spriteSettings.b.ss0 = 1; ent->ticks.b0 = 5; } -//Energy update -void sub_080870F4(Entity *ent) -{ +// Energy update +void sub_080870F4(Entity* ent) { sub_08004274(ent); if ((ent->frames.all & 128) != 0) { DeleteEntity(ent); } } - -void sub_08087114(Entity *ent) -{ +void sub_08087114(Entity* ent) { if ((ent->entityType).parameter2 == 0) { gGreatFairyInteract1[ent->action](ent); - } - else { + } else { gGreatFairyInteract2[ent->action](ent); sub_08004274(ent); } } #ifdef NON_MATCHING -void sub_08087150(Entity *ent) -{ +void sub_08087150(Entity* ent) { u8 var; u32 var2; @@ -490,22 +417,19 @@ void sub_08087150(Entity *ent) } #else NAKED -void sub_08087150(Entity *ent) -{ - asm(".include \"asm/greatFairy/sub_08087150.inc\""); +void sub_08087150(Entity* ent) { + asm(".include \"asm/greatFairy/sub_08087150.inc\""); } #endif -void nullsub_516() -{ +void nullsub_516() { } -void sub_080871A8(Entity *ent) -{ +void sub_080871A8(Entity* ent) { u32 bVar1; - + bVar1 = ent->parameter3 -= 1; - + if (bVar1 == 0) { ent->action = 3; ent->parameter3 = 60; @@ -513,10 +437,9 @@ void sub_080871A8(Entity *ent) } } -void sub_080871D0(Entity *ent) -{ +void sub_080871D0(Entity* ent) { u8 bVar1; - + bVar1 = ent->parameter3 -= 1; if (bVar1 == 0) { gRoomVars.greatFairyState = gRoomVars.greatFairyState | 8; @@ -525,15 +448,13 @@ void sub_080871D0(Entity *ent) } #ifdef NON_MATCHING -void sub_080871F8(Entity *ent) -{ +void sub_080871F8(Entity* ent) { s32 bVar1; - - if ((( ent->attachedEntity->x.HALF.HI == (ent->x).HALF.HI) && - ((Entity *)ent->attachedEntity)->y.HALF.HI + -32 == (ent->y).HALF.HI)) { + + if (((ent->attachedEntity->x.HALF.HI == (ent->x).HALF.HI) && + ((Entity*)ent->attachedEntity)->y.HALF.HI + -32 == (ent->y).HALF.HI)) { ent->action = 2; - } - else { + } else { bVar1 = (ent->x).HALF.HI; sub_080045D4(); ent->direction = bVar1; @@ -542,14 +463,12 @@ void sub_080871F8(Entity *ent) } #else NAKED -void sub_080871F8(Entity *ent) -{ - asm(".include \"asm/greatFairy/sub_080871F8.inc\""); +void sub_080871F8(Entity* ent) { + asm(".include \"asm/greatFairy/sub_080871F8.inc\""); } #endif -void sub_08087240(Entity *ent) -{ +void sub_08087240(Entity* ent) { if ((gRoomVars.greatFairyState & 4) != 0) { ent->action = 3; ent->parameter3 = 20; @@ -557,32 +476,26 @@ void sub_08087240(Entity *ent) } } -void sub_08087264(Entity *ent) -{ +void sub_08087264(Entity* ent) { if (ent->parameter3 != 0) { - ent->parameter3 = ent->parameter3 - 1; + ent->parameter3--; sub_0806F69C(ent); } } -void sub_0808727C(Entity *ent) -{ - u8 bVar1; - - bVar1 = ent->parameter3 -= 1; - if (bVar1 == 0) { +void sub_0808727C(Entity* ent) { + + if (--ent->parameter3 == 0) { DeleteEntity(ent); } } -void sub_08087294(Entity *ent) -{ +void sub_08087294(Entity* ent) { gUnk_081207A4[ent->action](ent); } #ifdef NON_MATCHING -void sub_080872AC(Entity *ent) -{ +void sub_080872AC(Entity* ent) { ent->spriteSettings.b.ss0 = 1; ent->spriteOrientation.b2 = 1; ent->spriteOrder.b0 = 0; @@ -594,9 +507,7 @@ void sub_080872AC(Entity *ent) } #else NAKED -void sub_080872AC(Entity *ent) -{ - asm(".include \"asm/greatFairy/sub_080872AC.inc\""); +void sub_080872AC(Entity* ent) { + asm(".include \"asm/greatFairy/sub_080872AC.inc\""); } #endif - diff --git a/src/introSetTransition.c b/src/introSetTransition.c index ee56a4e1..81ce484c 100644 --- a/src/introSetTransition.c +++ b/src/introSetTransition.c @@ -13,17 +13,16 @@ typedef struct { } TransitionStruct; extern u32 DoFade(u32, u32); -extern void sub_0801D630(u32 *, u32, u32); +extern void sub_0801D630(u32*, u32, u32); extern u32 gUnk_02000080; extern TransitionStruct gUnk_03001000; extern Menu gUnk_02032EC0; - -u32 IntroSetTransition(u8 transition,u32 param_2,u32 param_3) +u32 IntroSetTransition(u8 transition, u32 param_2, u32 param_3) { gUnk_02032EC0.transitionType = transition; gUnk_03001000.functionIndex = 2; - sub_0801D630(&gUnk_02000080,48,param_3); - return DoFade(7,8); + sub_0801D630(&gUnk_02000080, 48, param_3); + return DoFade(7, 8); } diff --git a/src/loadRoom.c b/src/loadRoom.c index c2eedb70..7c7fcd19 100644 --- a/src/loadRoom.c +++ b/src/loadRoom.c @@ -1,32 +1,32 @@ #include "global.h" /* called when loading any room */ - void LoadRoomEntityList(); - s32 CheckGlobalFlag(u32 flag); - extern s32* sub_0804B128(u8 unk); - extern void sub_0804B058(s32 *unk); - extern void sub_0804B1AC(); - extern void sub_0801AC98(); +void LoadRoomEntityList(); +s32 CheckGlobalFlag(u32 flag); +extern s32* sub_0804B128(u8 unk); +extern void sub_0804B058(s32* unk); +extern void sub_0804B1AC(); +extern void sub_0801AC98(); void LoadRoom(void) { s32 iVar1; - s32 *dat; + s32* dat; + + sub_0804B128(1); + LoadRoomEntityList(); + sub_0804B128(0); + LoadRoomEntityList(); - sub_0804B128(1); - LoadRoomEntityList(); - sub_0804B128(0); - LoadRoomEntityList(); - iVar1 = CheckGlobalFlag(21); if (iVar1 != 0) { - dat = sub_0804B128(2); - sub_0804B058(dat); + dat = sub_0804B128(2); + sub_0804B058(dat); } - sub_0804B128(3); - sub_0804B1AC(); - sub_0801AC98(); + sub_0804B128(3); + sub_0804B1AC(); + sub_0801AC98(); return; -} \ No newline at end of file +} diff --git a/src/loadRoomEntityList.c b/src/loadRoomEntityList.c index d877a1aa..0937e9c8 100644 --- a/src/loadRoomEntityList.c +++ b/src/loadRoomEntityList.c @@ -1,12 +1,12 @@ #include "global.h" #include "entityData.h" -void extern CreateEntity(EntityData *); +void extern CreateEntity(EntityData*); -void LoadRoomEntityList(EntityData *listPtr) { - if (listPtr != NULL) { - while (listPtr->entityType != 0xFF) { - CreateEntity(listPtr++); - } - } -} \ No newline at end of file +void LoadRoomEntityList(EntityData* listPtr) { + if (listPtr != NULL) { + while (listPtr->entityType != 0xFF) { + CreateEntity(listPtr++); + } + } +} diff --git a/src/mailbox.c b/src/mailbox.c index 0e17c18a..c617a04e 100644 --- a/src/mailbox.c +++ b/src/mailbox.c @@ -1,25 +1,24 @@ #include "global.h" #include "entity.h" -extern void sub_0806ED78(Entity *); +extern void sub_0806ED78(Entity*); extern void LoadAnimation(); extern void sub_08063280(); extern void TextboxTryNoOverlap(u32); extern void sub_080042B8(); extern void CreateFx(); -extern void (*gMailboxBehaviors[4])(Entity *); +extern void (*gMailboxBehaviors[4])(Entity*); -void sub_080631E8(Entity *ent) -{ +void sub_080631E8(Entity* ent) { gMailboxBehaviors[ent->action](ent); - + if (ent->action != 0) { sub_0806ED78(ent); } } -void sub_08063210(Entity *ent) +void sub_08063210(Entity* ent) { ent->action = 1; @@ -27,29 +26,26 @@ void sub_08063210(Entity *ent) return; } -void sub_08063220(Entity *ent) +void sub_08063220(Entity* ent) { u8 bVar1; - + if (ent->interactType != 0) { ent->action = 2; bVar1 = 8; - } - else { + } else { bVar1 = 0; } - + if (ent->field_0x58 != bVar1) { LoadAnimation(ent); - } - else { + } else { sub_08063280(ent, bVar1); } - } -void sub_08063254(Entity *ent) +void sub_08063254(Entity* ent) { sub_08063280(ent); @@ -60,23 +56,23 @@ void sub_08063254(Entity *ent) return; } -void sub_08063278(Entity *ent) +void sub_08063278(Entity* ent) { sub_08063280(ent); return; } -void sub_08063280(Entity *ent) +void sub_08063280(Entity* ent) { - Entity *e; // r4@1 - u8 var; // r2@1 - - e = ent; - sub_080042B8(); - var = e->frames.all & 0x7F; - e->frames.all = e->frames.all ^ var; - if ( var == 2 ) - CreateFx(e, 49, 0); -} \ No newline at end of file + Entity* e; // r4@1 + u8 var; // r2@1 + + e = ent; + sub_080042B8(); + var = e->frames.all & 0x7F; + e->frames.all = e->frames.all ^ var; + if (var == 2) + CreateFx(e, 49, 0); +} diff --git a/src/mainLoop.c b/src/mainLoop.c index 9230a2af..a9bf0d32 100644 --- a/src/mainLoop.c +++ b/src/mainLoop.c @@ -30,7 +30,7 @@ extern void sub_0804FFE4(void); extern void sub_0804FF84(u32); extern void sub_08056418(void); extern void sub_080ADD30(void); -extern void sub_0801D630(void *,u32); +extern void sub_0801D630(void*, u32); extern void sub_08056010(u32); extern void ReadKeyInput(); extern u32 sub_08055FF4(); @@ -45,15 +45,14 @@ extern u8 gUnk_02000014; extern u32 gUnk_020176A0; extern u32 gRand; extern MainStruct gUnk_03001000; -extern void (* gUnk_08100CBC[])(); +extern void (*gUnk_08100CBC[])(); extern void VBlankInterruptWait(void); -void MainLoop(void) -{ +void MainLoop(void) { bool32 codeInputted; u8 cVar1; u32 uVar2; - + sub_08055F70(); sub_080A3204(); sub_0805616C(); @@ -62,12 +61,12 @@ void MainLoop(void) sub_08056208(); gUnk_02000014 = 193; sub_0804FFE4(); - DmaSet(3, 0x5000000U, &gUnk_020176A0, 0x84000080U); + DmaSet(3, 0x5000000U, &gUnk_020176A0, 0x84000080U); sub_0804FF84(1); sub_08056418(); sub_080ADD30(); gRand = 0x1234567; - sub_0801D630(&gUnk_03001000,16); + sub_0801D630(&gUnk_03001000, 16); sub_08056010(0); do { ReadKeyInput(); @@ -97,16 +96,15 @@ void MainLoop(void) sub_08056458(); sub_08050154(); sub_080A3480(); - } - else { + } else { sub_08056260(); } sub_08016E78(); - } while( TRUE ); + } while (TRUE); } #else NAKED void MainLoop(void) { - asm(".include \"asm/non_matching/mainLoop.inc\""); + asm(".include \"asm/non_matching/mainLoop.inc\""); } -#endif \ No newline at end of file +#endif diff --git a/src/milkCart.c b/src/milkCart.c index f313422b..85da0d96 100644 --- a/src/milkCart.c +++ b/src/milkCart.c @@ -1,22 +1,19 @@ #include "global.h" #include "entity.h" -extern void _call_via_r1(Entity *, u32); +extern void _call_via_r1(Entity*, u32); extern void sub_0806ED78(); extern void LoadAnimation(); extern void sub_080042B8(); extern void (*gMilkCartBehaviors[2])(Entity*); -void sub_08065B4C(Entity *ent) -{ +void sub_08065B4C(Entity* ent) { gMilkCartBehaviors[ent->action](ent); sub_0806ED78(ent); } - -void sub_08065B6C(Entity *ent) -{ +void sub_08065B6C(Entity* ent) { ent->action++; ent->spriteSettings.b.ss0 = 1; (ent->y).HALF.LO += -32768; @@ -24,8 +21,6 @@ void sub_08065B6C(Entity *ent) LoadAnimation(ent, 3); } - -void sub_08065B9C(Entity *ent) -{ +void sub_08065B9C(Entity* ent) { sub_080042B8(ent); -} \ No newline at end of file +} diff --git a/src/modHealth.c b/src/modHealth.c index be51881c..8706debe 100644 --- a/src/modHealth.c +++ b/src/modHealth.c @@ -6,7 +6,7 @@ s32 ModHealth(s32 deltaHealth) { s32 newHealth; - + newHealth = gStats.health + deltaHealth; if (newHealth < 0) { newHealth = 0; @@ -17,4 +17,4 @@ s32 ModHealth(s32 deltaHealth) gStats.health = newHealth; gLinkEntity.currentHealth = newHealth; return newHealth; -} \ No newline at end of file +} diff --git a/src/modRupees.c b/src/modRupees.c index 47f59412..bbe8b88e 100644 --- a/src/modRupees.c +++ b/src/modRupees.c @@ -7,16 +7,15 @@ void ModRupees(s32 rupeeDelta) { s32 newRupeeCount; - Stats *s = &gStats; + Stats* s = &gStats; newRupeeCount = s->rupees + rupeeDelta; if (newRupeeCount < 0) { newRupeeCount = 0; - } - else { + } else { if (newRupeeCount > gWalletSizes[s->walletType * 2]) { newRupeeCount = gWalletSizes[s->walletType * 2]; } } s->rupees = newRupeeCount; -} \ No newline at end of file +} diff --git a/src/object1A.c b/src/object1A.c index 005683c5..4083c55d 100644 --- a/src/object1A.c +++ b/src/object1A.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" -extern Entity * CreateObject(); +extern Entity* CreateObject(); extern void CopyPosition(); extern void sub_08086A6C(); extern s32 sub_080044EC(); @@ -9,20 +9,18 @@ extern void sub_080AEF88(); extern void DeleteThisEntity(); extern u32 Random(void); -extern void (*gUnk_081206C4[99])(Entity *); +extern void (*gUnk_081206C4[99])(Entity*); extern u32 gUnk_080FD1A8; -//Main -void sub_080869C4(Entity *ent) -{ +// Main +void sub_080869C4(Entity* ent) { gUnk_081206C4[ent->action](ent); } -void sub_080869DC(Entity *ent) -{ - Entity *itemEntity; - +void sub_080869DC(Entity* ent) { + Entity* itemEntity; + ent->action = 1; ent->spriteSettings.b.ss0 = 0; ent->boundingBox = &gUnk_080FD1A8; @@ -37,35 +35,31 @@ void sub_080869DC(Entity *ent) } } -void sub_08086A28(Entity *ent) -{ +void sub_08086A28(Entity* ent) { s32 iVar1; - + if (ent->attachedEntity->field_0x4 == NULL) { ent->action = 2; - } - else { + } else { iVar1 = sub_080044EC(ent, 10240); if (iVar1 == 0) { ent->action = 2; } sub_080AEF88(ent); - CopyPosition(ent,ent->attachedEntity); + CopyPosition(ent, ent->attachedEntity); } } -void sub_08086A5C(Entity *ent) -{ +void sub_08086A5C(Entity* ent) { ent->attachedEntity->parent = NULL; DeleteThisEntity(); } -void sub_08086A6C(Entity *ent) -{ +void sub_08086A6C(Entity* ent) { u32 uVar1; - + uVar1 = Random(); ent->field_0x20 = 163840; ent->direction = (uVar1 >> 16) & 31; ent->nonPlanarMovement = uVar1 & 480; -} \ No newline at end of file +} diff --git a/src/ocarina.c b/src/ocarina.c index 3c916ced..0a5dc2e6 100644 --- a/src/ocarina.c +++ b/src/ocarina.c @@ -4,38 +4,36 @@ #include "link.h" extern void _call_via_r2(); -extern void sub_08077E78(ItemBehavior *, u32); +extern void sub_08077E78(ItemBehavior*, u32); extern void PlaySFX(u32); extern void sub_08078F60(void); -extern void sub_08077D38(ItemBehavior *, u32); +extern void sub_08077D38(ItemBehavior*, u32); extern void sub_0805E544(void); -extern void UpdateItemAnim(ItemBehavior *); +extern void UpdateItemAnim(ItemBehavior*); extern void CreateBird(void); extern void UnfreezeTime(void); extern Entity gLinkEntity; extern LinkState gLinkState; -extern void (*gOcarinaStates[4])(ItemBehavior *, u32); +extern void (*gOcarinaStates[4])(ItemBehavior*, u32); extern u8 gUnk_02034490; -void Ocarina(ItemBehavior *pItemBeh,u32 inputFlags) +void Ocarina(ItemBehavior* pItemBeh, u32 inputFlags) { - //u32 *ocarinaStates = &gOcarinaStates; + // u32 *ocarinaStates = &gOcarinaStates; //_call_via_r2(pItemBeh, inputFlags,(ocarinaStates)[pItemBeh->stateID]); gOcarinaStates[pItemBeh->stateID](pItemBeh, inputFlags); gLinkEntity.itemCooldown = gLinkEntity.itemCooldown + 1; } -void OcarinaUse(ItemBehavior *itemBeh,s32 inputFlags) -{ +void OcarinaUse(ItemBehavior* itemBeh, s32 inputFlags) { u32 bVar1; u32 var; if (gLinkState.linkAction == 24) { - sub_08077E78(itemBeh,inputFlags); - } - else { + sub_08077E78(itemBeh, inputFlags); + } else { itemBeh->unk4 |= 15; gLinkEntity.animationState = 4; var = gLinkEntity.spriteSettings.raw & ~0x40; @@ -50,8 +48,8 @@ void OcarinaUse(ItemBehavior *itemBeh,s32 inputFlags) gLinkState.unk3 = bVar1 | gLinkState.unk3; gLinkState.keepFacing = bVar1 | gLinkState.keepFacing; sub_08078F60(); - sub_08077D38(itemBeh,inputFlags); + sub_08077D38(itemBeh, inputFlags); PlaySFX(534); sub_0805E544(); } -} \ No newline at end of file +} diff --git a/src/octorok.c b/src/octorok.c index 4d6a0a78..21ad23e4 100644 --- a/src/octorok.c +++ b/src/octorok.c @@ -18,117 +18,100 @@ extern u32 Random(); extern void sub_0801ED14(); extern void sub_08004274(); -extern void (*gOctorok[2]); -extern void (*gOctorokIdle[4])(Entity *); -extern void (*gUnk_080CA158[4])(Entity *); +extern void(*gOctorok[2]); +extern void (*gOctorokIdle[4])(Entity*); +extern void (*gUnk_080CA158[4])(Entity*); extern u8 gUnk_080CA170[8]; -//Main -void sub_0801EAB0(Entity *ent) -{ +// Main +void sub_0801EAB0(Entity* ent) { EnemyFunctionHandler(ent, gOctorok); SetChildOffset(ent, 0, 1, -16); } -//Idle -void sub_0801EAD0(Entity *ent) -{ +// Idle +void sub_0801EAD0(Entity* ent) { gOctorokIdle[ent->action](ent); } -//Touch player -void sub_0801EAE8(Entity *ent) -{ +// Touch player +void sub_0801EAE8(Entity* ent) { if (ent->field_0x43 != 0) { sub_0804A9FC(ent, 28); } sub_0804AA30(ent, gOctorok); } -//Death -void sub_0801EB0C(Entity *ent) -{ +// Death +void sub_0801EB0C(Entity* ent) { if ((ent->entityType).parameter1 == 0) { sub_0804A7D4(ent); - } - else { + } else { CreateDeathFx(ent, 241, 0); } } -void sub_0801EB2C(Entity *ent) -{ +void sub_0801EB2C(Entity* ent) { s32 iVar1; - + if ((ent->previousActionFlag < 3) && (iVar1 = sub_0806F520(ent), iVar1 == 0)) { sub_0801ECFC(ent); InitializeAnimation(ent, ent->animationState); - } - else { + } else { gUnk_080CA158[ent->previousActionFlag](ent); } } -void sub_0801EB68(Entity *ent) -{ +void sub_0801EB68(Entity* ent) { ent->previousActionFlag = 1; ent->filler[1] = 60; } -void sub_0801EB74(Entity *ent) -{ - sub_0806F4E8(ent); +void sub_0801EB74(Entity* ent) { + sub_0806F4E8(ent); } -void sub_0801EB7C(Entity *ent) -{ +void sub_0801EB7C(Entity* ent) { sub_0806F3E4(ent); } -void sub_0801EB84(Entity *ent) -{ +void sub_0801EB84(Entity* ent) { ent->flags = ent->flags & 127; InitializeAnimationAnimation(ent, 2); } -void nullsub_3() -{ +void nullsub_3() { } -void sub_0801EB9C(Entity *ent) -{ +void sub_0801EB9C(Entity* ent) { if ((ent->flags & 128) != 0) { ent->flags = ent->flags | 128; ent->field_0x3a = ent->field_0x3a & 251; - } - else { + } else { ent->currentHealth = 0; } } -//Init +// Init #ifdef NON_MATCHING -void sub_0801EBC8(Entity *ent) -{ +void sub_0801EBC8(Entity* ent) { sub_0804A720(); ent->animationState = (ent->entityType).parameter1 == 2 ? (ent->entityType).parameter1 : Random() & 3; ent->filler[0] = 18; sub_0801ECFC(ent); - InitializeAnimation(ent,ent->animationState); + InitializeAnimation(ent, ent->animationState); } #else NAKED -void sub_0801EBC8(Entity *ent) -{ - asm(".include \"asm/octorok/sub_0801EBC8.inc\""); +void sub_0801EBC8(Entity* ent) { + asm(".include \"asm/octorok/sub_0801EBC8.inc\""); } #endif -void sub_0801EBF4(Entity *ent) -{ +void sub_0801EBF4(Entity* ent) { u8 bVar1; u32 uVar2; - + bVar1 = ent->parameter3 -= 1; if (bVar1 == 0) { ent->action = 2; @@ -137,4 +120,4 @@ void sub_0801EBF4(Entity *ent) sub_0801ED14(ent); } sub_08004274(ent); -} \ No newline at end of file +} diff --git a/src/positionRelative.c b/src/positionRelative.c index 14aab5b3..2c18c7b0 100644 --- a/src/positionRelative.c +++ b/src/positionRelative.c @@ -1,19 +1,19 @@ #include "global.h" #include "entity.h" -extern void UpdateSpriteOrderAndFlip(Entity *); +extern void UpdateSpriteOrderAndFlip(Entity*); -void PositionRelative(Entity *source, Entity *target, s32 offsetX, s32 offsetY) { //r0, r1, r2, r3 - s32 x; - s32 y; - - x = source->x.WORD; +void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) { // r0, r1, r2, r3 + s32 x; + s32 y; + + x = source->x.WORD; target->x.WORD = x + offsetX; - - y = source->y.WORD; + + y = source->y.WORD; target->y.WORD = y + offsetY; - - target->height = source->height; //ldr - target->collisionLayer = source->collisionLayer; - UpdateSpriteOrderAndFlip(target); -} \ No newline at end of file + + target->height = source->height; // ldr + target->collisionLayer = source->collisionLayer; + UpdateSpriteOrderAndFlip(target); +} diff --git a/src/room.c b/src/room.c index c1f98162..8149cc1f 100644 --- a/src/room.c +++ b/src/room.c @@ -8,10 +8,10 @@ extern u32 gUnk_0200B650; extern u32 gUnk_02025EB0; extern u8 gUnk_030010A0[10]; -extern void sub_08080840(Entity *); +extern void sub_08080840(Entity*); extern void sub_080809D4(); -void sub_0808091C(Entity *param_1,u32 param_2) +void sub_0808091C(Entity* param_1, u32 param_2) { sub_08080840(param_1); @@ -30,22 +30,21 @@ void sub_08080930(void) return; } -u32 * GetLayerByIndex(u32 param_1) +u32* GetLayerByIndex(u32 param_1) { - + if (param_1 == 2) { return &gUnk_0200B650; - } - else { + } else { return &gUnk_02025EB0; } } -void sub_08080964(u16 time,u32 magnitude) +void sub_08080964(u16 time, u32 magnitude) { gRoomControls.screenShakeTime = time; gRoomControls.screenShakeMagnitude = magnitude & 7; return; -} \ No newline at end of file +} diff --git a/src/slime.c b/src/slime.c index 679be3f4..4c226ec0 100644 --- a/src/slime.c +++ b/src/slime.c @@ -2,64 +2,59 @@ #include "entity.h" typedef struct { - void * field_0x0; - void * entityCount; + void* field_0x0; + void* entityCount; u8 freezeTime; } EntityHandler; -extern void EnemyFunctionHandler(Entity *, void *); -extern void SetChildOffset(Entity *, u32, u32, u32); -extern void sub_0804AA30(Entity *, void *); -extern void sub_0804A9FC(Entity *, u32); -extern void sub_0804A720(Entity *); -extern void InitializeAnimation(Entity *, u32); -extern void sub_08044FF8(Entity *); +extern void EnemyFunctionHandler(Entity*, void*); +extern void SetChildOffset(Entity*, u32, u32, u32); +extern void sub_0804AA30(Entity*, void*); +extern void sub_0804A9FC(Entity*, u32); +extern void sub_0804A720(Entity*); +extern void InitializeAnimation(Entity*, u32); +extern void sub_08044FF8(Entity*); extern u32 Random(void); -extern void sub_08004274(Entity *); +extern void sub_08004274(Entity*); extern u32 sub_0806FA04(u32, u32); -extern u32 sub_08049FA0(Entity *); -extern u32 sub_08049EE4(Entity *); +extern u32 sub_08049FA0(Entity*); +extern u32 sub_08049EE4(Entity*); extern u32 sub_080AEF88(void); -extern Entity * CreateEnemy(u32, u32); +extern Entity* CreateEnemy(u32, u32); - -extern void (*gUnk_080D16BC[])(Entity *); -extern void (*gUnk_080D16A4[])(Entity *); +extern void (*gUnk_080D16BC[])(Entity*); +extern void (*gUnk_080D16A4[])(Entity*); extern u8 gUnk_080D16D0; extern EntityHandler gUnk_03003DB8; - -void sub_08044F50(Entity *this) +void sub_08044F50(Entity* this) { EnemyFunctionHandler(this, &gUnk_080D16A4); - SetChildOffset(this,0,1,-12); + SetChildOffset(this, 0, 1, -12); } -void sub_08044F70(Entity *this) -{ +void sub_08044F70(Entity* this) { gUnk_080D16BC[this->action](this); } -void sub_08044F88(Entity *this) -{ +void sub_08044F88(Entity* this) { if ((this->currentHealth != 0) && (this->cutsceneBeh.HALF.LO != this->currentHealth)) { this->action = 4; - } - else { - sub_0804AA30(this,&gUnk_080D16A4); + } else { + sub_0804AA30(this, &gUnk_080D16A4); } if (this->field_0x43 != 0) { - sub_0804A9FC(this,28); + sub_0804A9FC(this, 28); } } -void nullsub_171(){} +void nullsub_171() { +} -void sub_08044FC8(Entity *this) -{ +void sub_08044FC8(Entity* this) { this->action = 1; this->spriteSettings.b.ss0 = 1; this->nonPlanarMovement = 128; @@ -68,23 +63,21 @@ void sub_08044FC8(Entity *this) sub_08044FF8(this); } -void sub_08044FF8(Entity *this) -{ +void sub_08044FF8(Entity* this) { u32 bVar1; - + this->action = 2; bVar1 = Random(); this->parameter3 = (bVar1 & 31) + 30; this->cutsceneBeh.HALF.LO = this->currentHealth; } -void sub_08045018(Entity *this) -{ +void sub_08045018(Entity* this) { u32 cVar1; u32 param3; u32 iVar3; u32 randValue; - + sub_08004274(this); param3 = this->parameter3 -= 1; if (param3 == 0) { @@ -96,17 +89,16 @@ void sub_08045018(Entity *this) iVar3 = sub_08049FA0(this); if ((iVar3 == 0) && (randValue = Random(), (randValue & 3) != 0)) { cVar1 = sub_08049EE4(this); - this->direction = (cVar1 + 0xfc + (Random() & 8)) & 24; + this->direction = (cVar1 + 0xfc + (Random() & 8)) & 24; return; } this->direction = Random() & 24; } } -void sub_08045088(Entity *this) -{ +void sub_08045088(Entity* this) { u8 bVar1; - + sub_080AEF88(); sub_08004274(this); bVar1 = this->parameter3 -= 1; @@ -116,22 +108,22 @@ void sub_08045088(Entity *this) } #ifdef NON_MATCHING -void sub_080450A8(Entity *this) +void sub_080450A8(Entity* this) { u8 bVar1; u32 uVar2; s32 iVar3; s32 iVar4; - Entity *pEVar5; - Entity **ppEVar6; + Entity* pEVar5; + Entity** ppEVar6; s32 dividend; u32 uVar7; - Entity *local_r6_72; + Entity* local_r6_72; u32 divisor; - u8 *pcVar8; - Entity *local_2c [4]; - + u8* pcVar8; + Entity* local_2c[4]; + ppEVar6 = local_2c; bVar1 = (&gUnk_080D16D0)[(this->entityType).parameter1]; divisor = (u32)bVar1; @@ -139,7 +131,7 @@ void sub_080450A8(Entity *this) uVar7 = divisor; if (bVar1 != 0) { do { - uVar2 = CreateEnemy(87,this->entityType.parameter1); + uVar2 = CreateEnemy(87, this->entityType.parameter1); *ppEVar6 = uVar2; ppEVar6 = ppEVar6 + 1; uVar7 = uVar7 - 1; @@ -151,28 +143,28 @@ void sub_080450A8(Entity *this) do { local_r6_72 = local_2c[iVar4]; dividend = iVar4 + 1; - iVar3 = Div(dividend,divisor); + iVar3 = Div(dividend, divisor); local_r6_72->attachedEntity = local_2c[iVar3]; - iVar4 = Div(iVar4 + divisor + -1,divisor); + iVar4 = Div(iVar4 + divisor + -1, divisor); local_r6_72->parent = local_2c[iVar4]; (local_r6_72->entityType).parameter2 = 1; local_r6_72->height.WORD = 0; local_r6_72->hurtBlinkTime = 240; - sub_08045178(this,local_r6_72,*pcVar8,pcVar8[1]); + sub_08045178(this, local_r6_72, *pcVar8, pcVar8[1]); pcVar8 = pcVar8 + 2; iVar4 = dividend; } while (dividend < divisor); } - pEVar5 = CreateFx(this,2,0); + pEVar5 = CreateFx(this, 2, 0); if (pEVar5 != NULL) { - CopyPosition(this,pEVar5); + CopyPosition(this, pEVar5); } DeleteEnemy(this); } } #else NAKED -void sub_080450A8(Entity *this) { - asm(".include \"asm/non_matching/slime/sub_080450A8.inc\""); +void sub_080450A8(Entity* this) { + asm(".include \"asm/non_matching/slime/sub_080450A8.inc\""); } -#endif \ No newline at end of file +#endif diff --git a/src/stamp.c b/src/stamp.c index 6f8ae194..8ac339da 100644 --- a/src/stamp.c +++ b/src/stamp.c @@ -2,11 +2,11 @@ #include "entity.h" #include "textbox.h" -extern void InitializeAnimation(Entity *, u32); -extern void sub_08078778(Entity *); -extern void sub_0805E47C(Entity *); -extern void sub_08004274(Entity *); -extern void sub_0806ED78(Entity *); +extern void InitializeAnimation(Entity*, u32); +extern void sub_08078778(Entity*); +extern void sub_0805E47C(Entity*); +extern void sub_08004274(Entity*); +extern void sub_0806ED78(Entity*); extern void TextboxTryNoOverlap(u32); extern void sub_0805E584(); extern void sub_0807DD64(); @@ -17,18 +17,17 @@ extern void sub_0807DDE4(); extern u32 sub_0801E7F4(); extern void ShowNPCDialogue(); - extern void (*gStampBehaviors1[4])(Entity*); extern void (*gStampBehaviors2[2])(Entity*); extern TextBox gTextBox; extern u32 gUnk_0810C2E4; -extern void InitializeAnimation(Entity *, u32); -extern void sub_08078778(Entity *); -extern void sub_0805E47C(Entity *); -extern void sub_08004274(Entity *); -extern void sub_0806ED78(Entity *); +extern void InitializeAnimation(Entity*, u32); +extern void sub_08078778(Entity*); +extern void sub_0805E47C(Entity*); +extern void sub_08004274(Entity*); +extern void sub_0806ED78(Entity*); extern void TextboxTryNoOverlap(u32); extern void sub_0805E584(); extern void sub_0807DD64(); @@ -39,33 +38,28 @@ extern void sub_0807DDE4(); extern u32 sub_0801E7F4(); extern void ShowNPCDialogue(); - extern void (*gStampBehaviors1[4])(Entity*); extern void (*gStampBehaviors2[2])(Entity*); extern TextBox gTextBox; extern u32 gUnk_0810C2E4; -void sub_08062B98(Entity *ent) -{ +void sub_08062B98(Entity* ent) { if ((ent->flags & 2) != 0) { gStampBehaviors2[ent->action](ent); - } - else { + } else { gStampBehaviors1[ent->action](ent); } } -void sub_08062BD4(Entity *ent) -{ +void sub_08062BD4(Entity* ent) { ent->action = 1; ent->spriteSettings.b.ss0 = 1; InitializeAnimation(ent, 0); sub_08078778(ent); } -void sub_08062BF8(Entity *ent) -{ +void sub_08062BF8(Entity* ent) { sub_08004274(ent); if (ent->interactType != 0) { ent->interactType = 0; @@ -75,8 +69,7 @@ void sub_08062BF8(Entity *ent) sub_0806ED78(ent); } -void sub_08062C24(Entity *ent) -{ +void sub_08062C24(Entity* ent) { sub_08004274(ent); if ((ent->frames.all & 128) != 0) { InitializeAnimation(ent, 4); @@ -85,8 +78,7 @@ void sub_08062C24(Entity *ent) } } -void sub_08062C54(Entity *ent) -{ +void sub_08062C54(Entity* ent) { if ((gTextBox.doTextBox & 127) == 0) { ent->action = 1; InitializeAnimation(ent, 0); @@ -94,8 +86,7 @@ void sub_08062C54(Entity *ent) } } -void sub_08062C7C(Entity *ent) -{ +void sub_08062C7C(Entity* ent) { ent->action = 1; sub_0807DD64(ent); InitializeAnimation(ent, 0); @@ -103,24 +94,21 @@ void sub_08062C7C(Entity *ent) sub_08062CA4(ent); } -void sub_08062CA4(Entity *ent) -{ +void sub_08062CA4(Entity* ent) { sub_0807DDAC(ent, 0); sub_0807DDE4(ent); sub_08004274(ent); } -void sub_08062CBC(Entity *ent) -{ +void sub_08062CBC(Entity* ent) { u32 uVar1; - + uVar1 = sub_0801E7F4(44); ShowNPCDialogue(ent, &gUnk_0810C2E4 + ((-uVar1 | uVar1) >> 31) * 2); } -void sub_08062CE0(Entity *ent) -{ +void sub_08062CE0(Entity* ent) { if (ent->action == 0) { ent->action = 1; } -} \ No newline at end of file +} diff --git a/src/sub_0801D5EC.c b/src/sub_0801D5EC.c index f5757230..a660e4f0 100644 --- a/src/sub_0801D5EC.c +++ b/src/sub_0801D5EC.c @@ -1,5 +1,4 @@ #include "global.h" -void sub_0801D5EC(u32 a1, u32 a2, u32 a3) -{ +void sub_0801D5EC(u32 a1, u32 a2, u32 a3) { DmaFill16(3, a1, a2, a3); -} \ No newline at end of file +} diff --git a/src/sub_0801D754.c b/src/sub_0801D754.c index 9ef36979..f2bab6f9 100644 --- a/src/sub_0801D754.c +++ b/src/sub_0801D754.c @@ -3,14 +3,13 @@ extern void sub_0807C960(); extern u32 sub_0801D754(u32, u8, u8); -u32 sub_0807C9D8(u32 *a1) -{ - u32 *v1; // r5@1 +u32 sub_0807C9D8(u32* a1) { + u32* v1; // r5@1 - v1 = a1; - sub_0807C960(0x6004000, *a1); - sub_0807C960(0x6000000, v1[1]); - sub_0807C960(0x6008000, v1[2]); - sub_0807C960(0x20176E0, v1[3]); - return sub_0801D754(0x20176E0, 2, 13); -} \ No newline at end of file + v1 = a1; + sub_0807C960(0x6004000, *a1); + sub_0807C960(0x6000000, v1[1]); + sub_0807C960(0x6008000, v1[2]); + sub_0807C960(0x20176E0, v1[3]); + return sub_0801D754(0x20176E0, 2, 13); +} diff --git a/src/sub_0804AA84.c b/src/sub_0804AA84.c index 8f45ee69..b706d4f1 100644 --- a/src/sub_0804AA84.c +++ b/src/sub_0804AA84.c @@ -10,30 +10,28 @@ extern u8 gUnk_03001000; u32 sub_0804AA84(void) { - u8 * r3 = &gArea; - u8 * r2; - u8 r0 = *(u8 *)(r3 + 0x19); - u8 r1; - + u8 * r3 = &gArea; + u8 * r2; + u8 r0 = *(u8 *)(r3 + 0x19); + u8 r1; + if (!r0) { - *(r3 + 0x18) = r0; - *(r3 + 0x19) = r0; - r0 = 0; - } + *(r3 + 0x18) = r0; + *(r3 + 0x19) = r0; + r0 = 0; + } else { - r2 = &gUnk_03001000; - r1 = 0; - r0 = 4; + r2 = &gUnk_03001000; + r1 = 0; + r0 = 4; *(r2 + 0x4) = r0; *(r3 + 0xe) = r1; *(r3 + 0xf) = r1; *(u16*)(r3 + 0x10) = r1; sub_0805E5A8(); - r0 = 1; + r0 = 1; } - return r0; + return r0; } */ -//void sub_0804AA9C() { - - +// void sub_0804AA9C() { diff --git a/src/sub_0804AFF4.c b/src/sub_0804AFF4.c index bcf104a4..a1a4731d 100644 --- a/src/sub_0804AFF4.c +++ b/src/sub_0804AFF4.c @@ -1,15 +1,13 @@ #include "global.h" - extern void sub_080186EC(); -extern u32 * sub_0804B128(u8); -extern u32 _call_via_r0(u32 *); +extern u32* sub_0804B128(u8); +extern u32 _call_via_r0(u32*); extern void sub_0804B16C(); -void sub_0804AFF4(void) -{ - u32 *func; - +void sub_0804AFF4(void) { + u32* func; + sub_080186EC(); func = sub_0804B128(5); if (func != NULL) { @@ -24,22 +22,22 @@ void sub_0804AFF4(void) } /* - thumb_func_start sub_0804AFF4 + thumb_func_start sub_0804AFF4 sub_0804AFF4: @ 0x0804AFF4 - push {lr} - bl sub_080186EC - movs r0, #5 - bl sub_0804B128 - cmp r0, #0 - beq _0804B008 - bl _call_via_r0 + push {lr} + bl sub_080186EC + movs r0, #5 + bl sub_0804B128 + cmp r0, #0 + beq _0804B008 + bl _call_via_r0 _0804B008: - movs r0, #7 - bl sub_0804B128 - cmp r0, #0 - beq _0804B016 - bl _call_via_r0 + movs r0, #7 + bl sub_0804B128 + cmp r0, #0 + beq _0804B016 + bl _call_via_r0 _0804B016: - bl sub_0804B16C - pop {pc} - */ \ No newline at end of file + bl sub_0804B16C + pop {pc} + */ diff --git a/src/sub_08050008.c b/src/sub_08050008.c index ad18e610..7ed85c26 100644 --- a/src/sub_08050008.c +++ b/src/sub_08050008.c @@ -4,14 +4,13 @@ extern u32 gUnk_020354C0; extern s32 gUnk_03000FD0; extern void sub_0801D630(u32, u32, u32); -void sub_08050008(u32 param_1,u32 param_2,u32 param_3) -{ - s32 * unk; - - sub_0801D630((u32)&gUnk_020354C0,128,param_3); - - unk = &gUnk_03000FD0; +void sub_08050008(u32 param_1, u32 param_2, u32 param_3) { + s32* unk; + + sub_0801D630((u32)&gUnk_020354C0, 128, param_3); + + unk = &gUnk_03000FD0; *(unk + 1) = -1; - + return; -} \ No newline at end of file +} diff --git a/src/sub_08050024.c b/src/sub_08050024.c index 0938882a..23f50e01 100644 --- a/src/sub_08050024.c +++ b/src/sub_08050024.c @@ -3,22 +3,20 @@ extern void sub_0801E104(); extern void DoFade(u32, u32); -void sub_08050024() -{ - sub_0801E104(); - DoFade(5, 0x80 << 1); - return; +void sub_08050024() { + sub_0801E104(); + DoFade(5, 0x80 << 1); + return; } - /* thumb_func_start sub_08050024 sub_08050024: @ 0x08050024 - push {lr} - bl sub_0801E104 - movs r1, #0x80 - lsls r1, r1, #1 - movs r0, #5 - bl DoFade - pop {pc} - .align 2, 0 - */ \ No newline at end of file + push {lr} + bl sub_0801E104 + movs r1, #0x80 + lsls r1, r1, #1 + movs r0, #5 + bl DoFade + pop {pc} + .align 2, 0 + */ diff --git a/src/sub_08052620.c b/src/sub_08052620.c index c91c9267..c4ec163a 100644 --- a/src/sub_08052620.c +++ b/src/sub_08052620.c @@ -2,7 +2,6 @@ extern u8 gArea; -bool32 sub_08052620(u32 r0) -{ +bool32 sub_08052620(u32 r0) { return gArea == 0x81; } diff --git a/src/sub_08052638.c b/src/sub_08052638.c index 5271d607..987572d8 100644 --- a/src/sub_08052638.c +++ b/src/sub_08052638.c @@ -2,10 +2,9 @@ extern u8 gUnk_08127D30[69]; -u32 sub_08052638(u32 r0) -{ - //u32 r1 = gUnk_08127D30; - //u32 r1 = gUnk_08127D30; +u32 sub_08052638(u32 r0) { + // u32 r1 = gUnk_08127D30; + // u32 r1 = gUnk_08127D30; return gUnk_08127D30[r0 * 4] == 129; -} \ No newline at end of file +} diff --git a/src/sub_08055E08.c b/src/sub_08055E08.c index 310ceaaa..7ae07b29 100644 --- a/src/sub_08055E08.c +++ b/src/sub_08055E08.c @@ -1,13 +1,13 @@ #include "global.h" -extern u32 * _call_via_r0(u32 *func); +extern u32* _call_via_r0(u32* func); extern u8 gUnk_02000080; -extern u32 *gUnk_080FF420; +extern u32* gUnk_080FF420; void sub_08055E08() { - u32 **arr = &gUnk_080FF420; + u32** arr = &gUnk_080FF420; u8 i = gUnk_02000080; - i = *(&gUnk_02000080 + 6); - _call_via_r0(arr[i]); -} \ No newline at end of file + i = *(&gUnk_02000080 + 6); + _call_via_r0(arr[i]); +} diff --git a/src/sub_0805E374.c b/src/sub_0805E374.c index 6ae1ddd0..38b30e94 100644 --- a/src/sub_0805E374.c +++ b/src/sub_0805E374.c @@ -1,15 +1,14 @@ #include "entity.h" -extern Entity * sub_0805E3A0(Entity *, u32); +extern Entity* sub_0805E3A0(Entity*, u32); extern u8 gUnk_030010A0[]; extern u8 gUnk_081091F8[]; extern u8 gUnk_081091EE[]; -Entity * sub_0805E374(Entity *param_1) -{ +Entity* sub_0805E374(Entity* param_1) { u8 r3 = gUnk_030010A0[0x2C]; - u8 *array = gUnk_081091F8; + u8* array = gUnk_081091F8; - if ( r3 != '\x02') { + if (r3 != '\x02') { array = gUnk_081091EE; } - return sub_0805E3A0(param_1,array[(param_1->entityType).type]); -} \ No newline at end of file + return sub_0805E3A0(param_1, array[(param_1->entityType).type]); +} diff --git a/src/sub_0805E3A0.c b/src/sub_0805E3A0.c index 61b4cef7..809d4b54 100644 --- a/src/sub_0805E3A0.c +++ b/src/sub_0805E3A0.c @@ -1,9 +1,9 @@ #include "global.h" #include "entity.h" -Entity * sub_0805E3A0(Entity *ent, u32 param){ - //these are bitfields - ent->scriptedScene2 = param; +Entity* sub_0805E3A0(Entity* ent, u32 param) { + // these are bitfields + ent->scriptedScene2 = param; ent->scriptedScene = param; - return ent; + return ent; } diff --git a/src/sub_0806F9EC.c b/src/sub_0806F9EC.c index 70a5b993..9f029530 100644 --- a/src/sub_0806F9EC.c +++ b/src/sub_0806F9EC.c @@ -1,13 +1,13 @@ #include "global.h" -s32 sub_0806F9EC(s16 param_1,s16 param_2) +s32 sub_0806F9EC(s16 param_1, s16 param_2) { int iVar1; - + iVar1 = (s32)param_1 * (s32)param_2; if (iVar1 < 0) { iVar1 = iVar1 + 255; } return (iVar1 << 8) >> 16; -} \ No newline at end of file +} diff --git a/src/sub_0806FA04.c b/src/sub_0806FA04.c index d5fc114d..a7eb191a 100644 --- a/src/sub_0806FA04.c +++ b/src/sub_0806FA04.c @@ -2,18 +2,17 @@ extern s32 __divsi3(s32, s32); -s16 sub_0806FA04(s16 param_1,s16 param_2) +s16 sub_0806FA04(s16 param_1, s16 param_2) { s16 sVar1; s32 iVar2; - + if (param_2 != 0) { - sVar1 = __divsi3( (param_1 << 16) >> 8 ,param_2); + sVar1 = __divsi3((param_1 << 16) >> 8, param_2); iVar2 = sVar1; - } - else { + } else { iVar2 = 0; } return iVar2; -} \ No newline at end of file +} diff --git a/src/sub_0806FA24.c b/src/sub_0806FA24.c index 015b773d..de614717 100644 --- a/src/sub_0806FA24.c +++ b/src/sub_0806FA24.c @@ -1,10 +1,10 @@ #include "global.h" #include "entity.h" -void PositionRelative(Entity *, Entity *, s32, s32); +void PositionRelative(Entity*, Entity*, s32, s32); -void CopyPosition(Entity *param_1,Entity *param_2) +void CopyPosition(Entity* param_1, Entity* param_2) { PositionRelative(param_1, param_2, 0, 0); -} \ No newline at end of file +} diff --git a/src/sub_0806FA30.c b/src/sub_0806FA30.c index 5cc41c23..280f539a 100644 --- a/src/sub_0806FA30.c +++ b/src/sub_0806FA30.c @@ -1,23 +1,23 @@ #include "global.h" #include "entity.h" -extern void PositionRelative(Entity *, Entity *, s32, s32); -extern void sub_0806FAB0(Entity *, Entity *); +extern void PositionRelative(Entity*, Entity*, s32, s32); +extern void sub_0806FAB0(Entity*, Entity*); -void sub_0806FA30(Entity * ent, Entity * ent2) { - PositionRelative(ent, ent2, 0, 0); - sub_0806FAB0(ent, ent2); +void sub_0806FA30(Entity* ent, Entity* ent2) { + PositionRelative(ent, ent2, 0, 0); + sub_0806FAB0(ent, ent2); } /* - thumb_func_start sub_0806FA30 + thumb_func_start sub_0806FA30 sub_0806FA30: @ 0x0806FA30 - push {r4, r5, lr} - adds r4, r0, #0 - adds r5, r1, #0 - movs r2, #0 - movs r3, #0 - bl PositionRelative - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_0806FAB0 - pop {r4, r5, pc} - */ \ No newline at end of file + push {r4, r5, lr} + adds r4, r0, #0 + adds r5, r1, #0 + movs r2, #0 + movs r3, #0 + bl PositionRelative + adds r0, r4, #0 + adds r1, r5, #0 + bl sub_0806FAB0 + pop {r4, r5, pc} + */ diff --git a/src/sub_08070680.c b/src/sub_08070680.c index c24314ad..d5b5b517 100644 --- a/src/sub_08070680.c +++ b/src/sub_08070680.c @@ -1,10 +1,9 @@ #include "global.h" #include "entity.h" -extern void (*gUnk_0811B9E0[])(Entity *); +extern void (*gUnk_0811B9E0[])(Entity*); - -//inject -void sub_08070680(Entity *this) { - gUnk_0811B9E0[this->action](this); -} \ No newline at end of file +// inject +void sub_08070680(Entity* this) { + gUnk_0811B9E0[this->action](this); +} diff --git a/src/sub_0807B7D8.c b/src/sub_0807B7D8.c index 917a12c8..7ef8b080 100644 --- a/src/sub_0807B7D8.c +++ b/src/sub_0807B7D8.c @@ -4,19 +4,18 @@ extern void sub_08000152(u32); extern void sub_0807B778(u32, u32); extern void SetTileType(u32, u32, u32); -void sub_0807B7D8(u32 param_1,u32 param_2,u32 param_3) +void sub_0807B7D8(u32 param_1, u32 param_2, u32 param_3) { if (param_1 == 53) { sub_08000152(53); - sub_0807B778(param_2,param_3); - sub_0807B778(param_2 + 1,param_3); - sub_0807B778(param_2 + -1,param_3); - sub_0807B778(param_2 + 64,param_3); - sub_0807B778(param_2 + -64,param_3); - } - else { - SetTileType(param_1,param_2,param_3); + sub_0807B778(param_2, param_3); + sub_0807B778(param_2 + 1, param_3); + sub_0807B778(param_2 + -1, param_3); + sub_0807B778(param_2 + 64, param_3); + sub_0807B778(param_2 + -64, param_3); + } else { + SetTileType(param_1, param_2, param_3); } return; -} \ No newline at end of file +} diff --git a/src/sub_0807B820.c b/src/sub_0807B820.c index 96aebec6..b8ae309d 100644 --- a/src/sub_0807B820.c +++ b/src/sub_0807B820.c @@ -5,14 +5,14 @@ extern void SetTileType(u32, u32, u32); void sub_0807B820(u32 param_1) { - SetTileType(620,param_1 + -65,1); - SetTileType(627,param_1 + -65,2); - SetTileType(621,param_1 + -64,1); - SetTileType(628,param_1 + -64,2); - SetTileType(622,param_1 + -63,1); - SetTileType(629,param_1 + -63,2); - SetTileType(623,param_1 + -1,1); - SetTileType(624,param_1,1); - SetTileType(626,param_1 + 1,1); + SetTileType(620, param_1 + -65, 1); + SetTileType(627, param_1 + -65, 2); + SetTileType(621, param_1 + -64, 1); + SetTileType(628, param_1 + -64, 2); + SetTileType(622, param_1 + -63, 1); + SetTileType(629, param_1 + -63, 2); + SetTileType(623, param_1 + -1, 1); + SetTileType(624, param_1, 1); + SetTileType(626, param_1 + 1, 1); return; -} \ No newline at end of file +} diff --git a/src/sub_0807B8A8.c b/src/sub_0807B8A8.c index dd332789..5c008ad2 100644 --- a/src/sub_0807B8A8.c +++ b/src/sub_0807B8A8.c @@ -5,14 +5,14 @@ extern void SetTileType(u32, u32, u32); void sub_0807B8A8(u32 param_1) { - SetTileType(636,param_1 + -65,1); - SetTileType(643,param_1 + -65,2); - SetTileType(637,param_1 + -64,1); - SetTileType(644,param_1 + -64,2); - SetTileType(638,param_1 + -63,1); - SetTileType(645,param_1 + -63,2); - SetTileType(639,param_1 + -1,1); - SetTileType(640,param_1,1); - SetTileType(642,param_1 + 1,1); + SetTileType(636, param_1 + -65, 1); + SetTileType(643, param_1 + -65, 2); + SetTileType(637, param_1 + -64, 1); + SetTileType(644, param_1 + -64, 2); + SetTileType(638, param_1 + -63, 1); + SetTileType(645, param_1 + -63, 2); + SetTileType(639, param_1 + -1, 1); + SetTileType(640, param_1, 1); + SetTileType(642, param_1 + 1, 1); return; -} \ No newline at end of file +} diff --git a/src/sub_0807B930.c b/src/sub_0807B930.c index 4daff516..aae0472c 100644 --- a/src/sub_0807B930.c +++ b/src/sub_0807B930.c @@ -1,19 +1,18 @@ #include "global.h" - extern void SetTileType(u32, u32, u32); void sub_0807B930(int param_1) { - SetTileType(652,param_1 + -65,1); - SetTileType(659,param_1 + -65,2); - SetTileType(653,param_1 + -64,1); - SetTileType(660,param_1 + -64,2); - SetTileType(654,param_1 + -63,1); - SetTileType(661,param_1 + -63,2); - SetTileType(655,param_1 + -1,1); - SetTileType(656,param_1,1); - SetTileType(658,param_1 + 1,1); + SetTileType(652, param_1 + -65, 1); + SetTileType(659, param_1 + -65, 2); + SetTileType(653, param_1 + -64, 1); + SetTileType(660, param_1 + -64, 2); + SetTileType(654, param_1 + -63, 1); + SetTileType(661, param_1 + -63, 2); + SetTileType(655, param_1 + -1, 1); + SetTileType(656, param_1, 1); + SetTileType(658, param_1 + 1, 1); return; } diff --git a/src/sub_0807C998.c b/src/sub_0807C998.c index ec3b162b..a1d16fdf 100644 --- a/src/sub_0807C998.c +++ b/src/sub_0807C998.c @@ -4,8 +4,7 @@ extern void sub_0807C960(); extern u32 gUnk_0202CEB4; extern u32 gUnk_02012654; -void sub_0807C998(u32 *a1) -{ +void sub_0807C998(u32* a1) { sub_0807C960(&gUnk_0202CEB4, a1[0]); sub_0807C960(&gUnk_0202CEB4 - 0x800, a1[1]); sub_0807C960(&gUnk_02012654, a1[2]); diff --git a/src/sub_080A554C.c b/src/sub_080A554C.c index ab9057fe..d28668ce 100644 --- a/src/sub_080A554C.c +++ b/src/sub_080A554C.c @@ -6,7 +6,7 @@ u32 sub_080A554C(u32 param_1) { u32 uVar1; - + if (param_1 != 0) { uVar1 = 0; do { diff --git a/src/sub_080AD644.c b/src/sub_080AD644.c index 3d501516..059c544b 100644 --- a/src/sub_080AD644.c +++ b/src/sub_080AD644.c @@ -3,15 +3,13 @@ extern s32 sub_080ADA14(u32, u32); extern u16 gUnk_03001010[4]; - -void sub_080AD644(void) -{ +void sub_080AD644(void) { gUnk_03001010[2] = 0; gUnk_03001010[3] = 0; gUnk_03001010[4] = 57376; gUnk_03001010[0] = 120; gUnk_03001010[1] = 152; - sub_080ADA14(511,1); + sub_080ADA14(511, 1); return; -} \ No newline at end of file +} diff --git a/src/sub_08127D30.c b/src/sub_08127D30.c index c4830e1d..aa953d3a 100644 --- a/src/sub_08127D30.c +++ b/src/sub_08127D30.c @@ -2,10 +2,9 @@ extern u8 gUnk_08127D30[69]; -u32 sub_08052654(u32 r0) -{ - //u32 r1 = gUnk_08127D30; - //u32 r1 = gUnk_08127D30; +u32 sub_08052654(u32 r0) { + // u32 r1 = gUnk_08127D30; + // u32 r1 = gUnk_08127D30; return gUnk_08127D30[r0 * 4] == 129; -} \ No newline at end of file +} diff --git a/src/textbox.c b/src/textbox.c index da855444..37010283 100644 --- a/src/textbox.c +++ b/src/textbox.c @@ -3,7 +3,7 @@ #include "entity.h" #include "textbox.h" -void TextboxNoOverlap(u32 index,Entity *ent); +void TextboxNoOverlap(u32 index, Entity* ent); void sub_0801D630(); void ShowTextbox(); void TextboxAtPosition(); @@ -29,14 +29,13 @@ void TextboxTryNoOverlap(u32 index) { if (gRoomControls.cameraTarget != NULL) { TextboxNoOverlap(index, gRoomControls.cameraTarget); - } - else { + } else { ShowTextbox(index); } return; } -void TextboxNoOverlap(u32 index,Entity *ent) +void TextboxNoOverlap(u32 index, Entity* ent) { s16 y; @@ -46,29 +45,26 @@ void TextboxNoOverlap(u32 index,Entity *ent) y = ent->y.HALF.HI; h = ent->height.HALF.HI; - + if (88 < ((y + h) - gRoomControls.roomScrollY)) { gTextBox.textWindowPosY = 1; } return; } -void sub_080563C8(u32 param_1,u32 param_2) -{ - TextboxAtPosition(param_1,1,param_2); +void sub_080563C8(u32 param_1, u32 param_2) { + TextboxAtPosition(param_1, 1, param_2); return; } -void TextboxAtPosition(u32 index,u32 x,u32 y) -{ +void TextboxAtPosition(u32 index, u32 x, u32 y) { ShowTextbox(index); gTextBox.textWindowPosX = x; gTextBox.textWindowPosY = y; return; } -void ShowTextbox(u32 index,u32 param_2,u32 *dest) -{ +void ShowTextbox(u32 index, u32 param_2, u32* dest) { sub_0801D630(&gTextBox, 32, dest); gTextBox.textIndex = index; gTextBox.textSpeed = 99; @@ -80,13 +76,12 @@ void ShowTextbox(u32 index,u32 param_2,u32 *dest) return; } -void sub_08056418(void) -{ +void sub_08056418(void) { - sub_0801D630(&gTextBox,32); - sub_0801D630(&gUnk_02022780,168); - sub_0801D630(&gUnk_02036A40,8); - sub_0801D630(&gUnk_02036A38,8); - sub_0801D630(&gUnk_02000040,4); + sub_0801D630(&gTextBox, 32); + sub_0801D630(&gUnk_02022780, 168); + sub_0801D630(&gUnk_02036A40, 8); + sub_0801D630(&gUnk_02036A38, 8); + sub_0801D630(&gUnk_02000040, 4); return; } diff --git a/src/well.c b/src/well.c index b57ae803..512f9f9a 100644 --- a/src/well.c +++ b/src/well.c @@ -9,30 +9,27 @@ void DeleteThisEntity(); extern Entity gLinkEntity; extern RoomControls gRoomControls; -extern void (*gUnk_08124C08[])(Entity *); +extern void (*gUnk_08124C08[])(Entity*); -void sub_080A0E98(Entity* ent) -{ +void sub_080A0E98(Entity* ent) { gUnk_08124C08[ent->action](ent); } -void sub_080A0EB0(Entity* ent) -{ +void sub_080A0EB0(Entity* ent) { u32 tilePos; ent->action = 1; - tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64); + tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | + ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64); ent->field_0x80 = tilePos; SetTile(16509, ent->field_0x80, 1); } -void sub_080A0EF0(Entity* ent) -{ +void sub_080A0EF0(Entity* ent) { s32 tileIndex; - + tileIndex = GetTileType(ent->field_0x80, 1); - if (tileIndex != 16509) - { + if (tileIndex != 16509) { sub_08078B48(); gLinkEntity.x.WORD = ent->x.WORD; gLinkEntity.y.HALF.HI = ent->y.HALF.HI + 4; diff --git a/src/zelda.c b/src/zelda.c index 4400351d..65c72d6c 100644 --- a/src/zelda.c +++ b/src/zelda.c @@ -6,12 +6,12 @@ extern void sub_0805EA78(Entity*, u32); extern void sub_0805E3A0(Entity*, u32); extern void sub_0807DD50(Entity*); extern void sub_0807DD94(Entity*, u32); -extern Entity* sub_0805EB9C(u32, u32); +extern Entity* sub_0805EB9C(u32, u32); void CopyPosition(Entity*, Entity*); void sub_08068680(Entity*, Entity*); void sub_08068694(Entity*, Entity*); extern void SetGlobalFlag(u32); -extern Entity* CreateNPC(u32 subtype,u32 parameter1,u32 parameter2); +extern Entity* CreateNPC(u32 subtype, u32 parameter1, u32 parameter2); u32 sub_0806EDC4(Entity* ent); void DeleteThisEntity(void); extern Entity* GetEntityByType(u32, u32); @@ -31,14 +31,11 @@ extern void (*gUnk_08110BD8[])(Entity* ent); extern u8 gUnk_02033280[]; extern u16 gUnk_08110BE0[]; - -void sub_08066CB4(Entity* ent) -{ +void sub_08066CB4(Entity* ent) { gUnk_08110BD8[ent->action](ent); } -void sub_08066CCC(Entity *ent) -{ +void sub_08066CCC(Entity* ent) { ent->action = 1; ent->spriteSettings.b.ss0 = 1; sub_0805EA78(ent, 7); @@ -46,42 +43,34 @@ void sub_08066CCC(Entity *ent) sub_0807DD50(ent); } -void sub_08066CF8(Entity* ent) -{ +void sub_08066CF8(Entity* ent) { sub_0807DD94(ent, 0); } -void sub_08066D04(Entity* ent) -{ +void sub_08066D04(Entity* ent) { ent->parent = sub_0805EB9C(7, 0x2E); } -void sub_08066D14(Entity* ent, u32* param_2) -{ +void sub_08066D14(Entity* ent, u32* param_2) { Entity* parent; - + parent = ent->parent; - if (parent != NULL) - { + if (parent != NULL) { ent->animationState = parent->animationState; ent->spriteSettings.b.ss0 = 1; CopyPosition(parent, ent); sub_08068680(ent, ent->parent); param_2[5] = 1; - } - else - { + } else { param_2[5] = 0; } } -void sub_08066D4C(Entity* ent, u32* param_2) -{ +void sub_08066D4C(Entity* ent, u32* param_2) { Entity* parent; parent = ent->parent; - if (ent->parent != NULL) - { + if (ent->parent != NULL) { CopyPosition(ent, parent); ent->parent->spriteSettings.b.ss0 = 1; ent->parent->animationState = ent->animationState; @@ -89,22 +78,18 @@ void sub_08066D4C(Entity* ent, u32* param_2) ent->field_0x17 &= 0xFE; sub_08068694(ent, ent->parent); param_2[5] = 1; - } - else - { + } else { param_2[5] = 0; } } -void sub_08066D94(Entity* ent) -{ +void sub_08066D94(Entity* ent) { u32 roomID; Entity* npc; - + SetGlobalFlag(0x1C); npc = CreateNPC(0x2E, 0, 0); - if (npc != NULL) - { + if (npc != NULL) { npc->animationState = gLinkEntity.animationState; npc->flags |= 0x20; npc->animationState = sub_0806EDC4(ent); @@ -115,60 +100,50 @@ void sub_08066D94(Entity* ent) DeleteThisEntity(); } -void sub_08066DE4(Entity* ent) -{ +void sub_08066DE4(Entity* ent) { Entity* pEVar1; - + pEVar1 = sub_0805EB9C(7, 0x2E); - if (pEVar1 != NULL) - { + if (pEVar1 != NULL) { CopyPosition(ent, pEVar1); sub_080686C4(ent, pEVar1); } } -void sub_08066E08(Entity* ent) -{ +void sub_08066E08(Entity* ent) { LoadAnimation(ent, 0x50); ent->field_0x80 = ent->field_0x58; } -void sub_08066E20(Entity* ent) -{ +void sub_08066E20(Entity* ent) { LoadAnimation(ent, 0x44); ent->field_0x80 = ent->field_0x58; } -void sub_08066E38(Entity* ent) -{ +void sub_08066E38(Entity* ent) { LoadAnimation(ent, 0x48); ent->field_0x80 = ent->field_0x58; } -void sub_08066E50(Entity* ent) -{ +void sub_08066E50(Entity* ent) { LoadAnimation(ent, 0x4C); ent->field_0x80 = ent->field_0x58; } -void sub_08066E68(Entity* ent) -{ +void sub_08066E68(Entity* ent) { LoadAnimation(ent, 0x54); ent->field_0x80 = ent->field_0x58; } -void sub_08066E80(Entity* ent, u8* param_2) -{ - switch(param_2[0x18]) - { +void sub_08066E80(Entity* ent, u8* param_2) { + switch (param_2[0x18]) { case 0: param_2[0x18]++; LoadAnimation(ent, 0x16); break; case 1: sub_080042B8(ent); - if (ent->frames.all & 1) - { + if (ent->frames.all & 1) { param_2[0x18]++; ent->field_0x20 = 0x20000; ent->frames.all &= 0xFE; @@ -178,28 +153,24 @@ void sub_08066E80(Entity* ent, u8* param_2) case 2: sub_0806F62C(ent, 0x100, 0x80); sub_08003FC4(ent, 0x2000); - if (!(ent->frames.all & 1)) - { + if (!(ent->frames.all & 1)) { sub_080042B8(ent); } - if (ent->field_0x20 < 0) - { + if (ent->field_0x20 < 0) { param_2[0x18]++; } break; case 3: sub_0806F62C(ent, 0x100, 0x80); sub_080042B8(ent); - if (sub_08003FC4(ent, 0x2000) == 0) - { + if (sub_08003FC4(ent, 0x2000) == 0) { param_2[0x18]++; LoadAnimation(ent, 0x1E); } break; case 4: sub_080042B8(ent); - if (ent->frames.b.f3) - { + if (ent->frames.b.f3) { gUnk_02033280[7] |= 1; return; } @@ -208,28 +179,24 @@ void sub_08066E80(Entity* ent, u8* param_2) gUnk_02033280[6] = 0; } -void sub_08066F94(void) -{ +void sub_08066F94(void) { u16 uVar1; u16* puVar2; - + puVar2 = gUnk_08110BE0; - while (*puVar2 != 0) - { + while (*puVar2 != 0) { uVar1 = *puVar2; puVar2++; SetTileType(16498, uVar1, 1); } } -void sub_08066FB8(void) -{ +void sub_08066FB8(void) { u16 uVar1; u16* puVar2; - + puVar2 = gUnk_08110BE0; - while (*puVar2 != 0) - { + while (*puVar2 != 0) { uVar1 = *puVar2; puVar2++; sub_0807BA8C(uVar1, 1); -- cgit v1.2.3