Skip to content

Commit

Permalink
Merge branch 'bomb_arrow' into enhancement_mods
Browse files Browse the repository at this point in the history
  • Loading branch information
lilDavid committed Dec 21, 2023
2 parents 5b34f65 + 426efee commit d74c639
Show file tree
Hide file tree
Showing 16 changed files with 305 additions and 116 deletions.
2 changes: 1 addition & 1 deletion soh/include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ extern "C"
extern u16 gUpgradeCapacities[8][4];
extern u32 gGsFlagsMasks[4];
extern u32 gGsFlagsShifts[4];
extern void* gItemIcons[0x82];
extern void* gItemIcons[0x83];
extern u8 gItemAgeReqs[];
extern u8 gSlotAgeReqs[];
extern u8 gItemSlots[56];
Expand Down
171 changes: 86 additions & 85 deletions soh/include/z64item.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,91 +221,92 @@ typedef enum {
/* 0x44 */ ITEM_BOOTS_KOKIRI,
/* 0x45 */ ITEM_BOOTS_IRON,
/* 0x46 */ ITEM_BOOTS_HOVER,
/* 0x47 */ ITEM_BULLET_BAG_30,
/* 0x48 */ ITEM_BULLET_BAG_40,
/* 0x49 */ ITEM_BULLET_BAG_50,
/* 0x4A */ ITEM_QUIVER_30,
/* 0x4B */ ITEM_QUIVER_40,
/* 0x4C */ ITEM_QUIVER_50,
/* 0x4D */ ITEM_BOMB_BAG_20,
/* 0x4E */ ITEM_BOMB_BAG_30,
/* 0x4F */ ITEM_BOMB_BAG_40,
/* 0x50 */ ITEM_BRACELET,
/* 0x51 */ ITEM_GAUNTLETS_SILVER,
/* 0x52 */ ITEM_GAUNTLETS_GOLD,
/* 0x53 */ ITEM_SCALE_SILVER,
/* 0x54 */ ITEM_SCALE_GOLDEN,
/* 0x55 */ ITEM_SWORD_KNIFE,
/* 0x56 */ ITEM_WALLET_ADULT,
/* 0x57 */ ITEM_WALLET_GIANT,
/* 0x58 */ ITEM_SEEDS,
/* 0x59 */ ITEM_FISHING_POLE,
/* 0x5A */ ITEM_SONG_MINUET,
/* 0x5B */ ITEM_SONG_BOLERO,
/* 0x5C */ ITEM_SONG_SERENADE,
/* 0x5D */ ITEM_SONG_REQUIEM,
/* 0x5E */ ITEM_SONG_NOCTURNE,
/* 0x5F */ ITEM_SONG_PRELUDE,
/* 0x60 */ ITEM_SONG_LULLABY,
/* 0x61 */ ITEM_SONG_EPONA,
/* 0x62 */ ITEM_SONG_SARIA,
/* 0x63 */ ITEM_SONG_SUN,
/* 0x64 */ ITEM_SONG_TIME,
/* 0x65 */ ITEM_SONG_STORMS,
/* 0x66 */ ITEM_MEDALLION_FOREST,
/* 0x67 */ ITEM_MEDALLION_FIRE,
/* 0x68 */ ITEM_MEDALLION_WATER,
/* 0x69 */ ITEM_MEDALLION_SPIRIT,
/* 0x6A */ ITEM_MEDALLION_SHADOW,
/* 0x6B */ ITEM_MEDALLION_LIGHT,
/* 0x6C */ ITEM_KOKIRI_EMERALD,
/* 0x6D */ ITEM_GORON_RUBY,
/* 0x6E */ ITEM_ZORA_SAPPHIRE,
/* 0x6F */ ITEM_STONE_OF_AGONY,
/* 0x70 */ ITEM_GERUDO_CARD,
/* 0x71 */ ITEM_SKULL_TOKEN,
/* 0x72 */ ITEM_HEART_CONTAINER,
/* 0x73 */ ITEM_HEART_PIECE,
/* 0x74 */ ITEM_KEY_BOSS,
/* 0x75 */ ITEM_COMPASS,
/* 0x76 */ ITEM_DUNGEON_MAP,
/* 0x77 */ ITEM_KEY_SMALL,
/* 0x78 */ ITEM_MAGIC_SMALL,
/* 0x79 */ ITEM_MAGIC_LARGE,
/* 0x7A */ ITEM_HEART_PIECE_2,
/* 0x7B */ ITEM_SINGLE_MAGIC,
/* 0x7C */ ITEM_DOUBLE_MAGIC,
/* 0x7D */ ITEM_DOUBLE_DEFENSE,
/* 0x7E */ ITEM_INVALID_4,
/* 0x7F */ ITEM_INVALID_5,
/* 0x80 */ ITEM_INVALID_6,
/* 0x81 */ ITEM_INVALID_7,
/* 0x82 */ ITEM_MILK,
/* 0x83 */ ITEM_HEART,
/* 0x84 */ ITEM_RUPEE_GREEN,
/* 0x85 */ ITEM_RUPEE_BLUE,
/* 0x86 */ ITEM_RUPEE_RED,
/* 0x87 */ ITEM_RUPEE_PURPLE,
/* 0x88 */ ITEM_RUPEE_GOLD,
/* 0x89 */ ITEM_INVALID_8,
/* 0x8A */ ITEM_STICKS_5,
/* 0x8B */ ITEM_STICKS_10,
/* 0x8C */ ITEM_NUTS_5,
/* 0x8D */ ITEM_NUTS_10,
/* 0x8E */ ITEM_BOMBS_5,
/* 0x8F */ ITEM_BOMBS_10,
/* 0x90 */ ITEM_BOMBS_20,
/* 0x91 */ ITEM_BOMBS_30,
/* 0x92 */ ITEM_ARROWS_SMALL,
/* 0x93 */ ITEM_ARROWS_MEDIUM,
/* 0x94 */ ITEM_ARROWS_LARGE,
/* 0x95 */ ITEM_SEEDS_30,
/* 0x96 */ ITEM_BOMBCHUS_5,
/* 0x97 */ ITEM_BOMBCHUS_20,
/* 0x98 */ ITEM_STICK_UPGRADE_20,
/* 0x99 */ ITEM_STICK_UPGRADE_30,
/* 0x9A */ ITEM_NUT_UPGRADE_30,
/* 0x9B */ ITEM_NUT_UPGRADE_40,
ITEM_BOW_ARROW_BOMB,
/* 0x48 */ ITEM_BULLET_BAG_30,
/* 0x49 */ ITEM_BULLET_BAG_40,
/* 0x4a */ ITEM_BULLET_BAG_50,
/* 0x4B */ ITEM_QUIVER_30,
/* 0x4C */ ITEM_QUIVER_40,
/* 0x4D */ ITEM_QUIVER_50,
/* 0x4E */ ITEM_BOMB_BAG_20,
/* 0x4F */ ITEM_BOMB_BAG_30,
/* 0x50 */ ITEM_BOMB_BAG_40,
/* 0x51 */ ITEM_BRACELET,
/* 0x52 */ ITEM_GAUNTLETS_SILVER,
/* 0x53 */ ITEM_GAUNTLETS_GOLD,
/* 0x54 */ ITEM_SCALE_SILVER,
/* 0x55 */ ITEM_SCALE_GOLDEN,
/* 0x56 */ ITEM_SWORD_KNIFE,
/* 0x57 */ ITEM_WALLET_ADULT,
/* 0x58 */ ITEM_WALLET_GIANT,
/* 0x59 */ ITEM_SEEDS,
/* 0x5a */ ITEM_FISHING_POLE,
/* 0x5B */ ITEM_SONG_MINUET,
/* 0x5C */ ITEM_SONG_BOLERO,
/* 0x5D */ ITEM_SONG_SERENADE,
/* 0x5E */ ITEM_SONG_REQUIEM,
/* 0x5F */ ITEM_SONG_NOCTURNE,
/* 0x60 */ ITEM_SONG_PRELUDE,
/* 0x61 */ ITEM_SONG_LULLABY,
/* 0x62 */ ITEM_SONG_EPONA,
/* 0x63 */ ITEM_SONG_SARIA,
/* 0x64 */ ITEM_SONG_SUN,
/* 0x65 */ ITEM_SONG_TIME,
/* 0x66 */ ITEM_SONG_STORMS,
/* 0x67 */ ITEM_MEDALLION_FOREST,
/* 0x68 */ ITEM_MEDALLION_FIRE,
/* 0x69 */ ITEM_MEDALLION_WATER,
/* 0x6a */ ITEM_MEDALLION_SPIRIT,
/* 0x6B */ ITEM_MEDALLION_SHADOW,
/* 0x6C */ ITEM_MEDALLION_LIGHT,
/* 0x6D */ ITEM_KOKIRI_EMERALD,
/* 0x6E */ ITEM_GORON_RUBY,
/* 0x6F */ ITEM_ZORA_SAPPHIRE,
/* 0x70 */ ITEM_STONE_OF_AGONY,
/* 0x71 */ ITEM_GERUDO_CARD,
/* 0x72 */ ITEM_SKULL_TOKEN,
/* 0x73 */ ITEM_HEART_CONTAINER,
/* 0x74 */ ITEM_HEART_PIECE,
/* 0x75 */ ITEM_KEY_BOSS,
/* 0x76 */ ITEM_COMPASS,
/* 0x77 */ ITEM_DUNGEON_MAP,
/* 0x78 */ ITEM_KEY_SMALL,
/* 0x79 */ ITEM_MAGIC_SMALL,
/* 0x7a */ ITEM_MAGIC_LARGE,
/* 0x7B */ ITEM_HEART_PIECE_2,
/* 0x7C */ ITEM_SINGLE_MAGIC,
/* 0x7D */ ITEM_DOUBLE_MAGIC,
/* 0x7E */ ITEM_DOUBLE_DEFENSE,
/* 0x7F */ ITEM_INVALID_4,
/* 0x80 */ ITEM_INVALID_5,
/* 0x81 */ ITEM_INVALID_6,
/* 0x82 */ ITEM_INVALID_7,
/* 0x83 */ ITEM_MILK,
/* 0x84 */ ITEM_HEART,
/* 0x85 */ ITEM_RUPEE_GREEN,
/* 0x86 */ ITEM_RUPEE_BLUE,
/* 0x87 */ ITEM_RUPEE_RED,
/* 0x88 */ ITEM_RUPEE_PURPLE,
/* 0x89 */ ITEM_RUPEE_GOLD,
/* 0x8a */ ITEM_INVALID_8,
/* 0x8B */ ITEM_STICKS_5,
/* 0x8C */ ITEM_STICKS_10,
/* 0x8D */ ITEM_NUTS_5,
/* 0x8E */ ITEM_NUTS_10,
/* 0x8F */ ITEM_BOMBS_5,
/* 0x90 */ ITEM_BOMBS_10,
/* 0x91 */ ITEM_BOMBS_20,
/* 0x92 */ ITEM_BOMBS_30,
/* 0x93 */ ITEM_ARROWS_SMALL,
/* 0x94 */ ITEM_ARROWS_MEDIUM,
/* 0x95 */ ITEM_ARROWS_LARGE,
/* 0x96 */ ITEM_SEEDS_30,
/* 0x97 */ ITEM_BOMBCHUS_5,
/* 0x98 */ ITEM_BOMBCHUS_20,
/* 0x99 */ ITEM_STICK_UPGRADE_20,
/* 0x9a */ ITEM_STICK_UPGRADE_30,
/* 0x9B */ ITEM_NUT_UPGRADE_30,
/* 0x9C */ ITEM_NUT_UPGRADE_40,
/* 0xFC */ ITEM_LAST_USED = 0xFC,
/* 0xFE */ ITEM_NONE_FE = 0xFE,
/* 0xFF */ ITEM_NONE = 0xFF
Expand Down
8 changes: 4 additions & 4 deletions soh/include/z64player.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ typedef enum {
/* 0x09 */ PLAYER_IA_BOW_FIRE,
/* 0x0A */ PLAYER_IA_BOW_ICE,
/* 0x0B */ PLAYER_IA_BOW_LIGHT,
/* 0x0C */ PLAYER_IA_BOW_0C,
/* 0x0C */ PLAYER_IA_BOW_BOMB,
/* 0x0D */ PLAYER_IA_BOW_0D,
/* 0x0E */ PLAYER_IA_BOW_0E,
/* 0x0F */ PLAYER_IA_SLINGSHOT,
Expand Down Expand Up @@ -426,14 +426,14 @@ typedef struct {
#define PLAYER_STATE1_ENEMY_TARGET (1 << 4)
#define PLAYER_STATE1_INPUT_DISABLED (1 << 5)
#define PLAYER_STATE1_TEXT_ON_SCREEN (1 << 6)
#define PLAYER_STATE1_DEAD (1 << 7)
#define PLAYER_STATE1_DEAD (1 << 7)
#define PLAYER_STATE1_START_PUTAWAY (1 << 8)
#define PLAYER_STATE1_READY_TO_FIRE (1 << 9)
#define PLAYER_STATE1_GETTING_ITEM (1 << 10)
#define PLAYER_STATE1_ITEM_OVER_HEAD (1 << 11)
#define PLAYER_STATE1_CHARGING_SPIN_ATTACK (1 << 12)
#define PLAYER_STATE1_HANGING_OFF_LEDGE (1 << 13)
#define PLAYER_STATE1_CLIMBING_LEDGE (1 << 14)
#define PLAYER_STATE1_CLIMBING_LEDGE (1 << 14)
#define PLAYER_STATE1_TARGETING (1 << 15)
#define PLAYER_STATE1_TARGET_LOCKED (1 << 16)
#define PLAYER_STATE1_TARGET_NOTHING (1 << 17)
Expand Down Expand Up @@ -490,7 +490,7 @@ typedef struct {
#define PLAYER_STATE3_PAUSE_ACTION_FUNC (1 << 2)
#define PLAYER_STATE3_FINISHED_ATTACKING (1 << 3)
#define PLAYER_STATE3_CHECK_FLOOR_WATER_COLLISION (1 << 4)
#define PLAYER_STATE3_FORCE_PULL_OCARINA (1 << 5)
#define PLAYER_STATE3_FORCE_PULL_OCARINA (1 << 5)
#define PLAYER_STATE3_RESTORE_NAYRUS_LOVE (1 << 6) // Set by ocarina effects actors when destroyed to signal Nayru's Love may be restored (see `ACTOROVL_ALLOC_ABSOLUTE`)
#define PLAYER_STATE3_HOOKSHOT_TRAVELLING (1 << 7) //Travelling to target

Expand Down
5 changes: 3 additions & 2 deletions soh/soh/Enhancements/custom-message/CustomMessageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ void CustomMessage::Replace(std::string&& oldStr, std::string&& newEnglish, std:

void CustomMessage::Format(ItemID iid) {
for (std::string* str : { &english, &french, &german }) {
str->insert(0, ITEM_OBTAINED(iid));
// HACK: this is so messed up
str->insert(0, ITEM_OBTAINED(iid > ITEM_BOW_ARROW_BOMB ? iid - 1 : iid));
size_t start_pos = 0;
std::replace(str->begin(), str->end(), '&', NEWLINE()[0]);
while ((start_pos = str->find('^', start_pos)) != std::string::npos) {
Expand Down Expand Up @@ -253,7 +254,7 @@ bool CustomMessageManager::ClearMessageTable(std::string tableID) {
return true;
}

bool CustomMessageManager::AddCustomMessageTable(std::string tableID) {
bool CustomMessageManager::AddCustomMessageTable(std::string tableID) {
CustomMessageTable newMessageTable;
return messageTables.emplace(tableID, newMessageTable).second;
}
1 change: 1 addition & 0 deletions soh/soh/Enhancements/presets.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ const std::vector<const char*> enhancementsCvars = {
"gAddTraps.Speed",
"gAddTraps.Tele",
"gAddTraps.Void",
"gBombArrows",
};

const std::vector<const char*> cheatCvars = {
Expand Down
2 changes: 2 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ void DrawEnhancementsMenu() {
UIWidgets::Tooltip("Catch Poes by swinging an empty bottle at them instead of from a text box like you can in Majora's Mask.");
UIWidgets::PaddedEnhancementCheckbox("Nuts explode bombs", "gNutsExplodeBombs", true, false);
UIWidgets::Tooltip("Makes nuts explode bombs, similar to how they interact with bombchus. This does not affect bombflowers.");
UIWidgets::PaddedEnhancementCheckbox("Bomb Arrows", "gBombArrows", true, false);
UIWidgets::Tooltip("Equip bombs onto the same button as your bow to shoot arrows that explode on impact");
UIWidgets::PaddedEnhancementCheckbox("Equip Multiple Arrows at Once", "gSeparateArrows", true, false);
UIWidgets::Tooltip("Allow the bow and magic arrows to be equipped at the same time on different slots. (Note this will disable the behaviour of the 'Equip Dupe' glitch)");
UIWidgets::PaddedEnhancementCheckbox("Switch Arrow Types", "gArrowSwitching", true, false);
Expand Down
1 change: 1 addition & 0 deletions soh/src/code/code_80097A00.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void* gItemIcons[] = {
gItemIconBootsKokiriTex,
gItemIconBootsIronTex,
gItemIconBootsHoverTex,
gItemIconBowFireTex,
gItemIconBulletBag30Tex,
gItemIconBulletBag40Tex,
gItemIconBulletBag50Tex,
Expand Down
9 changes: 6 additions & 3 deletions soh/src/code/z_message_PAL.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) {
sIconEnvColors[1] = color;
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
sIconPrimColors[0] = (Color_RGB8){ 0, 200, 80 };
sIconPrimColors[1] = (Color_RGB8){ 50, 255, 130 };
sIconEnvColors[1] = (Color_RGB8){ 50, 255, 130 };
sIconPrimColors[1] = (Color_RGB8){ 50, 255, 130 };
sIconEnvColors[1] = (Color_RGB8){ 50, 255, 130 };
}
static Color_RGB8 sIconPrim = { 0, 80, 200 };
static s16 sIconFlashTimer = 12;
Expand Down Expand Up @@ -1132,6 +1132,9 @@ void Message_LoadItemIcon(PlayState* play, u16 itemId, s16 y) {
interfaceCtx->mapPalette[30] = 0xFF;
interfaceCtx->mapPalette[31] = 0xFF;
}
if (itemId > ITEM_BOW_ARROW_BOMB) {
itemId += 1;
}
if (itemId < ITEM_MEDALLION_FOREST) {
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language];
R_TEXTBOX_ICON_YPOS = y + 6;
Expand Down Expand Up @@ -3139,7 +3142,7 @@ void Message_Update(PlayState* play) {
if (msgCtx->msgLength == 0) {
return;
}

GameInteractor_ExecuteOnDialogMessage();

bool isB_Held = CVarGetInteger("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) && !sTextboxSkipped
Expand Down
11 changes: 8 additions & 3 deletions soh/src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -4863,14 +4863,18 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) {
i = gSaveContext.equips.buttonItems[button];

if ((i == ITEM_STICK) || (i == ITEM_NUT) || (i == ITEM_BOMB) || (i == ITEM_BOW) ||
((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) || (i == ITEM_SLINGSHOT) || (i == ITEM_BOMBCHU) ||
(i == ITEM_BEAN)) {
((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) || (i == ITEM_BOW_ARROW_BOMB) || (i == ITEM_SLINGSHOT) ||
(i == ITEM_BOMBCHU) || (i == ITEM_BEAN)) {

if ((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) {
i = ITEM_BOW;
}

ammo = AMMO(i);
if (i == ITEM_BOW_ARROW_BOMB) {
ammo = MIN(AMMO(ITEM_BOW), AMMO(ITEM_BOMB));
} else {
ammo = AMMO(i);
}

gDPPipeSync(OVERLAY_DISP++);

Expand All @@ -4885,6 +4889,7 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) {
}
} else if (((i == ITEM_BOW) && (AMMO(i) == CUR_CAPACITY(UPG_QUIVER))) ||
((i == ITEM_BOMB) && (AMMO(i) == CUR_CAPACITY(UPG_BOMB_BAG))) ||
((i == ITEM_BOW_ARROW_BOMB) && MIN(AMMO(ITEM_BOW), AMMO(ITEM_BOMB)) == MIN(CUR_CAPACITY(UPG_QUIVER), CUR_CAPACITY(UPG_BOMB_BAG))) ||
((i == ITEM_SLINGSHOT) && (AMMO(i) == CUR_CAPACITY(UPG_BULLET_BAG))) ||
((i == ITEM_STICK) && (AMMO(i) == CUR_CAPACITY(UPG_STICKS))) ||
((i == ITEM_NUT) && (AMMO(i) == CUR_CAPACITY(UPG_NUTS))) || ((i == ITEM_BOMBCHU) && (ammo == 50)) ||
Expand Down
Loading

0 comments on commit d74c639

Please sign in to comment.