Skip to content

Commit

Permalink
Initial Enemy appearance message: Only visible enemies.
Browse files Browse the repository at this point in the history
This PR intends for, in the initial messages about enemy appearances, not including the ones that are hidden just like RM2000. For this:

        - The variable enemy_iterator has changed from std::vector<std::shared_ptr<Game_Enemy>>::const_iterator to std::vector<Game_Battler *>::const_iterator
        - A new protected variable called "visible_enemies" has been added. It will be initialized when the first message is going to be displayed. This will be used by all functions instead of GetEnemies.
  • Loading branch information
Albeleon committed Jun 6, 2018
1 parent 5f7b64d commit 474141f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/scene_battle_rpg2k.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ int Scene_Battle_Rpg2k::GetDelayForLine() {
}

void Scene_Battle_Rpg2k::SetWaitForEnemyAppearanceMessages() {
if ((enemy_iterator == Main_Data::game_enemyparty->GetEnemies().end() &&
if ((enemy_iterator == visible_enemies.end() &&
!battle_message_window->GetHiddenLineCount()) ||
battle_message_window->IsPageFilled()) {
encounter_message_sleep_until = Player::GetFrames() + GetDelayForWindow();
Expand All @@ -861,7 +861,8 @@ void Scene_Battle_Rpg2k::SetWaitForEnemyAppearanceMessages() {

bool Scene_Battle_Rpg2k::DisplayMonstersInMessageWindow() {
if (encounter_message_first_monster) {
enemy_iterator = Main_Data::game_enemyparty->GetEnemies().begin();
Main_Data::game_enemyparty->GetActiveBattlers(visible_enemies);
enemy_iterator = visible_enemies.begin();
encounter_message_first_monster = false;
}

Expand All @@ -885,7 +886,7 @@ bool Scene_Battle_Rpg2k::DisplayMonstersInMessageWindow() {
return false;
}

if (enemy_iterator == Main_Data::game_enemyparty->GetEnemies().end()) {
if (enemy_iterator == visible_enemies.end()) {
battle_message_window->Clear();
if (Game_Temp::battle_first_strike && !encounter_message_first_strike) {
battle_message_window->Push(Data::terms.special_combat);
Expand Down
3 changes: 2 additions & 1 deletion src/scene_battle_rpg2k.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ class Scene_Battle_Rpg2k : public Scene_Battle {
std::unique_ptr<Window_BattleMessage> battle_message_window;
std::vector<std::string> battle_result_messages;
std::vector<std::string>::iterator battle_result_messages_it;
std::vector<std::shared_ptr<Game_Enemy> >::const_iterator enemy_iterator;
std::vector<Game_Battler *> visible_enemies;
std::vector<Game_Battler *>::const_iterator enemy_iterator;
int battle_action_wait;
int battle_action_state;

Expand Down

0 comments on commit 474141f

Please sign in to comment.