Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This function takes an item value as input, then returns FF if the item doesn't use a slot. If it does use a slot, then it can return FF or some other value. Basically, this function is used to determine if an item has already been obtained (the slot is filled), which is used to convert items into blue rupees.
- uint FUN_801143cc(uint ItemValue) // not get item value, but the actual value of the item to be received
- {
- int loopCounter;
- uint ItemSlot;
- uint ItemSlotCopy;
- undefined *puVar4;
- ItemValue = ItemValue & 0xff;
- ItemSlot = (uint)(byte)(&DAT_801c2078)[ItemValue]; // Loads the slot from the slot table
- ItemSlotCopy = ItemSlot;
- if (0x8a < ItemValue) { // Refill ammo or glitched item
- ItemSlotCopy = (uint)(byte)(&DAT_801c2078)[*(short *)(&DAT_801bf79e + ItemValue * 2)]; // gets slot value from the "Item Refill Slot Table"
- }
- if (ItemValue == 0x6e) { // (unused Gold Skulltula Spirit marker on quest status screen?)
- return 0xff;
- }
- if (ItemValue == 0x31) { // Tingle's map
- return 0xff;
- }
- if (ItemValue == 0x6d) { // Bomber's Notebook
- return 0xff;
- }
- if ((0x4c < ItemValue) && (ItemValue < 0x50)) { // Kokiri/Razor/Gilded Sword
- return 0xff;
- }
- if ((0x50 < ItemValue) && (ItemValue < 0x53)) { // Hero's/Mirror Shield
- return 0xff;
- }
- if (((ItemValue == 0x74) || (ItemValue == 0x75)) || (ItemValue == 0x76)) { // Boss Key/Compass/Map
- if ((*(uint *)(&DAT_801c1b60 + ItemValue * 4) & (uint)(byte)(&DAT_801ef730)[_DAT_801f35a6]) !=0)
- {
- return ItemValue;
- }
- return 0xff;
- }
- if (ItemValue == 0x78) { // Small Key
- return 0xff;
- }
- if ((((ItemValue == 0) || (ItemValue == 7)) || // Ocarina/Bombchus(10)/Hookshot/Lens/Great Fairy Sword/Pictograph Box
- ((ItemValue == 0xf || ((ItemValue == 0xe || (ItemValue == 0x10)))))) || (ItemValue == 0xd)) {
- if ((&DAT_801ef6e0)[ItemSlot] != 0xff) {
- return (uint)(byte)(&DAT_801ef6e0)[ItemSlot];
- }
- return 0xff;
- }
- if ((0x8e < ItemValue) && (ItemValue == 0x92)) { // Bombs(30). This should have been all bomb refills, but the dev made a typo
- if ((_DAT_801ef728 & DAT_801c1dc4) >> ((uint)DAT_801c1e05 & 0x1f) != 0) {
- return 0;
- }
- return 0xff;
- }
- if ((0x96 < ItemValue) && (ItemValue < 0x9b)) { // Bombchu refill
- if ((_DAT_801ef728 & DAT_801c1dc4) >> ((uint)DAT_801c1e05 & 0x1f) != 0) {
- return 0;
- }
- return 0xff;
- }
- if ((ItemValue == 0x53) || (ItemValue == 1)) { // Hero's Bow/Quiver 30
- if ((_DAT_801ef728 & DAT_801c1dc0) >> ((uint)DAT_801c1e04 & 0x1f) != 0) {
- return 0;
- }
- return 0xff;
- }
- if ((ItemValue == 0x54) || (ItemValue == 0x55)) { // Quiver 40/50
- return 0xff;
- }
- if ((ItemValue == 0x56) || (ItemValue == 6)) { // Bombs (20)/Bomb Bag 20
- if ((_DAT_801ef728 & DAT_801c1dc4) >> ((uint)DAT_801c1e05 & 0x1f) != 0) {
- return 0;
- }
- return 0xff;
- }
- if ((0x9a < ItemValue) && (ItemValue < 0x9f)) { // Stick or Nut Capacity upgrade
- return 0xff;
- }
- if ((0x56 < ItemValue) && (ItemValue < 0x5c)) { // Bomb bag 30/40 or any of 3 wallets
- return 0xff;
- }
- if (ItemValue == 10) { // Magic Beans
- return 0xff;
- }
- if (ItemValue != 0xc) { // not powder keg
- if ((ItemValue == 0x7b) || (ItemValue == 0x70)) { // Piece of Heart or Piece of Heart
- return 0xff;
- }
- if (ItemValue == 0x6f) { // Heart Container
- return 0xff;
- }
- if (ItemValue == 0x83) { // Recovery Heart/Blue Rupee
- return 0x83;
- }
- if ((ItemValue == 0x79) || (ItemValue == 0x7a)) { // Blue Rupee/Magic Jar
- if ((DAT_801f0574 & 0x80) != 0) {
- return ItemValue;
- }
- return 0xff;
- }
- if ((0x83 < ItemValue) && (ItemValue < 0x8b)) { // Rupees
- return 0xff;
- }
- if ((0x5c < ItemValue) && (ItemValue < 0x61)) { // Remains
- return 0xff;
- }
- if (ItemValue == 0x11) { // Bottle of Red Potion/OoT Hookshot
- return 0xff;
- }
- if (ItemValue != 0x12) { // not empty bottle
- if ((((ItemValue != 0x18) && (ItemValue != 0x1d)) && (ItemValue != 0x22)) &&
- ((ItemValue != 0x25 && (ItemValue != 0x26)))) { // not // Milk, Poe, Gold Dust, Chateau Romani, Hylian Loach
- if ((((ItemValue < 0x13) || (0x27 < ItemValue)) &&
- ((ItemValue != 0x9f && (((ItemValue != 0xa0 && (ItemValue != 0xa1)) && (ItemValue != 0xa2))))))
- && (ItemValue != 0xa3)) {
- if ((0x27 < ItemValue) && (ItemValue < 0x4a)) { // Trade Item or Mask
- return 0xff;
- }
- }
- else {
- if ((ItemValue == 0x18) || (ItemValue == 0x19)) { // Milk or Halfmilk
- loopCounter = 0;
- puVar4 = &DAT_801ef670 + ItemSlot;
- while( true ) { // loop 6 times for bottle slots
- loopCounter = (loopCounter + 1) * 0x10000 >> 0x10;
- if (puVar4[0x70] == -1) {
- return 0xff;
- }
- if (5 < loopCounter)
- break;
- puVar4 = &DAT_801ef670 + ItemSlot + loopCounter;
- }
- }
- else {
- if (ItemValue == 0x9f) { // Chateau Romani
- ItemSlot = (uint)DAT_801c209d;
- }
- else {
- if (ItemValue == 0xa0) { // Milk
- ItemSlot = (uint)DAT_801c2090;
- }
- else {
- if (ItemValue == 0xa1) { // Gold Dust
- ItemSlot = (uint)DAT_801c209a;
- }
- else {
- if (ItemValue == 0xa2) { // Hylian Loach
- ItemSlot = (uint)DAT_801c209e;
- }
- else {
- if (ItemValue == 0xa3) { // Seahorse
- ItemSlot = (uint)DAT_801c209c;
- }
- }
- }
- }
- }
- loopCounter = 0;
- puVar4 = &DAT_801ef670 + ItemSlot;
- while( true ) { // loop 6 times
- loopCounter = (loopCounter + 1) * 0x10000 >> 0x10;
- if (puVar4[0x70] == '\x12') {
- return 0xff;
- }
- if (5 < loopCounter)
- break;
- puVar4 = &DAT_801ef670 + ItemSlot + loopCounter;
- }
- }
- }
- return (uint)(byte)(&DAT_801ef6e0)[ItemSlotCopy]; // item in the inventory slot
- }
- return 0xff; // Milk, Poe, Gold Dust, Chateau Romani, Hylian Loach
- }
- return 0xff; // empty bottle
- }
- return 0xff; // powder keg (1)
- }
- /* The full logic for determining if an item is converted into a blue rupee is the following:
- itemInSlot = FUN_801143cc(ItemValue)
- if (flag & 0x40 == 1) && (itemInSlot == 0xFF)
- get blue rupee
- else if (itemInSlot == 0xFF) || (flag & 0x20 == 0)
- get item from chest content table
- else
- get blue rupee
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement