summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com>2020-08-15 11:20:11 -0700
committerGitHub <noreply@github.com>2020-08-15 11:20:11 -0700
commit0e4397583a8f0ff4eb501e147b833416dfaa74f0 (patch)
tree2ca0edfb6370b7a9bf27887b0b8e90973a482b94 /src
parent68193cff020f05a5ac3fbb2ea5a8292dbfee10ab (diff)
parentc32fcaca51729c416451bd2df4318ab9649f3f03 (diff)
Merge pull request #53 from notyouraveragehooman/master
lilypadSmall.c OK
Diffstat (limited to 'src')
-rw-r--r--src/code_0805436C.c86
-rw-r--r--src/object/lilypadSmall.c68
-rw-r--r--src/sub_08070680.c4
3 files changed, 156 insertions, 2 deletions
diff --git a/src/code_0805436C.c b/src/code_0805436C.c
index 8ada4bd5..47f8f4d2 100644
--- a/src/code_0805436C.c
+++ b/src/code_0805436C.c
@@ -182,6 +182,92 @@ u32 sub_0805457C(u32 arg0, u32 arg1) {
asm(".include \"asm/non_matching/code_0805457C.inc\"");
}
+/*
+extern u8 gUnk_080FE1DD[];
+
+u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
+ u32 prereqID;
+ u32 adjustedParam;
+ u32 uVar1;
+ Entity* itemEntity;
+
+ adjustedParam = (u8)itemParameter;
+ switch (adjustedParam) {
+ case 0x3f:
+ if (!GetInventoryValue(0x40)) {
+ return 0;
+ }
+ if (itemParameter == 0) {
+ adjustedParam = 1;
+ }
+ case 0x5d:
+ if (!GetInventoryValue(0x65)) {
+ return 0;
+ }
+ break;
+ case 0x5e:
+ if (!GetInventoryValue(0x9)) {
+ return 0;
+ }
+ break;
+ case 0x5c:
+ case 0xfc ... 0xfe:
+ if (GetInventoryValue(0x67) == 0) {
+ return 0;
+ }
+ if (3 < gRoomVars.filler[5]) {
+ return 0;
+ }
+
+ if (itemID != 0x5c) {
+ adjustedParam = gUnk_080FE1DD[(Random() & 0x3f) + (itemID - 0xfc) * 0x40];
+ if (adjustedParam == 0) {
+ itemID = 0;
+ }
+ else {
+ itemID = 0x5c;
+ }
+ }
+ break;
+ case 0xff:
+ if (!GetInventoryValue(0x1)) {
+ return 0;
+ }
+ }
+ if (itemID != 0) {
+ if (itemID == 0xff) {
+ itemEntity = CreateEnemy(7, 0);
+ if (itemEntity != NULL) {
+ itemEntity->x.HALF.HI = arg0->x.HALF.HI;
+ itemEntity->y.HALF.HI = arg0->y.HALF.HI;
+ itemEntity->collisionLayer = arg0->collisionLayer;
+ UpdateSpriteOrderAndFlip(itemEntity);
+ }
+ } else {
+ itemEntity = CreateObject(0, itemID, adjustedParam);
+ if (itemEntity != NULL) {
+ if (arg0 == &gPlayerEntity) {
+ itemEntity->actionDelay = 1;
+ } else {
+ itemEntity->actionDelay = 0;
+ }
+ if ((arg0->entityType).type == 6) {
+ if (arg0->entityType.subtype == 99) {
+ arg0->attachedEntity = itemEntity;
+ } else if (arg0->entityType.subtype == 0x1e) {
+ itemEntity->direction = arg0->animationState << 3 | 0x80;
+ itemEntity->nonPlanarMovement = 0xc0;
+ itemEntity->field_0x20 = 0x18000;
+ }
+ }
+ CopyPosition(arg0, itemEntity);
+ }
+ }
+ }
+ return itemID;
+}
+*/
+
void sub_08054870(void)
{
gUnk_080FE2A0[gMenu.menuType]();
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;