mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 21:29:58 -04:00
Add a free camera to the debug menu.
With it on, the game draws from a camera of the menu's instead of its own, in play and in cutscenes. The left stick moves it along its view and sideways, the right stick turns it, ZR and ZL raise and lower it, R makes it faster and L slower, and Link stands meanwhile; or the camera stays where it is and the pad plays the game. It works inside the game's own camera update: a new patch site sends the instruction at which the frame's position, target and up vector are final to a host function, which replaces them for the camera that follows Link and the one the events direct, so the game draws, culls and loads detail for what the free camera sees. The camera of the interface's 3D models and the one the sound follows stay the game's. The set is off unless the menu switches it on. A teleport's arrival starts the free camera again from the game's view. Tested in Hyrule Field with scripted stick input (turn, rise, strafe, with Link's position unchanged), with the pad playing while the camera stays, across a teleport to Kakariko Village, during the Kakariko arrival cutscene, and switched on by a click in the menu. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// open, so its input, its sounds and the game's blocked pad are the menu's own): on the left edge, in the performance
|
||||
// overlay's look, with the game in view beside it. What it does to the game is in
|
||||
// debug_tools.c: the game's on/off flags by name, teleporting to the game's own start positions, starting its events,
|
||||
// the game's speed, Link's position, and a search of the game's memory with values to set and to hold. Plain Dear ImGui with English text: a tool for testing, not part of the game's
|
||||
// the game's speed, Link's position, a free camera, and a search of the game's memory with values to set and to hold. Plain Dear ImGui with English text: a tool for testing, not part of the game's
|
||||
// interface. Present thread only.
|
||||
#include <algorithm>
|
||||
#include <ctype.h>
|
||||
@@ -288,7 +288,30 @@ void tab_world(void) {
|
||||
ImGui::TextWrapped("The whole game runs at this speed, its interface and its music's timing included. It goes back to 1x when "
|
||||
"the game is closed.");
|
||||
ImGui::Separator();
|
||||
ImGui::TextWrapped("Not in this menu yet: the free camera.");
|
||||
ImGui::TextColored(ImVec4(236 / 255.0f, 196 / 255.0f, 104 / 255.0f, 1), "Free camera");
|
||||
if (!dbg_freecam_available()) {
|
||||
ImGui::TextWrapped("The free camera needs the game's code built by this version: the launcher's update or its rebuild "
|
||||
"makes it.");
|
||||
return;
|
||||
}
|
||||
int sticks = 1;
|
||||
float cam_speed = 8;
|
||||
double at[3] = {0, 0, 0};
|
||||
bool on = dbg_freecam(&sticks, &cam_speed, at) != 0;
|
||||
bool changed = ImGui::Checkbox("The game draws from a camera of your own", &on);
|
||||
if (on) {
|
||||
if (ImGui::RadioButton("The sticks fly the camera, Link stands", sticks != 0)) sticks = 1, changed = true;
|
||||
if (ImGui::RadioButton("The camera stays where it is, the pad plays the game", sticks == 0)) sticks = 0, changed = true;
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
if (ImGui::SliderFloat("##camspeed", &cam_speed, 1.0f, 100.0f, "%.0f metres a second", ImGuiSliderFlags_Logarithmic)) changed = true;
|
||||
if (ImGui::Button("Back to the game's view")) dbg_freecam_reset();
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("x %.1f y %.1f z %.1f", at[0], at[1], at[2]);
|
||||
}
|
||||
if (changed) dbg_freecam_set(on, sticks, cam_speed);
|
||||
ImGui::TextWrapped("Close this menu to fly: the left stick moves along the view and sideways, the right stick turns, ZR and ZL "
|
||||
"go up and down, R is four times as fast and L four times as slow. The game goes on meanwhile and "
|
||||
"draws what the camera sees; the game speed above slows it down. The camera does not stop at walls.");
|
||||
}
|
||||
|
||||
// ---- memory
|
||||
|
||||
Reference in New Issue
Block a user