From 853499168880d57f4567198b1dd490d64a345973 Mon Sep 17 00:00:00 2001 From: Llennpie <44985633+Llennpie@users.noreply.github.com> Date: Sun, 26 Dec 2021 21:24:24 -0500 Subject: [PATCH] Add wireframe mode, CC refresh button, quicksand disabled on Godmode --- src/game/mario_step.c | 4 ++++ src/moon/imgui/imgui_impl.cpp | 12 +++++++++--- src/moon/saturn/saturn_textures.cpp | 4 ++++ src/pc/configfile.c | 4 +++- src/pc/configfile.h | 1 + src/pc/gfx/gfx_opengl.cpp | 8 ++++++++ 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/game/mario_step.c b/src/game/mario_step.c index ba8315ca..cdb3623e 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -8,6 +8,7 @@ #include "game_init.h" #include "interaction.h" #include "mario_step.h" +#include "moon/saturn/saturn_types.h" static s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 }; @@ -127,6 +128,7 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) { case SURFACE_QUICKSAND: case SURFACE_MOVING_QUICKSAND: + if (enable_god) break; if ((m->quicksandDepth += sinkingSpeed) >= 60.0f) { m->quicksandDepth = 60.0f; } @@ -134,6 +136,7 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) { case SURFACE_DEEP_QUICKSAND: case SURFACE_DEEP_MOVING_QUICKSAND: + if (enable_god) break; if ((m->quicksandDepth += sinkingSpeed) >= 160.0f) { update_mario_sound_and_camera(m); return drop_and_set_mario_action(m, ACT_QUICKSAND_DEATH, 0); @@ -142,6 +145,7 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) { case SURFACE_INSTANT_QUICKSAND: case SURFACE_INSTANT_MOVING_QUICKSAND: + if (enable_god) break; update_mario_sound_and_camera(m); return drop_and_set_mario_action(m, ACT_QUICKSAND_DEATH, 0); break; diff --git a/src/moon/imgui/imgui_impl.cpp b/src/moon/imgui/imgui_impl.cpp index 135413f0..fc51e006 100644 --- a/src/moon/imgui/imgui_impl.cpp +++ b/src/moon/imgui/imgui_impl.cpp @@ -398,7 +398,7 @@ namespace MoonInternal { if (ImGui::BeginMenu("Tools")) { ImGui::MenuItem("Toggle View (F1)", NULL, &show_menu_bar); ImGui::MenuItem("Jabo Mode", NULL, &configImGui.jaboMode); - //ImGui::MenuItem("Night Mode", NULL, &enable_night_skybox); + ImGui::MenuItem("Wireframe Mode", NULL, &configImGui.wireframeMode); ImGui::EndMenu(); } if (ImGui::BeginMenu("View")) { @@ -601,12 +601,13 @@ namespace MoonInternal { ImGui::Checkbox("Infinite Lives", &Cheats.InfiniteLives); ImGui::Checkbox("Moon Jump", &Cheats.MoonJump); ImGui::SameLine(); HelpMarker( "Hold L in mid-air to Moon Jump!"); - ImGui::Checkbox("Responsive Controls", &Cheats.Responsive); - ImGui::Checkbox("Super Speed", &Cheats.SuperSpeed); ImGui::Checkbox("Custom Mario Scale", &Cheats.ScaleMario); if (Cheats.ScaleMario) { ImGui::SliderFloat("Scale ###mario_scale", &mario_scale_size, 0.2f, 5.0f); + ImGui::Dummy(ImVec2(0, 5)); } + ImGui::Checkbox("Responsive Controls", &Cheats.Responsive); + ImGui::Checkbox("Super Speed", &Cheats.SuperSpeed); } /* @@ -664,6 +665,10 @@ namespace MoonInternal { load_cc_file(cc_array[configColorCode]); apply_editor_from_cc(); } + ImGui::SameLine(); + if (ImGui::Button( ICON_MD_REFRESH "###refresh_cc_array")) { + MoonInternal::load_cc_directory(); + } ImGui::Dummy(ImVec2(0, 10)); @@ -1046,6 +1051,7 @@ namespace MoonInternal { ImGui::Text("Texture Filtering"); const char* texture_filters[] = { "Nearest", "Linear", "Three-point" }; ImGui::Combo("###texture_filters", (int*)&configFiltering, texture_filters, IM_ARRAYSIZE(texture_filters)); + ImGui::Checkbox("Wireframe Mode", &configImGui.wireframeMode); } if (ImGui::CollapsingHeader("Audio")) { ImGui::Text("Volume"); diff --git a/src/moon/saturn/saturn_textures.cpp b/src/moon/saturn/saturn_textures.cpp index 3466732c..e5699fcc 100644 --- a/src/moon/saturn/saturn_textures.cpp +++ b/src/moon/saturn/saturn_textures.cpp @@ -73,7 +73,11 @@ void saturn_emblem_swap() { if (custom_emblem_name != "default") { (*hookTexture) = const_cast(custom_emblem_name.c_str()); } else { +#ifdef __MINGW32__ + (*hookTexture) = const_cast("actors/mario/mario_logo.rgba16"); +#else (*hookTexture) = const_cast(texName.c_str()); +#endif } } }}); diff --git a/src/pc/configfile.c b/src/pc/configfile.c index afa517a2..cc238495 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -62,7 +62,8 @@ ImGuiConfig configImGui = { .s_machinima = true, .s_appearance = true, .s_options = false, - .jaboMode = false + .jaboMode = false, + .wireframeMode = false }; unsigned int configLanguage = 0; @@ -141,6 +142,7 @@ static const struct ConfigOption options[] = { {.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync}, {.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering}, {.name = "jaboMode", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.jaboMode}, + {.name = "wireframeMode", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.wireframeMode}, {.name = "lodMode", .type = CONFIG_TYPE_UINT, .uintValue = &configLODMode}, {.name = "master_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMasterVolume}, {.name = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 5a57c8f1..00e957ee 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -29,6 +29,7 @@ typedef struct { bool s_options; bool texture_debug; bool jaboMode; + bool wireframeMode; } ImGuiConfig; extern ConfigWindow configWindow; diff --git a/src/pc/gfx/gfx_opengl.cpp b/src/pc/gfx/gfx_opengl.cpp index 2f56eef7..fe6b4777 100644 --- a/src/pc/gfx/gfx_opengl.cpp +++ b/src/pc/gfx/gfx_opengl.cpp @@ -604,8 +604,16 @@ static void gfx_opengl_set_use_alpha(bool use_alpha) { static void gfx_opengl_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t buf_vbo_num_tris) { //printf("flushing %d tris\n", buf_vbo_num_tris); + if(configImGui.wireframeMode){ + glPolygonMode(GL_FRONT, GL_LINE); + glPolygonMode(GL_BACK, GL_LINE); + } glBufferData(GL_ARRAY_BUFFER, sizeof(float) * buf_vbo_len, buf_vbo, GL_STREAM_DRAW); glDrawArrays(GL_TRIANGLES, 0, 3 * buf_vbo_num_tris); + if(configImGui.wireframeMode){ + glPolygonMode(GL_FRONT, GL_FILL); + glPolygonMode(GL_BACK, GL_FILL); + } } static inline bool gl_get_version(int *major, int *minor, bool *is_es) {