-
Notifications
You must be signed in to change notification settings - Fork 521
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
Varuuna
wants to merge
46
commits into
HarbourMasters:develop
Choose a base branch
from
Varuuna:grassanity
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Rando] Grassanity #4889
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 4579611
Merge latest from HM64
Varuuna 57477f1
* fixed locations post-merge
Varuuna 9ef6ce3
* renamed option and types to 'GRASSANITY'
Varuuna 4daa372
* color is a sickly green when containing a check
Varuuna 4cc675a
Merge remote-tracking branch 'origin/main' into grassanity
Varuuna 6df13af
* forgot to rename the files to grassanity
Varuuna 58e24b3
Removed old WIP locacc files
Varuuna 98646ad
* removed comments in bush actor
Varuuna 41b7870
Added DC + MQ
Varuuna 047b98c
Fixed DC incorrect pos value on 1 loc
Varuuna 9a89c6d
JJB done minus after big octo
Varuuna 586fbdd
Added BotW + MQ locs
Varuuna bc936c3
WIP grottos
Varuuna 8bff058
Merge branch 'main' into grassanity
Varuuna f3a0726
Grottos done
Varuuna 6e699e3
Workaround to allow market grass during night
Varuuna 6576bd4
Seperated the 2 KF bushes into 4 checks
Varuuna 0ac012f
Hints and additional formatting
Varuuna 056b062
Slightly less ghastly color
Varuuna 27d9dd2
Corrected the 2 JJB locs
Varuuna 30acbe6
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna 6590f97
Merge from develop
Varuuna 22e07a5
* Renaming and removal of some locs.
Varuuna b39d0a2
* formatting and removal of dupe lines after merge
Varuuna 4a58325
* see previous (forgot to stage woops)
Varuuna 023a82e
* Clear grassIdentity on item drop
Varuuna 476cf01
* fixed dupe location spoiler names which caused occasional crash whe…
Varuuna 5a93a39
* reverse should
Varuuna 286783c
* fixed faulty locations
Varuuna ba37d44
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna 747fec8
* corrected KAK location names and some formatting
Varuuna 47db92b
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna dee8b44
* Fixed market bushes by tree not working at night
Varuuna c22b064
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna 51b41d6
* merged ZR near PoH grass into a single loc
Varuuna 20ed9de
merge and update options from develop
Varuuna fbf1b49
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna 10e4b70
* Changed to ShipInit (might be missing something?)
Varuuna c73fa2f
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna 39c6383
* Renaming to Shuffle Grass
Varuuna 2793cb2
* minor fix
Varuuna b27dd3e
* keyboard fail lol
Varuuna eb2add7
Merge remote-tracking branch 'hm64/develop' into grassanity
Varuuna b08736b
* suggestions
Varuuna 5730a73
* removed unused function
Varuuna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
#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" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.