-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Battle 2k3: Implement in-battle row command #2322
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -526,6 +526,7 @@ void Scene_Battle_Rpg2k3::CreateBattleCommandWindow() { | |
} | ||
++i; | ||
} | ||
commands.push_back(ToString(lcf::Data::terms.row)); | ||
} | ||
|
||
command_window.reset(new Window_Command(commands, option_command_mov)); | ||
|
@@ -1198,43 +1199,49 @@ void Scene_Battle_Rpg2k3::OptionSelected() { | |
} | ||
|
||
void Scene_Battle_Rpg2k3::CommandSelected() { | ||
const lcf::rpg::BattleCommand* command = active_actor->GetBattleCommands()[command_window->GetIndex()]; | ||
|
||
switch (command->type) { | ||
case lcf::rpg::BattleCommand::Type_attack: | ||
AttackSelected(); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_defense: | ||
DefendSelected(); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_escape: | ||
if (!IsEscapeAllowedFromActorCommand()) { | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Buzzer)); | ||
} | ||
else { | ||
int index = command_window->GetIndex(); | ||
// Row command always uses the last index | ||
if (index < command_window->GetRowMax() - 1) { | ||
const lcf::rpg::BattleCommand* command = active_actor->GetBattleCommands()[index]; | ||
|
||
switch (command->type) { | ||
case lcf::rpg::BattleCommand::Type_attack: | ||
AttackSelected(); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_defense: | ||
DefendSelected(); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_escape: | ||
if (!IsEscapeAllowedFromActorCommand()) { | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Buzzer)); | ||
} | ||
else { | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
active_actor->SetAtbGauge(0); | ||
SetState(State_Escape); | ||
} | ||
break; | ||
case lcf::rpg::BattleCommand::Type_item: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
SetState(State_SelectItem); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_skill: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
skill_window->SetSubsetFilter(0); | ||
sp_window->SetBattler(*active_actor); | ||
SetState(State_SelectSkill); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_special: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
SpecialSelected(); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_subskill: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
active_actor->SetAtbGauge(0); | ||
SetState(State_Escape); | ||
SubskillSelected(); | ||
break; | ||
} | ||
break; | ||
case lcf::rpg::BattleCommand::Type_item: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
SetState(State_SelectItem); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_skill: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
skill_window->SetSubsetFilter(0); | ||
sp_window->SetBattler(*active_actor); | ||
SetState(State_SelectSkill); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_special: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
SpecialSelected(); | ||
break; | ||
case lcf::rpg::BattleCommand::Type_subskill: | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision)); | ||
SubskillSelected(); | ||
break; | ||
} else { | ||
RowSelected(); | ||
} | ||
} | ||
|
||
|
@@ -1277,6 +1284,30 @@ void Scene_Battle_Rpg2k3::SpecialSelected() { | |
ActionSelectedCallback(active_actor); | ||
} | ||
|
||
void Scene_Battle_Rpg2k3::RowSelected() { | ||
// Switching rows is only possible if in back row or | ||
// if at least 2 party members are in front row | ||
int current_row = active_actor->GetBattleRow(); | ||
int front_row_battlers = 0; | ||
if (current_row == active_actor->IsDirectionFlipped()) { | ||
for (auto& actor: Main_Data::game_party->GetActors()) { | ||
if (actor->GetBattleRow() == actor->IsDirectionFlipped()) front_row_battlers++; | ||
} | ||
} | ||
if (current_row != active_actor->IsDirectionFlipped() || front_row_battlers >= 2) { | ||
if (active_actor->GetBattleRow() == Game_Actor::RowType::RowType_front) { | ||
active_actor->SetBattleRow(Game_Actor::RowType::RowType_back); | ||
} else { | ||
active_actor->SetBattleRow(Game_Actor::RowType::RowType_front); | ||
} | ||
active_actor->SetBattlePosition(Game_Battle::Calculate2k3BattlePosition(*active_actor)); | ||
active_actor->SetBattleAlgorithm(std::make_shared<Game_BattleAlgorithm::NoMove>(active_actor)); | ||
ActionSelectedCallback(active_actor); | ||
} else { | ||
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Buzzer)); | ||
} | ||
} | ||
|
||
void Scene_Battle_Rpg2k3::Escape(bool force_allow) { | ||
if (force_allow || TryEscape()) { | ||
// There is no success text for escape in 2k3 | ||
|
@@ -1461,8 +1492,14 @@ void Scene_Battle_Rpg2k3::ActionSelectedCallback(Game_Battler* for_battler) { | |
for_battler->SetAtbGauge(0); | ||
|
||
if (for_battler->GetType() == Game_Battler::Type_Ally) { | ||
const lcf::rpg::BattleCommand* command = static_cast<Game_Actor*>(for_battler)->GetBattleCommands()[command_window->GetIndex()]; | ||
for_battler->SetLastBattleAction(command->ID); | ||
int index = command_window->GetIndex(); | ||
// Row command always uses the last index | ||
if (index < command_window->GetRowMax() - 1) { | ||
const lcf::rpg::BattleCommand* command = static_cast<Game_Actor*>(for_battler)->GetBattleCommands()[index]; | ||
for_battler->SetLastBattleAction(command->ID); | ||
} else { | ||
for_battler->SetLastBattleAction(-1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This must be verified because the last battle action is a battle page start condition (or was it a condition in a conditional branch?). So this value must match. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -1 is indeed the Row command, just tested this via LDB-patching 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure it's actually -1. The logic I've seen in RPG_RT is usually something like this:
What if you try -2 or a large value greater than the number of configured battle commands? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only tested -1 and -2. -2 didn't activate my event page. Note that I talk about the page condition, not about the Command index in the menu. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Figured it out by now: That's (kinda) a bug. Only kinda because this needs external tools to be utilized: The Conclusion: @rueter37 can you implement this behaviour? ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the LastBattleAction changes. |
||
} | ||
status_window->SetIndex(-1); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case doesn't appear to handle back attacks etc..
I checked in RE tools and found that RPG_RT counts the number of actors which
row == mirrored
and then allows the row command ifcount >= 2 || current_hero.row != current_hero.mirrored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did the change as requested and tested it. I have amended the commit and force pushed it because I assume you want this in one commit.