Exemple #1
0
void sceneHandler16_drink() {
	if (g_vars->scene16_mug->_flags & 4) {
		if (!g_vars->scene16_jettie->_movement) {
			if (!g_vars->scene16_walkingBoy || !g_vars->scene16_walkingBoy->_movement || g_vars->scene16_walkingBoy->_movement->_id != MV_BOY_DRINK) {
				if (!g_vars->scene16_walkingGirl || !g_vars->scene16_walkingGirl->_movement || g_vars->scene16_walkingGirl->_movement->_id != MV_GRL_DRINK) {
					if (g_vars->scene16_mug->_statics->_staticsId == ST_MUG_FULL) {
						MessageQueue *mq;
						ExCommand *ex;

						if (g_vars->scene16_walkingBoy) {
							g_fp->_aniMan->_flags |= 0x180;

							g_vars->scene16_walkingBoy->changeStatics2(ST_BOY_STAND);
							g_vars->scene16_walkingBoy->queueMessageQueue(0);

							mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYKICK), 0, 1);

							mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode);

							ex = new ExCommand(ANI_MAN, 34, 384, 0, 0, 0, 1, 0, 0, 0);
							ex->_excFlags |= 3u;
							ex->_field_14 = 384;
							ex->_messageNum = 0;

							mq->insertExCommandAt(2, ex);
							mq->setFlags(mq->getFlags() | 1);
							mq->chain(0);
						} else {
							g_fp->_aniMan->_flags |= 1;

							mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_MANDRINK), 0, 1);

							ex = new ExCommand(ANI_MAN, 34, 256, 0, 0, 0, 1, 0, 0, 0);
							ex->_excFlags |= 3u;
							ex->_field_14 = 256;
							ex->_messageNum = 0;

							mq->addExCommandToEnd(ex);
							mq->setFlags(mq->getFlags() | 1);
							mq->chain(0);

							g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1)->changeStatics2(ST_GRL_STAND);
						}

						g_fp->_currentScene->getStaticANIObject1ById(ANI_WIRE16, -1)->show1(-1, -1, -1, 0);
					} else {
						chainObjQueue(g_fp->_aniMan, QU_SC16_TAKEMUG, 1);
					}
				}
			}
		}
	}
}
Exemple #2
0
bool MessageQueue::checkGlobalExCommandList1() {
	ExCommand *ex, *ex1;

	for (uint i = 0; i < getCount(); i++) {
		ex = getExCommandByIndex(i);

		if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27)
			continue;

		for (Common::List<ExCommand *>::iterator it = g_fullpipe->_exCommandList.begin(); it != g_fullpipe->_exCommandList.end(); it++) {
			ex1 = *it;

			if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27)
				continue;

			if (ex1->_keyCode != ex->_keyCode && ex1->_keyCode != -1 && ex->_keyCode != -1)
				continue;

			MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex1->_parId);

			if (mq) {
				if (mq->getFlags() & 1)
					return false;
			}
		}
	}
	return true;
}
Exemple #3
0
void sceneHandler27_batLogic() {
    if (g_vars->scene27_balls.size()) {
        g_vars->scene27_bat = g_vars->scene27_balls[0];

        g_vars->scene27_balls.remove_at(0);

        int mv;

        switch (g_vars->scene27_batHandler->_statics->_staticsId) {
        case ST_BTH_5:
            mv = MV_BTH_5_4;
            break;

        case ST_BTH_4:
            mv = MV_BTH_4_3;
            break;

        case ST_BTH_3:
            mv = MV_BTH_3_2;
            break;

        case ST_BTH_2:
            mv = MV_BTH_2_1;
            break;

        case ST_BTH_1:
            mv = MV_BTH_1_0;
            break;

        default:
            chainQueue(QU_SC27_RESTARTBETS, 1);

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

            g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);

            return;
        }

        MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());

        mq->setFlags(mq->getFlags() | 1);

        ExCommand *ex = new ExCommand(g_vars->scene27_batHandler->_id, 1, mv, 0, 0, 0, 1, 0, 0, 0);
        ex->_excFlags |= 2;
        mq->addExCommandToEnd(ex);

        ex = new ExCommand(0, 17, MSG_SC27_CLICKBET, 0, 0, 0, 1, 0, 0, 0);
        ex->_excFlags |= 3;
        mq->addExCommandToEnd(ex);

        mq->chain(0);
    } else {
        g_vars->scene27_bat = 0;
    }
}
Exemple #4
0
void sceneHandler26_animateVents(StaticANIObject *ani) {
    int qId = 0;

    switch (ani->_okeyCode) {
    case 0:
        if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Closed))
            qId = QU_SC26_OPEN1;
        else
            qId = QU_SC26_CLOSE1;

        break;

    case 1:
        if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Closed))
            qId = QU_SC26_OPEN2;
        else
            qId = QU_SC26_CLOSE2;

        break;

    case 2:
        if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Closed))
            qId = QU_SC26_OPEN3;
        else
            qId = QU_SC26_CLOSE3;

        break;

    case 3:
        if (g_fp->getObjectState(sO_Valve4_26) == g_fp->getObjectEnumState(sO_Valve4_26, sO_Closed))
            qId = QU_SC26_OPEN4;
        else
            qId = QU_SC26_CLOSE4;

        break;

    case 4:
        if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed))
            qId = QU_SC26_OPEN5;
        else
            qId = QU_SC26_CLOSE5;

        break;

    default:
        return;
    }

    if (qId) {
        MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(qId);

        mq->setFlags(mq->getFlags() | 1);
        mq->chain(0);
    }
}
Exemple #5
0
void sceneHandler08_jumpOff(ExCommand *cmd) {
	MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());

	mq->addExCommandToEnd(cmd->createClone());
	mq->setFlags(mq->getFlags() | 1);

	g_fp->_globalMessageQueueList->addMessageQueue(mq);

	g_fp->_aniMan->startAnim(MV_MAN8_JUMPOFF, mq->_id, -1);

	sceneHandler08_finishArcade();
}
Exemple #6
0
void sceneHandler11_hitMan() {
	if (g_fp->_aniMan->_ox > 345 && g_fp->_aniMan->_ox < 355) {
		g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);

		MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC11_MANFALL), 0, 0);

		mq->setFlags(mq->getFlags() | 1);
		if (!mq->chain(g_fp->_aniMan))
			delete mq;

		getCurrSceneSc2MotionController()->replaceNodeX(353, 303);
	}
}
Exemple #7
0
void sceneHandler16_startLaugh() {
	StaticANIObject *girl = g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1);

	girl->changeStatics2(ST_GRL_STAND);

	MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLLAUGH), 0, 1);

	mq->replaceKeyCode(-1, girl->_okeyCode);
	mq->setFlags(mq->getFlags() | 1);
	mq->chain(0);

	g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->setSubVarAsInt(sO_DudeSwinged, 0);

	g_vars->scene16_girlIsLaughing = true;
}
Exemple #8
0
void sceneHandler29_manHit() {
	MGMInfo mgminfo;

	g_vars->scene29_var15 = 1;

	g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR);
	g_fp->_aniMan->setOXY(g_vars->scene29_var20, g_vars->scene29_var21);

	mgminfo.ani = g_fp->_aniMan;
	mgminfo.staticsId2 = ST_MAN29_SITR;
	mgminfo.y1 = 463;
	mgminfo.x1 = g_vars->scene29_var20 <= 638 ? 351 : 0;
	mgminfo.field_1C = 10;
	mgminfo.field_10 = 1;
	mgminfo.flags = (g_vars->scene29_var20 <= 638 ? 2 : 0) | 0x44;
	mgminfo.movementId = MV_MAN29_HIT;

	MessageQueue *mq = g_vars->scene29_mgm.genMovement(&mgminfo);
	ExCommand *ex;

	if (mq) {
		if (g_vars->scene29_var20 <= 638) {
			ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP_NORM, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags = 2;
			ex->_keyCode = g_fp->_aniMan->_okeyCode;
			mq->addExCommandToEnd(ex);

			ex = new ExCommand(0, 17, MSG_SC29_STOPRIDE, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags = 2;
			mq->addExCommandToEnd(ex);

			g_vars->scene29_var09 = 0;
			g_vars->scene29_var10 = 0;
			g_vars->scene29_var11 = 0;
			g_vars->scene29_var12 = 0;
		} else {
			ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags = 2;
			ex->_keyCode = g_fp->_aniMan->_okeyCode;
			mq->addExCommandToEnd(ex);
		}

		mq->setFlags(mq->getFlags() | 1);

		if (!mq->chain(g_fp->_aniMan))
			delete mq;
	}
}
Exemple #9
0
void sceneHandler29_manHit() {
	MGMInfo mgminfo;

	g_vars->scene29_manIsHit = true;

	g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR);
	g_fp->_aniMan->setOXY(g_vars->scene29_manX, g_vars->scene29_manY);

	mgminfo.ani = g_fp->_aniMan;
	mgminfo.staticsId2 = ST_MAN29_SITR;
	mgminfo.y1 = 463;
	mgminfo.x1 = g_vars->scene29_manX <= 638 ? 351 : 0;
	mgminfo.field_1C = 10;
	mgminfo.field_10 = 1;
	mgminfo.flags = (g_vars->scene29_manX <= 638 ? 2 : 0) | 0x44;
	mgminfo.movementId = MV_MAN29_HIT;

	MessageQueue *mq = g_vars->scene29_mgm.genMovement(&mgminfo);
	ExCommand *ex;

	if (mq) {
		if (g_vars->scene29_manX <= 638) {
			ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP_NORM, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags = 2;
			ex->_keyCode = g_fp->_aniMan->_okeyCode;
			mq->addExCommandToEnd(ex);

			ex = new ExCommand(0, 17, MSG_SC29_STOPRIDE, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags = 2;
			mq->addExCommandToEnd(ex);

			g_vars->scene29_manIsRiding = false;
			g_vars->scene29_arcadeIsOn = false;
			g_vars->scene29_reachedFarRight = false;
			g_vars->scene29_rideBackEnabled = false;
		} else {
			ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags = 2;
			ex->_keyCode = g_fp->_aniMan->_okeyCode;
			mq->addExCommandToEnd(ex);
		}

		mq->setFlags(mq->getFlags() | 1);

		if (!mq->chain(g_fp->_aniMan))
			delete mq;
	}
}
Exemple #10
0
bool sceneHandler14_arcadeProcessClick(ExCommand *cmd) {
	if (!getCurrSceneSc2MotionController()->_isEnabled)
		return 0;

	if (!g_vars->scene14_grandmaIsHere) {
		if (!cmd->_keyCode) {
			if (g_vars->scene14_pink) {
				if (g_vars->scene14_pink->_flags & 4) {
					if (cmd->_sceneClickX < g_vars->scene14_pink->_ox + 40) {
						handleObjectInteraction(g_fp->_aniMan, g_vars->scene14_pink, 0);
						cmd->_messageKind = 0;
						return true;
					}
				}
			}
		}
		return false;
	}

	if (getCurrSceneSc2MotionController()->_objtype != kObjTypeMctlCompound)
		return false;

	if (!getCurrSceneSc2MotionController()->_motionControllers[0]->_movGraphReactObj->pointInRegion(cmd->_sceneClickX, cmd->_sceneClickY))
		return false;

	if (cmd->_sceneClickX > 1237)
		return false;

	MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 1237, 451, 1, 0);

	if (!mq)
		return false;

	ExCommand *ex = new ExCommand(0, 17, MSG_SC14_STARTARCADE, 0, 0, 0, 1, 0, 0, 0);

	ex->_excFlags |= 3;
	mq->addExCommandToEnd(ex);
	mq->setFlags(mq->getFlags() | 1);

	postExCommand(g_fp->_aniMan->_id, 2, 1237, 451, 0, -1);

	cmd->_messageKind = 0;

	getCurrSceneSc2MotionController()->deactivate();
	getGameLoaderInteractionController()->disableFlag24();
	return true;
}
Exemple #11
0
void sceneHandler32_ladderLogic(ExCommand *cmd) {
	MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC32_FROMLADDER), 0, 0);

	if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) != PIC_SC32_LADDER)
		mq->addExCommandToEnd(cmd->createClone());

	mq->setFlags(mq->getFlags() | 1);

	g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER);
	if (!mq->chain(g_fp->_aniMan))
		delete mq;

	g_vars->scene32_dudeOnLadder = false;

	getCurrSceneSc2MotionController()->activate();
	getGameLoaderInteractionController()->enableFlag24();
}
Exemple #12
0
void sceneHandler11_swingieJumpDown() {
    MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SWR_JUMPDOWN), 0, 0);

	mq->setFlags(mq->getFlags() | 1);

	if (!mq->chain(g_vars->scene11_swingie))
		delete mq;

	g_vars->scene11_swingIsSwinging = false;
	g_vars->scene11_swingieStands = true;
	g_vars->scene11_swingieScreenEdge = g_fp->_sceneRect.left;

	getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0);
	getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 1);
	getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 0);

	getCurrSceneSc2MotionController()->replaceNodeX(905, 805);
}
Exemple #13
0
void sceneHandler08_badLuck() {
	g_fp->_currentScene->getPictureObjectById(PIC_SC8_LADDER, 0)->_flags &= 0xFFFB;

	g_fp->_aniMan->changeStatics2(ST_MAN8_HANDSUP);
	g_fp->_aniMan->setOXY(376, 280);
	g_fp->_aniMan->_priority = 10;

	MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());

	ExCommand *ex = new ExCommand(g_fp->_aniMan->_id, 1, MV_MAN8_BADLUCK, 0, 0, 0, 1, 0, 0, 0);
	ex->_excFlags |= 2;
	ex->_keyCode = g_fp->_aniMan->_okeyCode;
	mq->addExCommandToEnd(ex);

	mq->setFlags(mq->getFlags() | 1);
	mq->chain(0);

	g_fp->setObjectState(sO_StairsUp_8, g_fp->getObjectEnumState(sO_StairsUp_8, sO_NotBroken));

	g_vars->scene08_inAir = false;
}
Exemple #14
0
bool MessageQueue::checkGlobalExCommandList2() {
	ExCommand *ex, *ex1;

	for (uint i = 0; i < getCount(); i++) {
		ex = getExCommandByIndex(i);

		if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27)
			continue;

		for (Common::List<ExCommand *>::iterator it = g_fp->_exCommandList.begin(); it != g_fp->_exCommandList.end();) {
			ex1 = *it;

			if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27) {
				it++;
				continue;
			}

			if (ex1->_param != ex->_param && ex1->_param != -1 && ex->_param != -1) {
				it++;
				continue;
			}

			MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex1->_parId);

			if (mq) {
				if (mq->getFlags() & 1)
					return false;

				delete mq;
			}

			it = g_fp->_exCommandList.erase(it);

			if (ex1->_excFlags & 2) {
				delete ex1;
			}
		}
	}
	return true;
}
Exemple #15
0
void sceneHandler11_jumpFromSwing() {
	g_vars->scene11_arcadeIsOn = false;
	g_vars->scene11_hint->_flags &= 0xFFFB;
	g_vars->scene11_scrollIsEnabled = false;

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

	g_vars->scene11_swingOldAngle = 0.0;
	g_vars->scene11_swingAngleDiff = 0.0;
	g_vars->scene11_swingSpeed = 0.0;
	g_vars->scene11_swingAngle = 0.0;

	g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1);
	g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB;
	g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_KACHELI, -1);
	g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC);
	g_vars->scene11_dudeOnSwing->setOXY(691, 371);
	g_vars->scene11_dudeOnSwing->_priority = 20;
	g_vars->scene11_dudeOnSwing->_flags |= 4;

    MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
    ExCommand *ex = new ExCommand(g_fp->_aniMan->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0);
	ex->_field_14 = 256;
	ex->_messageNum = 0;
	ex->_excFlags |= 3;
	mq->addExCommandToEnd(ex);
	mq->setFlags(mq->getFlags() | 1);

	g_fp->_globalMessageQueueList->addMessageQueue(mq);

	g_fp->_aniMan->_flags |= 0x104;
	g_fp->_aniMan->changeStatics2(ST_MAN11_SWING);
	g_fp->_aniMan->setOXY(685, 373);
	g_fp->_aniMan->startAnim(MV_MAN11_JUMPFROMSWING, mq->_id, -1);

	g_fp->_aniMan2 = g_fp->_aniMan;
}
Exemple #16
0
void sceneHandler35_startFlow() {
    if (g_fp->getObjectState(sO_Valve_35) == g_fp->getObjectEnumState(sO_Valve_35, sO_TurnedOn)) {
        if ((g_vars->scene35_hose->_flags & 4) && g_vars->scene35_hose->_statics->_staticsId == ST_HZE_NORM) {
            g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene35_bellyInflater, ST_PDV_SMALL, QU_PDV_SML_BLINK, 0);
            g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene35_bellyInflater, ST_PDV_SMALL, QU_PDV_SML_TRY, 0);

            g_vars->scene35_bellyInflater->changeStatics2(ST_PDV_SMALL);
            g_vars->scene35_bellyInflater->_flags &= 0xFEFF;

            MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC35_EATHOZE), 0, 0);

            mq->setFlags(mq->getFlags() | 1);

            ExCommand *cmd = new ExCommand(g_vars->scene35_bellyInflater->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0);

            cmd->_excFlags |= 3;
            cmd->_field_14 = 256;
            cmd->_messageNum = 0;

            mq->addExCommandToEnd(cmd);

            if (!mq->chain(g_vars->scene35_bellyInflater))
                delete mq;

            g_vars->scene35_bellyInflater->_flags |= 1;

            getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing, 1);

            g_fp->playSound(SND_35_012, 1);
        } else {
            if (!g_vars->scene35_flowCounter)
                g_vars->scene35_flowCounter = 98;

            g_fp->playSound(SND_35_011, 1);
        }
    }
}
Exemple #17
0
bool sceneHandler25_isOnLadder(ExCommand *cmd) {
	if ((g_fp->_aniMan->_movement && g_fp->_aniMan->_movement->_id == MV_MAN_GOLADDERDOWN)
		|| g_fp->_aniMan->_statics->_staticsId == ST_MAN_GOLADDERD) {
		Interaction *inter = getGameLoaderInteractionController()->getInteractionByObjectIds(PIC_SC25_LADDERDOWN, ANI_MAN, cmd->_keyCode);

		if (!inter)
			return 0;

		MessageQueue *mq = new MessageQueue(inter->_messageQueue, 0, 1);
		PictureObject *pic = g_fp->_currentScene->getPictureObjectById(PIC_SC25_LADDERDOWN, 0);
		Common::Point point;

		point.x = inter->_xOffs + pic->_ox;
		point.y = inter->_yOffs + pic->_oy;

		mq->setFlags(mq->getFlags() | 1);

		sceneHandler25_walkOnLadder(g_fp->_aniMan, &point, mq, 0);

		return true;
	} else {
		return false;
	}
}
Exemple #18
0
void sceneHandler32_potLogic(ExCommand *cmd) {
	if (g_vars->scene32_cactusCounter < 0 || g_vars->scene32_cactusCounter > 20) {
		MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());

		ExCommand *ex = new ExCommand(ANI_MAN, 1, MV_MAN32_STANDUP, 0, 0, 0, 1, 0, 0, 0);

		ex->_excFlags |= 2;

		mq->addExCommandToEnd(ex);

		StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);

		if (!ani || ani->_id != ANI_KADKA)
			mq->addExCommandToEnd(cmd->createClone());

		mq->setFlags(mq->getFlags() | 1);
		mq->chain(0);

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

		g_vars->scene32_dudeIsSitting = false;
	}
}
Exemple #19
0
bool GameLoader::gotoScene(int sceneId, int entranceId) {
    SceneTag *st;

    int sc2idx = getSceneTagBySceneId(sceneId, &st);

    if (sc2idx < 0)
        return false;

    if (!_sc2array[sc2idx]._isLoaded)
        return false;

    if (_sc2array[sc2idx]._entranceDataCount < 1) {
        g_fp->_currentScene = st->_scene;
        return true;
    }

    if (_sc2array[sc2idx]._entranceDataCount <= 0)
        return false;

    int entranceIdx = 0;
    if (sceneId != 726) // WORKAROUND
        for (entranceIdx = 0; _sc2array[sc2idx]._entranceData[entranceIdx]->_field_4 != entranceId; entranceIdx++) {
            if (entranceIdx >= _sc2array[sc2idx]._entranceDataCount)
                return false;
        }

    GameVar *sg = _gameVar->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME");

    if (sg || (sg = _gameVar->getSubVarByName("OBJSTATES")->addSubVarAsInt("SAVEGAME", 0)) != 0)
        sg->setSubVarAsInt("Entrance", entranceId);

    if (!g_fp->sceneSwitcher(_sc2array[sc2idx]._entranceData[entranceIdx]))
        return false;

    g_fp->_msgObjectId2 = 0;
    g_fp->_msgY = -1;
    g_fp->_msgX = -1;

    g_fp->_currentScene = st->_scene;

    MessageQueue *mq1 = g_fp->_currentScene->getMessageQueueById(_sc2array[sc2idx]._entranceData[entranceIdx]->_messageQueueId);
    if (mq1) {
        MessageQueue *mq = new MessageQueue(mq1, 0, 0);

        StaticANIObject *stobj = g_fp->_currentScene->getStaticANIObject1ById(_field_FA, -1);
        if (stobj) {
            stobj->_flags &= 0x100;

            ExCommand *ex = new ExCommand(stobj->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0);

            ex->_field_14 = 256;
            ex->_messageNum = 0;
            ex->_excFlags |= 3;

            mq->addExCommandToEnd(ex);
        }

        mq->setFlags(mq->getFlags() | 1);

        if (!mq->chain(0)) {
            delete mq;

            return false;
        }
    } else {
        StaticANIObject *stobj = g_fp->_currentScene->getStaticANIObject1ById(_field_FA, -1);
        if (stobj)
            stobj->_flags &= 0xfeff;
    }

    return true;
}
Exemple #20
0
void sceneHandler06_mumsyBallTake() {
	int momAni = 0;

	switch (g_vars->scene06_mumsyNumBalls) {
    case 1:
		momAni = MV_MOM_TAKE1;
		break;
    case 2:
		momAni = MV_MOM_TAKE2;
		break;
    case 3:
		momAni = MV_MOM_TAKE3;
		break;
    case 4:
		momAni = MV_MOM_TAKE4;
		break;
    case 5:
		momAni = MV_MOM_TAKE5;
		break;
	}

	MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());

	ExCommand *ex = new ExCommand(ANI_MAMASHA, 2, 50, 0, 0, 0, 1, 0, 0, 0);

	ex->_excFlags = 2u;
	mq->addExCommandToEnd(ex);

	if (g_vars->scene06_mumsyNumBalls >= 5) {
		g_fp->setObjectState(sO_BigMumsy, g_fp->getObjectEnumState(sO_BigMumsy, sO_IsGone));

		if (g_fp->getObjectState(sO_ClockAxis) == g_fp->getObjectEnumState(sO_ClockAxis, sO_IsNotAvailable))
			g_fp->setObjectState(sO_ClockAxis, g_fp->getObjectEnumState(sO_ClockAxis, sO_WithoutHandle));

		ex = new ExCommand(ANI_MAMASHA, 1, momAni, 0, 0, 0, 1, 0, 0, 0);
		ex->_excFlags |= 2;
		mq->addExCommandToEnd(ex);

		if (g_vars->scene06_mumsyPos + 3 >= 0) {
			ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_STARTBK, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags |= 2u;
			mq->addExCommandToEnd(ex);

			for (int i = 0; i < g_vars->scene06_mumsyPos + 3; i++) {
				ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_CYCLEBK, 0, 0, 0, 1, 0, 0, 0);
				ex->_excFlags |= 2;
				mq->addExCommandToEnd(ex);
			}

			ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_STOPBK, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags |= 2;
			mq->addExCommandToEnd(ex);
		}

		ex = new ExCommand(0, 18, QU_MOM_TOLIFT, 0, 0, 0, 1, 0, 0, 0);
		ex->_excFlags |= 3;
		mq->addExCommandToEnd(ex);
	} else {
		if (momAni) {
			ex = new ExCommand(ANI_MAMASHA, 1, momAni, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags |= 2;
			mq->addExCommandToEnd(ex);
		}

		if (g_vars->scene06_mumsyPos < 0) {
			for (int i = 0; i > g_vars->scene06_mumsyPos; i--) {
				ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_JUMPFW, 0, 0, 0, 1, 0, 0, 0);
				ex->_excFlags |= 2;
				mq->addExCommandToEnd(ex);
			}
		} else if (g_vars->scene06_mumsyPos > 0) {
			for (int i = 0; i < g_vars->scene06_mumsyPos; i++) {
				ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_JUMPBK, 0, 0, 0, 1, 0, 0, 0);
				ex->_excFlags |= 2;
				mq->addExCommandToEnd(ex);
			}
		}

		ex = new ExCommand(0, 18, QU_MOM_SITDOWN, 0, 0, 0, 1, 0, 0, 0);
		ex->_excFlags |= 3u;
		mq->addExCommandToEnd(ex);
	}

	mq->setFlags(mq->getFlags() | 1);
	mq->chain(0);

	g_vars->scene06_mumsyNumBalls = 0;
	g_vars->scene06_arcadeEnabled = false;

	g_fp->_aniMan2 = 0;
}