[wpdev-commits] wolfpack/ai ai.cpp,1.32,1.33
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-09-30 15:37:21
|
Update of /cvsroot/wpdev/wolfpack/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22469/ai Modified Files: ai.cpp Log Message: npc movement fixes Index: ai.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ai/ai.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ai.cpp 25 Sep 2004 22:57:09 -0000 1.32 --- ai.cpp 30 Sep 2004 15:37:12 -0000 1.33 *************** *** 533,536 **** --- 533,540 ---- } + if (m_npc->direction() != dir) { + Movement::instance()->Walking( m_npc, dir, 0xFF ); + } + // Walk in the same direction or if the direction has changed simply turn around. // If there's a obstacle, change the direction slightly to see if we can get *************** *** 590,593 **** --- 594,602 ---- Q_UINT8 dir = m_npc->pos().direction( pos ); + + if (m_npc->direction() != dir) { + Movement::instance()->Walking( m_npc, dir, 0xFF ); + } + Movement::instance()->Walking( m_npc, dir, 0xFF ); break; *************** *** 636,639 **** --- 645,649 ---- Q_UINT8 dir = m_npc->pos().direction( pos ); Coord_cl newPos = Movement::instance()->calcCoordFromDir( dir, m_npc->pos() ); + if ( !mayWalk( m_npc, newPos ) ) { *************** *** 660,663 **** --- 670,679 ---- } } + + // If we're not facing the direction we're trying to walk to, + // call Movement once more. + if (m_npc->direction() != dir) { + Movement::instance()->Walking( m_npc, dir, 0xFF ); + } return Movement::instance()->Walking( m_npc, dir, 0xFF ); *************** *** 694,697 **** --- 710,719 ---- Coord_cl nextmove = m_npc->nextMove(); Q_UINT8 dir = m_npc->pos().direction( nextmove ); + + // Make sure we face the direction... + if (m_npc->direction() != dir) { + Movement::instance()->Walking( m_npc, dir, 0xFF ); + } + bool result = Movement::instance()->Walking( m_npc, dir, 0xFF ); m_npc->popMove(); |