mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-23 00:28:51 -05:00
Cheat: Switch Age and Reload Link (#1963)
* Added button to switch age * Added logic to switch link's age Reloads link from last entrance he went through once his age is switched. * Link now respawns where he last was * Update game.c * move setting to GameMenuBar.cpp, fix build issues Co-authored-by: Jake Edvenson <77412657+JakeEdvenson@users.noreply.github.com> Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
parent
6361a4c776
commit
8571545bf2
@ -1470,6 +1470,11 @@ namespace GameMenuBar {
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("Change Age")) {
|
||||
CVar_SetS32("gSwitchAge", 1);
|
||||
}
|
||||
UIWidgets::Tooltip("Switches links age and reloads the area.");
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,10 @@ VisMono sMonoColors;
|
||||
ViMode sViMode;
|
||||
FaultClient sGameFaultClient;
|
||||
u16 sLastButtonPressed;
|
||||
int32_t warpTime = 0;
|
||||
bool warped = false;
|
||||
Vec3f playerPos;
|
||||
int16_t playerYaw;
|
||||
|
||||
// Forward declared, because this in a C++ header.
|
||||
int gfx_create_framebuffer(uint32_t width, uint32_t height);
|
||||
@ -427,6 +431,33 @@ void GameState_Update(GameState* gameState) {
|
||||
CVar_SetS32("gPrevTime", -1);
|
||||
}
|
||||
|
||||
//Switches Link's age and respawns him at the last entrance he entered.
|
||||
if (CVar_GetS32("gSwitchAge", 0) != 0) {
|
||||
CVar_SetS32("gSwitchAge", 0);
|
||||
if (gPlayState) {
|
||||
playerPos = GET_PLAYER(gPlayState)->actor.world.pos;
|
||||
playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y;
|
||||
gPlayState->nextEntranceIndex = gSaveContext.entranceIndex;
|
||||
gPlayState->sceneLoadFlag = 0x14;
|
||||
gPlayState->fadeTransition = 11;
|
||||
gSaveContext.nextTransition = 11;
|
||||
warped = true;
|
||||
if (gPlayState->linkAgeOnLoad == 1) {
|
||||
gPlayState->linkAgeOnLoad = 0;
|
||||
} else {
|
||||
gPlayState->linkAgeOnLoad = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gPlayState) {
|
||||
if (warped && gPlayState->sceneLoadFlag != 0x0014 && gSaveContext.nextTransition == 255) {
|
||||
GET_PLAYER(gPlayState)->actor.shape.rot.y = playerYaw;
|
||||
GET_PLAYER(gPlayState)->actor.world.pos = playerPos;
|
||||
warped = false;
|
||||
}
|
||||
}
|
||||
|
||||
//since our CVar is same value and properly default to 0 there is not problems doing this in single line.
|
||||
gSaveContext.language = CVar_GetS32("gLanguages", 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user