reepblue Posted 16 hours ago Posted 16 hours ago 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 16 hours ago Author Posted 16 hours ago 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!
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.