mirror of
https://github.com/zeldaret/tmc
synced 2026-08-10 19:17:33 -04:00
Match CreateItemDrop
This commit is contained in:
+93
-3
@@ -6,6 +6,8 @@
|
||||
#include "common.h"
|
||||
#include "save.h"
|
||||
#include "item.h"
|
||||
#include "object.h"
|
||||
#include "enemy.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk;
|
||||
@@ -30,6 +32,8 @@ Returns the slot the item is equipped in.
|
||||
1: B
|
||||
2: Not equipped
|
||||
*/
|
||||
extern u8 gUnk_080FE1DD[];
|
||||
|
||||
u32 IsItemEquipped(u32 itemID) {
|
||||
u32 itemSlot;
|
||||
|
||||
@@ -173,10 +177,96 @@ ASM_FUNC("asm/non_matching/eu/sub_0805457C.inc", u32 sub_0805457C(u32 arg0, u32
|
||||
ASM_FUNC("asm/non_matching/sub_0805457C.inc", u32 sub_0805457C(u32 arg0, u32 arg1));
|
||||
#endif
|
||||
|
||||
NONMATCH("asm/non_matching/CreateItemDrop.inc", u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter)) {
|
||||
// TODO see below
|
||||
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
|
||||
u32 prereqID;
|
||||
u32 adjustedParam = itemParameter;
|
||||
u32 uVar1;
|
||||
Entity* itemEntity;
|
||||
|
||||
switch (itemID) {
|
||||
case 0xff:
|
||||
if (!GetInventoryValue(0x1)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 0x5d:
|
||||
if (!GetInventoryValue(0x65)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 0x5e:
|
||||
if (!GetInventoryValue(0x9)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 0x3f: {
|
||||
if (!GetInventoryValue(0x40)) {
|
||||
return 0;
|
||||
}
|
||||
if (itemParameter == 0) {
|
||||
adjustedParam = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x5c:
|
||||
case 0xfc ... 0xfe: {
|
||||
u32 tmp, tmp2;
|
||||
u32 rand;
|
||||
u8* ptr;
|
||||
|
||||
if (GetInventoryValue(0x67) == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (3 < gRoomVars.filler1[0]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (itemID != 0x5c) {
|
||||
adjustedParam = itemID - 0xfc;
|
||||
rand = (Random() & 0x3f);
|
||||
ptr = gUnk_080FE1DD;
|
||||
adjustedParam = gUnk_080FE1DD[(rand + adjustedParam * 0x40)];
|
||||
if (adjustedParam == 0) {
|
||||
itemID = 0;
|
||||
} else {
|
||||
itemID = 0x5c;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (itemID != 0) {
|
||||
if (itemID != 0xff) {
|
||||
itemEntity = CreateObject(GROUND_ITEM, itemID, adjustedParam);
|
||||
if (itemEntity != NULL) {
|
||||
if (arg0 == &gPlayerEntity) {
|
||||
itemEntity->actionDelay = 1;
|
||||
} else {
|
||||
itemEntity->actionDelay = 0;
|
||||
}
|
||||
if (arg0->kind == 6) {
|
||||
if (arg0->id == 99) {
|
||||
arg0->child = itemEntity;
|
||||
} else if (arg0->id == 0x1e) {
|
||||
itemEntity->direction = arg0->animationState << 3 | 0x80;
|
||||
itemEntity->speed = 0xc0;
|
||||
itemEntity->zVelocity = 0x18000;
|
||||
}
|
||||
}
|
||||
CopyPosition(arg0, itemEntity);
|
||||
}
|
||||
} else {
|
||||
itemEntity = CreateEnemy(BEETLE, 0);
|
||||
if (itemEntity != NULL) {
|
||||
itemEntity->x.HALF.HI = arg0->x.HALF.HI;
|
||||
itemEntity->y.HALF.HI = arg0->y.HALF.HI;
|
||||
itemEntity->collisionLayer = arg0->collisionLayer;
|
||||
UpdateSpriteForCollisionLayer(itemEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemID;
|
||||
}
|
||||
END_NONMATCH
|
||||
/*
|
||||
extern u8 gUnk_080FE1DD[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user