This commit is contained in:
parent
1ab34685db
commit
3804517959
15 changed files with 108 additions and 44 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -190,8 +190,25 @@ void CNpcDustDevilEnemy::processMovementModifier( int _frames, s32 distX, s32 di
|
||||||
testPos1.vx -= 10;
|
testPos1.vx -= 10;
|
||||||
testPos2.vx += 10;
|
testPos2.vx += 10;
|
||||||
|
|
||||||
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
||||||
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.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 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
|
@ -228,8 +228,25 @@ void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
||||||
testPos1.vx -= 10;
|
testPos1.vx -= 10;
|
||||||
testPos2.vx += 10;
|
testPos2.vx += 10;
|
||||||
|
|
||||||
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
||||||
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.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 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
|
@ -41,8 +41,25 @@ void CNpcPricklyBugEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
||||||
testPos1.vx -= 10;
|
testPos1.vx -= 10;
|
||||||
testPos2.vx += 10;
|
testPos2.vx += 10;
|
||||||
|
|
||||||
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
||||||
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.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 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
|
@ -338,8 +338,6 @@ void CNpcSpiderCrabEnemy::processMovement(int _frames)
|
||||||
|
|
||||||
void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
|
void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
|
||||||
{
|
{
|
||||||
int groundDist;
|
|
||||||
|
|
||||||
Pos.vx += distX;
|
Pos.vx += distX;
|
||||||
Pos.vy += distY;
|
Pos.vy += distY;
|
||||||
|
|
||||||
|
@ -351,9 +349,9 @@ void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
||||||
testPos1.vx -= 10;
|
testPos1.vx -= 10;
|
||||||
testPos2.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;
|
m_drawRotation = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -361,9 +359,9 @@ void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
||||||
|
|
||||||
testPos1.vy += groundDist;
|
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;
|
m_drawRotation = 0;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -299,6 +299,8 @@ void CNpcGaryFriend::think( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_obstructed = false;
|
||||||
|
|
||||||
// sort out draw rotation
|
// sort out draw rotation
|
||||||
|
|
||||||
DVECTOR testPos1, testPos2;
|
DVECTOR testPos1, testPos2;
|
||||||
|
@ -307,8 +309,25 @@ void CNpcGaryFriend::think( int _frames )
|
||||||
testPos1.vx -= 10;
|
testPos1.vx -= 10;
|
||||||
testPos2.vx += 10;
|
testPos2.vx += 10;
|
||||||
|
|
||||||
testPos1.vy += CGameScene::getCollision()->getHeightFromGroundNonSB( testPos1.vx, testPos1.vy, 16 );
|
int groundDist = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
||||||
testPos2.vy += CGameScene::getCollision()->getHeightFromGroundNonSB( testPos2.vx, testPos2.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 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
@ -316,8 +335,6 @@ void CNpcGaryFriend::think( int _frames )
|
||||||
s16 heading = ratan2( yDist, xDist );
|
s16 heading = ratan2( yDist, xDist );
|
||||||
|
|
||||||
m_drawRotation = heading;
|
m_drawRotation = heading;
|
||||||
|
|
||||||
m_obstructed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -225,24 +225,23 @@ void CNpcCartPlatform::processMovement( int _frames )
|
||||||
|
|
||||||
u8 sensorDist = 16;
|
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
|
// 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 )
|
testPos1.vy += yDiff1;
|
||||||
{
|
testPos2.vy += yDiff2;
|
||||||
// only use if there is ground present
|
}
|
||||||
|
|
||||||
testPos2.vy += yDiff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 xDist = testPos2.vx - testPos1.vx;
|
s32 xDist = testPos2.vx - testPos1.vx;
|
||||||
|
@ -255,13 +254,13 @@ void CNpcCartPlatform::processMovement( int _frames )
|
||||||
testPos2 = Pos;
|
testPos2 = Pos;
|
||||||
testPos2.vx += 32;
|
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
|
// 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 )
|
switch ( CGameScene::getCollision()->getCollisionBlock( testPos2.vx, testPos2.vy - 8 ) & COLLISION_TYPE_MASK )
|
||||||
|
|
|
@ -217,24 +217,23 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
|
||||||
|
|
||||||
u8 sensorDist = 16;
|
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
|
// 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 )
|
testPos1.vy += yDiff1;
|
||||||
{
|
testPos2.vy += yDiff2;
|
||||||
// only use if there is ground present
|
}
|
||||||
|
|
||||||
testPos2.vy += yDiff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 xDist = testPos2.vx - testPos1.vx;
|
s32 xDist = testPos2.vx - testPos1.vx;
|
||||||
|
@ -247,13 +246,13 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
|
||||||
testPos2 = Pos;
|
testPos2 = Pos;
|
||||||
testPos2.vx += 32;
|
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
|
// 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 )
|
switch ( CGameScene::getCollision()->getCollisionBlock( testPos2.vx, testPos2.vy - 8 ) & COLLISION_TYPE_MASK )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue