Ejemplo n.º 1
0
void sceneHandler25_animateBearders() {
	if (g_fp->_rnd->getRandomNumber(32767) < 218) {
		MessageQueue *mq;

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

		mq->replaceKeyCode(-1, g_vars->scene25_bearders[0]->_okeyCode);
		mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
		mq->chain(0);

		g_vars->scene25_beardersCounter = 0;

		if (g_fp->_rnd->getRandomNumber(32767) < 0x1FFF) {
			mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED2), 0, 1);

			mq->replaceKeyCode(-1, g_vars->scene25_bearders[1]->_okeyCode);
			mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
			mq->chain(0);

			if (g_fp->_rnd->getRandomNumber(32767) < 8191) {
				mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED3), 0, 1);

				mq->replaceKeyCode(-1, g_vars->scene25_bearders[2]->_okeyCode);
				mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
				mq->chain(0);
			}
		}
	}
}
Ejemplo n.º 2
0
void sceneHandler32_trySit(ExCommand *cmd) {
	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);

	if (!mq || mq->getCount() == 0)
		return;

	ExCommand *ex = mq->getExCommandByIndex(0);

	if (g_vars->scene32_cactusIsGrowing || g_vars->scene32_cactus->_movement
		|| g_vars->scene32_cactus->_statics->_staticsId != ST_CTS_EMPTY
		|| (g_vars->scene32_cactusCounter >= 0 && g_vars->scene32_cactusCounter <= 20)) {
		ex->_messageKind = 0;
		ex->_excFlags |= 1;
	} else {
		ex->_parentId = ANI_MAN;
		ex->_messageKind = 1;
		ex->_messageNum = MV_MAN32_SITDOWN;
		ex->_param = g_fp->_aniMan->_odelay;

		g_vars->scene32_dudeIsSitting = true;

		getCurrSceneSc2MotionController()->deactivate();
		getGameLoaderInteractionController()->disableFlag24();
	}
}
Ejemplo n.º 3
0
void sceneHandler03_takeEgg(ExCommand *ex) {
	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex->_parId);

	if (mq && mq->getCount() > 0) {
		ExCommand *ex0 = mq->getExCommandByIndex(0);
		ExCommand *ex1 = mq->getExCommandByIndex(1);

		int egg1 = sceneHandler03_swallowedEgg1State();

		if (egg1 && ex0) {
			ex0->_parentId = egg1;
			sceneHandler03_pushEggStack();
		}

		if ( g_vars->swallowedEgg1->_value.intValue == ANI_INV_EGGAPL
			 && !g_vars->swallowedEgg2->_value.intValue
			 && !g_vars->swallowedEgg3->_value.intValue
			 && ex1) {

			if (ex1->_objtype == kObjTypeObjstateCommand) {
				ObjstateCommand *com = (ObjstateCommand *)ex1;

				com->_value = g_fp->getObjectEnumState(sO_EggGulper, sO_WantsNothing);
			}
		}
	}
}
Ejemplo n.º 4
0
void sceneHandler28_makeFaces(ExCommand *cmd) {
	g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0)->_flags &= 0xFFFB;

	g_vars->scene28_lighteningObject = 0;

	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
	if (mq) {
		int frames[5];

		frames[0] = MV_WMN28_IN_1;
		frames[1] = MV_WMN28_IN_2;
		frames[2] = MV_WMN28_IN_3;
		frames[3] = MV_WMN28_IN_4;
		frames[4] = MV_WMN28_IN_5;

		for (int i = 0; i < 5; i++) {
			int pos;

			while (frames[pos = g_fp->_rnd->getRandomNumber(4)] == 0)
				;

			mq->getExCommandByIndex(i)->_messageNum = frames[pos];

			frames[pos] = 0;
		}
	}
}
Ejemplo n.º 5
0
void sceneHandler03_giveCoin(ExCommand *ex) {
	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex->_parId);

	if (mq && mq->getCount() > 0) {
		ExCommand *ex0 = mq->getExCommandByIndex(0);
		ExCommand *ex1 = mq->getExCommandByIndex(1);

		if (sceneHandler03_swallowedEgg1State()) {
			ex0->_messageKind = 1;
			ex1->_messageKind = 1;

			getGameLoaderInventory()->removeItem(ANI_INV_COIN, 1);
		} else {
			ex0->_messageKind = 0;
			ex0->_excFlags |= 1;

			ex1->_messageKind = 0;
			ex1->_excFlags |= 1;

			g_vars->scene03_eggeater->_flags &= 0xFF7Fu;
		}
	}
}
Ejemplo n.º 6
0
void sceneHandler32_spin(ExCommand *cmd) {
	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);

	if (!mq || mq->getCount() == 0)
		return;

	ExCommand *ex = mq->getExCommandByIndex(0);
	ExCommand *newex;

	if ((g_vars->scene32_cactus->_movement && g_vars->scene32_cactus->_movement->_id == MV_CTS_DEFAULT)
		|| g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_GROWUP) {
		for (int i = 0; i < 12; i++) {
			newex = ex->createClone();
			newex->_excFlags |= 2;
			mq->insertExCommandAt(1, newex);
		}

		g_vars->scene32_cactus->changeStatics2(ST_CTS_GROWUP);

		chainQueue(QU_CTS_BACK, 1);

		g_vars->scene32_cactusIsGrowing = false;

		return;
	}

	if (g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_EMPTY && g_vars->scene32_cactusCounter < 0) {
		for (int i = 0; i < 2; i++) {
			newex = ex->createClone();
			newex->_excFlags |= 2;
			mq->insertExCommandAt(1, newex);
		}

		chainQueue(QU_KDK_DRIZZLE, 0);
	}
}
Ejemplo n.º 7
0
void sceneHandler29_animBearded() {
	MessageQueue *mq;

	for (uint i = 0; i < g_vars->scene29_bearders.size(); i++) {
		StaticANIObject *ani = g_vars->scene29_bearders[i]->ani;

		if (g_vars->scene29_bearders[i]->wbflag) {
			int x = ani->_ox;
			int y = ani->_oy;

			if (!ani->_movement && ani->_statics->_staticsId == (ST_BRDCMN_RIGHT | 0x4000)) {
				x -= 4;

				if (x - g_vars->scene29_manX < 100 || !g_vars->scene29_arcadeIsOn) {
					mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRDOUT1), 0, 1);

					mq->replaceKeyCode(-1, ani->_okeyCode);
					mq->chain(0);

					g_vars->scene29_bearders[i]->wbflag = 0;
					g_vars->scene29_bearders[i]->wbcounter = 0;
				}
			}

			if (!ani->_movement && ani->_statics->_staticsId == ST_BRDCMN_GOR)
				ani->startAnim(MV_BRDCMN_GOR, 0, -1);

			if (ani->_movement) {
				if (ani->_movement->_id == MV_BRDCMN_GOR) {
					x -= 4;

					if (g_vars->scene29_manX - x < 60 || x - g_vars->scene29_manX < -260 || !g_vars->scene29_arcadeIsOn) {
						ani->changeStatics2(ST_BRDCMN_RIGHT);

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

						mq->replaceKeyCode(-1, ani->_okeyCode);
						mq->chain(0);

						g_vars->scene29_bearders[i]->wbflag = 0;
						g_vars->scene29_bearders[i]->wbcounter = 0;
					}
				}
			}

			ani->setOXY(x, y);
			continue;
		}

		if (g_vars->scene29_arcadeIsOn && g_vars->scene29_bearders[i]->wbcounter > 30) {
			int newx;

			if (g_fp->_rnd->getRandomNumber(1))
				goto dostuff;

			if (g_vars->scene29_manX <= 700) {
				g_vars->scene29_bearders[i]->wbcounter++;
				continue;
			}

			if (g_vars->scene29_manX >= 1100) {
			dostuff:
				if (g_vars->scene29_manX <= 700 || g_vars->scene29_manX >= 1350) {
					g_vars->scene29_bearders[i]->wbcounter++;
					continue;
				}

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

				newx = g_vars->scene29_manX - 200;
			} else {
				mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRD1), 0, 1);

				newx = g_vars->scene29_manX + 350;
			}

			mq->getExCommandByIndex(0)->_x = newx;
			mq->replaceKeyCode(-1, ani->_okeyCode);
			mq->chain(0);

			g_vars->scene29_bearders[i]->wbflag = 1;
			g_vars->scene29_bearders[i]->wbcounter = 0;
		}

		g_vars->scene29_bearders[i]->wbcounter++;
	}
}
Ejemplo n.º 8
0
void sceneHandler28_trySecondaryPers() {
	MessageQueue *mq;
	int x;

	if (g_vars->scene28_headBeardedFlipper) {
		if (g_vars->scene28_beardedDirection) {
			mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1);

			mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 20;
			mq->getExCommandByIndex(0)->_param = 1;
			mq->setParamInt(-1, 1);
			mq->chain(0);

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

			mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 40;
			mq->getExCommandByIndex(0)->_y += 20;
			mq->getExCommandByIndex(0)->_param = 2;
			mq->setParamInt(-1, 2);
			mq->chain(0);

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

			x = g_fp->_sceneRect.left - 60;
		} else {
			mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1);

			mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 20;
			mq->getExCommandByIndex(0)->_param = 1;
			mq->setParamInt(-1, 1);
			mq->chain(0);

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

			mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 40;
			mq->getExCommandByIndex(0)->_y += 20;
			mq->getExCommandByIndex(0)->_param = 2;
			mq->setParamInt(-1, 2);
			mq->chain(0);

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

			x = g_fp->_sceneRect.right + 60;
		}

		mq->getExCommandByIndex(0)->_x = x;
		mq->getExCommandByIndex(0)->_y += 40;
		mq->getExCommandByIndex(0)->_param = 3;
		mq->setParamInt(-1, 3);
		mq->chain( 0);

		g_vars->scene28_beardedDirection = !g_vars->scene28_beardedDirection;
	} else {
		if (g_vars->scene28_headDirection) {
			mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOR), 0, 1);

			x = g_fp->_sceneRect.left - 40;
		} else {
			mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOL), 0, 1);

			x = g_fp->_sceneRect.right + 40;
		}

		mq->getExCommandByIndex(0)->_x = x;
		mq->chain(0);

		g_vars->scene28_headDirection = !g_vars->scene28_headDirection;
	}

	g_vars->scene28_headBeardedFlipper = !g_vars->scene28_headBeardedFlipper;
}