This commit is contained in:
parent
91231221c5
commit
8407047a70
4 changed files with 74 additions and 29 deletions
|
@ -69,7 +69,7 @@ void CNpcPath::initPath()
|
||||||
reversePath = false;
|
reversePath = false;
|
||||||
minX = maxX = minY = maxY = 0;
|
minX = maxX = minY = maxY = 0;
|
||||||
waypointPtr = NULL;
|
waypointPtr = NULL;
|
||||||
|
decLockout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -77,6 +77,7 @@ void CNpcPath::initPath()
|
||||||
void CNpcPath::resetPath()
|
void CNpcPath::resetPath()
|
||||||
{
|
{
|
||||||
lastWaypoint = currentWaypoint = 0;
|
lastWaypoint = currentWaypoint = 0;
|
||||||
|
decLockout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -168,6 +169,8 @@ void CNpcPath::setPathExtents()
|
||||||
|
|
||||||
bool CNpcPath::incPath()
|
bool CNpcPath::incPath()
|
||||||
{
|
{
|
||||||
|
decLockout = false;
|
||||||
|
|
||||||
if ( !reversePath )
|
if ( !reversePath )
|
||||||
{
|
{
|
||||||
if ( currentWaypoint < waypointCount )
|
if ( currentWaypoint < waypointCount )
|
||||||
|
@ -233,8 +236,10 @@ bool CNpcPath::incPath()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcPath::decPath()
|
bool CNpcPath::decPath()
|
||||||
{
|
{
|
||||||
|
if ( !decLockout )
|
||||||
|
{
|
||||||
if ( currentWaypoint > 0 )
|
if ( currentWaypoint > 0 )
|
||||||
{
|
{
|
||||||
lastWaypoint = currentWaypoint;
|
lastWaypoint = currentWaypoint;
|
||||||
|
@ -245,6 +250,13 @@ void CNpcPath::decPath()
|
||||||
lastWaypoint = currentWaypoint;
|
lastWaypoint = currentWaypoint;
|
||||||
currentWaypoint = waypointCount;
|
currentWaypoint = waypointCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decLockout = true;
|
||||||
|
|
||||||
|
return( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
return( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
void setPathType( u8 newPathType );
|
void setPathType( u8 newPathType );
|
||||||
u8 getPathType();
|
u8 getPathType();
|
||||||
bool incPath();
|
bool incPath();
|
||||||
void decPath();
|
bool decPath();
|
||||||
void resetPath();
|
void resetPath();
|
||||||
void reversePathDir();
|
void reversePathDir();
|
||||||
s32 think( DVECTOR const ¤tPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY );
|
s32 think( DVECTOR const ¤tPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY );
|
||||||
|
@ -55,6 +55,7 @@ private:
|
||||||
u8 lastWaypoint;
|
u8 lastWaypoint;
|
||||||
s32 minX, maxX;
|
s32 minX, maxX;
|
||||||
s32 minY, maxY;
|
s32 minY, maxY;
|
||||||
|
bool decLockout;
|
||||||
|
|
||||||
u16 *waypointPtr;
|
u16 *waypointPtr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -164,6 +164,8 @@ void CNpcSeaSnakeEnemy::postInit()
|
||||||
m_collTimer = 0;
|
m_collTimer = 0;
|
||||||
m_turnDir = 0;
|
m_turnDir = 0;
|
||||||
m_waitTimer = 0;
|
m_waitTimer = 0;
|
||||||
|
m_collCount = 0;
|
||||||
|
m_sign = 1;
|
||||||
|
|
||||||
CNpcBossEnemy::postInit();
|
CNpcBossEnemy::postInit();
|
||||||
}
|
}
|
||||||
|
@ -555,11 +557,24 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
|
||||||
case COLLISION_TYPE_FLAG_SOLID:
|
case COLLISION_TYPE_FLAG_SOLID:
|
||||||
{
|
{
|
||||||
Pos = oldPos;
|
Pos = oldPos;
|
||||||
m_heading += 2048;
|
|
||||||
|
if ( m_collCount > 4 )
|
||||||
|
{
|
||||||
|
m_collCount = 0;
|
||||||
|
m_sign = -m_sign;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_collCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_heading += m_sign * 1024;
|
||||||
m_heading &= 4095;
|
m_heading &= 4095;
|
||||||
|
|
||||||
m_npcPath.decPath();
|
bool dec = m_npcPath.decPath();
|
||||||
|
|
||||||
|
if ( dec )
|
||||||
|
{
|
||||||
DVECTOR waypointPos;
|
DVECTOR waypointPos;
|
||||||
m_npcPath.getCurrentWaypointPos( &waypointPos );
|
m_npcPath.getCurrentWaypointPos( &waypointPos );
|
||||||
waypointPos.vy -= 8;
|
waypointPos.vy -= 8;
|
||||||
|
@ -570,6 +585,7 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
|
||||||
|
|
||||||
m_npcPath.incPath();
|
m_npcPath.incPath();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -892,11 +908,24 @@ void CNpcSeaSnakeEnemy::processClose( int _frames )
|
||||||
m_sensorFunc = NPC_SENSOR_NONE;
|
m_sensorFunc = NPC_SENSOR_NONE;
|
||||||
|
|
||||||
Pos = oldPos;
|
Pos = oldPos;
|
||||||
m_heading += 2048;
|
|
||||||
|
if ( m_collCount > 4 )
|
||||||
|
{
|
||||||
|
m_collCount = 0;
|
||||||
|
m_sign = -m_sign;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_collCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_heading += m_sign * 1024;
|
||||||
m_heading &= 4095;
|
m_heading &= 4095;
|
||||||
|
|
||||||
m_npcPath.decPath();
|
bool dec = m_npcPath.decPath();
|
||||||
|
|
||||||
|
if ( dec )
|
||||||
|
{
|
||||||
DVECTOR waypointPos;
|
DVECTOR waypointPos;
|
||||||
m_npcPath.getCurrentWaypointPos( &waypointPos );
|
m_npcPath.getCurrentWaypointPos( &waypointPos );
|
||||||
waypointPos.vy -= 8;
|
waypointPos.vy -= 8;
|
||||||
|
@ -907,6 +936,7 @@ void CNpcSeaSnakeEnemy::processClose( int _frames )
|
||||||
|
|
||||||
m_npcPath.incPath();
|
m_npcPath.incPath();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,8 @@ protected:
|
||||||
s16 m_circleHeading;
|
s16 m_circleHeading;
|
||||||
s16 m_origHeading;
|
s16 m_origHeading;
|
||||||
s32 m_waitTimer;
|
s32 m_waitTimer;
|
||||||
|
u8 m_collCount;
|
||||||
|
s8 m_sign;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue