text: #include "item_effects.h"
  
  #include "icetrap.h"
  #include "z64.h"
  
  #define rupee_cap ((uint16_t*)0x800F8CEC)
  volatile uint8_t MAX_RUPEES = 0;
  
  void no_effect(z64_file_t *save, int16_t arg1, int16_t arg2) {
  }
  
  void full_heal(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->refill_hearts = 20 * 0x10;
  }
  
  void give_tycoon_wallet(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->wallet = 3;
      if(MAX_RUPEES)
          save->rupees = rupee_cap[save->wallet];
  }
  
  void give_biggoron_sword(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->bgs_flag = 1; // Set flag to make the sword durable
  }
  
  void give_bottle(z64_file_t *save, int16_t bottle_item_id, int16_t arg2) {
      for (int i = Z64_SLOT_BOTTLE_1; i <= Z64_SLOT_BOTTLE_4; i++) {
          if (save->items[i] == -1) {
              save->items[i] = bottle_item_id;
              return;
          }
      }
  }
  
  void give_dungeon_item(z64_file_t *save, int16_t mask, int16_t dungeon_id) {
      save->dungeon_items[dungeon_id].items |= mask;
  }
  
  void give_small_key(z64_file_t *save, int16_t dungeon_id, int16_t arg2) {
      int8_t keys = save->dungeon_keys[dungeon_id];
      if (keys < 0) {
          keys = 0;
      }
      save->dungeon_keys[dungeon_id] = keys + 1;
  }
  
  void give_defense(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->double_defense = 1;
      save->defense_hearts = 20;
      save->refill_hearts = 20 * 0x10;
  }
  
  void give_magic(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->magic_capacity_set = 1; // Set meter level
      save->magic_acquired = 1; // Required for meter to persist on save load
      save->magic_meter_size = 0x30; // Set meter size
      save->magic = 0x30; // Fill meter
  }
  
  void give_double_magic(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->magic_capacity_set = 2; // Set meter level
      save->magic_acquired = 1; // Required for meter to persist on save load
      save->magic_capacity = 1; // Required for meter to persist on save load
      save->magic_meter_size = 0x60; // Set meter size
      save->magic = 0x60; // Fill meter
  }
  
  void give_fairy_ocarina(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->items[Z64_SLOT_OCARINA] = 0x07;
  }
  
  void give_song(z64_file_t *save, int16_t quest_bit, int16_t arg2) {
      save->quest_items |= 1 << quest_bit;
  }
  
  void ice_trap_effect(z64_file_t *save, int16_t arg1, int16_t arg2) {
      push_pending_ice_trap();
  }
  
  void give_bean_pack(z64_file_t *save, int16_t arg1, int16_t arg2) {
      save->items[Z64_SLOT_BEANS] = Z64_ITEM_BEANS;
      save->ammo[14] += 10; // 10 Magic Beans
  }
  
  void fill_wallet_upgrade(z64_file_t *save, int16_t arg1, int16_t arg2) {
      if(MAX_RUPEES)
          save->rupees = rupee_cap[save->wallet + 1];
  }
  