diff --git a/Graphics/levels/Chapter01/Level01/Level01.MEX b/Graphics/levels/Chapter01/Level01/Level01.MEX index 3a4a4c1cf..cef78b1cd 100644 Binary files a/Graphics/levels/Chapter01/Level01/Level01.MEX and b/Graphics/levels/Chapter01/Level01/Level01.MEX differ diff --git a/Graphics/levels/Chapter01/Level01/level01.Mep b/Graphics/levels/Chapter01/Level01/level01.Mep index 75b0a3fad..71496452b 100644 Binary files a/Graphics/levels/Chapter01/Level01/level01.Mep and b/Graphics/levels/Chapter01/Level01/level01.Mep differ diff --git a/Graphics/levels/Chapter01/Level03/Level03.MEX b/Graphics/levels/Chapter01/Level03/Level03.MEX index 8d48ded03..c66fcd803 100644 Binary files a/Graphics/levels/Chapter01/Level03/Level03.MEX and b/Graphics/levels/Chapter01/Level03/Level03.MEX differ diff --git a/Graphics/levels/Chapter01/Level03/level03.Mep b/Graphics/levels/Chapter01/Level03/level03.Mep index 3fecaf7c8..e13f40d4f 100644 Binary files a/Graphics/levels/Chapter01/Level03/level03.Mep and b/Graphics/levels/Chapter01/Level03/level03.Mep differ diff --git a/Graphics/levels/Chapter02/Level01/level01.MEX b/Graphics/levels/Chapter02/Level01/level01.MEX index 57ea9c362..ae816a823 100644 Binary files a/Graphics/levels/Chapter02/Level01/level01.MEX and b/Graphics/levels/Chapter02/Level01/level01.MEX differ diff --git a/Graphics/levels/Chapter02/Level01/level01.Mep b/Graphics/levels/Chapter02/Level01/level01.Mep index 1bc0b388c..730680d21 100644 Binary files a/Graphics/levels/Chapter02/Level01/level01.Mep and b/Graphics/levels/Chapter02/Level01/level01.Mep differ diff --git a/Graphics/levels/Chapter06/Level05/Level05.MEX b/Graphics/levels/Chapter06/Level05/Level05.MEX index 8e2c7e2bd..0f0a0ce89 100644 Binary files a/Graphics/levels/Chapter06/Level05/Level05.MEX and b/Graphics/levels/Chapter06/Level05/Level05.MEX differ diff --git a/Graphics/levels/Chapter06/Level05/level05.Mep b/Graphics/levels/Chapter06/Level05/level05.Mep index 62cbce140..bec9c72a8 100644 Binary files a/Graphics/levels/Chapter06/Level05/level05.Mep and b/Graphics/levels/Chapter06/Level05/level05.Mep differ diff --git a/source/enemy/ndustdev.cpp b/source/enemy/ndustdev.cpp index b712c1ad2..df01d5fa0 100644 --- a/source/enemy/ndustdev.cpp +++ b/source/enemy/ndustdev.cpp @@ -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; diff --git a/source/enemy/nhcrab.cpp b/source/enemy/nhcrab.cpp index be23a3c5f..d84a15c54 100644 --- a/source/enemy/nhcrab.cpp +++ b/source/enemy/nhcrab.cpp @@ -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; diff --git a/source/enemy/npbug.cpp b/source/enemy/npbug.cpp index 6613cfbb4..2a58e810f 100644 --- a/source/enemy/npbug.cpp +++ b/source/enemy/npbug.cpp @@ -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; diff --git a/source/enemy/nscrab.cpp b/source/enemy/nscrab.cpp index cab1c4c40..f8780d4bd 100644 --- a/source/enemy/nscrab.cpp +++ b/source/enemy/nscrab.cpp @@ -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; diff --git a/source/friend/fgary.cpp b/source/friend/fgary.cpp index 5ce73d7b7..ab0113807 100644 --- a/source/friend/fgary.cpp +++ b/source/friend/fgary.cpp @@ -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; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/platform/pcart.cpp b/source/platform/pcart.cpp index 80648888c..23bd9e967 100644 --- a/source/platform/pcart.cpp +++ b/source/platform/pcart.cpp @@ -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 ) diff --git a/source/platform/pghost.cpp b/source/platform/pghost.cpp index 0d418b833..99b3791ef 100644 --- a/source/platform/pghost.cpp +++ b/source/platform/pghost.cpp @@ -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 )