Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30240
Modified Files:
ChangeLog player.cpp spawnregions.cpp spawnregions.h
Log Message:
Index: spawnregions.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** spawnregions.h 3 Nov 2004 02:09:27 -0000 1.35
--- spawnregions.h 5 Nov 2004 16:28:29 -0000 1.36
***************
*** 46,50 ****
virtual Coord findSpot() = 0;
! virtual bool inBounds(const Coord &pos) = 0;
};
--- 46,50 ----
virtual Coord findSpot() = 0;
! virtual bool inBounds(const Coord &pos) = 0;
};
***************
*** 137,140 ****
--- 137,141 ----
QPtrList<cSpawnPosition> positions_; // Spawn positions
+ QPtrList<cSpawnPosition> exceptions_; // Spawn positions (doesnt reduce point count (beware))
bool checkFreeSpot_; // The target spot has to be free.
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.144
retrieving revision 1.145
diff -C2 -d -r1.144 -r1.145
*** player.cpp 5 Nov 2004 07:26:52 -0000 1.144
--- player.cpp 5 Nov 2004 16:28:29 -0000 1.145
***************
*** 314,320 ****
QString ghostSpeech;
// Generate the ghost-speech *ONCE*
! if ( isDead() )
{
for ( Q_UINT32 gI = 0; gI < message.length(); ++gI )
--- 314,321 ----
QString ghostSpeech;
+ bool gmSpiritSpeak = skillValue(SPIRITSPEAK) >= 1000;
// Generate the ghost-speech *ONCE*
! if ( isDead() && !gmSpiritSpeak )
{
for ( Q_UINT32 gI = 0; gI < message.length(); ++gI )
***************
*** 330,335 ****
{
// Take the dead-status into account
! if ( isDead() )
! if ( !socket->player()->isDead() && !socket->player()->isGMorCounselor() )
textSpeech->setText( ghostSpeech );
else
--- 331,336 ----
{
// Take the dead-status into account
! if ( isDead() && !gmSpiritSpeak )
! if ( !socket->player()->isDead() && !socket->player()->isGMorCounselor() && socket->player()->skillValue(SPIRITSPEAK) < 1000 )
textSpeech->setText( ghostSpeech );
else
***************
*** 346,351 ****
{
// Take the dead-status into account
! if ( isDead() )
! if ( !mSock->player()->isDead() && !mSock->player()->isGMorCounselor() )
textSpeech->setText( ghostSpeech );
else
--- 347,352 ----
{
// Take the dead-status into account
! if ( isDead() && !gmSpiritSpeak )
! if ( !mSock->player()->isDead() && !mSock->player()->isGMorCounselor() && mSock->player()->skillValue(SPIRITSPEAK) < 1000 )
textSpeech->setText( ghostSpeech );
else
Index: spawnregions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -d -r1.86 -r1.87
*** spawnregions.cpp 5 Nov 2004 00:52:55 -0000 1.86
--- spawnregions.cpp 5 Nov 2004 16:28:29 -0000 1.87
***************
*** 119,122 ****
--- 119,123 ----
int x,y;
int radius;
+ int radius2;
bool fixedZ;
signed char z;
***************
*** 127,130 ****
--- 128,132 ----
this->y = center.y;
this->radius = radius;
+ this->radius2 = radius * radius; // Square of the radius for speeding up pythagoras
this->map = map;
this->fixedZ = fixedZ;
***************
*** 137,149 ****
}
bool inBounds(const Coord &pos) {
! // Calculate the distance to the center and
! // check if it's smaller than the radius
! float xDiff = (float)abs(pos.x - x);
! float yDiff = (float)abs(pos.y - y);
!
! float distance = sqrt(xDiff * xDiff + yDiff * yDiff);
!
! return distance <= (float)radius;
}
--- 139,147 ----
}
+ // Calculate the distance to the center and check if it's smaller than the radius
bool inBounds(const Coord &pos) {
! int xDiff = pos.x - x;
! int yDiff = pos.y - y;
! return (xDiff * xDiff + yDiff * yDiff) <= radius2;
}
***************
*** 185,188 ****
--- 183,187 ----
id_ = tag->getAttribute("id");
positions_.setAutoDelete(true);
+ exceptions_.setAutoDelete(true);
checkFreeSpot_ = false;
npcNodesTotal_ = 0;
***************
*** 369,373 ****
}
! positions_.append(new cSpawnRectangle(from, to, map, fixedZ, z)); // Append to position
}
--- 368,376 ----
}
! if (tag->getAttribute("exception", "false").lower() == "true") {
! exceptions_.append(new cSpawnRectangle(from, to, map, fixedZ, z)); // Append to position
! } else {
! positions_.append(new cSpawnRectangle(from, to, map, fixedZ, z)); // Append to position
! }
}
***************
*** 380,384 ****
}
! positions_.append(new cSpawnPoint(pos));
}
--- 383,391 ----
}
! if (tag->getAttribute("exception", "false").lower() == "true") {
! exceptions_.append(new cSpawnPoint(pos));
! } else {
! positions_.append(new cSpawnPoint(pos));
! }
}
***************
*** 424,428 ****
}
! positions_.append(new cSpawnCircle(center, radius, map, fixedZ, z)); // Append to position
}
--- 431,439 ----
}
! if (tag->getAttribute("exception", "false").lower() == "true") {
! exceptions_.append(new cSpawnCircle(center, radius, map, fixedZ, z)); // Append to position
! } else {
! positions_.append(new cSpawnCircle(center, radius, map, fixedZ, z)); // Append to position
! }
}
***************
*** 497,500 ****
--- 508,518 ----
}
+ // This checks if the point is within one of the exempt areas
+ for (cSpawnPosition *exception = exceptions_.first(); exception; exception = exceptions_.next()) {
+ if (exception->inBounds(rndPos)) {
+ return findValidSpot(result, tries - 1); // Invalid spot, search for another one
+ }
+ }
+
result = rndPos;
return true;
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.137
retrieving revision 1.138
diff -C2 -d -r1.137 -r1.138
*** ChangeLog 5 Nov 2004 07:26:52 -0000 1.137
--- ChangeLog 5 Nov 2004 16:28:24 -0000 1.138
***************
*** 43,46 ****
--- 43,50 ----
- It's no longer possible to login with a char if another char in the same account is still online.
- Fixed a bug that would cause onLogout not to be called.
+ - A skill of 100% or more in Spirit Speaking now allows you to talk freely as a ghost and hear
+ everything dead players have to say.
+ - All geometrical bodies for spawnregions now support the except="true" tag that makes the rectangle, circle or
+ point not be included in finding a random position within the region.
Wolfpack 12.9.12 Beta (18. October 2004)
|