[Feature] Entrance Rando v2 (#2071)

This commit is contained in:
Adam Bird 2022-12-06 18:37:50 -05:00 committed by GitHub
commit d9f3844b2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 1599 additions and 536 deletions

View file

@ -425,6 +425,11 @@ void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, PlayState* play) {
void DemoKankyo_Update(Actor* thisx, PlayState* play) {
DemoKankyo* this = (DemoKankyo*)thisx;
this->actionFunc(this, play);
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_WARP_SONGS) &&
thisx->params == 0x000F) { // Warp Song particles
Entrance_SetWarpSongEntrance();
}
}
void DemoKankyo_Draw(Actor* thisx, PlayState* play) {

View file

@ -958,7 +958,11 @@ void func_80ACC00C(EnOwl* this, PlayState* play) {
osSyncPrintf("SPOT 06 の デモがはしった\n"); // "Demo of SPOT 06 has been completed"
osSyncPrintf(VT_RST);
if (gSaveContext.n64ddFlag) {
play->nextEntranceIndex = 0x027E;
if (Randomizer_GetSettingValue(RSK_SHUFFLE_OWL_DROPS)) {
play->nextEntranceIndex = Entrance_OverrideNextIndex(0x027E);
} else {
play->nextEntranceIndex = 0x027E;
}
play->sceneLoadFlag = 0x14;
play->fadeTransition = 2;
break;
@ -969,7 +973,11 @@ void func_80ACC00C(EnOwl* this, PlayState* play) {
case 8:
case 9:
if (gSaveContext.n64ddFlag) {
play->nextEntranceIndex = 0x0554;
if (Randomizer_GetSettingValue(RSK_SHUFFLE_OWL_DROPS)) {
play->nextEntranceIndex = Entrance_OverrideNextIndex(0x0554);
} else {
play->nextEntranceIndex = 0x0554;
}
play->sceneLoadFlag = 0x14;
play->fadeTransition = 2;
break;

View file

@ -9591,6 +9591,11 @@ void Player_Init(Actor* thisx, PlayState* play2) {
s32 sp50;
s32 sp4C;
// In ER, once Link has spawned we know the scene has loaded, so we can sanitize the last known entrance type
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) {
Grotto_SanitizeEntranceType();
}
play->shootingGalleryStatus = play->bombchuBowlingStatus = 0;
play->playerInit = Player_InitCommon;

View file

@ -2197,6 +2197,15 @@ void FileChoose_LoadGame(GameState* thisx) {
gSaveContext.inventory.equipment ^= (gBitFlags[swordEquipMask - 1] << BOMSWAP16(gEquipShifts[EQUIP_SWORD]));
}
}
// Handle randomized spawn positions after the save context has been setup from load
// When remeber save location is on, set save warp if the save was in an a grotto, or
// the entrance index is -1 from shuffle overwarld spawn
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES) && ((!CVar_GetS32("gRememberSaveLocation", 0) ||
gSaveContext.savedSceneNum == SCENE_YOUSEI_IZUMI_TATE || gSaveContext.savedSceneNum == SCENE_KAKUSIANA) ||
(CVar_GetS32("gRememberSaveLocation", 0) && Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_SPAWNS) && gSaveContext.entranceIndex == -1))) {
Entrance_SetSavewarpEntrance();
}
}
static void (*gSelectModeUpdateFuncs[])(GameState*) = {