diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/createBowEntity.c | 8 | ||||
| -rw-r--r-- | src/enemy/smallPesto.c | 102 |
2 files changed, 96 insertions, 14 deletions
diff --git a/src/createBowEntity.c b/src/createBowEntity.c new file mode 100644 index 00000000..0e1f0ef8 --- /dev/null +++ b/src/createBowEntity.c @@ -0,0 +1,8 @@ +#include "global.h" +#include "entity.h" + +extern void (*const gUnk_080B3E30[])(Entity*); + +void sub_08018FCC(Entity* this){ + gUnk_080B3E30[(this->action)](this); +} diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 94eb8822..299d9219 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -8,25 +8,33 @@ extern u32 sub_0806F3E4(); extern void sub_0804A7D4(Entity*); extern void sub_0804A720(Entity*); extern void sub_080317F8(Entity*); +extern u32 sub_08049FA0(Entity*); +extern u32 Random(); +extern u32 sub_08049EE4(Entity*); +extern void sub_0806F69C(Entity*); extern void (*gUnk_080CE530[])(Entity*); extern void (*gUnk_080CE548[])(Entity*); extern void (*gUnk_080CE554[])(Entity*); -void SmallPesto(Entity *this) -{ +void sub_080317B4(Entity*); +void sub_080317E0(Entity*); +void sub_080317F8(Entity*); +void sub_08031840(Entity*); + +extern BoundingBox gUnk_080CE560; + +void SmallPesto(Entity *this){ gUnk_080CE530[GetNextFunction(this)](this); } -void sub_08031680(Entity *this) -{ +void sub_08031680(Entity *this){ gUnk_080CE548[this->action](this); } void nullsub_152(){} -void sub_0803169C(Entity *this) -{ +void sub_0803169C(Entity *this){ s32 iVar1; GetNextFrame(this); @@ -43,26 +51,92 @@ void sub_0803169C(Entity *this) } } -void sub_080316DC(Entity *this) -{ +void sub_080316DC(Entity *this){ this->previousActionFlag = 1; this->field_0x1d = 0x3c; } -void sub_080316E8(Entity *this) -{ +void sub_080316E8(Entity *this){ sub_0806F4E8(this); } -void sub_080316F0(Entity *this) -{ +void sub_080316F0(Entity *this){ if (sub_0806F3E4()) { sub_0804A7D4(this); } } -void sub_08031704(Entity *this) -{ +void sub_08031704(Entity *this){ sub_0804A720(this); sub_080317F8(this); } + +void sub_08031714(Entity* this){ + u8 newDirection; + sub_080317B4(this); + if(--this->field_0xf == 0){ + this->field_0xf = (Random() & 0xf) + 0x10; + if(sub_08049FA0(this) == 0){ + if((this->field_0xf & 1) != 0){ + this->direction = sub_08049EE4(this); + goto _08031766; + } + } + this->direction += 0x18; + this->direction = ((Random() & 0xe) + this->direction) & 0x1f; + _08031766: + sub_080317E0(this); + } +} + +void sub_08031770(Entity* this){ + if(this->field_0x80.HWORD != 0){ + if(--this->field_0x80.HWORD == 0){ + sub_08031840(this); + } + }else if(this->attachedEntity == NULL){ + this->field_0x80.HWORD = (Random() & 0x7f) | (0x80 << 2); + }else{ + if(this->attachedEntity->next == NULL){ + this->attachedEntity = NULL; + } + } + return; +} + +void sub_080317B4(Entity* this){ + this->height.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; + sub_0806F69C(this); + GetNextFrame(this); +} + + +void sub_080317E0(Entity *this){ + this->animationState = ((u8)(this->direction + 2) & 0x1c) >> 2; + InitializeAnimation(this, this->animationState); +} + +void sub_080317F8(Entity *this){ + u8 newDirection = Random() & 0x18; + this->action = 1; + this->height.HALF.HI = 0x0000FFF4; + this->collisionLayer = 1; + this->field_0x3c |= 0x10; + this->field_0x1c = 1; + this->direction = newDirection; + this->boundingBox = &gUnk_080CE560; + sub_080317E0(this); + this->actionDelay = 0; + this->field_0xf = 0x20; +} + +void sub_08031840(Entity* this){ + Entity *enemy = CreateEnemy(0x2d, this->entityType.form); + if(enemy!= NULL){ + CopyPosition(this, enemy); + enemy->parent = this; + this->attachedEntity = enemy; + enemy->entityType.parameter = 1; + } +} + |
