mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-26 16:15:19 -07:00
Merge pull request #5 from aMannus/christmas-tree
Move ending to christmas tree code
This commit is contained in:
commit
40f07b5c4c
4 changed files with 29 additions and 42 deletions
|
@ -65,6 +65,7 @@ typedef enum {
|
|||
extern "C" {
|
||||
#endif
|
||||
uint8_t GameInteractor_NoUIActive();
|
||||
void GameInteractor_SetNoUIActive(uint8_t state);
|
||||
GILinkSize GameInteractor_GetLinkSize();
|
||||
void GameInteractor_SetLinkSize(GILinkSize size);
|
||||
uint8_t GameInteractor_InvisibleLinkActive();
|
||||
|
|
|
@ -36,6 +36,10 @@ uint8_t GameInteractor_NoUIActive() {
|
|||
return GameInteractor::State::NoUIActive;
|
||||
}
|
||||
|
||||
void GameInteractor_SetNoUIActive(uint8_t state) {
|
||||
GameInteractor::State::NoUIActive = state;
|
||||
}
|
||||
|
||||
// MARK: - GameInteractor::State::LinkSize
|
||||
GILinkSize GameInteractor_GetLinkSize() {
|
||||
return GameInteractor::State::LinkSize;
|
||||
|
|
|
@ -670,52 +670,14 @@ void RegisterTriforceHunt() {
|
|||
}
|
||||
|
||||
void RegisterGrantGanonsBossKey() {
|
||||
static uint16_t eventTimer = -1;
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() {
|
||||
Player* player = GET_PLAYER(gPlayState);
|
||||
Actor* aplayer = &GET_PLAYER(gPlayState)->actor;
|
||||
// Triforce Hunt needs the check if the player isn't being teleported to the credits scene.
|
||||
if (!GameInteractor::IsGameplayPaused() && Flags_GetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY) &&
|
||||
gPlayState->sceneLoadFlag != 0x14 && (1 << 0 & gSaveContext.inventory.dungeonItems[SCENE_GANONS_TOWER]) == 0) {
|
||||
GetItemEntry getItemEntry =
|
||||
ItemTableManager::Instance->RetrieveItemEntry(MOD_RANDOMIZER, RG_GANONS_CASTLE_BOSS_KEY);
|
||||
GiveItemEntryWithoutActor(gPlayState, getItemEntry);
|
||||
if (gPlayState->sceneNum == SCENE_KAKARIKO_VILLAGE) {
|
||||
eventTimer = 0;
|
||||
} else {
|
||||
eventTimer = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GameInteractor::IsGameplayPaused() && gSaveContext.inventory.dungeonItems[SCENE_GANONS_TOWER] > 0
|
||||
&& eventTimer == 0) {
|
||||
eventTimer = 1;
|
||||
}
|
||||
if (eventTimer >= 1 && eventTimer <= 3) {
|
||||
eventTimer++;
|
||||
}
|
||||
if (eventTimer == 4) {
|
||||
if (gPlayState->sceneNum == SCENE_KAKARIKO_VILLAGE) {
|
||||
player->actor.world.pos.x = -929.336;
|
||||
player->actor.world.pos.y = 0;
|
||||
player->actor.world.pos.z = 446.178;
|
||||
player->actor.shape.rot.x = 0;
|
||||
player->actor.shape.rot.y = 17537;
|
||||
player->actor.shape.rot.z = 0;
|
||||
GameInteractor::State::NoUIActive = 1;
|
||||
|
||||
if (!Actor_FindNearby(gPlayState, aplayer, ACTOR_END_TITLE, ACTORCAT_ITEMACTION, 1000)) {
|
||||
//Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_END_TITLE, 0, 0, 0, 0, 0, 0, 2, false);
|
||||
}
|
||||
|
||||
player->stateFlags1 = PLAYER_STATE1_INPUT_DISABLED;
|
||||
} else {
|
||||
eventTimer = 5;
|
||||
}
|
||||
}
|
||||
if (eventTimer == 5) {
|
||||
eventTimer = -1;
|
||||
GameInteractor::State::NoUIActive = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ void EnChristmasTree_Draw(Actor* thisx, PlayState* play);
|
|||
|
||||
void EnChristmasTree_Wait(EnChristmasTree* this, PlayState* play);
|
||||
void EnChristmasTree_Talk(EnChristmasTree* this, PlayState* play);
|
||||
void EnChristmasTree_SetupEndTitle(EnChristmasTree* this, PlayState* play);
|
||||
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
|
@ -73,20 +74,39 @@ void EnChristmasTree_Talk(EnChristmasTree* this, PlayState* play) {
|
|||
u8 dialogState = Message_GetState(&play->msgCtx);
|
||||
if (dialogState != TEXT_STATE_CHOICE) {
|
||||
if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // advanced final textbox
|
||||
this->actionFunc = EnChristmasTree_Wait;
|
||||
|
||||
// Teleport to credits when goal is reached.
|
||||
if (gSaveContext.triforcePiecesCollected >= Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED)) {
|
||||
gSaveContext.sohStats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME;
|
||||
gSaveContext.sohStats.gameComplete = 1;
|
||||
Flags_SetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY);
|
||||
Play_PerformSave(play);
|
||||
GameInteractor_SetTriforceHuntCreditsWarpActive(true);
|
||||
this->actionFunc = EnChristmasTree_SetupEndTitle;
|
||||
} else {
|
||||
this->actionFunc = EnChristmasTree_Wait;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnChristmasTree_SetupEndTitle(EnChristmasTree* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
player->actor.world.pos.x = -929.336;
|
||||
player->actor.world.pos.y = 0;
|
||||
player->actor.world.pos.z = 446.178;
|
||||
player->actor.shape.rot.x = 0;
|
||||
player->actor.shape.rot.y = 17537;
|
||||
player->actor.shape.rot.z = 0;
|
||||
|
||||
GameInteractor_SetNoUIActive(1);
|
||||
|
||||
Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_END_TITLE, 0, 0, 0, 0, 0, 0, 2, false);
|
||||
|
||||
player->stateFlags1 = PLAYER_STATE1_INPUT_DISABLED;
|
||||
|
||||
Flags_SetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY);
|
||||
|
||||
this->actionFunc = EnChristmasTree_Wait;
|
||||
}
|
||||
|
||||
void EnChristmasTree_Update(Actor* thisx, PlayState* play) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue