diff --git a/src/createBowEntity.c b/src/createBowEntity.c index 5f3c4f39..0e1f0ef8 100644 --- a/src/createBowEntity.c +++ b/src/createBowEntity.c @@ -1,8 +1,8 @@ #include "global.h" +#include "entity.h" -extern long (*gUnk_080B3E30[])(u8*); +extern void (*const gUnk_080B3E30[])(Entity*); -long sub_08018FCC(u8 *r0) -{ - return gUnk_080B3E30[(r0[0xC])](r0); +void sub_08018FCC(Entity* this){ + gUnk_080B3E30[(this->action)](this); } diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 441cb09d..299d9219 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -24,20 +24,17 @@ void sub_08031840(Entity*); extern BoundingBox gUnk_080CE560; -void SmallPesto(Entity *this) -{ +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); @@ -54,97 +51,91 @@ 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* entity){ +void sub_08031714(Entity* this){ u8 newDirection; - sub_080317B4(entity); - if(--entity->field_0xf == 0){ - entity->field_0xf = (Random() & 0xf) + 0x10; - if(sub_08049FA0(entity) == 0){ - if((entity->field_0xf & 1) != 0){ - entity->direction = sub_08049EE4(entity); + 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; } } - entity->direction += 0x18; - entity->direction = ((Random() & 0xe) + entity->direction) & 0x1f; + this->direction += 0x18; + this->direction = ((Random() & 0xe) + this->direction) & 0x1f; _08031766: - sub_080317E0(entity); - + sub_080317E0(this); } } -void sub_08031770(Entity* entity){ - if(entity->field_0x80.HWORD != 0){ - if(--entity->field_0x80.HWORD == 0){ - sub_08031840(entity); +void sub_08031770(Entity* this){ + if(this->field_0x80.HWORD != 0){ + if(--this->field_0x80.HWORD == 0){ + sub_08031840(this); } - }else if(entity->attachedEntity == NULL){ - entity->field_0x80.HWORD = (Random() & 0x7f) | (0x80 << 2); + }else if(this->attachedEntity == NULL){ + this->field_0x80.HWORD = (Random() & 0x7f) | (0x80 << 2); }else{ - if(entity->attachedEntity->next == NULL){ - entity->attachedEntity = NULL; + if(this->attachedEntity->next == NULL){ + this->attachedEntity = NULL; } } return; } -void sub_080317B4(Entity* entity){ - - entity->height.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; - sub_0806F69C(entity); - GetNextFrame(entity); +void sub_080317B4(Entity* this){ + this->height.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; + sub_0806F69C(this); + GetNextFrame(this); } -void sub_080317E0(Entity *entity){ - entity->animationState = ((u8)(entity->direction + 2) & 0x1c) >> 2; - InitializeAnimation(entity, entity->animationState); +void sub_080317E0(Entity *this){ + this->animationState = ((u8)(this->direction + 2) & 0x1c) >> 2; + InitializeAnimation(this, this->animationState); } -void sub_080317F8(Entity *entity){ +void sub_080317F8(Entity *this){ u8 newDirection = Random() & 0x18; - entity->action = 1; - entity->height.HALF.HI = 0x0000FFF4; - entity->collisionLayer = 1; - entity->field_0x3c |= 0x10; - entity->field_0x1c = 1; - entity->direction = newDirection; - entity->boundingBox = &gUnk_080CE560; - sub_080317E0(entity); - entity->actionDelay = 0; - entity->field_0xf = 0x20; + 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* entity){ - Entity *enemy = CreateEnemy(0x2d, entity->entityType.form); +void sub_08031840(Entity* this){ + Entity *enemy = CreateEnemy(0x2d, this->entityType.form); if(enemy!= NULL){ - CopyPosition(entity, enemy); - enemy->parent = entity; - entity->attachedEntity = enemy; + CopyPosition(this, enemy); + enemy->parent = this; + this->attachedEntity = enemy; enemy->entityType.parameter = 1; } }