diff options
| author | theo3 <arisstephenson2@gmail.com> | 2020-08-15 11:18:00 -0700 |
|---|---|---|
| committer | theo3 <arisstephenson2@gmail.com> | 2020-08-15 11:18:00 -0700 |
| commit | c32fcaca51729c416451bd2df4318ab9649f3f03 (patch) | |
| tree | 2ca0edfb6370b7a9bf27887b0b8e90973a482b94 /src | |
| parent | d9572b3a03cb542c0209a64dd314c6e1b7b223e5 (diff) | |
lilypadSmall.c OK
Diffstat (limited to 'src')
| -rw-r--r-- | src/object/lilypadSmall.c | 68 | ||||
| -rw-r--r-- | src/sub_08070680.c | 4 |
2 files changed, 70 insertions, 2 deletions
diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c new file mode 100644 index 00000000..b6df8e8f --- /dev/null +++ b/src/object/lilypadSmall.c @@ -0,0 +1,68 @@ +#include "global.h" +#include "entity.h" +#include "functions.h" +#include "player.h" + +extern Entity* GetCurrentRoomProperty(u32); +extern void sub_080A2CC0(Entity*, Entity**, u16*); + +extern u16 gUnk_08123318[]; + +void LilypadSmall(Entity *this) +{ + u32 rand; + u16 *psVar4; + + if (this->action == 0) { + this->action = 1; + this->actionDelay = 0x5a; + rand = Random(); + this->field_0xf = rand; + this->frameIndex = (rand >> 0x10) & 3; + this->spriteSettings.b.draw = TRUE; + this->spritePriority.b0 = 7; + this->attachedEntity = GetCurrentRoomProperty(this->entityType.parameter); + sub_080A2CC0(this, &this->attachedEntity, &this->field_0x70.HALF.LO); + } + sub_080A2BE4(this, sub_08097ADC(this)); + sub_08097B24(this); + psVar4 = (u16 *)&this->field_0x70; + if (--*psVar4 == 0) { + sub_080A2CC0(this, &this->attachedEntity, psVar4); + } +} + +u32 sub_08097ADC(Entity *this) +{ + if ((gPlayerState.flags.all & 0x80) == 0) { + return 0; + } else if (sub_080041A0(this,&gPlayerEntity,8,8) == 0) { + return 0; + } else if (sub_08079F8C() == 0) { + return 0; + } else { + gPlayerState.field_0x14 = 1; + if (gPlayerEntity.height.HALF.HI != 0) { + return 0; + } else { + return 1; + } + } +} + +void sub_08097B24(Entity *this) +{ + u32 temp; + u32 temp2; + u16 *temp3; + + if (--this->actionDelay == 0) { + this->actionDelay = 0x5a; + this->frameIndex = (this->frameIndex + 1) & 3; + } + temp3 = gUnk_08123318; + temp2 = ++this->field_0xf; + + temp = temp3[(temp2 >> 5) & 7]; + sub_0805EC9C(this, temp, temp, 0); +}
\ No newline at end of file diff --git a/src/sub_08070680.c b/src/sub_08070680.c index 642167df..f99b745e 100644 --- a/src/sub_08070680.c +++ b/src/sub_08070680.c @@ -20,8 +20,8 @@ void sub_08070698(Entity *this) Entity *ent; gPlayerState.field_0x0[0] = 0xff; - gPlayerState.field_0x14[1] = gPlayerEntity.x.HALF.HI; - gPlayerState.field_0x14[2] = gPlayerEntity.y.HALF.HI; + gPlayerState.field_0x16[0] = gPlayerEntity.x.HALF.HI; + gPlayerState.field_0x16[1] = gPlayerEntity.y.HALF.HI; this->flags = this->flags | 0x80; this->spritePriority.b0 = 0xc; this->spritePriority.b1 = 1; |
