diff options
| author | notyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com> | 2020-07-15 20:52:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-15 20:52:03 -0700 |
| commit | e7ae99c1fab713a66b57e9602da69ffaa4652f1c (patch) | |
| tree | a91f9e616335f1d5691a215f364a90be152c1257 /src | |
| parent | 400807e932ff1bd27b59c4a2cedeaa988d15ffd7 (diff) | |
| parent | 75223bab243e67eb7233edf32ffd8a15a94c6b34 (diff) | |
Merge pull request #26 from notyouraveragehooman/master
keese.c, input.c
Diffstat (limited to 'src')
| -rw-r--r-- | src/code_08077DF4.c | 4 | ||||
| -rw-r--r-- | src/enemy/keese.c | 31 | ||||
| -rw-r--r-- | src/input.c | 44 | ||||
| -rw-r--r-- | src/item11.c | 2 | ||||
| -rw-r--r-- | src/npc/tingleSiblings.c | 43 | ||||
| -rw-r--r-- | src/npc/townsperson.c | 12 |
6 files changed, 124 insertions, 12 deletions
diff --git a/src/code_08077DF4.c b/src/code_08077DF4.c index 467cbe35..3897a273 100644 --- a/src/code_08077DF4.c +++ b/src/code_08077DF4.c @@ -18,7 +18,7 @@ void sub_08077DF4(Entity *ent, u32 arg1) if ((arg1 & 0xff) > 0xb8) { arg1 += (ent->entityType).form >> 1; } - gLinkEntity.spriteTileSize = (short)(arg1 >> 8); + gLinkEntity.spriteIndex = (short)(arg1 >> 8); InitAnimationForceUpdate(&gLinkEntity, (u8)arg1); sub_08077E54(ent); } @@ -38,7 +38,7 @@ void sub_08077E3C(Entity *ent) void sub_08077E54(Entity *ent) { ent->action = gLinkEntity.animIndex; - *(u8 *)&ent->spriteTileSize = gLinkEntity.frameIndex; + *(u8 *)&ent->spriteIndex = gLinkEntity.frameIndex; ent->previousActionFlag = gLinkEntity.frameDuration; ent->actionDelay = gLinkEntity.frames.all; } diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 0cbc9acd..ea25214b 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -14,6 +14,8 @@ extern void sub_08021EF0(Entity*); extern void sub_080AEFB4(Entity*); extern void sub_08021F24(Entity*); extern u32 sub_0806FCB8(Entity*, s32, s32, u32); +extern u32 sub_08049FA0(Entity*); +extern u32 sub_08049EE4(Entity*); extern void (*gUnk_080CB69C[])(Entity*); extern void (*gUnk_080CB6B4[])(Entity*); @@ -21,9 +23,7 @@ extern void (*gUnk_080CB6C4[])(Entity*); extern u8 gUnk_080CB6D0[]; extern u16 gUnk_080CB6D6[]; - - -extern u8 gUnk_080CB6D0[]; +extern u8 gUnk_080CB6F6[]; void Keese(Entity *this) { @@ -129,3 +129,28 @@ void sub_08021EF0(Entity *this) this->field_0x7a = 0x3c; InitializeAnimation(this, 0); } + +void sub_08021F24(Entity *this) +{ + u32 bVar1; + + if (this->field_0x78.HWORD == 0) { + this->action = 2; + this->actionDelay = gUnk_080CB6F6[Random() & 0xf]; + InitializeAnimation(this, 1); + } + else if (!this->field_0x7a && !(sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x70))) { + this->action = 3; + this->actionDelay = 0x1e; + InitializeAnimation(this, 1); + } + else { + if (sub_08049FA0(this) != 0) { + this->direction = Random() & 0x1f; + } + else { + this->direction = sub_08049EE4(this); + } + InitializeAnimation(this, 0); + } +}
\ No newline at end of file diff --git a/src/input.c b/src/input.c new file mode 100644 index 00000000..df5b2290 --- /dev/null +++ b/src/input.c @@ -0,0 +1,44 @@ +#include "global.h" +#include "entity.h" + +typedef struct { + u16 field_0x0; + u16 field_0x2; + u16 field_0x4; + u8 field_0x6; + u8 field_0x7; +} Input; + +void StoreKeyInput(Input *pkeyInput, u32 ioKeyInput); + +extern Input gUnk_03000FF0; + +void ReadKeyInput(void) +{ + u32 reg = ~*(u16*)0x04000130 & 0x3FF; + Input* input = &gUnk_03000FF0; + StoreKeyInput(input, reg); +} + +void StoreKeyInput(Input *input, u32 ioKeyInput) +{ + u32 difference; + u32 temp = input->field_0x0; + + difference = ioKeyInput & ~temp; + input->field_0x2 = difference; + if (ioKeyInput == temp) { + if (--input->field_0x7 == 0) { + input->field_0x7 = 4; + input->field_0x4 = ioKeyInput; + } + else { + input->field_0x4 = 0; + } + } + else { + input->field_0x7 = 0x14; + input->field_0x4 = difference; + } + input->field_0x0 = ioKeyInput; +}
\ No newline at end of file diff --git a/src/item11.c b/src/item11.c index 4f90bba6..b464bdd9 100644 --- a/src/item11.c +++ b/src/item11.c @@ -56,7 +56,7 @@ void sub_08018CBC(Entity *this) } this->action = 2; this->spriteSettings.b.draw = 1; - this->spriteTileSize = 0xa6; + this->spriteIndex = 0xa6; this->palette = 0x33; this->spriteVramOffset = 0; (this->entityType).form = gLinkState.field_0x1d[0] - 1; diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c new file mode 100644 index 00000000..ab50c63c --- /dev/null +++ b/src/npc/tingleSiblings.c @@ -0,0 +1,43 @@ +#include "global.h" +#include "entity.h" +#include "npc.h" +#include "textbox.h" + +extern void sub_08064DE4(Entity*); +extern void sub_08064D78(Entity*); +extern void sub_08064EE8(Entity*); + +extern void (*const gUnk_0810FBFC[])(Entity*); + +void TingleSiblings(Entity* this) { + if ((this->flags & 2) != 0) { + sub_08064DE4(this); + } + else { + sub_08064D78(this); + } +} + +void sub_08064D78(Entity* this) { + gUnk_0810FBFC[this->action](this); +} + +void sub_08064D90(Entity* this) { + InitAnimationForceUpdate(this, 2); + this->field_0xf = 1; +} + +void sub_08064DA0(Entity* this) { + sub_08064EE8(this); + if (this->interactType != 0) { + this->action = 2; + InitAnimationForceUpdate(this, 6); + TextboxNoOverlapFollow(0); + } +} + +void sub_08064DCC(Entity* this) { + sub_08064EE8(this); + InitAnimationForceUpdate(this, 2); + this->action = 1; +}
\ No newline at end of file diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 7c4bf877..c99cce93 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -192,7 +192,7 @@ void sub_08061E90(Entity* this, Entity* arg1) { if (arg1->spriteSettings.raw == 0) { arg1->spriteSettings.raw++; - arg1->spriteTileSize = (Random() & 0x3f) + 0x20; + arg1->spriteIndex = (Random() & 0x3f) + 0x20; animIndex = Random() & 0x18; switch (this->direction) { case 0x0: @@ -227,23 +227,23 @@ void sub_08061E90(Entity* this, Entity* arg1) { iVar4 = this->x.HALF.HI - *(s16*)&this->field_0x6a.HWORD; if (0x10 < iVar4) { this->x.HALF.HI = this->field_0x6a.HWORD + 0x10; - arg1->spriteTileSize = 1; + arg1->spriteIndex = 1; } if (iVar4 < -0x10) { this->x.HALF.HI = *(s16*)&this->field_0x6a.HWORD - 0x10; - arg1->spriteTileSize = 1; + arg1->spriteIndex = 1; } iVar4 = this->y.HALF.HI - *(s16*)&this->field_0x6c; if (0x10 < iVar4) { this->y.HALF.HI = *(s16*)&this->field_0x6c + 0x10; - arg1->spriteTileSize = 1; + arg1->spriteIndex = 1; } if (iVar4 < -0x10) { this->y.HALF.HI = *(s16*)&this->field_0x6c - 0x10; - arg1->spriteTileSize = 1; + arg1->spriteIndex = 1; } - if (--arg1->spriteTileSize != 0) { + if (--arg1->spriteIndex != 0) { gUnk_02033280[6] = 0; } } |
