Commit c862a03a authored by Gerhard Stein's avatar Gerhard Stein

Cleanups and adaptations to some sprites. Also Action format is used much more

parent eb1f0354
......@@ -36,11 +36,7 @@
enum direction_t{
NONE,
RIGHT,
RIGHTUP,
RIGHTDOWN,
LEFT,
LEFTUP,
LEFTDOWN,
UP,
DOWN
};
......
......@@ -69,38 +69,32 @@ void CPlayerWM::processWalking()
{
moveLeft(movespeed);
walking = true;
m_looking_dir = LEFT;
m_hDir = LEFT;
}
else if(g_pInput->getHoldedCommand(IC_RIGHT))
{
moveRight(movespeed);
walking = true;
m_looking_dir = RIGHT;
m_hDir = RIGHT;
}
if(g_pInput->getHoldedCommand(IC_UP))
{
if(!walking)
m_hDir = NONE;
moveUp(movespeed);
walking = true;
if(m_looking_dir == LEFT)
m_looking_dir = LEFTUP;
else if(m_looking_dir == RIGHT)
m_looking_dir = RIGHTUP;
else
m_looking_dir = UP;
m_vDir = UP;
}
else if(g_pInput->getHoldedCommand(IC_DOWN))
{
if(!walking)
m_hDir = NONE;
moveDown(movespeed);
walking = true;
if(m_looking_dir == LEFT)
m_looking_dir = LEFTDOWN;
else if(m_looking_dir == RIGHT)
m_looking_dir = RIGHTDOWN;
else
m_looking_dir = DOWN;
m_vDir = DOWN;
}
if(g_pInput->getHoldedCommand(IC_STATUS))
......@@ -213,22 +207,22 @@ void CPlayerWM::checkforSwimming()
*/
void CPlayerWM::performWalkingAnimation(bool walking)
{
if(m_looking_dir == LEFT)
sprite = m_basesprite;
else if(m_looking_dir == RIGHT)
if(m_hDir == RIGHT && m_vDir == NONE)
sprite = m_basesprite + 3;
else if(m_looking_dir == UP)
else if(m_hDir == NONE && m_vDir == UP)
sprite = m_basesprite + 6;
else if(m_looking_dir == DOWN)
else if(m_hDir == NONE && m_vDir == DOWN)
sprite = m_basesprite + 9;
else if(m_looking_dir == RIGHTDOWN)
else if(m_hDir == RIGHT && m_vDir == DOWN)
sprite = m_basesprite + 12;
else if(m_looking_dir == LEFTDOWN)
else if(m_hDir == LEFT && m_vDir == DOWN)
sprite = m_basesprite + 15;
else if(m_looking_dir == LEFTUP)
else if(m_hDir == LEFT && m_vDir == UP)
sprite = m_basesprite + 18;
else if(m_looking_dir == RIGHTUP)
else if(m_hDir == RIGHT && m_vDir == UP)
sprite = m_basesprite + 21;
else
sprite = m_basesprite;
if(walking)
{
......@@ -241,22 +235,22 @@ void CPlayerWM::performWalkingAnimation(bool walking)
void CPlayerWM::performSwimmingAnimation()
{
if(m_looking_dir == UP)
sprite = m_basesprite;
else if(m_looking_dir == RIGHT)
if(m_hDir == RIGHT && m_vDir == NONE)
sprite = m_basesprite + 2;
else if(m_looking_dir == DOWN)
else if(m_hDir == NONE && m_vDir == DOWN)
sprite = m_basesprite + 4;
else if(m_looking_dir == LEFT)
else if(m_hDir == LEFT && m_vDir == NONE)
sprite = m_basesprite + 6;
else if(m_looking_dir == RIGHTUP)
else if(m_hDir == RIGHT && m_vDir == UP)
sprite = m_basesprite + 8;
else if(m_looking_dir == RIGHTDOWN)
else if(m_hDir == RIGHT && m_vDir == DOWN)
sprite = m_basesprite + 10;
else if(m_looking_dir == LEFTDOWN)
else if(m_hDir == LEFT && m_vDir == DOWN)
sprite = m_basesprite + 12;
else if(m_looking_dir == LEFTUP)
else if(m_hDir == LEFT && m_vDir == UP)
sprite = m_basesprite + 14;
else
sprite = m_basesprite;
m_animation_time = 5;
sprite += m_animation%2;
......
......@@ -23,7 +23,7 @@ CMessie::CMessie(CMap *p_map, Uint32 x, Uint32 y,
CObject(p_map, x, y, OBJ_MESSIE),
m_Player(Player)
{
m_hDir = LEFTDOWN;
m_hDir = LEFT, m_vDir = DOWN;
onscreen = true;
solid = false;
......@@ -109,13 +109,13 @@ void CMessie::process()
bool godown = (desty > getYPosition());
if(goleft && !godown)
m_hDir = LEFTUP;
m_hDir = LEFT, m_vDir = UP;
else if(goleft && godown)
m_hDir = LEFTDOWN;
m_hDir = LEFT, m_vDir = DOWN;
else if(!goleft && !godown)
m_hDir = RIGHTUP;
m_hDir = RIGHT, m_vDir = UP;
else if(!goleft && godown)
m_hDir = RIGHTDOWN;
m_hDir = RIGHT, m_vDir = DOWN;
}
}
move_nessie();
......@@ -137,13 +137,13 @@ void CMessie::process()
void CMessie::move_nessie()
{
// select proper frame based on up/down and left/right direction flags
if (m_hDir == LEFTDOWN)
if (m_hDir == LEFT && m_vDir == DOWN)
baseframe = NESSIE_DOWNLEFT_FRAME;
else if (m_hDir == RIGHTDOWN)
else if (m_hDir == RIGHT && m_vDir == DOWN)
baseframe = NESSIE_DOWNRIGHT_FRAME;
else if (m_hDir == LEFTUP)
else if (m_hDir == LEFT && m_vDir == UP)
baseframe = NESSIE_UPLEFT_FRAME;
else if (m_hDir == RIGHTUP)
else if (m_hDir == RIGHT && m_vDir == UP)
baseframe = NESSIE_UPRIGHT_FRAME;
// head to destination
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment