diff options
-rw-r--r-- | engines/cine/various.cpp | 114 | ||||
-rw-r--r-- | engines/cine/various.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene29.cpp | 163 |
3 files changed, 231 insertions, 48 deletions
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index aa1c22c165..8687699a44 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -557,12 +557,20 @@ int16 selectSubObject(int16 x, int16 y, int16 param) { } } + if (selectedObject >= 20) + error("Invalid value for selectedObject: %d", selectedObject); return objListTab[selectedObject]; } -// TODO: Make separate functions for Future Wars's and Operation Stealth's version of this function, this is getting too messy -// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently) void makeCommandLine() { + if (g_cine->getGameType() == Cine::GType_FW) + makeFWCommandLine(); + else + makeOSCommandLine(); +} + +// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently) +void makeOSCommandLine() { uint16 x, y; commandVar1 = 0; @@ -578,28 +586,16 @@ void makeCommandLine() { int16 si; getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); - - if (g_cine->getGameType() == Cine::GType_FW) { - si = selectSubObject(x, y + 8, -2); - } else { - si = selectSubObject(x, y + 8, -subObjectUseTable[playerCommand]); - } + si = selectSubObject(x, y + 8, -subObjectUseTable[playerCommand]); if (si < 0) { - if (g_cine->getGameType() == Cine::GType_OS) { - canUseOnObject = 0; - } else { // Future Wars - playerCommand = -1; - g_cine->_commandBuffer = ""; - } + canUseOnObject = 0; } else { - if (g_cine->getGameType() == Cine::GType_OS) { - if (si >= 8000) { - si -= 8000; - canUseOnObject = canUseOnItemTable[playerCommand]; - } else { - canUseOnObject = 0; - } + if (si >= 8000) { + si -= 8000; + canUseOnObject = canUseOnItemTable[playerCommand]; + } else { + canUseOnObject = 0; } commandVar3[0] = si; @@ -607,27 +603,21 @@ void makeCommandLine() { g_cine->_commandBuffer += " "; g_cine->_commandBuffer += g_cine->_objectTable[commandVar3[0]].name; g_cine->_commandBuffer += " "; - if (g_cine->getGameType() == Cine::GType_OS) { - g_cine->_commandBuffer += commandPrepositionTable[playerCommand]; - } else { // Future Wars - g_cine->_commandBuffer += defaultCommandPreposition; - } + g_cine->_commandBuffer += commandPrepositionTable[playerCommand]; } } - if (g_cine->getGameType() == Cine::GType_OS || !(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) { - if (playerCommand == 2) { - getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); - CursorMan.showMouse(false); - processInventory(x, y + 8); - playerCommand = -1; - commandVar1 = 0; - g_cine->_commandBuffer = ""; - CursorMan.showMouse(true); - } + if (playerCommand == 2) { + getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); + CursorMan.showMouse(false); + processInventory(x, y + 8); + playerCommand = -1; + commandVar1 = 0; + g_cine->_commandBuffer = ""; + CursorMan.showMouse(true); } - if (g_cine->getGameType() == Cine::GType_OS && playerCommand != 2) { + if (playerCommand != 2) { if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object int16 si; @@ -665,7 +655,55 @@ void makeCommandLine() { } } - if (g_cine->getGameType() == Cine::GType_OS || !disableSystemMenu) { + isDrawCommandEnabled = 1; + renderer->setCommand(g_cine->_commandBuffer); +} + +// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently) +void makeFWCommandLine() { + uint16 x, y; + + commandVar1 = 0; + commandVar2 = -10; + + if (playerCommand != -1) { + g_cine->_commandBuffer = defaultActionCommand[playerCommand]; + } else { + g_cine->_commandBuffer = ""; + } + + if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection? + int16 si; + + getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); + si = selectSubObject(x, y + 8, -2); + + if (si < 0) { + playerCommand = -1; + g_cine->_commandBuffer = ""; + } else { + commandVar3[0] = si; + commandVar1 = 1; + g_cine->_commandBuffer += " "; + g_cine->_commandBuffer += g_cine->_objectTable[commandVar3[0]].name; + g_cine->_commandBuffer += " "; + g_cine->_commandBuffer += defaultCommandPreposition; + } + } + + if (!(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) { + if (playerCommand == 2) { + getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); + CursorMan.showMouse(false); + processInventory(x, y + 8); + playerCommand = -1; + commandVar1 = 0; + g_cine->_commandBuffer = ""; + CursorMan.showMouse(true); + } + } + + if (!disableSystemMenu) { isDrawCommandEnabled = 1; renderer->setCommand(g_cine->_commandBuffer); } diff --git a/engines/cine/various.h b/engines/cine/various.h index 04f2d47743..eb6312997d 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -37,6 +37,8 @@ void initLanguage(Common::Language lang); int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X, uint16 Y, uint16 width, bool recheckValue = false); void makeCommandLine(); +void makeFWCommandLine(); +void makeOSCommandLine(); void makeActionMenu(); void waitPlayerInput(); void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4); diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp index 794fb0412a..11012331b6 100644 --- a/engines/fullpipe/scenes/scene29.cpp +++ b/engines/fullpipe/scenes/scene29.cpp @@ -36,6 +36,151 @@ namespace Fullpipe { +void scene29_initScene(Scene *sc) { + g_vars->scene29_var01 = 300; + g_vars->scene29_var02 = 200; + g_vars->scene29_var03 = 400; + g_vars->scene29_var04 = 300; + g_vars->scene29_porter = sc->getStaticANIObject1ById(ANI_PORTER, -1); + g_vars->scene29_shooter1 = sc->getStaticANIObject1ById(ANI_SHOOTER1, -1); + g_vars->scene29_shooter2 = sc->getStaticANIObject1ById(ANI_SHOOTER2, -1); + g_vars->scene29_ass = sc->getStaticANIObject1ById(ANI_ASS, -1); + + v2 = g_vars->scene29_var05.pHead; + if (g_vars->scene29_var05.pHead) { + do + v2 = v2->p0; + while ( v2 ); + } + + g_vars->scene29_var05.numBalls = 0; + g_vars->scene29_var05.pTail = 0; + g_vars->scene29_var05.field_8 = 0; + g_vars->scene29_var05.pHead = 0; + CPlex::FreeDataChain(g_vars->scene29_var05.cPlex); + v3 = g_vars->scene29_var08.pHead; + g_vars->scene29_var05.cPlex = 0; + + if (g_vars->scene29_var08.pHead) { + do + v3 = v3->p0; + while (v3); + } + + g_vars->scene29_var08.numBalls = 0; + g_vars->scene29_var08.pTail = 0; + g_vars->scene29_var08.field_8 = 0; + g_vars->scene29_var08.pHead = 0; + CPlex::FreeDataChain(g_vars->scene29_var08.cPlex); + g_vars->scene29_var08.cPlex = 0; + v4 = Scene_getStaticANIObject1ById(sc, ANI_SHELL_GREEN, -1); + v5 = BallChain_sub04(&g_vars->scene29_var05, g_vars->scene29_var05.field_8, 0); + v5->ani = v4; + + if (g_vars->scene29_var05.field_8) + g_vars->scene29_var05.field_8->p0 = v5; + else + g_vars->scene29_var05.pHead = v5; + g_vars->scene29_var05.field_8 = v5; + + v22 = 2; + do { + v7 = StaticANIObject_ctorCopy(v6, v4); + Scene_addStaticANIObject(sc, v7, 1); + v8 = BallChain_sub04(&g_vars->scene29_var05, g_vars->scene29_var05.field_8, 0); + v8->ani = v7; + + if (g_vars->scene29_var05.field_8) + g_vars->scene29_var05.field_8->p0 = v8; + else + g_vars->scene29_var05.pHead = v8; + g_vars->scene29_var05.field_8 = v8; + --v22; + } while (v22); + + v9 = g_vars->scene29_var06.pHead; + if (g_vars->scene29_var06.pHead) { + do + v9 = v9->p0; + while (v9); + } + + g_vars->scene29_var06.numBalls = 0; + g_vars->scene29_var06.pTail = 0; + g_vars->scene29_var06.field_8 = 0; + g_vars->scene29_var06.pHead = 0; + CPlex::FreeDataChain(g_vars->scene29_var06.cPlex); + v10 = g_vars->scene29_var07.pHead; + g_vars->scene29_var06.cPlex = 0; + + if (g_vars->scene29_var07.pHead) { + do + v10 = v10->p0; + while (v10); + } + + g_vars->scene29_var07.numBalls = 0; + g_vars->scene29_var07.pTail = 0; + g_vars->scene29_var07.field_8 = 0; + g_vars->scene29_var07.pHead = 0; + CPlex::FreeDataChain(g_vars->scene29_var07.cPlex); + g_vars->scene29_var07.cPlex = 0; + + v11 = Scene_getStaticANIObject1ById(sc, ANI_SHELL_RED, -1); + v12 = BallChain_sub04(&g_vars->scene29_var06, g_vars->scene29_var06.field_8, 0); + v12->ani = v11; + + if (g_vars->scene29_var06.field_8) + g_vars->scene29_var06.field_8->p0 = v12; + else + g_vars->scene29_var06.pHead = v12; + + g_vars->scene29_var06.field_8 = v12; + + v23 = 2; + + do { + v14 = StaticANIObject_ctorCopy(v13, v11); + Scene_addStaticANIObject(sc, v14, 1); + v15 = BallChain_sub04(&g_vars->scene29_var06, g_vars->scene29_var06.field_8, 0); + v15->ani = v14; + if (g_vars->scene29_var06.field_8 ) + g_vars->scene29_var06.field_8->p0 = v15; + else + g_vars->scene29_var06.pHead = v15; + g_vars->scene29_var06.field_8 = v15; + --v23; + } while ( v23 ); + + ObArray_SetSize_0x0C((ObArray *)&g_vars->scene29_var19, 0, -1); + + StaticANIObject *ani = new StaticANIObject(accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1)); + + ani->_statics = ani->getStaticsById(ST_BRDCMN_EMPTY); + + sc->addStaticANIObject(ani, 1); + + v20 = g_vars->scene29_var19.m_nSize; + ObArray_SetSize_0x0C((ObArray *)&g_vars->scene29_var19, g_vars->scene29_var19.m_nSize + 1, -1); + v21 = &g_vars->scene29_var19.m_pData[v20]; + v21->ani = v19; + v21->wbflag = 0; + v21->wbcounter = 0; + + g_vars->scene29_var09 = 0; + g_vars->scene29_var10 = 0; + g_vars->scene29_var11 = 0; + g_vars->scene29_var12 = 0; + g_vars->scene29_var13 = 0; + g_vars->scene29_var14 = 75; + g_vars->scene29_var15 = 0; + g_vars->scene29_var16 = 0; + g_vars->scene29_var17 = 0; + g_vars->scene29_var18 = 0; + + g_fp->setArcadeOverlay(PIC_CSR_ARCADE8); +} + void sceneHandler29_winArcade() { warning("STUB: sceneHandler29_winArcade()"); } @@ -134,12 +279,12 @@ int sceneHandler29(ExCommand *cmd) { break; case MSG_SC29_LAUGH: - if (g_vars->scene29_var18 == ANI_SHELL_GREEN) { + if (g_vars->scene29_var18 == ANI_SHELL_GREEN) { playSound(SND_29_028, 0); break; - } + } - playSound(SND_29_029, 0); + playSound(SND_29_029, 0); break; @@ -152,12 +297,12 @@ int sceneHandler29(ExCommand *cmd) { break; case MSG_SC29_SHOOTGREEN: - sceneHandler29_shootGreen(); - break; + sceneHandler29_shootGreen(); + break; case MSG_SC29_SHOOTRED: - sceneHandler29_shootRed(); - break; + sceneHandler29_shootRed(); + break; case MSG_SC29_SHOWLASTGREEN: if (g_vars->scene29_var05.numBalls) { @@ -252,10 +397,8 @@ int sceneHandler29(ExCommand *cmd) { if (g_vars->scene29_var09) { sceneHandler29_manFromL(); - - } else if (g_vars->scene29_var10 && !g_aniMan->_movement) { + else if (g_vars->scene29_var10 && !g_aniMan->_movement) sceneHandler29_sub05(); - } if (g_vars->scene29_var11) sceneHandler29_shootersEscape(); |