diff options
| author | notyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com> | 2020-07-15 01:40:49 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-15 01:40:49 -0700 |
| commit | 6b01f03ce6e5e7e54fa48917574b0c4cf66c5a3d (patch) | |
| tree | 5b5aa98a20542432c8e9b0ce3c42180eb8c91a9f /src | |
| parent | f89035be43b3c4dc7dcf511fd774679a8e74b140 (diff) | |
| parent | 4b1bbd23e915f9d7a532c34359d7f7369190c5f5 (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'src')
| -rw-r--r-- | src/code_08077B98.c | 140 | ||||
| -rw-r--r-- | src/code_08077DF4.c | 133 | ||||
| -rw-r--r-- | src/code_08078778.c | 88 | ||||
| -rw-r--r-- | src/enemy/leever.c | 206 | ||||
| -rw-r--r-- | src/item11.c | 2 | ||||
| -rw-r--r-- | src/npc/bladeBrothers.c | 6 | ||||
| -rw-r--r-- | src/npc/melari.c | 173 | ||||
| -rw-r--r-- | src/object/cloud.c | 2 | ||||
| -rw-r--r-- | src/object/jailBars.c | 64 | ||||
| -rw-r--r-- | src/object/object86.c | 2 | ||||
| -rw-r--r-- | src/object/objectAF.c | 56 | ||||
| -rw-r--r-- | src/object/objectB2.c | 44 | ||||
| -rw-r--r-- | src/ocarina.c | 6 |
13 files changed, 913 insertions, 9 deletions
diff --git a/src/code_08077B98.c b/src/code_08077B98.c new file mode 100644 index 00000000..c908595b --- /dev/null +++ b/src/code_08077B98.c @@ -0,0 +1,140 @@ +#include "global.h" +#include "entity.h" +#include "link.h" +#include "functions.h" + + +typedef struct { + u8 unk[12]; +} struct_0811BE48; + +typedef struct { + u8 field_0x0; + u8 field_0x1; +} UnkItemStruct; + +Entity* sub_08077C94(ItemBehavior*, u32); +void* sub_08077C54(UnkItemStruct* unk); +Entity* CreatePlayerBomb(ItemBehavior*, u32); +extern Entity* sub_0805E744(); +extern void sub_0805EA2C(Entity*, u32); + +extern struct_0811BE48 gUnk_0811BE48[]; + +void sub_08077B98(UnkItemStruct* unk) +{ + if ((gLinkState.field_0x2c == NULL) || (gLinkState.field_0x2c[9] != 1)) { + gLinkState.field_0x2c = sub_08077C54(unk); + } +} + +void sub_08077BB8(UnkItemStruct* unk) +{ + u8* temp = sub_08077C54(unk); + if (temp != NULL) { + temp[0x10] = 0x20; + } + gLinkState.field_0x2c = temp; +} + +Entity* sub_08077BD4(ItemBehavior *beh) +{ + if (sub_08077C94(beh, gUnk_0811BE48[beh->behaviorID].unk[3]) != 0) { + return NULL; + } + else { + return CreatePlayerBomb(beh, gUnk_0811BE48[beh->behaviorID].unk[3]); + } +} + +Entity * sub_08077C0C(ItemBehavior *beh, u32 arg1) +{ + u8 bVar1; + Entity *pEVar3; + + bVar1 = gUnk_0811BE48[arg1].unk[3]; + + if (sub_08077C94(beh, bVar1) != 0) { + return NULL; + } + else { + return CreatePlayerBomb(beh, bVar1); + } +} + +Entity * CreatePlayerBomb(ItemBehavior *beh, u32 subtype) +{ + Entity *pEVar1; + + pEVar1 = CreatePlayerItem(subtype, 0, 0, beh->behaviorID); + if (pEVar1 != NULL) { + *(ItemBehavior **)&pEVar1->parent = beh; + } + return pEVar1; +} + +void* sub_08077C54(UnkItemStruct* unk) +{ + Entity *item; + + item = sub_0805E744(); + if (item != NULL) { + item->entityType.subtype = gUnk_0811BE48[unk->field_0x1].unk[3]; + item->entityType.type = 8; + item->flags = 0xa0; + item->parent = (Entity*)unk; + item->field_0x68 = unk->field_0x1; + sub_0805EA2C(item, 2); + } + return item; +} + +Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1) +{ + Entity* iVar1; + + iVar1 = sub_0805EB00(8, gUnk_0811BE48[arg1].unk[3], 2); + if (iVar1 == NULL) { + return NULL; + } + return iVar1; +} + +Entity * CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) +{ + Entity *ent; + + ent = GetEmptyEntity(); + if (ent != NULL) { + ent->flags = 0x80; + (ent->entityType).type = 8; + (ent->entityType).subtype = subtype; + (ent->entityType).form = form; + (ent->entityType).parameter = parameter; + ent->field_0x68 = unk; + sub_0805EA2C(ent, 2); + } + return ent; +} + +Entity * sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) +{ + Entity *ent; + + ent = sub_0805E744(); + if (ent != NULL) { + ent->flags = 0x80; + (ent->entityType).type = 8; + (ent->entityType).subtype = subtype; + (ent->entityType).form = form; + (ent->entityType).parameter = parameter; + ent->field_0x68 = unk; + sub_0805EA2C(ent, 2); + } + return ent; +} + +NAKED +void sub_08077D38(ItemBehavior *beh, u32 arg1) { + asm(".include \"asm/non_matching/sub_08077D38.inc\""); +}
\ No newline at end of file diff --git a/src/code_08077DF4.c b/src/code_08077DF4.c new file mode 100644 index 00000000..467cbe35 --- /dev/null +++ b/src/code_08077DF4.c @@ -0,0 +1,133 @@ +#include "global.h" +#include "entity.h" +#include "link.h" +#include "functions.h" + +typedef struct { + u8 b0: 4; + u8 b1: 4; +} PACKED Unk_bitfield; + +typedef struct { + u8 unk[16]; +} Unk_struct; + +void sub_08077DF4(Entity *ent, u32 arg1) +{ + *(u16 *)&ent->flags = arg1; + if ((arg1 & 0xff) > 0xb8) { + arg1 += (ent->entityType).form >> 1; + } + gLinkEntity.spriteTileSize = (short)(arg1 >> 8); + InitAnimationForceUpdate(&gLinkEntity, (u8)arg1); + sub_08077E54(ent); +} + +void UpdateItemAnim(Entity *ent) +{ + UpdateAnimationSingleFrame(&gLinkEntity); + sub_08077E54(ent); +} + +void sub_08077E3C(Entity *ent) +{ + sub_080042BA(&gLinkEntity); + sub_08077E54(ent); +} + +void sub_08077E54(Entity *ent) +{ + ent->action = gLinkEntity.animIndex; + *(u8 *)&ent->spriteTileSize = gLinkEntity.frameIndex; + ent->previousActionFlag = gLinkEntity.frameDuration; + ent->actionDelay = gLinkEntity.frames.all; +} + +void sub_08077E78(void* arg0, u32 bits) +{ + u8 *pbVar1; + u32 not; + + if (bits == 0) { + if (gLinkState.field_0x2c != NULL) { + ((Unk_bitfield *)gLinkState.field_0x2c)[0x11].b0 = 6; + gLinkState.field_0x2c = (u8 *)bits; + } + else { + gLinkState.field_0x2c = (u8 *)bits; + } + } + + not = (8 >> bits); + gLinkState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not); + not = ~not; + gLinkState.field_0xa &= not; + gLinkState.keepFacing &= not; + sub_0801D630(arg0, 0x1c); +} + +u32 sub_08077EC8(Unk_struct* arg0) +{ + + if ((gLinkState.field_0x1a[1] & 8) != 0) { + sub_08077DF4((Entity *)arg0,0x170); + arg0->unk[7] = 0x28; + arg0->unk[4] = 7; + arg0->unk[15] = 6; + return 1; + } + else { + return 0; + } +} + +void sub_08077EFC(ItemBehavior* arg0) +{ + sub_08077F24(arg0, (u16)gLinkState.field_0x90.HALF.LO); +} + +void sub_08077F10(ItemBehavior* arg0) +{ + sub_08077F24(arg0, (u16)gLinkState.field_0x90.HALF.HI); +} + +NAKED +void sub_08077F24(ItemBehavior* beh, u32 arg1) { + asm(".include \"asm/non_matching/sub_08077F24.inc\""); +} + +void sub_08077F50(ItemBehavior *beh, u32 arg1) +{ + sub_08079184(); + sub_08077E78(beh, arg1); +} + +u32 sub_08077F64(ItemBehavior* arg0, u32 unk) +{ + u32 temp; + if (gLinkState.heldObject == 0) { + sub_08077F50(arg0, unk); + temp = 0; + } + else { + temp = 1; + } + return temp; +} + +void sub_08077F84(void) +{ + Entity *obj; + + if (((gLinkEntity.collisionLayer & 2) == 0) && + GetTileTypeByPos(gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) { + sub_0807AA80(&gLinkEntity); + gLinkState.jumpStatus |= 8; + obj = CreateObject(0x44, 0, 0); + if (obj != NULL) { + obj->x = gLinkEntity.x; + obj->y.HALF.HI = gLinkEntity.y.HALF.HI - 0xc; + gLinkEntity.y.HALF.HI -= 0xc; + } + } +} diff --git a/src/code_08078778.c b/src/code_08078778.c new file mode 100644 index 00000000..78c54099 --- /dev/null +++ b/src/code_08078778.c @@ -0,0 +1,88 @@ +#include "global.h" +#include "entity.h" +#include "functions.h" + +typedef struct { + u8 unk[4]; + u32 unk2; + u32 unk4; +} Unk_struct; + +extern Unk_struct gUnk_03003DF0[]; + +void sub_08078778(Entity* ent) { + sub_0807887C(ent, 1, 0); +} + +void sub_08078784(Entity* ent, u32 arg1) { + sub_0807887C(ent, 1, arg1); +} + +void sub_08078790(Entity* ent, u32 arg1) { + sub_0807887C(ent, 2, arg1); +} + +void sub_0807879C(Entity* ent) { + sub_0807887C(ent, 7, 0); +} + +void sub_080787A8(Entity* ent, u32 arg1) { + sub_0807887C(ent, 7, arg1); +} + +void sub_080787B4(Entity* ent) { + sub_0807887C(ent, 9, 0); +} + +void sub_080787C0(Entity* ent) { + sub_0807887C(ent, 10, 0); +} + +void sub_080787CC(Entity* ent) { + sub_0807887C(ent, 5, 0); +} + +s32 sub_080787D8(Entity *ent) +{ + s32 iVar1; + + iVar1 = sub_0807887C(ent, 8, 0); + if (iVar1 >= 0) { + gUnk_03003DF0[iVar1].unk[10] = 0xbe; + } + return iVar1; +} + +s32 sub_08078800(Entity *ent) +{ + s32 iVar1; + + iVar1 = sub_0807887C(ent, 6, 0); + if (iVar1 >= 0) { + gUnk_03003DF0[iVar1].unk[10] = 0xbe; + } + return iVar1; +} + +s32 sub_08078828(Entity *ent) +{ + s32 iVar1; + + iVar1 = sub_0807887C(ent, 3, 0); + if (iVar1 >= 0) { + gUnk_03003DF0[iVar1].unk[10] = 0xbe; + } + return iVar1; +} + +void sub_08078850(u32 arg0, u32 arg1, u32 arg2, u32 arg3) +{ + s32 iVar1; + + iVar1 = sub_08078904(); + if (iVar1 >= 0) { + gUnk_03003DF0[iVar1].unk[8] = arg1; + gUnk_03003DF0[iVar1].unk[10] = arg2; + *(&gUnk_03003DF0[iVar1].unk4 + 1) = arg3; + } +}
\ No newline at end of file diff --git a/src/enemy/leever.c b/src/enemy/leever.c new file mode 100644 index 00000000..baefa4fd --- /dev/null +++ b/src/enemy/leever.c @@ -0,0 +1,206 @@ +#include "global.h" +#include "entity.h" +#include "enemy.h" +#include "functions.h" + +extern void SetChildOffset(Entity*, s32, s32, s32); +extern void sub_0804A9FC(Entity*, u32); +extern void sub_0804AA30(Entity*, void (*const func[])(Entity*)); +extern void sub_0804A7D4(Entity*); +extern Entity* CreateDeathFx(Entity*, u32, u32); +extern void sub_0804A720(Entity*); +bool32 sub_0801FE68(Entity*, s32); +extern void sub_0801FED4(Entity*); +extern u32 sub_080002D4(s32, s32, u32); +extern u32 sub_080002BC(s32, s32, u32); +extern u32 sub_08049FDC(Entity*, u32); +bool32 sub_0801FDE4(Entity*, s32, s32); + +extern void (*const gUnk_080CA49C[])(Entity*); +extern void (*const gUnk_080CA4B4[])(Entity*); +extern Entity* gUnk_020000B0; +extern u8 gUnk_080CA4C8[]; +extern u16 gUnk_080CA4CA[]; +extern s16 gSineTable[]; +void Leever(Entity *this) +{ + EnemyFunctionHandler(this, gUnk_080CA49C); + SetChildOffset(this, 0, 1, -0x10); +} + +void sub_0801FC28(Entity *this) +{ + gUnk_080CA4B4[this->action](this); +} + +void sub_0801FC40(Entity *this) +{ + if (this->bitfield == 0x80) { + if (this->action == 3) { + this->field_0x74 = 1; + } + } + else { + if (this->field_0x43 != 0) { + sub_0804A9FC(this, 0x1c); + } + } + sub_0804AA30(this, gUnk_080CA49C); +} + +void sub_0801FC7C(Entity *this) +{ + if ((this->entityType).form == 0) { + sub_0804A7D4(this); + } + else { + CreateDeathFx(this, 0xf1, 0); + } +} + +void sub_0801FC9C(Entity *this) +{ + sub_0804A720(this); + this->action = 1; + this->actionDelay = Random(); +} + +void sub_0801FCB0(Entity *this) +{ + if (--this->actionDelay == 0) { + if (sub_0801FE68(this, Random() & 0x1f) != 0) { + this->action = 2; + this->spriteSettings.b.draw = TRUE; + this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA4C8[Random() & 1]) & 0x1f; + InitializeAnimation(this, 0); + UpdateSpriteForCollisionLayer(this); + } + else { + this->actionDelay = (Random() & 0x18) + 8; + } + } +} + +void sub_0801FD2C(Entity *this) +{ + + GetNextFrame(this); + + if (this->frames.b.f3 != 0) { + this->action = 3; + if (this->entityType.form == 0) { + this->field_0x74 = 0xb4; + } + else { + this->field_0x74 = 0x6e; + } + InitializeAnimation(this,2); + } + else if (this->frames.b.f0 != 0) { + this->frames.all &= 0xfe; + this->flags |= 0x80; + } +} + +void sub_0801FD80(Entity *this) +{ + + sub_0801FED4(this); + GetNextFrame(this); + + if (--this->field_0x74 == 0) { + this->action = 4; + this->flags &= 0x7f; + InitializeAnimation(this, 1); + } +} + +void sub_0801FDB4(Entity *this) +{ + sub_0801FED4(this); + GetNextFrame(this); + if ((this->frames.b.f3) != 0) { + this->action = 1; + this->actionDelay = 0xf0; + this->spriteSettings.b.draw = FALSE; + } +} + +u32 sub_0801FDE4(Entity *ent, s32 x, s32 y) +{ + u32 uVar3; + u16 *puVar4; + + if (sub_080002D4(x, y, gUnk_020000B0->collisionLayer) != 0) { + return 0; + } else { + uVar3 = sub_080002BC(x, y, gUnk_020000B0->collisionLayer); + for (puVar4 = gUnk_080CA4CA; *puVar4 != (u16)-1;) { + if (*puVar4++ == uVar3) { + ent->x.HALF.HI = (x & 0xfff0) + 8; + ent->y.HALF.HI = (y & 0xfff0) + 8; + ent->collisionLayer = gUnk_020000B0->collisionLayer; + return 1; + } + } + return 0; + } +} + +bool32 sub_0801FE68(Entity *ent, s32 arg2) +{ + s32 sin, cos; + s32 x, y; + u32 i; + + + if (sub_08049FDC(ent, 1) == 0) { + return 0; + } + else { + x = gUnk_020000B0->x.WORD; + y = gUnk_020000B0->y.WORD; + sin = gSineTable[arg2 * 8] << 11; + cos = gSineTable[arg2 * 8 + 0x40] << 11; + for (i = 0; i < 8; i++) { + x += sin; + y += -cos; + if (sub_0801FDE4(ent, x >> 0x10, y >> 0x10) == 0) { + return 0; + } + } + return 1; + } +} + +#if NON_MATCHING +void sub_0801FED4(Entity *this) +{ + s16 sVar2; + + if (sub_08049FDC(this, 1) == 0) { + this->field_0x74 = 1; + } + sVar2 = (this->frames.all & 0xf) * 0x20; + this->nonPlanarMovement = sVar2; + if (this->entityType.form == 0) { + this->field_0xf++; + if ((this->field_0xf & 0xf) == 0) { + sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); + } + } + else { + this->nonPlanarMovement = sVar2 + 0x40; + this->field_0xf++; + if ((this->field_0xf & 0x7) == 0) { + sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); + } + } + sub_080AEF88(this); +} +#else +NAKED +void sub_0801FED4(Entity *this) { + asm(".include \"asm/non_matching/leever/sub_0801FED4.inc\""); +} +#endif
\ No newline at end of file diff --git a/src/item11.c b/src/item11.c index 0af53106..4f90bba6 100644 --- a/src/item11.c +++ b/src/item11.c @@ -59,7 +59,7 @@ void sub_08018CBC(Entity *this) this->spriteTileSize = 0xa6; this->palette = 0x33; this->spriteVramOffset = 0; - (this->entityType).form = gLinkState.filler9[0] - 1; + (this->entityType).form = gLinkState.field_0x1d[0] - 1; this->actionDelay = gUnk_080B3DE0[(this->entityType).form * 2]; this->field_0x44 = gUnk_080B3DE0[(this->entityType).form * 2 + 1]; this->field_0x40 = 0x1b; diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 68630e8e..bcd9fa62 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -358,15 +358,15 @@ void sub_08068E78(Entity* this) { void sub_08068E90(Entity* this) { LinkState* s = &gLinkState; - *(u16*)&s->unk8 = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->unk8; + *(u16*)&s->field_0xac = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->field_0xac; } void sub_08068EB4(void) { - gLinkState.unk71 = 0; + gLinkState.field_0xab = 0; } void sub_08068EC4(Entity* param_1, Entity* param_2) { - if (gUnk_08111740[param_1->actionDelay] == gLinkState.unk71) { + if (gUnk_08111740[param_1->actionDelay] == gLinkState.field_0xab) { *(u16*)¶m_2->flags = gUnk_0811172A[param_1->actionDelay]; *(u32*)¶m_2->animationState = 1; } else { diff --git a/src/npc/melari.c b/src/npc/melari.c new file mode 100644 index 00000000..ae906fd5 --- /dev/null +++ b/src/npc/melari.c @@ -0,0 +1,173 @@ +#include "global.h" +#include "entity.h" +#include "npc.h" +#include "textbox.h" +#include "functions.h" + +extern void sub_0806ED78(Entity*); +extern void sub_08068780(Entity*); +extern void sub_08078778(Entity*); +extern u32 Random(void); +extern void sub_0805E3A0(Entity*, u32); +extern void sub_0807DD50(Entity*); +extern void sub_0806F118(Entity*); +extern void sub_0807DDAC(Entity*, u32); +extern void sub_0807DDE4(Entity*); +extern u32 sub_080040A8(Entity*); +extern void sub_08004488(u32); +extern u32 sub_0801E99C(Entity*); +extern void sub_08078784(Entity*, u32); +extern void sub_0807000C(Entity*); +extern s32 sub_0806EDD8(Entity*, u32, u32); +extern void sub_080A7C18(u32, u32, u32); +extern void sub_0807CAA0(u32, u32); + +extern void (*const gUnk_08111530[])(Entity*); + +extern SpriteLoadData gUnk_08111520; +extern u16 gUnk_0811153E[]; +extern u16 gUnk_08111538[]; + +void Melari(Entity* this) { + if ((this->flags & 2) == 0) { + gUnk_08111530[this->action](this); + sub_0806ED78(this); + } else { + sub_08068780(this); + } +} + +void sub_08068708(Entity* this) { + if (LoadExtraSpriteData(this, &gUnk_08111520) != 0) { + this->action = 1; + InitializeAnimation(this, 0); + sub_08078778(this); + } +} + +void sub_08068730(Entity* this) { + s32 animIndex; + + animIndex = sub_0806ED9C(this, 0x20, 0x20); + if (-1 < animIndex) { + if (this->field_0xf == 0) { + this->field_0xf = 0x10; + if (this->animIndex != animIndex) { + InitializeAnimation(this, animIndex); + } + } else { + this->field_0xf--; + } + } + if (this->interactType != 0) { + this->interactType = 0; + TextboxNoOverlapFollow(this->actionDelay + 0x1200); + } +} + +void sub_08068780(Entity* this) { + Entity* ent; + + switch (this->action) { + case 0: + if (LoadExtraSpriteData(this, &gUnk_08111520) == 0) { + return; + } + this->action = 1; + this->spriteSettings.b.draw = TRUE; + this->animationState = this->entityType.form; + sub_0805E3A0(this, 2); + sub_0807DD50(this); + break; + case 1: + if (this->interactType == 2) { + this->action = 2; + this->interactType = 0; + sub_0806F118(this); + } else { + sub_0807DDAC(this, 0); + sub_0807DDE4(this); + GetNextFrame(this); + } + break; + case 2: + if (UpdateFuseInteraction(this)) { + this->action = 1; + } + } + + if ((this->frames.b.f2) != 0) { + this->frames.all &= 0xbf; + if (sub_080040A8(this) == 0) { + PlaySFX(gUnk_0811153E[(s32)Random() % 3]); + } else { + sub_08004488(gUnk_08111538[(s32)Random() % 3]); + } + ent = CreateFx(this, 0x3d, 0x20); + if (ent != NULL) { + PositionRelative(this, ent, 0x180000, -0xa0000); + } + } +} + +void sub_08068884(Entity* this) { + this->field_0x68 = sub_0801E99C(this); + sub_08078784(this, this->field_0x68); +} + +void Melari_Head(Entity* this) { + u32 bVar1; + + bVar1 = this->frames.all; + bVar1 &= -0xc1; + SetExtraSpriteFrame(this, 1, this->frameIndex); + if ((bVar1 & 0x20) != 0) { + SetExtraSpriteFrame(this, 0, bVar1 & -0xe1); + SetExtraSpriteFrame(this, 2, 0xff); + SetSpriteSubEntryOffsetData1(this, 1, 0); + } else { + SetExtraSpriteFrame(this, 0, 0xff); + SetExtraSpriteFrame(this, 2, bVar1 & -0xe1); + SetSpriteSubEntryOffsetData2(this, 1, 2); + } + sub_0807000C(this); +} + +void sub_08068910(Entity* this) { + s32 iVar1; + + if (this->actionDelay != 0) { + this->actionDelay--; + } else { + this->actionDelay = 0x10; + if ((this->frames.all & 0x20) != 0) { + iVar1 = sub_0806EDD8(this, 0x30, 0x30); + if (iVar1 < 0) { + iVar1 = 0x10; + } else { + } + iVar1 = sub_0806F5A4(iVar1); + InitializeAnimation(this, (this->animIndex & -0x4) + iVar1); + } + } +} + +void sub_08068964(Entity* this) { + sub_080A7C18(53, 0, 3); + sub_0807CAA0(53, 2); +} + +void Melari_Fusion(Entity* this) { + if (this->action == 0) { + if (LoadExtraSpriteData(this, &gUnk_08111520)) { + this->action++; + this->spriteSettings.b.draw = TRUE; + InitializeAnimation(this, 6); + } + } else { + GetNextFrame(this); + } +} + +void nullsub_502(Entity* this) { +}
\ No newline at end of file diff --git a/src/object/cloud.c b/src/object/cloud.c index 734559c4..027899cd 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -131,7 +131,7 @@ void sub_0809F69C(Entity* this) { void sub_0809F6CC(Entity* this) { if (((gRoomControls.unk6 & 4) == 0) && (--this->actionDelay == 0)) { - gLinkState.unk7 = 1; + gLinkState.field_0x8b = 1; DeleteThisEntity(); } } diff --git a/src/object/jailBars.c b/src/object/jailBars.c new file mode 100644 index 00000000..c72713b6 --- /dev/null +++ b/src/object/jailBars.c @@ -0,0 +1,64 @@ +#include "global.h" +#include "entity.h" +#include "flags.h" +#include "room.h" + +extern void sub_080A0960(Entity*, u32); +extern void PlaySFX(u32); +extern void sub_0801AF18(u8*, u32, u32); + +extern void (*const gUnk_08124950[])(Entity*); +extern u8 gUnk_08124960; +extern u8 gUnk_0812497A; + +void JailBars(Entity *this) +{ + gUnk_08124950[this->action](this); +} + +void sub_080A08C4(Entity *this) +{ + if (CheckFlags(this->field_0x86) == 0) { + this->action = 1; + sub_080A0960(this, 0); + } + else { + this->action = 3; + InitializeAnimation(this,1); + sub_080A0960(this, 1); + } + this->spriteSettings.b.draw = 3; // ??? + this->collisionLayer = 1; + UpdateSpriteForCollisionLayer(this); +} + +void sub_080A0910(Entity *this) +{ + if (CheckFlags(this->field_0x86) != 0) { + this->action = 2; + sub_080A0960(this, 1); + PlaySFX(0x10b); + } +} + +void sub_080A0938(Entity *this) +{ + GetNextFrame(this); + if ((this->frames.b.f3) != 0) { + this->action = 3; + InitializeAnimation(this, 1); + } +} + +void nullsub_127(Entity* this) {} + +void sub_080A0960(Entity *this, u32 arg1) +{ + u8 *puVar1; + + puVar1 = &gUnk_08124960; + if (arg1 == 1) { + puVar1 = &gUnk_0812497A; + } + sub_0801AF18(puVar1, COORD_TO_TILE(this), 1); +}
\ No newline at end of file diff --git a/src/object/object86.c b/src/object/object86.c index 979ab47a..5a1c0aec 100644 --- a/src/object/object86.c +++ b/src/object/object86.c @@ -76,6 +76,6 @@ void sub_08099ECC(Entity *this) this->previousActionFlag = 1; CopyPosition(this, &gLinkEntity); gLinkState.linkAction = 3; - gLinkState.filler12[4] = 0; + gLinkState.field_0x34[4] = 0; gLinkState.flags.all |= 0x8000; } diff --git a/src/object/objectAF.c b/src/object/objectAF.c new file mode 100644 index 00000000..0415398b --- /dev/null +++ b/src/object/objectAF.c @@ -0,0 +1,56 @@ +#include "global.h" +#include "entity.h" + +extern void sub_080A0640(Entity*); +extern void PositionRelative(Entity*, Entity*, s32, s32); +extern void CopyPosition(Entity*, Entity*); + +extern void (*const gUnk_081248C4[])(Entity*); + +void ObjectAF(Entity* this) { + gUnk_081248C4[this->action](this); +} + +void sub_080A05A4(Entity* this) { + if ((this->entityType).form != 2) { + this->action = 1; + this->spritePriority.b0 = 6; + sub_080A0640(this); + InitializeAnimation(this, 1); + } else { + this->action = 2; + this->y.HALF.HI++; + this->height.HALF.HI = 0; + this->spriteOffsetY--; + InitializeAnimation(this, 3); + } +} + +void sub_080A05F4(Entity* this) { + if (this->parent == NULL) { + this->action = 2; + InitializeAnimation(this, 2); + } else { + if (this->parent->field_0x4 == NULL) { + DeleteThisEntity(); + } + sub_080A0640(this); + GetNextFrame(this); + } +} + +void sub_080A0624(Entity* this) { + GetNextFrame(this); + if ((this->frames.b.f3) != 0) { + DeleteThisEntity(); + } +} + +void sub_080A0640(Entity* this) { + if (this->entityType.form == 0) { + PositionRelative(*(Entity**)(this->parent->otherEntity + 0x4), this, 0, 0x80000); + } else { + CopyPosition(this->parent, this); + } + this->height.HALF.HI = 0; +}
\ No newline at end of file diff --git a/src/object/objectB2.c b/src/object/objectB2.c new file mode 100644 index 00000000..3c7e7fe2 --- /dev/null +++ b/src/object/objectB2.c @@ -0,0 +1,44 @@ +#include "global.h" +#include "entity.h" + +extern void sub_0806F69C(Entity*); +extern u32 sub_080AE4CC(Entity*, u32, u32, u32); + +extern void* gUnk_02027EB4; +extern void* gUnk_0200D654; + +#if 0 + +void ObjectB2(Entity *this) +{ + void* pEVar3; + + if (this->action == 0) { + this->action = 1; + this->actionDelay = 0x10; + this->direction = (this->entityType).form << 3; + if (this->collisionLayer == 2) { + pEVar3 = &gUnk_0200D654; + } + else { + pEVar3 = &gUnk_02027EB4; + } + this->attachedEntity = pEVar3; + InitializeAnimation(this, this->entityType.form); + } + this->nonPlanarMovement = this->parent->nonPlanarMovement; + sub_0806F69C(this); + if (sub_080AE4CC(this->attachedEntity, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) { + DeleteThisEntity(); + } + if (this->nonPlanarMovement < 0x41) { + this->spriteSettings.b.draw ^= 1; + + if (--this->actionDelay == 0) { + DeleteThisEntity(); + } + } + GetNextFrame(this); +} + +#endif
\ No newline at end of file diff --git a/src/ocarina.c b/src/ocarina.c index b4eddddc..326e4c0d 100644 --- a/src/ocarina.c +++ b/src/ocarina.c @@ -34,7 +34,7 @@ void OcarinaUse(ItemBehavior* itemBeh, s32 inputFlags) { if (gLinkState.linkAction == 24) { sub_08077E78(itemBeh, inputFlags); } else { - itemBeh->unk4 |= 15; + itemBeh->field_0x5[4] |= 15; gLinkEntity.animationState = 4; var = gLinkEntity.spriteSettings.raw & ~0x40; gLinkEntity.spriteSettings.raw &= var; @@ -42,10 +42,10 @@ void OcarinaUse(ItemBehavior* itemBeh, s32 inputFlags) { gLinkEntity.flags &= 127; gLinkEntity.field_0x7a = 2; gLinkState.flags.all |= 0x10000000; - gLinkState.filler8[0] = 255; + gLinkState.field_0x27[0] = 255; gUnk_02034490 = 1; bVar1 = (8 >> inputFlags); - gLinkState.unk3 |= bVar1; + gLinkState.field_0xa |= bVar1; gLinkState.keepFacing |= bVar1; sub_08078F60(); sub_08077D38(itemBeh, inputFlags); |
