Merge branch 'develop' into states-extra

This commit is contained in:
louist103 2022-05-12 12:45:46 -04:00 committed by GitHub
commit b4f480ba47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 47 additions and 37 deletions

View file

@ -106,7 +106,7 @@ void Console::Draw() {
if (!this->opened) return;
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
ImGui::Begin("Console", nullptr);
ImGui::Begin("Console", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
const ImVec2 pos = ImGui::GetWindowPos();
const ImVec2 size = ImGui::GetWindowSize();

View file

@ -257,7 +257,7 @@ namespace SohImGui {
void LoadTexture(const std::string& name, const std::string& path) {
GfxRenderingAPI* api = gfx_get_current_rendering_api();
const auto res = GlobalCtx2::GetInstance()->GetResourceManager()->LoadFile(normalize(path));
const auto res = GlobalCtx2::GetInstance()->GetResourceManager()->LoadFile(path);
const auto asset = new GameAsset{ api->new_texture() };
uint8_t* img_data = stbi_load_from_memory(reinterpret_cast<const stbi_uc*>(res->buffer.get()), res->dwBufferSize, &asset->width, &asset->height, nullptr, 4);
@ -277,7 +277,7 @@ namespace SohImGui {
void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint) {
GfxRenderingAPI* api = gfx_get_current_rendering_api();
const auto res = static_cast<Ship::Texture*>(GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(normalize(path)).get());
const auto res = static_cast<Ship::Texture*>(GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(path).get());
std::vector<uint8_t> texBuffer;
texBuffer.reserve(res->width * res->height * 4);
@ -417,6 +417,15 @@ namespace SohImGui {
}
}
void EnhancementButton(std::string text, std::string cvarName)
{
bool val = (bool)CVar_GetS32(cvarName.c_str(), 0);
if (ImGui::Button(text.c_str())) {
CVar_SetS32(cvarName.c_str(), !val);
needs_save = true;
}
}
void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format)
{
int val = CVar_GetS32(cvarName.c_str(), 0);
@ -661,6 +670,7 @@ namespace SohImGui {
EnhancementCheckbox("Animated Link in Pause Menu", "gPauseLiveLink");
EnhancementCheckbox("Enable 3D Dropped items", "gNewDrops");
EnhancementCheckbox("Faster Block Push", "gFasterBlockPush");
EnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon");
EnhancementCheckbox("Always show dungeon entrances", "gAlwaysShowDungeonMinimapIcon");
@ -725,10 +735,11 @@ namespace SohImGui {
if (ImGui::BeginMenu("Developer Tools"))
{
EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled");
ImGui::Separator();
EnhancementCheckbox("Stats", "gStatsEnabled");
EnhancementCheckbox("Console", "gConsoleEnabled");
console->opened = CVar_GetS32("gConsoleEnabled", 0);
EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled");
ImGui::EndMenu();
}
@ -745,6 +756,7 @@ namespace SohImGui {
}
ImGui::EndMenu();
}
}
ImGui::EndMenuBar();
@ -755,7 +767,7 @@ namespace SohImGui {
if (CVar_GetS32("gStatsEnabled", 0)) {
const float framerate = ImGui::GetIO().Framerate;
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::Begin("Debug Stats", nullptr, ImGuiWindowFlags_None);
ImGui::Begin("Debug Stats", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
#ifdef _WIN32
ImGui::Text("Platform: Windows");
@ -921,13 +933,12 @@ namespace SohImGui {
ImTextureID GetTextureByID(int id) {
#ifdef ENABLE_DX11
if (impl.backend == Backend::DX11)
{
ImTextureID gfx_d3d11_get_texture_by_id(int id);
return gfx_d3d11_get_texture_by_id(id);
}
#else
return reinterpret_cast<ImTextureID>(id);
if (impl.backend == Backend::DX11)
{
ImTextureID gfx_d3d11_get_texture_by_id(int id);
return gfx_d3d11_get_texture_by_id(id);
}
#endif
return reinterpret_cast<ImTextureID>(id);
}
}

View file

@ -43,7 +43,7 @@ namespace Ship {
if (raw_path == nullptr) return;
const auto api = BIND_PTR("gfx_api", GfxRenderingAPI*);
const auto path = normalize(raw_path) + ".png";
const auto path = std::string(raw_path) + ".png";
const auto node = BIND_PTR("node", TextureCacheNode**);
const auto fmt = BIND_VAR("fmt", uint32_t*);
const auto siz = BIND_VAR("siz", uint32_t*);

View file

@ -36,15 +36,6 @@ namespace Ship {
void Hook_InvalidateTexture(HookEvent event);
};
inline std::string normalize(std::string path) {
#ifdef _WIN32
std::ranges::replace(path, '/', '\\');
#else
std::replace(path.begin(), path.end(), '\\', '/');
#endif
return path;
}
inline void GrayOutTexture(uint8_t* data, int width, int height) {
for (int x = 0; x < width * height * 4; x += 4) {

View file

@ -2405,6 +2405,7 @@ void Heaps_Alloc(void);
void Heaps_Free(void);
#ifdef __cplusplus
#undef this
};
#undef this
#endif

View file

@ -97,7 +97,7 @@ void DrawColViewerWindow(bool& open) {
}
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Collision Viewer", &open)) {
if (!ImGui::Begin("Collision Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

View file

@ -1540,7 +1540,7 @@ void DrawSaveEditor(bool& open) {
}
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Save Editor", &open)) {
if (!ImGui::Begin("Save Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

View file

@ -192,7 +192,12 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) {
s16 turnAngle;
this->vTurnRateDeg10++;
this->vTurnRateDeg10 = CLAMP_MAX(this->vTurnRateDeg10, 5);
if (CVar_GetS32("gFasterBlockPush", 0) != 0) {
this->vTurnRateDeg10 = 10;
CLAMP_MAX(this->vTurnRateDeg10, 5);
} else {
this->vTurnRateDeg10 = CLAMP_MAX(this->vTurnRateDeg10, 5);
}
turnFinished = Math_StepToS(&this->vTurnAngleDeg10, 600, this->vTurnRateDeg10);
turnAngle = this->vTurnAngleDeg10 * this->vTurnDirection;
this->dyna.actor.shape.rot.y = (this->vRotYDeg10 + turnAngle) * 0.1f * (0x10000 / 360.0f);
@ -212,7 +217,7 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) {
this->vRotYDeg10 = (this->vRotYDeg10 + turnAngle) % 3600;
this->vTurnRateDeg10 = 0;
this->vTurnAngleDeg10 = 0;
this->vTimer = 5;
this->vTimer = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 2 : 5;
this->actionFunc = BgHakaGate_StatueIdle;
this->dyna.unk_150 = 0.0f;
}

View file

@ -137,7 +137,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) {
}
}
this->dyna.actor.speedXZ += 0.05f;
this->dyna.actor.speedXZ += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.05f;
this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f);
if (D_8088BFC0 > 0.0f) {
@ -156,7 +156,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) {
this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z;
D_8088BFC0 = 0.0f;
this->dyna.actor.speedXZ = 0.0f;
this->timer = 5;
this->timer = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 2 : 5;
}
func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);

View file

@ -444,7 +444,7 @@ void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) {
if (this->dyna.unk_150 > 0.001f) {
this->unk_168++;
if (this->unk_168 >= 15) {
if (this->unk_168 >= CVar_GetS32("gFasterBlockPush", 0) != 0 ? 5 : 15) {
func_808969F8(this, globalCtx);
}
} else {
@ -484,9 +484,11 @@ void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) {
void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) {
s16 temp_v0;
Player* player = GET_PLAYER(globalCtx);
if (CVar_GetS32("gFasterBlockPush", 0) != 0)
this->unk_16E = 150.0f;
temp_v0 = (s16)((this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y) - this->dyna.actor.world.rot.y;
if (ABS(temp_v0) < 7424) {
if (ABS(temp_v0) < CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3712 : 7424) {
Math_StepToS(&this->unk_16E, 106, 4);
} else {
Math_StepToS(&this->unk_16E, 21, 10);

View file

@ -94,7 +94,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) {
if (this->dyna.unk_150 > 0.001f) {
this->timer++;
if ((this->timer > 28) && !Player_InCsMode(globalCtx)) {
if ((this->timer > CVar_GetS32("gFasterBlockPush", 0) != 0 ? 14 : 28) && !Player_InCsMode(globalCtx)) {
BgMoriKaitenkabe_SetupRotate(this);
func_8002DF54(globalCtx, &this->dyna.actor, 8);
Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos);
@ -118,7 +118,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) {
void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this) {
this->actionFunc = BgMoriKaitenkabe_Rotate;
this->rotSpeed = 0.0f;
this->rotSpeed = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.0f;
this->rotYdeg = 0.0f;
}

View file

@ -388,7 +388,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) {
s32 blockStop;
Player* player = GET_PLAYER(globalCtx);
this->dyna.actor.speedXZ += 0.1f;
this->dyna.actor.speedXZ += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.1f;
this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f);
blockStop = Math_StepToF(&sBgPoEventblockPushDist, 20.0f, this->dyna.actor.speedXZ);
displacement = this->direction * sBgPoEventblockPushDist;

View file

@ -260,7 +260,7 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) {
s32 approxFResult;
Actor* actor = &this->dyna.actor;
this->unk_174 += 0.5f;
this->unk_174 += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 1.0f : 0.5f;
this->unk_174 = CLAMP_MAX(this->unk_174, 2.0f);
@ -294,7 +294,7 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) {
this->dyna.unk_150 = 0.0f;
this->unk_178 = 0.0f;
this->unk_174 = 0.0f;
this->unk_168 = 10;
this->unk_168 = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3 : 10;
func_808B4084(this, globalCtx);
}
Audio_PlayActorSound2(actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);

View file

@ -558,7 +558,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) {
f32 pushDistSigned;
s32 stopFlag;
this->pushSpeed += 0.5f;
this->pushSpeed += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 1.0f : 0.5f;
this->stateFlags |= PUSHBLOCK_PUSH;
this->pushSpeed = CLAMP_MAX(this->pushSpeed, 2.0f);
stopFlag = Math_StepToF(&this->pushDist, 20.0f, this->pushSpeed);
@ -586,7 +586,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) {
this->dyna.unk_150 = 0.0f;
this->pushDist = 0.0f;
this->pushSpeed = 0.0f;
this->timer = 10;
this->timer = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3 : 10;
if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) {
ObjOshihiki_SetupOnScene(this, globalCtx);
} else {