Skip to content

Commit

Permalink
Fixes to DeathLink
Browse files Browse the repository at this point in the history
  • Loading branch information
NewSoupVi committed Mar 8, 2023
1 parent 72c2017 commit 55717fb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Source/Archipelago/APGameData.h
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@ const inline std::set<int> deathlinkExcludeList = {
0x00027, // UTM Invisible Dots Symmetry 1
0x00028, // UTM Invisible Dots Symmetry 2
0x00029, // UTM Invisible Dots Symmetry 3
0x0C373, // Patio Floor
0x0A079, // Bunker Elevator Panel
};

const inline std::set<int> allEPs = {
Expand Down
13 changes: 6 additions & 7 deletions Source/Archipelago/APRandomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ bool APRandomizer::Connect(std::string& server, std::string& user, std::string&
if (slotData.contains("challenge_lasers")) ChallengeLasers = slotData["challenge_lasers"];
DisableNonRandomizedPuzzles = slotData.contains("disable_non_randomized_puzzles") ? slotData["disable_non_randomized_puzzles"] == true : false;
EPShuffle = slotData.contains("shuffle_EPs") ? slotData["shuffle_EPs"] != 0 : false;
DeathLink = slotData.contains("death_link") ? slotData["death_link"] == true : false;

if (!UnlockSymbols) {
state.unlockedArrows = true;
Expand Down Expand Up @@ -243,12 +244,10 @@ bool APRandomizer::Connect(std::string& server, std::string& user, std::string&
}
}

if (slotData.contains("death_link")) {
if(slotData["death_link"] == true) {
std::list<std::string> newTags = { "DeathLink" };
if (DeathLink) {
std::list<std::string> newTags = { "DeathLink" };

ap->ConnectUpdate(NULL, newTags);
}
ap->ConnectUpdate(NULL, newTags);
}


Expand Down Expand Up @@ -539,15 +538,15 @@ void APRandomizer::Init() {
}

void APRandomizer::GenerateNormal() {
async = new APWatchdog(ap, panelIdToLocationId, FinalPanel, panelLocker, entityToName, audioLogMessages, obeliskSideIDsToEPHexes, EPShuffle, PuzzleRandomization, &state, solveModeSpeedFactor);
async = new APWatchdog(ap, panelIdToLocationId, FinalPanel, panelLocker, entityToName, audioLogMessages, obeliskSideIDsToEPHexes, EPShuffle, PuzzleRandomization, &state, solveModeSpeedFactor, DeathLink);
SeverDoors();

if (DisableNonRandomizedPuzzles)
panelLocker->DisableNonRandomizedPuzzles(disabledPanels, doorsActuallyInTheItemPool);
}

void APRandomizer::GenerateHard() {
async = new APWatchdog(ap, panelIdToLocationId, FinalPanel, panelLocker, entityToName, audioLogMessages, obeliskSideIDsToEPHexes, EPShuffle, PuzzleRandomization, &state, solveModeSpeedFactor);
async = new APWatchdog(ap, panelIdToLocationId, FinalPanel, panelLocker, entityToName, audioLogMessages, obeliskSideIDsToEPHexes, EPShuffle, PuzzleRandomization, &state, solveModeSpeedFactor, DeathLink);
SeverDoors();

//Mess with Town targets
Expand Down
1 change: 1 addition & 0 deletions Source/Archipelago/APRandomizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class APRandomizer {
bool EPShuffle = false;
int MountainLasers = 7;
int ChallengeLasers = 11;
bool DeathLink;

int mostRecentItemId = -1;

Expand Down
5 changes: 4 additions & 1 deletion Source/Archipelago/APWatchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define CHEAT_KEYS_ENABLED 0
#define SKIP_HOLD_DURATION 1.f

APWatchdog::APWatchdog(APClient* client, std::map<int, int> mapping, int lastPanel, PanelLocker* p, std::map<int, std::string> epn, std::map<int, std::pair<std::string, int64_t>> a, std::map<int, std::set<int>> o, bool ep, int puzzle_rando, APState* s, float smsf) : Watchdog(0.1f) {
APWatchdog::APWatchdog(APClient* client, std::map<int, int> mapping, int lastPanel, PanelLocker* p, std::map<int, std::string> epn, std::map<int, std::pair<std::string, int64_t>> a, std::map<int, std::set<int>> o, bool ep, int puzzle_rando, APState* s, float smsf, bool dl) : Watchdog(0.1f) {
generator = std::make_shared<Generate>();
ap = client;
panelIdToLocationId = mapping;
Expand All @@ -28,6 +28,7 @@ APWatchdog::APWatchdog(APClient* client, std::map<int, int> mapping, int lastPan
locationIdToPanelId_READ_ONLY[value] = key;
}

DeathLink = dl;
finalPanel = lastPanel;
panelLocker = p;
audioLogMessages = a;
Expand Down Expand Up @@ -1658,8 +1659,10 @@ void APServerPoller::action() {


void APWatchdog::CheckDeathLink() {
if (!DeathLink) return;
if (mostRecentActivePanelId == -1 || !actuallyEveryPanel.count(mostRecentActivePanelId)) return;
if (deathlinkExcludeList.count(mostRecentActivePanelId)) return;
if (PuzzleRandomization == SIGMA_EXPERT && 0x03C0C) return;

int newState = ReadPanelData<int>(mostRecentActivePanelId, FLASH_MODE);

Expand Down
3 changes: 2 additions & 1 deletion Source/Archipelago/APWatchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PanelLocker;

class APWatchdog : public Watchdog {
public:
APWatchdog(APClient* client, std::map<int, int> mapping, int lastPanel, PanelLocker* p, std::map<int, std::string> epn, std::map<int, std::pair<std::string, int64_t>> a, std::map<int, std::set<int>> o, bool ep, int puzzle_rando, APState* s, float smsf);
APWatchdog(APClient* client, std::map<int, int> mapping, int lastPanel, PanelLocker* p, std::map<int, std::string> epn, std::map<int, std::pair<std::string, int64_t>> a, std::map<int, std::set<int>> o, bool ep, int puzzle_rando, APState* s, float smsf, bool dl);

int spentPuzzleSkips = 0;
int foundPuzzleSkips = 0;
Expand Down Expand Up @@ -79,6 +79,7 @@ class APWatchdog : public Watchdog {

std::shared_ptr<HudManager> hudManager;

bool DeathLink = false;
bool EPShuffle = false;
int PuzzleRandomization = 0;

Expand Down

0 comments on commit 55717fb

Please sign in to comment.