Skip to content

Commit

Permalink
Write SaveMapEventBase::processed
Browse files Browse the repository at this point in the history
* Write this flag to be compatible with RPG_RT saves.
* Player - always 1
* Events - always 1
* Vehicle - 0 until we have visited the same map as a vehicle
  map events, and vehicles we have seen on the map.
  • Loading branch information
fmatthew5876 committed Nov 20, 2018
1 parent 2c58a77 commit e6150bc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/game_character.h
Expand Up @@ -451,6 +451,16 @@ class Game_Character {
*/
void SetFlying(bool val);

/**
* @return whether the RPG_RT processed flag is set.
*/
bool IsProcessed() const;

/**
* Set the RPG_RT processed flag
*/
void SetProcessed(bool val);

/**
* Checks if the character is stopping.
*
Expand Down Expand Up @@ -1089,4 +1099,12 @@ inline void Game_Character::SetTransparency(int value) {
data()->transparency = std::min(std::max(value, 0), 7);
}

inline bool Game_Character::IsProcessed() const {
return data()->processed;
}

inline void Game_Character::SetProcessed(bool val) {
data()->processed = val;
}

#endif
6 changes: 4 additions & 2 deletions src/game_event.cpp
Expand Up @@ -36,9 +36,10 @@ Game_Event::Game_Event(int map_id, const RPG::Event& event) :
Game_Character(new RPG::SaveMapEvent()),
_data_copy(this->data()),
event(event),
from_save(false) {

from_save(false)
{
SetMapId(map_id);
SetProcessed(true); //<- RPG_RT compatibility
SetMoveSpeed(3);
MoveTo(event.x, event.y);
Refresh();
Expand All @@ -52,6 +53,7 @@ Game_Event::Game_Event(int map_id, const RPG::Event& event, const RPG::SaveMapEv
{
// Savegames have 0 for the mapid for compatibility with RPG_RT.
SetMapId(map_id);
SetProcessed(true); //<- RPG_RT compatibility

this->event.ID = data()->ID;

Expand Down
1 change: 1 addition & 0 deletions src/game_player.cpp
Expand Up @@ -39,6 +39,7 @@ Game_Player::Game_Player():
Game_Character(&Main_Data::game_data.party_location)
{
SetDirection(RPG::EventPage::Direction_down);
SetProcessed(true); //<- RPG_RT compatibility
SetMoveSpeed(4);
SetAnimationType(RPG::EventPage::AnimType_non_continuous);
}
Expand Down
6 changes: 4 additions & 2 deletions src/game_vehicle.cpp
Expand Up @@ -157,10 +157,12 @@ RPG::Music& Game_Vehicle::GetBGM() {
}

void Game_Vehicle::Refresh() {
if (IsInUse())
if (IsInUse()) {
SetMapId(Game_Map::GetMapId());
else if (IsInCurrentMap())
} else if (IsInCurrentMap()) {
SetProcessed(true); //<- RPG_RT compatibility
MoveTo(GetX(), GetY());
}

switch (type) {
case None:
Expand Down

0 comments on commit e6150bc

Please sign in to comment.