diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index e4f7c2eb1..e4e477b86 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -91,7 +91,7 @@ void CNpcMotherJellyfishEnemy::setupWaypoints( sThingActor *ThisActor ) setStartPos( newXPos, newYPos ); - startX = newXPos << 4; + startX = ( newXPos << 4 ) + 8; if ( ThisActor->PointCount > 1 ) { @@ -109,13 +109,13 @@ void CNpcMotherJellyfishEnemy::setupWaypoints( sThingActor *ThisActor ) if ( pointNum == ThisActor->PointCount - 2 ) { - startX = newXPos << 4; + startX = ( newXPos << 4 ) + 8; m_base.vx = startX; - m_base.vy = newYPos << 4; + m_base.vy = ( newYPos << 4 ) + 16; } else if ( pointNum == ThisActor->PointCount - 1 ) { - m_cycleWidth = abs( startX - ( newXPos << 4 ) ); + m_cycleWidth = abs( startX - ( ( newXPos << 4 ) + 8 ) ); m_halfCycleWidth = m_cycleWidth >> 1; m_base.vx += m_halfCycleWidth; } diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 45d201a95..93f1fe2ff 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -507,8 +507,8 @@ void CNpcEnemy::addWaypoint( u16 *ptrX, u16 *ptrY ) void CNpcEnemy::setStartPos( s32 xPos, s32 yPos ) { - Pos.vx = xPos << 4; - Pos.vy = yPos << 4; + Pos.vx = ( xPos << 4 ) + 8; + Pos.vy = ( yPos << 4 ) + 16; m_initPos = m_base = Pos; } diff --git a/source/enemy/npcpath.cpp b/source/enemy/npcpath.cpp index dd406fd62..9fc666a23 100644 --- a/source/enemy/npcpath.cpp +++ b/source/enemy/npcpath.cpp @@ -25,12 +25,12 @@ bool CNpcPath::isPointNear( DVECTOR testPos, s32 *xDist, s32 *yDist ) u16 *waypoint = waypointPtr; waypoint += 2 * currentWaypoint; - *xDist = ( *waypoint << 4 ) - testPos.vx; + *xDist = ( ( *waypoint << 4 ) + 8 ) - testPos.vx; xDistSqr = (*xDist) * (*xDist); waypoint++; - *yDist = ( *waypoint << 4 ) - testPos.vy; + *yDist = ( ( *waypoint << 4 ) + 16 ) - testPos.vy; yDistSqr = (*yDist) * (*yDist); if ( xDistSqr + yDistSqr < 100 ) @@ -114,9 +114,9 @@ void CNpcPath::setPathExtents() if ( tempPtr ) { - mapPos.vx = *tempPtr << 4; + mapPos.vx = ( *tempPtr << 4 ) + 8; *tempPtr++; - mapPos.vy = *tempPtr << 4; + mapPos.vy = ( *tempPtr << 4 ) + 16; *tempPtr++; minX = maxX = mapPos.vx; @@ -124,9 +124,9 @@ void CNpcPath::setPathExtents() for ( tempWaypoint = 1 ; tempWaypoint <= waypointCount ; tempWaypoint++ ) { - mapPos.vx = *tempPtr << 4; + mapPos.vx = ( *tempPtr << 4 ) + 8; *tempPtr++; - mapPos.vy = *tempPtr << 4; + mapPos.vy = ( *tempPtr << 4 ) + 16; *tempPtr++; if ( mapPos.vx < minX ) @@ -263,9 +263,9 @@ s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete, bool *waypointChang u16 *waypoint = waypointPtr; waypoint += 2 * currentWaypoint; - *distX = ( *waypoint << 4 ) - currentPos.vx; + *distX = ( ( *waypoint << 4 ) + 8 ) - currentPos.vx; waypoint++; - *distY = ( *waypoint << 4 ) - currentPos.vy; + *distY = ( ( *waypoint << 4 ) + 16 ) - currentPos.vy; } s32 headingToTarget = ratan2( *distY, *distX ); @@ -289,9 +289,9 @@ bool CNpcPath::thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s3 u16 *waypoint = waypointPtr; waypoint += 2 * currentWaypoint; - *distX = ( *waypoint << 4 ) - currentPos.vx; + *distX = ( ( *waypoint << 4 ) + 8 ) - currentPos.vx; waypoint++; - *distY = ( *waypoint << 4 ) - currentPos.vy; + *distY = ( ( *waypoint << 4 ) + 16 ) - currentPos.vy; if ( abs( *distX ) < waypointDist ) { @@ -302,9 +302,9 @@ bool CNpcPath::thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s3 waypoint = waypointPtr; waypoint += 2 * currentWaypoint; - *distX = ( *waypoint << 4 ) - currentPos.vx; + *distX = ( ( *waypoint << 4 ) + 8 ) - currentPos.vx; waypoint++; - *distY = ( *waypoint << 4 ) - currentPos.vy; + *distY = ( ( *waypoint << 4 ) + 16 ) - currentPos.vy; if ( *distX > 0 ) { @@ -334,9 +334,9 @@ bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX u16 *waypoint = waypointPtr; waypoint += 2 * currentWaypoint; - *distX = ( *waypoint << 4 ) - currentPos.vx; + *distX = ( ( *waypoint << 4 ) + 8 ) - currentPos.vx; waypoint++; - *distY = ( *waypoint << 4 ) - currentPos.vy; + *distY = ( ( *waypoint << 4 ) + 16 ) - currentPos.vy; if ( abs( *distY ) < 10 ) { @@ -347,9 +347,9 @@ bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX waypoint = waypointPtr; waypoint += 2 * currentWaypoint; - *distX = ( *waypoint << 4 ) - currentPos.vx; + *distX = ( ( *waypoint << 4 ) + 8 ) - currentPos.vx; waypoint++; - *distY = ( *waypoint << 4 ) - currentPos.vy; + *distY = ( ( *waypoint << 4 ) + 16 ) - currentPos.vy; if ( *distY > 0 ) { diff --git a/source/friend/friend.cpp b/source/friend/friend.cpp index b0a83b963..565cd5be0 100644 --- a/source/friend/friend.cpp +++ b/source/friend/friend.cpp @@ -166,8 +166,8 @@ CNpcFriend *CNpcFriend::Create(sThingActor *ThisActor) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = ( newYPos + 1 ) << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; friendNpc->init( startPos ); diff --git a/source/hazard/hazard.cpp b/source/hazard/hazard.cpp index 370cde12e..5ba327e1c 100644 --- a/source/hazard/hazard.cpp +++ b/source/hazard/hazard.cpp @@ -326,8 +326,8 @@ void CNpcHazard::setWaypoints( sThingHazard *ThisHazard ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; Pos = startPos; m_base = Pos; diff --git a/source/hazard/hfalling.cpp b/source/hazard/hfalling.cpp index db90fcf57..98b51542a 100644 --- a/source/hazard/hfalling.cpp +++ b/source/hazard/hfalling.cpp @@ -249,8 +249,8 @@ void CNpcFallingHazard::setWaypoints( sThingHazard *ThisHazard ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; Pos = startPos; m_base = Pos; diff --git a/source/hazard/hfirebal.cpp b/source/hazard/hfirebal.cpp index 0c2439e46..7d4540223 100644 --- a/source/hazard/hfirebal.cpp +++ b/source/hazard/hfirebal.cpp @@ -56,8 +56,8 @@ void CNpcFireballHazard::setWaypoints( sThingHazard *ThisHazard ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; Pos = startPos; m_base = Pos; diff --git a/source/hazard/hpendulm.cpp b/source/hazard/hpendulm.cpp index 17c936f7b..4556d72e6 100644 --- a/source/hazard/hpendulm.cpp +++ b/source/hazard/hpendulm.cpp @@ -47,8 +47,8 @@ void CNpcPendulumHazard::setWaypoints( sThingHazard *ThisHazard ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; if ( ThisHazard->PointCount > 1 ) { @@ -58,8 +58,8 @@ void CNpcPendulumHazard::setWaypoints( sThingHazard *ThisHazard ) PntList++; DVECTOR pivotPos; - pivotPos.vx = newXPos << 4; - pivotPos.vy = newYPos << 4; + pivotPos.vx = ( newXPos << 4 ) + 8; + pivotPos.vy = ( newYPos << 4 ) + 16; s32 xDist = startPos.vx - pivotPos.vx; s32 yDist = startPos.vy - pivotPos.vy; diff --git a/source/hazard/hpswitch.cpp b/source/hazard/hpswitch.cpp index 4959789e5..97c84675f 100644 --- a/source/hazard/hpswitch.cpp +++ b/source/hazard/hpswitch.cpp @@ -52,8 +52,8 @@ void CNpcPressureSwitchHazard::setWaypoints( sThingHazard *ThisHazard ) m_triggerPos.vy = newYPos; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; Pos = startPos; m_base = Pos; diff --git a/source/hazard/hrweight.cpp b/source/hazard/hrweight.cpp index 09ce5e031..8bf7d313d 100644 --- a/source/hazard/hrweight.cpp +++ b/source/hazard/hrweight.cpp @@ -47,8 +47,8 @@ void CNpcRisingWeightHazard::setWaypoints( sThingHazard *ThisHazard ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; Pos = startPos; m_base = Pos; @@ -60,7 +60,7 @@ void CNpcRisingWeightHazard::setWaypoints( sThingHazard *ThisHazard ) newYPos = (u16) *PntList; PntList++; - m_maxExtension = abs( ( newYPos << 4 ) - startPos.vy ) << 8; + m_maxExtension = abs( ( ( newYPos << 4 ) + 16 ) - startPos.vy ) << 8; // get slave trigger position diff --git a/source/hazard/hrwheel.cpp b/source/hazard/hrwheel.cpp index 8053e0968..350d0c3dd 100644 --- a/source/hazard/hrwheel.cpp +++ b/source/hazard/hrwheel.cpp @@ -49,8 +49,8 @@ void CNpcRisingWeightWheelHazard::setWaypoints( sThingHazard *ThisHazard ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; Pos = startPos; m_base = Pos; diff --git a/source/platform/pbaloon.cpp b/source/platform/pbaloon.cpp index a5c85d3c1..94c354258 100644 --- a/source/platform/pbaloon.cpp +++ b/source/platform/pbaloon.cpp @@ -138,8 +138,8 @@ void CNpcBalloonBridgePlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; init( startPos ); @@ -152,7 +152,7 @@ void CNpcBalloonBridgePlatform::setWaypoints( sThingPlatform *ThisPlatform ) newYPos = (u16) *PntList; PntList++; - m_maxExtension = abs( ( newYPos << 4 ) - startPos.vy ); + m_maxExtension = abs( ( ( newYPos << 4 ) + 16 ) - startPos.vy ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/platform/pbranch.cpp b/source/platform/pbranch.cpp index 182f6d41d..55375182a 100644 --- a/source/platform/pbranch.cpp +++ b/source/platform/pbranch.cpp @@ -73,8 +73,8 @@ void CNpcBranchPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; init( startPos ); diff --git a/source/platform/pbwheel.cpp b/source/platform/pbwheel.cpp index 148021c56..2d54c93cf 100644 --- a/source/platform/pbwheel.cpp +++ b/source/platform/pbwheel.cpp @@ -60,8 +60,8 @@ void CNpcBigWheelPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; if ( ThisPlatform->PointCount > 1 ) { @@ -71,8 +71,8 @@ void CNpcBigWheelPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR pivotPos; - pivotPos.vx = newXPos << 4; - pivotPos.vy = newYPos << 4; + pivotPos.vx = ( newXPos << 4 ) + 8; + pivotPos.vy = ( newYPos << 4 ) + 16; s32 xDist = startPos.vx - pivotPos.vx; s32 yDist = startPos.vy - pivotPos.vy; diff --git a/source/platform/pdual.cpp b/source/platform/pdual.cpp index 24bac5ffc..0846eee4f 100644 --- a/source/platform/pdual.cpp +++ b/source/platform/pdual.cpp @@ -64,8 +64,8 @@ void CNpcDualPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; init( startPos ); @@ -78,7 +78,7 @@ void CNpcDualPlatform::setWaypoints( sThingPlatform *ThisPlatform ) newYPos = (u16) *PntList; PntList++; - m_maxExtension = ( newYPos << 4 ) - startPos.vy; + m_maxExtension = ( ( newYPos << 4 ) + 16 ) - startPos.vy; ASSERT( m_maxExtension >= 0 ); @@ -90,7 +90,7 @@ void CNpcDualPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR slavePos; - slavePos.vx = newXPos << 4; + slavePos.vx = ( newXPos << 4 ) + 8; slavePos.vy = startPos.vy + m_maxExtension; m_otherPlatform->init( slavePos ); diff --git a/source/platform/plantern.cpp b/source/platform/plantern.cpp index 6334b2618..404b9bb58 100644 --- a/source/platform/plantern.cpp +++ b/source/platform/plantern.cpp @@ -45,8 +45,8 @@ void CNpcLanternPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; if ( ThisPlatform->PointCount > 1 ) { @@ -56,8 +56,8 @@ void CNpcLanternPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR pivotPos; - pivotPos.vx = newXPos << 4; - pivotPos.vy = newYPos << 4; + pivotPos.vx = ( newXPos << 4 ) + 8; + pivotPos.vy = ( newYPos << 4 ) + 16; s32 xDist = startPos.vx - pivotPos.vx; s32 yDist = startPos.vy - pivotPos.vy; diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index 6156fe5fb..70d8871e2 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -460,8 +460,8 @@ void CNpcPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; init( startPos ); diff --git a/source/platform/ppendulm.cpp b/source/platform/ppendulm.cpp index 8a57092b2..e74995978 100644 --- a/source/platform/ppendulm.cpp +++ b/source/platform/ppendulm.cpp @@ -62,8 +62,8 @@ void CNpcPendulumPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; if ( ThisPlatform->PointCount > 1 ) { @@ -73,8 +73,8 @@ void CNpcPendulumPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR pivotPos; - pivotPos.vx = newXPos << 4; - pivotPos.vy = newYPos << 4; + pivotPos.vx = ( newXPos << 4 ) + 8; + pivotPos.vy = ( newYPos << 4 ) + 16; s32 xDist = startPos.vx - pivotPos.vx; s32 yDist = startPos.vy - pivotPos.vy; diff --git a/source/platform/prbridge.cpp b/source/platform/prbridge.cpp index 60ebf5c1a..0fce30ccb 100644 --- a/source/platform/prbridge.cpp +++ b/source/platform/prbridge.cpp @@ -60,8 +60,8 @@ void CNpcRisingBridgePlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; init( startPos ); @@ -74,7 +74,7 @@ void CNpcRisingBridgePlatform::setWaypoints( sThingPlatform *ThisPlatform ) newYPos = (u16) *PntList; PntList++; - m_maxExtension = abs( ( newYPos << 4 ) - startPos.vy ) << 8; + m_maxExtension = abs( ( ( newYPos << 4 ) + 16 ) - startPos.vy ) << 8; // get slave trigger position @@ -87,7 +87,7 @@ void CNpcRisingBridgePlatform::setWaypoints( sThingPlatform *ThisPlatform ) // trigger = new ("PlatformTrigger") CPlatformTrigger(); trigger=(CPlatformTrigger*)CTrigger::Create(CTrigger::TRIGGER_PLATFORM); - trigger->setPositionAndSize( newXPos << 4, newYPos << 4, 100, 0 ); + trigger->setPositionAndSize( ( newXPos << 4 ) + 8, ( newYPos << 4 ) + 16, 100, 0 ); //trigger->setTargetBox(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4,TriggerList->TargetSize.X<<4,TriggerList->TargetSize.Y<<4); trigger->setPlatform( this ); } diff --git a/source/platform/ptrpdoor.cpp b/source/platform/ptrpdoor.cpp index 9ad0eb945..af608b105 100644 --- a/source/platform/ptrpdoor.cpp +++ b/source/platform/ptrpdoor.cpp @@ -56,8 +56,8 @@ void CNpcTrapdoorPlatform::setWaypoints( sThingPlatform *ThisPlatform ) PntList++; DVECTOR startPos; - startPos.vx = newXPos << 4; - startPos.vy = newYPos << 4; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; Pos = startPos; m_base = Pos; @@ -71,7 +71,7 @@ void CNpcTrapdoorPlatform::setWaypoints( sThingPlatform *ThisPlatform ) newYPos = (u16) *PntList; PntList++; - if ( ( newXPos << 4 ) > m_base.vx ) + if ( ( ( newXPos << 4 ) + 8 ) > m_base.vx ) { m_pointRight = true; }