void scene32_initScene(Scene *sc) { g_vars->scene32_flagIsWaving = false; g_vars->scene32_flagNeedsStopping = false; g_vars->scene32_dudeIsSitting = false; g_vars->scene32_cactusCounter = -1; g_vars->scene32_dudeOnLadder = false; g_vars->scene32_cactusIsGrowing = false; g_vars->scene32_flag = sc->getStaticANIObject1ById(ANI_FLAG, -1); g_vars->scene32_cactus = sc->getStaticANIObject1ById(ANI_CACTUS, -1); g_vars->scene32_massOrange = sc->getStaticANIObject1ById(ANI_TESTO_ORANGE, -1); g_vars->scene32_massBlue = sc->getStaticANIObject1ById(ANI_TESTO_BLUE, -1); g_vars->scene32_massGreen = sc->getStaticANIObject1ById(ANI_TESTO_GREEN, -1); g_vars->scene32_button = sc->getStaticANIObject1ById(ANI_BUTTON_32, -1); g_vars->scene32_massOrange->startAnim(MV_TSTO_FLOW, 0, -1); g_vars->scene32_massOrange->_movement->setDynamicPhaseIndex(15); g_vars->scene32_massGreen->startAnim(MV_TSTG_FLOW, 0, -1); g_vars->scene32_massGreen->_movement->setDynamicPhaseIndex(26); Scene *oldsc = g_fp->_currentScene; StaticANIObject *ani; if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Lies)) { ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1); if (ani) { g_fp->_currentScene = sc; ani->changeStatics2(ST_HDL_LAID); } } else { if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) { ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1); g_fp->_currentScene = sc; if (ani) ani->changeStatics2(ST_HDL_PLUGGED); g_vars->scene32_button->changeStatics2(ST_BTN32_ON); } } g_fp->_currentScene = oldsc; if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32)) { MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK32_START), 0, 0); mq->sendNextCommand(); } g_fp->lift_setButton(sO_Level9, ST_LBN_9N); g_fp->lift_init(sc, QU_SC32_ENTERLIFT, QU_SC32_EXITLIFT); g_fp->initArcadeKeys("SC_32"); }
void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *entry) { debug(0, "BehaviorManager::updateBehavior() %d", entry->_itemsCount); for (int i = 0; i < entry->_itemsCount; i++) { BehaviorEntryInfo *bhi = entry->_items[i]; if (!(bhi->_flags & 1)) { if (bhi->_flags & 2) { MessageQueue *mq = new MessageQueue(bhi->_messageQueue, 0, 1); mq->sendNextCommand(); bhi->_flags &= 0xFFFFFFFD; } else if (behaviorInfo->_counter >= bhi->_delay && bhi->_percent && g_fullpipe->_rnd->getRandomNumber(32767) <= entry->_items[i]->_percent) { MessageQueue *mq = new MessageQueue(bhi->_messageQueue, 0, 1); mq->sendNextCommand(); behaviorInfo->_counter = 0; } } } }
int global_messageHandler4(ExCommand *cmd) { StaticANIObject *ani = 0; switch (cmd->_messageKind) { case 18: { MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(cmd->_messageNum), cmd->_parId, 0); if (cmd->_excFlags & 1) mq->_flag1 = 1; else mq->_flag1 = 0; mq->sendNextCommand(); break; } case 2: if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; ani->trySetMessageQueue(cmd->_messageNum, cmd->_parId); break; case 1: { if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; int flags = cmd->_field_14; if (flags <= 0) flags = -1; if (cmd->_excFlags & 1) ani->startAnim(cmd->_messageNum, 0, flags); else ani->startAnim(cmd->_messageNum, cmd->_parId, flags); break; } case 8: if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; ani->startAnimEx(cmd->_messageNum, cmd->_parId, -1, -1); break; case 20: { if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; int flags = cmd->_field_14; if (flags <= 0) flags = -1; ExCommand2 *cmd2 = (ExCommand2 *)cmd; if (cmd->_excFlags & 1) { ani->startAnimSteps(cmd->_messageNum, 0, cmd->_x, cmd->_y, cmd2->_points, cmd2->_pointsSize, flags); } else { ani->startAnimSteps(cmd->_messageNum, cmd->_parId, cmd->_x, cmd->_y, cmd2->_points, cmd2->_pointsSize, flags); } break; } case 21: if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; ani->queueMessageQueue(0); ani->playIdle(); break; case 9: // Nop in original break; case 3: g_fp->_currentScene->_y = cmd->_messageNum - cmd->_messageNum % g_fp->_scrollSpeed; break; case 4: g_fp->_currentScene->_x = cmd->_messageNum - cmd->_messageNum % g_fp->_scrollSpeed; break; case 19: { if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; MessageQueue *mq = ani->getMessageQueue(); MessageQueue *mq2 = ani->changeStatics1(cmd->_messageNum); if (!mq2 || !mq2->getExCommandByIndex(0) || !mq) break; mq2->_parId = mq->_id; mq2->_flag1 = (cmd->_field_24 == 0); break; } case 22: if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; ani->_flags |= 4; ani->changeStatics2(cmd->_messageNum); break; case 6: if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; ani->hide(); break; case 27: if (!g_fp->_currentScene || g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param) == 0) { ani = g_fp->accessScene(cmd->_field_20)->getStaticANIObject1ById(cmd->_parentId, -1); if (ani) { ani = new StaticANIObject(ani); g_fp->_currentScene->addStaticANIObject(ani, 1); } } // fall through case 5: if (g_fp->_currentScene) ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; if (cmd->_field_14 >= 0) ani->_priority = cmd->_field_14; ani->show1(cmd->_x, cmd->_y, cmd->_messageNum, cmd->_parId); break; case 10: if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; if (cmd->_field_14 >= 0) ani->_priority = cmd->_field_14; ani->show2(cmd->_x, cmd->_y, cmd->_messageNum, cmd->_parId); break; case 7: { if (!g_fp->_currentScene->_picObjList.size()) break; int offX = g_fp->_scrollSpeed * (cmd->_x / g_fp->_scrollSpeed); int offY = g_fp->_scrollSpeed * (cmd->_y / g_fp->_scrollSpeed); if (cmd->_messageNum) { g_fp->_currentScene->_x = offX - g_fp->_sceneRect.left; g_fp->_currentScene->_y = offY - g_fp->_sceneRect.top; if (cmd->_field_24) { g_fp->_currentScene->_messageQueueId = cmd->_parId; } } else { g_fp->_sceneRect.translate(offX - g_fp->_sceneRect.left, offY - g_fp->_sceneRect.top); g_fp->_currentScene->_x = 0; g_fp->_currentScene->_y = 0; g_fp->_currentScene->updateScrolling2(); } break; } case 34: if (!g_fp->_currentScene) break; ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param); if (!ani) break; ani->_flags = cmd->_messageNum | (ani->_flags & ~cmd->_field_14); break; case 35: global_messageHandler_handleSound(cmd); break; case 11: case 12: break; default: return 0; break; } return 1; }