Skip to content

Commit

Permalink
Merge pull request #3032 from Ghabry/ipomoea
Browse files Browse the repository at this point in the history
Support game Ipomoea
  • Loading branch information
fdelapena authored Jul 5, 2023
2 parents 7ec7624 + 5aa0b03 commit ba071e2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/game_interpreter_control_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>((Player::screen_width - MENU_WIDTH) / 2, 0);
Player::menu_offset_y = std::max<int>((Player::screen_height - MENU_HEIGHT) / 2, 0);
Player::message_box_offset_x = std::max<int>((Player::screen_width - MENU_WIDTH) / 2, 0);

Graphics::GetMessageOverlay().OnResolutionChange();

Expand Down Expand Up @@ -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_Map*>(Scene::instance.get())->StartFromSave(save_id);
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/scene_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/scene_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/window_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>((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 ;
Expand Down

0 comments on commit ba071e2

Please sign in to comment.