mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-26 03:12:18 -05:00
fix change age cheat causing link to spawn in the wrong spot (#2573)
This commit is contained in:
parent
0d54cb15df
commit
a5bf135541
@ -89,13 +89,13 @@ void RegisterInfiniteNayrusLove() {
|
|||||||
|
|
||||||
void RegisterMoonJumpOnL() {
|
void RegisterMoonJumpOnL() {
|
||||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||||
|
if (!gPlayState) return;
|
||||||
|
|
||||||
if (CVarGetInteger("gMoonJumpOnL", 0) != 0) {
|
if (CVarGetInteger("gMoonJumpOnL", 0) != 0) {
|
||||||
if (gPlayState) {
|
Player* player = GET_PLAYER(gPlayState);
|
||||||
Player* player = GET_PLAYER(gPlayState);
|
|
||||||
|
|
||||||
if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) {
|
if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) {
|
||||||
player->actor.velocity.y = 6.34375f;
|
player->actor.velocity.y = 6.34375f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -104,23 +104,23 @@ void RegisterMoonJumpOnL() {
|
|||||||
|
|
||||||
void RegisterInfiniteISG() {
|
void RegisterInfiniteISG() {
|
||||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||||
|
if (!gPlayState) return;
|
||||||
|
|
||||||
if (CVarGetInteger("gEzISG", 0) != 0) {
|
if (CVarGetInteger("gEzISG", 0) != 0) {
|
||||||
if (gPlayState) {
|
Player* player = GET_PLAYER(gPlayState);
|
||||||
Player* player = GET_PLAYER(gPlayState);
|
player->swordState = 1;
|
||||||
player->swordState = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterUnrestrictedItems() {
|
void RegisterUnrestrictedItems() {
|
||||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||||
|
if (!gPlayState) return;
|
||||||
|
|
||||||
if (CVarGetInteger("gNoRestrictItems", 0) != 0) {
|
if (CVarGetInteger("gNoRestrictItems", 0) != 0) {
|
||||||
if (gPlayState) {
|
u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong;
|
||||||
u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong;
|
memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions));
|
||||||
memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions));
|
gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup;
|
||||||
gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -142,35 +142,31 @@ void RegisterFreezeTime() {
|
|||||||
|
|
||||||
/// Switches Link's age and respawns him at the last entrance he entered.
|
/// Switches Link's age and respawns him at the last entrance he entered.
|
||||||
void RegisterSwitchAge() {
|
void RegisterSwitchAge() {
|
||||||
bool warped = false;
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||||
Vec3f playerPos;
|
static bool warped = false;
|
||||||
int16_t playerYaw;
|
static Vec3f playerPos;
|
||||||
|
static int16_t playerYaw;
|
||||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([&warped, &playerPos, &playerYaw]() {
|
|
||||||
|
if (!gPlayState) return;
|
||||||
|
|
||||||
if (CVarGetInteger("gSwitchAge", 0) != 0) {
|
if (CVarGetInteger("gSwitchAge", 0) != 0) {
|
||||||
CVarSetInteger("gSwitchAge", 0);
|
CVarSetInteger("gSwitchAge", 0);
|
||||||
if (gPlayState) {
|
playerPos = GET_PLAYER(gPlayState)->actor.world.pos;
|
||||||
playerPos = GET_PLAYER(gPlayState)->actor.world.pos;
|
playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y;
|
||||||
playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y;
|
|
||||||
gPlayState->nextEntranceIndex = gSaveContext.entranceIndex;
|
gPlayState->nextEntranceIndex = gSaveContext.entranceIndex;
|
||||||
gPlayState->sceneLoadFlag = 0x14;
|
gPlayState->sceneLoadFlag = 0x14;
|
||||||
gPlayState->fadeTransition = 11;
|
gPlayState->fadeTransition = 11;
|
||||||
gSaveContext.nextTransitionType = 11;
|
gSaveContext.nextTransitionType = 11;
|
||||||
warped = true;
|
gPlayState->linkAgeOnLoad ^= 1;
|
||||||
if (gPlayState->linkAgeOnLoad == 1) {
|
|
||||||
gPlayState->linkAgeOnLoad = 0;
|
warped = true;
|
||||||
} else {
|
|
||||||
gPlayState->linkAgeOnLoad = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gPlayState) {
|
if (warped && gPlayState->sceneLoadFlag != 0x0014 && gSaveContext.nextTransitionType == 255) {
|
||||||
if (warped && gPlayState->sceneLoadFlag != 0x0014 && gSaveContext.nextTransitionType == 255) {
|
GET_PLAYER(gPlayState)->actor.shape.rot.y = playerYaw;
|
||||||
GET_PLAYER(gPlayState)->actor.shape.rot.y = playerYaw;
|
GET_PLAYER(gPlayState)->actor.world.pos = playerPos;
|
||||||
GET_PLAYER(gPlayState)->actor.world.pos = playerPos;
|
warped = false;
|
||||||
warped = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user