From 329db692abb48a3a5266d633700512602ebc1e88 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Thu, 8 Jun 2023 13:47:28 +0200 Subject: [PATCH 1/3] Display message box and settings scene correctly when height < 240 --- src/player.cpp | 8 ++++---- src/window_message.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/player.cpp b/src/player.cpp index 19828188d5..1136e2426b 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -850,9 +850,9 @@ bool Player::ChangeResolution(int width, int height) { Player::screen_width = width; Player::screen_height = height; - Player::menu_offset_x = (Player::screen_width - MENU_WIDTH) / 2; - Player::menu_offset_y = (Player::screen_height - MENU_HEIGHT) / 2; - Player::message_box_offset_x = (Player::screen_width - MENU_WIDTH) / 2; + Player::menu_offset_x = std::max((Player::screen_width - MENU_WIDTH) / 2, 0); + Player::menu_offset_y = std::max((Player::screen_height - MENU_HEIGHT) / 2, 0); + Player::message_box_offset_x = std::max((Player::screen_width - MENU_WIDTH) / 2, 0); Graphics::GetMessageOverlay().OnResolutionChange(); @@ -1182,7 +1182,7 @@ void Player::LoadSavegame(const std::string& save_name, int save_id) { } else { // Increment frame counter for consistency with a normal savegame load IncFrame(); - Scene::instance->Start(); + static_cast(Scene::instance.get())->StartFromSave(save_id); } } diff --git a/src/window_message.cpp b/src/window_message.cpp index 9b5161edbd..20a5936f07 100644 --- a/src/window_message.cpp +++ b/src/window_message.cpp @@ -270,7 +270,7 @@ void Window_Message::InsertNewPage() { y = Player::menu_offset_y; } else if (Game_Message::GetRealPosition() == 1) { - y = (Player::screen_height / (float)2) - (MESSAGE_BOX_HEIGHT / (float)2); + y = static_cast((Player::screen_height - MESSAGE_BOX_HEIGHT) / 2.f); } else if (Game_Message::GetRealPosition() == 2) { y = Player::screen_height - Player::menu_offset_y - MESSAGE_BOX_HEIGHT ; From baa27d48fdd1be46515d9350d762fff1dd50d611 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Thu, 8 Jun 2023 13:48:20 +0200 Subject: [PATCH 2/3] Control Variable: Support obtaining of "Current Event ID" This is a Maniac Patch feature --- src/game_interpreter_control_variables.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/game_interpreter_control_variables.cpp b/src/game_interpreter_control_variables.cpp index 3e8c52a28a..d8c0590dd2 100644 --- a/src/game_interpreter_control_variables.cpp +++ b/src/game_interpreter_control_variables.cpp @@ -205,6 +205,9 @@ int ControlVariables::Event(int op, int event_id, const Game_Interpreter& interp return character->GetScreenY(); } } + case 6: + // Event ID + return Player::IsPatchManiac() ? interpreter.GetThisEventId() : 0; } Output::Warning("ControlVariables::Event: Unknown op {}", op); From 5aa0b03fa3493b88aaa2ab27e117bfae9c38ff90 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Thu, 8 Jun 2023 13:49:22 +0200 Subject: [PATCH 3/3] Continue the background music when loading a savegame through Load event command Fix #3029 --- src/scene_map.cpp | 5 +++++ src/scene_map.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/scene_map.cpp b/src/scene_map.cpp index 1a6134150d..55b9f394d3 100644 --- a/src/scene_map.cpp +++ b/src/scene_map.cpp @@ -96,6 +96,11 @@ void Scene_Map::Start() { Start2(MapUpdateAsyncContext()); } +void Scene_Map::StartFromSave(int from_save_id) { + this->from_save_id = from_save_id; + Start(); +} + void Scene_Map::Start2(MapUpdateAsyncContext actx) { PreUpdate(actx); diff --git a/src/scene_map.h b/src/scene_map.h index 6a9791a824..60833f8711 100644 --- a/src/scene_map.h +++ b/src/scene_map.h @@ -39,6 +39,7 @@ class Scene_Map: public Scene { ~Scene_Map(); void Start() override; + void StartFromSave(int from_save_id); void Continue(SceneType prev_scene) override; void vUpdate() override; void TransitionIn(SceneType prev_scene) override;