This commit is contained in:
Charles 2001-08-02 14:51:29 +00:00
parent 1ab34685db
commit 3804517959
15 changed files with 108 additions and 44 deletions

View File

@ -190,8 +190,25 @@ void CNpcDustDevilEnemy::processMovementModifier( int _frames, s32 distX, s32 di
testPos1.vx -= 10;
testPos2.vx += 10;
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos1.vy += groundDist;
groundDist = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos2.vy += groundDist;
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;

View File

@ -228,8 +228,25 @@ void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
testPos1.vx -= 10;
testPos2.vx += 10;
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos1.vy += groundDist;
groundDist = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos2.vy += groundDist;
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;

View File

@ -41,8 +41,25 @@ void CNpcPricklyBugEnemy::processMovementModifier( int _frames, s32 distX, s32 d
testPos1.vx -= 10;
testPos2.vx += 10;
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos1.vy += groundDist;
groundDist = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos2.vy += groundDist;
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;

View File

@ -338,8 +338,6 @@ void CNpcSpiderCrabEnemy::processMovement(int _frames)
void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
{
int groundDist;
Pos.vx += distX;
Pos.vy += distY;
@ -351,9 +349,9 @@ void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
testPos1.vx -= 10;
testPos2.vx += 10;
groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 12 );
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
if ( abs( groundDist ) > 12 )
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
@ -361,9 +359,9 @@ void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
testPos1.vy += groundDist;
groundDist = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 12 );
groundDist = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
if ( abs( groundDist ) > 12 )
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;

View File

@ -299,6 +299,8 @@ void CNpcGaryFriend::think( int _frames )
}
}
m_obstructed = false;
// sort out draw rotation
DVECTOR testPos1, testPos2;
@ -307,8 +309,25 @@ void CNpcGaryFriend::think( int _frames )
testPos1.vx -= 10;
testPos2.vx += 10;
testPos1.vy += CGameScene::getCollision()->getHeightFromGroundNonSB( testPos1.vx, testPos1.vy, 16 );
testPos2.vy += CGameScene::getCollision()->getHeightFromGroundNonSB( testPos2.vx, testPos2.vy, 16 );
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos1.vy += groundDist;
groundDist = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
if ( abs( groundDist ) > 15 )
{
m_drawRotation = 0;
return;
}
testPos2.vy += groundDist;
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;
@ -316,8 +335,6 @@ void CNpcGaryFriend::think( int _frames )
s16 heading = ratan2( yDist, xDist );
m_drawRotation = heading;
m_obstructed = false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -225,24 +225,23 @@ void CNpcCartPlatform::processMovement( int _frames )
u8 sensorDist = 16;
s32 yDiff;
s32 yDiff1, yDiff2;
yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos1.vx, testPos1.vy, sensorDist + 1 );
yDiff1 = CGameScene::getCollision()->getHeightFromGroundCart( testPos1.vx, testPos1.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
if ( abs( yDiff1 ) <= sensorDist )
{
// only use if there is ground present
testPos1.vy += yDiff;
}
yDiff2 = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
if ( abs( yDiff2 ) <= sensorDist )
{
// only use if there is ground present
if ( yDiff <= sensorDist )
{
// only use if there is ground present
testPos2.vy += yDiff;
testPos1.vy += yDiff1;
testPos2.vy += yDiff2;
}
}
s32 xDist = testPos2.vx - testPos1.vx;
@ -255,13 +254,13 @@ void CNpcCartPlatform::processMovement( int _frames )
testPos2 = Pos;
testPos2.vx += 32;
yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
yDiff1 = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
if ( yDiff1 <= sensorDist )
{
// only use if there is ground present
testPos2.vy += yDiff;
testPos2.vy += yDiff1;
}
switch ( CGameScene::getCollision()->getCollisionBlock( testPos2.vx, testPos2.vy - 8 ) & COLLISION_TYPE_MASK )

View File

@ -217,24 +217,23 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
u8 sensorDist = 16;
s32 yDiff;
s32 yDiff1, yDiff2;
yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos1.vx, testPos1.vy, sensorDist + 1 );
yDiff1 = CGameScene::getCollision()->getHeightFromGroundCart( testPos1.vx, testPos1.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
if ( abs( yDiff1 ) <= sensorDist )
{
// only use if there is ground present
testPos1.vy += yDiff;
}
yDiff2 = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
if ( abs( yDiff2 ) <= sensorDist )
{
// only use if there is ground present
if ( yDiff <= sensorDist )
{
// only use if there is ground present
testPos2.vy += yDiff;
testPos1.vy += yDiff1;
testPos2.vy += yDiff2;
}
}
s32 xDist = testPos2.vx - testPos1.vx;
@ -247,13 +246,13 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
testPos2 = Pos;
testPos2.vx += 32;
yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
yDiff1 = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
if ( yDiff1 <= sensorDist )
{
// only use if there is ground present
testPos2.vy += yDiff;
testPos2.vy += yDiff1;
}
switch ( CGameScene::getCollision()->getCollisionBlock( testPos2.vx, testPos2.vy - 8 ) & COLLISION_TYPE_MASK )