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

Scl redo #9

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ae77635
Port initial framework up to latest dev-rando. Includes about 15 item…
Malkierian Jun 28, 2024
f02ca59
Most other item variables ported to SaveContext in UpdateHelpers.
Malkierian Jun 28, 2024
df741f8
Removed individual Context retrievals in favor of single local variab…
Malkierian Jul 1, 2024
379045e
start of some diagnostics.
Malkierian Jul 3, 2024
68ed369
more diagnostics
Malkierian Jul 4, 2024
4aa1b5d
Resolve major logic issue with SetInventory flow in ApplyItemEffect.
Malkierian Jul 9, 2024
d4dfa19
Added a bit of logging.
Malkierian Jul 9, 2024
6a7b67a
revert hint gen bypass
Malkierian Jul 9, 2024
bb0085f
item_list *actually* divorced from logicVar pointers.
Malkierian Jul 14, 2024
a9c31bf
Some formatting
Malkierian Jul 15, 2024
b8e3c01
Bit more formatting.
Malkierian Jul 15, 2024
fd739ef
Couple review changes.
Malkierian Jul 16, 2024
986822d
Merge branch 'develop-rando' of github.com:Malkierian/Shipwright into…
Malkierian Jul 23, 2024
ede8c54
Incorporate progressive upgrades and skeleton key into SCL.
Malkierian Jul 24, 2024
e8e7e51
Change `inLogic` to static array.
Malkierian Jul 24, 2024
20fce7e
Merge branch 'develop-rando' of github.com:Malkierian/Shipwright into…
Malkierian Jul 26, 2024
d32e37e
Fix bug in `BottleCount()` preventing Jabu Jabu from ever being in lo…
Malkierian Jul 26, 2024
553fd22
Fix bomb bag HasItem check.
Malkierian Jul 26, 2024
dddef97
Merge branch 'scl-redo' of github.com:Malkierian/Shipwright into scl-…
Malkierian Jul 30, 2024
341ece2
Fix Gerudo Fortress and Ganon's Castle SmallKeys checks.
Malkierian Jul 30, 2024
a1896eb
Change all logic use of `bool remove` to be `bool state` and work on …
Malkierian Jul 30, 2024
500d140
Forgot the `Set(x)` uses in `Logic::Reset()`.
Malkierian Jul 30, 2024
ee822df
Fix fishing pole effect application.
Malkierian Jul 30, 2024
08d33c8
fishing pole tweak
Malkierian Jul 30, 2024
5effd11
Add `RG_BOMB_BAG`, `RG_NUTS` and `RG_STICKS` to `HasItem()`.
Malkierian Jul 31, 2024
180f897
Change mSaveContext to simple pointer.
Malkierian Jul 31, 2024
3c69f03
Rename all remaining references of LogicVar to variants of LogicVal.
Malkierian Jul 31, 2024
aa90b96
Change final references to song LogicVars to CanUse calls, and remove…
Malkierian Aug 1, 2024
a3c75fb
Separate equip and rand inf flag maps.
Malkierian Aug 2, 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 change: 1 addition & 0 deletions soh/include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ extern "C"
extern u16 gEquipMasks[4];
extern u16 gEquipNegMasks[4];
extern u32 gUpgradeMasks[8];
extern u32 gUpgradeNegMasks[8];
extern u8 gEquipShifts[4];
extern u8 gUpgradeShifts[8];
extern u16 gUpgradeCapacities[8][4];
Expand Down
15 changes: 15 additions & 0 deletions soh/include/z64item.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,21 @@ typedef enum {
/* 0xFF */ ITEM_NONE = 0xFF
} ItemID;

typedef enum {
EQUIP_FLAG_SWORD_KOKIRI = 1 << 0,
EQUIP_FLAG_SWORD_MASTER = 1 << 1,
EQUIP_FLAG_SWORD_BGS = 1 << 2,
EQUIP_FLAG_SHIELD_DEKU = 1 << 4,
EQUIP_FLAG_SHIELD_HYLIAN = 1 << 5,
EQUIP_FLAG_SHIELD_MIRROR = 1 << 6,
EQUIP_FLAG_TUNIC_KOKIRI = 1 << 8,
EQUIP_FLAG_TUNIC_GORON = 1 << 9,
EQUIP_FLAG_TUNIC_ZORA = 1 << 10,
EQUIP_FLAG_BOOTS_KOKIRI = 1 << 12,
EQUIP_FLAG_BOOTS_IRON = 1 << 13,
EQUIP_FLAG_BOOTS_HOVER = 1 << 14,
} EquipmentFlag;

#define ITEM_TRADE_CHILD ITEM_WEIRD_EGG
#define ITEM_TRADE_ADULT ITEM_POCKET_EGG

Expand Down
16 changes: 12 additions & 4 deletions soh/soh/Enhancements/randomizer/3drando/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ std::vector<RandomizerCheck> GetAccessibleLocations(const std::vector<Randomizer
int gsCount = 0;
const int maxGsCount = mode == SearchMode::GeneratePlaythrough ? GetMaxGSCount() : 0; //If generating playthrough want the max that's possibly useful, else doesn't matter
bool bombchusFound = false;
std::vector<std::variant<bool*, uint8_t*>> buyIgnores;
std::vector<LogicVal> buyIgnores;

//Variables for search
std::vector<Rando::ItemLocation*> newItemLocations;
Expand Down Expand Up @@ -365,9 +365,9 @@ std::vector<RandomizerCheck> GetAccessibleLocations(const std::vector<Randomizer
else if (IsBombchus(ignore) && IsBombchus(locItem, true)) {
newItemLocations.push_back(location);
}
//We want to ignore a specific Buy item. Buy items with different RandomizerGets are recognised by a shared GetLogicVar
//We want to ignore a specific Buy item. Buy items with different RandomizerGets are recognised by a shared GetLogicVal
else if (ignore != RG_GOLD_SKULLTULA_TOKEN && IsBombchus(ignore)) {
if ((type == ITEMTYPE_SHOP && Rando::StaticData::GetItemTable()[ignore].GetLogicVar() != location->GetPlacedItem().GetLogicVar()) || type != ITEMTYPE_SHOP) {
if ((type == ITEMTYPE_SHOP && Rando::StaticData::GetItemTable()[ignore].GetLogicVal() != location->GetPlacedItem().GetLogicVal()) || type != ITEMTYPE_SHOP) {
newItemLocations.push_back(location);
}
}
Expand Down Expand Up @@ -408,7 +408,7 @@ std::vector<RandomizerCheck> GetAccessibleLocations(const std::vector<Randomizer
// TODO: Reimplement Ammo Drops setting
else if (/*AmmoDrops.IsNot(AMMODROPS_NONE) &&*/ !(bombchus && bombchusFound) && type == ITEMTYPE_SHOP) {
//Only check each buy item once
auto buyItem = location->GetPlacedItem().GetLogicVar();
auto buyItem = location->GetPlacedItem().GetLogicVal();
//Buy item not in list to ignore, add it to list and write to playthrough
if (std::find(buyIgnores.begin(), buyIgnores.end(), buyItem) == buyIgnores.end()) {
exclude = false;
Expand Down Expand Up @@ -1003,7 +1003,9 @@ void ClearProgress() {
int Fill() {
auto ctx = Rando::Context::GetInstance();
int retries = 0;
SPDLOG_INFO("Starting seed generation...");
while(retries < 5) {
SPDLOG_INFO("Attempt {}...", retries + 1);
placementFailure = false;
//showItemProgress = false;
ctx->playthroughLocations.clear();
Expand Down Expand Up @@ -1036,8 +1038,10 @@ int Fill() {
//Place shop items first, since a buy shield is needed to place a dungeon reward on Gohma due to access
NonShopItems = {};
if (ctx->GetOption(RSK_SHOPSANITY).Is(RO_SHOPSANITY_OFF)) {
SPDLOG_INFO("Placing Vanilla Shop Items...");
PlaceVanillaShopItems(); //Place vanilla shop items in vanilla location
} else {
SPDLOG_INFO("Shuffling Shop Items");
int total_replaced = 0;
if (ctx->GetOption(RSK_SHOPSANITY).IsNot(RO_SHOPSANITY_ZERO_ITEMS)) { //Shopsanity 1-4, random
//Initialize NonShopItems
Expand Down Expand Up @@ -1080,6 +1084,7 @@ int Fill() {
}

//Place dungeon rewards
SPDLOG_INFO("Shuffling and Placing Dungeon Items...");
RandomizeDungeonRewards();

//Place dungeon items restricted to their Own Dungeon
Expand Down Expand Up @@ -1111,15 +1116,18 @@ int Fill() {

//Then place dungeon items that are assigned to restrictive location pools
RandomizeDungeonItems();
SPDLOG_INFO("Dungeon Items Done");

//Then place Link's Pocket Item if it has to be an advancement item
RandomizeLinksPocket();
SPDLOG_INFO("Shuffling Advancement Items");
//Then place the rest of the advancement items
std::vector<RandomizerGet> remainingAdvancementItems =
FilterAndEraseFromPool(ItemPool, [](const auto i) { return Rando::StaticData::RetrieveItem(i).IsAdvancement(); });
AssumedFill(remainingAdvancementItems, ctx->allLocations, true);

//Fast fill for the rest of the pool
SPDLOG_INFO("Shuffling Remaining Items");
std::vector<RandomizerGet> remainingPool = FilterAndEraseFromPool(ItemPool, [](const auto i) { return true; });
FastFill(remainingPool, GetAllEmptyLocations(), false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Rando::Entrance* Area::GetExit(RandomizerRegion exitToReturn) {
}

bool Area::CanPlantBeanCheck() const {
return (logic->MagicBean || logic->MagicBeanPack) && BothAgesCheck();
return Rando::Context::GetInstance()->GetAmmo(ITEM_BEAN) > 0 && BothAgesCheck();
}

bool Area::AllAccountedFor() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ void AreaTable_Init_SpiritTemple() {
areaTable[RR_SPIRIT_TEMPLE_MQ_LOWER_ADULT] = Area("Spirit Temple MQ Lower Adult", "Spirit Temple", RA_SPIRIT_TEMPLE, NO_DAY_NIGHT_CYCLE, {}, {
//Locations
LOCATION(RC_SPIRIT_TEMPLE_MQ_LEEVER_ROOM_CHEST, true),
LOCATION(RC_SPIRIT_TEMPLE_MQ_SYMPHONY_ROOM_CHEST, logic->SmallKeys(RR_SPIRIT_TEMPLE, 7) && logic->Hammer && logic->Ocarina && logic->SongOfTime && logic->EponasSong && logic->SunsSong && logic->SongOfStorms && logic->ZeldasLullaby),
LOCATION(RC_SPIRIT_TEMPLE_MQ_SYMPHONY_ROOM_CHEST, logic->SmallKeys(RR_SPIRIT_TEMPLE, 7) && logic->Hammer && logic->CanUse(RG_SONG_OF_TIME) && logic->CanUse(RG_EPONAS_SONG) && logic->CanUse(RG_SUNS_SONG)
&& logic->CanUse(RG_SONG_OF_STORMS) && logic->CanUse(RG_ZELDAS_LULLABY)),
LOCATION(RC_SPIRIT_TEMPLE_MQ_ENTRANCE_FRONT_RIGHT_CHEST, logic->Hammer),
LOCATION(RC_SPIRIT_TEMPLE_MQ_GS_LEEVER_ROOM, true),
LOCATION(RC_SPIRIT_TEMPLE_MQ_GS_SYMPHONY_ROOM, logic->SmallKeys(RR_SPIRIT_TEMPLE, 7) && logic->Hammer && logic->Ocarina && logic->SongOfTime && logic->EponasSong && logic->SunsSong && logic->SongOfStorms && logic->ZeldasLullaby),
LOCATION(RC_SPIRIT_TEMPLE_MQ_GS_SYMPHONY_ROOM, logic->SmallKeys(RR_SPIRIT_TEMPLE, 7) && logic->Hammer && logic->CanUse(RG_SONG_OF_TIME) && logic->CanUse(RG_EPONAS_SONG) && logic->CanUse(RG_SUNS_SONG)
&& logic->CanUse(RG_SONG_OF_STORMS) && logic->CanUse(RG_ZELDAS_LULLABY)),
}, {});

areaTable[RR_SPIRIT_TEMPLE_MQ_BOSS_AREA] = Area("Spirit Temple MQ Boss Area", "Spirit Temple", RA_SPIRIT_TEMPLE, NO_DAY_NIGHT_CYCLE, {}, {
Expand Down
Loading
Loading