Enable MQ Dungeons in Randomizer (#1828)

* Refactor GetCheckFromActor, WIP currently broken

* Fixes build errors via forward declarations and emplace vs insert.

* Removes some unnecessary code.

* Fixes non-windows build errors.

* Fixes Deku Scrubs outside of grottos.

* Fixes DMC Deku Scrub Grotto Center

* Fixes Ruto Blue Warp

* Fix issue identifying blue warp rando checks

* Move identifyCow to randomizer.cpp

* Various updates to vanilla check objects

* Identify MQ checks in check object table

* Adjustments to how multimap is used and initialized

* Convert u16 in check object table to s16

* Fix a few issues with MQ checks

* Fix issue with TWO_ACTOR_PARAMS macro

* Fixes some scrubs and cows appearing as identical.

* Fixes known gossip stone issues (ToT, DC)

* Fixes Dampe's Gravedigging tour rcObject

* Fix crash on locations tab

* Enable master quest dungeons in rando

Co-authored-by: Christopher Leggett <chris@leggett.dev>
This commit is contained in:
Garrett Cox 2022-10-21 20:43:37 -05:00 committed by GitHub
commit 1db4e9303e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 1197 additions and 2583 deletions

View file

@ -462,7 +462,7 @@ s32 DoorWarp1_PlayerInRange(DoorWarp1* this, GlobalContext* globalCtx) {
}
void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globalCtx, u8 ruto, u8 adult) {
GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->actor.params, GI_NONE);
GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, 0x00, GI_NONE);
if (this->actor.parent != NULL && this->actor.parent->id == GET_PLAYER(globalCtx)->actor.id &&
!Flags_GetTreasure(globalCtx, 0x1F)) {

View file

@ -18,7 +18,6 @@ void func_809E0070(Actor* thisx, GlobalContext* globalCtx);
void func_809DF494(EnCow* this, GlobalContext* globalCtx);
void func_809DF6BC(EnCow* this, GlobalContext* globalCtx);
CowInfo EnCow_GetInfo(EnCow* this, GlobalContext* globalCtx);
void EnCow_MoveForRandomizer(EnCow* this, GlobalContext* globalCtx);
void func_809DF778(EnCow* this, GlobalContext* globalCtx);
void func_809DF7D8(EnCow* this, GlobalContext* globalCtx);
@ -215,61 +214,6 @@ void func_809DF730(EnCow* this, GlobalContext* globalCtx) {
}
}
CowInfo EnCow_GetInfo(EnCow* this, GlobalContext* globalCtx) {
struct CowInfo cowInfo;
cowInfo.randomizerInf = -1;
cowInfo.randomizerCheck = RC_UNKNOWN_CHECK;
switch (globalCtx->sceneNum) {
case SCENE_SOUKO: // Lon Lon Tower
if (this->actor.world.pos.x == -229 && this->actor.world.pos.z == 157) {
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_LLR_TOWER_LEFT_COW;
cowInfo.randomizerCheck = RC_LLR_TOWER_LEFT_COW;
} else if (this->actor.world.pos.x == -142 && this->actor.world.pos.z == -140) {
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_LLR_TOWER_RIGHT_COW;
cowInfo.randomizerCheck = RC_LLR_TOWER_RIGHT_COW;
}
break;
case SCENE_MALON_STABLE:
if (this->actor.world.pos.x == 116 && this->actor.world.pos.z == -254) {
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_LLR_STABLES_RIGHT_COW;
cowInfo.randomizerCheck = RC_LLR_STABLES_RIGHT_COW;
} else if (this->actor.world.pos.x == -122 && this->actor.world.pos.z == -254) {
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_LLR_STABLES_LEFT_COW;
cowInfo.randomizerCheck = RC_LLR_STABLES_LEFT_COW;
}
break;
case SCENE_KAKUSIANA: // Grotto
if (this->actor.world.pos.x == 2444 && this->actor.world.pos.z == -471) {
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_DMT_COW_GROTTO_COW;
cowInfo.randomizerCheck = RC_DMT_COW_GROTTO_COW;
} else if (this->actor.world.pos.x == 3485 && this->actor.world.pos.z == -291) {
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_HF_COW_GROTTO_COW;
cowInfo.randomizerCheck = RC_HF_COW_GROTTO_COW;
}
break;
case SCENE_LINK_HOME:
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_LINKS_HOUSE_COW;
cowInfo.randomizerCheck = RC_KF_LINKS_HOUSE_COW;
break;
case SCENE_LABO: // Impa's house
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_KAK_IMPAS_HOUSE_COW;
cowInfo.randomizerCheck = RC_KAK_IMPAS_HOUSE_COW;
break;
case SCENE_SPOT09: // Gerudo Valley
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_GV_COW;
cowInfo.randomizerCheck = RC_GV_COW;
break;
case SCENE_BDAN: // Jabu's Belly
cowInfo.randomizerInf = RAND_INF_COWS_MILKED_JABU_JABUS_BELLY_MQ_COW;
cowInfo.randomizerCheck = RC_JABU_JABUS_BELLY_MQ_COW;
break;
}
return cowInfo;
}
void EnCow_MoveForRandomizer(EnCow* this, GlobalContext* globalCtx) {
// Only move the cow body (the tail will be moved with the body)
if (this->actor.params != 0) {
@ -288,9 +232,9 @@ void EnCow_MoveForRandomizer(EnCow* this, GlobalContext* globalCtx) {
}
void EnCow_SetCowMilked(EnCow* this, GlobalContext* globalCtx) {
CowInfo cowInfo = EnCow_GetInfo(this, globalCtx);
CowIdentity cowIdentity = Randomizer_IdentifyCow(globalCtx->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z);
Player* player = GET_PLAYER(globalCtx);
player->pendingFlag.flagID = cowInfo.randomizerInf;
player->pendingFlag.flagID = cowIdentity.randomizerInf;
player->pendingFlag.flagType = FLAG_RANDOMIZER_INF;
}
@ -336,14 +280,14 @@ void func_809DF8FC(EnCow* this, GlobalContext* globalCtx) {
}
bool EnCow_HasBeenMilked(EnCow* this, GlobalContext* globalCtx) {
CowInfo cowInfo = EnCow_GetInfo(this, globalCtx);
return Flags_GetRandomizerInf(cowInfo.randomizerInf);
CowIdentity cowIdentity = Randomizer_IdentifyCow(globalCtx->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z);
return Flags_GetRandomizerInf(cowIdentity.randomizerInf);
}
void EnCow_GivePlayerRandomizedItem(EnCow* this, GlobalContext* globalCtx) {
if (!EnCow_HasBeenMilked(this, globalCtx)) {
CowInfo cowInfo = EnCow_GetInfo(this, globalCtx);
GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(cowInfo.randomizerCheck, GI_MILK);
CowIdentity cowIdentity = Randomizer_IdentifyCow(globalCtx->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z);
GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(cowIdentity.randomizerCheck, GI_MILK);
GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 10000.0f, 100.0f);
} else {
// once we've gotten the rando reward from the cow,

View file

@ -21,9 +21,4 @@ typedef struct EnCow {
/* 0x027C */ EnCowActionFunc actionFunc;
} EnCow; // size = 0x0280
typedef struct CowInfo {
RandomizerInf randomizerInf;
RandomizerCheck randomizerCheck;
} CowInfo;
#endif