Example #1
0
int sceneHandler29(ExCommand *cmd) {
	if (cmd->_messageKind != 17)
		return 0;

	switch (cmd->_messageNum) {
	case MSG_CMN_WINARCADE:
		sceneHandler29_winArcade();
		break;

	case MSG_SC29_LAUGH:
		if (g_vars->scene29_hitBall == ANI_SHELL_GREEN) {
			g_fp->playSound(SND_29_028, 0);
			break;
		}

		g_fp->playSound(SND_29_029, 0);

		break;

	case MSG_SC29_SHOWLASTRED:
		if (g_vars->scene29_redBalls.numBalls) { // original uses scene29_balls which looks like a copy/paste error
			g_vars->scene29_redBalls.field_8->ani->show1(-1, -1, -1, 0);
			g_vars->scene29_redBalls.field_8->ani->startAnim(MV_SHR_HITASS, 0, -1);
		}

		break;

	case MSG_SC29_SHOOTGREEN:
		sceneHandler29_shootGreen();
		break;

	case MSG_SC29_SHOOTRED:
		sceneHandler29_shootRed();
		break;

	case MSG_SC29_SHOWLASTGREEN:
		if (g_vars->scene29_balls.numBalls) {
			g_vars->scene29_balls.field_8->ani->show1(-1, -1, -1, 0);
			g_vars->scene29_balls.field_8->ani->startAnim(MV_SHG_HITASS, 0, -1);
		}

		break;

	case MSG_SC29_STOPRIDE:
		g_vars->scene29_manIsRiding = false;
		g_vars->scene29_arcadeIsOn = false;
		g_vars->scene29_reachedFarRight = false;
		g_vars->scene29_rideBackEnabled = false;

		getCurrSceneSc2MotionController()->activate();
		getGameLoaderInteractionController()->enableFlag24();
		break;

	case MSG_SC29_DISABLERIDEBACK:
		g_vars->scene29_rideBackEnabled = false;
		break;

	case MSG_SC29_ENABLERIDEBACK:
		g_vars->scene29_rideBackEnabled = true;
		g_vars->scene29_reachedFarRight = false;
		break;

	case MSG_SC29_DISABLEPORTER:
		g_vars->scene29_reachedFarRight = false;
		break;

	case MSG_SC29_ENABLEPORTER:
		g_vars->scene29_reachedFarRight = true;
		g_vars->scene29_rideBackEnabled = false;
		g_vars->scene29_manIsHit = false;
		break;

	case 29:
		if (!g_vars->scene29_manIsRiding || g_vars->scene29_arcadeIsOn) {
			if (!g_vars->scene29_arcadeIsOn) {
				StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y);

				if (ani && ani == g_vars->scene29_porter) {
					sceneHandler29_clickPorter(cmd);

					cmd->_messageKind = 0;
					break;
				}
				break;
			}

			sceneHandler29_manJump();

			cmd->_messageKind = 0;
			break;
		}
		break;

	case 107:
		if (g_vars->scene29_arcadeIsOn)
			sceneHandler29_manBend();

		break;

	case 33:
		if (g_vars->scene29_arcadeIsOn) {
			if (g_vars->scene29_manX > g_fp->_sceneRect.right - 500)
				g_fp->_currentScene->_x = g_fp->_sceneRect.right - g_vars->scene29_manX - 350;

			if (g_vars->scene29_manX < g_fp->_sceneRect.left + 100)
				g_fp->_currentScene->_x = g_vars->scene29_manX - g_fp->_sceneRect.left - 100;

		} else if (g_fp->_aniMan2) {
			int x = g_fp->_aniMan2->_ox;

			if (x < g_fp->_sceneRect.left + 300)
				g_fp->_currentScene->_x = x - 400 - g_fp->_sceneRect.left;

			if (x > g_fp->_sceneRect.right - 300)
				g_fp->_currentScene->_x = x + 400 - g_fp->_sceneRect.right;
		}

		g_vars->scene29_manX = g_fp->_aniMan->_ox;
		g_vars->scene29_manY = g_fp->_aniMan->_oy;

		sceneHandler29_ballHitCheck();

		if (!g_vars->scene29_porter->_movement)
			g_vars->scene29_porter->startAnim(MV_PTR_MOVEFAST, 0, -1);

		if (g_vars->scene29_manIsRiding)
			sceneHandler29_manFromL();
		else if (g_vars->scene29_arcadeIsOn && !g_fp->_aniMan->_movement)
			sceneHandler29_shootersProcess();

		if (g_vars->scene29_reachedFarRight)
			sceneHandler29_shootersEscape();
		else if (g_vars->scene29_rideBackEnabled)
			sceneHandler29_manRideBack();

		g_vars->scene29_shootCountdown++;

		if (g_vars->scene29_shootCountdown > g_vars->scene29_shootDistance)
			sceneHandler29_shoot();

		sceneHandler29_animBearded();

		g_fp->_behaviorManager->updateBehaviors();
		g_fp->startSceneTrack();

		break;
	}

	return 0;
}
Example #2
0
int sceneHandler29(ExCommand *cmd) {
	if (cmd->_messageKind != 17)
		return 0;

	switch (cmd->_messageNum) {
	case MSG_CMN_WINARCADE:
		sceneHandler29_winArcade();
		break;

	case MSG_SC29_LAUGH:
		if (g_vars->scene29_var18 == ANI_SHELL_GREEN) {
			g_fp->playSound(SND_29_028, 0);
			break;
		}

		g_fp->playSound(SND_29_029, 0);

		break;

	case MSG_SC29_SHOWLASTRED:
		if (g_vars->scene29_var05.numBalls) {
			g_vars->scene29_var06.field_8->ani->show1(-1, -1, -1, 0);
			g_vars->scene29_var06.field_8->ani->startAnim(MV_SHR_HITASS, 0, -1);
		}

		break;

	case MSG_SC29_SHOOTGREEN:
		sceneHandler29_shootGreen();
		break;

	case MSG_SC29_SHOOTRED:
		sceneHandler29_shootRed();
		break;

	case MSG_SC29_SHOWLASTGREEN:
		if (g_vars->scene29_var05.numBalls) {
			g_vars->scene29_var05.field_8->ani->show1(-1, -1, -1, 0);
			g_vars->scene29_var05.field_8->ani->startAnim(MV_SHG_HITASS, 0, -1);
		}

		break;

	case MSG_SC29_STOPRIDE:
		g_vars->scene29_var09 = 0;
		g_vars->scene29_var10 = 0;
		g_vars->scene29_var11 = 0;
		g_vars->scene29_var12 = 0;

		getCurrSceneSc2MotionController()->setEnabled();
		getGameLoaderInteractionController()->enableFlag24();
		break;

	case MSG_SC29_DISABLERIDEBACK:
		g_vars->scene29_var12 = 0;
		break;

	case MSG_SC29_ENABLERIDEBACK:
		g_vars->scene29_var12 = 1;
		g_vars->scene29_var11 = 0;
		break;

	case MSG_SC29_DISABLEPORTER:
		g_vars->scene29_var11 = 0;
		break;

	case MSG_SC29_ENABLEPORTER:
		g_vars->scene29_var11 = 1;
		g_vars->scene29_var12 = 0;
		g_vars->scene29_var15 = 0;
		break;

	case 29:
		if (!g_vars->scene29_var09 || g_vars->scene29_var10) {
			if (!g_vars->scene29_var10) {
				StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y);

				if (ani && ani == g_vars->scene29_porter) {
					sceneHandler29_clickPorter(cmd);

					cmd->_messageKind = 0;
					break;
				}
				break;
			}

			sceneHandler29_manJump();

			cmd->_messageKind = 0;
			break;
		}
		break;

	case 107:
		if (g_vars->scene29_var10)
			sceneHandler29_manBend();

		break;

	case 33:
		if (g_vars->scene29_var10) {
			if (g_vars->scene29_var20 > g_fp->_sceneRect.right - 500)
				g_fp->_currentScene->_x = g_fp->_sceneRect.right - g_vars->scene29_var20 - 350;

			if (g_vars->scene29_var20 < g_fp->_sceneRect.left + 100)
				g_fp->_currentScene->_x = g_vars->scene29_var20 - g_fp->_sceneRect.left - 100;

		} else if (g_fp->_aniMan2) {
			int x = g_fp->_aniMan2->_ox;

			if (x < g_fp->_sceneRect.left + g_vars->scene29_var01)
				g_fp->_currentScene->_x = x - g_vars->scene29_var03 - g_fp->_sceneRect.left;

			if (x > g_fp->_sceneRect.right - g_vars->scene29_var01)
				g_fp->_currentScene->_x = x + g_vars->scene29_var03 - g_fp->_sceneRect.right;
		}

		g_vars->scene29_var20 = g_fp->_aniMan->_ox;
		g_vars->scene29_var21 = g_fp->_aniMan->_oy;

		sceneHandler29_sub03();

		if (!g_vars->scene29_porter->_movement)
			g_vars->scene29_porter->startAnim(MV_PTR_MOVEFAST, 0, -1);

		if (g_vars->scene29_var09)
			sceneHandler29_manFromL();
		else if (g_vars->scene29_var10 && !g_fp->_aniMan->_movement)
			sceneHandler29_sub05();

		if (g_vars->scene29_var11)
			sceneHandler29_shootersEscape();
		else if (g_vars->scene29_var12)
			sceneHandler29_sub07();

		g_vars->scene29_var13++;

		if (g_vars->scene29_var13 > g_vars->scene29_var14)
			sceneHandler29_shoot();

		sceneHandler29_animBearded();

		g_fp->_behaviorManager->updateBehaviors();
		g_fp->startSceneTrack();

		break;
	}

	return 0;
}