Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to allow progressive items to give all the upgrades at once #2108

Open
wants to merge 46 commits into
base: Dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
de6b3bb
logic for upgrading bow
AngheloAlf Oct 5, 2023
c49f09c
wire up the guy
AngheloAlf Oct 5, 2023
d8f5845
build files
AngheloAlf Oct 5, 2023
88fd7fa
stuff
AngheloAlf Oct 5, 2023
553c1bc
autogenerated stuff
AngheloAlf Oct 6, 2023
007ed82
bow seems to work
AngheloAlf Oct 6, 2023
622d603
macro cleanup
AngheloAlf Oct 6, 2023
3b65fde
checks for most progressive items
AngheloAlf Oct 6, 2023
5d6bd3e
magic upgradeful
AngheloAlf Oct 6, 2023
6461238
whoops
AngheloAlf Oct 6, 2023
d4a3fe3
testing
AngheloAlf Oct 6, 2023
00d5b4d
upgradeful bow
AngheloAlf Oct 6, 2023
8f5c2c7
fix bombbag and slingshot
AngheloAlf Oct 6, 2023
0544e6e
Various fixes
AngheloAlf Oct 6, 2023
824a699
tooltip
AngheloAlf Oct 6, 2023
5c38195
cleanups
AngheloAlf Oct 6, 2023
9e363f7
Change UPGRADEFUL_ITEM_FLAGS to uint16_t
AngheloAlf Oct 6, 2023
002f573
Wording
AngheloAlf Oct 6, 2023
356f9ea
CI
AngheloAlf Oct 6, 2023
6d94b46
tooltip
AngheloAlf Oct 6, 2023
3f7c926
Add all the upgradeful items to item_table.c and ItemList.py
AngheloAlf Oct 6, 2023
21b2812
Rename to Max Upgrade
AngheloAlf Oct 6, 2023
7eee920
Add Max Upgrade items to ItemPool
AngheloAlf Oct 6, 2023
f1407b9
Better ItemPool.py Implementation
Cuphat Oct 6, 2023
4041518
hint list placeholders
AngheloAlf Oct 7, 2023
5c60da3
hints
AngheloAlf Oct 7, 2023
c5bd519
change plando file
AngheloAlf Oct 7, 2023
9610848
Properly give Adult's Wallet or Tycoon's Wallet depending if shopsani…
AngheloAlf Oct 7, 2023
06d4170
Remove UPGRADEFUL_ITEM_FLAGS
AngheloAlf Oct 8, 2023
1d3c4d4
more explanation on the tooltip
AngheloAlf Oct 8, 2023
4adcc38
Remove symbols and use raw addresses instead
AngheloAlf Oct 8, 2023
a4e4d9c
Move to Other Misc
AngheloAlf Oct 8, 2023
b9c18f0
remove unused stuff
AngheloAlf Oct 8, 2023
45502bf
Merge remote-tracking branch 'upstream/Dev' into upgradeful_item_2
AngheloAlf Dec 25, 2023
ef08c80
update build files
AngheloAlf Dec 25, 2023
9961082
Move index to 0x011B
AngheloAlf Jan 19, 2024
9f1191d
Merge remote-tracking branch 'upstream/Dev' into upgradeful_item_2
AngheloAlf May 17, 2024
7e816f9
rerun build
AngheloAlf May 17, 2024
211f4f8
Update SettingsList.py
AngheloAlf May 17, 2024
c4dc491
Update Patches.py
AngheloAlf May 17, 2024
2c4a263
Merge remote-tracking branch 'upstream/Dev' into upgradeful_item_2
AngheloAlf Sep 1, 2024
57d7a47
generated files
AngheloAlf Sep 1, 2024
111c7c2
Merge remote-tracking branch 'upstream/Dev' into upgradeful_item_2
AngheloAlf Sep 30, 2024
5cf21fa
Update stuff
AngheloAlf Sep 30, 2024
6254814
generated files
AngheloAlf Oct 1, 2024
0d6d936
presets?
AngheloAlf Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,082 changes: 545 additions & 537 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
676 changes: 342 additions & 334 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion ASM/c/actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ void Actor_StoreChestType(z64_actor_t* actor, z64_game_t* game) {
if (POTCRATE_TEXTURES_MATCH_CONTENTS == PTMC_UNCHECKED && override.key.all > 0) { // For "unchecked" PTMC setting: Check if we have an override which means it wasn't collected.
*pChestType = GILDED_CHEST;
} else if(POTCRATE_TEXTURES_MATCH_CONTENTS == PTMC_CONTENTS) {
uint16_t item_id = resolve_upgrades(override);
item_row_t *row = get_item_row(override.value.looks_like_item_id);
if (row == NULL) {
row = get_item_row(override.value.base.item_id);
Expand Down
18 changes: 18 additions & 0 deletions ASM/c/item_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,21 @@ void unlock_ocarina_note(z64_file_t *save, int16_t arg1, int16_t arg2) {
break;
}
}

void give_max_upgrade_bomb_bag(z64_file_t *save, int16_t arg1, int16_t arg2) {
z64_Inventory_ChangeUpgrade(UPG_BOMB_BAG, 3);
INV_CONTENT(ITEM_BOMB) = ITEM_BOMB;
AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 3);
}

void give_max_upgrade_bow(z64_file_t *save, int16_t arg1, int16_t arg2) {
z64_Inventory_ChangeUpgrade(UPG_QUIVER, 3);
INV_CONTENT(ITEM_BOW) = ITEM_BOW;
AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 3);
}

void give_max_upgrade_slingshot(z64_file_t *save, int16_t arg1, int16_t arg2) {
z64_Inventory_ChangeUpgrade(UPG_BULLET_BAG, 3);
INV_CONTENT(ITEM_SLINGSHOT) = ITEM_SLINGSHOT;
AMMO(ITEM_SLINGSHOT) = CAPACITY(UPG_BULLET_BAG, 3);
}
3 changes: 3 additions & 0 deletions ASM/c/item_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ void give_bombchus(z64_file_t *save, int16_t arg1, int16_t arg2);
void trade_quest_upgrade(z64_file_t *save, int16_t item_id, int16_t arg2);
extern uint8_t KEYRING_BOSSKEY_CONDITION;
void unlock_ocarina_note(z64_file_t *save, int16_t arg1, int16_t arg2);
void give_max_upgrade_bomb_bag(z64_file_t *save, int16_t arg1, int16_t arg2);
void give_max_upgrade_bow(z64_file_t *save, int16_t arg1, int16_t arg2);
void give_max_upgrade_slingshot(z64_file_t *save, int16_t arg1, int16_t arg2);

typedef enum dungeon {
DEKU_ID = 0,
Expand Down
37 changes: 25 additions & 12 deletions ASM/c/item_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,18 @@ item_row_t item_table[] = {
[0x007E] = ITEM_ROW(0x3E, HEART_CHEST_SMALL, 0x41, -1, 0x90C6, 0x00BD, 0x13, no_upgrade, full_heal, -1, -1, NULL), // Capped Heart Container
[0x007F] = ITEM_ROW(0x53, HEART_CHEST_SMALL, 0x41, -1, 0x90FA, 0x00BD, 0x14, no_upgrade, full_heal, -1, -1, NULL), // Capped Piece of Heart (Chest Game)

[0x0080] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00DD, 0x2D, hookshot_upgrade, no_effect, -1, -1, NULL), // Progressive Hookshot
[0x0081] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x0147, 0x58, strength_upgrade, no_effect, -1, -1, NULL), // Progressive Strength
[0x0082] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00BF, 0x18, bomb_bag_upgrade, no_effect, -1, -1, NULL), // Progressive Bomb Bag
[0x0083] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00E9, 0x35, bow_upgrade, no_effect, -1, -1, NULL), // Progressive Bow
[0x0084] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00E7, 0x33, slingshot_upgrade, no_effect, -1, -1, NULL), // Progressive Slingshot
[0x0085] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00D1, 0x22, wallet_upgrade, no_effect, -1, -1, NULL), // Progressive Wallet
[0x0086] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00DB, 0x2A, scale_upgrade, no_effect, -1, -1, NULL), // Progressive Scale
[0x0087] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00BB, 0x12, nut_upgrade, no_effect, -1, -1, NULL), // Progressive Nut Capacity
[0x0088] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00C7, 0x1B, stick_upgrade, no_effect, -1, -1, NULL), // Progressive Stick Capacity
[0x0089] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00D9, 0x28, bombchu_upgrade, no_effect, -1, -1, NULL), // Progressive Bombchus
[0x008A] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00CD, 0x1E, magic_upgrade, no_effect, -1, -1, NULL), // Progressive Magic Meter
[0x008B] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x010E, 0x46, ocarina_upgrade, no_effect, -1, -1, NULL), // Progressive Ocarina
[0x0080] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00DD, 0x2D, hookshot_upgrade, no_effect, -1, -1, NULL), // Progressive Hookshot
[0x0081] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x0147, 0x58, strength_upgrade, no_effect, -1, -1, NULL), // Progressive Strength
[0x0082] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00BF, 0x18, bomb_bag_upgrade, no_effect, -1, -1, NULL), // Progressive Bomb Bag
[0x0083] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00E9, 0x35, bow_upgrade, no_effect, -1, -1, NULL), // Progressive Bow
[0x0084] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00E7, 0x33, slingshot_upgrade, no_effect, -1, -1, NULL), // Progressive Slingshot
[0x0085] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00D1, 0x22, wallet_upgrade, no_effect, -1, -1, NULL), // Progressive Wallet
[0x0086] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00DB, 0x2A, scale_upgrade, no_effect, -1, -1, NULL), // Progressive Scale
[0x0087] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00BB, 0x12, nut_upgrade, no_effect, -1, -1, NULL), // Progressive Nut Capacity
[0x0088] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00C7, 0x1B, stick_upgrade, no_effect, -1, -1, NULL), // Progressive Stick Capacity
[0x0089] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00D9, 0x28, bombchu_upgrade, no_effect, -1, -1, NULL), // Progressive Bombchus
[0x008A] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00CD, 0x1E, magic_upgrade, no_effect, -1, -1, NULL), // Progressive Magic Meter
[0x008B] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x010E, 0x46, ocarina_upgrade, no_effect, -1, -1, NULL), // Progressive Ocarina

[0x008C] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x90A0, 0x00C6, 0x01, no_upgrade, give_bottle, 0x15, -1, NULL), // Bottle with Red Potion
[0x008D] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x90A1, 0x00C6, 0x01, no_upgrade, give_bottle, 0x16, -1, NULL), // Bottle with Green Potion
Expand Down Expand Up @@ -328,6 +328,19 @@ item_row_t item_table[] = {
[0x0117] = ITEM_ROW(0x53, SILVER_CHEST, 0x41, -1, 0x00A1, 0x01A1, 0x88, no_upgrade, give_small_key, CASTLE_ID, -1, resolve_text_small_keys), // Ganon's Castle Small Key
[0x0118] = ITEM_ROW(0x53, SILVER_CHEST, 0x41, -1, 0x913E, 0x01A2, 0x89, no_upgrade, give_small_key, TCG_ID, -1, resolve_text_small_keys_cmg), // Small Key (Chest Game)

[0x0119] = ITEM_ROW(0x53, GILDED_CHEST, 0x0B, -1, 0x004F, 0x00DD, 0x2E, no_upgrade, no_effect, -1, -1, NULL), // Max Upgrade Hookshot
[0x011A] = ITEM_ROW(0x53, GILDED_CHEST, 0x52, -1, 0x005C, 0x012D, 0x4A, no_upgrade, no_effect, -1, -1, NULL), // Max Upgrade Strength
fenhl marked this conversation as resolved.
Show resolved Hide resolved
[0x011B] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x90B4, 0x00BF, 0x18, no_upgrade, give_max_upgrade_bomb_bag, -1, -1, NULL), // Max Upgrade Bomb Bag
[0x011C] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x90B5, 0x00E9, 0x35, no_upgrade, give_max_upgrade_bow, -1, -1, NULL), // Max Upgrade Bow
[0x011D] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x90B6, 0x00E7, 0x33, no_upgrade, give_max_upgrade_slingshot, -1, -1, NULL), // Max Upgrade Slingshot
[0x011E] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x00F8, 0x00D1, 0x23, no_upgrade, give_tycoon_wallet, 3, -1, NULL), // Max Upgrade Wallet
[0x011F] = ITEM_ROW(0x53, GILDED_CHEST, 0x54, -1, 0x00CE, 0x00DB, 0x2B, no_upgrade, no_effect, -1, -1, NULL), // Max Upgrade Scale
[0x0120] = ITEM_ROW(0x53, BROWN_CHEST, 0x9B, -1, 0x00A8, 0x00BB, 0x12, no_upgrade, no_effect, -1, -1, NULL), // Max Upgrade Nut
[0x0121] = ITEM_ROW(0x53, BROWN_CHEST, 0x99, -1, 0x0091, 0x00C7, 0x1B, no_upgrade, no_effect, -1, -1, NULL), // Max Upgrade Stick
[0x0122] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x9019, 0x0197, 0x7E, no_upgrade, give_bombchus, 20, -1, NULL), // Max Upgrade Bombchu
[0x0123] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x00E8, 0x00CD, 0x1F, no_upgrade, give_double_magic, -1, -1, NULL), // Max Upgrade Magic
[0x0124] = ITEM_ROW(0x53, GILDED_CHEST, 0x08, -1, 0x003A, 0x00DE, 0x2F, no_upgrade, no_effect, -1, -1, NULL), // Max Upgrade Ocarina

};

/* Determine which message to display based on the number of silver rupees collected.
Expand Down
53 changes: 51 additions & 2 deletions ASM/c/item_upgrades.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,28 @@ extern uint8_t PLAYER_ID;
extern uint8_t MW_PROGRESSIVE_ITEMS_ENABLE;
extern mw_progressive_items_state_t MW_PROGRESSIVE_ITEMS_STATE[256];

uint16_t UPGRADEFUL_ITEM_FLAGS = 0;

uint16_t no_upgrade(z64_file_t *save, override_t override) {
return override.value.base.item_id;
}

uint16_t hookshot_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_HOOKSHOT)) {
return 0x0119; // Max Upgrade Hookshot
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->items[Z64_SLOT_HOOKSHOT] : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].hookshot) {
case -1: case 0: return 0x08; // Hookshot
default: return 0x09; // Longshot
}
}

uint16_t strength_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_STRENGTH)) {
return 0x011A; // Max Upgrade Strength
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->strength_upgrade : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].strength) {
case 0: return 0x54; // Goron Bracelet
case 1: return 0x35; // Silver Gauntlets
Expand All @@ -50,6 +59,10 @@ uint16_t strength_upgrade(z64_file_t *save, override_t override) {
}

uint16_t bomb_bag_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_BOMB_BAG)) {
return 0x011B; // Max Upgrade bomb bag
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->bomb_bag : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].bomb_bag) {
case 0: return 0x32; // Bomb Bag
case 1: return 0x33; // Bigger Bomb Bag
Expand All @@ -58,6 +71,10 @@ uint16_t bomb_bag_upgrade(z64_file_t *save, override_t override) {
}

uint16_t bow_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_BOW)) {
return 0x011C; // Max Upgrade bow
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->quiver : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].bow) {
case 0: return 0x04; // Bow
case 1: return 0x30; // Big Quiver
Expand All @@ -66,6 +83,10 @@ uint16_t bow_upgrade(z64_file_t *save, override_t override) {
}

uint16_t slingshot_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_SLINGSHOT)) {
return 0x011D; // Max Upgrade slingshot
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->bullet_bag : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].slingshot) {
case 0: return 0x05; // Slingshot
case 1: return 0x60; // Bullet Bag (40)
Expand All @@ -74,6 +95,10 @@ uint16_t slingshot_upgrade(z64_file_t *save, override_t override) {
}

uint16_t wallet_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_WALLET)) {
return 0x011E; // Max Upgrade Wallet
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->wallet : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].wallet) {
case 0: return 0x45; // Adult's Wallet
case 1: return 0x46; // Giant's Wallet
Expand All @@ -82,13 +107,21 @@ uint16_t wallet_upgrade(z64_file_t *save, override_t override) {
}

uint16_t scale_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_SCALE)) {
return 0x011F; // Max Upgrade Scale
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->diving_upgrade : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].scale) {
case 0: return 0x37; // Silver Scale
default: return 0x38; // Gold Scale
}
}

uint16_t nut_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_NUT)) {
return 0x0120; // Max Upgrade Nut
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->nut_upgrade : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].nuts) {
case 0: return 0x79; // 30 Nuts. 0 and 1 are both starting capacity
case 1: return 0x79; // 30 Nuts
Expand All @@ -97,6 +130,10 @@ uint16_t nut_upgrade(z64_file_t *save, override_t override) {
}

uint16_t stick_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_STICK)) {
return 0x0121; // Max Upgrade Stick
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->stick_upgrade : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].sticks) {
case 0: return 0x77; // 20 Sticks. 0 and 1 are both starting capacity
case 1: return 0x77; // 20 Sticks
Expand All @@ -105,23 +142,35 @@ uint16_t stick_upgrade(z64_file_t *save, override_t override) {
}

uint16_t magic_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_MAGIC)) {
return 0x0123; // Max Upgrade Magic
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->magic_acquired : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].magic) {
case 0: return 0xB9; // Single Magic
default: return 0xBA; // Double Magic
}
}

uint16_t bombchu_upgrade(z64_file_t *save, override_t override) {
if (save->items[Z64_SLOT_BOMBCHU] == -1) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_BOMBCHU)) {
return 0x0122; // Max Upgrade Bombchu
}

if (INV_CONTENT(ITEM_BOMBCHU) == ITEM_NONE) {
return 0x6B; // Bombchu 20 pack
}
if (save->ammo[8] <= 5) {
if (AMMO(ITEM_BOMBCHU) <= 5) {
return 0x03; // Bombchu 10 pack
}
return 0x6A; // Bombchu 5 pack
}

uint16_t ocarina_upgrade(z64_file_t *save, override_t override) {
if (UPGRADEFUL_ITEM_FLAGS & (1 << PROG_ID_OCARINA)) {
return 0x0124; // Max Upgrade Ocarina
}

switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->items[Z64_SLOT_OCARINA] : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].ocarina) {
case -1: case 0: return 0x3B; // Fairy Ocarina
default: return 0x0C; // Ocarina of Time
Expand Down
18 changes: 18 additions & 0 deletions ASM/c/item_upgrades.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@
#include "get_items.h"
#include "z64.h"

typedef enum ProgressiveItemIdentifier {
/* 0 */ PROG_ID_HOOKSHOT,
/* 1 */ PROG_ID_STRENGTH,
/* 2 */ PROG_ID_BOMB_BAG,
/* 3 */ PROG_ID_BOW,
/* 4 */ PROG_ID_SLINGSHOT,
/* 5 */ PROG_ID_WALLET,
/* 6 */ PROG_ID_SCALE,
/* 7 */ PROG_ID_NUT,
/* 8 */ PROG_ID_STICK,
/* 9 */ PROG_ID_BOMBCHU,
/* 10 */ PROG_ID_MAGIC,
/* 11 */ PROG_ID_OCARINA,
/* 12 */ PROG_ID_MAX,
} ProgressiveItemIdentifier;

extern uint16_t UPGRADEFUL_ITEM_FLAGS;

extern uint8_t CUSTOM_KEY_MODELS;

uint16_t no_upgrade(z64_file_t *save, override_t override);
Expand Down
26 changes: 26 additions & 0 deletions ASM/c/z64.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "z64.h"

/**
* Symbol addresses from the original game
*
* `.global SYM_NAME` tells the assembler that the symbol should be global,
* i.e. accessable from other files
*
* `.equ SYM_NAME, 0xF00DFACE` sets the symbol `SYM_NAME` to have address
* `0xF00DFACE`
*/

asm("\
.global z64_Inventory_ChangeUpgrade; \
.equ z64_Inventory_ChangeUpgrade, 0x80081294; \
");

asm("\
.global gItemSlots; \
.equ gItemSlots, 0x800F8F34; \
");

asm("\
.global gUpgradeCapacities; \
.equ gUpgradeCapacities, 0x800F8CCC; \
");
18 changes: 18 additions & 0 deletions ASM/c/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1854,11 +1854,27 @@ typedef enum {
} PauseBgPreRenderState;


typedef enum UpgradeType {
/* 0x00 */ UPG_QUIVER,
/* 0x01 */ UPG_BOMB_BAG,
/* 0x02 */ UPG_STRENGTH,
/* 0x03 */ UPG_SCALE,
/* 0x04 */ UPG_WALLET,
/* 0x05 */ UPG_BULLET_BAG,
/* 0x06 */ UPG_DEKU_STICKS,
/* 0x07 */ UPG_DEKU_NUTS,
/* 0x08 */ UPG_MAX
} UpgradeType;

extern uint8_t gItemSlots[56];
extern uint16_t gUpgradeCapacities[UPG_MAX][4];

/* helper macros */
#define LINK_IS_ADULT (z64_file.link_age == 0)
#define SLOT(item) gItemSlots[item]
#define INV_CONTENT(item) z64_file.items[SLOT(item)]
#define AMMO(item) z64_file.ammo[SLOT(item)]
#define CAPACITY(upg, value) gUpgradeCapacities[upg][value]

/* dram addresses */
#define z64_EnItem00Action_addr 0x800127E0
Expand Down Expand Up @@ -2081,6 +2097,8 @@ typedef uint16_t (*z64_Audio_GetActiveSeqId_proc)(uint8_t seqId);
z64_DisplayTextbox_addr)
#define z64_GiveItem ((z64_GiveItem_proc) z64_GiveItem_addr)

void z64_Inventory_ChangeUpgrade(int16_t upgrade, int16_t value);
fenhl marked this conversation as resolved.
Show resolved Hide resolved

#define z64_LinkDamage ((z64_LinkDamage_proc)z64_LinkDamage_addr)
#define z64_LinkInvincibility ((z64_LinkInvincibility_proc) \
z64_LinkInvincibility_addr)
Expand Down
13 changes: 13 additions & 0 deletions ItemList.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,19 @@
'Ocarina C left Button': ('Item', True, 0x0107, {'ocarina_button': True}),
'Ocarina C right Button': ('Item', True, 0x0108, {'ocarina_button': True}),

'Max Upgrade Hookshot': ('Item', True, 0x0119, {'alias': ('Progressive Hookshot', 2), 'progressive': 2}),
'Max Upgrade Strength': ('Item', True, 0x011A, {'alias': ('Progressive Strength Upgrade', 3), 'progressive': 3}),
'Max Upgrade Bomb Bag': ('Item', True, 0x011B, {'alias': ('Bomb Bag', 3), 'progressive': 3}),
'Max Upgrade Bow': ('Item', True, 0x011C, {'alias': ('Bow', 3), 'progressive': 3}),
'Max Upgrade Slingshot': ('Item', True, 0x011D, {'alias': ('Slingshot', 3), 'progressive': 3}),
'Max Upgrade Wallet': ('Item', True, 0x011E, {'alias': ('Progressive Wallet', 3), 'progressive': 3}),
'Max Upgrade Scale': ('Item', True, 0x011F, {'alias': ('Progressive Scale', 2), 'progressive': 2}),
'Max Upgrade Nut': ('Item', True, 0x0120, {'alias': ('Deku Nut Capacity', 2), 'progressive': 2}),
'Max Upgrade Stick': ('Item', True, 0x0121, {'alias': ('Deku Stick Capacity', 2), 'progressive': 2}),
'Max Upgrade Bombchu': ('Item', True, 0x0122, {'alias': ('Bombchus', 1), 'progressive': 1}),
'Max Upgrade Magic': ('Item', True, 0x0123, {'alias': ('Magic Meter', 2), 'progressive': 2}),
'Max Upgrade Ocarina': ('Item', True, 0x0124, {'alias': ('Ocarina', 2), 'progressive': 2}),

# Event items otherwise generated by generic event logic
# can be defined here to enforce their appearance in playthroughs.
'Water Temple Clear': ('Event', True, None, None),
Expand Down
Loading
Loading