![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
The battle manager. More...
#include <BattleManager.h>
Classes | |
struct | BattleCamera |
A battle camera settings. More... | |
struct | Spoil |
Item earned during the battle. More... | |
Public Types | |
enum | LAYOUT { NORMAL = 0 , PREEMPTIVE = 1 , BACK_ATTACK = 2 , SIDE_ATTACK = 3 , PINCER_ATTACK = 4 , SOLO = 5 , UNKNOWN_0 = 6 , UNKNOWN_1 = 7 , LOCKED = 8 } |
Possible battle layouts. More... | |
![]() | |
enum | Module { FIELD = 0 , BATTLE = 1 , WORLD = 2 } |
The modules the entity manager can handle. More... | |
Public Member Functions | |
BattleManager () | |
Constructor. More... | |
virtual | ~BattleManager () |
Destructor. More... | |
void | Input (const VGears::Event &event) override |
Handles an input event. More... | |
void | UpdateDebug () override |
Updates the battle in the manager with debug information. More... | |
void | OnResize () override |
Handles resizing events. More... | |
void | ClearField () override |
Clears all field information in the battle manager. More... | |
void | ClearBattle () override |
Clears all battle information in the battle manager. More... | |
void | ClearWorld () override |
Clears all world map information in the battle manager. More... | |
void | StartBattle (const unsigned int id) |
Starts a battle. More... | |
void | EndBattle () |
Ends the current battle. More... | |
std::vector< Enemy > | GetEnemies () const |
Retrieves the list of enemies. More... | |
void | AddEnemy (const unsigned int id, const Ogre::Vector3 pos, const bool front, const bool visible, const bool targeteable, const bool active, const std::string cover) |
Adds an enemy to the manager for the next battle. More... | |
unsigned int | ScriptGetEnemyCount () const |
Retrieves the number of enemies in the battle. More... | |
Enemy * | ScriptGetEnemy (const unsigned int index) |
Retrieves an enemy. More... | |
void | Load () |
Loads enemy info from the enemy XML enemy file. More... | |
void | SetLayout (const LAYOUT layout) |
Sets the battle layout. More... | |
void | SetFormationId (const int id) |
Sets the battle formation ID. More... | |
void | SetNextFormationId (const int id) |
Sets the battle formation ID for the next battle, if any. More... | |
void | SetEscapeability (const float difficulty) |
Sets escaping data for the battle. More... | |
void | SetSkipVictoryPose (const bool skip) |
Sets the battle to show or skip the victory pose. More... | |
void | SetSkipSpoils (const bool skip) |
Sets the battle to show or skip the spoils screens. More... | |
void | SetLocation (const int id, const Ogre::String name) |
Sets the battle location. More... | |
void | SetArenaBattle (const bool arena) |
Indicates if the battle is an arena battle. More... | |
void | SetInitialCamera (const unsigned int id) |
Sets the initial camera. More... | |
void | AddCamera (const unsigned int id, const Ogre::Vector3 pos, const Ogre::Vector3 dir) |
Adds a camera for the next battle. More... | |
![]() | |
Manager () | |
Constructor. More... | |
virtual | ~Manager () |
Destructor. More... | |
Module | GetModule () const |
Retrieves the currently selected module. More... | |
bool | IsModule (const Module module) const |
Checks the currently selected module. More... | |
bool | IsFieldModule () const |
Checks if the currently selected module is the field module. More... | |
bool | IsBattleModule () const |
Checks if the currently selected module is the battle module. More... | |
bool | IsWorldModule () const |
Checks if the currently selected module is the world module. More... | |
void | SetModule (const Module module) |
Sets the current module for the entity manager. More... | |
void | SetFieldModule () |
Sets the current module to the field mode. More... | |
void | SetBattleModule () |
Sets the current module to the battle mode. More... | |
void | SetWorldModule () |
Sets the current module to the world map mode. More... | |
void | SetPreviousModule () |
Sets the module that was loaded before a battle. More... | |
virtual void | Input (const VGears::Event &event)=0 |
Handles an input event. More... | |
void | Update () |
Called every frame, performs an update on the things controlled by the manager. More... | |
virtual void | UpdateDebug ()=0 |
Called every frame, performs an update on the things controlled by the manager. More... | |
virtual void | OnResize ()=0 |
Handles resizing events. More... | |
void | Clear () |
Clears the manager. More... | |
void | Clear (const Module module) |
Clears the manager. More... | |
virtual void | ClearField ()=0 |
Clear all field information in the manager. More... | |
virtual void | ClearBattle ()=0 |
Clear all battle information in the manager. More... | |
virtual void | ClearWorld ()=0 |
Clear all world map information in the manager. More... | |
void | ClearAll () |
Clears the manager. More... | |
void | ScriptSetPaused (const bool paused) |
Handles game pausing. More... | |
Private Member Functions | |
void | LoadParty () |
Loads the party members into the battle. More... | |
void | UpdateField () override |
Updates the manager while in the field. More... | |
void | UpdateBattle () override |
Updates the manager during a battle. More... | |
void | UpdateWorld () override |
Updates manager while in the world map. More... | |
Private Attributes | |
Ogre::SceneNode * | scene_node_ |
The scene node. More... | |
int | formation_id_ |
The current battle formation ID. More... | |
int | next_formation_id_ |
The battle formation ID for the next battle, if any. More... | |
std::vector< BattleCamera > | camera_ |
unsigned int | initial_camera_ |
Default camera ID. More... | |
LAYOUT | layout_ |
Battle layout. More... | |
float | escape_difficulty_ |
Difficulty to escape the battle. More... | |
bool | arena_battle_ |
Indicates if the current battle is an arena one. More... | |
bool | show_victory_pose_ |
Indicates if the victory pose must be shown at the battle end. More... | |
bool | show_spoils_ |
Indicates if the spoils screens must be shown at the battle end. More... | |
bool | preemptive_ |
Indicates if the battle can be preemptive (not if it will definitely be). More... | |
unsigned int | money_ |
Money earned during the current battle. More... | |
std::vector< Spoil > | spoil_ |
List of items earned during the battle. More... | |
std::vector< Enemy > | enemies_ |
List of enemies for the battle. More... | |
std::vector< XmlBattleCharactersFile::BattleCharacter > | character_model_map_ |
Map of playable character models. More... | |
std::vector< XmlBattleScenesFile::BattleScene > | scene_model_map_ |
Map of battle scene models. More... | |
Static Private Attributes | |
static const float | ENEMY_SCALE = 0.0032f |
Scale factor for battle enemy models. More... | |
static const float | PARTY_SCALE = 0.0039f |
Scale factor for battle character models. More... | |
static const float | SCENE_SCALE = 0.0012f |
Scale factor for battle background models. More... | |
Additional Inherited Members | |
![]() | |
virtual void | UpdateField ()=0 |
Updates the field entities in the manager. More... | |
virtual void | UpdateBattle ()=0 |
Updates the battle entities in the manager. More... | |
virtual void | UpdateWorld ()=0 |
Updates the world map entities in the manager. More... | |
void | Update (Module module) |
Updates the entities of one module in the manager. More... | |
![]() | |
Module | module_ |
The currently selected module. More... | |
Module | prev_module_ |
The previous module. More... | |
bool | paused_ |
Indicates if the game is paused. More... | |
The battle manager.
Possible battle layouts.
Enumerator | |
---|---|
NORMAL | Normal battle. Party facing enemies, all ATBs filled at random, they start filling at the battle start. |
PREEMPTIVE | Preemptive attack. Enemies are facing backwards, their ATBs start empty and only start to fill after an attack or after a set amount of time. PArty starts with full ATBs. |
BACK_ATTACK | Party attacked from the back. Party members are facing backwards, with their rows reversed. Their ATBs are empty and only start to fill after an attack or after a set amount of time. Enemies start with full ATBs. |
SIDE_ATTACK | Party surrounds the enemy. Party members alternated on both sides of the battle. They are considered front row for offense and back row for defense. Their ATBs start full. Party-targeted commands only target one side. Enemies in the middle, facing in a random direction. Their ATBs start with a random amount. When attacked, an enemy turns to the attacker. |
PINCER_ATTACK | Enemies surrounds the party. Enemies alternated on both sides of the battle. They are considered front row for offense and back row for defense. Their ATBs start full. Multiple-targeted commands only target one side. Party members in the middle, facing in a random direction. Their ATBs start with a random amount. When attacked, they turn to the attacker. |
SOLO | Reserved for scripted battles with only one character. Works the same as {
|
UNKNOWN_0 | Unknown. Never used in the original game. |
UNKNOWN_1 | Unknown. Never used in the original game. |
LOCKED | Locked formation. Same as {
|
BattleManager::BattleManager | ( | ) |
Constructor.
|
virtual |
Destructor.
void BattleManager::AddCamera | ( | const unsigned int | id, |
const Ogre::Vector3 | pos, | ||
const Ogre::Vector3 | dir | ||
) |
Adds a camera for the next battle.
[in] | id | Camera ID. |
[in] | pos | Camera position (x, y, z). |
[in] | dir | Camera orientation (a point the camera will point to). |
void BattleManager::AddEnemy | ( | const unsigned int | id, |
const Ogre::Vector3 | pos, | ||
const bool | front, | ||
const bool | visible, | ||
const bool | targeteable, | ||
const bool | active, | ||
const std::string | cover | ||
) |
Adds an enemy to the manager for the next battle.
[in] | id | Enemy ID. |
[in] | pos | Enemy position (x, y, z). |
[in] | front | True to set the enemy in the front row, false for back row. |
[in] | visible | Indicates enemy visibility. |
[in] | targeteable | Indicates if the enemy can be targeted. |
[in] | active | Indicates whether the enemy main script is active or not. |
[in] | cover | Cover binary flags string. |
|
overridevirtual |
Clears all battle information in the battle manager.
Implements Manager.
|
overridevirtual |
|
overridevirtual |
Clears all world map information in the battle manager.
Implements Manager.
void BattleManager::EndBattle | ( | ) |
Ends the current battle.
std::vector< Enemy > BattleManager::GetEnemies | ( | ) | const |
Retrieves the list of enemies.
|
overridevirtual |
void BattleManager::Load | ( | ) |
Loads enemy info from the enemy XML enemy file.
|
private |
Loads the party members into the battle.
|
overridevirtual |
Handles resizing events.
Implements Manager.
Enemy * BattleManager::ScriptGetEnemy | ( | const unsigned int | index | ) |
Retrieves an enemy.
To be called from Lua scripts.
[in] | index | The enemy index, 0 based. must be lower than reported by { |
unsigned int BattleManager::ScriptGetEnemyCount | ( | ) | const |
Retrieves the number of enemies in the battle.
To be called from Lua scripts.
void BattleManager::SetArenaBattle | ( | const bool | arena | ) |
Indicates if the battle is an arena battle.
[in] | arena | True for arena battles, false for every other battles. |
void BattleManager::SetEscapeability | ( | const float | difficulty | ) |
Sets escaping data for the battle.
[in] | difficulty | Values between 0 and 1 (exclusive) set the escaping difficulty from easy to hard. 0 Means the battle can be escaped instantly. Any other value means the battle can't be escaped from. |
void BattleManager::SetFormationId | ( | const int | id | ) |
Sets the battle formation ID.
[in] | id | Battle formation ID. Negative values to clean the manager. |
void BattleManager::SetInitialCamera | ( | const unsigned int | id | ) |
Sets the initial camera.
Can be set before configuring the camera, but if the battle starts and this index is invalid, it's undefined behavior.
[in] | id | ID of the initial camera. |
void BattleManager::SetLayout | ( | const LAYOUT | layout | ) |
Sets the battle layout.
[in] | layout | The battle layout. { |
void BattleManager::SetLocation | ( | const int | id, |
const Ogre::String | name | ||
) |
Sets the battle location.
[in] | id | Location ID. |
[in] | name | Location name, for debug purposes only. Can be empty or null. |
void BattleManager::SetNextFormationId | ( | const int | id | ) |
Sets the battle formation ID for the next battle, if any.
If set, a new battle will happen when this one is over, instead of returning to the field.
[in] | id | Next battle formation ID. Negative values if none. |
void BattleManager::SetSkipSpoils | ( | const bool | skip | ) |
Sets the battle to show or skip the spoils screens.
void BattleManager::SetSkipVictoryPose | ( | const bool | skip | ) |
Sets the battle to show or skip the victory pose.
void BattleManager::StartBattle | ( | const unsigned int | id | ) |
Starts a battle.
id | Battle ID. |
|
overrideprivatevirtual |
Updates the manager during a battle.
Implements Manager.
|
overridevirtual |
|
overrideprivatevirtual |
|
overrideprivatevirtual |
|
private |
Indicates if the current battle is an arena one.
|
private |
|
private |
Map of playable character models.
|
private |
List of enemies for the battle.
|
staticprivate |
Scale factor for battle enemy models.
|
private |
Difficulty to escape the battle.
|
private |
The current battle formation ID.
|
private |
Default camera ID.
|
private |
Battle layout.
|
private |
Money earned during the current battle.
|
private |
The battle formation ID for the next battle, if any.
|
staticprivate |
Scale factor for battle character models.
|
private |
Indicates if the battle can be preemptive (not if it will definitely be).
|
private |
Map of battle scene models.
|
private |
The scene node.
|
staticprivate |
Scale factor for battle background models.
|
private |
Indicates if the spoils screens must be shown at the battle end.
|
private |
Indicates if the victory pose must be shown at the battle end.
|
private |
List of items earned during the battle.