forked from EasyRPG/Player
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure event and common event update
- Loading branch information
Showing
8 changed files
with
72 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,6 @@ Game_CommonEvent::Game_CommonEvent(int common_event_id, bool battle, const RPG:: | |
} | ||
|
||
void Game_CommonEvent::Refresh() { | ||
CheckEventTriggerAuto(); | ||
|
||
if (GetTrigger() == RPG::EventPage::Trigger_parallel) { | ||
if (GetSwitchFlag() ? Game_Switches[GetSwitchId()] : true) { | ||
if (!interpreter) { | ||
|
@@ -58,14 +56,27 @@ void Game_CommonEvent::Refresh() { | |
} | ||
|
||
void Game_CommonEvent::Update() { | ||
CheckEventTriggerAuto(); | ||
if (GetTrigger() != RPG::EventPage::Trigger_auto_start) | ||
return; | ||
|
||
for (int i = 0; i < 500; ++i) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Zegeri
Author
Owner
|
||
if (GetSwitchFlag() ? Game_Switches[GetSwitchId()] : true) { | ||
if (!Game_Map::GetInterpreter().IsRunning()) { | ||
Game_Map::GetInterpreter().SetupStartingEvent(this); | ||
Game_Map::GetInterpreter().Update(); | ||
continue; | ||
} | ||
} | ||
return; | ||
} | ||
} | ||
|
||
void Game_CommonEvent::UpdateParallel() { | ||
if (interpreter && parallel_running) { | ||
if (!interpreter->IsRunning()) { | ||
interpreter->Setup(GetList(), 0, false, -common_event_id, -2); | ||
} else { | ||
interpreter->Update(); | ||
interpreter->Setup(GetList(), 0, -common_event_id, -2); | ||
} | ||
interpreter->Update(); | ||
} | ||
} | ||
|
||
|
@@ -93,17 +104,6 @@ std::vector<RPG::EventCommand>& Game_CommonEvent::GetList() { | |
return Data::commonevents[common_event_id - 1].event_commands; | ||
} | ||
|
||
void Game_CommonEvent::CheckEventTriggerAuto() { | ||
if (GetTrigger() == RPG::EventPage::Trigger_auto_start) { | ||
if (GetSwitchFlag() ? Game_Switches[GetSwitchId()] : true) { | ||
//printf("%d %d\n", GetSwitchId(), (int)Game_Switches[GetSwitchId()]); | ||
if (!Game_Map::GetInterpreter().IsRunning()) { | ||
Game_Map::GetInterpreter().SetupStartingEvent(this); | ||
} | ||
} | ||
} | ||
} | ||
|
||
RPG::SaveEventData Game_CommonEvent::GetSaveData() { | ||
RPG::SaveEventData event_data; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is the purpose of that loop?
It loops up to 500 times when the event is finishing in one update tick but why the 500?