reepblue Posted yesterday at 02:45 AM Posted yesterday at 02:45 AM I've been playing with the new Game.cpp / GameMenu.cpp code and I noticed some bugs with the code. First, this wrong, video isn't a boolean and there can be an error if window size vector is missing. On Line 33 of Game.cpp change: bool fullscreen = true; if (settings["video"].is_boolean() and settings["video"]["fullscreen"].is_boolean()) fullscreen = settings["video"]["fullscreen"]; if (settings["video"].is_boolean() and settings["video"]["windowsize"].size() >= 2) { w = settings["video"]["windowsize"][0]; h = settings["video"]["windowsize"][1]; } To: bool fullscreen = true; if (settings["video"].is_object() and settings["video"]["fullscreen"].is_boolean()) fullscreen = settings["video"]["fullscreen"]; if (settings["video"].is_object() and settings["video"]["windowsize"].is_array()) { if (settings["video"]["windowsize"].size() >= 2) { w = settings["video"]["windowsize"][0]; h = settings["video"]["windowsize"][1]; } } There's a bug with the window size values not carrying over from one save to another. This is because the window size values only get saved if a new window was created. Around Line 787 change: if (resolutionIndex > 0) { bool newFullscreenMode = (fullscreenbutton->GetState() == WIDGETSTATE_SELECTED); bool oldFullscreenMode = (Game::window->style & WINDOW_FULLSCREEN) != 0; auto& item = resolutionlist->items[resolutionIndex]; auto s = item.text; auto sarr = s.Split(" x "); auto w = std::stoi(sarr[0]); auto h = std::stoi(sarr[1]); if (w != Game::window->size.x || h != Game::window->size.y || newFullscreenMode != oldFullscreenMode) { auto style = WINDOW_CENTER | WINDOW_TITLEBAR; if (fullscreenbutton->GetState() == WIDGETSTATE_SELECTED) style |= WINDOW_FULLSCREEN; auto newWindow = CreateWindow(Game::window->text, Game::window->position.x, Game::window->position.y, w, h, Game::window->display, style); if (newWindow) { Game::window->SetHidden(true); Game::window = newWindow; Game::framebuffer = CreateFramebuffer(Game::window); ui->SetSize(Game::framebuffer->size); Game::settings["video"]["windowsize"] = {}; Game::settings["video"]["windowsize"][0] = Game::window->size.x; Game::settings["video"]["windowsize"][1] = Game::window->size.y; Game::settings["video"]["fullscreen"] = (Game::window->style & WINDOW_FULLSCREEN) != 0; } } } To: if (resolutionIndex > 0) { bool newFullscreenMode = (fullscreenbutton->GetState() == WIDGETSTATE_SELECTED); bool oldFullscreenMode = (Game::window->style & WINDOW_FULLSCREEN) != 0; auto& item = resolutionlist->items[resolutionIndex]; auto s = item.text; auto sarr = s.Split(" x "); auto w = std::stoi(sarr[0]); auto h = std::stoi(sarr[1]); if (w != Game::window->size.x || h != Game::window->size.y || newFullscreenMode != oldFullscreenMode) { auto style = WINDOW_CENTER | WINDOW_TITLEBAR; if (fullscreenbutton->GetState() == WIDGETSTATE_SELECTED) style |= WINDOW_FULLSCREEN; auto newWindow = CreateWindow(Game::window->text, Game::window->position.x, Game::window->position.y, w, h, Game::window->display, style); if (newWindow) { Game::window->SetHidden(true); Game::window = newWindow; Game::framebuffer = CreateFramebuffer(Game::window); ui->SetSize(Game::framebuffer->size); } } Game::settings["video"]["windowsize"] = {}; Game::settings["video"]["windowsize"][0] = Game::window->size.x; Game::settings["video"]["windowsize"][1] = Game::window->size.y; Game::settings["video"]["fullscreen"] = (Game::window->style & WINDOW_FULLSCREEN) != 0; } There's also a bug with Post Processing effects being applied when the map already has effects applied. Bonus: When the game un-pauses with the FPSPlayer, the camera will spin to where the mouse is currently is. This is because freelookstarted needs to be set back to false. I just added the function to have the listen to EVENT_WORLDPAUSE and added this to the ProcessEvent function case EVENT_WORLDPAUSE: freelookstarted = false; break; Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon!
reepblue Posted yesterday at 02:59 AM Author Posted yesterday at 02:59 AM Actually, there also seems to be a mismatch with SetShadowQuality. The default setting is high, but the menu reports the medium setting. There's no GetShadowQuality to start as a base value for the menu. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon!
reepblue Posted 10 hours ago Author Posted 10 hours ago You also have camera->ClearPostEffects() only being called only if the posteffect array has a size greater than 0. This will allow the user to only set the effect on but turn it off. Change: // Post Effects auto peIt = videoSettings.find("posteffects"); if (videoSettings["posteffects"].is_array()) { auto& posteffects = videoSettings["posteffects"]; camera->ClearPostEffects(); for (int n = 0; n < posteffects.size(); ++n) { if (not posteffects[n].is_string()) continue; std::string path = posteffects[n]; auto fx = LoadPostEffect(path); if (fx) camera->AddPostEffect(fx); } } To: // Post Effects if (not videoSettings["posteffects"].is_null()) { camera->ClearPostEffects(); if (videoSettings["posteffects"].is_array()) { auto& posteffects = videoSettings["posteffects"]; for (int n = 0; n < posteffects.size(); ++n) { if (not posteffects[n].is_string()) continue; std::string path = posteffects[n]; auto fx = LoadPostEffect(path); if (fx) camera->AddPostEffect(fx); } } } 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon!
reepblue Posted 6 hours ago Author Posted 6 hours ago The MSAA and textureanisotropy setting doesn't apply correctly ether. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.