#include <battle.h>
Inheritance diagram for hoa_battle::BattleMode:


Public Member Functions | |
| bool | _IsPerformingScript () const |
| Returns true if an actor is performing an action. | |
| void | AddEnemy (uint32 new_enemy_id) |
| Adds a new active enemy to the battle field. | |
| void | AddEnemy (hoa_global::GlobalEnemy new_enemy) |
| Adds a new active enemy to the battle field. | |
| void | AddMusic (std::string music_filename) |
| Adds a piece of music to the battle soundtrack. | |
| void | AddScriptEventToQueue (private_battle::ScriptEvent *event) |
| Added a scripted event to the queue. | |
| BattleMode () | |
| void | FreezeTimers () |
| Freezes all timers in battle mode. Used when game is paused or using wait battle mode. | |
| private_battle::ScriptEvent * | GetActiveScript () |
| std::deque< private_battle::BattleCharacterActor * > | GetCharacters () const |
| Returns all player actors. | |
| private_battle::BattleEnemyActor * | GetEnemyActorAt (uint32 index) const |
| Returns the enemy actor at the deque location 'index'. | |
| uint32 | GetIndexOfCharacter (private_battle::BattleCharacterActor *const Actor) const |
| Returns the index of a player character. | |
| uint32 | GetIndexOfFirstAliveEnemy () const |
| uint32 | GetIndexOfFirstIdleCharacter () const |
| uint32 | GetIndexOfLastAliveEnemy () const |
| uint32 | GetIndexOfNextAliveEnemy (bool move_upward) const |
| Useful for item and skill targeting. | |
| uint32 | GetNumberOfCharacters () const |
| uint32 | GetNumberOfEnemies () const |
| private_battle::BattleCharacterActor * | GetPlayerCharacterAt (uint32 index) const |
| Returns the player actor at the deque location 'index'. | |
| bool | IsBattleOver () const |
| Is the battle over? | |
| bool | IsVictorious () const |
| Was the battle victorious? | |
| void | PlayerDefeat () |
| Handle player defeat. | |
| void | PlayerVictory () |
| Handle player victory. | |
| void | RemoveScriptedEventsForActor (hoa_battle::private_battle::BattleActor *actor) |
| Remove all scripted events for an actor. | |
| void | SetPerformingScript (bool is_performing, private_battle::ScriptEvent *se) |
| Sets whether an action is being performed or not, and what that action is. | |
| void | SwapCharacters (private_battle::BattleCharacterActor *ActorToRemove, private_battle::BattleCharacterActor *ActorToAdd) |
| Swap a character from _player_actors to _player_actors_in_battle. | |
| void | UnFreezeTimers () |
| Unfreezes all timers in battle mode. Used when game is unpaused or using wait battle mode. | |
| ~BattleMode () | |
| void | Draw () |
| This method calls different draw functions depending on the battle state. | |
| void | Reset () |
| Resets appropriate class members. Called whenever BattleMode is made the active game mode. | |
| void | Update () |
| This method calls different update functions depending on the battle state. | |
Private Member Functions | |
| void | _CreateCharacterActors () |
| void | _CreateEnemyActors () |
| void | _Initialize () |
| Initializes all data necessary for the battle to begin. | |
| uint32 | _NumberCharactersAlive () const |
| Returns the number of characters that are still alive in the battle. | |
| uint32 | _NumberEnemiesAlive () const |
| Returns the number of enemies that are still alive in the battle. | |
| void | _ShutDown () |
| Shutdown the battle mode. | |
| void | _TallyRewards () |
| Tally rewards (XP, money, items). | |
| void | _TEMP_LoadTestData () |
| Loads images and other hard-coded data for the battle. | |
Draw helper functions | |
Functions which draw various components of the battle screen | |
| void | _DrawBackgroundVisuals () |
| Draws all background images and animations The images and effects drawn by this function will never be drawn over anything else in the battle (battle sprites, menus, etc.). | |
| void | _DrawBottomMenu () |
| Draws the bottom menu visuals and information The bottom menu contains a wide array of information, including swap cards, character portraits, character names, and both character and enemy status. This menu is perpetually drawn on the battle screen. | |
| void | _DrawSprites () |
| Draws all character and enemy sprites as well as any sprite visuals In addition to the sprites themselves, this function draws special effects and indicators for the sprites. For example, the actor selector image and any visible action effects like magic. | |
| void | _DrawTimeMeter () |
| Draws the universal time meter and the portraits attached to it Portraits are retrieved from the battle actors. | |
Update helper functions | |
Functions which update the state of various battle components | |
| void | _UpdateAttackPointSelection () |
| Processes user input when the player's cursor is selecting an attack point for an action. | |
| void | _UpdateCharacterSelection () |
| Updates which character the player has chosen to select. | |
| void | _UpdateTargetSelection () |
| Processes user input when the player's cursor is selecting a target for an action. | |
Private Attributes | |
| private_battle::ScriptEvent * | _active_se |
| The script currently being performed. | |
| std::vector< hoa_audio::MusicDescriptor > | _battle_music |
| Container for all music to be played during the battle The first element in this vector is the primary battle track. For most battles, only a primary track is required. However, some battles may require additional tracks to toggle between. | |
| bool | _battle_over |
| Set to true when either side of the battle is dead. | |
| bool | _initialized |
| When set to true, all preparations have been made and the battle is ready to begin. | |
| uint32 | _min_agility |
| Used for scaling actor wait times. | |
| int32 | _next_monster_location_index |
| An Index to the (x,y) location of the next created monster (MONSTER_LOCATIONS array). | |
| bool | _performing_script |
| Set to true whenever an actor (player or enemy) is performing an action. | |
| bool | _victorious_battle |
| Set to true if it was player who won the battle. | |
| std::map< std::string, uint32 > | _victory_items |
| Items gained from battle. | |
| bool | _victory_level |
| Set to true if character gained an experience level. | |
| uint32 | _victory_money |
| Money gained from battle. | |
| bool | _victory_skill |
| Set to true if character earned a new skill this experience level. | |
| uint32 | _victory_sp |
| SP gained from battle. | |
| uint32 | _victory_xp |
| XP gained from battle. | |
Battle GUI Windows | |
| private_battle::ActionWindow * | _action_window |
| Window which displays various information and options related to selecting actions for characters Located at the bottom right hand corner of the screen, this window is only visible when the player is actively selecting an action for a character. | |
| private_battle::FinishWindow * | _finish_window |
| Window which presents information and options after a battle is concluded Located at the center of the screen, this window only appears after one party in the battle has defeated the other. | |
Battle GUI Images | |
| hoa_video::StillImage | _actor_selection_image |
| An image that indicates that a particular actor has been selected This image best suites character sprites and enemy sprites of similar size. It does not work well with larger or smaller sprites. | |
| hoa_video::AnimatedImage | _attack_point_indicator |
| An image that points out the location of specific attack points on an actor This image may be used for both character and enemy actors. It is used to indicate an actively selected attack point, not just any attack points present. | |
| hoa_video::StillImage | _bottom_menu_image |
| The static image that is drawn for the bottom menus. | |
| hoa_video::StillImage | _swap_card |
| Used for visual display of how many swaps a character may perform This image is drawn in the lower left corner of the screen, just above the swap indicator. This image may be drawn on the screen up to four times (in a card-stack fashion), one for each swap that is available to be used. It is not drawn when the player has no swaps available. | |
| hoa_video::StillImage | _swap_icon |
| Image that indicates when a player may perform character swapping This image is drawn in the lower left corner of the screen. When no swaps are available to the player, the image is drawn in gray-scale. | |
| hoa_video::StillImage | _universal_time_meter |
| The universal stamina bar that all battle actors proceed along All battle actors have a portrait that moves along this meter to signify their turn in the rotation. The meter and corresponding portraits must be drawn after the character sprites. | |
Battle Background Data | |
| std::vector< hoa_video::ImageDescriptor * > | _background_images |
| Container for images (both still and animated) that are to be drawn in the background. | |
| hoa_video::StillImage | _battle_background |
| The full-screen, static background image to be used for the battle. | |
Battle Actor Containers | |
| std::map< uint8, private_battle::BattleActor * > | _battle_actors |
| A map containing pointers to all actors both on and off the battle field The actor objects are indexed by their unique ID numbers. This structure is used primarily for two things. First, it serves as a convenient index to look up and retrieve an actor object when only an ID number is known. Second, it is used to prevent memory leaks by ensuring that all BattleActor objects are deleted when the battle ends. | |
| std::deque< private_battle::BattleCharacterActor * > | _character_actors |
| Characters that are presently fighting in the battle No more than four characters may be fighting at any given time, thus this structure will never contain more than four CharacterActor objects. This structure does not include any characters that are in the party, but not actively fighting in the battle. This structure includes characters that have zero hit points. | |
| std::deque< private_battle::BattleEnemyActor * > | _enemy_actors |
| Enemies that are presently fighting in the battle There is a theoretical limit on how many enemies may fight in one battle, but that is dependent upon the sprite size of all active enemies and this limit will be detected by the BattleMode class. This structure includes enemies that have zero hit points. | |
| std::deque< hoa_global::GlobalCharacter > | _original_characters |
| Contains the original set of characters and their status This data is retained in the case that the player loses the battle and chooses to re-try the battle from the beginning. This data will be used to restore BattleMode::_character_actors. | |
| std::deque< hoa_global::GlobalEnemy > | _original_enemies |
| Contains the original set of enemies and their status This data is retained in the case that the player loses the battle and chooses to re-try the battle from the beginning. This data will be used to restore BattleMode::_enemy_actors. | |
| std::deque< private_battle::BattleCharacterActor * > | _reserve_characters |
| Characters that are in the party reserves This structure contains characters which are in the current party, but are not fighting in the battle. They may be swapped into the battle by the player. | |
Character Swap Card Data | |
| uint8 | _current_number_swaps |
| The number of character swaps that the player may currently perform The maximum number of swaps ever allowed is four, thus the value of this class member will always have the range [0, 4]. This member is also used to determine how many swap cards to draw on the battle screen. | |
| int32 | _swap_countdown_timer |
| A running counter to determine when a player may be given another swap card The units of this timer are milliseconds. The timer is initially set to around 5 minutes. Once the timer reaches below zero, it is reset and BattleMode::_num_swap_cards is incremented by one. | |
Selection Data | |
| private_battle::CURSOR_STATE | _cursor_state |
| The state of the battle's selection cursor. | |
| uint32 | _selected_attack_point |
| The index of the attack point on the selected target that is selected If the target type of the skill or item is not an attack point target, then the value of this member is meaningless. | |
| private_battle::BattleCharacterActor * | _selected_character |
| The current character that is selected by the player. | |
| int32 | _selected_character_index |
| Character index of the currently selected actor. | |
| private_battle::BattleActor * | _selected_target |
| The current target for the player's selection This may point to either a character or enemy actor. | |
| uint32 | _selected_target_index |
| Argument selector. | |
Actor Action Processing | |
| std::list< private_battle::ScriptEvent * > | _script_queue |
| A FIFO queue of actor actions to perform. | |
Friends | |
| class | private_battle::ActionWindow |
| class | private_battle::BattleActor |
| class | private_battle::BattleCharacterActor |
| class | private_battle::BattleEnemyActor |
| class | private_battle::FinishWindow |
| class | private_battle::ScriptEvent |
****************************************************************************
To create a battle, first you must create an instance of this class. Next, the battle must be populated with enemies by using the AddEnemy() methods prescribed below. You must then call the InitializeEnemies() method so that the added enemies are ready for the battle to come. This should all be done prior the Reset() method being called. If you fail to add any enemies, an error will occur and the battle will self-terminate itself.
Definition at line 222 of file battle.h.
| hoa_battle::BattleMode::BattleMode | ( | ) |
Definition at line 287 of file battle.cpp.
References _action_window, _actor_selection_image, _attack_point_indicator, _finish_window, _TEMP_LoadTestData(), _universal_time_meter, _victory_items, hoa_video::AnimatedImage::AddFrame(), hoa_battle::BATTLE_DEBUG, hoa_video::GameVideo::LoadImage(), hoa_mode_manager::MODE_MANAGER_BATTLE_MODE, hoa_mode_manager::GameMode::mode_type, hoa_video::StillImage::SetDimensions(), hoa_video::StillImage::SetFilename(), and hoa_video::VideoManager.
Here is the call graph for this function:

| hoa_battle::BattleMode::~BattleMode | ( | ) |
Definition at line 354 of file battle.cpp.
References _action_window, _actor_selection_image, _attack_point_indicator, _battle_background, _battle_music, _bottom_menu_image, _character_actors, _enemy_actors, _finish_window, _script_queue, _swap_card, _swap_icon, _universal_time_meter, _victory_items, hoa_battle::private_battle::current_battle, hoa_video::GameVideo::DeleteImage(), and hoa_video::VideoManager.
Here is the call graph for this function:

| void hoa_battle::BattleMode::_CreateCharacterActors | ( | ) | [private] |
| void hoa_battle::BattleMode::_CreateEnemyActors | ( | ) | [private] |
| void hoa_battle::BattleMode::_DrawBackgroundVisuals | ( | ) | [private] |
Draws all background images and animations The images and effects drawn by this function will never be drawn over anything else in the battle (battle sprites, menus, etc.).
Definition at line 1028 of file battle.cpp.
References _battle_background, hoa_video::GameVideo::DrawImage(), hoa_video::GameVideo::Move(), hoa_video::GameVideo::SetDrawFlags(), hoa_video::VIDEO_NO_BLEND, hoa_video::VIDEO_X_LEFT, hoa_video::VIDEO_Y_BOTTOM, and hoa_video::VideoManager.
Referenced by Draw().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_DrawBottomMenu | ( | ) | [private] |
Draws the bottom menu visuals and information The bottom menu contains a wide array of information, including swap cards, character portraits, character names, and both character and enemy status. This menu is perpetually drawn on the battle screen.
Definition at line 1039 of file battle.cpp.
References _bottom_menu_image, _character_actors, _current_number_swaps, _selected_character, _swap_card, _swap_icon, hoa_video::GameVideo::DrawImage(), hoa_battle::private_battle::BattleCharacterActor::DrawPortrait(), hoa_video::GameVideo::Move(), hoa_video::GameVideo::MoveRelative(), hoa_video::GameVideo::SetDrawFlags(), hoa_video::VIDEO_BLEND, hoa_video::VIDEO_X_LEFT, hoa_video::VIDEO_Y_BOTTOM, and hoa_video::VideoManager.
Referenced by Draw().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_DrawSprites | ( | ) | [private] |
Draws all character and enemy sprites as well as any sprite visuals In addition to the sprites themselves, this function draws special effects and indicators for the sprites. For example, the actor selector image and any visible action effects like magic.
Definition at line 1065 of file battle.cpp.
References _character_actors, and _enemy_actors.
Referenced by Draw().
| void hoa_battle::BattleMode::_DrawTimeMeter | ( | ) | [private] |
Draws the universal time meter and the portraits attached to it Portraits are retrieved from the battle actors.
Definition at line 1084 of file battle.cpp.
References _action_window, _character_actors, _cursor_state, _enemy_actors, _selected_target, _universal_time_meter, hoa_battle::private_battle::ACTION_TYPE_ITEM, hoa_battle::private_battle::CURSOR_SELECT_ATTACK_POINT, hoa_battle::private_battle::CURSOR_SELECT_TARGET, hoa_video::GameVideo::DrawImage(), hoa_battle::private_battle::ActionWindow::GetActionCategory(), hoa_battle::private_battle::ActionWindow::GetActionTargetType(), hoa_global::GLOBAL_TARGET_INVALID, hoa_global::GLOBAL_TARGET_PARTY, hoa_battle::private_battle::BattleActor::IsEnemy(), hoa_video::GameVideo::Move(), hoa_video::GameVideo::SetDrawFlags(), hoa_video::VIDEO_X_CENTER, hoa_video::VIDEO_X_LEFT, hoa_video::VIDEO_Y_BOTTOM, hoa_video::VIDEO_Y_CENTER, and hoa_video::VideoManager.
Referenced by Draw().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_Initialize | ( | ) | [private] |
Initializes all data necessary for the battle to begin.
Definition at line 524 of file battle.cpp.
References _character_actors, _enemy_actors, _initialized, _min_agility, _selected_character, _selected_character_index, hoa_battle::BATTLE_DEBUG, hoa_global::GameGlobal::GetActiveParty(), hoa_global::GlobalParty::GetActorAtIndex(), GetIndexOfFirstIdleCharacter(), hoa_global::GlobalParty::GetPartySize(), hoa_global::GlobalManager, hoa_battle::private_battle::BattleActor::InitBattleActorStats(), hoa_battle::private_battle::MAX_INIT_WAIT_TIME, hoa_mode_manager::ModeManager, hoa_mode_manager::GameModeManager::Pop(), hoa_system::SystemManager, and hoa_system::GameSystem::UpdateTimers().
Referenced by Reset().
Here is the call graph for this function:

| bool hoa_battle::BattleMode::_IsPerformingScript | ( | ) | const [inline] |
Returns true if an actor is performing an action.
Definition at line 278 of file battle.h.
References _performing_script.
Referenced by Update().
| uint32 hoa_battle::BattleMode::_NumberCharactersAlive | ( | ) | const [private] |
Returns the number of characters that are still alive in the battle.
Definition at line 1203 of file battle.cpp.
References _character_actors.
Referenced by _UpdateCharacterSelection(), and Update().
| uint32 hoa_battle::BattleMode::_NumberEnemiesAlive | ( | ) | const [private] |
Returns the number of enemies that are still alive in the battle.
Definition at line 1191 of file battle.cpp.
References _enemy_actors.
Referenced by Update().
| void hoa_battle::BattleMode::_ShutDown | ( | ) | [private] |
Shutdown the battle mode.
Definition at line 615 of file battle.cpp.
References _battle_music, _character_actors, hoa_input::GameInput::EventHandler(), hoa_input::InputManager, hoa_mode_manager::ModeManager, and hoa_mode_manager::GameModeManager::Pop().
Referenced by _TEMP_LoadTestData(), PlayerDefeat(), and hoa_battle::private_battle::FinishWindow::Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_TallyRewards | ( | ) | [private] |
Tally rewards (XP, money, items).
Definition at line 631 of file battle.cpp.
References _victory_money, _victory_sp, _victory_xp, hoa_battle::private_battle::BattleEnemyActor::GetActor(), hoa_global::GlobalEnemy::GetDrunesDropped(), GetEnemyActorAt(), hoa_global::GlobalActor::GetExperiencePoints(), GetNumberOfCharacters(), GetNumberOfEnemies(), and GetPlayerCharacterAt().
Referenced by Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_TEMP_LoadTestData | ( | ) | [private] |
Loads images and other hard-coded data for the battle.
Definition at line 491 of file battle.cpp.
References _battle_background, _bottom_menu_image, _ShutDown(), _swap_card, _swap_icon, hoa_video::GameVideo::LoadImage(), hoa_battle::private_battle::SCREEN_HEIGHT, hoa_battle::private_battle::SCREEN_LENGTH, hoa_video::StillImage::SetDimensions(), hoa_video::StillImage::SetFilename(), hoa_battle::private_battle::TILE_SIZE, and hoa_video::VideoManager.
Referenced by BattleMode().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_UpdateAttackPointSelection | ( | ) | [private] |
Processes user input when the player's cursor is selecting an attack point for an action.
Definition at line 942 of file battle.cpp.
References _action_window, _cursor_state, _selected_attack_point, _selected_character, _selected_character_index, _selected_target, _selected_target_index, hoa_battle::private_battle::ACTION_TYPE_ITEM, hoa_battle::private_battle::ACTIVE_BATTLE_MODE, AddScriptEventToQueue(), hoa_input::GameInput::CancelPress(), hoa_input::GameInput::ConfirmPress(), hoa_battle::private_battle::CURSOR_IDLE, hoa_battle::private_battle::CURSOR_SELECT_TARGET, hoa_global::GlobalObject::DecrementCount(), hoa_input::GameInput::DownPress(), hoa_battle::private_battle::ActionWindow::GetActionCategory(), hoa_battle::private_battle::BattleEnemyActor::GetActor(), hoa_global::GlobalActor::GetAttackPoints(), GetEnemyActorAt(), GetIndexOfFirstIdleCharacter(), hoa_battle::private_battle::ActionWindow::GetSelectedItem(), hoa_battle::private_battle::ActionWindow::GetSelectedSkill(), hoa_input::InputManager, hoa_input::GameInput::LeftPress(), hoa_battle::private_battle::ActionWindow::Reset(), hoa_input::GameInput::RightPress(), hoa_battle::private_battle::BattleActor::SetQueuedToPerform(), UnFreezeTimers(), and hoa_input::GameInput::UpPress().
Referenced by Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_UpdateCharacterSelection | ( | ) | [private] |
Updates which character the player has chosen to select.
Definition at line 778 of file battle.cpp.
References _action_window, _cursor_state, _NumberCharactersAlive(), _selected_character, _selected_character_index, hoa_battle::private_battle::ACTIVE_BATTLE_MODE, hoa_input::GameInput::ConfirmPress(), hoa_battle::private_battle::CURSOR_WAIT, hoa_input::GameInput::DownPress(), FreezeTimers(), GetIndexOfFirstIdleCharacter(), GetNumberOfCharacters(), GetPlayerCharacterAt(), hoa_battle::private_battle::BattleActor::GetWaitTime(), hoa_battle::private_battle::ActionWindow::Initialize(), hoa_input::InputManager, hoa_battle::private_battle::INVALID_BATTLE_ACTOR_INDEX, hoa_battle::private_battle::BattleActor::IsAlive(), hoa_system::SystemTimer::IsFinished(), hoa_battle::private_battle::BattleActor::IsQueuedToPerform(), hoa_input::GameInput::LeftPress(), hoa_input::GameInput::RightPress(), and hoa_input::GameInput::UpPress().
Referenced by Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::_UpdateTargetSelection | ( | ) | [private] |
Processes user input when the player's cursor is selecting a target for an action.
Definition at line 845 of file battle.cpp.
References _action_window, _cursor_state, _selected_attack_point, _selected_character, _selected_character_index, _selected_target, _selected_target_index, hoa_battle::private_battle::ACTION_TYPE_ITEM, hoa_battle::private_battle::ACTIVE_BATTLE_MODE, AddScriptEventToQueue(), hoa_input::GameInput::CancelPress(), hoa_input::GameInput::ConfirmPress(), hoa_battle::private_battle::CURSOR_IDLE, hoa_battle::private_battle::CURSOR_SELECT_ATTACK_POINT, hoa_global::GlobalObject::DecrementCount(), hoa_input::GameInput::DownPress(), hoa_battle::private_battle::ActionWindow::GetActionCategory(), hoa_battle::private_battle::ActionWindow::GetActionTargetType(), hoa_global::GameGlobal::GetActiveParty(), GetEnemyActorAt(), GetIndexOfFirstIdleCharacter(), GetIndexOfNextAliveEnemy(), hoa_global::GlobalParty::GetPartySize(), GetPlayerCharacterAt(), hoa_battle::private_battle::ActionWindow::GetSelectedItem(), hoa_battle::private_battle::ActionWindow::GetSelectedSkill(), hoa_global::GLOBAL_TARGET_ATTACK_POINT, hoa_global::GLOBAL_TARGET_PARTY, hoa_global::GlobalManager, hoa_input::InputManager, hoa_battle::private_battle::ActionWindow::IsActionTargetAlly(), hoa_battle::private_battle::BattleActor::IsEnemy(), hoa_input::GameInput::LeftPress(), hoa_input::GameInput::RightPress(), hoa_battle::private_battle::BattleActor::SetQueuedToPerform(), UnFreezeTimers(), and hoa_input::GameInput::UpPress().
Referenced by Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::AddEnemy | ( | uint32 | new_enemy_id | ) | [inline] |
Adds a new active enemy to the battle field.
| new_enemy_id | The id number of the new enemy to add to the battle This method works precisely the same was as the method which takes a GlobalEnemy argument, only this version will construct the global enemy just using its id (meaning that it has to open up the Lua file which defines the enemy). If the GlobalEnemy has already been defined somewhere else, it is better to pass it in to the alternative definition of this function. |
Definition at line 264 of file battle.h.
References AddEnemy().
Here is the call graph for this function:

| void hoa_battle::BattleMode::AddEnemy | ( | hoa_global::GlobalEnemy | new_enemy | ) |
Adds a new active enemy to the battle field.
| new_enemy | A copy of the GlobalEnemy object to add to the battle This method uses the GlobalEnemy copy constructor to create a copy of the enemy. The GlobalEnemy passed as an argument should be in its default loaded state (that is, it should have an experience level equal to one). |
Definition at line 433 of file battle.cpp.
References _enemy_actors, _next_monster_location_index, _original_enemies, hoa_global::GameGlobal::AverageActivePartyExperienceLevel(), hoa_battle::BATTLE_DEBUG, hoa_global::GlobalActor::GetExperienceLevel(), hoa_global::GlobalActor::GetID(), hoa_global::GlobalManager, hoa_battle::private_battle::BattleActor::InitBattleActorStats(), hoa_global::GlobalEnemy::Initialize(), and hoa_battle::private_battle::MONSTER_LOCATIONS.
Referenced by hoa_boot::BootMode::_OnBattleDebug(), and AddEnemy().
Here is the call graph for this function:

| void hoa_battle::BattleMode::AddMusic | ( | std::string | music_filename | ) |
Adds a piece of music to the battle soundtrack.
| music_filename | The full filename of the music to play Note that the first piece of music added is the one that will be played upon entering battle. All subsequent pieces of music added must be explicitly triggered to play by certain scripted conditions in battle. If no music is added for a battle, a default battle theme will be played. |
Referenced by hoa_battle::private_battle::FinishWindow::Initialize().
| void hoa_battle::BattleMode::AddScriptEventToQueue | ( | private_battle::ScriptEvent * | event | ) | [inline] |
Added a scripted event to the queue.
Definition at line 285 of file battle.h.
References _script_queue.
Referenced by _UpdateAttackPointSelection(), _UpdateTargetSelection(), and hoa_battle::private_battle::BattleEnemyActor::Update().
| void hoa_battle::BattleMode::Draw | ( | ) | [virtual] |
This method calls different draw functions depending on the battle state.
Implements hoa_mode_manager::GameMode.
Definition at line 1001 of file battle.cpp.
References _action_window, _battle_over, _DrawBackgroundVisuals(), _DrawBottomMenu(), _DrawSprites(), _DrawTimeMeter(), _finish_window, _victorious_battle, hoa_battle::private_battle::FinishWindow::Draw(), hoa_battle::private_battle::ActionWindow::Draw(), hoa_video::GameVideo::EnableSceneLighting(), hoa_battle::private_battle::ActionWindow::GetState(), hoa_video::VideoManager, and hoa_battle::private_battle::VIEW_INVALID.
Here is the call graph for this function:

| void hoa_battle::BattleMode::FreezeTimers | ( | ) |
Freezes all timers in battle mode. Used when game is paused or using wait battle mode.
Definition at line 1278 of file battle.cpp.
References _character_actors, _enemy_actors, and _script_queue.
Referenced by _UpdateCharacterSelection(), and hoa_input::TEMP_HandlePause().
| private_battle::ScriptEvent* hoa_battle::BattleMode::GetActiveScript | ( | ) | [inline] |
| std::deque<private_battle::BattleCharacterActor*> hoa_battle::BattleMode::GetCharacters | ( | ) | const [inline] |
| private_battle::BattleEnemyActor* hoa_battle::BattleMode::GetEnemyActorAt | ( | uint32 | index | ) | const [inline] |
Returns the enemy actor at the deque location 'index'.
Definition at line 335 of file battle.h.
References _enemy_actors.
Referenced by _TallyRewards(), hoa_battle::private_battle::ActionWindow::_UpdateActionSelection(), _UpdateAttackPointSelection(), _UpdateTargetSelection(), and hoa_battle::private_battle::ScriptEvent::RunScript().
| uint32 hoa_battle::BattleMode::GetIndexOfCharacter | ( | private_battle::BattleCharacterActor *const | Actor | ) | const |
Returns the index of a player character.
Definition at line 1431 of file battle.cpp.
References _character_actors, and hoa_battle::private_battle::INVALID_BATTLE_ACTOR_INDEX.
| uint32 hoa_battle::BattleMode::GetIndexOfFirstAliveEnemy | ( | ) | const |
Definition at line 1387 of file battle.cpp.
References _enemy_actors, and hoa_battle::private_battle::INVALID_BATTLE_ACTOR_INDEX.
Referenced by hoa_battle::private_battle::ActionWindow::_UpdateActionSelection().
| uint32 hoa_battle::BattleMode::GetIndexOfFirstIdleCharacter | ( | ) | const |
Definition at line 1414 of file battle.cpp.
References _character_actors, hoa_battle::private_battle::BattleCharacterActor::GetActor(), hoa_battle::private_battle::BattleActor::GetWaitTime(), hoa_battle::private_battle::INVALID_BATTLE_ACTOR_INDEX, hoa_global::GlobalActor::IsAlive(), hoa_system::SystemTimer::IsFinished(), and hoa_battle::private_battle::BattleActor::IsQueuedToPerform().
Referenced by _Initialize(), _UpdateAttackPointSelection(), _UpdateCharacterSelection(), and _UpdateTargetSelection().
Here is the call graph for this function:

| uint32 hoa_battle::BattleMode::GetIndexOfLastAliveEnemy | ( | ) | const |
Definition at line 1400 of file battle.cpp.
References _enemy_actors, and hoa_battle::private_battle::INVALID_BATTLE_ACTOR_INDEX.
| uint32 hoa_battle::BattleMode::GetIndexOfNextAliveEnemy | ( | bool | move_upward | ) | const |
Useful for item and skill targeting.
Definition at line 1444 of file battle.cpp.
References _enemy_actors, _selected_target_index, and hoa_battle::private_battle::INVALID_BATTLE_ACTOR_INDEX.
Referenced by _UpdateTargetSelection().
| uint32 hoa_battle::BattleMode::GetNumberOfCharacters | ( | ) | const [inline] |
Definition at line 315 of file battle.h.
References _character_actors.
Referenced by _TallyRewards(), _UpdateCharacterSelection(), and hoa_battle::private_battle::ScriptEvent::RunScript().
| uint32 hoa_battle::BattleMode::GetNumberOfEnemies | ( | ) | const [inline] |
Definition at line 318 of file battle.h.
References _enemy_actors.
Referenced by _TallyRewards(), and hoa_battle::private_battle::ScriptEvent::RunScript().
| private_battle::BattleCharacterActor* hoa_battle::BattleMode::GetPlayerCharacterAt | ( | uint32 | index | ) | const [inline] |
Returns the player actor at the deque location 'index'.
Definition at line 331 of file battle.h.
References _character_actors.
Referenced by _TallyRewards(), hoa_battle::private_battle::ActionWindow::_UpdateActionSelection(), _UpdateCharacterSelection(), _UpdateTargetSelection(), hoa_battle::private_battle::ScriptEvent::RunScript(), and hoa_battle::private_battle::BattleEnemyActor::Update().
| bool hoa_battle::BattleMode::IsBattleOver | ( | ) | const [inline] |
| bool hoa_battle::BattleMode::IsVictorious | ( | ) | const [inline] |
| void hoa_battle::BattleMode::PlayerDefeat | ( | ) |
Handle player defeat.
Definition at line 1358 of file battle.cpp.
References _ShutDown(), hoa_mode_manager::ModeManager, hoa_mode_manager::GameModeManager::PopAll(), and hoa_mode_manager::GameModeManager::Push().
Referenced by hoa_battle::private_battle::FinishWindow::Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::PlayerVictory | ( | ) |
Handle player victory.
Definition at line 1337 of file battle.cpp.
References _character_actors, _victory_level, _victory_money, _victory_skill, _victory_sp, _victory_xp, hoa_global::GameGlobal::AddDrunes(), and hoa_global::GlobalManager.
Referenced by Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::RemoveScriptedEventsForActor | ( | hoa_battle::private_battle::BattleActor * | actor | ) |
Remove all scripted events for an actor.
Definition at line 1262 of file battle.cpp.
References _script_queue.
Referenced by hoa_battle::private_battle::BattleActor::TakeDamage().
| void hoa_battle::BattleMode::Reset | ( | ) | [virtual] |
Resets appropriate class members. Called whenever BattleMode is made the active game mode.
Implements hoa_mode_manager::GameMode.
Definition at line 402 of file battle.cpp.
References _battle_music, _Initialize(), _initialized, hoa_battle::BATTLE_DEBUG, hoa_battle::private_battle::current_battle, hoa_audio::MusicDescriptor::GetFilename(), hoa_audio::MusicDescriptor::LoadMusic(), hoa_video::GameVideo::SetCoordSys(), hoa_video::GameVideo::SetFont(), and hoa_video::VideoManager.
Here is the call graph for this function:

| void hoa_battle::BattleMode::SetPerformingScript | ( | bool | is_performing, | |
| private_battle::ScriptEvent * | se | |||
| ) |
Sets whether an action is being performed or not, and what that action is.
Definition at line 1215 of file battle.cpp.
References _active_se, _performing_script, _script_queue, hoa_system::GameSystem::ExitGame(), hoa_battle::private_battle::BattleActor::ResetWaitTime(), hoa_battle::private_battle::BattleActor::SetQueuedToPerform(), and hoa_system::SystemManager.
Referenced by Update().
Here is the call graph for this function:

| void hoa_battle::BattleMode::SwapCharacters | ( | private_battle::BattleCharacterActor * | ActorToRemove, | |
| private_battle::BattleCharacterActor * | ActorToAdd | |||
| ) |
Swap a character from _player_actors to _player_actors_in_battle.
Definition at line 1367 of file battle.cpp.
References _character_actors, hoa_battle::private_battle::BattleActor::GetXOrigin(), hoa_battle::private_battle::BattleActor::GetYOrigin(), hoa_battle::private_battle::BattleActor::SetXLocation(), hoa_battle::private_battle::BattleActor::SetXOrigin(), hoa_battle::private_battle::BattleActor::SetYLocation(), and hoa_battle::private_battle::BattleActor::SetYOrigin().
Here is the call graph for this function:

| void hoa_battle::BattleMode::UnFreezeTimers | ( | ) |
Unfreezes all timers in battle mode. Used when game is unpaused or using wait battle mode.
Definition at line 1306 of file battle.cpp.
References _character_actors, _enemy_actors, and _script_queue.
Referenced by _UpdateAttackPointSelection(), _UpdateTargetSelection(), and hoa_input::TEMP_HandlePause().
| void hoa_battle::BattleMode::Update | ( | ) | [virtual] |
This method calls different update functions depending on the battle state.
Implements hoa_mode_manager::GameMode.
Definition at line 681 of file battle.cpp.
References _action_window, _attack_point_indicator, _battle_over, _character_actors, _cursor_state, _enemy_actors, _finish_window, _IsPerformingScript(), _NumberCharactersAlive(), _NumberEnemiesAlive(), _script_queue, _TallyRewards(), _UpdateAttackPointSelection(), _UpdateCharacterSelection(), _UpdateTargetSelection(), _victorious_battle, hoa_battle::private_battle::CURSOR_IDLE, hoa_battle::private_battle::CURSOR_SELECT_ATTACK_POINT, hoa_battle::private_battle::CURSOR_SELECT_PARTY, hoa_battle::private_battle::CURSOR_SELECT_TARGET, hoa_battle::private_battle::CURSOR_WAIT, hoa_battle::private_battle::FINISH_INVALID, hoa_battle::private_battle::ActionWindow::GetState(), hoa_battle::private_battle::FinishWindow::GetState(), hoa_battle::private_battle::ScriptEvent::GetWarmUpTime(), hoa_battle::private_battle::FinishWindow::Initialize(), hoa_system::SystemTimer::IsFinished(), PlayerVictory(), hoa_battle::private_battle::ActionWindow::Reset(), hoa_battle::private_battle::ScriptEvent::RunScript(), SetPerformingScript(), hoa_battle::private_battle::ActionWindow::Update(), hoa_video::AnimatedImage::Update(), hoa_battle::private_battle::ScriptEvent::Update(), hoa_battle::private_battle::FinishWindow::Update(), and hoa_battle::private_battle::VIEW_INVALID.
Here is the call graph for this function:

friend class private_battle::ActionWindow [friend] |
friend class private_battle::BattleActor [friend] |
friend class private_battle::BattleCharacterActor [friend] |
friend class private_battle::BattleEnemyActor [friend] |
friend class private_battle::FinishWindow [friend] |
friend class private_battle::ScriptEvent [friend] |
Window which displays various information and options related to selecting actions for characters Located at the bottom right hand corner of the screen, this window is only visible when the player is actively selecting an action for a character.
Definition at line 481 of file battle.h.
Referenced by _DrawTimeMeter(), _UpdateAttackPointSelection(), _UpdateCharacterSelection(), _UpdateTargetSelection(), BattleMode(), Draw(), Update(), and ~BattleMode().
The script currently being performed.
Definition at line 358 of file battle.h.
Referenced by GetActiveScript(), and SetPerformingScript().
An image that indicates that a particular actor has been selected This image best suites character sprites and enemy sprites of similar size. It does not work well with larger or smaller sprites.
Definition at line 499 of file battle.h.
Referenced by BattleMode(), hoa_battle::private_battle::BattleEnemyActor::DrawSprite(), hoa_battle::private_battle::BattleCharacterActor::DrawSprite(), and ~BattleMode().
An image that points out the location of specific attack points on an actor This image may be used for both character and enemy actors. It is used to indicate an actively selected attack point, not just any attack points present.
Definition at line 505 of file battle.h.
Referenced by BattleMode(), hoa_battle::private_battle::BattleEnemyActor::DrawSprite(), Update(), and ~BattleMode().
std::vector<hoa_video::ImageDescriptor*> hoa_battle::BattleMode::_background_images [private] |
std::map<uint8, private_battle::BattleActor*> hoa_battle::BattleMode::_battle_actors [private] |
A map containing pointers to all actors both on and off the battle field The actor objects are indexed by their unique ID numbers. This structure is used primarily for two things. First, it serves as a convenient index to look up and retrieve an actor object when only an ID number is known. Second, it is used to prevent memory leaks by ensuring that all BattleActor objects are deleted when the battle ends.
The full-screen, static background image to be used for the battle.
Definition at line 393 of file battle.h.
Referenced by _DrawBackgroundVisuals(), _TEMP_LoadTestData(), and ~BattleMode().
std::vector<hoa_audio::MusicDescriptor> hoa_battle::BattleMode::_battle_music [private] |
Container for all music to be played during the battle The first element in this vector is the primary battle track. For most battles, only a primary track is required. However, some battles may require additional tracks to toggle between.
Definition at line 388 of file battle.h.
Referenced by _ShutDown(), hoa_battle::private_battle::FinishWindow::Initialize(), Reset(), and ~BattleMode().
bool hoa_battle::BattleMode::_battle_over [private] |
Set to true when either side of the battle is dead.
Definition at line 361 of file battle.h.
Referenced by Draw(), IsBattleOver(), and Update().
The static image that is drawn for the bottom menus.
Definition at line 493 of file battle.h.
Referenced by _DrawBottomMenu(), _TEMP_LoadTestData(), and ~BattleMode().
std::deque<private_battle::BattleCharacterActor*> hoa_battle::BattleMode::_character_actors [private] |
Characters that are presently fighting in the battle No more than four characters may be fighting at any given time, thus this structure will never contain more than four CharacterActor objects. This structure does not include any characters that are in the party, but not actively fighting in the battle. This structure includes characters that have zero hit points.
Definition at line 427 of file battle.h.
Referenced by _DrawBottomMenu(), _DrawSprites(), _DrawTimeMeter(), _Initialize(), _NumberCharactersAlive(), _ShutDown(), hoa_battle::private_battle::BattleCharacterActor::DrawStatus(), FreezeTimers(), GetCharacters(), GetIndexOfCharacter(), GetIndexOfFirstIdleCharacter(), GetNumberOfCharacters(), GetPlayerCharacterAt(), PlayerVictory(), SwapCharacters(), UnFreezeTimers(), Update(), and ~BattleMode().
The number of character swaps that the player may currently perform The maximum number of swaps ever allowed is four, thus the value of this class member will always have the range [0, 4]. This member is also used to determine how many swap cards to draw on the battle screen.
Definition at line 535 of file battle.h.
Referenced by _DrawBottomMenu().
The state of the battle's selection cursor.
Definition at line 446 of file battle.h.
Referenced by _DrawTimeMeter(), hoa_battle::private_battle::ActionWindow::_UpdateActionSelection(), _UpdateAttackPointSelection(), _UpdateCharacterSelection(), _UpdateTargetSelection(), hoa_battle::private_battle::BattleEnemyActor::DrawSprite(), hoa_battle::private_battle::BattleCharacterActor::DrawSprite(), hoa_battle::private_battle::BattleEnemyActor::DrawStatus(), and Update().
std::deque<private_battle::BattleEnemyActor*> hoa_battle::BattleMode::_enemy_actors [private] |
Enemies that are presently fighting in the battle There is a theoretical limit on how many enemies may fight in one battle, but that is dependent upon the sprite size of all active enemies and this limit will be detected by the BattleMode class. This structure includes enemies that have zero hit points.
Definition at line 434 of file battle.h.
Referenced by _DrawSprites(), _DrawTimeMeter(), _Initialize(), _NumberEnemiesAlive(), AddEnemy(), FreezeTimers(), GetEnemyActorAt(), GetIndexOfFirstAliveEnemy(), GetIndexOfLastAliveEnemy(), GetIndexOfNextAliveEnemy(), GetNumberOfEnemies(), UnFreezeTimers(), Update(), and ~BattleMode().
Window which presents information and options after a battle is concluded Located at the center of the screen, this window only appears after one party in the battle has defeated the other.
Definition at line 487 of file battle.h.
Referenced by BattleMode(), Draw(), Update(), and ~BattleMode().
bool hoa_battle::BattleMode::_initialized [private] |
When set to true, all preparations have been made and the battle is ready to begin.
Definition at line 352 of file battle.h.
Referenced by _Initialize(), and Reset().
uint32 hoa_battle::BattleMode::_min_agility [private] |
Used for scaling actor wait times.
Definition at line 545 of file battle.h.
Referenced by _Initialize().
An Index to the (x,y) location of the next created monster (MONSTER_LOCATIONS array).
Definition at line 554 of file battle.h.
Referenced by AddEnemy().
std::deque<hoa_global::GlobalCharacter> hoa_battle::BattleMode::_original_characters [private] |
Contains the original set of characters and their status This data is retained in the case that the player loses the battle and chooses to re-try the battle from the beginning. This data will be used to restore BattleMode::_character_actors.
std::deque<hoa_global::GlobalEnemy> hoa_battle::BattleMode::_original_enemies [private] |
Contains the original set of enemies and their status This data is retained in the case that the player loses the battle and chooses to re-try the battle from the beginning. This data will be used to restore BattleMode::_enemy_actors.
Definition at line 405 of file battle.h.
Referenced by AddEnemy().
bool hoa_battle::BattleMode::_performing_script [private] |
Set to true whenever an actor (player or enemy) is performing an action.
Definition at line 355 of file battle.h.
Referenced by _IsPerformingScript(), and SetPerformingScript().
std::deque<private_battle::BattleCharacterActor*> hoa_battle::BattleMode::_reserve_characters [private] |
std::list<private_battle::ScriptEvent*> hoa_battle::BattleMode::_script_queue [private] |
A FIFO queue of actor actions to perform.
Definition at line 550 of file battle.h.
Referenced by AddScriptEventToQueue(), FreezeTimers(), RemoveScriptedEventsForActor(), SetPerformingScript(), UnFreezeTimers(), Update(), and ~BattleMode().
The index of the attack point on the selected target that is selected If the target type of the skill or item is not an attack point target, then the value of this member is meaningless.
Definition at line 472 of file battle.h.
Referenced by _UpdateAttackPointSelection(), _UpdateTargetSelection(), hoa_battle::private_battle::BattleEnemyActor::DrawSprite(), and hoa_battle::private_battle::BattleEnemyActor::DrawStatus().
The current character that is selected by the player.
Definition at line 461 of file battle.h.
Referenced by _DrawBottomMenu(), _Initialize(), _UpdateAttackPointSelection(), _UpdateCharacterSelection(), _UpdateTargetSelection(), and hoa_battle::private_battle::BattleCharacterActor::DrawSprite().
Character index of the currently selected actor.
Definition at line 455 of file battle.h.
Referenced by _Initialize(), _UpdateAttackPointSelection(), _UpdateCharacterSelection(), and _UpdateTargetSelection().
The current target for the player's selection This may point to either a character or enemy actor.
Definition at line 466 of file battle.h.
Referenced by _DrawTimeMeter(), hoa_battle::private_battle::ActionWindow::_UpdateActionSelection(), _UpdateAttackPointSelection(), _UpdateTargetSelection(), hoa_battle::private_battle::BattleEnemyActor::DrawSprite(), and hoa_battle::private_battle::BattleCharacterActor::DrawSprite().
Argument selector.
Definition at line 458 of file battle.h.
Referenced by hoa_battle::private_battle::ActionWindow::_UpdateActionSelection(), _UpdateAttackPointSelection(), _UpdateTargetSelection(), and GetIndexOfNextAliveEnemy().
Used for visual display of how many swaps a character may perform This image is drawn in the lower left corner of the screen, just above the swap indicator. This image may be drawn on the screen up to four times (in a card-stack fashion), one for each swap that is available to be used. It is not drawn when the player has no swaps available.
Definition at line 525 of file battle.h.
Referenced by _DrawBottomMenu(), _TEMP_LoadTestData(), and ~BattleMode().
A running counter to determine when a player may be given another swap card The units of this timer are milliseconds. The timer is initially set to around 5 minutes. Once the timer reaches below zero, it is reset and BattleMode::_num_swap_cards is incremented by one.
Image that indicates when a player may perform character swapping This image is drawn in the lower left corner of the screen. When no swaps are available to the player, the image is drawn in gray-scale.
Definition at line 518 of file battle.h.
Referenced by _DrawBottomMenu(), _TEMP_LoadTestData(), and ~BattleMode().
The universal stamina bar that all battle actors proceed along All battle actors have a portrait that moves along this meter to signify their turn in the rotation. The meter and corresponding portraits must be drawn after the character sprites.
Definition at line 512 of file battle.h.
Referenced by _DrawTimeMeter(), BattleMode(), and ~BattleMode().
bool hoa_battle::BattleMode::_victorious_battle [private] |
Set to true if it was player who won the battle.
Definition at line 364 of file battle.h.
Referenced by Draw(), IsVictorious(), and Update().
std::map<std::string, uint32> hoa_battle::BattleMode::_victory_items [private] |
Items gained from battle.
Definition at line 382 of file battle.h.
Referenced by BattleMode(), hoa_battle::private_battle::FinishWindow::Draw(), and ~BattleMode().
bool hoa_battle::BattleMode::_victory_level [private] |
Set to true if character gained an experience level.
Definition at line 376 of file battle.h.
Referenced by hoa_battle::private_battle::FinishWindow::Draw(), and PlayerVictory().
uint32 hoa_battle::BattleMode::_victory_money [private] |
Money gained from battle.
Definition at line 373 of file battle.h.
Referenced by _TallyRewards(), hoa_battle::private_battle::FinishWindow::Draw(), and PlayerVictory().
bool hoa_battle::BattleMode::_victory_skill [private] |
Set to true if character earned a new skill this experience level.
Definition at line 379 of file battle.h.
Referenced by hoa_battle::private_battle::FinishWindow::Draw(), and PlayerVictory().
uint32 hoa_battle::BattleMode::_victory_sp [private] |
SP gained from battle.
Definition at line 370 of file battle.h.
Referenced by _TallyRewards(), hoa_battle::private_battle::FinishWindow::Draw(), and PlayerVictory().
uint32 hoa_battle::BattleMode::_victory_xp [private] |
XP gained from battle.
Definition at line 367 of file battle.h.
Referenced by _TallyRewards(), hoa_battle::private_battle::FinishWindow::Draw(), and PlayerVictory().
1.5.1