Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29184
Modified Files:
ChangeLog npc.cpp timing.cpp walking.cpp
Log Message:
Guards now run towards their targets.
Fixed bug #0000345.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -d -r1.93 -r1.94
*** ChangeLog 2 Oct 2004 22:15:49 -0000 1.93
--- ChangeLog 3 Oct 2004 13:51:39 -0000 1.94
***************
*** 25,28 ****
--- 25,30 ----
Because of that the format changed, please hop on irc and ask for details if you want
to convert your scripts.
+ - Guards now run towards their targets.
+ - Fixed bug #0000345.
Wolfpack 12.9.11 Beta (26. September 2004)
Index: walking.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/walking.cpp,v
retrieving revision 1.152
retrieving revision 1.153
diff -C2 -d -r1.152 -r1.153
*** walking.cpp 1 Oct 2004 16:32:53 -0000 1.152
--- walking.cpp 3 Oct 2004 13:51:39 -0000 1.153
***************
*** 877,880 ****
--- 877,882 ----
return false;
+ int oldz = pos.z;
+
// Go trough the array top-to-bottom and check
// If we find a tile to walk on
***************
*** 922,925 ****
--- 924,959 ----
return false;
+ // Another loop *IS* needed here (at least that's what i think)
+ for ( i = 0; i < blockList.size(); ++i )
+ {
+ // So we know about the new Z position we are moving to
+ // Lets check if there is enough space ABOVE that position (at least 15 z units)
+ // If there is ANY impassable object between pos.z and pos.z + 15 we can't walk here
+ stBlockItem item = blockList[i];
+ Q_INT8 itemTop = ( item.z + item.height );
+
+ // If the item is below what we step on, ignore it
+ if (itemTop <= pos.z) {
+ continue;
+ }
+
+ // Does the top of the item looms into our space
+ // Like before 15 is the assumed height of ourself
+ // Use the new position here.
+ if ( ( itemTop > pos.z ) && ( itemTop < pos.z + P_M_MAX_Z_BLOCKS ) )
+ return false;
+
+ // Or the bottom ?
+ // note: the following test was commented out. by putting the code back in,
+ // npcs stop wandering through the walls of multis. I am curious if this code
+ // has other (negative) affects besides that.
+ if ( ( item.z > oldz ) && ( item.z < oldz + P_M_MAX_Z_BLOCKS / 2 ) )
+ return false;
+
+ // Or does it spread the whole range ?
+ if ( ( item.z <= oldz ) && ( itemTop >= oldz + P_M_MAX_Z_BLOCKS / 2 ) )
+ return false;
+ }
+
return true;
}
Index: timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timing.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** timing.cpp 18 Sep 2004 21:10:40 -0000 1.15
--- timing.cpp 3 Oct 2004 13:51:39 -0000 1.16
***************
*** 452,458 ****
{
startProfiling(PF_AICHECK);
- unsigned int delay = RandomNum(250, 750);
- npc->setAICheckTime( time + delay );
npc->ai()->check();
stopProfiling(PF_AICHECK);
}
--- 452,468 ----
{
startProfiling(PF_AICHECK);
npc->ai()->check();
+
+ // Check the current action
+ Monster_Aggr_MoveToTarget *a1 = dynamic_cast<Monster_Aggr_MoveToTarget*>(npc->ai()->currentAction());
+ Human_Guard_MoveToTarget *a2 = dynamic_cast<Human_Guard_MoveToTarget*>(npc->ai()->currentAction());
+
+ if (a1 || a2) {
+ npc->setAICheckTime( time + 100 );
+ } else {
+ unsigned int delay = RandomNum(250, 700);
+ npc->setAICheckTime( time + delay );
+ }
+
stopProfiling(PF_AICHECK);
}
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -C2 -d -r1.118 -r1.119
*** npc.cpp 2 Oct 2004 22:15:50 -0000 1.118
--- npc.cpp 3 Oct 2004 13:51:39 -0000 1.119
***************
*** 230,234 ****
bool cNPC::isInnocent()
{
! return notoriety() == 1;
}
--- 230,235 ----
bool cNPC::isInnocent()
{
! unsigned char notoriety = this->notoriety();
! return notoriety >= 4 && notoriety <= 6;
}
***************
*** 271,274 ****
--- 272,285 ----
}
+ // If we are moving to a targert, run!
+ if (ai_ && ai_->currentAction()) {
+ Human_Guard_MoveToTarget *moveToTargetG = dynamic_cast<Human_Guard_MoveToTarget*>(ai_->currentAction());
+ Monster_Aggr_MoveToTarget *moveToTargetM = dynamic_cast<Monster_Aggr_MoveToTarget*>(ai_->currentAction());
+
+ if (moveToTargetG || moveToTargetM) {
+ interval = 250;
+ }
+ }
+
setNextMoveTime( Server::instance()->time() + interval );
}
|