Merge pull request #87 from notyouraveragehooman/pr

hiddenLadderDown.c, started bird.c
This commit is contained in:
notyouraveragehooman
2020-09-15 19:27:38 -07:00
committed by GitHub
8 changed files with 195 additions and 526 deletions
+144
View File
@@ -0,0 +1,144 @@
#include "global.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
extern void (*const gUnk_08123EC0[])(Entity*);
extern void (*const gUnk_08123EEC[])(Entity*);
extern void (*const gUnk_08123EF4[])(Entity*);
extern void (*const gUnk_08123EFC[])(Entity*);
extern void (*const gUnk_08123F04[])(Entity*);
void Bird(Entity* this) {
gUnk_08123EC0[this->entityType.form](this);
}
void sub_0809CF3C(Entity* this) {
gUnk_08123EEC[this->action](this);
}
void sub_0809CF54(Entity* this) {
Entity* target;
this->action++;
this->spriteSettings.b.draw = TRUE;
this->actionDelay = 0x31;
this->field_0xf = 1;
this->field_0x20 = -0x18000;
this->height.WORD = -0x38C000;
this->field_0x68.HWORD = -0x800;
this->nonPlanarMovement = 0x280;
this->direction = 8;
this->collisionLayer = 2;
this->x.HALF.HI = gRoomControls.roomScrollX;
PlaySFX(0x123);
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0);
target = CreateObject(0x95, 1, 0);
if (target != NULL) {
target->parent = this;
PositionRelative(this, target, 0, 0x80000);
ResolveEntityOnTop(this, target);
}
}
void sub_0809CFEC(Entity* this) {
sub_0806F69C(this);
sub_08003FC4(this, *(s16*)&this->field_0x68.HWORD);
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
this->field_0xf = 0;
}
} else if (sub_080040A8(this) == 0) {
DeleteThisEntity();
}
UpdateAnimationSingleFrame(this);
}
void sub_0809D030(Entity* this) {
gUnk_08123EF4[this->action](this);
}
void sub_0809D048(Entity* this) {
this->action++;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0x17);
}
void sub_0809D06C(Entity* this) {
gUnk_08123EFC[this->previousActionFlag](this);
}
void sub_0809D084(Entity* this) {
u32 temp;
if (this->parent != NULL) {
temp = this->parent->field_0xf;
if (temp != 0) {
PositionRelative(this->parent, this, 0, 0x80000);
} else {
this->previousActionFlag++;
this->field_0x20 = temp;
}
}
}
void sub_0809D0AC(Entity* this) {
Entity* fx;
if (sub_080044EC(this, 0x1800) < 2) {
(this->entityType).form = 2;
this->action = 1;
this->height.WORD = 0;
this->collisionLayer = 1;
SetLocalFlag(0x45);
PlaySFX(0x72);
fx = CreateFx(this, 0x11, 0);
if (fx != NULL) {
sub_0806FAD8(this, fx);
}
}
}
void sub_0809D0F4(Entity* this) {
gUnk_08123F04[this->action](this);
}
void sub_0809D10C(Entity* this) {
this->action++;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0x17);
}
void sub_0809D130(Entity* this) {
if ((gPlayerState.flags.all & 0x80) != 0) {
sub_0800445C(this);
} else if (sub_08017850(this) != 0) {
CreateItemEntity(0x17, 0, 0);
gUnk_02002A40.windcrests |= 0x10000000;
DeleteThisEntity();
}
}
void sub_0809D178(Entity* this) {
if (this->action == 0) {
this->action++;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
this->frames.all = 0x80;
}
if ((this->frames.all & 0x80) != 0) {
InitializeAnimation(this, Random() & 3);
this->frameDuration = (Random() & 0xf) + 0x10;
this->spriteSettings.b.flipX = FALSE;
if ((Random() & 1) != 0) {
this->spriteSettings.b.flipX = TRUE;
}
} else {
GetNextFrame(this);
}
}
+1 -3
View File
@@ -5,9 +5,7 @@
extern void DeleteThisEntity();
extern void sub_08080CB4(Entity*);
extern int sub_08017850(Entity*);
extern void CreateItemEntity(u32, u32, u32);
extern u32 sub_08017850(Entity*);
static void sub_0808E6A0(Entity*);
static void sub_0808E6E4(Entity*);
static void sub_0808E714(Entity*);
+44
View File
@@ -0,0 +1,44 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "room.h"
#include "flags.h"
extern void (*const gUnk_08122604[])(Entity*);
void HiddenLadderDown(Entity* this) {
if (this->action < 2) {
gUnk_08122604[this->action](this);
}
}
void sub_08091F14(Entity* this) {
u16* puVar3;
this->action = 1;
this->spritePriority.b0 = 7;
this->animIndex = 0;
this->field_0x70.HALF.LO = COORD_TO_TILE(this);
puVar3 = &this->field_0x70.HALF.LO;
if (CheckFlags(this->field_0x86) != 0) {
this->action = 2;
this->spriteSettings.b.draw = TRUE;
SetTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer);
SetTileType(0x1a3, *puVar3 - 0x40, this->collisionLayer);
SetTileType(0x1a4, *puVar3 - 0x3f, this->collisionLayer);
SetTileType(0x1a5, *puVar3 - 1, this->collisionLayer);
SetTileType(0x1a6, *puVar3, this->collisionLayer);
SetTileType(0x1a7, *puVar3 + 1, this->collisionLayer);
SetTileType(0x1a8, *puVar3 + 0x3f, this->collisionLayer);
SetTileType(0x1a9, *puVar3 + 0x40, this->collisionLayer);
SetTileType(0x1aa, *puVar3 + 0x41, this->collisionLayer);
}
}
void sub_08092000(Entity* this) {
if (GetTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) {
this->action = 2;
this->spriteSettings.b.draw = TRUE;
SetFlag(this->field_0x86);
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "entity.h"
extern void CreateItemEntity(u32, u32, u32);
extern Entity* CreateItemEntity(u32, u32, u32);
extern void DeleteThisEntity();
extern void sub_08080CB4(Entity*);