bool CThunderCloud::isNearby(CSpriteObject &theObject) { if( CPlayerLevel *player = dynamic_cast<CPlayerLevel*>(&theObject) ) { const unsigned int cloudX = getXMidPos(); const unsigned int playXLeft = player->getXMidPos() - DIST_TO_AWAKE; const unsigned int playXRight = player->getXMidPos() + DIST_TO_AWAKE; if( playXLeft < cloudX && playXRight > cloudX ) { if( getActionStatus(A_CLOUD_ASLEEP) && getProbability(180) ) setAction(A_CLOUD_WAKING); } else { if( !getActionStatus(A_CLOUD_ASLEEP) ) { setAction(A_CLOUD_ASLEEP); setActionSprite(); return true; } } if( getActionStatus(A_CLOUD_WAKING) ) { if( player->getXMidPos() < getXMidPos() ) xDirection = LEFT; else xDirection = RIGHT; } if( getActionStatus(A_CLOUD_MOVING) ) { if( mpBolt == nullptr && player->getYMidPos() > getYMidPos() ) { const unsigned int playXStrikeLeft = player->getXMidPos() - DIST_TO_STRIKE; const unsigned int playXStrikeRight = player->getXMidPos() + DIST_TO_STRIKE; if( playXStrikeLeft < cloudX && playXStrikeRight > cloudX && (mTimer>TIME_TO_STRIKE_2 || (mSecondTry && mTimer>TIME_TO_STRIKE_1) ) ) { mTimer = 0; mSecondTry = !mSecondTry; setAction(A_CLOUD_STRIKING); playSound(SOUND_THUNDERCLOUD_STRIKE); mpBolt = new CThunderBolt( mp_Map, getXLeftPos() + (12<<STC), getYDownPos() + (32<<STC), mSprVar ); spawnObj( mpBolt ); } } } } return true; }
bool CMimrock::isNearby(CSpriteObject &theObject) { if(dead || theObject.dead || mTimer > 0 ) return true; if( !blockedd || getActionStatus(A_MIMROCK_JUMP) || getActionStatus(A_MIMROCK_BOUNCE) ) return true; if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) ) { const int dx = player->getXMidPos() - getXMidPos(); if( dx>-CSF_DISTANCE_TO_FOLLOW_TOLERANCE && dx<+CSF_DISTANCE_TO_FOLLOW_TOLERANCE ) { if( dx<0 ) xDirection = LEFT; else xDirection = RIGHT; if( !getProbability(40) ) return true; if( dx>-CSF_DISTANCE_TO_JUMP_TOLERANCE && dx<+CSF_DISTANCE_TO_JUMP_TOLERANCE ) { if( xDirection == -player->xDirection ) { setAction(A_MIMROCK_SIT); } else { yinertia = -JUMP_HEIGHT; mTimer = JUMP_TIME; setAction(A_MIMROCK_JUMP); } } else { if( xDirection == player->xDirection && !blockedr && !blockedl ) { setAction(A_MIMROCK_WALK); } else { setAction(A_MIMROCK_SIT); } } } } return true; }
void CShelly::processJump() { if( getActionStatus(A_SHELLY_WALK) ) { setAction(A_SHELLY_FALL); } if( getActionStatus(A_SHELLY_FALL) ) { setAction(A_SHELLY_FALL); } }
void COrbatrix::processLand() { if(getActionStatus(A_ORBATRIX_SLIDE)) { setAction(A_ORBATRIX_SLIDE); } }
void CArachnut::process() { performCollisions(); performGravityLow(); if( blockedl ) xDirection = RIGHT; else if( blockedr ) xDirection = LEFT; if( getActionStatus(A_ARACHNUT_WALK) ) setAction(A_ARACHNUT_WALK); if( getActionNumber(A_ARACHNUT_WALK) ) { // Move normally in the direction if( xDirection == RIGHT ) moveRight( WALK_SPEED ); else moveLeft( WALK_SPEED ); } if(!processActionRoutine()) exists = false; }
void CAmpton::processFlipSwitch() { if(getActionStatus(A_AMPTON_WALK)) { setAction(A_AMPTON_WALK); } }
void CDopeFish::processBurp() { if(!m_burped && getActionStatus(A_DOPEFISH_BURPING)) { g_pSound->playSound(SOUND_DOPEFISH_BURP); CBubbles *Bubble = new CBubbles(mp_Map, 0, getXMidPos()+(1<<CSF), getYMidPos()+(1<<CSF), true); g_pBehaviorEngine->m_EventList.add( new EventSpawnObject( Bubble ) ); m_burped = true; } if(getActionStatus(A_DOPEFISH_BURP_FINISHED)) { setAction(A_DOPEFISH_SWIM); mp_processState = &CDopeFish::processSwim; } }
void CAmpton::processTurn() { if(getActionStatus(A_AMPTON_WALK)) { setAction(A_AMPTON_WALK); } }
void CAmpton::processStopPole() { if(getActionStatus(A_AMPTON_WALK)) { setAction(A_AMPTON_WALK); } }
void CMimrock::getTouchedBy(CSpriteObject &theObject) { if( getActionStatus(A_MIMROCK_SIT) ) return; if(dead || theObject.dead) return; CStunnable::getTouchedBy(theObject); // Was it a bullet? Than make it stunned. if( dynamic_cast<CBullet*>(&theObject) ) { setAction( A_MIMROCK_STUNNED ); honorPriority = false; theObject.dead = true; dead = true; } if( getActionNumber(A_MIMROCK_WALK) || getActionNumber(A_MIMROCK_JUMP) || getActionNumber(A_MIMROCK_BOUNCE) ) { if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) ) player->kill(); } }
void COrbatrix::processCurl() { if(getActionStatus(A_ORBATRIX_BOUNCE)) { yinertia = MAX_BOUNCE_BOOST; setAction(A_ORBATRIX_BOUNCE); } }
void CCouncilMember::processThinking() { if( getActionStatus(A_COUNCIL_MEMBER_MOVE) ) { setAction(A_COUNCIL_MEMBER_MOVE); mp_processState = &CCouncilMember::processWalking; } }
void CThunderCloud::processWaking() { if( getActionStatus(A_CLOUD_MOVING) ) { mTimer = 0; setAction(A_CLOUD_MOVING); } }
void CKorath::processSitting() { xDirection = getProbability(500) ? RIGHT : LEFT; if(getActionStatus(A_KORATH_WALK)) { setAction(A_KORATH_WALK); } }
void CBip::processStanding() { mTimer++; if(getActionStatus(A_BIP_WALK)) setAction(A_BIP_WALK); mTimer = 0; }
void CSkypest::processOnFloor() { if(getActionStatus(A_SKYPEST_FLY)) { mp_processState = &CSkypest::processFly; blockedu = blockedd = false; blockedl = blockedr = false; setAction(A_SKYPEST_FLY); } }
void CLick::processBreathe() { // Breathe for a brief moment m_timer--; if(getActionStatus(A_LICK_HOP+2)) { mp_processState = (void (CStunnable::*)()) (&CLick::processHop); setAction( A_LICK_HOP ); } }
void CSkypest::processOnFloor() { if(getActionStatus(A_SKYPEST_FLY)) // it is not set right, so we do it here! { mp_processState = &CSkypest::processFly; blockedu = blockedd = false; blockedl = blockedr = false; setAction(A_SKYPEST_FLY); } }
void CBlooguard::processClubbing() { if( getActionStatus(A_BLOOGUARD_WALK) ) { // At this point Keen must get stunned! mStubPlayer = true; setAction(A_BLOOGUARD_WALK); playSound(SOUND_BLOOGGUARD_STUB); } }
void CLick::processBreathe() { // Breathe for a brief moment m_timer--; if(getActionStatus(A_LICK_HOP+2) || m_timer <= 0) { m_timer = LICK_HOP_TIME; setAction( A_LICK_HOP ); yinertia = -LICK_HOP_Y_SPEED; } }
void CMimrock::processWalk() { if(m_hDir == LEFT) moveLeft(WALK_SPEED); else moveRight(WALK_SPEED); if(getActionStatus(A_MIMROCK_SIT)) { setAction(A_MIMROCK_SIT); mp_processState = (void (CStunnable::*)()) &CMimrock::processSit; } }
void CThunderCloud::processStriking() { if( getActionStatus(A_CLOUD_STRIKING+1) ) { setAction(A_CLOUD_STRIKING); } if( mpBolt == NULL && mTimer > STRIKE_TIME) { mTimer = 0; setAction(A_CLOUD_MOVING); setActionSprite(); } }
bool CSkypest::isNearby(CObject &theObject) { if(getActionStatus(A_SKYPEST_LICKEYES)) { if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) ) { const int dx = player->getXMidPos() - getXMidPos(); if( dx<0 ) m_hDir = LEFT; else m_hDir = RIGHT; } } return true; }
void CSparky::processLook() { if(getActionStatus(A_SPARKY_WALK)) { if(mGoodChargeChance) { xDirection = mKeenAlignment; setAction(A_SPARKY_CHARGE); playSound(SOUND_SPARKY_CHARGE); } else if(mKeenAlignment != xDirection) setAction(A_SPARKY_TURN); else setAction(A_SPARKY_WALK); } }
void CMimrock::processWalk() { if(xDirection == LEFT) { moveLeft(WALK_SPEED); } else { moveRight(WALK_SPEED); } if(getActionStatus(A_MIMROCK_SIT)) { setAction(A_MIMROCK_SIT); } }
bool COrbatrix::isNearby(CSpriteObject &theObject) { if(!getActionStatus(A_ORBATRIX_FLOAT)) return true; if( CPlayerLevel *player = dynamic_cast<CPlayerLevel*>(&theObject) ) { if( getProbability(600) ) { if( player->getXMidPos() < getXMidPos() ) xDirection = LEFT; else xDirection = RIGHT; } } return true; }
void CArachnut::getTouchedBy(CSpriteObject &theObject) { if( theObject.mIsDead || getActionStatus(A_ARACHNUT_STUNNED) ) return; if( CBullet *bullet = dynamic_cast<CBullet*>(&theObject) ) { bullet->setAction(A_KEENSHOT_IMPACT); bullet->playSound( SOUND_SHOT_HIT ); setAction(A_ARACHNUT_STUNNED); } if(getActionNumber(A_ARACHNUT_STUNNED)) return; if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) ) { player->kill(); } }
void CInchWorm::process() { performCollisions(); performGravityLow(); if(!processActionRoutine()) exists = false; if( blockedl ) xDirection = RIGHT; else if(blockedr) xDirection = LEFT; if(!getActionStatus(0)) return; // Move normally in the direction if( xDirection == RIGHT ) moveRight( (m_Action.h_anim_move>>3)*((rand()%2)+1) ); else
void CSkypest::getTouchedBy(CObject &theObject) { if(dead || theObject.dead) return; // When Keen touches the Council Member exit the level and add one to the council list if( CPlayerLevel *Player = dynamic_cast<CPlayerLevel*>(&theObject) ) { // Check if player is using pogo and Skypest is licking if( getActionStatus(A_SKYPEST_LICKEYES) || Player->isPogoing() ) { dead = true; playSound(SOUND_SQUISH_SKYPEST); setAction(A_SKYPEST_SQUISHED); } else { // else Keen will die Player->kill(); } } }
void CShelly::processPrepareJump() { if(getActionStatus(A_SHELLY_JUMP)) { if(xDirection != mKeenAlignment) { xDirection = mKeenAlignment; setAction(A_SHELLY_WALK); return; } if(mGoodJumpChance) { setAction(A_SHELLY_JUMP); yinertia = -MAX_JUMP_INERTIA; } else { setAction(A_SHELLY_WALK); } } }