From 35fd91c97a2fe674b958da7101f369fd54edd9ea Mon Sep 17 00:00:00 2001
From: Rtch90 <ritchie.cunningham@protonmail.com>
Date: Sat, 18 Feb 2012 19:29:45 +0000
Subject: [PATCH] [Change] Character::Move was named incorrectly, This is now
 defined as Character::HealthBarScroll

---
 src/Unuk/Player.cpp              |   2 +-
 src/libUnuk/Engine/Character.cpp | 156 +++++++++++++++----------------
 src/libUnuk/Engine/Character.h   |   2 +-
 src/libUnuk/Engine/NPC.cpp       |  92 +++++++++---------
 4 files changed, 126 insertions(+), 126 deletions(-)

diff --git a/src/Unuk/Player.cpp b/src/Unuk/Player.cpp
index 3098abf..20b96e2 100644
--- a/src/Unuk/Player.cpp
+++ b/src/Unuk/Player.cpp
@@ -123,7 +123,7 @@ void Player::SetCamera(void) {
 
 void Player::Move() {
   map->MoveIfPossible(this, xVel, yVel, true);
-	Character::Move();
+	Character::HealthBarScroll();
 }
 
 void Player::SetLevel(int level) {
diff --git a/src/libUnuk/Engine/Character.cpp b/src/libUnuk/Engine/Character.cpp
index 112348e..d74d539 100644
--- a/src/libUnuk/Engine/Character.cpp
+++ b/src/libUnuk/Engine/Character.cpp
@@ -7,108 +7,108 @@ static list<Character*>collisionList;
 static list<Character*>::iterator collisionIter;
 
 Character::Character(LevelGen* mapArg) {
-  map = mapArg;
-  attacking = false;
-  directionFacing = FACING_DOWN;
-  _animationStage  = ANIM_NO_FOOT;
-  _animationTimer.Start();
-  _leftFoot = false;
-  _health = 100;
+	map = mapArg;
+	attacking = false;
+	directionFacing = FACING_DOWN;
+	_animationStage  = ANIM_NO_FOOT;
+	_animationTimer.Start();
+	_leftFoot = false;
+	_health = 100;
 
-  xVel = 0.0f;
-  yVel = 0.0f;
-  
-  _texture = NULL;
-  
-  collisionList.push_front(this);
+	xVel = 0.0f;
+	yVel = 0.0f;
 
-  _healthBar.SetBackgroundRGB(0, 0, 0);
-  _healthBar.SetForegroundRGB(255, 0, 0);
+	_texture = NULL;
 
-  _showHealthBar = false;
+	collisionList.push_front(this);
+
+	_healthBar.SetBackgroundRGB(0, 0, 0);
+	_healthBar.SetForegroundRGB(255, 0, 0);
+
+	_showHealthBar = false;
 }
 
 Character::~Character(void) {
-  SDL_FreeSurface(_texture);
-  for(collisionIter = collisionList.begin(); collisionIter != collisionList.end(); collisionIter++) {
-    if((*collisionIter) == this) {
-      collisionList.erase(collisionIter);
-      break;
-    }
-  }
+	SDL_FreeSurface(_texture);
+	for(collisionIter = collisionList.begin(); collisionIter != collisionList.end(); collisionIter++) {
+		if((*collisionIter) == this) {
+			collisionList.erase(collisionIter);
+			break;
+		}
+	}
 }
 
 void Character::LoadSprites(string filename, int wArg, int hArg) {
-  if(_texture != NULL)
-    SDL_FreeSurface(_texture);
+	if(_texture != NULL)
+		SDL_FreeSurface(_texture);
 
-  _texture = LoadImageAlpha(filename.c_str());
+	_texture = LoadImageAlpha(filename.c_str());
 
-  w = (float)wArg;
-  h = (float)hArg;
+	w = (float)wArg;
+	h = (float)hArg;
 
-  for(int m_direction = 0; m_direction < 4; m_direction++) {
-    for(int m_action = 0; m_action < 4; m_action++) {
-      _sprites[m_direction][m_action].x = (Sint16)(w * m_action);
-      _sprites[m_direction][m_action].y = (Sint16)(h * m_direction);
-      _sprites[m_direction][m_action].w = (Sint16)w;
-      _sprites[m_direction][m_action].h = (Sint16)h;
-    }
-  }
+	for(int m_direction = 0; m_direction < 4; m_direction++) {
+		for(int m_action = 0; m_action < 4; m_action++) {
+			_sprites[m_direction][m_action].x = (Sint16)(w * m_action);
+			_sprites[m_direction][m_action].y = (Sint16)(h * m_direction);
+			_sprites[m_direction][m_action].w = (Sint16)w;
+			_sprites[m_direction][m_action].h = (Sint16)h;
+		}
+	}
 
-  _healthBar.SetWidthHeight((int)w, 10);
+	_healthBar.SetWidthHeight((int)w, 10);
 }
 
 void Character::Render(void) {
-  if(attacking && attackTimer.GetTicks() < ATTACKING_DISPLAY_LEN) {
-    ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][ANIM_ATTACK]);
-    return;
-  }
-  else if(attacking)
-    attacking = false;
-  
-  if(xVel == 0.0f && yVel == 0.0f)
-    ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][ANIM_NO_FOOT]);
-  else {
-    if(_animationTimer.GetTicks() > ANIMATION_SPEED) {
-      if(_animationStage == ANIM_NO_FOOT) {
-        if(_leftFoot == true)
-          _animationStage = ANIM_RIGHT_FOOT;
-        else
-          _animationStage = ANIM_LEFT_FOOT;
-      }
-      else if(_animationStage == ANIM_LEFT_FOOT) {
-        _animationStage = ANIM_NO_FOOT;
-        _leftFoot = true;
-      }
-      else if(_animationStage == ANIM_RIGHT_FOOT) {
-        _animationStage = ANIM_NO_FOOT;
-        _leftFoot = false;
-      }
-      _animationTimer.Start();
-    }
-    ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][_animationStage]);
-  }
+	if(attacking && attackTimer.GetTicks() < ATTACKING_DISPLAY_LEN) {
+		ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][ANIM_ATTACK]);
+		return;
+	}
+	else if(attacking)
+		attacking = false;
 
-  if(_showHealthBar && (_healthBarDuration.GetTicks() >= 5000)) {
-    _healthBarDuration.Stop();
-    _showHealthBar = false;
-  }
+	if(xVel == 0.0f && yVel == 0.0f)
+		ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][ANIM_NO_FOOT]);
+	else {
+		if(_animationTimer.GetTicks() > ANIMATION_SPEED) {
+			if(_animationStage == ANIM_NO_FOOT) {
+				if(_leftFoot == true)
+					_animationStage = ANIM_RIGHT_FOOT;
+				else
+					_animationStage = ANIM_LEFT_FOOT;
+			}
+			else if(_animationStage == ANIM_LEFT_FOOT) {
+				_animationStage = ANIM_NO_FOOT;
+				_leftFoot = true;
+			}
+			else if(_animationStage == ANIM_RIGHT_FOOT) {
+				_animationStage = ANIM_NO_FOOT;
+				_leftFoot = false;
+			}
+			_animationTimer.Start();
+		}
+		ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][_animationStage]);
+	}
 
-  if(_showHealthBar) {
-    _healthBar.Draw();
-  }
+	if(_showHealthBar && (_healthBarDuration.GetTicks() >= 5000)) {
+		_healthBarDuration.Stop();
+		_showHealthBar = false;
+	}
+
+	if(_showHealthBar) {
+		_healthBar.Draw();
+	}
 }
 
 void Character::Update(void) {
-  _healthBar.SetProgress((float)_health / 100.0f);
+	_healthBar.SetProgress((float)_health / 100.0f);
 }
 
 void Character::OnAttack(void) {
-  _healthBarDuration.Start();
-  _showHealthBar = true;
+	_healthBarDuration.Start();
+	_showHealthBar = true;
 }
 
-void Character::Move(void) {
-  _healthBar.SetXY((int)x, (int)(y - _healthBar.GetHeight() - 5));
+void Character::HealthBarScroll(void) {
+	_healthBar.SetXY((int)x, (int)(y - _healthBar.GetHeight() - 5));
 }
diff --git a/src/libUnuk/Engine/Character.h b/src/libUnuk/Engine/Character.h
index bc46387..587ca38 100644
--- a/src/libUnuk/Engine/Character.h
+++ b/src/libUnuk/Engine/Character.h
@@ -69,7 +69,7 @@ public:
   };
 
 protected:
-	void Move(void);
+	void HealthBarScroll(void);
 
 	float x;
 	float y;
diff --git a/src/libUnuk/Engine/NPC.cpp b/src/libUnuk/Engine/NPC.cpp
index 2be24de..cab1e5d 100644
--- a/src/libUnuk/Engine/NPC.cpp
+++ b/src/libUnuk/Engine/NPC.cpp
@@ -1,11 +1,11 @@
 #include "NPC.h"
 
 NPC::NPC(LevelGen* mapArg) : Character(mapArg) {
-  _moveTimer.Start();
-  
-  _moveChangeFrequency = 14000;
-  _moveDurationMax	= 3000;
-  _moveDurationMin	= 1000;
+	_moveTimer.Start();
+
+	_moveChangeFrequency = 14000;
+	_moveDurationMax	= 3000;
+	_moveDurationMin	= 1000;
 }
 
 NPC::~NPC(void) {
@@ -13,51 +13,51 @@ NPC::~NPC(void) {
 }
 
 void NPC::Update(void) {
-  // Store the NPC's health.
-  // int health = GetHealth(); // not referenced
+	// Store the NPC's health.
+	// int health = GetHealth(); // not referenced
 
-  Move();
+	Move();
 
-  if(xVel > 0) directionFacing          = FACING_RIGHT;
-  else if(xVel < 0) directionFacing     = FACING_LEFT;
-  else if(yVel > 0) directionFacing     = FACING_DOWN;
-  else if(yVel < 0) directionFacing     = FACING_UP;
+	if(xVel > 0) directionFacing          = FACING_RIGHT;
+	else if(xVel < 0) directionFacing     = FACING_LEFT;
+	else if(yVel > 0) directionFacing     = FACING_DOWN;
+	else if(yVel < 0) directionFacing     = FACING_UP;
 
-  _healthBar.SetProgress((float)GetHealth() / 100.0f);
+	_healthBar.SetProgress((float)GetHealth() / 100.0f);
 }
 
 void NPC::Move(void) {
-  if(_moving && _moveTimer.GetTicks() > _moveDurationMax) {
-    xVel = 0.0f;
-    yVel = 0.0f;
-    _moving = false;
-  }
-  
-  if(_moving && _moveTimer.GetTicks() >= _moveDurationCurrent) {
-    xVel = 0.0f;
-    yVel = 0.0f;
-    _moving = false;
-  }
-  
-  if(_moveTimer.GetTicks() > _moveChangeFrequency) {
-    _moveTimer.Start();
-    _moveDurationCurrent = _moveDurationMin + (rand() % (_moveDurationMax - _moveDurationMin));
-    if(rand() % 2) {
-      yVel = 0.0f;
-      if(rand() % 2)
-        xVel = CHARACTER_SPEED;
-      else
-        xVel = -CHARACTER_SPEED;
-    } else {
-      xVel = 0.0f;
-      if(rand() % 2)
-        yVel = CHARACTER_SPEED;
-      else
-        yVel = -CHARACTER_SPEED;
-    }
-    _moving = true;
-  }
-  
-  map->MoveIfPossible(this, xVel, yVel, false);
-  Character::Move();
+	if(_moving && _moveTimer.GetTicks() > _moveDurationMax) {
+		xVel = 0.0f;
+		yVel = 0.0f;
+		_moving = false;
+	}
+
+	if(_moving && _moveTimer.GetTicks() >= _moveDurationCurrent) {
+		xVel = 0.0f;
+		yVel = 0.0f;
+		_moving = false;
+	}
+
+	if(_moveTimer.GetTicks() > _moveChangeFrequency) {
+		_moveTimer.Start();
+		_moveDurationCurrent = _moveDurationMin + (rand() % (_moveDurationMax - _moveDurationMin));
+		if(rand() % 2) {
+			yVel = 0.0f;
+			if(rand() % 2)
+				xVel = CHARACTER_SPEED;
+			else
+				xVel = -CHARACTER_SPEED;
+		} else {
+			xVel = 0.0f;
+			if(rand() % 2)
+				yVel = CHARACTER_SPEED;
+			else
+				yVel = -CHARACTER_SPEED;
+		}
+		_moving = true;
+	}
+
+	map->MoveIfPossible(this, xVel, yVel, false);
+	Character::HealthBarScroll();
 }