Added opening of local checks when synchinc locations
This commit is contained in:
@@ -71,4 +71,5 @@ DEFINE_HOOK(OnAssetAltChange, ());
|
|||||||
DEFINE_HOOK(OnKaleidoUpdate, ());
|
DEFINE_HOOK(OnKaleidoUpdate, ());
|
||||||
|
|
||||||
DEFINE_HOOK(OnRandomizerItemGivenHooks, (uint32_t rc));
|
DEFINE_HOOK(OnRandomizerItemGivenHooks, (uint32_t rc));
|
||||||
DEFINE_HOOK(OnArchipelagoItemRecieved, (uint32_t rc));
|
DEFINE_HOOK(OnArchipelagoItemRecieved, (uint32_t rg));
|
||||||
|
DEFINE_HOOK(OnRandomizerExternalCheck, (uint32_t rc));
|
||||||
|
|||||||
@@ -309,6 +309,10 @@ void GameInteractor_ExecuteOnRandomizerItemGivenHooks(uint32_t rc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Archipelago
|
// MARK: Archipelago
|
||||||
void GameInteractor_ExecuteOnArchipelagoItemRecieved(uint32_t rc) {
|
void GameInteractor_ExecuteOnArchipelagoItemRecieved(uint32_t rg) {
|
||||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnArchipelagoItemRecieved>(rc);
|
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnArchipelagoItemRecieved>(rg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameInteractor_ExecuteOnRandomizerExternalCheck(uint32_t rc) {
|
||||||
|
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnRandomizerExternalCheck>(rc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ void GameInteractor_ExecuteOnKaleidoUpdate();
|
|||||||
void GameInteractor_ExecuteOnRandomizerItemGivenHooks(uint32_t rc);
|
void GameInteractor_ExecuteOnRandomizerItemGivenHooks(uint32_t rc);
|
||||||
|
|
||||||
// Mark: - Archipelago
|
// Mark: - Archipelago
|
||||||
void GameInteractor_ExecuteOnArchipelagoItemRecieved(uint32_t rc);
|
void GameInteractor_ExecuteOnArchipelagoItemRecieved(uint32_t rg);
|
||||||
|
void GameInteractor_ExecuteOnRandomizerExternalCheck(uint32_t rc);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,6 +286,10 @@ void RandomizerOnSceneFlagSetHandler(int16_t sceneNum, int16_t flagType, int16_t
|
|||||||
randomizerQueuedChecks.push(rc);
|
randomizerQueuedChecks.push(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RandomizerOnExternalCheckHandler(uint32_t randomizerCheck) {
|
||||||
|
randomizerQueuedChecks.push(static_cast<RandomizerCheck>(randomizerCheck));
|
||||||
|
}
|
||||||
|
|
||||||
static Vec3f spawnPos = { 0.0f, -999.0f, 0.0f };
|
static Vec3f spawnPos = { 0.0f, -999.0f, 0.0f };
|
||||||
|
|
||||||
void RandomizerOnPlayerUpdateForRCQueueHandler() {
|
void RandomizerOnPlayerUpdateForRCQueueHandler() {
|
||||||
@@ -2525,9 +2529,8 @@ void RandomizerRegisterHooks() {
|
|||||||
onCuccoOrChickenHatchHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnCuccoOrChickenHatch>(
|
onCuccoOrChickenHatchHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnCuccoOrChickenHatch>(
|
||||||
RandomizerOnCuccoOrChickenHatch);
|
RandomizerOnCuccoOrChickenHatch);
|
||||||
|
|
||||||
// TODO Implement propeerly when we can read what kind of game we're playing from the save file
|
|
||||||
|
|
||||||
COND_HOOK(GameInteractor::OnArchipelagoItemRecieved, IS_ARCHIPELAGO, ArchipelagoOnRecieveItem);
|
COND_HOOK(GameInteractor::OnArchipelagoItemRecieved, IS_ARCHIPELAGO, ArchipelagoOnRecieveItem);
|
||||||
|
COND_HOOK(GameInteractor::OnRandomizerExternalCheck, IS_ARCHIPELAGO, RandomizerOnExternalCheckHandler)
|
||||||
|
|
||||||
if (RAND_GET_OPTION(RSK_FISHSANITY) != RO_FISHSANITY_OFF) {
|
if (RAND_GET_OPTION(RSK_FISHSANITY) != RO_FISHSANITY_OFF) {
|
||||||
OTRGlobals::Instance->gRandoContext->GetFishsanity()->InitializeFromSave();
|
OTRGlobals::Instance->gRandoContext->GetFishsanity()->InitializeFromSave();
|
||||||
|
|||||||
@@ -109,7 +109,9 @@ bool ArchipelagoClient::StartClient() {
|
|||||||
}); // todo maybe move these functions to a lambda, since they don't have to be static anymore
|
}); // todo maybe move these functions to a lambda, since they don't have to be static anymore
|
||||||
|
|
||||||
apClient->set_location_checked_handler([&](const std::list<int64_t> locations) {
|
apClient->set_location_checked_handler([&](const std::list<int64_t> locations) {
|
||||||
// todo implement me
|
for(const int64_t apLoc : locations) {
|
||||||
|
QueueExternalCheck(apLoc);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -171,10 +173,16 @@ void ArchipelagoClient::SynchSentLocations() {
|
|||||||
void ArchipelagoClient::SynchRecievedLocations() {
|
void ArchipelagoClient::SynchRecievedLocations() {
|
||||||
// Open checks that have been found previously but went unsaved
|
// Open checks that have been found previously but went unsaved
|
||||||
for(const int64_t apLoc : apClient->get_checked_locations()) {
|
for(const int64_t apLoc : apClient->get_checked_locations()) {
|
||||||
// TODO call location checked function to open any unopened checks.
|
QueueExternalCheck(apLoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArchipelagoClient::QueueExternalCheck(const int64_t apLocation) {
|
||||||
|
const std::string checkName = apClient->get_location_name(apLocation, AP_Client_consts::AP_GAME_NAME);
|
||||||
|
const uint32_t RC = static_cast<uint32_t>(Rando::StaticData::locationNameToEnum[checkName]);
|
||||||
|
GameInteractor_ExecuteOnRandomizerExternalCheck(RC);
|
||||||
|
}
|
||||||
|
|
||||||
bool ArchipelagoClient::IsConnected() {
|
bool ArchipelagoClient::IsConnected() {
|
||||||
return apClient->get_state() == APClient::State::SLOT_CONNECTED;
|
return apClient->get_state() == APClient::State::SLOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class ArchipelagoClient{
|
|||||||
|
|
||||||
void OnItemReceived(const ApItem apItem);
|
void OnItemReceived(const ApItem apItem);
|
||||||
void QueueItem(const ApItem item);
|
void QueueItem(const ApItem item);
|
||||||
|
void QueueExternalCheck(int64_t apLocation);
|
||||||
|
|
||||||
void SendGameWon();
|
void SendGameWon();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user