[wpdev-commits] wolfpack/ai ai.cpp,1.28,1.29 ai.h,1.13,1.14
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-09-17 23:28:35
|
Update of /cvsroot/wpdev/wolfpack/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15468/ai Modified Files: ai.cpp ai.h Log Message: improved npc walking and wandering. Index: ai.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ai/ai.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ai.h 10 Sep 2004 04:06:27 -0000 1.13 --- ai.h 17 Sep 2004 23:28:17 -0000 1.14 *************** *** 33,36 **** --- 33,37 ---- // wolfpack includes + #include "../basics.h" #include "../factory.h" #include "../definable.h" Index: ai.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ai/ai.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ai.cpp 10 Sep 2004 04:06:27 -0000 1.28 --- ai.cpp 17 Sep 2004 23:28:16 -0000 1.29 *************** *** 479,482 **** --- 479,483 ---- return; } + m_npc->setNextMoveTime(); *************** *** 498,501 **** --- 499,508 ---- // Calculate the field we're facing. unsigned char dir = m_npc->direction(); + + // There is a 5% chance of changing the direction + if (!RandomNum(0, 19)) { + dir = RandomNum(0, 7); + } + Coord_cl newpos = Movement::instance()->calcCoordFromDir( dir, m_npc->pos() ); *************** *** 531,536 **** } ! m_npc->setDirection( newdir ); ! m_npc->update(); } --- 538,542 ---- } ! Movement::instance()->Walking( m_npc, newdir, 0xFF ); } *************** *** 545,549 **** dir = RandomNum( 0, 7 ); - m_npc->setDirection( dir ); Movement::instance()->Walking( m_npc, dir, 0xFF ); break; --- 551,554 ---- *************** *** 557,561 **** Q_UINT8 dir = m_npc->pos().direction( Coord_cl( rndx, rndy ) ); - m_npc->setDirection( dir ); Movement::instance()->Walking( m_npc, dir, 0xFF ); break; --- 562,565 ---- *************** *** 575,579 **** Q_UINT8 dir = m_npc->pos().direction( pos ); - m_npc->setDirection( dir ); Movement::instance()->Walking( m_npc, dir, 0xFF ); break; --- 579,582 ---- *************** *** 639,643 **** } - m_npc->setDirection( dir ); Movement::instance()->Walking( m_npc, dir, 0xFF ); } --- 642,645 ---- *************** *** 673,677 **** Coord_cl nextmove = m_npc->nextMove(); Q_UINT8 dir = m_npc->pos().direction( nextmove ); - m_npc->setDirection( dir ); Movement::instance()->Walking( m_npc, dir, 0xFF ); m_npc->popMove(); --- 675,678 ---- |