Skip to content

Commit

Permalink
LL: Handle location scouts properly, fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceManiac committed Dec 21, 2024
1 parent 7cb97a2 commit a5f0002
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
43 changes: 31 additions & 12 deletions source/loonyland/loonyArchipelago.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,32 @@ void GivePlayerItem(int64_t item_id, bool loud)
}
}

void GetLocationScouts(std::vector<ArchipelagoClient::Item> vec_NetworkItems)
void GetLocationScouts()
{
world_t world;
LoadWorld(&world, "ap.llw");

for (auto item : vec_NetworkItems)
bool allGood = true;

for (auto loc : basic_locations)
{
locationData loc = basic_locations[item.location - loonyland_base_id];
if (loc.Name == "Q: Save Halloween Hill")
{
continue;
}

const ArchipelagoClient::Item* item = ap->item_at_location(loc.ID + loonyland_base_id);
if (item == nullptr)
{
allGood = false;
continue;
}

if (loc.Type == "Pickup")
{
Map* tempMap = world.map[loc.MapID];
int item_id = item.item - loonyland_base_id;
if (item.player == ap->player_id())
int item_id = item->item - loonyland_base_id;
if (item->player == ap->player_id())
{
item_id = basic_items.at(item_id);
}
Expand All @@ -201,14 +214,17 @@ void GetLocationScouts(std::vector<ArchipelagoClient::Item> vec_NetworkItems)
}
for (auto const& i : loc.chatCodes)
{
chat_table[i].updated += ap->item_name(item.item);
chat_table[i].updated += ap->item_name(item->item);
}
}

SaveWorld(&world, "ap.llw");
FreeWorld(&world);
if (allGood)
{
locationWait = false;
SaveWorld(&world, "ap.llw");
}

locationWait = false;
FreeWorld(&world);
}

void SendCheckedLocPickup(std::string mapName, int mapNum, int x, int y)
Expand All @@ -221,7 +237,7 @@ void SendCheckedLocPickup(std::string mapName, int mapNum, int x, int y)
return;
}
}
std::cout << "AP ITEM MISS: " << mapName << " " << x << " " << y;
std::cout << "AP ITEM MISS: " << mapName << " " << x << " " << y << std::endl;

}
void SendCheckedLocQuest(int questVar)
Expand All @@ -234,7 +250,7 @@ void SendCheckedLocQuest(int questVar)
return;
}
}
std::cout << "AP QUEST MISS: " << questVar;
std::cout << "AP QUEST MISS: " << questVar << std::endl;
}

void SendCheckedTalkReward(int talkVar)
Expand Down Expand Up @@ -404,7 +420,10 @@ void UpdateArchipelago()
}

// Location scouts
// TODO: call GetLocationScouts with result
if (locationWait)
{
GetLocationScouts();
}

// DeathLink
if (ap->pop_death_link())
Expand Down
2 changes: 1 addition & 1 deletion source/loonyland/loonyArchipelagoData.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static locationData basic_locations[] = { {"Swamp: Mud Path","Pickup",0,"Hallowe
{"PolterGuy's Reward","Pickup",50,"Haunted Tower Roof",20,13,37,1,2,"Haunted Tower Roof",{68}},
{"Tower Basement: DoorDoorDoorDoorDoorDoor","Pickup",51,"Haunted Basement",21,20,13,1,2,"Haunted Basement",{}},
{"Abandoned Mine: Shaft","Pickup",52,"Abandoned Mines",22,39,2,1,2,"Abandoned Mines",{}},
{"Shrine of Bombulus: Prize","Pickup",53,"The Shrine of Bombulus",23,12,3,2,3,"The Shrine Of Bombulus",{}},
{"Shrine of Bombulus: Prize","Pickup",53,"The Shrine Of Bombulus",23,12,3,2,3,"The Shrine Of Bombulus",{}},
{"Gloomy Cavern: Lockpick","Pickup",54,"A Gloomy Cavern",24,50,44,2,3,"A Gloomy Cavern",{}},
{"Happy Stick: Hidden","Pickup",55,"Happy Stick Woods",25,61,2,5,6,"Happy Stick Woods",{}},
{"Happy Stick: Reward","Pickup",56,"Happy Stick Woods",25,35,34,0,1,"Happy Stick Woods",{}},
Expand Down
5 changes: 3 additions & 2 deletions source/loonyland/loonyArchipelagoMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ UpdateArchipelagoMenu(int* lastTime, MGLDraw* mgl)
dword btn, j;
int i;

UpdateArchipelago();

if (*lastTime > TIME_PER_FRAME * 30)
*lastTime = TIME_PER_FRAME * 30;
Expand Down Expand Up @@ -188,7 +189,7 @@ UpdateArchipelagoMenu(int* lastTime, MGLDraw* mgl)
printf("DEBUG: Status: %s\n", status.c_str());
}

if (status == "Authenticated")
if (status == "Active")
{
GetInfoFromAP();
optMode = 4;
Expand Down Expand Up @@ -296,7 +297,7 @@ void RenderArchipelagoMenu(MGLDraw* mgl)
PrintColor(350, 60 + 5 * 30 + 20, ConnectionStatus().c_str(), 7, -10, 0);

PrintColor(160, 60 + 6 * 30 + 20, "Scout status:", 7, -10, 0);
if (!locationWait)
if (locationWait)
{
PrintColor(350, 60 + 6 * 30 + 20, "Waiting", 7, -10, 0);
}
Expand Down

0 comments on commit a5f0002

Please sign in to comment.