mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Add warp developer tool (#283)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "2s2h/Enhancements/Enhancements.h"
|
||||
#include "2s2h/Enhancements/Graphics/MotionBlur.h"
|
||||
#include "2s2h/DeveloperTools/DeveloperTools.h"
|
||||
#include "2s2h/DeveloperTools/WarpPoint.h"
|
||||
#include "HudEditor.h"
|
||||
|
||||
extern bool ShouldClearTextureCacheAtEndOfFrame;
|
||||
@@ -408,6 +409,7 @@ void DrawDeveloperToolsMenu() {
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderWarpPointSection();
|
||||
ImGui::Separator();
|
||||
if (mCollisionViewerWindow) {
|
||||
UIWidgets::WindowButton("Collision Viewer", "gWindows.CollisionViewer", mCollisionViewerWindow,
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "WarpPoint.h"
|
||||
|
||||
#include <libultraship/libultraship.h>
|
||||
#include "2s2h/BenGui/UIWidgets.hpp"
|
||||
#include "window/gui/IconsFontAwesome4.h"
|
||||
|
||||
extern "C" {
|
||||
#include "z64.h"
|
||||
#include "macros.h"
|
||||
#include "functions.h"
|
||||
extern PlayState* gPlayState;
|
||||
extern SaveContext gSaveContext;
|
||||
}
|
||||
|
||||
#define CV "gDeveloperTools.WarpPoint."
|
||||
|
||||
// 2S2H Added columns to scene table: entranceSceneId, betterMapSelectIndex, humanName
|
||||
#define DEFINE_SCENE(_name, enumValue, _textId, _drawConfig, _restrictionFlags, _persistentCycleFlags, _entranceSceneId, _betterMapSelectIndex, humanName) \
|
||||
{ enumValue, humanName },
|
||||
#define DEFINE_SCENE_UNSET(_enumValue)
|
||||
|
||||
std::unordered_map<s16, const char*> warpPointSceneList = {
|
||||
#include "tables/scene_table.h"
|
||||
};
|
||||
|
||||
#undef DEFINE_SCENE
|
||||
#undef DEFINE_SCENE_UNSET
|
||||
|
||||
void RenderWarpPointSection() {
|
||||
if (gPlayState == NULL) return;
|
||||
|
||||
if (UIWidgets::Button("Set Warp Point")) {
|
||||
Player* player = GET_PLAYER(gPlayState);
|
||||
|
||||
CVarSetInteger(CV "Entrance", gSaveContext.save.entrance);
|
||||
CVarSetInteger(CV "Room", gPlayState->roomCtx.curRoom.num);
|
||||
CVarSetFloat(CV "X", player->actor.world.pos.x);
|
||||
CVarSetFloat(CV "Y", player->actor.world.pos.y);
|
||||
CVarSetFloat(CV "Z", player->actor.world.pos.z);
|
||||
CVarSetFloat(CV "Rotation", player->actor.shape.rot.y);
|
||||
CVarSetInteger(CV "Saved", 1);
|
||||
}
|
||||
if (CVarGetInteger(CV "Saved", 0)) {
|
||||
u32 sceneId = Entrance_GetSceneIdAbsolute(CVarGetInteger(CV "Entrance", ENTRANCE(SOUTH_CLOCK_TOWN, 0)));
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("%s Room %d", warpPointSceneList[sceneId], CVarGetInteger(CV "Room", 0));
|
||||
ImGui::SameLine();
|
||||
if (UIWidgets::Button(ICON_FA_TIMES, { .size = UIWidgets::Sizes::Inline })) {
|
||||
CVarClear(CV "Entrance");
|
||||
CVarClear(CV "Room");
|
||||
CVarClear(CV "X");
|
||||
CVarClear(CV "Y");
|
||||
CVarClear(CV "Z");
|
||||
CVarClear(CV "Rotation");
|
||||
CVarClear(CV "Saved");
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (UIWidgets::Button("Warp", { .size = UIWidgets::Sizes::Inline })) {
|
||||
Vec3f pos = { CVarGetFloat(CV "X", 0.0f),
|
||||
CVarGetFloat(CV "Y", 0.0f),
|
||||
CVarGetFloat(CV "Z", 0.0f) };
|
||||
|
||||
Play_SetRespawnData(&gPlayState->state, RESPAWN_MODE_DOWN,
|
||||
CVarGetInteger(CV "Entrance", ENTRANCE(SOUTH_CLOCK_TOWN, 0)),
|
||||
CVarGetInteger(CV "Room", 0), PLAYER_PARAMS(0xFF, PLAYER_INITMODE_D),
|
||||
&pos, CVarGetFloat(CV "Rotation", 0.0f));
|
||||
func_80169EFC(&gPlayState->state);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef DEVELOPER_TOOLS_WARP_POINT_H
|
||||
#define DEVELOPER_TOOLS_WARP_POINT_H
|
||||
|
||||
void RenderWarpPointSection();
|
||||
|
||||
#endif // DEVELOPER_TOOLS_WARP_POINT_H
|
||||
Reference in New Issue
Block a user