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); } } } }
void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *bhe) { debug(0, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName)); MessageQueue *mq = 0; if (bhe->_flags & 1) { uint rnd = g_fullpipe->_rnd->getRandomNumber(32767); uint runPercent = 0; for (int i = 0; i < bhe->_itemsCount; i++) { if (!(bhe->_items[i]->_flags & 1) && bhe->_items[i]->_percent) { if ((rnd >= runPercent && rnd <= runPercent + bhe->_items[i]->_percent) || i == bhe->_itemsCount - 1) { mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1); break; } runPercent += bhe->_items[i]->_percent; } } } else { for (int i = 0; i < bhe->_itemsCount; i++) { if (!(bhe->_items[i]->_flags & 1) && delay >= bhe->_items[i]->_delay) { if (bhe->_items[i]->_percent) { if (g_fullpipe->_rnd->getRandomNumber(32767) <= bhe->_items[i]->_percent) { mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1); break; } } } } } if (mq) { mq->replaceKeyCode(-1, ani->_okeyCode); mq->chain(ani); } }
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); } } } } } }
void sceneHandler06_showNextBall() { if (g_vars->scene06_balls.size()) { g_vars->scene06_currentBall = new StaticANIObject(g_vars->scene06_balls.front()); g_vars->scene06_balls.remove_at(0); MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC6_SHOWNEXTBALL), 0, 1); mq->replaceKeyCode(-1, g_vars->scene06_currentBall->_okeyCode); mq->chain(0); ++g_vars->scene06_numBallsGiven; } }
void sceneHandler16_putOnWheel() { StaticANIObject *ani = g_vars->scene16_walkingBoy; if (!ani) ani = g_vars->scene16_walkingGirl; if (ani) g_vars->scene16_figures.push_back(ani); ani = g_vars->scene16_figures.front(); g_vars->scene16_figures.pop_front(); if (ani) { MessageQueue *mq; if (ani->_id == ANI_BOY) { mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOBOY), 0, 1); mq->replaceKeyCode(-1, ani->_okeyCode); mq->chain(0); g_vars->scene16_walkingBoy = ani; g_vars->scene16_walkingGirl = 0; } else if (ani->_id == ANI_GIRL) { if (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)) { mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOGIRL), 0, 1); mq->replaceKeyCode(-1, ani->_okeyCode); mq->chain(0); g_vars->scene16_walkingBoy = 0; g_vars->scene16_walkingGirl = ani; } } } }
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; }
void sceneHandler06_fallBall() { g_vars->scene06_ballY = 475; g_vars->scene06_flyingBall->setOXY(g_vars->scene06_ballX, g_vars->scene06_ballY); MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC6_FALLBALL), 0, 1); mq->replaceKeyCode(-1, g_vars->scene06_flyingBall->_okeyCode); mq->chain(0); g_vars->scene06_balls.push_back(g_vars->scene06_flyingBall); g_vars->scene06_flyingBall = 0; sceneHandler06_dropBall(); sceneHandler06_eggieWalk(); }
void sceneHandler16_fillMug() { if (g_vars->scene16_mug->_flags & 4) { g_vars->scene16_jettie->_priority = 2; g_vars->scene16_jettie->startAnim(MV_JTI_FLOWIN, 0, -1); if (g_fp->_aniMan->_movement) { if (g_fp->_aniMan->_movement->_id == MV_MAN16_TAKEMUG) { g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); g_vars->scene16_mug->show1(-1, -1, -1, 0); g_fp->setObjectState(sO_Cup, g_fp->getObjectEnumState(sO_Cup, sO_DudeHas)); } } return; } MessageQueue *mq; if (!(g_vars->scene16_boot->_flags & 4)) { g_vars->scene16_jettie->_priority = 15; g_vars->scene16_jettie->startAnim(MV_JTI_FLOWBY, 0, -1); if (g_vars->scene16_walkingBoy) { mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1); mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); if (mq->chain(g_vars->scene16_walkingBoy)) return; } else { if (!g_vars->scene16_walkingGirl) return; mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1); mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode); if (mq->chain(g_vars->scene16_walkingGirl)) return; } delete mq; return; } g_vars->scene16_jettie->_priority = 15; g_vars->scene16_boot->startAnim(MV_BT16_FILL, 0, -1); StaticANIObject *ani; if (g_vars->scene16_walkingBoy) { mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1); mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); ani = g_vars->scene16_walkingBoy; } else { if (!g_vars->scene16_walkingGirl) return; mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1); mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode); ani = g_vars->scene16_walkingGirl; } if (!mq->chain(ani)) delete mq; }
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++; } }