Permalink
Browse files

Made the battle weapon ammo independent in term of draw sorting.

I added the BattleObject class making all the visuals depend on it.

It permitted to make the ammo be independent in term of draw sorting,
but will also permit to later add proper battle particle effects for instance.

Added the BattleObject class and let the actor and ammo be yet another type of object
  • Loading branch information...
1 parent e5023d8 commit a44e29884bc0063b65aaedb57ea0f79a4bd49f9c Yohann Ferreira committed Sep 16, 2012
View
9 src/common/global/global_objects.cpp
@@ -120,8 +120,7 @@ GlobalItem& GlobalItem::operator=(const GlobalItem& copy) {
////////////////////////////////////////////////////////////////////////////////
GlobalWeapon::GlobalWeapon(uint32 id, uint32 count) :
- GlobalObject(id, count),
- _has_ammo(false)
+ GlobalObject(id, count)
{
// Initialize all elemental effects as neutral
_elemental_effects.insert(std::pair<GLOBAL_ELEMENTAL, GLOBAL_INTENSITY>(GLOBAL_ELEMENTAL_FIRE, GLOBAL_INTENSITY_NEUTRAL));
@@ -154,10 +153,8 @@ GlobalWeapon::GlobalWeapon(uint32 id, uint32 count) :
_metaphysical_attack = script_file.ReadUInt("metaphysical_attack");
_usable_by = script_file.ReadUInt("usable_by");
- // Load the possible battle ammo animated image.
- std::string ammo_file = script_file.ReadString("battle_ammo_animation_file");
- if (!ammo_file.empty() && _ammo_image.LoadFromAnimationScript(ammo_file))
- _has_ammo = true;
+ // Load the possible battle ammo animated image filename.
+ _ammo_image_file = script_file.ReadString("battle_ammo_animation_file");
script_file.CloseTable();
if (script_file.IsErrorDetected()) {
View
11 src/common/global/global_objects.h
@@ -273,16 +273,13 @@ class GlobalWeapon : public GlobalObject {
const std::map<GLOBAL_ELEMENTAL, GLOBAL_INTENSITY>& GetElementalEffects() const
{ return _elemental_effects; }
- hoa_video::AnimatedImage* GetAmmoImage()
- { return _has_ammo ? &_ammo_image : 0; }
+ const std::string& GetAmmoImageFile() const
+ { return _ammo_image_file; }
//@}
private:
- //! \brief The battle image used to display the weapon ammo.
- hoa_video::AnimatedImage _ammo_image;
-
- //! \brief Tells whether the weapon uses ammo.
- bool _has_ammo;
+ //! \brief The battle image animation file used to display the weapon ammo.
+ std::string _ammo_image_file;
//! \brief The amount of physical damage that the weapon causes
uint32 _physical_attack;
View
20 src/modes/battle/battle.cpp
@@ -333,8 +333,9 @@ void BattleMode::Reset() {
GetScriptSupervisor().Reset();
}
-bool CompareActorsYCoord(BattleActor* one, BattleActor* other) {
- // Compares the Y-coordinates of the actors, used to sort the actors before draw calls
+//! \brief Compares the Y-coordinates of the battle objects,
+//! It is used to sort them before draw calls.
+static bool CompareObjectsYCoord(BattleObject* one, BattleObject* other) {
return (one->GetYLocation() > other->GetYLocation());
}
@@ -365,16 +366,19 @@ void BattleMode::Update() {
}
// Update all actors animations and y-sorting
- _battle_sprites.clear();
+ _battle_objects.clear();
for (uint32 i = 0; i < _character_actors.size(); i++) {
_character_actors[i]->Update();
- _battle_sprites.push_back(_character_actors[i]);
+ _battle_objects.push_back(_character_actors[i]);
+ // Add also potential ammo objects
+ if (_character_actors[i]->GetAmmo().IsAmmoShown())
+ _battle_objects.push_back(&(_character_actors[i]->GetAmmo()));
}
for (uint32 i = 0; i < _enemy_actors.size(); i++) {
_enemy_actors[i]->Update();
- _battle_sprites.push_back(_enemy_actors[i]);
+ _battle_objects.push_back(_enemy_actors[i]);
}
- std::sort(_battle_sprites.begin(), _battle_sprites.end(), CompareActorsYCoord);
+ std::sort(_battle_objects.begin(), _battle_objects.end(), CompareObjectsYCoord);
// Now checking standard battle conditions
@@ -1017,8 +1021,8 @@ void BattleMode::_DrawSprites() {
// Draw sprites in order based on their x and y coordinates on the screen (bottom to top)
VideoManager->SetDrawFlags(VIDEO_X_CENTER, VIDEO_Y_BOTTOM, VIDEO_BLEND, 0);
- for (uint32 i = 0; i < _battle_sprites.size(); ++i)
- _battle_sprites[i]->DrawSprite();
+ for (uint32 i = 0; i < _battle_objects.size(); ++i)
+ _battle_objects[i]->DrawSprite();
// Draw the attack point selector graphic
if (draw_point_selection) {
View
11 src/modes/battle/battle.h
@@ -40,6 +40,8 @@ extern bool BATTLE_DEBUG;
//! \brief An internal namespace to be used only within the battle code. Don't use this namespace anywhere else!
namespace private_battle {
+class BattleObject;
+
/** \name Battle setting type
*** \brief Represents the play types of battle that the player may have to deal with
**/
@@ -283,7 +285,8 @@ class BattleMode : public hoa_mode_manager::GameMode {
**/
void RestartBattle();
- //! \brief Tells the battle actor class whether it should not update the state timer when in idle phase.
+ //! \brief Tells the battle actor class whether
+ //! it should update the state timer.
bool AreActorStatesPaused() const
{ return _actor_state_paused; }
@@ -438,10 +441,10 @@ class BattleMode : public hoa_mode_manager::GameMode {
std::list<private_battle::BattleActor*> _ready_queue;
//@}
- /** \brief List used to draw character based on their y coordinate.
+ /** \brief Vector used to draw all battle objects based on their y coordinate.
*** Sorted in the update() method.
**/
- std::vector<private_battle::BattleActor*> _battle_sprites;
+ std::vector<private_battle::BattleObject*> _battle_objects;
/** \brief 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].
@@ -497,7 +500,7 @@ class BattleMode : public hoa_mode_manager::GameMode {
**/
void _DrawBackgroundGraphics();
- /** \brief Draws all character and enemy sprites as well as any sprite visuals
+ /** \brief Draws all characters, 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.
**/
View
88 src/modes/battle/battle_actors.cpp
@@ -38,23 +38,24 @@ namespace hoa_battle {
namespace private_battle {
+void BattleAmmo::DrawSprite() {
+ // Draw potential sprite ammo
+ if (_shown) {
+ VideoManager->Move(GetXLocation(), GetYLocation());
+ _ammo_image.Draw();
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// BattleActor class
////////////////////////////////////////////////////////////////////////////////
BattleActor::BattleActor(GlobalActor* actor) :
GlobalActor(*actor),
+ BattleObject(),
_state(ACTOR_STATE_INVALID),
_global_actor(actor),
- _ammo_image(NULL),
- _show_ammo(false),
- _ammo_x(0.0f),
- _ammo_y(0.0f),
_action(NULL),
- _x_origin(0.0f),
- _y_origin(0.0f),
- _x_location(0.0f),
- _y_location(0.0f),
_execution_finished(false),
_idle_state_time(0),
_shake_timer(0),
@@ -69,16 +70,17 @@ BattleActor::BattleActor(GlobalActor* actor) :
return;
}
- // Get the pointer of the ammo image. Do not delete it, as the Global Actor is handling it already.
- _ammo_image = GetWeaponEquipped() ? GetWeaponEquipped()->GetAmmoImage() : NULL;
+ // Load the potential the ammo image filename
+ std::string ammo_animation_file = GetWeaponEquipped() ?
+ GetWeaponEquipped()->GetAmmoImageFile() : std::string();
+ if (!ammo_animation_file.empty())
+ _ammo.LoadAmmoAnimatedImage(ammo_animation_file);
// TODO: I have concerns about the copy constructor for GlobalActor. Currently it creates a copy
// of every single attack point, weapon, armor, and skill. I wonder if perhaps we should only
// create a copy of the attack point
}
-
-
BattleActor::~BattleActor() {
// If the actor did not get a chance to execute their action, delete it
if (_action != NULL) {
@@ -90,8 +92,6 @@ BattleActor::~BattleActor() {
delete _indicator_supervisor;
}
-
-
void BattleActor::ResetActor() {
_effects_supervisor->RemoveAllStatus();
@@ -110,8 +110,6 @@ void BattleActor::ResetActor() {
ChangeState(ACTOR_STATE_DEAD);
}
-
-
void BattleActor::ChangeState(ACTOR_STATE new_state) {
if (_state == new_state) {
IF_PRINT_WARNING(BATTLE_DEBUG) << "actor was already in new state: " << new_state << std::endl;
@@ -175,14 +173,10 @@ void BattleActor::ChangeState(ACTOR_STATE new_state) {
}
}
-
-
void BattleActor::RegisterDamage(uint32 amount) {
RegisterDamage(amount, NULL);
}
-
-
void BattleActor::RegisterDamage(uint32 amount, BattleTarget* target) {
if (amount == 0) {
IF_PRINT_WARNING(BATTLE_DEBUG) << "function called with a zero value argument" << std::endl;
@@ -250,8 +244,6 @@ void BattleActor::RegisterDamage(uint32 amount, BattleTarget* target) {
}
}
-
-
void BattleActor::RegisterHealing(uint32 amount, bool hit_points) {
if (amount == 0) {
IF_PRINT_WARNING(BATTLE_DEBUG) << "function called with a zero value argument" << std::endl;
@@ -271,7 +263,6 @@ void BattleActor::RegisterHealing(uint32 amount, bool hit_points) {
_indicator_supervisor->AddHealingIndicator(amount, hit_points);
}
-
void BattleActor::RegisterRevive(uint32 amount) {
if (amount == 0) {
IF_PRINT_WARNING(BATTLE_DEBUG) << "function called with a zero value argument" << std::endl;
@@ -293,16 +284,13 @@ void BattleActor::RegisterRevive(uint32 amount) {
ChangeState(ACTOR_STATE_REVIVE);
}
-
void BattleActor::RegisterMiss(bool was_attacked) {
_indicator_supervisor->AddMissIndicator();
if (was_attacked && !IsEnemy())
ChangeSpriteAnimation("dodge");
}
-
-
void BattleActor::RegisterStatusChange(GLOBAL_STATUS status, GLOBAL_INTENSITY intensity) {
GLOBAL_STATUS old_status = GLOBAL_STATUS_INVALID;
GLOBAL_STATUS new_status = GLOBAL_STATUS_INVALID;
@@ -317,16 +305,15 @@ void BattleActor::RegisterStatusChange(GLOBAL_STATUS status, GLOBAL_INTENSITY in
}
}
-
void BattleActor::Update() {
// Don't update the state timer when the battle tells is to pause
// when in idle state.
if (!BattleMode::CurrentInstance()->AreActorStatesPaused())
_state_timer.Update();
- // Ths shaking updates even in pause mode, so that the shaking
- // doesn't last indefinitely in that state.
- _shake_timer.Update();
+ // Ths shaking updates even in pause mode, so that the shaking
+ // doesn't last indefinitely in that state.
+ _shake_timer.Update();
_UpdateStaminaIconPosition();
@@ -356,7 +343,6 @@ void BattleActor::Update() {
}
}
-
void BattleActor::_UpdateStaminaIconPosition() {
float x_pos = _x_stamina_location;
float y_pos = _y_stamina_location;
@@ -407,23 +393,10 @@ void BattleActor::_UpdateStaminaIconPosition() {
_y_stamina_location = y_pos;
}
-
-void BattleActor::DrawSprite() {
- // Draw potential sprite ammo
- if (_ammo_image && _show_ammo) {
- VideoManager->Move(_ammo_x, _ammo_y);
- _ammo_image->Draw();
- }
-
- VideoManager->Move(_x_location, _y_location);
-}
-
-
void BattleActor::DrawIndicators() const {
_indicator_supervisor->Draw();
}
-
void BattleActor::DrawStaminaIcon(const hoa_video::Color& color) const {
if (!IsAlive())
return;
@@ -437,7 +410,6 @@ void BattleActor::DrawStaminaIcon(const hoa_video::Color& color) const {
_stamina_icon.Draw(color);
}
-
void BattleActor::SetAction(BattleAction* action) {
if (action == NULL) {
IF_PRINT_WARNING(BATTLE_DEBUG) << "function received NULL argument" << std::endl;
@@ -454,8 +426,6 @@ void BattleActor::SetAction(BattleAction* action) {
_action = action;
}
-
-
uint32 BattleActor::TotalPhysicalDefense() {
uint32 phys_defense = 0;
@@ -466,8 +436,6 @@ uint32 BattleActor::TotalPhysicalDefense() {
return phys_defense;
}
-
-
uint32 BattleActor::TotalMetaphysicalDefense() {
uint32 meta_defense = 0;
@@ -478,8 +446,6 @@ uint32 BattleActor::TotalMetaphysicalDefense() {
return meta_defense;
}
-
-
float BattleActor::TotalEvadeRating() {
float evade = 0.0f;
@@ -517,13 +483,10 @@ BattleCharacter::BattleCharacter(GlobalCharacter* character) :
_target_selection_text.SetText("");
}
-
void BattleCharacter::ResetActor() {
BattleActor::ResetActor();
}
-
-
void BattleCharacter::ChangeState(ACTOR_STATE new_state) {
BattleActor::ChangeState(new_state);
@@ -578,8 +541,6 @@ void BattleCharacter::ChangeState(ACTOR_STATE new_state) {
ChangeActionText();
}
-
-
void BattleCharacter::Update() {
BattleActor::Update();
@@ -660,8 +621,7 @@ void BattleCharacter::Update() {
}
void BattleCharacter::DrawSprite() {
- BattleActor::DrawSprite();
-
+ VideoManager->Move(_x_location, _y_location);
_global_character->RetrieveBattleAnimation(_sprite_animation_alias)->Draw();
} // void BattleCharacter::DrawSprite()
@@ -675,8 +635,6 @@ void BattleCharacter::ChangeSpriteAnimation(const std::string& alias) {
_animation_timer.Run();
}
-
-
void BattleCharacter::ChangeActionText() {
// If the character has no action selected to be used, clear both action and target text
if (_action == NULL) {
@@ -696,8 +654,6 @@ void BattleCharacter::ChangeActionText() {
}
}
-
-
void BattleCharacter::DrawPortrait() {
VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_BOTTOM, VIDEO_BLEND, 0);
VideoManager->Move(48.0f, 9.0f);
@@ -733,8 +689,6 @@ void BattleCharacter::DrawPortrait() {
}
}
-
-
void BattleCharacter::DrawStatus(uint32 order) {
// Used to determine where to draw the character's status
float y_offset = 0.0f;
@@ -953,10 +907,8 @@ void BattleEnemy::Update() {
}
}
-
-
void BattleEnemy::DrawSprite() {
- BattleActor::DrawSprite();
+ VideoManager->Move(_x_location, _y_location);
std::vector<StillImage>& sprite_frames = *(_global_enemy->GetBattleSpriteFrames());
@@ -990,8 +942,6 @@ void BattleEnemy::DrawSprite() {
}
} // void BattleEnemy::DrawSprite()
-
-
void BattleEnemy::_DecideAction() {
if (_global_enemy->GetSkills().empty() == true) {
IF_PRINT_WARNING(BATTLE_DEBUG) << "enemy had no usable skills" << std::endl;
View
201 src/modes/battle/battle_actors.h
@@ -34,6 +34,103 @@ namespace hoa_battle {
namespace private_battle {
+ /** ****************************************************************************
+*** \brief An abstract class for representing an object in the battle
+*** Used to properly draw objects based on their Y coordinate.
+**/
+class BattleObject {
+public:
+ BattleObject():
+ _x_origin(0.0f),
+ _y_origin(0.0f),
+ _x_location(0.0f),
+ _y_location(0.0f)
+ {}
+
+ float GetXOrigin() const
+ { return _x_origin; }
+
+ float GetYOrigin() const
+ { return _y_origin; }
+
+ float GetXLocation() const
+ { return _x_location; }
+
+ float GetYLocation() const
+ { return _y_location; }
+
+ void SetXOrigin(float x_origin)
+ { _x_origin = x_origin; }
+
+ void SetYOrigin(float y_origin)
+ { _y_origin = y_origin; }
+
+ void SetXLocation(float x_location)
+ { _x_location = x_location; }
+
+ void SetYLocation(float y_location)
+ { _y_location = y_location; }
+
+ virtual void DrawSprite()
+ {};
+
+protected:
+ //! \brief The "home" coordinates for the actor's default location on the battle field
+ float _x_origin, _y_origin;
+
+ //! \brief The x and y coordinates of the actor's current location on the battle field
+ float _x_location, _y_location;
+};
+
+//! \brief The battle ammo class is made to represent an ammo image on the battle ground.
+class BattleAmmo : public BattleObject {
+public:
+ BattleAmmo():
+ BattleObject(),
+ _flying_height(0),
+ _shown(false)
+ {}
+
+ BattleAmmo(const std::string& animation_filename, uint32 flying_height):
+ BattleObject(),
+ _flying_height(flying_height),
+ _shown(false)
+ { LoadAmmoAnimatedImage(animation_filename); }
+
+ //! Draw the ammo on screen if it was set to be shown.
+ void DrawSprite();
+
+ void LoadAmmoAnimatedImage(const std::string& filename)
+ { _ammo_image.Clear(); _ammo_image.LoadFromAnimationScript(filename); }
+
+ const hoa_video::AnimatedImage& GetAmmoImage() const
+ { return _ammo_image; }
+
+ void SetFlyingHeight(uint32 height)
+ { _flying_height = height; }
+
+ uint32 GetFlyingHeight() const
+ { return _flying_height; }
+
+ void SetShowAmmo(bool show)
+ { _shown = show; }
+
+ bool IsAmmoShown() const
+ { return _shown; }
+
+protected:
+ //! The actual ammo graphics used when firing
+ hoa_video::AnimatedImage _ammo_image;
+ // TODO: Later add a shadow to the ammo, to show its height
+ //hoa_video::AnimatedImage _ammo_shadow_image;
+
+ //! The height of the ammo compared to the ground (at which height the ammo flies).
+ uint32 _flying_height;
+
+ //! Tells whether the ammo should be drawn on screen.
+ bool _shown;
+};
+
/** ****************************************************************************
*** \brief An abstract class for representing an actor in the battle
***
@@ -67,7 +164,7 @@ namespace private_battle {
*** use an item, or perform some sort of skill. Each actor is responsible for the
*** management of the action that they intend to take.
*** ***************************************************************************/
-class BattleActor : public hoa_global::GlobalActor {
+class BattleActor : public hoa_global::GlobalActor, public BattleObject {
public:
BattleActor(hoa_global::GlobalActor* actor);
@@ -78,15 +175,15 @@ class BattleActor : public hoa_global::GlobalActor {
//! \brief Returns true as long as the actor is not in the "dead" state
bool IsAlive() const
- { return (_state != ACTOR_STATE_DEAD); }
+ { return (_state != ACTOR_STATE_DEAD); }
//! \brief Returns true if the actor can still fight.
bool IsValid() const
- { return (_state != ACTOR_STATE_DYING && IsAlive()); }
+ { return (_state != ACTOR_STATE_DYING && IsAlive()); }
//! \brief Empty method. Required because this is a pure virtual method of GlobalActor
void AddSkill(uint32 /*skill_id*/)
- {}
+ {}
/** \brief Restores an actor to the initial state it was in when the battle began
***
@@ -118,7 +215,7 @@ class BattleActor : public hoa_global::GlobalActor {
*** and there is an issue with using Luabind on pure virtual functions.
**/
virtual void ChangeSpriteAnimation(const std::string& /*alias*/)
- {}
+ {}
/** \brief Deals damage to the actor by reducing its hit points by a certain amount
*** \param amount The number of hit points to decrease on the actor
@@ -213,9 +310,6 @@ class BattleActor : public hoa_global::GlobalActor {
**/
virtual void Update();
- //! \brief Draws the actor's current sprite animation frame
- virtual void DrawSprite();
-
//! \brief Draws all active indicator text and graphics for the actor
void DrawIndicators() const;
@@ -236,34 +330,34 @@ class BattleActor : public hoa_global::GlobalActor {
//! \brief Resets actor stats to their original values
//@{
void ResetHitPoints()
- { SetHitPoints(_global_actor->GetHitPoints()); }
+ { SetHitPoints(_global_actor->GetHitPoints()); }
void ResetMaxHitPoints()
- { SetMaxHitPoints(_global_actor->GetMaxHitPoints()); }
+ { SetMaxHitPoints(_global_actor->GetMaxHitPoints()); }
void ResetSkillPoints()
- { SetSkillPoints(_global_actor->GetSkillPoints()); }
+ { SetSkillPoints(_global_actor->GetSkillPoints()); }
void ResetMaxSkillPoints()
- { SetMaxSkillPoints(_global_actor->GetMaxSkillPoints()); }
+ { SetMaxSkillPoints(_global_actor->GetMaxSkillPoints()); }
void ResetStrength()
- { SetStrength(_global_actor->GetStrength()); }
+ { SetStrength(_global_actor->GetStrength()); }
void ResetVigor()
- { SetVigor(_global_actor->GetVigor()); }
+ { SetVigor(_global_actor->GetVigor()); }
void ResetFortitude()
- { SetFortitude(_global_actor->GetFortitude()); }
+ { SetFortitude(_global_actor->GetFortitude()); }
void ResetProtection()
- { SetProtection(_global_actor->GetProtection()); }
+ { SetProtection(_global_actor->GetProtection()); }
void ResetAgility()
- { SetAgility(_global_actor->GetAgility()); }
+ { SetAgility(_global_actor->GetAgility()); }
void ResetEvade()
- { SetEvade(_global_actor->GetEvade()); }
+ { SetEvade(_global_actor->GetEvade()); }
//@}
//! \brief Returns the average defense/evasion totals of all of the actor's attack points
@@ -284,29 +378,20 @@ class BattleActor : public hoa_global::GlobalActor {
{ return _global_actor; }
void SetShowAmmo(bool show)
- { _show_ammo = show; }
+ { _ammo.SetShowAmmo(show); }
void SetAmmoPosition(float x, float y)
- { _ammo_x = x; _ammo_y = y; }
+ { _ammo.SetXLocation(x); _ammo.SetYLocation(y); }
+
+ BattleAmmo& GetAmmo()
+ { return _ammo; }
BattleAction* GetAction()
{ return _action; }
bool IsActionSet() const
{ return (_action != NULL); }
- float GetXOrigin() const
- { return _x_origin; }
-
- float GetYOrigin() const
- { return _y_origin; }
-
- float GetXLocation() const
- { return _x_location; }
-
- float GetYLocation() const
- { return _y_location; }
-
uint32 GetIdleStateTime() const
{ return _idle_state_time; }
@@ -316,18 +401,6 @@ class BattleActor : public hoa_global::GlobalActor {
BattleTimer& GetStateTimer()
{ return _state_timer; }
- void SetXOrigin(float x_origin)
- { _x_origin = x_origin; }
-
- void SetYOrigin(float y_origin)
- { _y_origin = y_origin; }
-
- void SetXLocation(float x_location)
- { _x_location = x_location; }
-
- void SetYLocation(float y_location)
- { _y_location = y_location; }
-
//! \note If the actor is in the idle state, this will not affect the state timer
void SetIdleStateTime(uint32 time)
{ _idle_state_time = time; }
@@ -340,25 +413,12 @@ class BattleActor : public hoa_global::GlobalActor {
//! \brief A pointer to the global actor object which the battle actor represents
hoa_global::GlobalActor* _global_actor;
- //! \brief The ammo image pointer. Do not delete it, it is handled by the GlobalActor
- hoa_video::AnimatedImage *_ammo_image;
-
- //! \brief Used to make the engine aware about whether the ammo image should be shown or not.
- bool _show_ammo;
-
- //! \brief the ammo image screen position used when showing it.
- float _ammo_x;
- float _ammo_y;
+ //! \brief The ammo object. Use when the actor weapon uses ammo.
+ BattleAmmo _ammo;
//! \brief A pointer to the action that the actor is preparing to perform or is currently performing
BattleAction* _action;
- //! \brief The "home" coordinates for the actor's default location on the battle field
- float _x_origin, _y_origin;
-
- //! \brief The x and y coordinates of the actor's current location on the battle field
- float _x_location, _y_location;
-
//! \brief Set to true when the actor is in the ACTING state and the execution of the action is complete
bool _execution_finished;
@@ -407,17 +467,17 @@ class BattleCharacter : public BattleActor {
{}
bool IsEnemy() const
- { return false; }
+ { return false; }
void ResetActor();
void ChangeState(ACTOR_STATE new_state);
float GetSpriteWidth() const
- { return _global_character->RetrieveBattleAnimation(_sprite_animation_alias)->GetWidth(); }
+ { return _global_character->RetrieveBattleAnimation(_sprite_animation_alias)->GetWidth(); }
float GetSpriteHeight() const
- { return _global_character->RetrieveBattleAnimation(_sprite_animation_alias)->GetHeight(); }
+ { return _global_character->RetrieveBattleAnimation(_sprite_animation_alias)->GetHeight(); }
/** \brief Changes the battle character's current sprite animation image
*** \param alias The alias text used to identify the animation to change
@@ -435,7 +495,7 @@ class BattleCharacter : public BattleActor {
//! \brief Returns true if the player may select a command for the character to execute
bool CanSelectCommand() const
- { return (_state == ACTOR_STATE_IDLE) || (_state == ACTOR_STATE_COMMAND); }
+ { return (_state == ACTOR_STATE_IDLE) || (_state == ACTOR_STATE_COMMAND); }
//! \brief Updates the state of the character. Must be called every frame loop.
void Update();
@@ -452,10 +512,10 @@ class BattleCharacter : public BattleActor {
void DrawStatus(uint32 order);
hoa_global::GlobalCharacter* GetGlobalCharacter()
- { return _global_character; }
+ { return _global_character; }
const std::string& GetSpriteAnimationAlias() const
- { return _sprite_animation_alias; }
+ { return _sprite_animation_alias; }
protected:
//! \brief A pointer to the global character object which the battle character represents
@@ -496,17 +556,17 @@ class BattleEnemy : public BattleActor {
~BattleEnemy();
bool IsEnemy() const
- { return true; }
+ { return true; }
void ResetActor();
void ChangeState(ACTOR_STATE new_state);
float GetSpriteWidth() const
- { return _global_enemy->GetBattleSpriteFrames()->at(0).GetWidth(); }
+ { return _global_enemy->GetBattleSpriteFrames()->at(0).GetWidth(); }
float GetSpriteHeight() const
- { return _global_enemy->GetBattleSpriteFrames()->at(0).GetHeight(); }
+ { return _global_enemy->GetBattleSpriteFrames()->at(0).GetHeight(); }
/** \brief Changes the battle enemy's current sprite animation image
*** \param alias The alias text used to identify the animation to change
@@ -528,10 +588,7 @@ class BattleEnemy : public BattleActor {
void DrawSprite();
hoa_global::GlobalEnemy* GetGlobalEnemy()
- { return _global_enemy; }
-
- //! \brief Compares the Y-coordinates of the actors, used for sorting the actors up-down when drawing
- bool operator<(const BattleEnemy & other) const;
+ { return _global_enemy; }
protected:
//! \brief A pointer to the global enemy object which the battle enemy represents

0 comments on commit a44e298

Please sign in to comment.