Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7222
Modified Files:
ChangeLog baseregion.h spawnregions.cpp walking.cpp
Log Message:
fixes for walking
fixes for maps
fixes for spawnregions
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ChangeLog 27 Aug 2004 14:41:15 -0000 1.14
--- ChangeLog 27 Aug 2004 18:56:59 -0000 1.15
***************
*** 23,26 ****
--- 23,29 ----
- hasscript(a) will return true if a is in the basescripts.
- addscript now prepends a new script rather than appending it.
+ - the python .scripts property includes all script names, including the scripts in basescripts.
+ - added a new property .basescripts to get a comma separated list of all scripts in the
+ basescripts list.
Index: walking.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/walking.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -C2 -d -r1.138 -r1.139
*** walking.cpp 25 Aug 2004 17:01:24 -0000 1.138
--- walking.cpp 27 Aug 2004 18:56:59 -0000 1.139
***************
*** 80,84 ****
#define P_M_MAX_Z_INFLUENCE 15
#define P_M_MAX_Z_FALL 20 // You can fall 20 tiles ofcourse !!
! #define P_M_MAX_Z_BLOCKS 15
// These are the debugging defines
--- 80,84 ----
#define P_M_MAX_Z_INFLUENCE 15
#define P_M_MAX_Z_FALL 20 // You can fall 20 tiles ofcourse !!
! #define P_M_MAX_Z_BLOCKS 14
// These are the debugging defines
***************
*** 111,116 ****
Q_UINT8 height;
bool walkable;
! stBlockItem() : z( -128 ), height( 0 ), walkable( false )
{
}
--- 111,117 ----
Q_UINT8 height;
bool walkable;
+ bool maptile;
! stBlockItem() : z( -128 ), height( 0 ), walkable( false ), maptile( false )
{
}
***************
*** 143,146 ****
--- 144,148 ----
// Process the map at that position
stBlockItem mapBlock;
+ mapBlock.maptile = true;
mapBlock.z = Maps::instance()->mapAverageElevation( pos );
mapBlock.height = 0;
***************
*** 148,152 ****
// TODO: Calculate the REAL average Z Value of that Map Tile here! Otherwise clients will have minor walking problems.
map_st mapCell = Maps::instance()->seekMap( pos );
! mapBlock.z = mapCell.z;
land_st mapTile = TileCache::instance()->getLand( mapCell.id );
--- 150,154 ----
// TODO: Calculate the REAL average Z Value of that Map Tile here! Otherwise clients will have minor walking problems.
map_st mapCell = Maps::instance()->seekMap( pos );
! //mapBlock.z = mapCell.z;*/
land_st mapTile = TileCache::instance()->getLand( mapCell.id );
***************
*** 187,191 ****
// If we are a stair only the half height counts (round up)
if ( tTile.flag2 & 0x04 )
! staticBlock.height = ( Q_UINT8 ) ( tTile.height + 1 / 2 );
else
staticBlock.height = tTile.height;
--- 189,193 ----
// If we are a stair only the half height counts (round up)
if ( tTile.flag2 & 0x04 )
! staticBlock.height = ( Q_UINT8 ) ( ( tTile.height + 1 ) / 2 );
else
staticBlock.height = tTile.height;
***************
*** 283,286 ****
--- 285,289 ----
Q_UINT32 i;
bool priviledged = false;
+ Q_INT32 oldz = pos.z;
P_PLAYER player = dynamic_cast<P_PLAYER>( pChar );
***************
*** 299,312 ****
return false;
! // If the top of the item is within our max-climb reach
! // then the first check passed. in addition we need to
! // check if the "bottom" of the item is reachable
! // I would say 2 is a good "reach" value for the bottom
! // of any item
! if ( ( item.walkable || priviledged ) && ( itemTop <= pos.z + P_M_MAX_Z_CLIMB ) && ( itemTop >= pos.z - P_M_MAX_Z_FALL ) /*&& ( item.z <= pos.z + 2 )*/ )
! {
! pos.z = itemTop;
! found = true;
! break;
}
}
--- 302,321 ----
return false;
! if ( item.walkable || priviledged ) {
! // If the top of the item is within our max-climb reach
! // then the first check passed. in addition we need to
! // check if the "bottom" of the item is reachable
! // I would say 2 is a good "reach" value for the bottom
! // of any item
! if ( itemTop < pos.z + P_M_MAX_Z_CLIMB && itemTop >= pos.z - P_M_MAX_Z_FALL ) {
! pos.z = itemTop;
! found = true;
! break;
! // Climbing maptiles is 5 tiles easier
! } else if ( item.maptile && itemTop < pos.z + P_M_MAX_Z_CLIMB + 5 && itemTop >= pos.z - P_M_MAX_Z_FALL ) {
! pos.z = itemTop;
! found = true;
! break;
! }
}
}
***************
*** 331,351 ****
Q_INT8 itemTop = ( item.z + item.height );
// Does the top of the item looms into our space
// Like before 15 is the assumed height of ourself
if ( ( itemTop > pos.z ) && ( itemTop < pos.z + P_M_MAX_Z_BLOCKS ) )
return false;
// Or the bottom ?
! if ( ( item.z > pos.z ) && ( item.z < pos.z + P_M_MAX_Z_BLOCKS ) )
return false;
// Or does it spread the whole range ?
! if ( ( item.z <= pos.z ) && ( itemTop >= pos.z + P_M_MAX_Z_BLOCKS ) )
return false;
-
- // If the Item Tops are already below our current position exit the
- // loop, we're sorted by those !
- if ( itemTop <= pos.z )
- break;
}
--- 340,361 ----
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 ?
! if ( ( item.z > oldz ) && ( item.z < oldz + P_M_MAX_Z_BLOCKS ) )
return false;
// Or does it spread the whole range ?
! if ( ( item.z <= oldz ) && ( itemTop >= oldz + P_M_MAX_Z_BLOCKS ) )
return false;
}
Index: spawnregions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** spawnregions.cpp 10 Aug 2004 03:15:57 -0000 1.67
--- spawnregions.cpp 27 Aug 2004 18:56:59 -0000 1.68
***************
*** 210,216 ****
bool cSpawnRegion::findValidSpot( Coord_cl& pos )
{
! // Try up to 100 times.
! for ( unsigned int i = 0; i < 100; ++i )
! {
int rndRectNum = RandomNum( 0, this->rectangles_.size() - 1 );
pos.x = RandomNum( this->rectangles_[rndRectNum].x1, this->rectangles_[rndRectNum].x2 );
--- 210,215 ----
bool cSpawnRegion::findValidSpot( Coord_cl& pos )
{
! // Try up to 25 times.
! for ( unsigned int i = 0; i < 25; ++i ) {
int rndRectNum = RandomNum( 0, this->rectangles_.size() - 1 );
pos.x = RandomNum( this->rectangles_[rndRectNum].x1, this->rectangles_[rndRectNum].x2 );
Index: baseregion.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/baseregion.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** baseregion.h 27 Jul 2004 04:15:08 -0000 1.25
--- baseregion.h 27 Aug 2004 18:56:59 -0000 1.26
***************
*** 164,167 ****
--- 164,176 ----
toinsert_.y2 = Tag->getAttribute( "y2" ).toUShort();
toinsert_.map = Tag->getAttribute( "map" ).toUShort();
+
+ if (toinsert_.y1 > toinsert_.y2) {
+ std::swap(toinsert_.y1, toinsert_.y2);
+ }
+
+ if (toinsert_.x1 > toinsert_.x2) {
+ std::swap(toinsert_.x1, toinsert_.x2);
+ }
+
this->rectangles_.push_back( toinsert_ );
}
|