diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 37ed21889..a45d60b7b 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -156,6 +156,8 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = DAMAGE__NONE, 0, NPC_PLATFORM_INFINITE_LIFE, + 0, + NPC_PLATFORM_TIMER_NONE, }, { // NPC_CIRCULAR_PLATFORM @@ -168,6 +170,8 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = DAMAGE__NONE, 0, NPC_PLATFORM_INFINITE_LIFE, + 0, + NPC_PLATFORM_TIMER_NONE, }, { // NPC_BUBBLE_PLATFORM @@ -179,7 +183,79 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = true, DAMAGE__NONE, 0, + NPC_PLATFORM_FINITE_LIFE_RESPAWN, + 0, + NPC_PLATFORM_TIMER_NONE, + }, + + { // NPC_COLLAPSING_BUBBLE_PLATFORM + ACTORS_CLAM_SBK, + ANIM_CLAM_SIDESNAP, + NPC_PLATFORM_MOVEMENT_STATIC, + 3, + 128, + true, + DAMAGE__NONE, + 0, + NPC_PLATFORM_INFINITE_LIFE_COLLAPSIBLE, + 0, + NPC_PLATFORM_TIMER_NONE, + }, + + { // NPC_FISH_HOOK_PLATFORM + ACTORS_CLAM_SBK, + ANIM_CLAM_SIDESNAP, + NPC_PLATFORM_MOVEMENT_STATIC, + 3, + 128, + true, + DAMAGE__NONE, + 0, + NPC_PLATFORM_INFINITE_LIFE_FISH_HOOK, + 0, + NPC_PLATFORM_TIMER_NONE, + }, + + { // NPC_RETRACTING_PLATFORM + ACTORS_CLAM_SBK, + ANIM_CLAM_SIDESNAP, + NPC_PLATFORM_MOVEMENT_STATIC, + 3, + 128, + true, + DAMAGE__NONE, + 0, + NPC_PLATFORM_INFINITE_LIFE, + 0, + NPC_PLATFORM_TIMER_RETRACT, + }, + + { // NPC_GEYSER_PLATFORM + ACTORS_CLAM_SBK, + ANIM_CLAM_SIDESNAP, + NPC_PLATFORM_MOVEMENT_STATIC, + 8, + 128, + true, + DAMAGE__NONE, + 0, + NPC_PLATFORM_INFINITE_LIFE, + 4, + NPC_PLATFORM_TIMER_GEYSER, + }, + + { // NPC_PLAYER_BUBBLE_PLATFORM + ACTORS_CLAM_SBK, + ANIM_CLAM_SIDESNAP, + NPC_PLATFORM_MOVEMENT_PLAYER_BUBBLE, + 3, + 128, + true, + DAMAGE__NONE, + 0, NPC_PLATFORM_FINITE_LIFE, + 0, + NPC_PLATFORM_TIMER_NONE, }, }; diff --git a/source/enemy/npcpath.cpp b/source/enemy/npcpath.cpp index 2d7c9c3e4..d4d884006 100644 --- a/source/enemy/npcpath.cpp +++ b/source/enemy/npcpath.cpp @@ -43,7 +43,7 @@ void CNpcPath::initPath() lastWaypoint = NULL; waypointCount = 0; reversePath = false; - minX = maxX = 0; + minX = maxX = minY = maxY = 0; } void CNpcPath::resetPath() @@ -84,6 +84,15 @@ void CNpcPath::addWaypoint( DVECTOR newPos ) { maxX = newPos.vx; } + + if ( newPos.vy < minY ) + { + minY = newPos.vy; + } + else if ( newPos.vy > maxY ) + { + maxY = newPos.vy; + } } else { @@ -99,7 +108,7 @@ void CNpcPath::addWaypoint( DVECTOR newPos ) currentWaypoint = this->waypoint; - minX = maxX = newPos.vx; + minX = maxX = minY = maxY = newPos.vx; } } @@ -109,6 +118,12 @@ void CNpcPath::getPathXExtents( s32 *minExtent, s32 *maxExtent ) *maxExtent = maxX; } +void CNpcPath::getPathYExtents( s32 *minExtent, s32 *maxExtent ) +{ + *minExtent = minY; + *maxExtent = maxY; +} + void CNpcPath::removeAllWaypoints() { CNpcWaypoint *testWaypoint; @@ -289,5 +304,47 @@ bool CNpcPath::thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *headi *heading = 2048; } + return( pointChange ); +} + +bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading ) +{ + bool pointChange = false; + + if ( !this->waypoint ) + { + return( true ); + } + + if ( !currentWaypoint ) + { + // if no currentWaypoint set, start it off + + currentWaypoint = this->waypoint; + } + + *distX = currentWaypoint->pos.vx - currentPos.vx; + *distY = currentWaypoint->pos.vy - currentPos.vy; + + *pathComplete = false; + + if ( abs( *distY ) < 10 ) + { + pointChange = true; + *pathComplete = incPath(); + } + + *distX = currentWaypoint->pos.vx - currentPos.vx; + *distY = currentWaypoint->pos.vy - currentPos.vy; + + if ( *distY > 0 ) + { + *heading = 1024; + } + else + { + *heading = 3072; + } + return( pointChange ); } \ No newline at end of file diff --git a/source/enemy/npcpath.h b/source/enemy/npcpath.h index 0df295f82..d44d044cd 100644 --- a/source/enemy/npcpath.h +++ b/source/enemy/npcpath.h @@ -45,8 +45,10 @@ public: void reversePathDir(); s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange ); bool thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *heading ); + bool thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading ); bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY ); void getPathXExtents( s32 *minExtent, s32 *maxExtent ); + void getPathYExtents( s32 *minExtent, s32 *maxExtent ); private: CNpcWaypoint *waypoint; @@ -56,6 +58,7 @@ private: CNpcWaypoint *currentWaypoint; CNpcWaypoint *lastWaypoint; s32 minX, maxX; + s32 minY, maxY; }; #endif \ No newline at end of file diff --git a/source/player/pmbubble.cpp b/source/player/pmbubble.cpp index 3c346f862..00206fe96 100644 --- a/source/player/pmbubble.cpp +++ b/source/player/pmbubble.cpp @@ -105,7 +105,7 @@ void CPlayerModeBubbleMixture::think() CNpcPlatform *bubble; DVECTOR pos; bubble=new ("bubble platform") CNpcPlatform; - bubble->setType( CNpcPlatform::NPC_BUBBLE_PLATFORM ); + bubble->setType( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM ); pos=m_player->getPos(); pos.vx+=buboff.vx*m_player->getFacing(); pos.vy+=buboff.vy;