mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-05 03:17:34 -04:00
Identify clean up (#6673)
Can't move `IdentifyShopItem` as it's used all over the place.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include "randomizerTypes.h"
|
||||
|
||||
// There has been some talk about potentially just using the RC identifier to store flags rather than randomizer inf, so
|
||||
// for now we're not going to store randomzierInf in the randomizer check objects, we're just going to map them 1:1 here
|
||||
extern std::map<RandomizerCheck, RandomizerInf> rcToRandomizerInf;
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "static_data.h"
|
||||
#include "soh/ObjectExtension/ObjectExtension.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h"
|
||||
@@ -75,11 +76,33 @@ void ObjComb_RandomizerWait(ObjComb* objComb, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData) {
|
||||
CheckIdentity beehiveIdentity;
|
||||
|
||||
beehiveIdentity.randomizerInf = RAND_INF_MAX;
|
||||
beehiveIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
if (sceneNum == SCENE_GROTTOS) {
|
||||
respawnData = TWO_ACTOR_PARAMS(xPosition, respawnData);
|
||||
} else {
|
||||
respawnData = TWO_ACTOR_PARAMS(xPosition, 0);
|
||||
}
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_COMB, sceneNum, respawnData);
|
||||
|
||||
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
|
||||
beehiveIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
beehiveIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return beehiveIdentity;
|
||||
}
|
||||
|
||||
void ObjComb_RandomizerInit(void* actor) {
|
||||
ObjComb* objComb = static_cast<ObjComb*>(actor);
|
||||
s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1);
|
||||
auto beehiveIdentity = OTRGlobals::Instance->gRandomizer->IdentifyBeehive(
|
||||
gPlayState->sceneNum, (s16)objComb->actor.world.pos.x, respawnData);
|
||||
auto beehiveIdentity = IdentifyBeehive(gPlayState->sceneNum, (s16)objComb->actor.world.pos.x, respawnData);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(beehiveIdentity));
|
||||
objComb->actionFunc = (ObjCombActionFunc)ObjComb_RandomizerWait;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,34 @@
|
||||
#include <soh/OTRGlobals.h>
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "overlays/actors/ovl_En_Hy/z_en_hy.h"
|
||||
extern PlayState* gPlayState;
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyBeggar(s32 sceneNum, s32 textId) {
|
||||
CheckIdentity beggarIdentity;
|
||||
beggarIdentity.randomizerInf = RAND_INF_MAX;
|
||||
beggarIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_HY, sceneNum, textId);
|
||||
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifyBeggar did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
} else {
|
||||
beggarIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
beggarIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return beggarIdentity;
|
||||
}
|
||||
|
||||
CheckIdentity ShuffleBeggar_GetBeggarIdentity(int32_t textId) {
|
||||
CheckIdentity beggarIdentity;
|
||||
s16 sceneNum = gPlayState->sceneNum;
|
||||
|
||||
beggarIdentity = OTRGlobals::Instance->gRandomizer->IdentifyBeggar(sceneNum, textId);
|
||||
beggarIdentity = IdentifyBeggar(sceneNum, textId);
|
||||
|
||||
return beggarIdentity;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <soh/OTRGlobals.h>
|
||||
#include "static_data.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Cow/z_en_cow.h"
|
||||
@@ -34,14 +35,36 @@ void EnCow_MoveForRandomizer(EnCow* enCow, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyCow(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
CheckIdentity cowIdentity;
|
||||
|
||||
cowIdentity.randomizerInf = RAND_INF_MAX;
|
||||
cowIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = 0x00;
|
||||
// Only need to pass params if in a scene with two cows
|
||||
if (sceneNum == SCENE_GROTTOS || sceneNum == SCENE_STABLE || sceneNum == SCENE_LON_LON_BUILDINGS) {
|
||||
actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
}
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_COW, sceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
|
||||
cowIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
cowIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return cowIdentity;
|
||||
}
|
||||
|
||||
void RegisterShuffleCows() {
|
||||
bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_COWS);
|
||||
|
||||
COND_VB_SHOULD(VB_GIVE_ITEM_FROM_COW, shouldRegister, {
|
||||
EnCow* enCow = va_arg(args, EnCow*);
|
||||
CheckIdentity cowIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCow(
|
||||
gPlayState->sceneNum, static_cast<int32_t>(enCow->actor.world.pos.x),
|
||||
static_cast<int32_t>(enCow->actor.world.pos.z));
|
||||
CheckIdentity cowIdentity = IdentifyCow(gPlayState->sceneNum, static_cast<int32_t>(enCow->actor.world.pos.x),
|
||||
static_cast<int32_t>(enCow->actor.world.pos.z));
|
||||
// Has this cow already rewarded an item?
|
||||
if (!Flags_GetRandomizerInf(cowIdentity.randomizerInf)) {
|
||||
Flags_SetRandomizerInf(cowIdentity.randomizerInf);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "soh/ObjectExtension/ObjectExtension.h"
|
||||
#include "item_category_adj.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "variables.h"
|
||||
@@ -186,6 +187,63 @@ void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState*
|
||||
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
CheckIdentity crateIdentity;
|
||||
uint32_t crateSceneNum = sceneNum;
|
||||
|
||||
// pretend night is day to align crates in market and align GF child/adult crates
|
||||
if (sceneNum == SCENE_MARKET_NIGHT) {
|
||||
crateSceneNum = SCENE_MARKET_DAY;
|
||||
} else if (sceneNum == SCENE_GERUDOS_FORTRESS && gPlayState->linkAgeOnLoad == 1 && posX == 310) {
|
||||
if (posZ == -1830) {
|
||||
posZ = -1842;
|
||||
} else if (posZ == -1770) {
|
||||
posZ = -1782;
|
||||
}
|
||||
}
|
||||
|
||||
crateIdentity.randomizerInf = RAND_INF_MAX;
|
||||
crateIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_KIBAKO2, crateSceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifyCrate did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
assert(false);
|
||||
} else {
|
||||
crateIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
crateIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return crateIdentity;
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifySmallCrate(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
CheckIdentity smallCrateIdentity;
|
||||
uint32_t smallCrateSceneNum = sceneNum;
|
||||
|
||||
smallCrateIdentity.randomizerInf = RAND_INF_MAX;
|
||||
smallCrateIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_KIBAKO, smallCrateSceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifyCrate did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
assert(false);
|
||||
} else {
|
||||
smallCrateIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
smallCrateIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return smallCrateIdentity;
|
||||
}
|
||||
|
||||
void ObjKibako2_RandomizerInit(void* actorRef) {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
auto logicSetting = RAND_GET_OPTION(RSK_LOGIC_RULES);
|
||||
@@ -211,8 +269,7 @@ void ObjKibako2_RandomizerInit(void* actorRef) {
|
||||
|
||||
ObjKibako2* crateActor = static_cast<ObjKibako2*>(actorRef);
|
||||
|
||||
auto crateIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCrate(gPlayState->sceneNum, (s16)actor->world.pos.x,
|
||||
(s16)actor->world.pos.z);
|
||||
auto crateIdentity = IdentifyCrate(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(crateIdentity));
|
||||
}
|
||||
|
||||
@@ -224,8 +281,7 @@ void ObjKibako_RandomizerInit(void* actorRef) {
|
||||
|
||||
ObjKibako* smallCrateActor = static_cast<ObjKibako*>(actorRef);
|
||||
|
||||
auto crateIdentity = OTRGlobals::Instance->gRandomizer->IdentifySmallCrate(
|
||||
gPlayState->sceneNum, (s16)actor->home.pos.x, (s16)actor->home.pos.z);
|
||||
auto crateIdentity = IdentifySmallCrate(gPlayState->sceneNum, (s16)actor->home.pos.x, (s16)actor->home.pos.z);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(crateIdentity));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "item_category_adj.h"
|
||||
#include "soh/ObjectExtension/ObjectExtension.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "variables.h"
|
||||
@@ -115,6 +116,69 @@ void EnKusa_RandomizerSpawnCollectible(EnKusa* grassActor, PlayState* play) {
|
||||
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge) {
|
||||
CheckIdentity grassIdentity;
|
||||
|
||||
grassIdentity.randomizerInf = RAND_INF_MAX;
|
||||
grassIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
if (sceneNum == SCENE_GROTTOS) {
|
||||
respawnData = TWO_ACTOR_PARAMS(posX, respawnData);
|
||||
} else {
|
||||
// We'll just pretend it's always daytime for our market bushes.
|
||||
if (sceneNum == SCENE_MARKET_NIGHT) {
|
||||
sceneNum = SCENE_MARKET_DAY;
|
||||
|
||||
/*
|
||||
The two bushes by the tree are not in the same spot
|
||||
between night and day. We'll assume the coordinates
|
||||
of the daytime bushes so that we can count them as
|
||||
the same locations.
|
||||
*/
|
||||
if (posX == -74) {
|
||||
posX = -106;
|
||||
posZ = 277;
|
||||
}
|
||||
if (posX == -87) {
|
||||
posX = -131;
|
||||
posZ = 225;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Same as with Market. ZR has a bush slightly off pos
|
||||
between Child and Adult. This is to merge them into
|
||||
a single location.
|
||||
*/
|
||||
if (sceneNum == SCENE_ZORAS_RIVER) {
|
||||
if (posX == 233) {
|
||||
posX = 231;
|
||||
posZ = -1478;
|
||||
}
|
||||
}
|
||||
|
||||
// The two bushes behind the sign in KF should be separate
|
||||
// locations between Child and Adult.
|
||||
if (sceneNum == SCENE_KOKIRI_FOREST && linkAge == 0) {
|
||||
if (posX == -498 || posX == -523) {
|
||||
posZ = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
respawnData = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
}
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_KUSA, sceneNum, respawnData);
|
||||
|
||||
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
|
||||
grassIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
grassIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return grassIdentity;
|
||||
}
|
||||
|
||||
void EnKusa_RandomizerInit(void* actorRef) {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
|
||||
@@ -124,8 +188,8 @@ void EnKusa_RandomizerInit(void* actorRef) {
|
||||
EnKusa* grassActor = static_cast<EnKusa*>(actorRef);
|
||||
s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1);
|
||||
|
||||
auto grassIdentity = OTRGlobals::Instance->gRandomizer->IdentifyGrass(
|
||||
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, respawnData, gPlayState->linkAgeOnLoad);
|
||||
auto grassIdentity = IdentifyGrass(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z,
|
||||
respawnData, gPlayState->linkAgeOnLoad);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(grassIdentity));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "particle_cmc.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "functions.h"
|
||||
@@ -90,6 +91,29 @@ void BgIceTurara_RandomizerSpawnCollectible(void* actor) {
|
||||
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyIcicle(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
struct CheckIdentity icicleIdentity;
|
||||
uint32_t icicleSceneNum = sceneNum;
|
||||
|
||||
icicleIdentity.randomizerInf = RAND_INF_MAX;
|
||||
icicleIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_BG_ICE_TURARA, icicleSceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifyIcicle did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
assert(false);
|
||||
} else {
|
||||
icicleIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
icicleIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return icicleIdentity;
|
||||
}
|
||||
|
||||
void RegisterShuffleIcicles() {
|
||||
bool shouldRegister = IS_RANDO && Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_ICICLES).Get();
|
||||
|
||||
@@ -97,8 +121,7 @@ void RegisterShuffleIcicles() {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
BgIceTurara* icicleActor = static_cast<BgIceTurara*>(actorRef);
|
||||
|
||||
auto icicleIdentity = OTRGlobals::Instance->gRandomizer->IdentifyIcicle(
|
||||
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
auto icicleIdentity = IdentifyIcicle(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(icicleIdentity));
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "item_category_adj.h"
|
||||
#include "soh/ObjectExtension/ObjectExtension.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h"
|
||||
@@ -100,6 +101,32 @@ void ObjTsubo_RandomizerSpawnCollectible(ObjTsubo* potActor, PlayState* play) {
|
||||
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyPot(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
CheckIdentity potIdentity;
|
||||
uint32_t potSceneNum = sceneNum;
|
||||
|
||||
if (sceneNum == SCENE_GANONDORF_BOSS) {
|
||||
potSceneNum = SCENE_GANONS_TOWER;
|
||||
}
|
||||
|
||||
potIdentity.randomizerInf = RAND_INF_MAX;
|
||||
potIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_TSUBO, potSceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifyPot did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
} else {
|
||||
potIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
potIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return potIdentity;
|
||||
}
|
||||
|
||||
void RegisterShufflePots() {
|
||||
bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_POTS);
|
||||
|
||||
@@ -107,8 +134,7 @@ void RegisterShufflePots() {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
ObjTsubo* potActor = static_cast<ObjTsubo*>(actorRef);
|
||||
|
||||
auto potIdentity = OTRGlobals::Instance->gRandomizer->IdentifyPot(gPlayState->sceneNum, (s16)actor->world.pos.x,
|
||||
(s16)actor->world.pos.z);
|
||||
auto potIdentity = IdentifyPot(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(potIdentity));
|
||||
});
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "item_category_adj.h"
|
||||
#include "particle_cmc.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "functions.h"
|
||||
@@ -118,6 +119,34 @@ void BgIceShelter_RandomizerSpawnCollectible(Actor* actor) {
|
||||
}
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyRedIce(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
struct CheckIdentity redIceIdentity;
|
||||
uint32_t redIceSceneNum = sceneNum;
|
||||
|
||||
// Handle KZ moving
|
||||
if (sceneNum == SCENE_ZORAS_DOMAIN && LINK_IS_ADULT && posX == 531 && posZ == -1818) {
|
||||
posX = 628;
|
||||
}
|
||||
|
||||
redIceIdentity.randomizerInf = RAND_INF_MAX;
|
||||
redIceIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_BG_ICE_SHELTER, redIceSceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifyRedIce did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
assert(false);
|
||||
} else {
|
||||
redIceIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
redIceIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return redIceIdentity;
|
||||
}
|
||||
|
||||
void RegisterShuffleRedIce() {
|
||||
bool shouldRegister = IS_RANDO && Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_RED_ICE).Get();
|
||||
|
||||
@@ -125,8 +154,7 @@ void RegisterShuffleRedIce() {
|
||||
BgIceShelter* redIceActor = va_arg(args, BgIceShelter*);
|
||||
Actor* actor = (Actor*)redIceActor;
|
||||
|
||||
auto redIceIdentity = OTRGlobals::Instance->gRandomizer->IdentifyRedIce(
|
||||
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
auto redIceIdentity = IdentifyRedIce(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(redIceIdentity));
|
||||
|
||||
if (*should) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "particle_cmc.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "variables.h"
|
||||
@@ -205,11 +206,29 @@ void Rock_RandomizerSpawnCollectible(Actor* actor, CheckIdentity rockIdentity, P
|
||||
}
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyRock(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
CheckIdentity rockIdentity;
|
||||
|
||||
rockIdentity.randomizerInf = RAND_INF_MAX;
|
||||
rockIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
Rando::Location* location = OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(
|
||||
ACTOR_EN_ISHI, sceneNum, TWO_ACTOR_PARAMS(posX, posZ));
|
||||
|
||||
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
|
||||
rockIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
rockIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
} else {
|
||||
LUSLOG_WARN("IdentifyRock did not receive a valid RC value %d,%d.", posX, posZ);
|
||||
}
|
||||
|
||||
return rockIdentity;
|
||||
}
|
||||
|
||||
void EnIshi_RandomizerInit(void* actorRef) {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
EnIshi* rockActor = static_cast<EnIshi*>(actorRef);
|
||||
auto rockIdentity = OTRGlobals::Instance->gRandomizer->IdentifyRock(gPlayState->sceneNum, (s16)actor->world.pos.x,
|
||||
(s16)actor->world.pos.z);
|
||||
auto rockIdentity = IdentifyRock(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
if (rockIdentity.randomizerCheck == RC_MAX) {
|
||||
LUSLOG_WARN("ROCK ishi %d\t:\t%d, %d", rockIdentity.randomizerCheck, actor->params & 1,
|
||||
(s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
@@ -227,8 +246,7 @@ void EnIshi_RandomizerInit(void* actorRef) {
|
||||
void ObjBombiwa_RandomizerInit(void* actorRef) {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
ObjBombiwa* rockActor = static_cast<ObjBombiwa*>(actorRef);
|
||||
auto rockIdentity = OTRGlobals::Instance->gRandomizer->IdentifyRock(gPlayState->sceneNum, (s16)actor->world.pos.x,
|
||||
(s16)actor->world.pos.z);
|
||||
auto rockIdentity = IdentifyRock(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
if (rockIdentity.randomizerCheck == RC_MAX) {
|
||||
LUSLOG_INFO("ROCK bombiwa\t:\t%d, %d", rockIdentity.randomizerCheck, (s16)actor->world.pos.x,
|
||||
(s16)actor->world.pos.z);
|
||||
@@ -245,8 +263,7 @@ void ObjBombiwa_RandomizerInit(void* actorRef) {
|
||||
void ObjHamishi_RandomizerInit(void* actorRef) {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
ObjHamishi* rockActor = static_cast<ObjHamishi*>(actorRef);
|
||||
auto rockIdentity = OTRGlobals::Instance->gRandomizer->IdentifyRock(gPlayState->sceneNum, (s16)actor->world.pos.x,
|
||||
(s16)actor->world.pos.z);
|
||||
auto rockIdentity = IdentifyRock(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
if (rockIdentity.randomizerCheck == RC_MAX) {
|
||||
LUSLOG_WARN("ROCK hamishi\t:\t%d, %d", rockIdentity.randomizerCheck, (s16)actor->world.pos.x,
|
||||
(s16)actor->world.pos.z);
|
||||
@@ -286,8 +303,8 @@ void RegisterShuffleRock() {
|
||||
if (*should) {
|
||||
Actor* rockActor = va_arg(args, Actor*);
|
||||
// hook called before OnActorInit sets up object extension
|
||||
auto rockIdentity = OTRGlobals::Instance->gRandomizer->IdentifyRock(
|
||||
gPlayState->sceneNum, (s16)rockActor->world.pos.x, (s16)rockActor->world.pos.z);
|
||||
auto rockIdentity =
|
||||
IdentifyRock(gPlayState->sceneNum, (s16)rockActor->world.pos.x, (s16)rockActor->world.pos.z);
|
||||
if (Rock_RandomizerHoldsItem(rockIdentity, gPlayState, true)) {
|
||||
Rock_RandomizerSpawnCollectible(rockActor, rockIdentity, gPlayState);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "item_category_adj.h"
|
||||
#include "particle_cmc.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
extern PlayState* gPlayState;
|
||||
@@ -89,6 +90,69 @@ void Sign_RoyalTombSpawnCollectible(int16_t flagType, int16_t flag) {
|
||||
}
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifySign(s32 sceneNum, s32 posX, s32 posZ, s32 id) {
|
||||
CheckIdentity signIdentity;
|
||||
uint32_t signSceneNum = sceneNum;
|
||||
Rando::Location* location = nullptr;
|
||||
|
||||
// align child/adult signs
|
||||
if (sceneNum == SCENE_KAKARIKO_VILLAGE && LINK_IS_ADULT && posX == 1165 && posZ == 1545) {
|
||||
posZ = 1550;
|
||||
} else if (sceneNum == SCENE_GRAVEYARD && LINK_IS_ADULT) {
|
||||
if (id == ACTOR_EN_WONDER_TALK2 && posX == -807 && posZ == 266) {
|
||||
posX = -805;
|
||||
} else if (id == ACTOR_EN_WONDER_TALK) {
|
||||
if (posX == 634 && posZ == 260) {
|
||||
posX = 654;
|
||||
posZ = 258;
|
||||
} else if (posX == 634 && posZ == -100) {
|
||||
posX = 654;
|
||||
posZ = -102;
|
||||
} else if (posX == 753 && posZ == 85) {
|
||||
posX = 752;
|
||||
}
|
||||
}
|
||||
} else if (sceneNum == SCENE_ZORAS_RIVER && LINK_IS_ADULT && posX == 4097 && posZ == -1399) {
|
||||
posX = 4096;
|
||||
posZ = -1401;
|
||||
}
|
||||
|
||||
signIdentity.randomizerInf = RAND_INF_MAX;
|
||||
signIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
|
||||
switch (id) {
|
||||
case ACTOR_EN_KANBAN:
|
||||
location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_KANBAN, signSceneNum, actorParams);
|
||||
break;
|
||||
case ACTOR_EN_A_OBJ:
|
||||
location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_A_OBJ, signSceneNum, actorParams);
|
||||
break;
|
||||
case ACTOR_EN_WONDER_TALK2:
|
||||
location = OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_WONDER_TALK2, signSceneNum,
|
||||
actorParams);
|
||||
break;
|
||||
case ACTOR_EN_WONDER_TALK:
|
||||
location = OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_WONDER_TALK, signSceneNum,
|
||||
actorParams);
|
||||
break;
|
||||
default:
|
||||
return signIdentity;
|
||||
}
|
||||
|
||||
if (location == nullptr || location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifySign did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
} else {
|
||||
signIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
signIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return signIdentity;
|
||||
}
|
||||
|
||||
void RegisterShuffleSigns() {
|
||||
bool shouldRegister = IS_RANDO && Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_SIGNS).Get();
|
||||
|
||||
@@ -96,8 +160,8 @@ void RegisterShuffleSigns() {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
EnKanban* signActor = static_cast<EnKanban*>(actorRef);
|
||||
|
||||
auto signIdentity = OTRGlobals::Instance->gRandomizer->IdentifySign(
|
||||
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
auto signIdentity =
|
||||
IdentifySign(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(signIdentity));
|
||||
});
|
||||
|
||||
@@ -105,8 +169,8 @@ void RegisterShuffleSigns() {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
EnAObj* signActor = static_cast<EnAObj*>(actorRef);
|
||||
|
||||
auto signIdentity = OTRGlobals::Instance->gRandomizer->IdentifySign(
|
||||
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
auto signIdentity =
|
||||
IdentifySign(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(signIdentity));
|
||||
});
|
||||
|
||||
@@ -114,8 +178,8 @@ void RegisterShuffleSigns() {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
EnWonderTalk* signActor = static_cast<EnWonderTalk*>(actorRef);
|
||||
|
||||
auto signIdentity = OTRGlobals::Instance->gRandomizer->IdentifySign(
|
||||
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
auto signIdentity =
|
||||
IdentifySign(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(signIdentity));
|
||||
});
|
||||
|
||||
@@ -123,8 +187,8 @@ void RegisterShuffleSigns() {
|
||||
Actor* actor = static_cast<Actor*>(actorRef);
|
||||
EnWonderTalk2* signActor = static_cast<EnWonderTalk2*>(actorRef);
|
||||
|
||||
auto signIdentity = OTRGlobals::Instance->gRandomizer->IdentifySign(
|
||||
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
auto signIdentity =
|
||||
IdentifySign(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, actor->id);
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(signIdentity));
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "soh/ObjectExtension/ObjectExtension.h"
|
||||
#include "item_category_adj.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "variables.h"
|
||||
@@ -125,6 +126,29 @@ void EnWood02_RandomizerSpawnCollectible(EnWood02* treeActor, PlayState* play) {
|
||||
treeIdentity->randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyTree(s32 sceneNum, s32 posX, s32 posZ) {
|
||||
CheckIdentity treeIdentity;
|
||||
|
||||
if (sceneNum == SCENE_MARKET_NIGHT) {
|
||||
sceneNum = SCENE_MARKET_DAY;
|
||||
}
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_WOOD02, sceneNum, actorParams);
|
||||
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK &&
|
||||
(location->GetRCType() != RCTYPE_NLTREE ||
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LOGIC_RULES) == RO_LOGIC_NO_LOGIC)) {
|
||||
treeIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
treeIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
return treeIdentity;
|
||||
}
|
||||
|
||||
treeIdentity.randomizerInf = RAND_INF_MAX;
|
||||
treeIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
return treeIdentity;
|
||||
}
|
||||
|
||||
void EnWood02_RandomizerInit(void* actorRef) {
|
||||
EnWood02* treeActor = static_cast<EnWood02*>(actorRef);
|
||||
if ((treeActor->actor.params <= WOOD_TREE_KAKARIKO_ADULT &&
|
||||
@@ -132,8 +156,8 @@ void EnWood02_RandomizerInit(void* actorRef) {
|
||||
(treeActor->actor.params > WOOD_TREE_KAKARIKO_ADULT &&
|
||||
treeActor->actor.params <= WOOD_BUSH_BLACK_LARGE_SPAWNED &&
|
||||
Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_BUSHES).Get())) {
|
||||
auto treeIdentity = OTRGlobals::Instance->gRandomizer->IdentifyTree(
|
||||
gPlayState->sceneNum, (s16)treeActor->actor.world.pos.x, (s16)treeActor->actor.world.pos.z);
|
||||
auto treeIdentity =
|
||||
IdentifyTree(gPlayState->sceneNum, (s16)treeActor->actor.world.pos.x, (s16)treeActor->actor.world.pos.z);
|
||||
if (treeIdentity.randomizerInf != RAND_INF_MAX && treeIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actorRef, std::move(treeIdentity));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "item_category_adj.h"
|
||||
#include "particle_cmc.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h"
|
||||
@@ -95,6 +96,39 @@ void SpawnNTSC1011WonderItem() {
|
||||
}
|
||||
}
|
||||
|
||||
static CheckIdentity IdentifyWonderItem(s32 sceneNum, s32 par1, s32 par2) {
|
||||
CheckIdentity wonderIdentity;
|
||||
uint32_t wonderSceneNum = sceneNum;
|
||||
|
||||
// align oasis trees in colossus between child/adult
|
||||
if (sceneNum == SCENE_DESERT_COLOSSUS && LINK_IS_ADULT) {
|
||||
if (par1 == 1157 && par2 == 2388) {
|
||||
par1 = 1161;
|
||||
par2 = 2383;
|
||||
} else if (par1 == 1114 && par2 == 2580) {
|
||||
par1 = 1113;
|
||||
par2 = 2581;
|
||||
}
|
||||
}
|
||||
|
||||
wonderIdentity.randomizerInf = RAND_INF_MAX;
|
||||
wonderIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
s32 actorParams = TWO_ACTOR_PARAMS(par1, par2);
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_WONDER_ITEM, wonderSceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
|
||||
LUSLOG_WARN("IdentifyWonderItem did not receive a valid RC value (%d).", location->GetRandomizerCheck());
|
||||
} else {
|
||||
wonderIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
wonderIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return wonderIdentity;
|
||||
}
|
||||
|
||||
uint8_t EnWonderItem_RandomizerHoldsItem(EnWonderItem* wonderActor, PlayState* play) {
|
||||
const CheckIdentity* wonderIdentity = ObjectExtension::GetInstance().Get<CheckIdentity>(&wonderActor->actor);
|
||||
if (wonderIdentity == nullptr) {
|
||||
@@ -103,10 +137,9 @@ uint8_t EnWonderItem_RandomizerHoldsItem(EnWonderItem* wonderActor, PlayState* p
|
||||
bool isDungeonScene = (play->sceneNum >= SCENE_DEKU_TREE && play->sceneNum <= SCENE_GERUDO_TRAINING_GROUND) ||
|
||||
play->sceneNum == SCENE_INSIDE_GANONS_CASTLE;
|
||||
// For dungeons, use room Id and actor index. For overworld, use xz coordinates.
|
||||
auto newIdentity = isDungeonScene ? OTRGlobals::Instance->gRandomizer->IdentifyWonderItem(
|
||||
play->sceneNum, (s16)play->roomCtx.curRoom.num, actorIndex)
|
||||
: OTRGlobals::Instance->gRandomizer->IdentifyWonderItem(
|
||||
play->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
auto newIdentity = isDungeonScene
|
||||
? IdentifyWonderItem(play->sceneNum, (s16)play->roomCtx.curRoom.num, actorIndex)
|
||||
: IdentifyWonderItem(play->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);
|
||||
|
||||
ObjectExtension::GetInstance().Set<CheckIdentity>(actor, std::move(newIdentity));
|
||||
wonderIdentity = ObjectExtension::GetInstance().Get<CheckIdentity>(actor);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <libultraship/bridge/consolevariablebridge.h>
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_Fishing/z_fishing.h"
|
||||
@@ -56,6 +57,28 @@ Color_RGB8 fsPulseColor = { 30, 240, 200 };
|
||||
static s16 fishGroupCounter = 0;
|
||||
static bool enableAdvance = false;
|
||||
|
||||
static CheckIdentity IdentifyFish(s32 sceneNum, s32 actorParams) {
|
||||
CheckIdentity fishIdentity;
|
||||
|
||||
fishIdentity.randomizerInf = RAND_INF_MAX;
|
||||
fishIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
|
||||
// Fishsanity will determine what the identity of the fish should be
|
||||
if (sceneNum == SCENE_FISHING_POND) {
|
||||
return OTRGlobals::Instance->gRandoContext->GetFishsanity()->IdentifyPondFish(actorParams);
|
||||
}
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_FISH, sceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
|
||||
fishIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
fishIdentity.randomizerCheck = location->GetRandomizerCheck();
|
||||
}
|
||||
|
||||
return fishIdentity;
|
||||
}
|
||||
|
||||
namespace Rando {
|
||||
const CheckIdentity Fishsanity::defaultIdentity = { RAND_INF_MAX, RC_UNKNOWN_CHECK };
|
||||
bool Fishsanity::fishsanityHelpersInit = false;
|
||||
@@ -366,7 +389,7 @@ void Fishsanity::OnActorInitHandler(void* refActor) {
|
||||
actor->params = 0x100 | gSaveContext.respawn[RESPAWN_MODE_RETURN].data;
|
||||
}
|
||||
|
||||
fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
fish = IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
// Render fish as randomized item
|
||||
if (Rando::Fishsanity::IsFish(&fish) && !Flags_GetRandomizerInf(fish.randomizerInf)) {
|
||||
if (!drawEnFish) {
|
||||
@@ -383,7 +406,7 @@ void Fishsanity::OnActorInitHandler(void* refActor) {
|
||||
// Initialize fishsanity metadata on this actor
|
||||
Fishing* fishActor = static_cast<Fishing*>(refActor);
|
||||
// fishActor->fishsanityParams = actor->params;
|
||||
fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
fish = IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
|
||||
// With every pond fish shuffled, caught fish will not spawn unless all fish have been caught.
|
||||
if (RAND_GET_OPTION(RSK_FISHSANITY_POND_COUNT).Get() > 16 && !fs->GetPondCleared()) {
|
||||
@@ -414,8 +437,7 @@ void Fishsanity::OnActorUpdateHandler(void* refActor) {
|
||||
|
||||
// State 6 -> Fish caught and hoisted
|
||||
if (fish->fishState == 6) {
|
||||
CheckIdentity identity =
|
||||
OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
CheckIdentity identity = IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
if (identity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||
Flags_SetRandomizerInf(identity.randomizerInf);
|
||||
enableAdvance = true;
|
||||
@@ -429,7 +451,7 @@ void Fishsanity::OnActorUpdateHandler(void* refActor) {
|
||||
}
|
||||
|
||||
if (actor->id == ACTOR_EN_FISH && fs->GetOverworldFishShuffled()) {
|
||||
CheckIdentity fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
CheckIdentity fish = IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
EnFish* fishActor = static_cast<EnFish*>(refActor);
|
||||
if (Rando::Fishsanity::IsFish(&fish) && Flags_GetRandomizerInf(fish.randomizerInf)) {
|
||||
// Reset draw method
|
||||
@@ -506,7 +528,7 @@ void Fishsanity_DrawEffShadow(Actor* actor, Lights* lights, PlayState* play) {
|
||||
}
|
||||
|
||||
void Fishsanity_DrawEnFish(struct Actor* actor, struct PlayState* play) {
|
||||
CheckIdentity fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(play->sceneNum, actor->params);
|
||||
CheckIdentity fish = IdentifyFish(play->sceneNum, actor->params);
|
||||
GetItemEntry randoItem = Rando::Context::GetInstance()->GetFinalGIEntry(fish.randomizerCheck, true, GI_FISH);
|
||||
if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)) {
|
||||
randoItem = GET_ITEM_MYSTERY;
|
||||
@@ -566,7 +588,7 @@ void RegisterShuffleFish() {
|
||||
Actor* actor = va_arg(args, Actor*);
|
||||
auto fs = OTRGlobals::Instance->gRandoContext->GetFishsanity();
|
||||
if (actor->id == ACTOR_EN_FISH && fs->GetOverworldFishShuffled()) {
|
||||
auto fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
auto fish = IdentifyFish(gPlayState->sceneNum, actor->params);
|
||||
if (fish.randomizerCheck != RC_UNKNOWN_CHECK && !Flags_GetRandomizerInf(fish.randomizerInf)) {
|
||||
Flags_SetRandomizerInf(fish.randomizerInf);
|
||||
actor->parent = &GET_PLAYER(gPlayState)->actor;
|
||||
|
||||
@@ -82,7 +82,7 @@ class Fishsanity {
|
||||
|
||||
/**
|
||||
* @brief Returns the identity for a caught pond fish given its params.
|
||||
* Not for use externally from rando, use Randomizer::IdentifyFish
|
||||
* Not for use externally from rando
|
||||
*
|
||||
* @param fishParams Actor parameters for the fish to identify
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "soh/ObjectExtension/ObjectExtension.h"
|
||||
#include "item_category_adj.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer.h"
|
||||
#include "soh/Enhancements/randomizer/RCToRandInf.h"
|
||||
|
||||
extern "C" {
|
||||
#include "macros.h"
|
||||
@@ -899,6 +900,46 @@ void RandomizerOnDialogMessageHandler() {
|
||||
|
||||
extern "C" void func_80A5475C(EnHeishi2* CastleGuard, PlayState* play);
|
||||
|
||||
static ScrubIdentity IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData) {
|
||||
struct ScrubIdentity scrubIdentity;
|
||||
|
||||
scrubIdentity.identity.randomizerInf = RAND_INF_MAX;
|
||||
scrubIdentity.identity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||
scrubIdentity.getItemId = GI_NONE;
|
||||
scrubIdentity.itemPrice = -1;
|
||||
|
||||
// Scrubs that are 0x06 are loaded as 0x03 when child, switching from selling arrows to seeds
|
||||
if (actorParams == 0x06)
|
||||
actorParams = 0x03;
|
||||
|
||||
if (sceneNum == SCENE_GROTTOS) {
|
||||
actorParams = TWO_ACTOR_PARAMS(actorParams, respawnData);
|
||||
}
|
||||
|
||||
Rando::Location* location =
|
||||
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_DNS, sceneNum, actorParams);
|
||||
|
||||
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
|
||||
if (location->GetRandomizerCheck() == RC_HF_DEKU_SCRUB_GROTTO ||
|
||||
location->GetRandomizerCheck() == RC_LW_DEKU_SCRUB_GROTTO_FRONT ||
|
||||
location->GetRandomizerCheck() == RC_LW_DEKU_SCRUB_NEAR_BRIDGE) {
|
||||
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) == RO_SCRUBS_OFF) {
|
||||
return scrubIdentity;
|
||||
}
|
||||
} else if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) != RO_SCRUBS_ALL) {
|
||||
return scrubIdentity;
|
||||
}
|
||||
|
||||
scrubIdentity.identity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
|
||||
scrubIdentity.identity.randomizerCheck = location->GetRandomizerCheck();
|
||||
scrubIdentity.getItemId = (GetItemID)Rando::StaticData::RetrieveItem(location->GetVanillaItem()).GetItemID();
|
||||
scrubIdentity.itemPrice =
|
||||
OTRGlobals::Instance->gRandoContext->GetItemLocation(scrubIdentity.identity.randomizerCheck)->GetPrice();
|
||||
}
|
||||
|
||||
return scrubIdentity;
|
||||
}
|
||||
|
||||
void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_list originalArgs) {
|
||||
va_list args;
|
||||
va_copy(args, originalArgs);
|
||||
@@ -1477,8 +1518,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
|
||||
case VB_BUSINESS_SCRUB_DESPAWN: {
|
||||
EnShopnuts* enShopnuts = va_arg(args, EnShopnuts*);
|
||||
s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1);
|
||||
ScrubIdentity scrubIdentity = OTRGlobals::Instance->gRandomizer->IdentifyScrub(
|
||||
gPlayState->sceneNum, enShopnuts->actor.params, respawnData);
|
||||
ScrubIdentity scrubIdentity = IdentifyScrub(gPlayState->sceneNum, enShopnuts->actor.params, respawnData);
|
||||
|
||||
if (scrubIdentity.identity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||
*should = Flags_GetRandomizerInf(scrubIdentity.identity.randomizerInf);
|
||||
@@ -2154,8 +2194,7 @@ void RandomizerOnActorInitHandler(void* actorRef) {
|
||||
if (actor->id == ACTOR_EN_DNS) {
|
||||
EnDns* enDns = static_cast<EnDns*>(actorRef);
|
||||
s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1);
|
||||
auto scrubIdentity =
|
||||
OTRGlobals::Instance->gRandomizer->IdentifyScrub(gPlayState->sceneNum, enDns->actor.params, respawnData);
|
||||
auto scrubIdentity = IdentifyScrub(gPlayState->sceneNum, enDns->actor.params, respawnData);
|
||||
|
||||
if (scrubIdentity.identity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||
// DNS uses pointers so we're creating our own entry instead of modifying the original
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,29 +22,13 @@ class Randomizer {
|
||||
public:
|
||||
Randomizer();
|
||||
~Randomizer();
|
||||
static Sprite* GetSeedTexture(uint8_t index);
|
||||
bool SpoilerFileExists(const char* spoilerFileName);
|
||||
bool IsTrialRequired(s32 trialFlag);
|
||||
u8 GetRandoSettingValue(RandomizerSettingKey randoSettingKey);
|
||||
RandomizerCheck GetCheckFromRandomizerInf(RandomizerInf randomizerInf);
|
||||
RandomizerInf GetRandomizerInfFromCheck(RandomizerCheck rc);
|
||||
Rando::Location* GetCheckObjectFromActor(s16 actorId, s16 sceneNum, s32 actorParams);
|
||||
ScrubIdentity IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData);
|
||||
CheckIdentity IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData);
|
||||
ShopItemIdentity IdentifyShopItem(s32 sceneNum, u8 slotIndex);
|
||||
CheckIdentity IdentifyCow(s32 sceneNum, s32 posX, s32 posZ);
|
||||
CheckIdentity IdentifyPot(s32 sceneNum, s32 posX, s32 posZ);
|
||||
CheckIdentity IdentifyFish(s32 sceneNum, s32 actorParams);
|
||||
CheckIdentity IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge);
|
||||
CheckIdentity IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ);
|
||||
CheckIdentity IdentifySmallCrate(s32 sceneNum, s32 posX, s32 posZ);
|
||||
CheckIdentity IdentifyRock(s32 sceneNum, s32 posX, s32 posZ);
|
||||
CheckIdentity IdentifyTree(s32 sceneNum, s32 posX, s32 posZ);
|
||||
CheckIdentity IdentifySign(s32 sceneNum, s32 posX, s32 posZ, s32 id);
|
||||
CheckIdentity IdentifyWonderItem(s32 sceneNum, s32 par1, s32 par2);
|
||||
CheckIdentity IdentifyBeggar(s32 sceneNum, s32 textId);
|
||||
CheckIdentity IdentifyIcicle(s32 sceneNum, s32 posX, s32 posZ);
|
||||
CheckIdentity IdentifyRedIce(s32 sceneNum, s32 posX, s32 posZ);
|
||||
GetItemEntry GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogItemId,
|
||||
bool checkObtainability = true);
|
||||
GetItemEntry GetItemFromActor(s16 actorId, s16 sceneNum, s16 actorParams, GetItemID ogItemId,
|
||||
|
||||
Reference in New Issue
Block a user