Merge remote-tracking branch 'fork/aManchipelago' into AddArchipelagoClientLib
This commit is contained in:
@@ -69,3 +69,5 @@ DEFINE_HOOK(OnSetGameLanguage, ());
|
||||
DEFINE_HOOK(OnFileDropped, (std::string filePath));
|
||||
DEFINE_HOOK(OnAssetAltChange, ());
|
||||
DEFINE_HOOK(OnKaleidoUpdate, ());
|
||||
|
||||
DEFINE_HOOK(OnRandomizerItemGivenHooks, (uint32_t rc));
|
||||
|
||||
@@ -301,3 +301,9 @@ void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void)) {
|
||||
void GameInteractor_ExecuteOnKaleidoUpdate() {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnKaleidoUpdate>();
|
||||
}
|
||||
|
||||
// Mark: Randomizer
|
||||
|
||||
void GameInteractor_ExecuteOnRandomizerItemGivenHooks(uint32_t rc) {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnRandomizerItemGivenHooks>(rc);
|
||||
}
|
||||
|
||||
@@ -81,6 +81,9 @@ void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void));
|
||||
// Mark: - Pause Menu
|
||||
void GameInteractor_ExecuteOnKaleidoUpdate();
|
||||
|
||||
// Mark: - Randomizer
|
||||
void GameInteractor_ExecuteOnRandomizerItemGivenHooks(uint32_t rc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -346,6 +346,8 @@ void RandomizerOnPlayerUpdateForRCQueueHandler() {
|
||||
}
|
||||
}
|
||||
|
||||
GameInteractor_ExecuteOnRandomizerItemGivenHooks((uint32_t)rc);
|
||||
|
||||
randomizerQueuedChecks.pop();
|
||||
}
|
||||
|
||||
@@ -380,13 +382,6 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) {
|
||||
SPDLOG_INFO("Item received mod {} item {} from RC {}", receivedItemEntry.modIndex, receivedItemEntry.itemId,
|
||||
static_cast<uint32_t>(randomizerQueuedCheck));
|
||||
|
||||
// todo maybe move to seperate function
|
||||
// let arhipelago know we got this check
|
||||
if(randomizerQueuedCheck != RC_ARCHIPELAGO_RECIEVED_ITEM) {
|
||||
ArchipelagoClient& ap_client = ArchipelagoClient::GetInstance();
|
||||
ap_client.CheckLocation(randomizerQueuedCheck);
|
||||
}
|
||||
|
||||
loc->SetCheckStatus(RCSHOW_COLLECTED);
|
||||
CheckTracker::SpoilAreaFromCheck(randomizerQueuedCheck);
|
||||
CheckTracker::RecalculateAllAreaTotals();
|
||||
@@ -2408,6 +2403,9 @@ void RandomizerRegisterHooks() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) {
|
||||
ShipInit::Init("IS_RANDO");
|
||||
|
||||
// Add condition around this to only fire when loading into an Archipelago save file
|
||||
ShipInit::Init("IS_ARCHIPELAGO");
|
||||
|
||||
randomizerQueuedChecks = std::queue<RandomizerCheck>();
|
||||
randomizerQueuedCheck = RC_UNKNOWN_CHECK;
|
||||
randomizerQueuedItemEntry = GET_ITEM_NONE;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||
#include "soh/Enhancements/randomizer/static_data.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
|
||||
ArchipelagoClient::ArchipelagoClient() {
|
||||
std::string uuid = ap_get_uuid("uuid");
|
||||
@@ -115,7 +116,7 @@ void ArchipelagoClient::CheckLocation(RandomizerCheck SoH_check_id) {
|
||||
std::string logMessage = "[LOG] Checked: " + ap_name + "(" + std::to_string(ap_item_id) + "), sending to AP server";
|
||||
ArchipelagoConsole_SendMessage(logMessage.c_str());
|
||||
|
||||
// currently not sending, because i only get so many real chances
|
||||
// currently not sending, because i only get so many real chances
|
||||
if(!IsConnected()) {
|
||||
return;
|
||||
}
|
||||
@@ -199,3 +200,20 @@ const char* ArchipelagoClient::GetConnectionStatus() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// Implement this properly once we have some kind of indication within a save file wether the player is in a normal
|
||||
// rando save or an archipelago one.
|
||||
#define IS_ARCHIPELAGO true
|
||||
|
||||
void RegisterArchipelago() {
|
||||
COND_HOOK(GameInteractor::OnRandomizerItemGivenHooks, IS_ARCHIPELAGO,
|
||||
[](uint32_t rc) {
|
||||
if (rc == RC_ARCHIPELAGO_RECIEVED_ITEM) {
|
||||
// Update lastReceivedIndex
|
||||
} else {
|
||||
ArchipelagoClient::GetInstance().CheckLocation((RandomizerCheck)rc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterArchipelago, { "IS_ARCHIPELAGO" });
|
||||
|
||||
Reference in New Issue
Block a user