Fix Crash On NVIDIA + Improve Splash Oscillation

This commit is contained in:
TheBrokenRail 2024-12-17 21:17:45 -05:00
parent 5d8aa28113
commit 71042da861
5 changed files with 10 additions and 5 deletions

@ -1 +1 @@
Subproject commit b35641f4a3c62aa86a0b3c983d163bc0fe36026d
Subproject commit 21fea01161e0d6b70c0c5c1f52dc8e7a7df14a50

View File

@ -118,7 +118,7 @@ void ConfigurationUI::draw_main() const {
int gui_scale_int = int(state.gui_scale); // Fractional GUI Scales Are Messy
std::string scale_format = "%ix";
if (gui_scale_int <= AUTO_GUI_SCALE) {
scale_format = "Auto";
scale_format = "Automatic";
}
if (ImGui::SliderInt(labels[2], &gui_scale_int, 0, 8, scale_format.c_str())) {
state.gui_scale = float(gui_scale_int);

View File

@ -40,6 +40,8 @@ GLFWwindow *create_glfw_window(const char *title, const int width, const int hei
void cleanup_glfw(GLFWwindow *window) {
// Ignore GLFW Errors During Termination
glfwSetErrorCallback(nullptr);
// Workaround Segmentation Fault On NVIDIA
glfwPollEvents();
// Terminate GLFW
glfwDestroyWindow(window);
glfwTerminate();

View File

@ -62,7 +62,7 @@ static int32_t TallGrass_getColor_injection(TallGrass_getColor_t original, TallG
// Grass Side Tinting
CUSTOM_VTABLE(grass_side, Tile) {
vtable->shouldRenderFace = [](Tile *self, LevelSource *level_source, const int x, const int y, const int z, const int face) {
return face != 0 && face != 1 && Tile_vtable::base->shouldRenderFace(self, level_source, x, y, z, face);
return face > 1 && Tile_vtable::base->shouldRenderFace(self, level_source, x, y, z, face);
};
vtable->getColor = [](Tile *self, LevelSource *level_source, const int32_t x, const int32_t y, const int32_t z) {
return GrassTile_getColor_injection(nullptr, (GrassTile *) self, level_source, x, y, z);

View File

@ -114,8 +114,11 @@ static bool draw_splash(const StartMenuScreen *screen, const float y_factor, con
media_glRotatef(SplashLine::angle, 0.0f, 0.0f, 1.0f);
// Oscillate
const float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f;
const float oscillation = (scale / SplashLine::max_scale) * 0.1f;
scale = scale - Mth::abs(oscillation * Mth::sin(2.0f * float(M_PI) * timeMS));
const float time = 4.0f * float(M_PI) * timeMS;
float oscillation = 0.1f;
oscillation /= 2.0f;
oscillation = 1.0f + (oscillation * Mth::cos(time)) - oscillation;
scale *= oscillation;
// Scale
media_glTranslatef(splash_width / 2.0f, 0, 0);
media_glScalef(scale, scale, 1);