mirror of
https://github.com/zeldaret/tmc
synced 2026-07-27 14:52:13 -04:00
Merge remote-tracking branch 'upstream/master' into docs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
+138
-4
@@ -5,8 +5,13 @@
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
|
||||
static void sub_08082824(Entity*);
|
||||
static void sub_08082850(Entity*, Entity*);
|
||||
static void sub_08082608(Entity*);
|
||||
|
||||
extern void (*const gUnk_0811F090[])(Entity*);
|
||||
extern void (*const gUnk_0811F0A8[])(Entity*);
|
||||
extern void (*const gUnk_0811F0C4[])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_080FD338; // TODO: should be const
|
||||
extern BoundingBox gUnk_080FD340; // TODO: should be const
|
||||
@@ -15,10 +20,9 @@ extern u32 sub_08016A30(Entity*);
|
||||
extern u32 sub_080001DA(u32, u32);
|
||||
extern u32 GetTileTypeByEntity(Entity*);
|
||||
extern void sub_08078930(Entity*);
|
||||
extern void sub_08082824(Entity*);
|
||||
extern u32 sub_080002B8(Entity*);
|
||||
extern void sub_08082850(Entity*, Entity*);
|
||||
extern void sub_08082608(Entity*);
|
||||
extern void sub_08016A6C(Entity*);
|
||||
extern u32 sub_0800442E(Entity*);
|
||||
|
||||
void Pot(Entity* this) {
|
||||
gUnk_0811F090[this->action](this);
|
||||
@@ -163,7 +167,137 @@ void sub_080825F0(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08082608(Entity* this) {
|
||||
static void sub_08082608(Entity* this) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
}
|
||||
|
||||
void sub_08082614(Entity* this) {
|
||||
u32 tileType;
|
||||
|
||||
sub_0800445C(this);
|
||||
if (--this->actionDelay != 0xFF) {
|
||||
sub_0806F69C(this);
|
||||
sub_08016A6C(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sub_0800442E(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->action = 1;
|
||||
if (gPlayerState.flags.all & 0x80) {
|
||||
this->nonPlanarMovement <<= 1;
|
||||
}
|
||||
|
||||
this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer);
|
||||
tileType = GetTileTypeByEntity(this);
|
||||
switch (tileType) {
|
||||
case 0x71:
|
||||
case 0x72:
|
||||
sub_08082850(this, NULL);
|
||||
break;
|
||||
default:
|
||||
SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer);
|
||||
sub_08078930(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080826E4(Entity* this) {
|
||||
gUnk_0811F0C4[this->previousActionFlag](this);
|
||||
}
|
||||
|
||||
void sub_080826FC(Entity* this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 48;
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
|
||||
void sub_0808270C(Entity* this) {
|
||||
if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->bitfield & 0x7F) != 0x13) {
|
||||
this->spriteOffsetX = 0;
|
||||
this->action = 1;
|
||||
SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer);
|
||||
} else {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08082778(Entity* this) {
|
||||
if (this->actionDelay == 0) {
|
||||
this->actionDelay = 1;
|
||||
this->spriteOffsetX = 0;
|
||||
this->spriteOffsetY = -2;
|
||||
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
}
|
||||
|
||||
if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->bitfield & 0x7F) != 0x13) {
|
||||
sub_08082850(this, NULL);
|
||||
} else {
|
||||
sub_0806F3E4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080827F8(Entity* this) {
|
||||
if (gPlayerState.field_0x1c == 0) {
|
||||
sub_08082850(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_512(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08082818(Entity* this) {
|
||||
sub_08082850(this, NULL);
|
||||
}
|
||||
|
||||
static void sub_08082824(Entity* this) {
|
||||
if (this->field_0x20 < 0) {
|
||||
this->spriteSettings.b.flipY = 1;
|
||||
}
|
||||
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
sub_08082850(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_08082850(Entity* this, Entity* parent) {
|
||||
u32 parameter = sub_0808288C(this, this->entityType.form, this->field_0x7c.BYTES.byte1, this->entityType.parameter);
|
||||
Entity* fxEntity = CreateFx(this, 5, parameter);
|
||||
if (fxEntity) {
|
||||
fxEntity->parent = parent;
|
||||
}
|
||||
|
||||
if (this->entityType.parameter == 1) {
|
||||
SetFlag(this->field_0x86);
|
||||
}
|
||||
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) {
|
||||
Entity* entity;
|
||||
u32 result = 0;
|
||||
switch (form) {
|
||||
case 0xFF:
|
||||
result = 0;
|
||||
break;
|
||||
case 0:
|
||||
result = 0x80;
|
||||
break;
|
||||
default:
|
||||
entity = CreateObjectWithParent(this, 0, form, arg2);
|
||||
if (entity) {
|
||||
if (arg3 == 2) {
|
||||
entity->actionDelay = 5;
|
||||
entity->field_0x86 = this->field_0x86;
|
||||
} else {
|
||||
entity->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user