Skip to content

Commit

Permalink
Made Merrick items impossible to take to prevent any kind of crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinopony committed Sep 25, 2022
1 parent 08e2173 commit 8cb314f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/patches/patch_fix_throwables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@ class PatchFixThrowables : public GamePatch
uint32_t offset_2 = data.get_long_le(OBJECT_PROPERTIES_TABLE_START + offset_1);
return OBJECT_PROPERTIES_TABLE_START + offset_2;
}
// TODO: This patch doesn't work for now


void alter_datas_file(BinaryFile& data, const GameData& game_data, const RandomizerWorld& world) override
{
// Prevent Merrick items from being taken and thrown to prevent any crash
data.set_byte(0x1EBF9E8, 0x00);
data.set_byte(0x1EBF9FC, 0x00);
data.set_byte(0x1EBFA10, 0x00);

// TODO: This patch doesn't work for now, so we just prevent Merrick items from being thrown
/*
constexpr uint8_t VALID_THROWABLE_ITEM_ID = ITEM_HERBS;
// Extract the first 8 bytes of object properties for a valid item object
uint32_t valid_bytes_addr = get_object_properties_addr(data, ITEM_HERBS);
uint32_t valid_bytes_addr = get_object_properties_addr(data, VALID_THROWABLE_ITEM_ID);
ByteArray valid_bytes = data.get_bytes(valid_bytes_addr, valid_bytes_addr + 8);
// Now, we apply those "valid bytes" to every item object
Expand All @@ -39,5 +46,6 @@ class PatchFixThrowables : public GamePatch
uint32_t bytes_addr = get_object_properties_addr(data, item_id);
data.set_bytes(bytes_addr, valid_bytes);
}
*/
}
};
2 changes: 2 additions & 0 deletions src/patches/patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "patch_remove_items_fanfare.hpp"
#include "patch_fix_wrong_map_transitions.hpp"
#include "patch_fix_item_names_in_textboxes.hpp"
#include "patch_fix_throwables.hpp"

void execute_patches(const std::vector<GamePatch*>& patches,
BinaryFile& data_file, PsxExeFile& exe_file,
Expand Down Expand Up @@ -46,6 +47,7 @@ void apply_randomizer_patches(BinaryFile& data, PsxExeFile& exe,
patches.emplace_back(new PatchSetKingSnowDeathCount(options.king_snow_death_count()));
patches.emplace_back(new PatchRemoveItemsFanfare());
patches.emplace_back(new PatchFixItemNamesInTextboxes());
patches.emplace_back(new PatchFixThrowables());

if(options.original_game_balance())
patches.emplace_back(new PatchOriginalGameBalance());
Expand Down

0 comments on commit 8cb314f

Please sign in to comment.