From 693224e16639517d1d7680688b559877e73cf0a8 Mon Sep 17 00:00:00 2001 From: theo3 Date: Fri, 14 Aug 2020 21:56:34 -0700 Subject: [PATCH] CreateItemDrop WIP --- src/code_0805436C.c | 86 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) 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]();