Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rando] Grassanity #4889

Open
wants to merge 46 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b754479
* Overworld pretty much done.
Varuuna Jan 16, 2025
4579611
Merge latest from HM64
Varuuna Jan 16, 2025
57477f1
* fixed locations post-merge
Varuuna Jan 16, 2025
9ef6ce3
* renamed option and types to 'GRASSANITY'
Varuuna Jan 16, 2025
4daa372
* color is a sickly green when containing a check
Varuuna Jan 16, 2025
4cc675a
Merge remote-tracking branch 'origin/main' into grassanity
Varuuna Jan 16, 2025
6df13af
* forgot to rename the files to grassanity
Varuuna Jan 16, 2025
58e24b3
Removed old WIP locacc files
Varuuna Jan 16, 2025
98646ad
* removed comments in bush actor
Varuuna Jan 17, 2025
41b7870
Added DC + MQ
Varuuna Jan 17, 2025
047b98c
Fixed DC incorrect pos value on 1 loc
Varuuna Jan 17, 2025
9a89c6d
JJB done minus after big octo
Varuuna Jan 18, 2025
586fbdd
Added BotW + MQ locs
Varuuna Jan 18, 2025
bc936c3
WIP grottos
Varuuna Jan 18, 2025
8bff058
Merge branch 'main' into grassanity
Varuuna Jan 18, 2025
f3a0726
Grottos done
Varuuna Jan 18, 2025
6e699e3
Workaround to allow market grass during night
Varuuna Jan 18, 2025
6576bd4
Seperated the 2 KF bushes into 4 checks
Varuuna Jan 18, 2025
0ac012f
Hints and additional formatting
Varuuna Jan 18, 2025
056b062
Slightly less ghastly color
Varuuna Jan 18, 2025
27d9dd2
Corrected the 2 JJB locs
Varuuna Jan 19, 2025
30acbe6
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna Jan 20, 2025
6590f97
Merge from develop
Varuuna Jan 21, 2025
22e07a5
* Renaming and removal of some locs.
Varuuna Jan 22, 2025
b39d0a2
* formatting and removal of dupe lines after merge
Varuuna Jan 22, 2025
4a58325
* see previous (forgot to stage woops)
Varuuna Jan 22, 2025
023a82e
* Clear grassIdentity on item drop
Varuuna Jan 22, 2025
476cf01
* fixed dupe location spoiler names which caused occasional crash whe…
Varuuna Jan 22, 2025
5a93a39
* reverse should
Varuuna Jan 22, 2025
286783c
* fixed faulty locations
Varuuna Jan 22, 2025
ba37d44
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna Jan 22, 2025
747fec8
* corrected KAK location names and some formatting
Varuuna Jan 23, 2025
47db92b
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna Jan 23, 2025
dee8b44
* Fixed market bushes by tree not working at night
Varuuna Jan 24, 2025
c22b064
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna Jan 24, 2025
51b41d6
* merged ZR near PoH grass into a single loc
Varuuna Jan 24, 2025
20ed9de
merge and update options from develop
Varuuna Jan 28, 2025
fbf1b49
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna Jan 28, 2025
10e4b70
* Changed to ShipInit (might be missing something?)
Varuuna Jan 28, 2025
c73fa2f
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna Feb 4, 2025
39c6383
* Renaming to Shuffle Grass
Varuuna Feb 4, 2025
2793cb2
* minor fix
Varuuna Feb 4, 2025
b27dd3e
* keyboard fail lol
Varuuna Feb 4, 2025
eb2add7
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna Feb 5, 2025
b08736b
* suggestions
Varuuna Feb 5, 2025
5730a73
* removed unused function
Varuuna Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ typedef enum {
VB_DOOR_BE_LOCKED,
// Vanilla condition: ((doorActor->params >> 7) & 7) == 3
VB_DOOR_PLAY_SCENE_TRANSITION,
// Opt: *EnKusa
VB_GRASS_SETUP_DRAW,
VB_GRASS_DROP_ITEM,

/*** Play Cutscenes ***/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ void StaticData::HintTable_Init_Exclude_Dungeon() {
/*german*/ "",
/*french*/ "Selon moi, un #coeur dans l'Arbre Mojo# cache #[[1]]#.", {QM_RED, QM_GREEN}));

hintTextTable[RHT_DEKU_TREE_GRASS] = HintText(CustomMessage("They say that some #grass in the Deku Tree# hides #[[1]]#.",
/*german*/ "",
/*french*/ "", {QM_RED, QM_GREEN}));

/*--------------------------
| DODONGOS CAVERN |
---------------------------*/
Expand Down Expand Up @@ -295,6 +299,10 @@ hintTextTable[RHT_DODONGOS_CAVERN_BOSS_ROOM_CHEST] = HintText(CustomMessage("The
/*german*/ "!!!",
/*french*/ "Selon moi, #jouer un air orageux pour une pierre étrange dans la Caverne Dodongo# révèle #[[1]]#.", {QM_RED, QM_GREEN}));

hintTextTable[RHT_DODONGOS_CAVERN_GRASS] = HintText(CustomMessage("They say that some #grass in Dodongo's Cavern# hides #[[1]]#.",
/*german*/ "!!!",
/*french*/ "", {QM_RED, QM_GREEN}));


/*--------------------------
| JABU JABUS BELLY |
Expand Down Expand Up @@ -456,6 +464,10 @@ hintTextTable[RHT_DODONGOS_CAVERN_BOSS_ROOM_CHEST] = HintText(CustomMessage("The
/*german*/ "",
/*french*/ "Selon moi, près d'un #ascenceur central dans le Ventre de Jabu-Jabu# se trouve #[[1]]#.", {QM_RED, QM_GREEN}));

hintTextTable[RHT_JABU_JABUS_BELLY_GRASS] = HintText(CustomMessage("They say that some #grass in Jabu Jabu's Belly# hides #[[1]]#.",
/*german*/ "",
/*french*/ "", {QM_RED, QM_GREEN}));

/*--------------------------
| FOREST TEMPLE |
---------------------------*/
Expand Down Expand Up @@ -1687,6 +1699,10 @@ hintTextTable[RHT_SHADOW_TEMPLE_MAP_CHEST] = HintText(CustomMessage("They say th
/*german*/ "!!!",
/*french*/ "Selon moi, #appeler le soleil dans une impasse# à l’intérieur du puits révèle #[[1]]#.", {QM_RED, QM_GREEN}));

hintTextTable[RHT_BOTTOM_OF_THE_WELL_GRASS] = HintText(CustomMessage("They say that some #grass in the Bottom of the Well# hides #[[1]]#.",
/*german*/ "",
/*french*/ "", {QM_RED, QM_GREEN}));


/*--------------------------
| ICE CAVERN |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1954,5 +1954,25 @@ void StaticData::HintTable_Init_Exclude_Overworld() {

hintTextTable[RHT_GRAVEYARD_ROYAL_FAMILYS_TOMB_SUN_FAIRY] = HintText(CustomMessage("They say that #calling the sun in a royal tomb# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_KF_GRASS] = HintText(CustomMessage("They say that #cutting some grass in a forest# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_LW_GRASS] = HintText(CustomMessage("They say that #cutting some grass in the woods# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_MARKET_GRASS] = HintText(CustomMessage("They say that #cutting some grass in the market# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_HC_GRASS] = HintText(CustomMessage("They say that #cutting some grass near the castle# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_KAK_GRASS] = HintText(CustomMessage("They say that #cutting some grass in a village# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_GY_GRASS] = HintText(CustomMessage("They say that #cutting some grass in a graveyard# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_LH_GRASS] = HintText(CustomMessage("They say that #cutting some grass near a lake# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_HF_GRASS] = HintText(CustomMessage("They say that #cutting some grass on a field# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_ZR_GRASS] = HintText(CustomMessage("They say that #cutting some grass near a river# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

hintTextTable[RHT_GROTTO_GRASS] = HintText(CustomMessage("They say that #cutting some grass in a grotto# reveals #[[1]]#.", { QM_RED, QM_GREEN }));

}
}
9 changes: 9 additions & 0 deletions soh/soh/Enhancements/randomizer/3drando/item_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,15 @@ void GenerateItemPool() {
if (overworldPotsActive || dungeonPotsActive) {
PlaceItemsForType(RCTYPE_POT, overworldPotsActive, dungeonPotsActive, false);
}

// Shuffle Grass
bool overworldGrassActive = ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_OVERWORLD) ||
ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_ALL);
bool dungeonGrassActive = ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_DUNGEONS) ||
ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_ALL);
if (overworldGrassActive || dungeonGrassActive) {
PlaceItemsForType(RCTYPE_GRASS, overworldGrassActive, dungeonGrassActive, false);
}

auto fsMode = ctx->GetOption(RSK_FISHSANITY);
if (fsMode.IsNot(RO_FISHSANITY_OFF)) {
Expand Down
113 changes: 113 additions & 0 deletions soh/soh/Enhancements/randomizer/ShuffleGrass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#include "ShuffleGrass.h"
#include "soh_assets.h"
#include "static_data.h"

extern "C" {
#include "variables.h"
#include "overlays/actors/ovl_En_Kusa/z_en_kusa.h"
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
#include "objects/object_kusa/object_kusa.h"
extern PlayState* gPlayState;
Copy link
Contributor

@aMannus aMannus Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree on this one, we don't do this in other places of the code either.

}

#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).Get()

extern void EnItem00_DrawRandomizedItem(EnItem00* enItem00, PlayState* play);

extern "C" void EnKusa_RandomizerDraw(Actor* thisx, PlayState* play) {
static Gfx* dLists[] = { (Gfx*)gFieldBushDL, (Gfx*)object_kusa_DL_000140, (Gfx*)object_kusa_DL_000140 };
auto grassActor = ((EnKusa*)thisx);

OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gDPSetGrayscaleColor(POLY_OPA_DISP++, 175, 255, 0, 255);

if (grassActor->grassIdentity.randomizerCheck != RC_MAX &&
Flags_GetRandomizerInf(grassActor->grassIdentity.randomizerInf) == 0) {
gSPGrayscale(POLY_OPA_DISP++, true);
}

if (grassActor->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) {
Gfx_DrawDListOpa(play, (Gfx*)object_kusa_DL_0002E0);
} else {
Gfx_DrawDListOpa(play, dLists[grassActor->actor.params & 3]);
}

gSPGrayscale(POLY_OPA_DISP++, false);

CLOSE_DISPS(play->state.gfxCtx);
}

uint8_t EnKusa_RandomizerHoldsItem(EnKusa* grassActor, PlayState* play) {
if (grassActor->grassIdentity.randomizerCheck == RC_MAX)
return false;

RandomizerCheck rc = grassActor->grassIdentity.randomizerCheck;

uint8_t isDungeon = Rando::StaticData::GetLocation(rc)->IsDungeon();
uint8_t grassSetting = Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_GRASS).Get();

// Don't pull randomized item if grass isn't randomized or is already checked
if (!IS_RANDO || (grassSetting == RO_SHUFFLE_GRASS_OVERWORLD && isDungeon) ||
(grassSetting == RO_SHUFFLE_GRASS_DUNGEONS && !isDungeon) ||
Flags_GetRandomizerInf(grassActor->grassIdentity.randomizerInf) ||
grassActor->grassIdentity.randomizerCheck == RC_UNKNOWN_CHECK) {
return false;
} else {
return true;
}
}

void EnKusa_RandomizerSpawnCollectible(EnKusa* grassActor, PlayState* play) {
EnItem00* item00 = (EnItem00*)Item_DropCollectible2(play, &grassActor->actor.world.pos, ITEM00_SOH_DUMMY);
item00->randoInf = grassActor->grassIdentity.randomizerInf;
item00->itemEntry =
Rando::Context::GetInstance()->GetFinalGIEntry(grassActor->grassIdentity.randomizerCheck, true, GI_NONE);
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
item00->actor.velocity.y = 8.0f;
item00->actor.speedXZ = 2.0f;
item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
}

void EnKusa_RandomizerInit(void* actorRef) {
Actor* actor = static_cast<Actor*>(actorRef);

if (actor->id != ACTOR_EN_KUSA)
return;

EnKusa* grassActor = static_cast<EnKusa*>(actorRef);
s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1);

grassActor->grassIdentity = OTRGlobals::Instance->gRandomizer->IdentifyGrass(
gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, respawnData, gPlayState->linkAgeOnLoad);
}

void RegisterShuffleGrass() {
bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_GRASS);

COND_ID_HOOK(OnActorInit, ACTOR_EN_KUSA, shouldRegister, EnKusa_RandomizerInit);

COND_VB_SHOULD(VB_GRASS_SETUP_DRAW, shouldRegister, {
EnKusa* grassActor = va_arg(args, EnKusa*);
if (EnKusa_RandomizerHoldsItem(grassActor, gPlayState)) {
grassActor->actor.draw = (ActorFunc)EnKusa_RandomizerDraw;
*should = false;
} else {
*should = true;
}
});

COND_VB_SHOULD(VB_GRASS_DROP_ITEM, shouldRegister, {
EnKusa* grassActor = va_arg(args, EnKusa*);
if (EnKusa_RandomizerHoldsItem(grassActor, gPlayState)) {
EnKusa_RandomizerSpawnCollectible(grassActor, gPlayState);
grassActor->grassIdentity.randomizerCheck = RC_MAX;
grassActor->grassIdentity.randomizerInf = RAND_INF_MAX;
*should = false;
} else {
*should = true;
}
});
}

static RegisterShipInitFunc initFunc(RegisterShuffleGrass, { "IS_RANDO" });
17 changes: 17 additions & 0 deletions soh/soh/Enhancements/randomizer/ShuffleGrass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef SHUFFLEGRASS_H
#define SHUFFLEGRASS_H

#include <z64.h>
#include <soh/OTRGlobals.h>

#ifdef __cplusplus
extern "C" {
#endif
void EnKusa_RandomizerInit(void* actorRef);
#ifdef __cplusplus
};
#endif

void ShuffleGrass_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_list originalArgs);
Varuuna marked this conversation as resolved.
Show resolved Hide resolved

#endif //SHUFFLEGRASS_H
5 changes: 5 additions & 0 deletions soh/soh/Enhancements/randomizer/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ void Context::GenerateLocationPool() {
AddLocations(StaticData::GetOverworldPotLocations());
}

if (mOptions[RSK_SHUFFLE_GRASS].Is(RO_SHUFFLE_GRASS_OVERWORLD) ||
mOptions[RSK_SHUFFLE_GRASS].Is(RO_SHUFFLE_GRASS_ALL)) {
AddLocations(StaticData::GetOverworldGrassLocations());
}

AddLocations(StaticData::GetAllDungeonLocations());
}

Expand Down
Loading