[Scummvm-git-logs] scummvm master -> 7fa8dc522900d0d0a17ecfc8d2eef14b807c2e3f

sev- noreply at scummvm.org
Thu Dec 3 21:04:21 UTC 2026


This automated email contains information about 120 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
9300357ccf NGI: Tutorial SEE_INVENTORY and SEE_MAP pass no touches to the scene
3559c8afe1 NGI: The scene below a tutorial bubble runs the whole Scene::update
d918db1c32 NGI: Scene::update runs its controller like CScene::Update, the stacked scenes go through it
614d268d4d NGI: Read the pointer pictures of CURSORCONTROLLER
41c660f599 NGI: Port CScene::GetCursorType and IsCursorObjectRender
723840b5d7 NGI: Draw the pointer pictures of CCursorController
99918bf87c NGI: The Android scenes get their events through CScene::OnMouse*, the controller gets every mouse move
d3075de22a NGI: CCursorController::CalcCursorType asks the inventory with the scene position
86b6a0b2ee NGI: CTutorialController::Finish and TransmitCoord as in the original
3450ee3418 NGI: CInventory::Update ends with CScene::Update
3b2f868e8a NGI: The cursor and the inventory update under a dialog too, the scene on top of the stack runs (CGame::UpdateContent)
e0bb8c32ad NGI: HIDE finds pictures, SET_STATIC runs, REMOVE_INV_ITEM has no guard (CMessageQueue::ExecuteCmd*)
d752b0dff4 NGI: CFPController::OnUpdate runs the tremble, task and achievement updates, hides the reaction, camera time only withou
6bbcf49c16 NGI: CFPController::OnShow resets the targets and the interaction object, switches the interactions on, hides the helper
82a9c351c4 NGI: CFPController::TestSwipe and ExecCmdScroll without the guards the original does not have
feb211165a NGI: PopScene sends the mouse move, CScene::OnShow runs the controller before the behaviors (after the sound lists in Do
5fd6315f03 NGI: Shared controller helpers isState, isSoundPlayed, copyQueue, moveToStaticCommand, setSceneCommand
1f9059c0f3 NGI: Port CSc05Controller
33b8af7528 NGI: Port CSc07Controller
1a4d400cc8 NGI: Port CSc10Controller
46337fa505 NGI: Port CSc12Controller
1fb32da58f NGI: Port CSc13Controller
85a09dc017 NGI: Port CSc15Controller
996e6891cf NGI: Port CSc16Controller
5cf4ac34f6 NGI: Port CSc21Controller
dfe9aaffda NGI: Port CSc20Controller
ce337b7de4 NGI: Port CSc24Controller
e561ef506c NGI: Port CSc31Controller
417223980a NGI: Port CSc30Controller
e3f53f8920 NGI: Port CSc35Controller
1a5909e2c8 NGI: Port CSc37Controller
8d199cdeae NGI: Sc08 MoveToStatic and Sc09 PLVCLICK command as the original
649d313484 NGI: Per-queue timer in BehaviorMove, BehaviorAni Update/CanMove/TryStartMove as the original
6a064501d3 NGI: Port HitregionObject and give animations a hit region
be82744e93 NGI: Mark BehaviorAni CanMove flags 4 and 8 untested
6a4e264391 NGI: GetAllRunableInteractions through the interaction index in the renderables order
6a88530f39 NGI: Port CFPController::GetCursorType and FillCursorData
fb589ce7b9 NGI: Init the cursors where CGame::OnShow does, not lazily
e215d1cc80 NGI: Scene::Update polls the queue map by key and waits for OnShow
e938437ffb NGI: Port CSc32Controller
832f40753c NGI: Lift parts of the controllers always active, remove tapOnLift
951a2f1836 NGI: Port CAniObject::StopMovement, StopMovementToPrev and CMovement::Stop exactly
230c43f5b8 NGI: Port CSc26Controller
3145e7a562 NGI: Port CSc28Controller
812798e480 NGI: Port CSc33Controller
d43cd125ce NGI: Port CSc22Controller
254ad72c59 NGI: Port CSc34Controller
7a9de247f0 NGI: CArcadeInterface::Render draws the icons with RenderAtPos (loads the texture)
f516926e68 NGI: Port CMessageQueueBuilder
e4c811fc81 NGI: Port CSc18Controller
af108f6f8a NGI: Port CSc25Controller
a9fff976d6 NGI: Port CSc23Controller
3a6483f06c NGI: Sc04Controller runs the scene logic of scene 4
af55f1a08e NGI: Scene 4 test aid plankjump=N, SHOOTKOZAW log line
675438d6c2 NGI: Test mode visitdelay
00bbdd77fb NGI: Sc04Controller moves the plank with MoveToStatic, more scene 4 test aids
9a9b79d9e1 NGI: Sc05Controller runs the scene logic of scene 5
9cabfb0b7d NGI: Sc07Controller runs the scene logic of scene 7
a7000d2a1e NGI: Sc12Controller runs the scene logic of scene 12
9227ba2dee NGI: Sc13Controller runs the scene logic of scene 13
0885e8521b NGI: Sc20Controller runs the scene logic of scene 20
e593aa7982 NGI: Sc10Controller runs the scene logic of scene 10
c625c0a934 NGI: Test mode aids showstate and watch
badd6168ad NGI: Sc15Controller runs the scene logic of scene 15
b5150ab8ed NGI: Keep the scene key of XML queue ids above 32767
7e0e2b6239 NGI: SHOW keeps the statics offsets for the Android version
497003bd16 NGI: Port COldAniObject::SetPos
69a52cf296 NGI: Sc16Controller runs the scene logic of scene 16
d14a6caa41 NGI: Sc17Controller runs the scene logic of scene 17
7ab15e338a NGI: Sc21Controller runs the scene logic of scene 21
952a0e3303 NGI: EnableAllQueuesForAni switches the queues for the Android version
4c56fde1be NGI: Sc24Controller runs the scene logic of scene 24
abc2a39f5a NGI: Sc30Controller runs the scene logic of scene 30
316e3dcf35 NGI: PassMouseActions follows the listing: SEE_ALL_TASKS and LAST refuse touches, cursor type of the scene below
3e0c5becf7 NGI: Move the Android-only Full Pipe files to fullpipe/mobile
01c2d66bf5 NGI: Port the silent flag of CAniObject::StartMovement for FastStartMovement
d63169e909 NGI: The cursor follows the mouse in the Android game
9a1d629b68 NGI: Hit test of the Android objects by the texture rectangle (CVisibleObject::Hit)
c0b8ce04fa NGI: Draw the cursor of the Android game under the noRandom test flag
0572ff2936 NGI: The watch test aid logs the top left and the frame
5d4066dc26 NGI: SetPos of an OLDANI is COldAniObject::SetPos, the pivot of a standing object
5f997693aa NGI: SetStatic moves the top left as CAniObject::SetStatic, also mirrored
72d1fddc2a NGI: SetCurFrame steps frame by frame (CMovement::SetCurFrame) and keeps the timer flag
c9e80fc503 NGI: Sc03Controller moves the egg eater with the SetPos of the original
fbb6dfa311 NGI: Sc04Controller passes the mirror of SetStatic and stops the lamps at the last phase
f2f699ad8e NGI: A held frame of a movement does not count its time
85bcf4e76b NGI: Port CMovement::SetNext and SetFrame, CPhase::SetCurrent and ExecCmd for the Android frame stepping
c47c67e99c NGI: StartSliding finishes a running movement, takes cycled and slides before the command of the first frame
b46cebbc11 NGI: Sc10 and Sc11 set the interrupt state of a running queue with SetIntState
8a06a7796a NGI: FPController edge scrolling needs an enabled motion controller
61c2e35ef6 NGI: FPController::checkQueues resets when the hero has no queue
30e94ef147 NGI: Keep the scene render list like CScene +176
7f6e3d63e7 NGI: Cursor hit objects from the scene render list
cc948a6210 NGI: MOVE_TO_STATIC of the controllers shows the object
9675669ba3 NGI: First SHOW of a line queue has no wait
2c53a0d321 NGI: Graphs and ladders share the animation handler, as in 201509
110abf4d35 NGI: TutorialController::OnUpdate passes 0,0,0 to AddContinueBtnIfNeed
8cd1023b04 NGI: Controllers set the interrupt state of queues through SetIntState
c9e221f18b NGI: canInteractAny uses the interactions of the object on 201509
df6a6d4f6c NGI: AniObject destructor leaves the shared animation handler alone on 201509
b0b960b616 NGI: AniObject position is read through pivotX() and pivotY()
12fd0f8c5d NGI: Motion controllers have a scene, the ladder runs its queue in it
d462585b27 NGI: Interaction finders read the scene render list on 201509
13c6a45fb8 NGI: Port the flag bytes of CSettings
5f8a5b6b68 NGI: NoActionLogger::onUpdate reads CSettings::GetIsFull
725e13754a NGI: Port CMoveToInfo and the MOVETO command
af8d24237f NGI: Port CFPController::OnSceneInit and the cursor Load/Unload
bb10f16385 NGI: PreloadManager::startGame loads the cursors
c955d841fb NGI: Add GuiManager::createButton and Scene::addRoamingObject
c86d727158 NGI: Port CCatalogManager and CCatalogItem
3cce368974 NGI: Wire the catalog into the notebook and the unlock calls
f0747e5a12 NGI: Keep the wait attribute of SHOW, HIDE and USER commands
857392b1e2 NGI: Port CFPController::CopyCommonQeueus
e03877ba42 NGI: Port CScIntoController and enter the intro scenes through it
a7c5e83f8b NGI: Store the position of objects and scenes as float
9aa5cce700 NGI: Switch scene 31 to its controller
87c5932987 NGI: Switch scene 35 to its controller
4c9896dd8c NGI: Switch scene 36 to its controller
130dde848d NGI: Switch scene 37 to its controller
7fa8dc5229 NGI: Order the statements of CScNNController::OnShow as the original


Commit: 9300357ccfb001accf5926125488186254a2ca88
    https://github.com/scummvm/scummvm/commit/9300357ccfb001accf5926125488186254a2ca88
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: Tutorial SEE_INVENTORY and SEE_MAP pass no touches to the scene

Changed paths:
    engines/ngi/fullpipe/tutorialcontroller.cpp


diff --git a/engines/ngi/fullpipe/tutorialcontroller.cpp b/engines/ngi/fullpipe/tutorialcontroller.cpp
index 59c91642576..e951d080cda 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.cpp
+++ b/engines/ngi/fullpipe/tutorialcontroller.cpp
@@ -678,9 +678,9 @@ int TutorialController::getCursorType(float x, float y) {
 	return -1;
 }
 
-// CTutorialController::PassMouseActions (1A4854): action 1 move, 2 finger down, 3 finger up;
-// every tutorial has a zone, a touch in it can finish it. From the disassembly (jump table):
-// no zone: FIRST, SEE_TASK, USE_TASK (no pass), SEE_ALL_TASKS, SEE_EGGEATER, LAST (pass)
+// CTutorialController::PassMouseActions (1A4854): action 1 move, 2 finger down, 3 finger up
+// no zone, from the disassembly: FIRST, SEE_TASK, USE_TASK, SEE_INVENTORY, SEE_MAP don't pass;
+// SEE_ALL_TASKS, SEE_EGGEATER, LAST pass
 bool TutorialController::passMouseActions(float x, float y, int action) {
 	const bool pass = passMouseActionsZone(x, y, action);
 	debugC(2, kDebugEvents, "TutorialController::passMouseActions(%g, %g, %d) = %d", x, y, action, pass);
@@ -700,6 +700,9 @@ bool TutorialController::passMouseActionsZone(float x, float y, int action) {
 		return false;
 	if (id == "TUTORIAL_SEE_ALL_TASKS" || id == "TUTORIAL_SEE_EGGEATER" || id == "TUTORIAL_LAST")
 		return true;
+	// 1A4A7E..1A4B68: both jump to 1A4D64 (return 0), only the bubble button counts
+	if (id == "TUTORIAL_SEE_INVENTORY" || id == "TUTORIAL_SEE_MAP")
+		return false;
 
 	Scene *scene = g_ngi->getSceneInStack(0);
 	if (id == "TUTORIAL_MOVE_MAN") {


Commit: 3559c8afe10c64d3df55edbb486a02005f9e8c23
    https://github.com/scummvm/scummvm/commit/3559c8afe10c64d3df55edbb486a02005f9e8c23
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: The scene below a tutorial bubble runs the whole Scene::update

Changed paths:
    engines/ngi/fullpipe/tutorialcontroller.cpp
    engines/ngi/scene.cpp


diff --git a/engines/ngi/fullpipe/tutorialcontroller.cpp b/engines/ngi/fullpipe/tutorialcontroller.cpp
index e951d080cda..4548135a86e 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.cpp
+++ b/engines/ngi/fullpipe/tutorialcontroller.cpp
@@ -387,11 +387,9 @@ void TutorialController::onUpdate(uint32 elapsed) {
 	if (_arrowTime != -1.0f)
 		_arrowTime += (float)elapsed / 1000.0f;
 	if (g_ngi->_sceneStack.size() > 1) {
-		// CScene::Update of the scene below; it is not current, so the early return part is done by hand
+		// CScene::Update of the scene below
 		Scene *below = sceneBelow();
-		if (below->_behaviorController)
-			below->_behaviorController->update(elapsed);
-		below->updateObjects(elapsed);
+		below->update(elapsed);
 		if (below->_controller)
 			below->_controller->onUpdate(elapsed);
 	}
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 9f557612856..61e865451b1 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -1523,11 +1523,6 @@ bool Scene::update(int counterdiff) {
 		for (uint i = 0; i < _interactionQueues.size(); i++)
 			_interactionQueues[i]->update(counterdiff);
 		processMessages();
-		if (g_ngi->_modalObject || this != g_ngi->getCurrentScene()) {
-			getGameLoaderInteractionController()->onUpdate(counterdiff);
-			removeObjectSafe();
-			return true;
-		}
 		changed |= updateObjects(counterdiff);
 		getGameLoaderInteractionController()->onUpdate(counterdiff);
 		removeObjectSafe();


Commit: d918db1c32a18005561215fd00e0614256a0d9e7
    https://github.com/scummvm/scummvm/commit/d918db1c32a18005561215fd00e0614256a0d9e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: Scene::update runs its controller like CScene::Update, the stacked scenes go through it

Changed paths:
    engines/ngi/fullpipe/notebook.cpp
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/fullpipe/tutorialcontroller.cpp
    engines/ngi/ngi.cpp
    engines/ngi/scene.cpp


diff --git a/engines/ngi/fullpipe/notebook.cpp b/engines/ngi/fullpipe/notebook.cpp
index c3ae700d176..6d3309258a6 100644
--- a/engines/ngi/fullpipe/notebook.cpp
+++ b/engines/ngi/fullpipe/notebook.cpp
@@ -610,6 +610,8 @@ void Notebook::onUpdate(uint32 elapsed) {
 		}
 	}
 
+	// CNotebookController::OnUpdate (15D7BC): the scene below goes on
+	g_ngi->getSceneInStack(0)->update(elapsed);
 	if (_autoFoil)
 		removeFoil(elapsed);
 	else
diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index c98c4d00d3b..ab3a90dff10 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -584,8 +584,9 @@ void NGIEngine::updateSceneLogic(uint32 elapsed) {
 	if (_arcadeInterface)
 		_arcadeInterface->update(elapsed);
 
+	// the controller is updated by Scene::update; it is made here at the first use of the scene
 	if (_currentScene && _currentScene->_sceneId != SC_INTRO1)
-		sceneController(*_currentScene).onUpdate(elapsed);
+		sceneController(*_currentScene);
 
 	const MessageHandler *handler = getMessageHandlerById(2);
 	if (!handler || !_currentScene || _currentScene->_sceneId == SC_INTRO1)
diff --git a/engines/ngi/fullpipe/tutorialcontroller.cpp b/engines/ngi/fullpipe/tutorialcontroller.cpp
index 4548135a86e..e492fdd840d 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.cpp
+++ b/engines/ngi/fullpipe/tutorialcontroller.cpp
@@ -388,10 +388,7 @@ void TutorialController::onUpdate(uint32 elapsed) {
 		_arrowTime += (float)elapsed / 1000.0f;
 	if (g_ngi->_sceneStack.size() > 1) {
 		// CScene::Update of the scene below
-		Scene *below = sceneBelow();
-		below->update(elapsed);
-		if (below->_controller)
-			below->_controller->onUpdate(elapsed);
+		sceneBelow()->update(elapsed);
 	}
 	checkArrowPos();
 	addContinueBtnIfNeed(-1, -1, 0);
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 39f899f927a..eceb5614b39 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -822,8 +822,6 @@ Common::Error NGIEngine::updateScreen(uint32 elapsed, byte &brightness, bool red
 	if (hadDialog) {
 		Scene *top = getCurrentScene();
 		top->update(elapsed);
-		if (top == getCurrentScene() && top->_controller)
-			top->_controller->onUpdate(elapsed);
 		redraw = true;
 	}
 	if (!hadModal && (timedUpdates || _flgGameIsRunning)) {
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 61e865451b1..c167550d475 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -1523,7 +1523,18 @@ bool Scene::update(int counterdiff) {
 		for (uint i = 0; i < _interactionQueues.size(); i++)
 			_interactionQueues[i]->update(counterdiff);
 		processMessages();
-		changed |= updateObjects(counterdiff);
+		for (uint i = 0; i < _renderableAnis.size(); i++)
+			changed |= _renderableAnis[i]->update(counterdiff);
+		if (_controller)
+			_controller->onUpdate(counterdiff);
+		if (_physListener)
+			_physListener->update(counterdiff);
+		if (_guiManager)
+			changed |= _guiManager->update(counterdiff);
+		if (_zController)
+			_zController->update();
+		if (_controller)
+			_controller->onUpdateTop(counterdiff);
 		getGameLoaderInteractionController()->onUpdate(counterdiff);
 		removeObjectSafe();
 		return changed;


Commit: 614d268d4d3f8436302127f05290cb14492a9000
    https://github.com/scummvm/scummvm/commit/614d268d4d3f8436302127f05290cb14492a9000
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: Read the pointer pictures of CURSORCONTROLLER

Changed paths:
    engines/ngi/objects.h
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/objects.h b/engines/ngi/objects.h
index ef1609d6f98..618f4020d7e 100644
--- a/engines/ngi/objects.h
+++ b/engines/ngi/objects.h
@@ -112,6 +112,16 @@ class GameProject : public CObject {
 	bool _createInventory = true;
 	/** create_waitscreen of the project: the scene SC_LDR of sc_waitscreen.xml (the Android build) */
 	bool _createWaitScreen = true;
+	/** CURSORCONTROLLER of the project (CCursor): the picture shown for a cursor type */
+	struct PointerSpec {
+		int type = 0;
+		float offsetX = 0;
+		float offsetY = 0;
+		Common::String scene;
+		Common::String picture;
+		Common::String move;
+	};
+	Common::Array<PointerSpec> _pointers;
 
  public:
 	GameProject();
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index e1f091caf1b..b028d77e908 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -421,6 +421,17 @@ private:
 		if (!parent->ignore && (parent->name != "PROJECT" ||
 				(node->name != "DIALOGCONTROLLER" && node->name != "CURSORCONTROLLER")))
 			return false;
+		if (node->name == "CURSOR" && parent->name == "CURSORCONTROLLER") {
+			// CCursor::CCursor (F5150)
+			GameProject::PointerSpec spec;
+			spec.type = atoi(node->values.getValOrDefault("type", "0").c_str());
+			spec.offsetX = atof(node->values.getValOrDefault("ofsX", "0").c_str());
+			spec.offsetY = atof(node->values.getValOrDefault("ofsY", "0").c_str());
+			spec.scene = node->values.getValOrDefault("scene");
+			spec.picture = node->values.getValOrDefault("id");
+			spec.move = node->values.getValOrDefault("move");
+			_project._pointers.push_back(spec);
+		}
 		node->layout = _XMLkeys;
 		node->ignore = true;
 		return true;


Commit: 41c660f59964354250634911657b2908cb75afee
    https://github.com/scummvm/scummvm/commit/41c660f59964354250634911657b2908cb75afee
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: Port CScene::GetCursorType and IsCursorObjectRender

Changed paths:
    engines/ngi/inventory.h
    engines/ngi/scene.cpp
    engines/ngi/scene.h


diff --git a/engines/ngi/inventory.h b/engines/ngi/inventory.h
index b7922be4372..719587675c7 100644
--- a/engines/ngi/inventory.h
+++ b/engines/ngi/inventory.h
@@ -249,7 +249,7 @@ public:
 	bool onMouseRKeyUp(uint32 id, float x, float y) override;
 	bool onMouseMove(uint32 id, float x, float y) override;
 	/** CInventory::GetCursorType (the position is the one of the screen) */
-	int getCursorType(float x, float y);
+	int getCursorType(float x, float y) override;
 	/** CInventory::Hit */
 	bool hit(float x, float y);
 
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index c167550d475..ce67dfc94a1 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -1542,6 +1542,33 @@ bool Scene::update(int counterdiff) {
 	return changed | updateObjects(counterdiff);
 }
 
+// CScene::GetCursorType (120C94); the object name next to the cursor is not shown
+int Scene::getCursorType(float x, float y) {
+	int type = 0;
+	if (_controller && _controller->getCursorType(x, y) > 0)
+		type = _controller->getCursorType(x, y);
+	const int interactionType = getGameLoaderInteractionController()->getCursorType();
+	if (type < interactionType)
+		type = interactionType;
+	if (_guiManager) {
+		const int guiType = _guiManager->getCursorType(Common::Point(x - _x, y - _y));
+		if (guiType != -1)
+			type = guiType;
+	}
+	if (_controller && _controller->getCursorTypeTop(x, y) != -1)
+		return _controller->getCursorTypeTop(x, y);
+	return type;
+}
+
+// CScene::IsCursorObjectRender (11F6F4)
+bool Scene::isCursorObjectRender(float x, float y) {
+	if (_controller && !_controller->isCursorObjectRender(x, y))
+		return false;
+	if (_guiManager)
+		return _guiManager->isCursorObjectRender(Common::Point(x - _x, y - _y));
+	return true;
+}
+
 // CScene::IsQueuesProcessed (11FB98): a queue that is not stopped (interaction queues first)
 bool Scene::isQueuesProcessed(bool ignoreInterruptState3) const {
 	if (g_ngi->_gameVersion >= 201509) {
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index 392bca2e0f7..6f90f16de1f 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -175,6 +175,9 @@ class Scene : public Background {
 
 	/** Returns true if the scene may need redrawing. */
 	virtual bool update(int counterdiff);
+	/** CScene::GetCursorType (120C94) and IsCursorObjectRender (11F6F4); x, y in scene coordinates */
+	virtual int getCursorType(float x, float y);
+	bool isCursorObjectRender(float x, float y);
 	/** The objects and the GUI of CScene::Update (what a scene that is not the current one updates) */
 	bool updateObjects(int counterdiff);
 


Commit: 723840b5d75b42b1f35b49e67d6ff5acd7ed2be1
    https://github.com/scummvm/scummvm/commit/723840b5d75b42b1f35b49e67d6ff5acd7ed2be1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: Draw the pointer pictures of CCursorController

Changed paths:
    engines/ngi/gameloader.cpp
    engines/ngi/input.cpp
    engines/ngi/input.h


diff --git a/engines/ngi/gameloader.cpp b/engines/ngi/gameloader.cpp
index 51450e03a9c..348b56786b6 100644
--- a/engines/ngi/gameloader.cpp
+++ b/engines/ngi/gameloader.cpp
@@ -584,6 +584,8 @@ PicAniInfoList GameLoader::savePicAniInfos(Scene *sc, int flag1, int flag2) {
 
 bool GameLoader::updateContent(int counterdiff) {
 	if (g_ngi->_currentScene) {
+		if (g_ngi->_gameVersion >= 201509)
+			_inputController->update(counterdiff);
 		bool changed = g_ngi->_currentScene->update(counterdiff);
 		if (g_ngi->_gameVersion >= 201509) {
 			// CGame::UpdateContent: the inventory is updated when it is enabled
diff --git a/engines/ngi/input.cpp b/engines/ngi/input.cpp
index b2e2ee4b5b2..58aa190c78c 100644
--- a/engines/ngi/input.cpp
+++ b/engines/ngi/input.cpp
@@ -97,6 +97,64 @@ void CursorController::render() {
 		else
 			warning("STUB/untested: CCursorController::Render of an object that is not a picture");
 	}
+	if (!_pointerShown)
+		return;
+	for (const Pointer &pointer : _pointers) {
+		if (pointer.type != _cursorType || !pointer.picture)
+			continue;
+		// CCursor::Render (F52FC)
+		if (pointer.picture->_objtype == kObjTypePictureObject)
+			static_cast<PictureObject *>(pointer.picture)->renderAtPos(_screenX - pointer.offsetX, _screenY - pointer.offsetY);
+		else
+			warning("STUB/untested: CCursor::Render of an object that is not a picture");
+	}
+}
+
+void CursorController::initPointers() {
+	_pointers.clear();
+	bool complete = true;
+	for (const GameProject::PointerSpec &spec : g_ngi->_gameProject->_pointers) {
+		Pointer pointer;
+		pointer.type = spec.type;
+		pointer.offsetX = spec.offsetX;
+		pointer.offsetY = spec.offsetY;
+		uint32 sceneId = 0;
+		uint32 pictureId = 0;
+		if (g_ngi->_gameProject->_objectIds.findId(spec.scene, sceneId) && g_ngi->_gameProject->_objectIds.findId(spec.picture, pictureId)) {
+			if (Scene *scene = g_ngi->_gameProject->findLoadedScene(sceneId))
+				pointer.picture = scene->findVisibleObject(pictureId, 0);
+		}
+		if (!pointer.picture)
+			complete = false;
+		if (!spec.move.empty())
+			warning("STUB/untested: CCursor::Init starts the movement %s of the pointer", spec.move.c_str());
+		_pointers.push_back(pointer);
+	}
+	_pointersMade = complete;
+}
+
+// CGame +28 (a scene is being set: the type 7) is not modelled
+void CursorController::calcCursorType() {
+	Scene *scene = g_ngi->getCurrentScene();
+	if (!scene)
+		return;
+	_cursorType = scene->getCursorType(_hotSceneX, _hotSceneY);
+	const bool inventory = g_ngi->isInventoryEnabled();
+	if (inventory) {
+		const int inventoryType = g_ngi->_inventory->getCursorType(_hotScreenX, _hotScreenY);
+		if (inventoryType != -1)
+			_cursorType = inventoryType;
+	}
+	_objectVisible = scene->isCursorObjectRender(_hotSceneX, _hotSceneY);
+	if (inventory)
+		_objectVisible = _objectVisible && g_ngi->_inventory->Scene::isCursorObjectRender(_hotScreenX, _hotScreenY);
+}
+
+void CursorController::update(uint32 elapsed) {
+	if (!_pointersMade)
+		initPointers();
+	repopulateHitObjects(nullptr);
+	calcCursorType();
 }
 
 void CursorController::render(int x, int y) {
diff --git a/engines/ngi/input.h b/engines/ngi/input.h
index fa38c93c343..4ba2ebcdeb9 100644
--- a/engines/ngi/input.h
+++ b/engines/ngi/input.h
@@ -77,6 +77,17 @@ public:
 	float _offsetX = 0; // +128
 	float _offsetY = 0; // +132
 	Common::Array<GameObject *> _hitObjects; // +12: objects under the cursor, lowest z first
+	/** CCursor (+36): the picture that is shown for a cursor type */
+	struct Pointer {
+		int type = 0;
+		GameObject *picture = nullptr;
+		float offsetX = 0;
+		float offsetY = 0;
+	};
+	Common::Array<Pointer> _pointers;
+	bool _pointersMade = false;
+	int _cursorType = 0; // +80
+	bool _pointerShown = true; // +116
 
  public:
 	CursorController();
@@ -87,8 +98,14 @@ public:
 	void setCursorMode(bool mode);
 
 	void render(int x, int y);
-	/** CCursorController::Render: draws the held object (no pointer images, no cursor text) */
+	/** CCursorController::Render: the held object and the pointer picture, no cursor text */
 	void render();
+	/** CCursorController::Init (F556C), CCursor::Init (F5258): find the pointer pictures */
+	void initPointers();
+	/** CCursorController::CalcCursorType (F5802) */
+	void calcCursorType();
+	/** CCursorController::Update (F5C6C) */
+	void update(uint32 elapsed);
 	void setCursor(int id);
 
 	void setObject(Texture *pic) { _cursorItemPicture = pic; }


Commit: 99918bf87ca069c1b6113b1f306f524975b1fe4a
    https://github.com/scummvm/scummvm/commit/99918bf87ca069c1b6113b1f306f524975b1fe4a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: The Android scenes get their events through CScene::OnMouse*, the controller gets every mouse move

Changed paths:
    engines/ngi/ngi.cpp
    engines/ngi/scene.cpp


diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index eceb5614b39..7277493dbb6 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -335,8 +335,8 @@ bool NGIEngine::handleGuiEvent(const Common::Event &event) {
 		_touchDown = false;
 	if (event.type == Common::EVENT_SCREEN_CHANGED) {
 		return true;
-	} else if (_sceneStack.size() > 1) {
-		// the dialogs of the Android build are scenes on the stack (CGame::OnMouse*)
+	} else if (_sceneStack.size() > 1 || (usesXMLProject() && _gameVersion >= 201509 && !_modalObject)) {
+		// CGame::OnMouse*: the current scene gets the event, the dialogs are scenes on the stack too
 		return handleSceneStackEvent(event);
 	} else if (_modalObject) {
 		const bool back = (event.type == Common::EVENT_KEYUP &&
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index ce67dfc94a1..28174b810cb 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -206,6 +206,19 @@ bool NGIEngine::handleSceneStackEvent(const Common::Event &event) {
 	case Common::EVENT_MOUSEMOVE:
 		handled = scene->onMouseMove(0, event.mouse.x, event.mouse.y);
 		break;
+	case Common::EVENT_KEYDOWN:
+	case Common::EVENT_KEYUP:
+		// CScene::OnKeyDown / OnKeyUp / OnChar: the GUI elements only
+		if (scene->_guiManager) {
+			if (event.type == Common::EVENT_KEYUP) {
+				scene->_guiManager->onKeyUp(event.kbd.keycode);
+			} else {
+				scene->_guiManager->onKeyDown(event.kbd.keycode);
+				if (event.kbd.ascii)
+					scene->_guiManager->onChar(event.kbd.ascii);
+			}
+		}
+		return false;
 	case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
 		if (event.customType == kActionCloseDialog)
 			scene->onKeyUp(4); // AKEYCODE_BACK
@@ -1264,9 +1277,9 @@ bool Scene::onMouseMove(uint32 id, float x, float y) {
 	if (!_controller || !_controller->onMouseMoveTop(id, sceneX, sceneY)) {
 		if (_guiManager)
 			_guiManager->onMouseMove(Common::Point(x, y));
-		if (_controller)
-			_controller->onMouseMove(id, sceneX, sceneY);
 	}
+	if (_controller)
+		_controller->onMouseMove(id, sceneX, sceneY);
 	return false;
 }
 


Commit: d3075de22a0edae167c4f178a94ddb6c6fc1e280
    https://github.com/scummvm/scummvm/commit/d3075de22a0edae167c4f178a94ddb6c6fc1e280
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: CCursorController::CalcCursorType asks the inventory with the scene position

Changed paths:
    engines/ngi/input.cpp


diff --git a/engines/ngi/input.cpp b/engines/ngi/input.cpp
index 58aa190c78c..2ea5765972c 100644
--- a/engines/ngi/input.cpp
+++ b/engines/ngi/input.cpp
@@ -147,7 +147,7 @@ void CursorController::calcCursorType() {
 	}
 	_objectVisible = scene->isCursorObjectRender(_hotSceneX, _hotSceneY);
 	if (inventory)
-		_objectVisible = _objectVisible && g_ngi->_inventory->Scene::isCursorObjectRender(_hotScreenX, _hotScreenY);
+		_objectVisible = _objectVisible && g_ngi->_inventory->Scene::isCursorObjectRender(_hotSceneX, _hotSceneY);
 }
 
 void CursorController::update(uint32 elapsed) {


Commit: 86b6a0b2eed0cb525c9fb5ac3742d800d7795539
    https://github.com/scummvm/scummvm/commit/86b6a0b2eed0cb525c9fb5ac3742d800d7795539
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: CTutorialController::Finish and TransmitCoord as in the original

Changed paths:
    engines/ngi/fullpipe/tutorialcontroller.cpp
    engines/ngi/fullpipe/tutorialcontroller.h


diff --git a/engines/ngi/fullpipe/tutorialcontroller.cpp b/engines/ngi/fullpipe/tutorialcontroller.cpp
index e492fdd840d..dfd8f303f5c 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.cpp
+++ b/engines/ngi/fullpipe/tutorialcontroller.cpp
@@ -148,7 +148,7 @@ void TutorialController::transmitCoord() {
 	if (_transmitObject)
 		cursor->setObject(_transmitObject, 0, 0);
 	cursor->setCursorPos(_transmitX, _transmitY);
-	warnOnce("CCursorController::Update (the hit objects are repopulated by the next touch)");
+	cursor->update(0);
 	g_ngi->getCurrentScene()->onMouseLKeyUp(0, _transmitX, _transmitY);
 	_transmitObject = nullptr;
 	_transmitX = -1;
@@ -283,7 +283,7 @@ void TutorialController::start() {
 	Movement *fall = _man->getMovement(MOV_SC_TUTORIAL_BEARDED_FALL);
 	fall->_phases[0]->_delayMs = tutorial->_isArcade ? 1000 : 0;
 	fall->_loopDelay = 83;
-	runSceneQueue(tutorial->_isMirror ? QU_SC_TUTORIAL_BEARDED_FALL_MIRROR : QU_SC_TUTORIAL_BEARDED_FALL);
+	_scene->findMessageQueue(tutorial->_isMirror ? QU_SC_TUTORIAL_BEARDED_FALL_MIRROR : QU_SC_TUTORIAL_BEARDED_FALL)->run(4);
 	_skipButton = inventoryButton("BTN_SKIP");
 	if (tutorial->_isExtra) {
 		inventoryController()->setHelperVisible(false);
@@ -302,12 +302,13 @@ void TutorialController::finish() {
 	unloadLayout();
 	Tutorial *tutorial = g_ngi->_tutorialManager->findActiveTutorial();
 	const int queueId = tutorial && tutorial->_isMirror ? QU_SC_TUTORIAL_BEARDED_RISE_MIRROR : QU_SC_TUTORIAL_BEARDED_RISE;
-	if (!_scene->isQueueRunning(queueId)) {
+	MessageQueue *queue = _scene->findMessageQueue(queueId);
+	if (queue->_curIndex == -1) {
 		Movement *fall = _man->getMovement(MOV_SC_TUTORIAL_BEARDED_FALL);
 		fall->_loopDelay = 60;
 		fall->_phases[0]->_delayMs = 0;
 		// CMessageQueue::Run(queue, 3): background queue, interactions starting meanwhile do not stop it
-		runSceneQueue(queueId, 3);
+		queue->run(3);
 	}
 	if (tutorial && tutorial->_id == "TUTORIAL_LAST") {
 		inventoryController()->setHelperVisible(false);
@@ -316,11 +317,6 @@ void TutorialController::finish() {
 	}
 }
 
-// CScene::RunQueue of the scene of the controller
-bool TutorialController::runSceneQueue(int queueId, int interruptState) {
-	return _scene->runQueue(queueId, interruptState);
-}
-
 // CTutorialController::OnShow (1A46C8)
 void TutorialController::onShow() {
 	_step++;
diff --git a/engines/ngi/fullpipe/tutorialcontroller.h b/engines/ngi/fullpipe/tutorialcontroller.h
index 0b6963a9b98..dba36fed8c5 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.h
+++ b/engines/ngi/fullpipe/tutorialcontroller.h
@@ -103,8 +103,6 @@ private:
 	float _transmitX = -1; // +80: where the touch goes on to the scene below
 	float _transmitY = -1; // +84
 	GameObject *_transmitObject = nullptr; // +88
-
-	bool runSceneQueue(int queueId, int interruptState = 4);
 };
 
 } // End of namespace NGI


Commit: 3450ee3418b7670e8f0292b58e45b164c0dbdb15
    https://github.com/scummvm/scummvm/commit/3450ee3418b7670e8f0292b58e45b164c0dbdb15
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:47+01:00

Commit Message:
NGI: CInventory::Update ends with CScene::Update

Changed paths:
    engines/ngi/inventory.cpp


diff --git a/engines/ngi/inventory.cpp b/engines/ngi/inventory.cpp
index a40714e2ede..5db15e101ff 100644
--- a/engines/ngi/inventory.cpp
+++ b/engines/ngi/inventory.cpp
@@ -1157,13 +1157,7 @@ bool Inventory::update(int elapsed) {
 	}
 	for (uint i = _firstVisible; i < _items.size(); i++)
 		_items[i]->onUpdate(elapsed);
-	// CScene::Update: the controller after the objects and the queues
-	if (_controller)
-		_controller->onUpdate(elapsed);
-	const bool changed = updateObjects(elapsed);
-	if (_controller)
-		_controller->onUpdateTop(elapsed);
-	return changed;
+	return Scene::update(elapsed);
 }
 
 // CInventory::RenderBottom (108EA4)


Commit: 3b2f868e8a75016249c2431f3c41c1e9dc6da01c
    https://github.com/scummvm/scummvm/commit/3b2f868e8a75016249c2431f3c41c1e9dc6da01c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: The cursor and the inventory update under a dialog too, the scene on top of the stack runs (CGame::UpdateContent)

Changed paths:
    engines/ngi/gameloader.cpp
    engines/ngi/ngi.cpp


diff --git a/engines/ngi/gameloader.cpp b/engines/ngi/gameloader.cpp
index 348b56786b6..c8cd581052a 100644
--- a/engines/ngi/gameloader.cpp
+++ b/engines/ngi/gameloader.cpp
@@ -586,9 +586,10 @@ bool GameLoader::updateContent(int counterdiff) {
 	if (g_ngi->_currentScene) {
 		if (g_ngi->_gameVersion >= 201509)
 			_inputController->update(counterdiff);
-		bool changed = g_ngi->_currentScene->update(counterdiff);
+		// CGame::UpdateContent: the scene on top of the stack
+		bool changed = (g_ngi->_gameVersion >= 201509 ? g_ngi->getCurrentScene() : g_ngi->_currentScene)->update(counterdiff);
 		if (g_ngi->_gameVersion >= 201509) {
-			// CGame::UpdateContent: the inventory is updated when it is enabled
+			// the inventory is updated when it is enabled
 			if (g_ngi->isInventoryEnabled())
 				changed |= g_ngi->_inventory->update(counterdiff);
 			return changed;
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 7277493dbb6..971bcfc93db 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -816,22 +816,20 @@ Common::Error NGIEngine::updateScreen(uint32 elapsed, byte &brightness, bool red
 	_mouseVirtY = _mouseScreenPos.y + _sceneRect.top;
 
 	Scene *scene = _currentScene;
-	// Android dialogs are scenes on the stack: while one is on top the scene below does not run
+	// Android dialogs are scenes on the stack: only the scene on top is updated (CGame::UpdateContent)
 	const bool hadDialog = timedUpdates && _sceneStack.size() > 1;
 	const bool hadModal = _modalObject != nullptr || hadDialog;
-	if (hadDialog) {
-		Scene *top = getCurrentScene();
-		top->update(elapsed);
+	if (hadDialog)
 		redraw = true;
-	}
-	if (!hadModal && (timedUpdates || _flgGameIsRunning)) {
+	if (!_modalObject && (timedUpdates || _flgGameIsRunning)) {
 		redraw |= _gameLoader->updateContent(elapsed);
-		if (usesXMLProject() && !isDialogShown() && scene == _currentScene && scene->_sceneId == SC_INTRO1)
-			redraw |= sceneIntro_updateAndroid(elapsed, brightness);
-		if (timedUpdates)
-			processMessages();
-		if (usesXMLProject() && !isDialogShown() && !_gameLoader->_preloadSceneId) {
-			updateSceneLogic(elapsed);
+		if (!hadDialog) {
+			if (usesXMLProject() && scene == _currentScene && scene->_sceneId == SC_INTRO1)
+				redraw |= sceneIntro_updateAndroid(elapsed, brightness);
+			if (timedUpdates)
+				processMessages();
+			if (usesXMLProject() && !_gameLoader->_preloadSceneId)
+				updateSceneLogic(elapsed);
 		}
 	}
 	const bool renderScene = !_modalObject;


Commit: e0bb8c32adcad47c662107f583ab8d719e461109
    https://github.com/scummvm/scummvm/commit/e0bb8c32adcad47c662107f583ab8d719e461109
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: HIDE finds pictures, SET_STATIC runs, REMOVE_INV_ITEM has no guard (CMessageQueue::ExecuteCmd*)

Changed paths:
    engines/ngi/messagehandlers.cpp
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/messagehandlers.cpp b/engines/ngi/messagehandlers.cpp
index e34e631f7a9..73ac5c1bb9b 100644
--- a/engines/ngi/messagehandlers.cpp
+++ b/engines/ngi/messagehandlers.cpp
@@ -686,6 +686,12 @@ int global_messageHandler4(Command *cmd) {
 		if (!ani)
 			break;
 
+		if (g_ngi->_gameVersion >= 201509) {
+			// CMessageQueue::ExecuteCmdStatic (10E514): the mirror stays unless the command gives it
+			ani->setStatic(cmd->_messageNum, cmd->_auxParam < 0 ? (ani->_flags & 8) != 0 : cmd->_auxParam != 0);
+			break;
+		}
+
 		ani->_flags |= 4;
 		ani->setStatic(cmd->_messageNum);
 		break;
@@ -694,6 +700,23 @@ int global_messageHandler4(Command *cmd) {
 		if (!scene)
 			break;
 
+		if (g_ngi->_gameVersion >= 201509) {
+			// CMessageQueue::ExecuteCmdHide (10D184): any visible object, a picture too
+			GameObject *object = scene->findVisibleObject(cmd->_parentId, cmd->_param);
+			if (!object && !cmd->_param) {
+				// CScene::FindVisibleObjectAnyCopy
+				for (PictureObject *picture : scene->_pictureObjects) {
+					if (picture->_id == cmd->_parentId)
+						object = picture;
+				}
+				if (!object)
+					object = scene->findAniObjectById(cmd->_parentId, -1);
+			}
+			if (object)
+				object->_flags &= ~4;
+			break;
+		}
+
 		ani = scene->findAniObjectById(cmd->_parentId, cmd->_param);
 		if (!ani)
 			break;
@@ -799,10 +822,8 @@ int global_messageHandler4(Command *cmd) {
 			const Common::String itemId = g_ngi->_gameProject->_objectIds.findName(cmd->_parentId);
 			if (cmd->_cmd == kCmdAddInvItem)
 				g_ngi->_inventory->addItem(itemId, 1);
-			else if (InventoryItem *item = g_ngi->_inventory->getItemByName(itemId)) {
-				if (item->_counter)
-					g_ngi->_inventory->removeItem(itemId, -1);
-			}
+			else
+				g_ngi->_inventory->removeItem(itemId, -1);
 		}
 		break;
 	case kCmdUser:
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index b028d77e908..fd20280e498 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1473,7 +1473,14 @@ private:
 				return parserError("Unknown object in MOVE_TO_STATIC");
 			if (!node->values.getValOrDefault("static").empty())
 				idProperty = "static";
-		} else if (kind == "USER" || kind == "12" || kind == "SET_STATIC" || kind == "25" || kind == "SET_ACTIVE_INTERACTION") {
+		} else if (kind == "SET_STATIC" || kind == "25") {
+			// CMessageQueue::ExecuteCmdStatic (10E514)
+			cmd->_cmd = kCmdSetStatic;
+			if (!readId(node->values.getValOrDefault("ani"), cmd->_parentId))
+				return parserError("Unknown animation in SET_STATIC");
+			cmd->_auxParam = node->values.contains("mirror") ? (int)boolProperty(*node, "mirror") : -1;
+			idProperty = "stat";
+		} else if (kind == "USER" || kind == "12" || kind == "SET_ACTIVE_INTERACTION") {
 			cmd->_cmd = kCmdUser;
 			cmd->_messageName = node->values.getValOrDefault("type", kind);
 			// only SET_SCROLL waits (CFPController::UpdateCmdScroll); GO_MCTL (UpdateCmdMctl) is not ported


Commit: d752b0dff4ad04d5ca4123a48a51423a7e68452a
    https://github.com/scummvm/scummvm/commit/d752b0dff4ad04d5ca4123a48a51423a7e68452a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: CFPController::OnUpdate runs the tremble, task and achievement updates, hides the reaction, camera time only without a dialog

Changed paths:
    engines/ngi/fullpipe/fpcontroller.cpp
    engines/ngi/fullpipe/scenes.cpp


diff --git a/engines/ngi/fullpipe/fpcontroller.cpp b/engines/ngi/fullpipe/fpcontroller.cpp
index d0efe8f85cc..d6d1557b3ed 100644
--- a/engines/ngi/fullpipe/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/fpcontroller.cpp
@@ -50,6 +50,7 @@
 #include "ngi/guimanager.h"
 #include "ngi/inventory.h"
 #include "ngi/fullpipe/tremble.h"
+#include "ngi/fullpipe/tutorialmanager.h"
 
 namespace NGI {
 
@@ -540,6 +541,10 @@ void FPController::testScroll() {
 
 // CFPController::OnUpdate, the camera part: every 10 ms UpdateScroll, TestScroll unless touching
 void FPController::onUpdate(uint32 elapsed) {
+	// the hint of the bar shakes when the tutorials are over and the hero can be swiped
+	const bool idle = g_ngi->_tutorialManager->isTutorialCompleted() && !g_ngi->_tutorialManager->findActiveTutorial() && canSwipeMan(0.0f, 0.0f);
+	if (g_ngi->_tremble)
+		g_ngi->_tremble->onUpdate(elapsed, idle);
 	// the time restarts while the hero cannot be swiped (CanSwipeMan(0, 0) is false)
 	g_ngi->_hintManager->onUpdate(elapsed);
 	g_ngi->_noActionLogger->onUpdate(elapsed);
@@ -547,7 +552,10 @@ void FPController::onUpdate(uint32 elapsed) {
 		g_ngi->_noActionLogger->_time = 0;
 	checkTutorial();
 	checkQueues();
-	_elapsed += elapsed;
+	if (!_walkQueue)
+		_swiped = false;
+	if (g_ngi->_sceneStack.size() == 1)
+		_elapsed += elapsed;
 	const int oldX = _scene->_x;
 	const int oldY = _scene->_y;
 	while (_elapsed > 10) {
@@ -562,6 +570,13 @@ void FPController::onUpdate(uint32 elapsed) {
 		g_ngi->_objHelperHint->checkObjHelperHint(_scene);
 	// CExitManager::OnUpdate; the original has no test for a missing hero
 	g_ngi->_exitManager->onUpdate(elapsed, hero() ? hero()->_z : -1000.0f);
+	if (g_ngi->_taskManager)
+		g_ngi->_taskManager->onUpdate(elapsed);
+	if (g_ngi->_achievementsManager)
+		g_ngi->_achievementsManager->onUpdate(elapsed);
+	// the pointer reaction hides when its movement is over
+	if (_react && (_react->_flags & 4) && !_react->_movement)
+		_react->_flags &= ~4;
 	if (_scene->_x != oldX || _scene->_y != oldY) {
 		debugC(2, kDebugSceneLogic, "camera %d -> %d (target %g, follow %d)", oldX, _scene->_x, _targetX, _follow != nullptr);
 		g_ngi->_sceneRect.moveTo(_scene->_x, _scene->_y);
@@ -582,7 +597,6 @@ void FPController::checkQueues() {
 		_lastTargetY = 0;
 		_interactObjectId = 0;
 		_swipeDirection = 0;
-		_swiped = false;
 		// the item that INTERACT_PRESTART kept in the state 1 shows again (+204)
 		if (_interactItemId) {
 			if (InventoryItem *item = g_ngi->_inventory->getItem(_interactItemId))
diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index ab3a90dff10..8cfe10ca286 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -569,16 +569,6 @@ bool NGIEngine::initSceneLogic(Scene *scene, int entranceId) {
 // Android calls the controller's OnUpdate(ms) every frame; the scene handler gets kMsgUpdate
 // with the elapsed milliseconds in _param.
 void NGIEngine::updateSceneLogic(uint32 elapsed) {
-	// CFPController::OnUpdate
-	if (_tremble && _currentScene) {
-		// the hint only shakes when nothing else is going on: the tutorial is completed and none is shown
-		const bool idle = _tutorialManager->isTutorialCompleted() && !isDialogShown();
-		_tremble->onUpdate(elapsed, idle);
-	}
-	if (_taskManager)
-		_taskManager->onUpdate(elapsed);
-	if (_achievementsManager)
-		_achievementsManager->onUpdate(elapsed);
 	testmode_update(elapsed);
 	// CInventoryController::OnUpdate runs the arcade interface
 	if (_arcadeInterface)


Commit: 6bbcf49c163c7ea9e7889771a2bc7866029a7b35
    https://github.com/scummvm/scummvm/commit/6bbcf49c163c7ea9e7889771a2bc7866029a7b35
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: CFPController::OnShow resets the targets and the interaction object, switches the interactions on, hides the helper pictures; REFRESH_INVENTORY

Changed paths:
    engines/ngi/fullpipe/fpcontroller.cpp


diff --git a/engines/ngi/fullpipe/fpcontroller.cpp b/engines/ngi/fullpipe/fpcontroller.cpp
index d6d1557b3ed..6b0078878db 100644
--- a/engines/ngi/fullpipe/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/fpcontroller.cpp
@@ -214,7 +214,7 @@ bool FPController::isScrollYScene() const {
 	return _scene->_dims.y > g_ngi->_backgroundSurface.h;
 }
 
-// CFPController::OnShow, camera part; not ported: ResetSwipeParams, flurry, hints, GUI helpers
+// CFPController::OnShow, the camera part and the resets; not ported: flurry, hints
 void FPController::onShow() {
 	// CMap::Update: the scene and the entrance it was entered through appear on the map
 	if (g_ngi->_map)
@@ -230,8 +230,17 @@ void FPController::onShow() {
 	_touching = false;
 	_dragged = false;
 	resetSwipeParams();
+	_lastTargetX = _lastTargetY = 0;
+	_failedTargetX = _failedTargetY = 0;
+	_interactObjectId = 0;
+	_swipeDirection = 0;
 	g_ngi->_sceneRect.moveTo(_scene->_x, _scene->_y);
 
+	// the interactions are on again, the helper pictures of the bar are hidden
+	getGameLoaderInteractionController()->_enabled = true;
+	g_ngi->_inventory->_guiManager->getElement("PIC_INV_HELPER_ACTIONS")->hide();
+	g_ngi->_inventory->_guiManager->getElement("PIC_INV_HELPER_ZONES")->hide();
+
 	if (PictureObject *button = _scene->findPictureObjectById(PIC_SC8_ARCADENOW, 0))
 		button->_flags &= ~4;
 
@@ -955,6 +964,8 @@ void FPController::onMessage(const Common::String &message, const Common::String
 		onInteractPrestart();
 	} else if (message == "INTERACT_ENDED") {
 		onInteractEnded(param, queue);
+	} else if (message == "REFRESH_INVENTORY") {
+		g_ngi->_inventory->setItemsState(0);
 	}
 }
 


Commit: 82a9c351c47ba09b2bd2792bd0bb0ac68076f811
    https://github.com/scummvm/scummvm/commit/82a9c351c47ba09b2bd2792bd0bb0ac68076f811
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: CFPController::TestSwipe and ExecCmdScroll without the guards the original does not have

Changed paths:
    engines/ngi/fullpipe/fpcontroller.cpp


diff --git a/engines/ngi/fullpipe/fpcontroller.cpp b/engines/ngi/fullpipe/fpcontroller.cpp
index 6b0078878db..841b6fc803a 100644
--- a/engines/ngi/fullpipe/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/fpcontroller.cpp
@@ -309,7 +309,7 @@ void FPController::execCmdScroll(Command *cmd) {
 			y = sceneSize.y - viewHeight;
 	}
 
-	if (boolParam(cmd, "scroll") && _scene == g_ngi->_currentScene) {
+	if (boolParam(cmd, "scroll")) {
 		// the camera moves towards the point (+52/+56), 3 pixels every 10 ms, see updateCamera
 		scrollTo(x - _scene->_x, y - _scene->_y);
 	} else {
@@ -803,8 +803,6 @@ bool FPController::tryStartInteractMan() {
 
 // CFPController::TestSwipe
 void FPController::testSwipe() {
-	if (_scene->_sceneId != g_ngi->_currentScene->_sceneId)
-		return;
 	if (!canSwipeMan(cursorX(), cursorY()))
 		return;
 	if (!hero())


Commit: feb211165a55ec92964c849cebd2eaab425c6c4f
    https://github.com/scummvm/scummvm/commit/feb211165a55ec92964c849cebd2eaab425c6c4f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: PopScene sends the mouse move, CScene::OnShow runs the controller before the behaviors (after the sound lists in DoSetScene)

Changed paths:
    engines/ngi/behavior.cpp
    engines/ngi/behavior.h
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/scene.cpp


diff --git a/engines/ngi/behavior.cpp b/engines/ngi/behavior.cpp
index 8c40a613940..0f998fbed54 100644
--- a/engines/ngi/behavior.cpp
+++ b/engines/ngi/behavior.cpp
@@ -80,7 +80,8 @@ BehaviorMove &BehaviorAni::addMove(int16 staticsId) {
 	return moves.back();
 }
 
-void BehaviorController::onShow(Scene &scene) {
+// The behaviors find their animations by id (the original looks them up when needed)
+void BehaviorController::attachAnimations(Scene &scene) {
 	_scene = &scene;
 	for (BehaviorAni &behavior : _behaviors) {
 		AniObject *ani = scene.findAniObjectById(behavior._objectId, 0);
@@ -92,6 +93,10 @@ void BehaviorController::onShow(Scene &scene) {
 			behavior._elapsed = 0;
 		}
 	}
+}
+
+void BehaviorController::onShow(Scene &scene) {
+	attachAnimations(scene);
 	if (scene._putPrev) // CBehaviorController::OnShow: music only for a replacing scene (+37 == 0)
 		return;
 	for (int i = 0; i < g_ngi->_currSoundListCount; ++i) {
diff --git a/engines/ngi/behavior.h b/engines/ngi/behavior.h
index f1a02610f2f..79d122fa29a 100644
--- a/engines/ngi/behavior.h
+++ b/engines/ngi/behavior.h
@@ -115,6 +115,7 @@ class BehaviorController : public CObject {
 	/** CBehaviorController::DisableAllMusic: stops the tracks and switches them off */
 	void disableAllMusic();
 	BehaviorAni &addAni(int16 objectId, int16 sceneId, int flags);
+	void attachAnimations(Scene &scene);
 	void onShow(Scene &scene);
 	bool update(uint32 elapsed = 1);
 	/** CBehaviorController::OnSetQueue (F3774) and OnStartQueue (F3564) */
diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index 8cfe10ca286..ce53d7e34ea 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -674,8 +674,6 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 		removeMessageHandler(2, -1);
 		stopAllSounds(Sound::kSpeech);
 		stopAllSounds(Sound::kEffect);
-		if (scene->_behaviorController)
-			scene->_behaviorController->onShow(*scene);
 		_currSoundListCount = 0;
 		if (scene->_soundList)
 			_currSoundList1[_currSoundListCount++] = scene->_soundList.get();
@@ -711,10 +709,15 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 		_sceneStack.push_back(scene);
 		scene->_currentEntranceId = entrance._id;
 		FPController &controller = sceneController(*scene);
+		if (scene->_behaviorController)
+			scene->_behaviorController->attachAnimations(*scene);
 		if (scene->_sceneId != SC_INTRO1) {
 			controller.initScene();
 			controller.onShow();
 		}
+		// CScene::OnShow: the behaviors after the controller, with the sound lists of the scene
+		if (scene->_behaviorController)
+			scene->_behaviorController->onShow(*scene);
 		if (_aniMan && scene->_motionController) {
 			scene->_motionController->attachObject(_aniMan);
 			scene->_motionController->activate();
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 28174b810cb..316b392a75b 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -30,6 +30,7 @@
 #include "ngi/objects.h"
 #include "ngi/behavior.h"
 #include "ngi/ngiarchive.h"
+#include "ngi/input.h"
 #include "ngi/statics.h"
 #include "ngi/messages.h"
 #include "ngi/physics.h"
@@ -133,7 +134,7 @@ void NGIEngine::pushScene(int sceneId) {
 	scene->onShow();
 }
 
-// CGame::PopScene (FCBAC): CGame::OnMouseMove with the cursor, CRender::SetSrcRect are not ported
+// CGame::PopScene (FCBAC): CRender::SetSrcRect is not ported
 void NGIEngine::popScene() {
 	Scene *scene = getCurrentScene();
 	if (!scene || _sceneStack.size() < 2) {
@@ -146,6 +147,10 @@ void NGIEngine::popScene() {
 	scene->onHide();
 	_soundManager.stopInScene(scene->_sceneId);
 	_sceneStack.pop_back();
+	// CGame::OnMouseMove with the cursor (the scene position goes in as the screen one)
+	getCurrentScene()->onMouseMove(0, _inputController->_hotSceneX, _inputController->_hotSceneY);
+	if (isInventoryEnabled())
+		_inventory->onMouseMove(0, _inputController->_hotSceneX, _inputController->_hotSceneY);
 	getCurrentScene()->resetCurrLoadingObj();
 	if (!getCurrentScene()->isSoundPaused())
 		_soundManager.resumeInScene(getCurrentScene()->_sceneId);
@@ -1197,9 +1202,11 @@ uint Scene::unloadAdditional() {
 // CScene::OnShow (the parts that are ported): the controller, the behaviors
 void Scene::onShow() {
 	if (_behaviorController)
-		_behaviorController->onShow(*this);
+		_behaviorController->attachAnimations(*this);
 	if (_controller)
 		_controller->onShow();
+	if (_behaviorController)
+		_behaviorController->onShow(*this);
 }
 
 // CScene::OnHide (the parts that are ported): the controller and the GUI


Commit: 5fd6315f037e11f6a8294c6978e5e759aa97d9f7
    https://github.com/scummvm/scummvm/commit/5fd6315f037e11f6a8294c6978e5e759aa97d9f7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Shared controller helpers isState, isSoundPlayed, copyQueue, moveToStaticCommand, setSceneCommand

Changed paths:
    engines/ngi/fullpipe/controllerhelpers.cpp
    engines/ngi/fullpipe/controllerhelpers.h
    engines/ngi/fullpipe/sc04controller.cpp


diff --git a/engines/ngi/fullpipe/controllerhelpers.cpp b/engines/ngi/fullpipe/controllerhelpers.cpp
index d244751e484..dc7772acc39 100644
--- a/engines/ngi/fullpipe/controllerhelpers.cpp
+++ b/engines/ngi/fullpipe/controllerhelpers.cpp
@@ -26,6 +26,7 @@
 #include "ngi/interaction.h"
 #include "ngi/messages.h"
 #include "ngi/scene.h"
+#include "ngi/sound.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/controllerhelpers.h"
 #include "ngi/fullpipe/fpcontroller.h"
@@ -78,6 +79,39 @@ Command *queueCommand(int queueId, const char *name, const char *interrupt) {
 	return command;
 }
 
+Command *moveToStaticCommand(int aniId, int copyId, int staticId) {
+	Command *command = new Command(aniId, kCmdMoveToStatic, staticId, 0, 0, 0, 1, 0, 0, 0);
+	command->_param = copyId;
+	command->_excFlags |= 2;
+	return command;
+}
+
+Command *setSceneCommand(int sceneId, int entranceId, const char *scene, const char *entrance) {
+	Command *command = new Command(sceneId, kCmdSetScene, entranceId, 0, 0, 0, 0, 0, 0, 0);
+	command->_args["scene"] = scene;
+	command->_args["entr"] = entrance;
+	command->_excFlags = 2;
+	return command;
+}
+
+bool isState(const char *object, const char *state) {
+	return g_ngi->getStateId(object) == g_ngi->getStateValue(object, state);
+}
+
+bool isSoundPlayed(int soundId) {
+	const Sound *sound = g_ngi->findSound(soundId);
+	return sound && sound->isPlaying();
+}
+
+MessageQueue *copyQueue(Scene *scene, int queueId) {
+	MessageQueue *queue = scene->findMessageQueue(queueId);
+	if (!queue)
+		return nullptr;
+	MessageQueue *copy = new MessageQueue(queue, 0, 0);
+	copy->_scene = scene;
+	return copy;
+}
+
 void hideAction(Scene *scene, int objectId, int copyId) {
 	AniObject *ani;
 	do {
diff --git a/engines/ngi/fullpipe/controllerhelpers.h b/engines/ngi/fullpipe/controllerhelpers.h
index 14f1163325a..42bb935aae1 100644
--- a/engines/ngi/fullpipe/controllerhelpers.h
+++ b/engines/ngi/fullpipe/controllerhelpers.h
@@ -27,6 +27,7 @@ namespace NGI {
 class AniObject;
 class Command;
 class Interact;
+class MessageQueue;
 class Scene;
 
 /** Helpers shared by the CScNNController ports: queue and mouse commands, STUB placeholders */
@@ -38,6 +39,17 @@ Command *movementCommand(const AniObject *ani, int movementId);
 Command *pauseCommand(int delay);
 Command *hideCommand(int objectId, int copyId);
 Command *queueCommand(int queueId, const char *name, const char *interrupt);
+/** MOVE_TO_STATIC of the copy of the object */
+Command *moveToStaticCommand(int aniId, int copyId, int staticId);
+/** SETSC with the scene and the entrance (the ids of the project) */
+Command *setSceneCommand(int sceneId, int entranceId, const char *scene, const char *entrance);
+
+/** The state of the object is the named one (CStateManager::GetState == string) */
+bool isState(const char *object, const char *state);
+/** CSoundManager::IsPlayed */
+bool isSoundPlayed(int soundId);
+/** FindQueue + CMessageQueue::CMessageQueue(CMessageQueue *): the copy of the queue of the scene */
+MessageQueue *copyQueue(Scene *scene, int queueId);
 
 /** CFPController::HideAction (1490B0): stops and hides the copies from copyId on */
 void hideAction(Scene *scene, int objectId, int copyId);
diff --git a/engines/ngi/fullpipe/sc04controller.cpp b/engines/ngi/fullpipe/sc04controller.cpp
index a740764eda4..2d580b05007 100644
--- a/engines/ngi/fullpipe/sc04controller.cpp
+++ b/engines/ngi/fullpipe/sc04controller.cpp
@@ -60,26 +60,6 @@ const int kSpeakerPhases[] = {
 	0, 2, -1, -1, -1, -1
 };
 
-bool isState(const char *object, const char *state) {
-	return g_ngi->getStateId(object) == g_ngi->getStateValue(object, state);
-}
-
-// CSoundManager::IsPlayed
-bool isSoundPlayed(int soundId) {
-	const Sound *sound = g_ngi->findSound(soundId);
-	return sound && sound->isPlaying();
-}
-
-// FindQueue + CMessageQueue::CMessageQueue(CMessageQueue *): the copy of the queue of the scene
-MessageQueue *copyQueue(Scene *scene, int queueId) {
-	MessageQueue *queue = scene->findMessageQueue(queueId);
-	if (!queue)
-		return nullptr;
-	MessageQueue *copy = new MessageQueue(queue, 0, 0);
-	copy->_scene = scene;
-	return copy;
-}
-
 // CCommand(USER) type EXIT_ROTATE with the parameters picId and where
 Command *exitRotateCommand(const char *where) {
 	Command *command = new Command(0, kCmdUser, 0, 0, 0, 0, 0, 0, 0, 0);


Commit: 1f9059c0f3e6908b13cb136cb5e2a715e32673ea
    https://github.com/scummvm/scummvm/commit/1f9059c0f3e6908b13cb136cb5e2a715e32673ea
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc05Controller

Changed paths:
  A engines/ngi/fullpipe/sc05controller.cpp
  A engines/ngi/fullpipe/sc05controller.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk
    engines/ngi/scene.cpp
    engines/ngi/scene.h


diff --git a/engines/ngi/fullpipe/sc05controller.cpp b/engines/ngi/fullpipe/sc05controller.cpp
new file mode 100644
index 00000000000..c4855f1f1b3
--- /dev/null
+++ b/engines/ngi/fullpipe/sc05controller.cpp
@@ -0,0 +1,302 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc05controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc05Controller::CSc05Controller (169B54)
+Sc05Controller::Sc05Controller(int sceneId) : FPController(sceneId), _flyPack(new FlyPack()) {
+}
+
+// CSc05Controller::~CSc05Controller (169B08): the fly pack goes with it
+Sc05Controller::~Sc05Controller() {
+}
+
+// CSc05Controller::UpdateLastpush (169BB0)
+void Sc05Controller::updateLastpush() {
+	if (hero()->_movement && (uint)(hero()->getLastMovementId() - MV_MANHDL_HANDLEDOWN) <= 1)
+		_pushTime = g_system->getMillis();
+	else
+		_pushTime = 0;
+}
+
+// CSc05Controller::TryFly (169BE0)
+void Sc05Controller::tryFly() {
+	if (_flyTimer <= 83000)
+		return;
+	if (random31() & 1)
+		return;
+	const int count = random31() / 715827882;
+	for (int i = 0; i <= count; i++) {
+		const int x = scaledRandom(55) + 538;
+		const int y = 30 * i + 520 + scaledRandom(60);
+		_flyPack->addFly(_scene, x, y, 4, 1);
+		GutlFly &fly = _flyPack->_flies.back();
+		fly.targetX = 585;
+		fly.targetY = -70;
+		fly.maxSpeed = 0.3;
+	}
+	_flyTimer = 0;
+}
+
+// CSc05Controller::ShowHandle (169CC0)
+void Sc05Controller::showHandle() {
+	_scene->findAniObjectById(ANI_HANDLE, 0)->_flags |= 4;
+}
+
+// CSc05Controller::HideHandle (169CDC)
+void Sc05Controller::hideHandle() {
+	_scene->findAniObjectById(ANI_HANDLE, 0)->_flags &= ~4;
+}
+
+// CSc05Controller::MakeManFlight (169CF8)
+void Sc05Controller::makeManFlight() {
+	g_ngi->_taskManager->deactivateTask("FIND_EXIT_SWING_SC11");
+	MessageQueue *queue;
+	if (_hatch->_statics->_staticsId == ST_BLK_OPEN) {
+		queue = copyQueue(_scene, QU_SC5_MANFLY);
+	} else {
+		if (!g_ngi->_taskManager->isTaskClosed("GET_VANTUZ_SC11"))
+			g_ngi->_taskManager->activateTask("GET_VANTUZ_SC11");
+		queue = copyQueue(_scene, QU_SC5_MANBUMP);
+	}
+	_scene->runQueueObject(queue, nullptr, 2);
+}
+
+// CSc05Controller::OpenLuke (169DE4)
+void Sc05Controller::openLuke() {
+	if (isState(sO_WeirdWacko, sO_WithPlunger)) {
+		g_ngi->_taskManager->deactivateTask("OPEN_HANDLE_SC5");
+		g_ngi->_taskManager->activateTask("FIND_EXIT_SWING_SC11");
+	}
+	_hatch->stopMovement();
+	_hatch->moveToStaticChain(ST_BLK_CLOSED);
+	_hatch->startMovement(MV_BLK_OPEN, 0, -1);
+	updateLastpush();
+	tryFly();
+}
+
+// CSc05Controller::CloseLuke (169ED8)
+void Sc05Controller::closeLuke() {
+	if (isState(sO_WeirdWacko, sO_WithPlunger))
+		g_ngi->_taskManager->activateTask("OPEN_HANDLE_SC5");
+	_hatch->stopMovement();
+	_hatch->moveToStaticChain(ST_BLK_OPEN);
+	_hatch->startMovement(MV_BLK_CLOSE, 0, -1);
+	updateLastpush();
+}
+
+// CSc05Controller::DoOtmFeedback (169FA0): the frozen man works the handle after the hero
+void Sc05Controller::doOtmFeedback() {
+	int staticsId;
+	int movementId;
+	if (isState(sO_WeirdWacko, sO_InGlasses)) {
+		staticsId = ST_OTM_GLS_LEFT;
+		movementId = _handle->_statics->_staticsId == ST_HDL_DOWN ? MV_OTM_HANDLEUP : MV_OTM_HANDLEDOWN;
+	} else if (isState(sO_WeirdWacko, sO_WithDrawer)) {
+		staticsId = ST_OTM_BOX_LEFT;
+		movementId = _handle->_statics->_staticsId == ST_HDL_DOWN ? MV_OTM_BOXHANDLEUP : MV_OTM_BOXHANDLEDOWN;
+	} else {
+		return;
+	}
+	if (_wacko->_movement)
+		_wacko->stopMovement();
+	MessageQueue *queue = new MessageQueue(_scene, true, 1); // CMessageQueue(scene, 1, 1)
+	if (staticsId == _wacko->_statics->_staticsId) {
+		queue->addCommandToEnd(movementCommand(_wacko->_id, movementId));
+	} else {
+		queue->addCommandToEnd(moveToStaticCommand(_wacko->_id, _wacko->_copyId, staticsId));
+		queue->addCommandToEnd(movementCommand(_wacko->_id, movementId));
+	}
+	_scene->runQueueObject(queue, _wacko, 2);
+}
+
+// CSc05Controller::OnShow (16A29C)
+void Sc05Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_taskManager->activateTask("FIND_GLASS_SC5");
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_handle = _scene->findAniObjectById(ANI_HANDLE, 0);
+	_wacko = _scene->findAniObjectById(ANI_OTMOROZ, 0);
+	_hatch = _scene->findAniObjectById(ANI_BIGLUK, 0);
+	_pushTime = 0;
+	_feedbackCount = 1;
+	_flyTimer = 83000;
+	if (isState(sO_WeirdWacko, sO_InGlasses)) {
+		_wacko->moveToStaticChain(ST_OTM_GLS_LEFT);
+		_hatch->moveToStaticChain(ST_BLK_CLOSED);
+		_handle->moveToStaticChain(ST_HDL_UP);
+	} else if (isState(sO_WeirdWacko, sO_WithDrawer)) {
+		_wacko->moveToStaticChain(ST_OTM_BOX_LEFT);
+		_hatch->moveToStaticChain(ST_BLK_CLOSED);
+		_handle->moveToStaticChain(ST_HDL_UP);
+	} else if (isState(sO_WeirdWacko, sO_WithPlunger)) {
+		_wacko->moveToStaticChain(ST_OTM_VNT_LEFT);
+	} else {
+		_wacko->moveToStaticChain(ST_OTM_VNT_LEFT);
+		_handle->moveToStaticChain(ST_HDL_BROKEN);
+		_hatch->moveToStaticChain(ST_BLK_CLOSED);
+	}
+}
+
+// CSc05Controller::OnHide (16A4A4)
+void Sc05Controller::onHide() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onHide();
+		return;
+	}
+	_wacko->stopMovementToPrev(false);
+	_handle->stopMovementToPrev(false);
+	_handle->_flags |= 4;
+	_hatch->stopMovementToPrev(false);
+	_flyPack->deleteAllFlies();
+	FPController::onHide();
+}
+
+// CSc05Controller::GetCursorType (16A4F4)
+int Sc05Controller::getCursorType(float x, float y) {
+	return FPController::getCursorType(x, y);
+}
+
+// CSc05Controller::OnKeyUp (16A4FC)
+void Sc05Controller::onKeyUp(uint32 key) {
+	FPController::onKeyUp(key);
+}
+
+// CSc05Controller::DoTestLuke (16A504): the hero leaves for the pipe; the frozen man goes with him
+void Sc05Controller::doTestLuke(MessageQueue *queue) {
+	if (_scene->findAniObjectById(ANI_BIGLUK, 0)->_statics->_staticsId == ST_BLK_CLOSED) {
+		Command *command = setSceneCommand(SC_4, TrubaRight, "SC_4", "TrubaRight");
+		_scene->execCmd(command, 1);
+		delete command;
+		return;
+	}
+	if (_wacko->_movement) {
+		const int nextStatic = _wacko->_movement->_nextStatic->_staticsId;
+		_wacko->stopMovement();
+		_wacko->moveToStaticChain(nextStatic);
+	}
+	int staticsId = 0;
+	int movementId = 0;
+	if (isState(sO_WeirdWacko, sO_InGlasses)) {
+		staticsId = ST_OTM_GLS_LEFT;
+		movementId = MV_OTM_HANDLEUP;
+	} else if (isState(sO_WeirdWacko, sO_WithDrawer)) {
+		staticsId = ST_OTM_BOX_LEFT;
+		movementId = MV_OTM_BOXHANDLEUP;
+	} else {
+		Command *command = setSceneCommand(SC_4, TrubaRight, "SC_4", "TrubaRight");
+		_scene->execCmd(command, 1);
+		delete command;
+		return;
+	}
+	if (_wacko->_statics->_staticsId != staticsId) {
+		_wacko->stopMovement();
+		_wacko->moveToStaticChain(staticsId);
+	}
+	MessageQueue *newQueue = new MessageQueue(_scene, true, 1);
+	newQueue->addCommandToEnd(movementCommand(ANI_OTMOROZ, movementId));
+	newQueue->addCommandToEnd(setSceneCommand(SC_4, TrubaRight, "SC_4", "TrubaRight"));
+	_scene->runQueueObject(newQueue, nullptr, 4);
+}
+
+// CSc05Controller::OnMessage (16A8D0)
+void Sc05Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC5_HANDLEUP") {
+		_handle->moveToStaticChain(ST_HDL_UP);
+		closeLuke();
+	} else if (message == "MSG_SC5_HANDLEDOWN") {
+		_handle->moveToStaticChain(ST_HDL_DOWN);
+		openLuke();
+	} else if (message == "MSG_SC5_FL_HANDLE") {
+		// the analytics event switcher_pressed is not ported (D43)
+	} else if (message == "MSG_SC5_TESTLUK") {
+		doTestLuke(queue);
+	} else if (message == "MSG_SC5_SHOWHANDLE") {
+		showHandle();
+	} else if (message == "MSG_SC5_HIDEHANDLE") {
+		hideHandle();
+	} else if (message == "MSG_SC5_MAKEMANFLIGHT") {
+		makeManFlight();
+	} else if (message == "MSG_SC5_MAKEOTMFEEDBACK") {
+		if (!hero()->_movement || (uint)(hero()->getLastMovementId() - MV_MANHDL_HANDLEDOWN) > 1) {
+			doOtmFeedback();
+			_pushTime = 0;
+		}
+	} else if (message == "MSG_SC5_BGRSOUNDON") {
+		g_ngi->playSound(SND_5_026, 1);
+	} else if (message == "MSG_SC5_BGRSOUNDOFF") {
+		g_ngi->stopAllSoundInstances(SND_5_026);
+	} else if (message == "MSG_SC5_MOVEOTMOROZ") {
+		_wacko->setPosition(Common::Point(217, 360));
+		_wacko->_z = 20;
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc05Controller::OnUpdate (16AB8C)
+void Sc05Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	FPController::onUpdate(elapsed);
+	if (_pushTime != 0) {
+		if (g_system->getMillis() - _pushTime > 62 &&
+				((!hero()->_movement && !hero()->getMessageQueue()) || (uint)(hero()->getLastMovementId() - MV_MANHDL_HANDLEDOWN) > 1)) {
+			if (_feedbackCount & 1)
+				doOtmFeedback();
+			_pushTime = 0;
+			_feedbackCount++;
+		}
+	}
+	_flyTimer += elapsed;
+	if (isSoundPlayed(SND_CMN_060)) {
+		if (_flyPack->_flies.empty() || _flyPack->_flies.back().y <= 0)
+			_flyPack->deleteAllFlies();
+	}
+	_flyPack->onUpdate(elapsed);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc05controller.h b/engines/ngi/fullpipe/sc05controller.h
new file mode 100644
index 00000000000..85bbac4bada
--- /dev/null
+++ b/engines/ngi/fullpipe/sc05controller.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC05CONTROLLER_H
+#define NGI_FULLPIPE_SC05CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/floaters.h"
+
+namespace NGI {
+
+// CSc05Controller: hatch, handle, the frozen man; sceneHandler05 runs the scene until wired
+class Sc05Controller : public FPController {
+public:
+	explicit Sc05Controller(int sceneId);
+	~Sc05Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onKeyUp(uint32 key) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void updateLastpush();
+	void tryFly();
+	void showHandle();
+	void hideHandle();
+	void makeManFlight();
+	void openLuke();
+	void closeLuke();
+	void doOtmFeedback();
+	void doTestLuke(MessageQueue *queue);
+
+private:
+	AniObject *_handle = nullptr; // +216: ANI_HANDLE
+	uint32 _pushTime = 0; // +220: the time the hero pushed the handle, 0 when not
+	AniObject *_wacko = nullptr; // +224: ANI_OTMOROZ
+	AniObject *_hatch = nullptr; // +228: ANI_BIGLUK
+	int _feedbackCount = 1; // +232: odd = the frozen man answers the push
+	int _flyTimer = 0; // +236: the milliseconds since the last flies
+	Common::ScopedPtr<FlyPack> _flyPack; // +240
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC05CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 57e23453475..ea0d4686fce 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -32,6 +32,7 @@
 #include "ngi/fullpipe/sc29controller.h"
 #include "ngi/fullpipe/sc17controller.h"
 #include "ngi/fullpipe/sc38controller.h"
+#include "ngi/fullpipe/sc05controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -48,15 +49,6 @@
 
 namespace NGI {
 
-// CSc05Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc05Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc07Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc07Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 96640136dc1..3025dbfa4b9 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc05Controller : public FPController {
-public:
-	explicit Sc05Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc07Controller : public FPController {
 public:
 	explicit Sc07Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 726aa96c698..77dd90922a0 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -105,6 +105,7 @@ MODULE_OBJS = \
 	fullpipe/sc02controller.o \
 	fullpipe/sc03controller.o \
 	fullpipe/sc04controller.o \
+	fullpipe/sc05controller.o \
 	fullpipe/sc06controller.o \
 	fullpipe/sc08controller.o \
 	fullpipe/sc09controller.o \
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 316b392a75b..267fa1d5f32 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -726,6 +726,14 @@ bool Scene::runQueueObject(MessageQueue *queue, AniObject *ani, int interruptSta
 	return true;
 }
 
+// CScene::ExecCmd (1228CA)
+void Scene::execCmd(Command *cmd, int interruptState) {
+	MessageQueue *queue = new MessageQueue(this, true, interruptState);
+	queue->addCommandToEnd(new Command(cmd));
+	addQueue(queue);
+	queue->run(4);
+}
+
 // CScene::StopAllQueues (120C40)
 void Scene::stopAllQueues() {
 	if (g_ngi->_gameVersion >= 201509) {
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index 6f90f16de1f..834710c07c5 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -211,6 +211,8 @@ class Scene : public Background {
 	bool runQueueWithAni(int queueId, AniObject *ani, int interruptState = 4);
 	/** CScene::RunQueue / RunQueueWithAni with a queue of the caller; deleted if it does not start */
 	bool runQueueObject(MessageQueue *queue, AniObject *ani, int interruptState = 4);
+	/** CScene::ExecCmd (1228CA): a copy of the command runs in a queue of its own (Android) */
+	void execCmd(Command *cmd, int interruptState);
 	/** CScene::StopAllQueues (120C40); StoppedAllInteractions is not ported */
 	void stopAllQueues();
 	/** CScene::IsQueuesProcessed (11FB98): copies of the template queues run in the global list */


Commit: 33b8af7528c1e3f5cb80a55953acb5820ad7a8a3
    https://github.com/scummvm/scummvm/commit/33b8af7528c1e3f5cb80a55953acb5820ad7a8a3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc07Controller

Changed paths:
  A engines/ngi/fullpipe/sc07controller.cpp
  A engines/ngi/fullpipe/sc07controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/controllerhelpers.cpp
    engines/ngi/fullpipe/controllerhelpers.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index af6137ff49e..c09dcdbe3cb 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1909,4 +1909,7 @@ namespace NGI {
 #define QU_EGTR_FATASK 5334
 #define PIC_SC3_CLOUD_1 23509
 
+// Android: names of obj.h that the ported controllers use
+#define QU_HGN_OPENLUKE 824
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/controllerhelpers.cpp b/engines/ngi/fullpipe/controllerhelpers.cpp
index dc7772acc39..451ff5f3db2 100644
--- a/engines/ngi/fullpipe/controllerhelpers.cpp
+++ b/engines/ngi/fullpipe/controllerhelpers.cpp
@@ -157,6 +157,10 @@ void setSaving(bool) {
 	warnOnce("CBaseSettings::SetSaving (the saves are not blocked while the arcade runs)");
 }
 
+void unlockCatalogItem(const char *) {
+	warnOnce("CCatalogManager::UnlockItem: the catalog is not ported");
+}
+
 void enableSound(int, bool) {
 	warnOnce("CBehaviorController::EnableSound is not ported");
 }
diff --git a/engines/ngi/fullpipe/controllerhelpers.h b/engines/ngi/fullpipe/controllerhelpers.h
index 42bb935aae1..9343ce66150 100644
--- a/engines/ngi/fullpipe/controllerhelpers.h
+++ b/engines/ngi/fullpipe/controllerhelpers.h
@@ -61,6 +61,7 @@ int projectId(const char *name);
 // placeholders of subsystems that are not ported
 void warnOnce(const char *what);
 void setSaving(bool allowed); // CBaseSettings::SetSaving
+void unlockCatalogItem(const char *item); // CCatalogManager::UnlockItem
 void enableSound(int soundId, bool enable); // CBehaviorController::EnableSound
 Interact *findInteractionUnderCursor(); // CInteractionController (106D94)
 void runInteractionWithMouse(const char *name, float x, float y); // CFPController (14D5E0)
diff --git a/engines/ngi/fullpipe/sc07controller.cpp b/engines/ngi/fullpipe/sc07controller.cpp
new file mode 100644
index 00000000000..9565961f740
--- /dev/null
+++ b/engines/ngi/fullpipe/sc07controller.cpp
@@ -0,0 +1,159 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc07controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc07Controller::CSc07Controller (16E2B8)
+Sc07Controller::Sc07Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc07Controller::~CSc07Controller (16E280)
+Sc07Controller::~Sc07Controller() {
+}
+
+// CSc07Controller::DoShowBox (16E2EC)
+void Sc07Controller::doShowBox() {
+	_box->setPosition(Common::Point(493, 473));
+	_box->_z = 25;
+	AniObject *sitter = _scene->findAniObjectById(ANI_CORNERSITTER, 0);
+	sitter->setPosition(Common::Point(621, 418));
+	sitter->_z = 20;
+	_box->_flags |= 4;
+}
+
+// CSc07Controller::DoHideBox (16E360)
+void Sc07Controller::doHideBox() {
+	_box->_flags &= ~4;
+}
+
+// CSc07Controller::DoHideLuke (16E370)
+void Sc07Controller::doHideLuke(bool closing) {
+	_luke->_flags &= ~4;
+	AniObject *sitter = _scene->findAniObjectById(ANI_CORNERSITTER, 0);
+	if (closing && sitter->getLastMovementId() == MV_CST_CLOSELUKE) {
+		_hooligan->moveToStaticChain(ST_HGN_LOOK);
+		_hooligan->_flags &= ~4;
+	}
+}
+
+// CSc07Controller::DoOpenLuke (16E3BC)
+void Sc07Controller::doOpenLuke() {
+	_luke->_flags |= 4;
+	if (!_hatchQueue)
+		_hatchQueue = _scene->_behaviorController->getAniQueue(ANI_CORNERSITTER, QU_CST_CLOSELUKE);
+	_hatchQueue->_percent = _hatchPercent;
+	warnOnce("CSc07Controller::DoOpenLuke: the timer of the behavior queue (+12) is kept per animation here");
+}
+
+// CSc07Controller::DoCloseLuke (16E3FC)
+void Sc07Controller::doCloseLuke() {
+	if (!_hatchQueue)
+		_hatchQueue = _scene->_behaviorController->getAniQueue(ANI_CORNERSITTER, QU_CST_CLOSELUKE);
+	_hatchPercent = _hatchQueue->_percent;
+	_hatchQueue->_percent = 0;
+	warnOnce("CSc07Controller::DoCloseLuke: the timer of the behavior queue (+12) of QU_CST_CLOSELUKE and QU_HGN_OPENLUKE is kept per animation here");
+	_hooligan->moveToStaticChain(ST_HGN_LUKE);
+	_hooligan->_flags |= 4;
+}
+
+// CSc07Controller::OnShow (16E458)
+void Sc07Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_taskManager->activateTask("GET_HANDLE_SC7");
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_hatchQueue = nullptr;
+	_luke = _scene->findAniObjectById(ANI_LUKE, 0);
+	_box = _scene->findAniObjectById(ANI_SC7_BOX, 0);
+	_hooligan = _scene->findAniObjectById(ANI_HOOLIGAN, 0);
+	_plusMinus = _scene->findAniObjectById(ANI_PLUSMINUS, 1);
+	_plusMinus->setStatic(isState(sO_Guard_1, sO_Off) ? ST_PMS_MINUS : ST_PMS_PLUS, false);
+	if (isState(sO_HareTheNooksiter, sO_WithoutHandle))
+		_scene->findAniObjectById(ANI_CORNERSITTER, 0)->setStatic(ST_CST_HANDLELESS, false);
+	if (!(_luke->_flags & 4)) {
+		_hooligan->_flags |= 4;
+		_hooligan->moveToStaticChain(ST_HGN_LUKE);
+	}
+	unlockCatalogItem("ANI_GUARD1");
+}
+
+// CSc07Controller::GetCursorType (16E664)
+int Sc07Controller::getCursorType(float x, float y) {
+	return FPController::getCursorType(x, y);
+}
+
+// CSc07Controller::OnMessage (16E66C)
+void Sc07Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC7_SHOWBOX") {
+		doShowBox();
+	} else if (message == "MSG_SC7_HIDEBOX") {
+		doHideBox();
+	} else if (message == "MSG_SC7_HIDELUKE") {
+		doHideLuke(param == "MV_CST_CLOSELUKE");
+	} else if (message == "MSG_SC7_OPENLUKE") {
+		doOpenLuke();
+	} else if (message == "MSG_SC7_CLOSELUKE") {
+		doCloseLuke();
+	} else if (message == "MSG_SC7_PULL") {
+		_plusMinus->setStatic(_plusMinus->_statics->_staticsId == ST_PMS_MINUS ? ST_PMS_PLUS : ST_PMS_MINUS, false);
+	} else if (message == "MSG_SET_ACHIEVEMENT_ACTIVITY") {
+		AchievementsManager *achievements = g_ngi->_achievementsManager.get();
+		if (achievements->isActivatingItem("ACHIEVEMENT_GUARD_2", "guard11")) {
+			if (achievements->isActivatingItem("ACHIEVEMENT_GUARD_2", "guard12"))
+				achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard13");
+			else
+				achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard12");
+		} else {
+			achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard11");
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc07Controller::OnUpdate (16E8D4)
+void Sc07Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc07controller.h b/engines/ngi/fullpipe/sc07controller.h
new file mode 100644
index 00000000000..ece8d42505d
--- /dev/null
+++ b/engines/ngi/fullpipe/sc07controller.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC07CONTROLLER_H
+#define NGI_FULLPIPE_SC07CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+struct BehaviorMove;
+
+/** CSc07Controller (box, hatch, hooligan); sceneHandler07 runs the scene until wired */
+class Sc07Controller : public FPController {
+public:
+	explicit Sc07Controller(int sceneId);
+	~Sc07Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void doShowBox();
+	void doHideBox();
+	void doHideLuke(bool closing);
+	void doOpenLuke();
+	void doCloseLuke();
+
+private:
+	BehaviorMove *_hatchQueue = nullptr; // +216: the queue QU_HGN_OPENLUKE of the corner sitter
+	int _hatchPercent = 0; // +220: its percent while the hatch is closed
+	AniObject *_plusMinus = nullptr; // +224: ANI_PLUSMINUS (copy 1)
+	AniObject *_luke = nullptr; // +228: ANI_LUKE
+	AniObject *_box = nullptr; // +232: ANI_SC7_BOX
+	AniObject *_hooligan = nullptr; // +236: ANI_HOOLIGAN
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC07CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index ea0d4686fce..9afe973034f 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -33,6 +33,7 @@
 #include "ngi/fullpipe/sc17controller.h"
 #include "ngi/fullpipe/sc38controller.h"
 #include "ngi/fullpipe/sc05controller.h"
+#include "ngi/fullpipe/sc07controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -49,15 +50,6 @@
 
 namespace NGI {
 
-// CSc07Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc07Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc10Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc10Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 3025dbfa4b9..625b6dbc501 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc07Controller : public FPController {
-public:
-	explicit Sc07Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc10Controller : public FPController {
 public:
 	explicit Sc10Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 77dd90922a0..5bd8573b54a 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -107,6 +107,7 @@ MODULE_OBJS = \
 	fullpipe/sc04controller.o \
 	fullpipe/sc05controller.o \
 	fullpipe/sc06controller.o \
+	fullpipe/sc07controller.o \
 	fullpipe/sc08controller.o \
 	fullpipe/sc09controller.o \
 	fullpipe/sc11controller.o \


Commit: 1a4d400cc88924bd3f867fcc881f4e6474857ac3
    https://github.com/scummvm/scummvm/commit/1a4d400cc88924bd3f867fcc881f4e6474857ac3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc10Controller

Changed paths:
  A engines/ngi/fullpipe/highlight.cpp
  A engines/ngi/fullpipe/highlight.h
  A engines/ngi/fullpipe/sc10controller.cpp
  A engines/ngi/fullpipe/sc10controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index c09dcdbe3cb..5894b0925c2 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1912,4 +1912,7 @@ namespace NGI {
 // Android: names of obj.h that the ported controllers use
 #define QU_HGN_OPENLUKE 824
 
+// Android: names of obj.h that the ported controllers use
+#define PIC_GUM_SEL 28048
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/highlight.cpp b/engines/ngi/fullpipe/highlight.cpp
new file mode 100644
index 00000000000..adbba38003e
--- /dev/null
+++ b/engines/ngi/fullpipe/highlight.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gfx.h"
+#include "ngi/scene.h"
+#include "ngi/fullpipe/highlight.h"
+
+namespace NGI {
+
+// CHighlight::CHighlight (152564)
+Highlight::Highlight(Scene *scene, int pictureId) {
+	_picture = scene->findPictureObjectById(pictureId, 0);
+	_time = 0;
+}
+
+// CHighlight::Update (15257E)
+void Highlight::update(uint32 elapsed, bool active) {
+	const int time = _time - (int)elapsed;
+	if (abs(time) <= 200 && active)
+		_time = time;
+	else
+		_time = 200;
+	if (active && _time > 0)
+		_picture->_flags |= 4;
+	else
+		_picture->_flags &= ~4;
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/highlight.h b/engines/ngi/fullpipe/highlight.h
new file mode 100644
index 00000000000..e5cecde231a
--- /dev/null
+++ b/engines/ngi/fullpipe/highlight.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_HIGHLIGHT_H
+#define NGI_FULLPIPE_HIGHLIGHT_H
+
+#include "common/scummsys.h"
+
+namespace NGI {
+
+class PictureObject;
+class Scene;
+
+/** CHighlight: a picture that blinks while something can be taken */
+class Highlight {
+public:
+	Highlight(Scene *scene, int pictureId);
+
+	void update(uint32 elapsed, bool active);
+
+private:
+	int _time = 0; // +0: counts down from 200 ms
+	PictureObject *_picture = nullptr; // +4
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_HIGHLIGHT_H
diff --git a/engines/ngi/fullpipe/sc10controller.cpp b/engines/ngi/fullpipe/sc10controller.cpp
new file mode 100644
index 00000000000..7780a455c6e
--- /dev/null
+++ b/engines/ngi/fullpipe/sc10controller.cpp
@@ -0,0 +1,202 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/lift.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc10controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc10Controller::CSc10Controller (1739A0)
+Sc10Controller::Sc10Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc10Controller::~CSc10Controller (173950): the highlight goes with it
+Sc10Controller::~Sc10Controller() {
+}
+
+// CSc10Controller::CanTakeGum (1739DC): the blower is blowing and has not finished the frame 41
+bool Sc10Controller::canTakeGum() {
+	return _blower->_movement && _blower->getLastMovementId() == MV_NDV_BLOW2 && _blower->getCurFrame() <= 41;
+}
+
+// CSc10Controller::DoHideGum (173A0C)
+void Sc10Controller::doHideGum() {
+	_gum->_flags &= ~4;
+	_pack->_flags &= ~4;
+	_pack2->_flags &= ~4;
+}
+
+// CSc10Controller::DoShowGum (173A32)
+void Sc10Controller::doShowGum() {
+	if (_gumEnabled)
+		_gum->_flags |= 4;
+	_pack->_flags |= 4;
+	_pack2->_flags |= 4;
+}
+
+// CSc10Controller::DoTakeGum (173A68): the hero walks next to the gum, then takes it
+void Sc10Controller::doTakeGum() {
+	if (!_gumEnabled)
+		return;
+	const float targetX = (float)_gum->getCenter().x - 139.0f;
+	const float targetY = (float)_gum->getCenter().y - 48.0f;
+	if (fabsf(targetX - (float)hero()->getCenter().x) > 3.0f || fabsf(targetY - (float)hero()->getCenter().y) > 3.0f ||
+			hero()->_movement) {
+		MessageQueue *queue = mctlStartMove((int)targetX, (int)targetY, true, ST_MAN_RIGHT, false);
+		if (queue) {
+			queue->addCommandToEnd(messageCommand("MSG_SC10_CLICKGUM"));
+			queue->_interruptState = 2; // CMessageQueue::SetIntState(2)
+		}
+	} else {
+		_gumEnabled = false;
+		_scene->runQueueWithAni(QU_SC10_TAKEGUM, hero(), 2);
+		// CFPController::FlurryItemFound (analytics) is not ported (D43)
+	}
+}
+
+// CSc10Controller::OnClickGum (173C2C)
+void Sc10Controller::onClickGum() {
+	if (!_gumEnabled)
+		return;
+	if (canTakeGum()) {
+		doTakeGum();
+	} else {
+		_blower->setStatic(ST_NDV_SIT, false);
+		if (isState(sO_Inflater, sO_WithGum))
+			_blower->startMovement(MV_NDV_DENIES, 0, -1);
+		else
+			_blower->startMovement(MV_NDV_DENY_NOGUM, 0, -1);
+	}
+}
+
+// CSc10Controller::OnSceneInit (173CF4)
+void Sc10Controller::onSceneInit() {
+	FPController::onSceneInit();
+	_highlight.reset(new Highlight(_scene, PIC_GUM_SEL));
+}
+
+// CSc10Controller::OnShow (173D20)
+void Sc10Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_gum = _scene->findAniObjectById(ANI_GUM, 0);
+	_pack = _scene->findAniObjectById(ANI_PACHKA, 0);
+	_pack2 = _scene->findAniObjectById(ANI_PACHKA2, 0);
+	_blower = _scene->findAniObjectById(ANI_NADUVATEL, 0);
+	_blower->setStatic(ST_NDV_SIT, false);
+	_ladder = _scene->findPictureObjectById(PIC_SC10_LADDER, 0);
+	_ladder->_z = 0;
+	g_ngi->lift().enableButton(sO_Level1, projectId("ST_LBN_1N"));
+	g_ngi->lift().initLift(_scene, hero(), QU_SC10_ENTERLIFT, QU_SC10_EXITLIFT);
+	if (isState(sO_Inflater, sO_WithGum)) {
+		_gumEnabled = true;
+		_gum->_flags |= 4;
+	} else {
+		_gumEnabled = false;
+		_gum->_flags &= ~4;
+	}
+	doShowGum();
+	// the analytics parameter gum_start (CFlurryEventManager) is not ported (D43)
+}
+
+// CSc10Controller::GetCursorType (173F0C): the lift buttons, the gum (the blower must be blowing)
+int Sc10Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (g_ngi->lift().getCursorType(x, y))
+		return 116;
+	if ((g_ngi->_inputController->isObjectHit(_gum) || g_ngi->_inputController->isObjectHit(_pack)) && _gumEnabled)
+		return !canTakeGum() + 118;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc10Controller::OnMouseLKeyDown (173F72)
+bool Sc10Controller::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyDown(id, x, y);
+	if (FPController::onMouseLKeyDown(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonDown(x, y);
+}
+
+// CSc10Controller::OnMouseLKeyUp (173F8E)
+bool Sc10Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	if (FPController::onMouseLKeyUp(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonUp(x, y);
+}
+
+// CSc10Controller::OnMessage (173FAC)
+void Sc10Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC10_CLICKGUM") {
+		onClickGum();
+	} else if (message == "MSG_SC10_HIDEGUM") {
+		doHideGum();
+	} else if (message == "MSG_SC10_SHOWGUM") {
+		doShowGum();
+	} else if (message == "MSG_SC10_LADDERTOBACK") {
+		_ladder->_z = 49;
+	} else if (message == "MSG_SC10_LADDERTOFORE") {
+		_ladder->_z = 0;
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc10Controller::OnUpdate (174084)
+void Sc10Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	_highlight->update(elapsed, canTakeGum() ? (_gum->_flags & 4) != 0 : false);
+}
+
+// CSc10Controller::OnRender (1740B4)
+void Sc10Controller::onRender(Common::Point scroll) {
+	FPController::onRender(scroll);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc10controller.h b/engines/ngi/fullpipe/sc10controller.h
new file mode 100644
index 00000000000..03ed68bc9a0
--- /dev/null
+++ b/engines/ngi/fullpipe/sc10controller.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC10CONTROLLER_H
+#define NGI_FULLPIPE_SC10CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/highlight.h"
+
+namespace NGI {
+
+class PictureObject;
+
+/** CSc10Controller (lift, gum of the blower); sceneHandler10 runs the scene until wired */
+class Sc10Controller : public FPController {
+public:
+	explicit Sc10Controller(int sceneId);
+	~Sc10Controller() override;
+
+	void onSceneInit() override;
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void onUpdate(uint32 elapsed) override;
+	void onRender(Common::Point scroll) override;
+
+	bool canTakeGum();
+	void doHideGum();
+	void doShowGum();
+	void doTakeGum();
+	void onClickGum();
+
+private:
+	bool _gumEnabled = true; // +215: the gum is there until it is taken
+	AniObject *_gum = nullptr; // +216: ANI_GUM
+	AniObject *_pack = nullptr; // +220: ANI_PACHKA
+	AniObject *_pack2 = nullptr; // +224: ANI_PACHKA2
+	AniObject *_blower = nullptr; // +228: ANI_NADUVATEL
+	PictureObject *_ladder = nullptr; // +232: PIC_SC10_LADDER
+	Common::ScopedPtr<Highlight> _highlight; // +236: PIC_GUM_SEL
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC10CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 9afe973034f..1fc8ac4bd41 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -34,6 +34,7 @@
 #include "ngi/fullpipe/sc38controller.h"
 #include "ngi/fullpipe/sc05controller.h"
 #include "ngi/fullpipe/sc07controller.h"
+#include "ngi/fullpipe/sc10controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -50,15 +51,6 @@
 
 namespace NGI {
 
-// CSc10Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc10Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc12Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc12Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 625b6dbc501..e9e00c4289e 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc10Controller : public FPController {
-public:
-	explicit Sc10Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc12Controller : public FPController {
 public:
 	explicit Sc12Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 5bd8573b54a..2fed37972b9 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -92,6 +92,7 @@ MODULE_OBJS = \
 	fullpipe/fpguicontroller.o \
 	fullpipe/help.o \
 	fullpipe/hintmanager.o \
+	fullpipe/highlight.o \
 	fullpipe/inventorycontroller.o \
 	fullpipe/lift.o \
 	fullpipe/liftcontroller.o \
@@ -110,6 +111,7 @@ MODULE_OBJS = \
 	fullpipe/sc07controller.o \
 	fullpipe/sc08controller.o \
 	fullpipe/sc09controller.o \
+	fullpipe/sc10controller.o \
 	fullpipe/sc11controller.o \
 	fullpipe/sc14controller.o \
 	fullpipe/sc17controller.o \


Commit: 46337fa505443d5e6dd712c1ec5ea4e9b1a98b71
    https://github.com/scummvm/scummvm/commit/46337fa505443d5e6dd712c1ec5ea4e9b1a98b71
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc12Controller

Changed paths:
  A engines/ngi/fullpipe/sc12controller.cpp
  A engines/ngi/fullpipe/sc12controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 5894b0925c2..7ceb6562ef6 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1915,4 +1915,7 @@ namespace NGI {
 // Android: names of obj.h that the ported controllers use
 #define PIC_GUM_SEL 28048
 
+// Android: names of obj.h that the ported controllers use
+#define ANI_SLONIK 827
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/sc12controller.cpp b/engines/ngi/fullpipe/sc12controller.cpp
new file mode 100644
index 00000000000..3d74e581212
--- /dev/null
+++ b/engines/ngi/fullpipe/sc12controller.cpp
@@ -0,0 +1,143 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/gameloader.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc12controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc12Controller::CSc12Controller (1774E0)
+Sc12Controller::Sc12Controller(int sceneId) : FPController(sceneId), _flyPack(new FlyPack()) {
+}
+
+// CSc12Controller::~CSc12Controller (177494): the fly pack goes with it
+Sc12Controller::~Sc12Controller() {
+}
+
+// CSc12Controller::StartFly (177530)
+void Sc12Controller::startFly() {
+	_flyPack->addFly(_scene, 397, -50, 100, 6);
+	GutlFly &fly = _flyPack->_flies[0];
+	fly.countdown = scaledRandom(5) + 4;
+	fly.exitX = 397;
+	fly.exitY = -50;
+}
+
+// CSc12Controller::OnShow (17757C)
+void Sc12Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_taskManager->activateTask("GET_BOOT_SC12");
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_12"));
+	_flyPending = g_ngi->getStateId(sO_Fly_12) != 0;
+	if (_flyPending)
+		_flyTimer = scaledRandom(49800) + 49800;
+	g_ngi->setState(sO_Fly_12, random31() % 2);
+	_elephant = _scene->findAniObjectById(ANI_SLONIK, 0);
+	if (isState(sO_Elephantine, sO_IsSleeping)) {
+		getGameLoaderInteractionController()->setActive("INT_052", SC_12, ANI_SLONIK, 0.0f, 0.0f);
+		getGameLoaderInteractionController()->setActive("INT_053", SC_12, ANI_SLONIK, 0.0f, 0.0f);
+	}
+}
+
+// CSc12Controller::OnMessage (17777C)
+void Sc12Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC12_CHANGE_SLONIK") {
+		g_ngi->setState(sO_Elephantine, g_ngi->getStateValue(sO_Elephantine, sO_IsSleeping));
+		getGameLoaderInteractionController()->setActive("INT_052", SC_12, ANI_SLONIK, 0.0f, 0.0f);
+		getGameLoaderInteractionController()->setActive("INT_053", SC_12, ANI_SLONIK, 0.0f, 0.0f);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc12Controller::OnHide (177880)
+void Sc12Controller::onHide() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onHide();
+		return;
+	}
+	if (isState(sO_Elephantine, sO_WithJug))
+		g_ngi->setState(sO_Elephantine, g_ngi->getStateValue(sO_Elephantine, sO_IsSleeping));
+	_flyPack->deleteAllFlies();
+	FPController::onHide();
+}
+
+// CSc12Controller::GetCursorType (177934): the sleeping elephant girl takes an item
+int Sc12Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (!g_ngi->_inputController->isObjectHit(_elephant))
+		return FPController::getCursorType(x, y);
+	bool takes = false;
+	if (isState(sO_Elephantine, sO_IsSleeping))
+		takes = g_ngi->_inputController->getObject() != nullptr;
+	if (!takes)
+		return FPController::getCursorType(x, y);
+	return 102;
+}
+
+// CSc12Controller::OnMouseLKeyUp (1779D8)
+bool Sc12Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	return FPController::onMouseLKeyUp(id, x, y);
+}
+
+// CSc12Controller::OnUpdate (1779E0)
+void Sc12Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	FPController::onUpdate(elapsed);
+	if (_flyPending) {
+		const int time = _flyTimer;
+		_flyTimer = time - elapsed;
+		if (_flyTimer <= 0) {
+			startFly();
+			_flyPending = false;
+		}
+	}
+	_flyPack->onUpdate(elapsed);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc12controller.h b/engines/ngi/fullpipe/sc12controller.h
new file mode 100644
index 00000000000..28827a0d25d
--- /dev/null
+++ b/engines/ngi/fullpipe/sc12controller.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC12CONTROLLER_H
+#define NGI_FULLPIPE_SC12CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/floaters.h"
+
+namespace NGI {
+
+/** CSc12Controller (the elephant girl and the fly); sceneHandler12 runs the scene until wired */
+class Sc12Controller : public FPController {
+public:
+	explicit Sc12Controller(int sceneId);
+	~Sc12Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void startFly();
+
+private:
+	Common::ScopedPtr<FlyPack> _flyPack; // +216
+	bool _flyPending = false; // +220: a fly has to start when the timer is over
+	int _flyTimer = 0; // +224: the milliseconds until the fly starts
+	AniObject *_elephant = nullptr; // +228: ANI_SLONIK
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC12CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 1fc8ac4bd41..52a2172903b 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -35,6 +35,7 @@
 #include "ngi/fullpipe/sc05controller.h"
 #include "ngi/fullpipe/sc07controller.h"
 #include "ngi/fullpipe/sc10controller.h"
+#include "ngi/fullpipe/sc12controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -51,15 +52,6 @@
 
 namespace NGI {
 
-// CSc12Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc12Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc13Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc13Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index e9e00c4289e..459e06c7618 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc12Controller : public FPController {
-public:
-	explicit Sc12Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc13Controller : public FPController {
 public:
 	explicit Sc13Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 2fed37972b9..d6c64166c1c 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -113,6 +113,7 @@ MODULE_OBJS = \
 	fullpipe/sc09controller.o \
 	fullpipe/sc10controller.o \
 	fullpipe/sc11controller.o \
+	fullpipe/sc12controller.o \
 	fullpipe/sc14controller.o \
 	fullpipe/sc17controller.o \
 	fullpipe/sc27controller.o \


Commit: 1fb32da58f397bf74fc302680c1240d9a4eadcfc
    https://github.com/scummvm/scummvm/commit/1fb32da58f397bf74fc302680c1240d9a4eadcfc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc13Controller

Changed paths:
  A engines/ngi/fullpipe/sc13controller.cpp
  A engines/ngi/fullpipe/sc13controller.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/sc13controller.cpp b/engines/ngi/fullpipe/sc13controller.cpp
new file mode 100644
index 00000000000..77537b842c0
--- /dev/null
+++ b/engines/ngi/fullpipe/sc13controller.cpp
@@ -0,0 +1,337 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/gameloader.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc13controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc13Controller::CSc13Controller (177A50)
+Sc13Controller::Sc13Controller(int sceneId) : FPController(sceneId) {
+	_swipeThreshold = 415;
+}
+
+// CSc13Controller::~CSc13Controller (177A18)
+Sc13Controller::~Sc13Controller() {
+}
+
+// CSc13Controller::EnableSwitchToL (177A98)
+void Sc13Controller::enableSwitchToL(bool enable) {
+	BehaviorMove *queue = _scene->_behaviorController->getAniQueue(_guard->_id, QU_STR_RTOL);
+	queue->setEnabled(enable);
+	queue->_percent = enable;
+}
+
+// CSc13Controller::EnableSwitchToR (177AB8)
+void Sc13Controller::enableSwitchToR(bool enable) {
+	BehaviorMove *queue = _scene->_behaviorController->getAniQueue(_guard->_id, QU_STR_LTOR);
+	queue->setEnabled(enable);
+	queue->_percent = enable;
+}
+
+// CSc13Controller::DoShowGum (177AD8)
+void Sc13Controller::doShowGum() {
+	_scene->runQueue(QU_SC13_SHOWGUM);
+}
+
+// CSc13Controller::DoEatGum (177AEC)
+void Sc13Controller::doEatGum() {
+	BehaviorMove *chew = _scene->_behaviorController->getAniQueue(_guard->_id, QU_STR_CHEW);
+	if (chew) {
+		chew->_percent = 715827882;
+		chew->_delay = 0;
+	}
+}
+
+// CSc13Controller::DoPluuGum (177B18)
+void Sc13Controller::doPluuGum() {
+	BehaviorMove *chew = _scene->_behaviorController->getAniQueue(_guard->_id, QU_STR_CHEW);
+	if (chew) {
+		chew->_percent = 0;
+		chew->_delay = 36;
+	}
+	BehaviorMove *spit = _scene->_behaviorController->getAniQueue(_guard->_id, QU_STR_PLUU);
+	if (spit) {
+		spit->_percent = 214748364;
+		spit->_delay = 10;
+	}
+}
+
+// CSc13Controller::DoUneatGum (177B64)
+void Sc13Controller::doUneatGum() {
+	BehaviorMove *chew = _scene->_behaviorController->getAniQueue(_guard->_id, QU_STR_CHEW);
+	if (chew) {
+		chew->_percent = 0;
+		chew->_delay = 36;
+	}
+	BehaviorMove *spit = _scene->_behaviorController->getAniQueue(_guard->_id, QU_STR_PLUU);
+	if (spit) {
+		spit->_percent = 0;
+		spit->_delay = 36;
+	}
+}
+
+// CSc13Controller::TestOpening (177BAC)
+void Sc13Controller::testOpening() {
+	switch (_handleR->_statics->_staticsId) {
+	case ST_HDLR_DOWN:
+		_scene->runQueue(QU_SC13_OPENFAIL);
+		break;
+	case ST_HDLR_DOWN_GUM:
+		_scene->runQueue(QU_SC13_OPENSUCCESS);
+		break;
+	case ST_HDLR_GUM:
+		_handleR->setStatic(ST_HDLR_DOWN_GUM, false);
+		_scene->runQueue(QU_SC13_OPENSUCCESS);
+		break;
+	default:
+		break;
+	}
+}
+
+// CSc13Controller::DoCloseBridge (177C00): a running opening is turned round at the same frame
+void Sc13Controller::doCloseBridge() {
+	if (_bridge->_movement && _bridge->getLastMovementId() == MV_BDG_OPEN) {
+		const Movement *movement = _bridge->_movement;
+		const int count = movement->_currMovement ? movement->_currMovement->_phases.size() : movement->_phases.size();
+		const int frame = _bridge->getCurFrame();
+		_bridge->stopMovement();
+		_bridge->moveToStaticChain(ST_BDG_OPEN2);
+		_bridge->startMovement(MV_BDG_CLOSE, 0, -1);
+		_bridge->setCurFrame(count - frame, true, false);
+	} else {
+		_bridge->stopMovement();
+		_bridge->moveToStaticChain(ST_BDG_OPEN2);
+		_bridge->startMovement(MV_BDG_CLOSE, 0, -1);
+	}
+}
+
+// CSc13Controller::TestClosing (177CB8)
+void Sc13Controller::testClosing() {
+	const int staticsId = _handleL->_statics->_staticsId;
+	if (staticsId == ST_HDLL_UP)
+		_scene->runQueue(QU_SC13_CLOSEFAIL, 2);
+	else if (staticsId == ST_HDLL_FIRECAN || staticsId == ST_HDLL_HAMMER)
+		_scene->runQueue(QU_SC13_CLOSESUCCESS, 2);
+}
+
+// CSc13Controller::DoOpenBridge (177D00): a running closing is turned round at the same frame
+void Sc13Controller::doOpenBridge() {
+	if (_bridge->_movement && _bridge->getLastMovementId() == MV_BDG_CLOSE) {
+		const Movement *movement = _bridge->_movement;
+		const int count = movement->_currMovement ? movement->_currMovement->_phases.size() : movement->_phases.size();
+		const int frame = _bridge->getCurFrame();
+		_bridge->stopMovement();
+		_bridge->moveToStaticChain(ST_BDG_CLOSED);
+		_bridge->startMovement(MV_BDG_OPEN, 0, -1);
+		_bridge->setCurFrame(count - frame, true, false);
+	} else {
+		_bridge->stopMovement();
+		_bridge->moveToStaticChain(ST_BDG_CLOSED);
+		_bridge->startMovement(MV_BDG_OPEN, 0, -1);
+	}
+}
+
+// CSc13Controller::DoOpenFast (177DB8)
+void Sc13Controller::doOpenFast() {
+	_bridge->stopMovement();
+	_bridge->moveToStaticChain(ST_BDG_CLOSED);
+	_bridge->startMovement(MV_BDG_OPEN, 0, -1);
+	_bridge->setCurFrame(15, true, false);
+}
+
+// CSc13Controller::DoCloseFast (177E04)
+void Sc13Controller::doCloseFast() {
+	_bridge->stopMovement();
+	_bridge->moveToStaticChain(ST_BDG_OPEN2);
+	_bridge->startMovement(MV_BDG_CLOSE, 0, -1);
+	_bridge->setCurFrame(21, true, false);
+}
+
+// CSc13Controller::DoUpdateBridge (177E50): the bridge link is passable while the bridge is down
+void Sc13Controller::doUpdateBridge() {
+	MovGraphLink *link = _scene->_motionController->getGraphLink(sO_Bridge);
+	if (!link)
+		return;
+	if (isState(sO_Bridge, sO_Convoluted)) {
+		link->_flags |= 0x20000000;
+	} else {
+		link->_flags &= ~0x20000000;
+		g_ngi->_taskManager->deactivateTask("OPEN_BRIDGE_SC13");
+	}
+}
+
+// CSc13Controller::DoStopWhirlgig (177F18)
+void Sc13Controller::doStopWhirlgig() {
+	_whirligig->setCurFrame(_whirligig->getCurFrame(), false, false);
+	g_ngi->stopAllSoundInstances(SND_13_018);
+	g_ngi->playSound(SND_13_033, 0);
+	g_ngi->playSound(SND_13_037, 1);
+}
+
+// CSc13Controller::DoStartWhirlgig (177F74)
+void Sc13Controller::doStartWhirlgig() {
+	_whirligig->setCurFrame(_whirligig->getCurFrame(), true, false);
+	g_ngi->playSound(SND_13_018, 1);
+	g_ngi->playSound(SND_13_034, 0);
+	g_ngi->stopAllSoundInstances(SND_13_037);
+}
+
+// CSc13Controller::OnShow (177FD0)
+void Sc13Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(4);
+	g_ngi->_chapterManager->setActiveChapter(4);
+	// the hit region of ANI_HANDLE_L (its top is set to -27) is not supported for animations
+	warnOnce("CSc13Controller::OnShow: the hit region (top -27) of ANI_HANDLE_L is not ported");
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+		g_ngi->_taskManager->activateTask("OPEN_BRIDGE_SC13");
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_4", true);
+	}
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_whirligig = _scene->findAniObjectById(ANI_WHIRLGIG_13, 0);
+	_guard = _scene->findAniObjectById(ANI_STOROZH, 0);
+	_handleR = _scene->findAniObjectById(ANI_HANDLE_R, 0);
+	_handleL = _scene->findAniObjectById(ANI_HANDLE_L, 0);
+	_bridge = _scene->findAniObjectById(ANI_BRIDGE, 0);
+	_heroLeft = true;
+	MovGraphLink *link = _scene->_motionController->getGraphLink(sO_Bridge);
+	if (!isState(sO_Bridge, sO_Convoluted)) {
+		_guard->_flags &= ~4;
+		_bridge->stopMovement();
+		_bridge->moveToStaticChain(ST_BDG_OPEN2);
+		if (link)
+			link->_flags &= ~0x20000000;
+		_whirligig->startMovement(MV_WHR13_SPIN, 0, -1);
+		_whirligig->setCurFrame(30, false, false);
+	} else {
+		_bridge->stopMovement();
+		_bridge->moveToStaticChain(ST_BDG_CLOSED);
+		if (link)
+			link->_flags |= 0x20000000;
+	}
+	if (_scene->_currentEntranceId == 0)
+		onMessage("MSG_SC13_START_SOUND", "", nullptr);
+}
+
+// CSc13Controller::GetCursorType (1782BC)
+int Sc13Controller::getCursorType(float x, float y) {
+	return FPController::getCursorType(x, y);
+}
+
+// CSc13Controller::OnMouseLKeyUp (1782C4)
+bool Sc13Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	return FPController::onMouseLKeyUp(id, x, y);
+}
+
+// CSc13Controller::OnMessage (1782CC)
+void Sc13Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC13_SHOWGUM") {
+		doShowGum();
+	} else if (message == "MSG_SC13_UPDATEBRIDGE") {
+		doUpdateBridge();
+	} else if (message == "MSG_SC13_EATGUM") {
+		doEatGum();
+	} else if (message == "MSG_SC13_UNEATGUM") {
+		doUneatGum();
+	} else if (message == "MSG_SC13_STOPWHIRLGIG") {
+		doStopWhirlgig();
+	} else if (message == "MSG_SC13_STARTWHIRLGIG") {
+		doStartWhirlgig();
+	} else if (message == "MSG_SC13_TESTOPEN") {
+		testOpening();
+	} else if (message == "MSG_SC13_CLOSEBRIDGE") {
+		doCloseBridge();
+	} else if (message == "MSG_SC13_TESTCLOSE") {
+		testClosing();
+	} else if (message == "MSG_SC13_OPENBRIDGE") {
+		doOpenBridge();
+	} else if (message == "MSG_SC13_OPENFAST") {
+		doOpenFast();
+	} else if (message == "MSG_SC13_CLOSEFAST") {
+		doCloseFast();
+	} else if (message == "MSG_SC14_MOVEHANDLE") {
+		AniObject *handle = _scene->findAniObjectById(ANI_HANDLE_L, 0);
+		handle->setPosition(Common::Point(199, 471));
+		handle->_z = 7;
+	} else if (message == "MSG_SC13_START_SOUND") {
+		if (isState(sO_Bridge, sO_Convoluted))
+			g_ngi->playSound(SND_13_018, 1);
+		else
+			g_ngi->playSound(SND_13_037, 1);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc13Controller::UpdateScroll (178520): the guard turns to the side the hero is on
+void Sc13Controller::updateScroll() {
+	FPController::updateScroll();
+	if (!controllerRunsSceneLogic())
+		return;
+	if (_heroLeft && hero()->getCenter().x < 1022.0f) {
+		_scene->runQueue(QU_STR_RTOL);
+		_heroLeft = false;
+		return;
+	}
+	if (!_heroLeft && hero()->getCenter().x > 1022.0f) {
+		_scene->runQueue(QU_STR_LTOR);
+		_heroLeft = true;
+	}
+}
+
+// CSc13Controller::OnUpdate (17859C): INT_095 works only while the hero is right of the bridge
+void Sc13Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	bool heroRight = false;
+	if (isState(sO_Bridge, sO_Convoluted))
+		heroRight = hero()->getCenter().x >= 1022.0f;
+	getGameLoaderInteractionController()->setActive("INT_095", 0, 0, heroRight ? 0.0f : 1.0f, 0.0f);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc13controller.h b/engines/ngi/fullpipe/sc13controller.h
new file mode 100644
index 00000000000..806fde6e5ce
--- /dev/null
+++ b/engines/ngi/fullpipe/sc13controller.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC13CONTROLLER_H
+#define NGI_FULLPIPE_SC13CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc13Controller (guard, bridge, whirligig, gum); sceneHandler13 runs the scene until wired */
+class Sc13Controller : public FPController {
+public:
+	explicit Sc13Controller(int sceneId);
+	~Sc13Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+	void onUpdate(uint32 elapsed) override;
+
+	void enableSwitchToL(bool enable);
+	void enableSwitchToR(bool enable);
+	void doShowGum();
+	void doEatGum();
+	void doPluuGum();
+	void doUneatGum();
+	void testOpening();
+	void doCloseBridge();
+	void testClosing();
+	void doOpenBridge();
+	void doOpenFast();
+	void doCloseFast();
+	void doUpdateBridge();
+	void doStopWhirlgig();
+	void doStartWhirlgig();
+
+private:
+	AniObject *_guard = nullptr; // +216: ANI_STOROZH
+	AniObject *_whirligig = nullptr; // +220: ANI_WHIRLGIG_13
+	AniObject *_handleR = nullptr; // +224: ANI_HANDLE_R
+	AniObject *_handleL = nullptr; // +228: ANI_HANDLE_L
+	AniObject *_bridge = nullptr; // +232: ANI_BRIDGE
+	bool _heroLeft = true; // +240: the hero is left of x 1022
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC13CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 52a2172903b..e23c3246045 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -36,6 +36,7 @@
 #include "ngi/fullpipe/sc07controller.h"
 #include "ngi/fullpipe/sc10controller.h"
 #include "ngi/fullpipe/sc12controller.h"
+#include "ngi/fullpipe/sc13controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -52,15 +53,6 @@
 
 namespace NGI {
 
-// CSc13Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc13Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc15Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc15Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 459e06c7618..a85a4836f27 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc13Controller : public FPController {
-public:
-	explicit Sc13Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc15Controller : public FPController {
 public:
 	explicit Sc15Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index d6c64166c1c..9bf81baa170 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -114,6 +114,7 @@ MODULE_OBJS = \
 	fullpipe/sc10controller.o \
 	fullpipe/sc11controller.o \
 	fullpipe/sc12controller.o \
+	fullpipe/sc13controller.o \
 	fullpipe/sc14controller.o \
 	fullpipe/sc17controller.o \
 	fullpipe/sc27controller.o \


Commit: 85a09dc017eb76b0da5933ce4046c95152871609
    https://github.com/scummvm/scummvm/commit/85a09dc017eb76b0da5933ce4046c95152871609
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc15Controller

Changed paths:
  A engines/ngi/fullpipe/sc15controller.cpp
  A engines/ngi/fullpipe/sc15controller.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 98948532e0b..3cde466dfdc 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -168,6 +168,7 @@ namespace NGI {
 #define sO_Fireman "\xcf\xee\xe6\xe0\xf0\xed\xe8\xea"	// "Пожарник"
 #define sO_ShowingHeel "\xcf\xee\xea\xe0\xe7\xfb\xe2\xe0\xe5\xf2 \xef\xff\xf2\xea\xf3"	// "Показывает пятку"
 #define sO_FullPipe "\xcf\xee\xeb\xed\xe0\xff \xd2\xf0\xf3\xe1\xe0"	// "Полная Труба"
+#define sO_IsFull "\xcf\xee\xeb\xee\xed"	// "Полон"
 #define sO_RightStairs_9 "\xcf\xf0\xe0\xe2\xe0\xff \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe0_9"	// "Правая лестница_9"
 #define sO_RightPipe_17 "\xcf\xf0\xe0\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_17"	// "Правая труба_17"
 #define sO_IsPresent "\xcf\xf0\xe8\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2"	// "Присутствует"
diff --git a/engines/ngi/fullpipe/sc15controller.cpp b/engines/ngi/fullpipe/sc15controller.cpp
new file mode 100644
index 00000000000..e076c51ba0e
--- /dev/null
+++ b/engines/ngi/fullpipe/sc15controller.cpp
@@ -0,0 +1,196 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/lift.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc15controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc15Controller::CSc15Controller (17AF6C)
+Sc15Controller::Sc15Controller(int sceneId) : FPController(sceneId) {
+	_heroCenterX = 0;
+	_heroCenterY = 0;
+}
+
+// CSc15Controller::~CSc15Controller (17AF34)
+Sc15Controller::~Sc15Controller() {
+}
+
+// CSc15Controller::OnShow (17AFA4)
+void Sc15Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_chapterManager->setActiveChapter(5);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_5", true);
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_chantTimer = 0;
+	g_ngi->_exitManager->setExitState(PIC_SC15_LTRUBA, 0);
+	AniObject *grandma = _scene->findAniObjectById(ANI_GRANDMA_ASS, 0);
+	if (isState(sO_Grandma, sO_In_15)) {
+		grandma->setStatic(ST_GMS_BOOT, false);
+		grandma->setPosition(Common::Point(97, 399));
+		g_ngi->setState(sO_LeftPipe_15, g_ngi->getStateValue(sO_LeftPipe_15, sO_IsClosed));
+	} else if (isState(sO_Grandma, sO_In_15_1)) {
+		grandma->setStatic(ST_GMS_BOOT, false);
+		grandma->setPosition(Common::Point(86, 399));
+		g_ngi->setState(sO_LeftPipe_15, g_ngi->getStateValue(sO_LeftPipe_15, sO_IsClosed));
+	} else if (isState(sO_Grandma, sO_In_15_2)) {
+		grandma->setStatic(ST_GMS_BOOT, false);
+		grandma->setPosition(Common::Point(71, 399));
+		g_ngi->setState(sO_LeftPipe_15, g_ngi->getStateValue(sO_LeftPipe_15, sO_IsClosed));
+	} else if (isState(sO_Grandma, sO_In_15_3)) {
+		grandma->setStatic(ST_GMS_BOOT, false);
+		grandma->setPosition(Common::Point(49, 399));
+		g_ngi->setState(sO_LeftPipe_15, g_ngi->getStateValue(sO_LeftPipe_15, sO_IsClosed));
+	} else if (isState(sO_Grandma, sO_WithoutBoot)) {
+		grandma->setStatic(ST_GMS_BOOT, false);
+		grandma->setPosition(Common::Point(97, 399));
+		grandma->setStatic(ST_GMS_BOOTLESS2, false);
+		g_ngi->setState(sO_LeftPipe_15, g_ngi->getStateValue(sO_LeftPipe_15, sO_IsClosed));
+	} else {
+		grandma->_flags &= ~4;
+		g_ngi->setState(sO_LeftPipe_15, g_ngi->getStateValue(sO_LeftPipe_15, sO_IsOpened));
+		g_ngi->_exitManager->setExitState(PIC_SC15_LTRUBA, 1);
+	}
+	if (isState(sO_CoinSlot_1, sO_IsFull)) {
+		AniObject *coin = g_ngi->findScene(SC_15)->findAniObjectById(ANI_SC4_COIN, 0);
+		if (coin)
+			coin->_flags |= 4;
+		g_ngi->setState(sO_CoinSlot_1, g_ngi->getStateValue(sO_CoinSlot_1, sO_Empty));
+	}
+	_plusMinus = _scene->findAniObjectById(ANI_PLUSMINUS, 2);
+	_plusMinus->setStatic(isState(sO_Guard_2, sO_Off) ? ST_PMS_MINUS : ST_PMS_PLUS, false);
+	_ladder = _scene->findPictureObjectById(PIC_SC15_LADDER, 0);
+	_ladder->_z = 5;
+	_boot = _scene->findAniObjectById(ANI_BOOT_15, 0);
+	if (isState(sO_Boot_15, sO_IsPresent))
+		_boot->_flags |= 4;
+	else
+		_boot->_flags &= ~4;
+	g_ngi->lift().enableButton(sO_Level5, projectId("ST_LBN_5N"));
+	g_ngi->lift().initLift(_scene, hero(), QU_SC15_ENTERLIFT, QU_SC15_EXITLIFT);
+	unlockCatalogItem("ANI_GUARD2");
+}
+
+// CSc15Controller::OnHide (17B678)
+void Sc15Controller::onHide() {
+	if (controllerRunsSceneLogic())
+		_walkQueue = nullptr;
+	FPController::onHide();
+}
+
+// CSc15Controller::GetCursorType (17B684): the lift buttons, the left pipe
+int Sc15Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (g_ngi->lift().getCursorType(x, y))
+		return 116;
+	if (g_ngi->_inputController->isObjectHit(PIC_SC15_LTRUBA))
+		return 3;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc15Controller::OnUpdate (17B6F4)
+void Sc15Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	if (_chantTimer > 0) {
+		_chantTimer--;
+		if (_chantTimer == 0)
+			g_ngi->playSound(SND_15_001, 1);
+	}
+}
+
+// CSc15Controller::OnMouseLKeyDown (17B72C)
+bool Sc15Controller::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyDown(id, x, y);
+	if (FPController::onMouseLKeyDown(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonDown(x, y);
+}
+
+// CSc15Controller::OnMouseLKeyUp (17B748)
+bool Sc15Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	if (FPController::onMouseLKeyUp(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonUp(x, y);
+}
+
+// CSc15Controller::OnMessage (17B764)
+void Sc15Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC15_PULL") {
+		_plusMinus->setStatic(_plusMinus->_statics->_staticsId == ST_PMS_MINUS ? ST_PMS_PLUS : ST_PMS_MINUS, false);
+	} else if (message == "MSG_SC15_LADDERTOBACK") {
+		_ladder->_z = 60;
+	} else if (message == "MSG_SC15_STOPCHANTING") {
+		g_ngi->stopAllSoundInstances(SND_15_001);
+		_chantTimer = 120;
+	} else if (message == "MSG_SC4_HIDEBOOT") {
+		_boot->_flags &= ~4;
+	} else if (message == "MSG_SC15_ASSDRYG") {
+		if (random31() <= 0x3FFFFFFF)
+			g_ngi->playSound(SND_15_011, 0);
+		else
+			g_ngi->playSound(SND_15_006, 0);
+	} else if (message == "MSG_SET_ACHIEVEMENT_ACTIVITY") {
+		AchievementsManager *achievements = g_ngi->_achievementsManager.get();
+		if (achievements->isActivatingItem("ACHIEVEMENT_GUARD_2", "guard21")) {
+			if (achievements->isActivatingItem("ACHIEVEMENT_GUARD_2", "guard22"))
+				achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard23");
+			else
+				achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard22");
+		} else {
+			achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard21");
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc15controller.h b/engines/ngi/fullpipe/sc15controller.h
new file mode 100644
index 00000000000..d39bb5ac538
--- /dev/null
+++ b/engines/ngi/fullpipe/sc15controller.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC15CONTROLLER_H
+#define NGI_FULLPIPE_SC15CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+class PictureObject;
+
+/** CSc15Controller (lift, grandma, chanting); sceneHandler15 runs the scene until wired */
+class Sc15Controller : public FPController {
+public:
+	explicit Sc15Controller(int sceneId);
+	~Sc15Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+private:
+	AniObject *_plusMinus = nullptr; // +216: ANI_PLUSMINUS (copy 2)
+	PictureObject *_ladder = nullptr; // +220: PIC_SC15_LADDER
+	AniObject *_boot = nullptr; // +224: ANI_BOOT_15
+	int _chantTimer = 0; // +228: updates until the chanting starts again
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC15CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index e23c3246045..a10399515c4 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -37,6 +37,7 @@
 #include "ngi/fullpipe/sc10controller.h"
 #include "ngi/fullpipe/sc12controller.h"
 #include "ngi/fullpipe/sc13controller.h"
+#include "ngi/fullpipe/sc15controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -53,15 +54,6 @@
 
 namespace NGI {
 
-// CSc15Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc15Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc16Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc16Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index a85a4836f27..b4867d52536 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc15Controller : public FPController {
-public:
-	explicit Sc15Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc16Controller : public FPController {
 public:
 	explicit Sc16Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 9bf81baa170..2850b919de7 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -116,6 +116,7 @@ MODULE_OBJS = \
 	fullpipe/sc12controller.o \
 	fullpipe/sc13controller.o \
 	fullpipe/sc14controller.o \
+	fullpipe/sc15controller.o \
 	fullpipe/sc17controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \


Commit: 996e6891cf4689dc9a9e711c99e4cdc20fbdaa59
    https://github.com/scummvm/scummvm/commit/996e6891cf4689dc9a9e711c99e4cdc20fbdaa59
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc16Controller

Changed paths:
  A engines/ngi/fullpipe/sc16controller.cpp
  A engines/ngi/fullpipe/sc16controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 7ceb6562ef6..56e4b803e11 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1918,4 +1918,12 @@ namespace NGI {
 // Android: names of obj.h that the ported controllers use
 #define ANI_SLONIK 827
 
+// Android: names of obj.h that the ported controllers use
+#define QU_SC16_BOYDRINK 1353
+#define QU_SC16_FALLMUG 28049
+#define PIC_MUG_SEL 28051
+#define ANI_SC16_TUMBA 28052
+#define QU_SC16_GIRLDRINK 63314
+#define ST_GRL_POPA 3277
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 3cde466dfdc..b0238248b09 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -106,6 +106,7 @@ namespace NGI {
 #define sO_IsPlaying "\xc8\xe3\xf0\xe0\xe5\xf2"	// "Играет"
 #define sO_Tub "\xca\xe0\xe4\xea\xe0"	// "Кадка"
 #define sO_Cactus "\xca\xe0\xea\xf2\xf3\xf1"	// "Кактус"
+#define sO_IsRiding "\xca\xe0\xf2\xe0\xe5\xf2\xf1\xff"	// "Катается"
 #define sO_IsSwingingWithBoot "\xca\xe0\xf2\xe0\xe5\xf2\xf1\xff \xf1 \xe1\xee\xf2\xe8\xed\xea\xee\xec"	// "Катается с ботинком"
 #define sO_IsSwinging "\xca\xe0\xf2\xe0\xe5\xf2\xf1\xff"	// "Катается"
 #define sO_Swingie "\xca\xe0\xf7\xe5\xeb\xe5\xed\xff"	// "Качеленя"
@@ -113,6 +114,7 @@ namespace NGI {
 #define sO_Carpet_35 "\xca\xee\xe2\xf0\xe8\xea_35"	// "Коврик_35"
 #define sO_Valve_35 "\xca\xf0\xe0\xed_35"	// "Кран_35"
 #define sO_Cup "\xca\xf0\xf3\xe6\xea\xe0"	// "Кружка"
+#define sO_Mug "\xca\xf0\xf3\xe6\xea\xe0"	// "Кружка"
 #define sO_Cube "\xca\xf3\xe1\xe8\xea"	// "Кубик"
 #define sO_LeftPipe_15 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_15"	// "Левая труба_15"
 #define sO_LeftPipe_26 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_26"	// "Левая труба_26"
@@ -182,6 +184,7 @@ namespace NGI {
 #define sO_Broken "\xd0\xe0\xe7\xe1\xe8\xf2\xe0"	// "Разбита"
 #define sO_Unblocked "\xd0\xe0\xe7\xe1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed"	// "Разблокирован"
 #define sO_Unconvoluted "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2"	// "Развернут"
+#define sO_Unfolded "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2"	// "Развернут"
 #define sO_WarmUp "\xd0\xe0\xf1\xef\xf0\xfb\xe3"	// "Распрыг"
 #define sO_Jawcrucnher "\xd0\xee\xf2\xee\xf5\xf0\xf3\xf1"	// "Ротохрус"
 #define sO_UsherHand "\xd0\xf3\xea\xe0 \xc1\xe8\xeb\xe5\xf2\xe5\xf0\xf8\xe8"	// "Рука Билетерши"
@@ -228,6 +231,7 @@ namespace NGI {
 #define sO_Pedestal_16 "\xd2\xf3\xec\xe1\xe0_16"	// "Тумба_16"
 #define sO_Pedestal_17 "\xd2\xf3\xec\xe1\xe0_17"	// "Тумба_17"
 #define sO_Pedestal_33 "\xd2\xf3\xec\xe1\xe0_33"	// "Тумба_33"
+#define sO_AtUncle "\xd3 \xc4\xff\xe4\xe8"	// "У Дяди"
 #define sO_NearDudesStairs "\xd3 \xc4\xff\xe4\xe8 \xed\xe0 \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe5"	// "У Дяди на лестнице"
 #define sO_DudeHas "\xd3 \xc4\xff\xe4\xe8"	// "У Дяди"
 #define sO_NearPipeWithStool "\xd3 \xf2\xf0\xf3\xe1\xfb \xf1 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xee\xe9"	// "У трубы с табуреткой"
diff --git a/engines/ngi/fullpipe/sc16controller.cpp b/engines/ngi/fullpipe/sc16controller.cpp
new file mode 100644
index 00000000000..26c0ed0fdcf
--- /dev/null
+++ b/engines/ngi/fullpipe/sc16controller.cpp
@@ -0,0 +1,431 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc16controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc16Controller::CSc16Controller (17BA4C)
+Sc16Controller::Sc16Controller(int sceneId) : FPController(sceneId), _laughSound(SND_16_034) {
+}
+
+// CSc16Controller::~CSc16Controller (17B9EC): the highlight goes with it
+Sc16Controller::~Sc16Controller() {
+}
+
+// CSc16Controller::DoHideWire (17BAA4)
+void Sc16Controller::doHideWire() {
+	_wire->_flags &= ~4;
+}
+
+// CSc16Controller::DoShowWire (17BAB2)
+void Sc16Controller::doShowWire() {
+	_wire->_flags |= 4;
+}
+
+// CSc16Controller::DoHideMug (17BAC0)
+void Sc16Controller::doHideMug() {
+	_mug->_flags &= ~4;
+}
+
+// CSc16Controller::DoShowMug (17BAD0)
+void Sc16Controller::doShowMug() {
+	_scene->runQueue(QU_SC16_SHOWMUG, 3);
+}
+
+// CSc16Controller::DoShowMugFull (17BAE4)
+void Sc16Controller::doShowMugFull() {
+	_mug->setStatic(ST_MUG_FULL, false);
+}
+
+// CSc16Controller::DoHideMan (17BAFA)
+void Sc16Controller::doHideMan() {
+	hero()->setStatic(ST_MAN_RIGHT, false);
+	hero()->_flags &= ~4;
+	_mug->_flags &= ~4;
+}
+
+// CSc16Controller::DoShowMan (17BB24)
+void Sc16Controller::doShowMan() {
+	hero()->setStatic(ST_MAN_RIGHT, false);
+	hero()->_flags |= 4;
+	_mug->_flags |= 4;
+}
+
+// CSc16Controller::DoSwitchGirl (17BB50)
+void Sc16Controller::doSwitchGirl() {
+	AniObject *girl = _scene->findAniObjectById(ANI_GIRL, 0);
+	girl->setStatic(ST_GRL_LAUGH, false);
+	girl->startMovement(MV_GRL_FALL, 0, -1);
+	_girlLaughs = false;
+}
+
+// CSc16Controller::MakeLaughSound (17BB9C)
+void Sc16Controller::makeLaughSound() {
+	switch (_laughSound) {
+	case SND_16_035:
+		_laughSound = SND_16_037;
+		break;
+	case SND_16_037:
+		_laughSound = SND_16_034;
+		break;
+	case SND_16_034:
+		_laughSound = SND_16_035;
+		break;
+	default:
+		break;
+	}
+	g_ngi->playSound(_laughSound, 0);
+}
+
+// CSc16Controller::DoStartLaugh (17BC10)
+void Sc16Controller::doStartLaugh() {
+	AniObject *girl = _scene->findAniObjectById(ANI_GIRL, 0);
+	girl->setStatic(ST_GRL_STAND, false);
+	MessageQueue *queue = copyQueue(_scene, QU_SC16_GIRLLAUGH);
+	queue->setObjectCopyAll(girl->_copyId);
+	_scene->runQueueObject(queue, nullptr, 2);
+	g_ngi->_taskManager->deactivateTask("GET_PLACE_BIGWEEL_SC16");
+	g_ngi->_taskManager->activateTask("RIDE_BIGWHEEL_SC18");
+	_girlLaughs = true;
+}
+
+// CSc16Controller::DoFillMug (17BCC8)
+void Sc16Controller::doFillMug() {
+	MessageQueue *queue = nullptr;
+	AniObject *child = nullptr;
+	if (!(_mug->_flags & 4)) {
+		_jettie->_z = 15;
+		if (_boot->_flags & 4) {
+			_boot->startMovement(MV_BT16_FILL, 0, -1);
+		} else {
+			_jettie->startMovement(MV_JTI_FLOWBY, 0, -1);
+		}
+		if (_boy) {
+			queue = copyQueue(_scene, QU_SC16_BOYOUT);
+			child = _boy;
+		} else if (_girl) {
+			queue = copyQueue(_scene, QU_SC16_GIRLOUT);
+			child = _girl;
+		} else {
+			return;
+		}
+	} else {
+		_jettie->_z = 2;
+		_jettie->startMovement(MV_JTI_FLOWIN, 0, -1);
+		if (hero()->_movement && hero()->getLastMovementId() == MV_MAN16_TAKEMUG) {
+			hero()->setStatic(ST_MAN_RIGHT, false);
+			_mug->_flags |= 4;
+			g_ngi->setState(sO_Mug, g_ngi->getStateValue(sO_Mug, sO_AtUncle));
+		}
+		if (_boy) {
+			queue = copyQueue(_scene, QU_SC16_BOYDRINK);
+			child = _boy;
+		} else if (_girl) {
+			queue = copyQueue(_scene, QU_SC16_GIRLDRINK);
+			child = _girl;
+		} else {
+			return;
+		}
+	}
+	queue->setObjectCopyAll(child->_copyId);
+	_scene->runQueueObject(queue, nullptr, 3);
+}
+
+// CSc16Controller::CheckMug (17BF2C): the mug is full, nobody drinks or works the jet
+bool Sc16Controller::checkMug() {
+	if (!isState(sO_Mug, sO_In_16))
+		return false;
+	if (!(_mug->_flags & 4))
+		return false;
+	if ((_jettie->_flags & 4) && _jettie->_movement)
+		return false;
+	if (_boy && _boy->_movement && _boy->getLastMovementId() == MV_BOY_DRINK)
+		return false;
+	return (!_girl || !_girl->_movement || _girl->getLastMovementId() != MV_GRL_DRINK) && _mug->_statics->_staticsId == ST_MUG_FULL;
+}
+
+// CSc16Controller::DoMug (17C018)
+void Sc16Controller::doMug() {
+	if (!checkMug())
+		return;
+	if (_mug->_statics->_staticsId == ST_MUG_FULL) {
+		if (_boy) {
+			_scene->stopAllQueues();
+			_boy->moveToStaticChain(ST_BOY_STAND);
+			MessageQueue *queue = copyQueue(_scene, QU_SC16_BOYKICK);
+			queue->setObjectCopyAll(_boy->_copyId);
+			_scene->runQueueObject(queue, hero(), 2);
+		} else {
+			_scene->stopAllQueues();
+			MessageQueue *queue = copyQueue(_scene, QU_SC16_MANDRINK);
+			_scene->runQueueObject(queue, hero(), 2);
+			_scene->findAniObjectById(ANI_GIRL, 0)->moveToStaticChain(ST_GRL_STAND);
+		}
+		_scene->findAniObjectById(ANI_WIRE16, 0)->_flags |= 4;
+	} else {
+		_scene->runQueueWithAni(QU_SC16_TAKEMUG, hero(), 2);
+	}
+}
+
+// CSc16Controller::DoTryBearded (17C0FC)
+void Sc16Controller::doTryBearded() {
+	if (!isState(sO_Bridge, sO_Unfolded))
+		return;
+	AniObject *bearded = _scene->findAniObjectById(ANI_BEARDED_CMN, 0);
+	if (bearded && !bearded->_movement && !(bearded->_flags & 4))
+		_scene->runQueue(QU_BRD16_STARTBEARDED, 3);
+}
+
+// CSc16Controller::OnMugFall (17C190)
+void Sc16Controller::onMugFall() {
+	if (isState(sO_Mug, sO_In_16))
+		_scene->runQueue(QU_SC16_FALLMUG, 3);
+}
+
+// CSc16Controller::OnMugClick (17C208): the hero walks to the mug, then takes it
+void Sc16Controller::onMugClick() {
+	if (!canInterruptManQueue())
+		return;
+	const Common::Point center = hero()->getCenter();
+	if (fabsf(310.0f - (float)center.x) < 3.0f && fabsf(449.0f - (float)center.y) < 3.0f && !hero()->_movement &&
+			hero()->_statics->_staticsId == ST_MAN_RIGHT) {
+		doMug();
+		return;
+	}
+	MessageQueue *queue = mctlStartMove(310, 449, true, ST_MAN_RIGHT, false);
+	if (!queue)
+		return;
+	if (queue->getCount() != 0)
+		queue->addCommandToEnd(messageCommand("MSG_SC16_MUGCLICK"));
+	else
+		doMug();
+}
+
+// CSc16Controller::DoNextChild (17C344): the next of the children walks in
+void Sc16Controller::doNextChild() {
+	if (_boy)
+		_children.push_back(_boy);
+	else if (_girl)
+		_children.push_back(_girl);
+	if (_children.empty())
+		return;
+	AniObject *child = _children[0];
+	_children.remove_at(0);
+	if (!child)
+		return;
+	_countChildren = false;
+	_girl = nullptr;
+	_boy = nullptr;
+	const int fullId = (child->_copyId << 16) | child->_id;
+	if (fullId == ANI_BOY) {
+		MessageQueue *queue = copyQueue(_scene, QU_SC16_GOBOY);
+		queue->setObjectCopyAll(child->_copyId);
+		_scene->runQueueObject(queue, nullptr, 3);
+		_boy = child;
+	} else if (fullId == ANI_GIRL) {
+		if (isState(sO_Girl, sO_IsRiding)) {
+			MessageQueue *queue = copyQueue(_scene, QU_SC16_GOGIRL);
+			queue->setObjectCopyAll(child->_copyId);
+			_scene->runQueueObject(queue, nullptr, 3);
+			_girl = child;
+		}
+	} else {
+		_countChildren = true;
+	}
+}
+
+// CSc16Controller::OnSceneInit (17C490)
+void Sc16Controller::onSceneInit() {
+	FPController::onSceneInit();
+	_highlight.reset(new Highlight(_scene, PIC_MUG_SEL));
+}
+
+// CSc16Controller::OnShow (17C4BC)
+void Sc16Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_children.clear();
+	_boy = nullptr;
+	_girl = nullptr;
+	_countChildren = true;
+	_childTimer = 0;
+	_wire = _scene->findAniObjectById(ANI_WIRE16, 0);
+	_mug = _scene->findAniObjectById(ANI_MUG, 0);
+	_jettie = _scene->findAniObjectById(ANI_JETTIE, 0);
+	_boot = _scene->findAniObjectById(ANI_BOOT_16, 0);
+	_girlLaughs = false;
+	_laughSound = SND_16_034;
+	AniObject *bearded = _scene->findAniObjectById(ANI_BEARDED_CMN, 0);
+	bearded->_flags &= ~4;
+	if (isState(sO_Bridge, sO_Convoluted)) {
+		_childrenMode = true;
+		AniObject *boy = _scene->findAniObjectById(ANI_BOY, 0);
+		_children.push_back(boy);
+		_children.push_back(boy);
+		_children.push_back(boy);
+		_children.push_back(_scene->findAniObjectById(ANI_GIRL, 0));
+		for (int i = 4; i != 0; --i)
+			_children.push_back(boy);
+	} else {
+		g_ngi->setState(sO_Girl, g_ngi->getStateValue(sO_Girl, sO_IsRiding));
+		_childrenMode = false;
+		bearded->setStatic(ST_BRDCMN_EMPTY, false);
+	}
+	AniObject *girl = _scene->findAniObjectById(ANI_GIRL, 0);
+	if (isState(sO_Girl, sO_IsLaughing)) {
+		girl->_flags |= 4;
+		girl->setStatic(ST_GRL_POPA, false);
+		girl->setCenter(Common::Point(554, 432));
+		girl->_z = 20;
+	} else {
+		girl->stopMovement();
+		_scene->findAniObjectById(ANI_GIRL, 0)->_flags &= ~4;
+	}
+	if (isState(sO_Mug, sO_In_16)) {
+		_mug->setStatic(ST_MUG_EMPTY, false);
+		_mug->_flags |= 4;
+		_mug->setPosition(Common::Point(409, 459));
+		_mug->_z = 5;
+	}
+	_beardedTimer = 0;
+}
+
+// CSc16Controller::OnHide (17C858)
+void Sc16Controller::onHide() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onHide();
+		return;
+	}
+	if (_boy) {
+		_boy->stopMovement();
+		_boy->_flags &= ~4;
+		_boy = nullptr;
+	}
+	if (_girl) {
+		_girl->stopMovement();
+		_girl->_flags &= ~4;
+		_girl = nullptr;
+	}
+	_children.clear();
+	FPController::onHide();
+}
+
+// CSc16Controller::GetCursorType (17C8B4): the tumba takes an item, the full mug can be taken
+int Sc16Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (g_ngi->_inputController->isObjectHit(ANI_SC16_TUMBA) && !g_ngi->_inputController->getObject())
+		return 1;
+	if (g_ngi->_inputController->isObjectHit(ANI_MUG) && _mug->_statics->_staticsId == ST_MUG_FULL)
+		return 118;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc16Controller::OnUpdate (17C90C)
+void Sc16Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	FPController::onUpdate(elapsed);
+	if (_childrenMode) {
+		if (_countChildren) {
+			_childTimer += elapsed;
+			if (_childTimer > 279) {
+				doNextChild();
+				_childTimer = 0;
+			}
+		}
+	} else {
+		_beardedTimer += elapsed;
+		if (_beardedTimer > 19999) {
+			_beardedTimer = 0;
+			doTryBearded();
+		}
+	}
+	if (_girlLaughs && hero()->_movement && hero()->getLastMovementId() == MV_MAN_TURN_RL)
+		doSwitchGirl();
+	_highlight->update(elapsed, checkMug());
+}
+
+// CSc16Controller::OnMessage (17C9A0)
+void Sc16Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC16_HIDEWIRE") {
+		doHideWire();
+	} else if (message == "MSG_SC16_SHOWWIRE") {
+		doShowWire();
+	} else if (message == "MSG_SC16_HIDEMUG") {
+		doHideMug();
+	} else if (message == "MSG_SC16_SHOWMUG") {
+		doShowMug();
+	} else if (message == "MSG_SC16_SHOWMUGFULL") {
+		doShowMugFull();
+	} else if (message == "MSG_SC16_HIDEMAN") {
+		doHideMan();
+	} else if (message == "MSG_SC16_SHOWMAN") {
+		doShowMan();
+	} else if (message == "MSG_SC16_FILLMUG") {
+		doFillMug();
+	} else if (message == "MSG_SC16_MUGCLICK") {
+		onMugClick();
+	} else if (message == "MSG_SC16_STARTLAUGH") {
+		doStartLaugh();
+	} else if (message == "MSG_SC16_SHOWBEARDED") {
+		doTryBearded();
+	} else if (message == "MSG_SC16_LAUGHSOUND") {
+		makeLaughSound();
+	} else if (message == "MSG_SC16_NEED_INC_GO_TIME") {
+		_countChildren = true;
+	} else if (message == "MSG_SC16_FALLMUG") {
+		onMugFall();
+	} else if (message == "MSG_SC16_HIDE_BOY") {
+		if (_boy)
+			_boy->_flags &= ~4;
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc16controller.h b/engines/ngi/fullpipe/sc16controller.h
new file mode 100644
index 00000000000..3e20e9e3b7f
--- /dev/null
+++ b/engines/ngi/fullpipe/sc16controller.h
@@ -0,0 +1,83 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC16CONTROLLER_H
+#define NGI_FULLPIPE_SC16CONTROLLER_H
+
+#include "common/array.h"
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/highlight.h"
+
+namespace NGI {
+
+/** CSc16Controller (children, mug, bearded man); sceneHandler16 runs the scene until wired */
+class Sc16Controller : public FPController {
+public:
+	explicit Sc16Controller(int sceneId);
+	~Sc16Controller() override;
+
+	void onSceneInit() override;
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void doHideWire();
+	void doShowWire();
+	void doHideMug();
+	void doShowMug();
+	void doShowMugFull();
+	void doHideMan();
+	void doShowMan();
+	void doSwitchGirl();
+	void makeLaughSound();
+	void doStartLaugh();
+	void doFillMug();
+	bool checkMug();
+	void doMug();
+	void doTryBearded();
+	void onMugFall();
+	void onMugClick();
+	void doNextChild();
+
+private:
+	AniObject *_wire = nullptr; // +216: ANI_WIRE16
+	AniObject *_mug = nullptr; // +220: ANI_MUG
+	AniObject *_jettie = nullptr; // +224: ANI_JETTIE
+	AniObject *_boot = nullptr; // +228: ANI_BOOT_16
+	int _childTimer = 0; // +232: ms until the next child comes
+	AniObject *_boy = nullptr; // +236: the boy that is on the scene
+	AniObject *_girl = nullptr; // +240: the girl that is on the scene
+	Common::Array<AniObject *> _children; // +244: who comes next
+	bool _childrenMode = true; // +256: the bridge is folded: the children come, else the bearded man
+	bool _girlLaughs = false; // +257: the girl falls when the hero turns
+	int _laughSound = 0; // +260: the sound of the next laugh
+	bool _countChildren = true; // +264: the timer for the next child runs
+	int _beardedTimer = 0; // +268: ms until the bearded man is tried
+	Common::ScopedPtr<Highlight> _highlight; // +272: PIC_MUG_SEL
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC16CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index a10399515c4..2f5e8e26e7e 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -38,6 +38,7 @@
 #include "ngi/fullpipe/sc12controller.h"
 #include "ngi/fullpipe/sc13controller.h"
 #include "ngi/fullpipe/sc15controller.h"
+#include "ngi/fullpipe/sc16controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -54,15 +55,6 @@
 
 namespace NGI {
 
-// CSc16Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc16Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc18Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc18Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index b4867d52536..4bc9194774b 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc16Controller : public FPController {
-public:
-	explicit Sc16Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc18Controller : public FPController {
 public:
 	explicit Sc18Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 2850b919de7..8c2babed691 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -117,6 +117,7 @@ MODULE_OBJS = \
 	fullpipe/sc13controller.o \
 	fullpipe/sc14controller.o \
 	fullpipe/sc15controller.o \
+	fullpipe/sc16controller.o \
 	fullpipe/sc17controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \


Commit: 5cf4ac34f69a64603c2e0fae83f227d4f2056d10
    https://github.com/scummvm/scummvm/commit/5cf4ac34f69a64603c2e0fae83f227d4f2056d10
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc21Controller

Changed paths:
  A engines/ngi/fullpipe/sc21controller.cpp
  A engines/ngi/fullpipe/sc21controller.h
  A engines/ngi/fullpipe/sc36controller.cpp
  A engines/ngi/fullpipe/sc36controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 56e4b803e11..286fc532b74 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1926,4 +1926,9 @@ namespace NGI {
 #define QU_SC16_GIRLDRINK 63314
 #define ST_GRL_POPA 3277
 
+// Android: names of obj.h that the ported controllers use
+#define ANI_CLEANERS 1767
+#define ST_CLN_STAND 1769
+#define ANI_HAMMER38 2194
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index b0238248b09..280d004b4f4 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -156,6 +156,7 @@ namespace NGI {
 #define sO_Leg "\xcd\xee\xe3\xe0"	// "Нога"
 #define sO_FriesPit "\xcd\xee\xf0\xea\xe0 \xea\xee\xe7\xff\xe2\xea\xe8"	// "Норка козявки"
 #define sO_Sock_26 "\xcd\xee\xf1\xee\xea_26"	// "Носок_26"
+#define sO_Deceived "\xce\xe1\xec\xe0\xed\xf3\xf2\xfb"	// "Обмануты"
 #define sO_ClockAxis "\xce\xf1\xfc \xf7\xe0\xf1\xee\xe2"	// "Ось часов"
 #define sO_Opened "\xce\xf2\xea\xf0\xfb\xf2"	// "Открыт"
 #define sO_OpenedWithBoot "\xce\xf2\xea\xf0\xfb\xf2\xe0 \xf1 \xe1\xee\xf2\xe8\xed\xea\xee\xec"	// "Открыта с ботинком"
@@ -237,6 +238,7 @@ namespace NGI {
 #define sO_NearPipeWithStool "\xd3 \xf2\xf0\xf3\xe1\xfb \xf1 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xee\xe9"	// "У трубы с табуреткой"
 #define sO_NearPipe "\xd3 \xf2\xf0\xf3\xe1\xfb"	// "У трубы"
 #define sO_Janitors "\xd3\xe1\xee\xf0\xf9\xe8\xea\xe8"	// "Уборщики"
+#define sO_Cleaners "\xd3\xe1\xee\xf0\xf9\xe8\xea\xe8"	// "Уборщики"
 #define sO_Maid "\xd3\xe1\xee\xf0\xf9\xe8\xf6\xe0"	// "Уборщица"
 #define sO_IsGone "\xd3\xe5\xf5\xe0\xeb\xe0"	// "Уехала"
 #define sO_FallenTwice "\xd3\xef\xe0\xeb \xe4\xe2\xe0"	// "Упал два"
diff --git a/engines/ngi/fullpipe/sc21controller.cpp b/engines/ngi/fullpipe/sc21controller.cpp
new file mode 100644
index 00000000000..8372c96873d
--- /dev/null
+++ b/engines/ngi/fullpipe/sc21controller.cpp
@@ -0,0 +1,165 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/inventory.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc21controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc21Controller::CSc21Controller (180D38)
+Sc21Controller::Sc21Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc21Controller::~CSc21Controller (180D00)
+Sc21Controller::~Sc21Controller() {
+}
+
+// CSc21Controller::MoveTheAss (180D88): the hanging giraffe swings sideways
+void Sc21Controller::moveTheAss(uint32 elapsed) {
+	const int offset = (int)(cos(_angle) * 10.0);
+	_giraffe->setCenter(Common::Point((int)(_giraffeX + (float)offset), (int)_giraffeY));
+	const double angle = (double)elapsed * 0.19635 / 40.0 + _angle;
+	if (angle > 6.28318530717958)
+		_angle = angle - 6.28318530717958;
+	else
+		_angle = angle;
+}
+
+// CSc21Controller::TrySwitchUp (180E38)
+int Sc21Controller::trySwitchUp() {
+	return 0;
+}
+
+// CSc21Controller::OnShow (180E40)
+void Sc21Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(5);
+	g_ngi->_chapterManager->setActiveChapter(6);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_6", true);
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	AniObject *hammer = _scene->findAniObjectById(ANI_HAMMER38, 0);
+	bool hammerShown = false;
+	if (isState(sO_Bridge, sO_Convoluted))
+		hammerShown = g_ngi->_inventory->getItemByName("ANI_INV_HAMMER")->_counter == 0;
+	if (hammerShown)
+		hammer->_flags |= 4;
+	else
+		hammer->_flags &= ~4;
+	_marginY = 200;
+	_marginX = 300;
+	_offsetY = 300;
+	_offsetX = 400;
+	_giraffe = _scene->findAniObjectById(ANI_GIRAFFE_BOTTOM, 0);
+	PictureObject *pipe = _scene->findPictureObjectById(PIC_SC21_DTRUBA, 0);
+	if (!isState(sO_LowerPipe_21, sO_IsOpened)) {
+		_swinging = false;
+		if (pipe->_hitRegion.left != 150) {
+			pipe->_hitRegion.left += 100;
+			pipe->_hitRegion.top -= 25;
+			pipe->_hitRegion.right += 100;
+			pipe->_hitRegion.bottom -= 25;
+		}
+	} else {
+		_giraffe->moveToStaticChain(ST_GRFB_HANG);
+		_swinging = true;
+		_angle = 0.0;
+		const Common::Point center = _giraffe->getCenter();
+		_giraffeX = center.x;
+		_giraffeY = center.y;
+		if (pipe->_hitRegion.left != 50) {
+			pipe->_hitRegion.left -= 100;
+			pipe->_hitRegion.right -= 100;
+		}
+	}
+	g_ngi->_exitManager->setExitOffset(PIC_SC21_DTRUBA, 0, 0);
+	if (isState(sO_Cleaners, sO_Deceived)) {
+		AniObject *cleaners = _scene->findAniObjectById(ANI_CLEANERS, 0);
+		if (cleaners)
+			cleaners->moveToStaticChain(ST_CLN_STAND);
+	}
+}
+
+// CSc21Controller::GetCursorType (181198): the open lower pipe
+int Sc21Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (!g_ngi->_inputController->isObjectHit(PIC_SC21_DTRUBA))
+		return FPController::getCursorType(x, y);
+	if (isState(sO_LowerPipe_21, sO_IsOpened))
+		return 2;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc21Controller::OnUpdate (181254)
+void Sc21Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	if (_swinging)
+		moveTheAss(elapsed);
+}
+
+// CSc21Controller::OnMessage (181274)
+void Sc21Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC21_UPDATEASS") {
+		if (!isState(sO_LowerPipe_21, sO_IsOpened))
+			return;
+		_giraffe->setStatic(ST_GRFB_HANG, false);
+		_giraffe->setCenter(Common::Point((int)_giraffeX, (int)_giraffeY));
+		_giraffe->moveToStaticChain(ST_GRFB_SIT);
+		_swinging = false;
+		g_ngi->setState(sO_LowerPipe_21, g_ngi->getStateValue(sO_LowerPipe_21, sO_IsClosed));
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc21Controller::UpdateScroll (18138C)
+void Sc21Controller::updateScroll() {
+	FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc21controller.h b/engines/ngi/fullpipe/sc21controller.h
new file mode 100644
index 00000000000..e6aec11d64b
--- /dev/null
+++ b/engines/ngi/fullpipe/sc21controller.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC21CONTROLLER_H
+#define NGI_FULLPIPE_SC21CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc21Controller (giraffe, cleaners); sceneHandler21 runs the scene until wired */
+class Sc21Controller : public FPController {
+public:
+	explicit Sc21Controller(int sceneId);
+	~Sc21Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void moveTheAss(uint32 elapsed);
+	int trySwitchUp();
+
+private:
+	AniObject *_giraffe = nullptr; // +216: ANI_GIRAFFE_BOTTOM
+	double _angle = 0.0; // +224: the swing of the hanging giraffe
+	bool _swinging = false; // +232
+	float _giraffeX = 0.0f; // +236: its center when it hangs
+	float _giraffeY = 0.0f; // +240
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC21CONTROLLER_H
diff --git a/engines/ngi/fullpipe/sc36controller.cpp b/engines/ngi/fullpipe/sc36controller.cpp
new file mode 100644
index 00000000000..9cb5a242380
--- /dev/null
+++ b/engines/ngi/fullpipe/sc36controller.cpp
@@ -0,0 +1,76 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/input.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/sc36controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc36Controller::CSc36Controller (194808)
+Sc36Controller::Sc36Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc36Controller::~CSc36Controller (1947D0)
+Sc36Controller::~Sc36Controller() {
+}
+
+// CSc36Controller::OnShow (194834)
+void Sc36Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_taskManager->activateTask("USE_ROTOHRUST_SC36");
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_rotohrust = _scene->findAniObjectById(ANI_ROTOHRUST, 0);
+	_scissors = _scene->findAniObjectById(ANI_SCISSORS_36, 0);
+}
+
+// CSc36Controller::GetCursorType (1948CC): the open rotohrust shows the hand
+int Sc36Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (g_ngi->_inputController->isObjectHit(ANI_ROTOHRUST) && _rotohrust->_statics->_staticsId == ST_RHT_OPEN)
+		return 3;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc36Controller::OnUpdate (194918)
+void Sc36Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+}
+
+// CSc36Controller::OnMessage (194920)
+void Sc36Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	FPController::onMessage(message, param, queue);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc36controller.h b/engines/ngi/fullpipe/sc36controller.h
new file mode 100644
index 00000000000..d420b44ddfb
--- /dev/null
+++ b/engines/ngi/fullpipe/sc36controller.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC36CONTROLLER_H
+#define NGI_FULLPIPE_SC36CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc36Controller (rotohrust, scissors); sceneHandler36 runs the scene until wired */
+class Sc36Controller : public FPController {
+public:
+	explicit Sc36Controller(int sceneId);
+	~Sc36Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+private:
+	AniObject *_rotohrust = nullptr; // +216: ANI_ROTOHRUST
+	AniObject *_scissors = nullptr; // +220: ANI_SCISSORS_36
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC36CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 2f5e8e26e7e..ef6e2878850 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -39,6 +39,8 @@
 #include "ngi/fullpipe/sc13controller.h"
 #include "ngi/fullpipe/sc15controller.h"
 #include "ngi/fullpipe/sc16controller.h"
+#include "ngi/fullpipe/sc21controller.h"
+#include "ngi/fullpipe/sc36controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -83,15 +85,6 @@ void Sc20Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc21Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc21Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc22Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc22Controller::onShow() {
 	FPController::onShow();
@@ -200,15 +193,6 @@ void Sc35Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc36Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc36Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc37Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc37Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 4bc9194774b..20c68118302 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -46,12 +46,6 @@ public:
 	void onShow() override;
 };
 
-class Sc21Controller : public FPController {
-public:
-	explicit Sc21Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc22Controller : public FPController {
 public:
 	explicit Sc22Controller(int sceneId) : FPController(sceneId) {}
@@ -124,12 +118,6 @@ public:
 	void onShow() override;
 };
 
-class Sc36Controller : public FPController {
-public:
-	explicit Sc36Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc37Controller : public FPController {
 public:
 	explicit Sc37Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 8c2babed691..75e7452a319 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -119,8 +119,10 @@ MODULE_OBJS = \
 	fullpipe/sc15controller.o \
 	fullpipe/sc16controller.o \
 	fullpipe/sc17controller.o \
+	fullpipe/sc21controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \
+	fullpipe/sc36controller.o \
 	fullpipe/sc38controller.o \
 	fullpipe/scene01.o \
 	fullpipe/scene02.o \


Commit: dfe9aaffdabb4074d5cb8762fee64ddb60701ffc
    https://github.com/scummvm/scummvm/commit/dfe9aaffdabb4074d5cb8762fee64ddb60701ffc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc20Controller

Changed paths:
  A engines/ngi/fullpipe/sc20controller.cpp
  A engines/ngi/fullpipe/sc20controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 286fc532b74..ad4e13982db 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1931,4 +1931,7 @@ namespace NGI {
 #define ST_CLN_STAND 1769
 #define ANI_HAMMER38 2194
 
+// Android: names of obj.h that the ported controllers use
+#define ANI_STOOL_20 2463
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 280d004b4f4..5dfcecceb67 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -137,6 +137,7 @@ namespace NGI {
 #define sO_Fly_12 "\xcc\xf3\xf5\xe0_12"	// "Муха_12"
 #define sO_Fly_17 "\xcc\xf3\xf5\xe0_17"	// "Муха_17"
 #define sO_OnTheFloor "\xcd\xe0 \xef\xee\xeb\xf3"	// "На полу"
+#define sO_OnFloor "\xcd\xe0 \xef\xee\xeb\xf3"	// "На полу"
 #define sO_OnTheSpring "\xcd\xe0 \xef\xf0\xf3\xe6\xe8\xed\xe5"	// "На пружине"
 #define sO_OnTheTable "\xcd\xe0 \xf1\xf2\xee\xeb\xe5"	// "На столе"
 #define sO_OnStool "\xcd\xe0 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xe5"	// "На табуретке"
@@ -235,8 +236,10 @@ namespace NGI {
 #define sO_AtUncle "\xd3 \xc4\xff\xe4\xe8"	// "У Дяди"
 #define sO_NearDudesStairs "\xd3 \xc4\xff\xe4\xe8 \xed\xe0 \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe5"	// "У Дяди на лестнице"
 #define sO_DudeHas "\xd3 \xc4\xff\xe4\xe8"	// "У Дяди"
+#define sO_AtPipe "\xd3 \xf2\xf0\xf3\xe1\xfb"	// "У трубы"
 #define sO_NearPipeWithStool "\xd3 \xf2\xf0\xf3\xe1\xfb \xf1 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xee\xe9"	// "У трубы с табуреткой"
 #define sO_NearPipe "\xd3 \xf2\xf0\xf3\xe1\xfb"	// "У трубы"
+#define sO_AtPipeWithStool "\xd3 \xf2\xf0\xf3\xe1\xfb \xf1 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xee\xe9"	// "У трубы с табуреткой"
 #define sO_Janitors "\xd3\xe1\xee\xf0\xf9\xe8\xea\xe8"	// "Уборщики"
 #define sO_Cleaners "\xd3\xe1\xee\xf0\xf9\xe8\xea\xe8"	// "Уборщики"
 #define sO_Maid "\xd3\xe1\xee\xf0\xf9\xe8\xf6\xe0"	// "Уборщица"
diff --git a/engines/ngi/fullpipe/sc20controller.cpp b/engines/ngi/fullpipe/sc20controller.cpp
new file mode 100644
index 00000000000..a5de6dab5c2
--- /dev/null
+++ b/engines/ngi/fullpipe/sc20controller.cpp
@@ -0,0 +1,168 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/sc20controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+namespace {
+
+// n * lrand48() / 0x7FFFFFFF as the original, for a value that was drawn earlier
+int scaleRandom(int n, uint32 value) {
+	const int32 product = (int32)((uint32)n * value);
+	return product / 0x7FFFFFFF;
+}
+
+} // End of anonymous namespace
+
+// CSc20Controller::CSc20Controller (18035C)
+Sc20Controller::Sc20Controller(int sceneId) : FPController(sceneId), _flyPack(new FlyPack()) {
+}
+
+// CSc20Controller::~CSc20Controller (180310): the fly pack goes with it
+Sc20Controller::~Sc20Controller() {
+}
+
+// CSc20Controller::TryFly (1803B0): another fly comes, or one of them is sent away
+void Sc20Controller::tryFly() {
+	const int count = _flyPack->_flies.size();
+	if (count <= 2) {
+		_flyPack->addFly(_scene, 253, 650, 200, 0);
+		GutlFly &fly = _flyPack->_flies.back();
+		fly.targetX = 250;
+		fly.targetY = 200;
+	} else {
+		const uint index = (uint32)(count * random31()) == 0x80000000u ? 1 : 0;
+		GutlFly &fly = _flyPack->_flies[index];
+		fly.countdown = 0;
+		fly.flags |= 4;
+		fly.targetX = 250;
+		fly.targetY = 200;
+		fly.exitX = 253;
+		fly.exitY = 650;
+		fly.ani->_z = 200;
+	}
+	_flyTimer = scaledRandom(16600) + 33200;
+}
+
+// CSc20Controller::UpdateLockable (180478): the links that the grandma's place locks
+void Sc20Controller::updateLockable() {
+	MotionController *controller = _scene->_motionController.get();
+	if (isState(sO_Grandma, sO_OnStool) || isState(sO_Grandma, sO_OnFloor)) {
+		controller->lockLink(sO_CloseThing, true);
+		controller->lockLink(sO_CloseThing2, false);
+		controller->lockLink(sO_CloseThing3, true);
+	} else if (isState(sO_Grandma, sO_AtPipe)) {
+		controller->lockLink(sO_CloseThing, true);
+		controller->lockLink(sO_CloseThing2, true);
+		controller->lockLink(sO_CloseThing3, false);
+	} else if (isState(sO_Grandma, sO_AtPipeWithStool)) {
+		controller->lockLink(sO_CloseThing, true);
+		controller->lockLink(sO_CloseThing2, true);
+		controller->lockLink(sO_CloseThing3, false);
+	} else {
+		controller->lockLink(sO_CloseThing, false);
+		controller->lockLink(sO_CloseThing2, false);
+		controller->lockLink(sO_CloseThing3, true);
+	}
+}
+
+// CSc20Controller::OnShow (1807C0)
+void Sc20Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_grandma = _scene->findAniObjectById(ANI_GRANDMA_20, 0);
+	_stool = _scene->findAniObjectById(ANI_STOOL_20, 0);
+	_grandma->_flags |= 4;
+	if (isState(sO_Grandma, sO_OnFloor))
+		g_ngi->setState(sO_Grandma, g_ngi->getStateValue(sO_Grandma, sO_AtPipe));
+	if (isState(sO_Grandma, sO_OnStool)) {
+		_grandma->moveToStaticChain(ST_GMA20_STOOL);
+	} else if (isState(sO_Grandma, sO_OnFloor)) {
+		_grandma->moveToStaticChain(ST_GMA20_FLOOR);
+	} else if (isState(sO_Grandma, sO_AtPipe) || isState(sO_Grandma, sO_AtPipeWithStool)) {
+		_grandma->moveToStaticChain(ST_GMA20_STOOL);
+		_grandma->moveToStaticChain(ST_GMA20_STAND);
+	} else {
+		_grandma->_flags &= ~4;
+	}
+	if (isState(sO_Grandma, sO_AtPipeWithStool))
+		_stool->_flags |= 4;
+	updateLockable();
+	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_20"));
+	for (int i = 0; i < 3; i++) {
+		const uint32 randomX = random31();
+		const int y = scaledRandom(50) + 175;
+		_flyPack->addFly(_scene, scaleRandom(100, randomX) + 70, y, 100, 0);
+		_flyPack->_flies.back().idleTicks = scaledRandom(664);
+	}
+	_flyTimer = scaledRandom(16600) + 33200;
+}
+
+// CSc20Controller::OnHide (180C54)
+void Sc20Controller::onHide() {
+	if (controllerRunsSceneLogic())
+		_flyPack->deleteAllFlies();
+	FPController::onHide();
+}
+
+// CSc20Controller::OnUpdate (180C6A)
+void Sc20Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	const int time = _flyTimer;
+	_flyTimer = time - elapsed;
+	if (_flyTimer <= 0)
+		tryFly();
+	_flyPack->onUpdate(elapsed);
+}
+
+// CSc20Controller::OnMessage (180C94)
+void Sc20Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC20_UPDATELOCKABLE")
+		updateLockable();
+	else
+		FPController::onMessage(message, param, queue);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc20controller.h b/engines/ngi/fullpipe/sc20controller.h
new file mode 100644
index 00000000000..72d5b15ac2e
--- /dev/null
+++ b/engines/ngi/fullpipe/sc20controller.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC20CONTROLLER_H
+#define NGI_FULLPIPE_SC20CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/floaters.h"
+
+namespace NGI {
+
+/** CSc20Controller (grandma, stool, flies); sceneHandler20 runs the scene until wired */
+class Sc20Controller : public FPController {
+public:
+	explicit Sc20Controller(int sceneId);
+	~Sc20Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void tryFly();
+	void updateLockable();
+
+private:
+	AniObject *_grandma = nullptr; // +216: ANI_GRANDMA_20
+	AniObject *_stool = nullptr; // +220: ANI_STOOL_20
+	Common::ScopedPtr<FlyPack> _flyPack; // +224
+	int _flyTimer = 0; // +228: the milliseconds until the next fly
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC20CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index ef6e2878850..f8794ac6203 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -41,6 +41,7 @@
 #include "ngi/fullpipe/sc16controller.h"
 #include "ngi/fullpipe/sc21controller.h"
 #include "ngi/fullpipe/sc36controller.h"
+#include "ngi/fullpipe/sc20controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -76,15 +77,6 @@ void Sc19Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc20Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc20Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc22Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc22Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 20c68118302..a94cd5162ab 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -40,12 +40,6 @@ public:
 	void onShow() override;
 };
 
-class Sc20Controller : public FPController {
-public:
-	explicit Sc20Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc22Controller : public FPController {
 public:
 	explicit Sc22Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 75e7452a319..3a6239f5457 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -119,6 +119,7 @@ MODULE_OBJS = \
 	fullpipe/sc15controller.o \
 	fullpipe/sc16controller.o \
 	fullpipe/sc17controller.o \
+	fullpipe/sc20controller.o \
 	fullpipe/sc21controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \


Commit: ce337b7de4638790321ecc6e06bf92e9651c6158
    https://github.com/scummvm/scummvm/commit/ce337b7de4638790321ecc6e06bf92e9651c6158
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc24Controller

Changed paths:
  A engines/ngi/fullpipe/sc24controller.cpp
  A engines/ngi/fullpipe/sc24controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index ad4e13982db..d171793143e 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1934,4 +1934,7 @@ namespace NGI {
 // Android: names of obj.h that the ported controllers use
 #define ANI_STOOL_20 2463
 
+// Android: names of obj.h that the ported controllers use
+#define PIC_SC24_LADDERD 1826
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 5dfcecceb67..1b7f156079c 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -122,6 +122,7 @@ namespace NGI {
 #define sO_LeftPipe_30 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_30"	// "Левая труба_30"
 #define sO_LeftPipe_37 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_37"	// "Левая труба_37"
 #define sO_StairsDown_24 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xe2\xed\xe8\xe7_24"	// "Лестница вниз_24"
+#define sO_LadderDown_24 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xe2\xed\xe8\xe7_24"	// "Лестница вниз_24"
 #define sO_StairsUp_8 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xf1\xe2\xe5\xf0\xf5\xf3_8"	// "Лестница сверху_8"
 #define sO_Stairway "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0"	// "Лестница"
 #define sO_Fliers "\xcb\xe5\xf2\xf3\xed\xfb"	// "Летуны"
@@ -169,6 +170,7 @@ namespace NGI {
 #define sO_First "\xcf\xe5\xf0\xe2\xfb\xe9"	// "Первый"
 #define sO_UpsideDown "\xcf\xe5\xf0\xe5\xe2\xe5\xf0\xed\xf3\xf2\xe0"	// "Перевернута"
 #define sO_Overfull "\xcf\xe5\xf0\xe5\xef\xee\xeb\xed\xe5\xed"	// "Переполнен"
+#define sO_Overflowed "\xcf\xe5\xf0\xe5\xef\xee\xeb\xed\xe5\xed"	// "Переполнен"
 #define sO_Fireman "\xcf\xee\xe6\xe0\xf0\xed\xe8\xea"	// "Пожарник"
 #define sO_ShowingHeel "\xcf\xee\xea\xe0\xe7\xfb\xe2\xe0\xe5\xf2 \xef\xff\xf2\xea\xf3"	// "Показывает пятку"
 #define sO_FullPipe "\xcf\xee\xeb\xed\xe0\xff \xd2\xf0\xf3\xe1\xe0"	// "Полная Труба"
diff --git a/engines/ngi/fullpipe/sc24controller.cpp b/engines/ngi/fullpipe/sc24controller.cpp
new file mode 100644
index 00000000000..ff620ce50ba
--- /dev/null
+++ b/engines/ngi/fullpipe/sc24controller.cpp
@@ -0,0 +1,151 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc24controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc24Controller::CSc24Controller (1847B4)
+Sc24Controller::Sc24Controller(int sceneId) : FPController(sceneId) {
+	_heroCenterX = 0;
+	_heroCenterY = 0;
+	_marginX = 0;
+	_marginY = 0;
+	_offsetX = 0;
+	_offsetY = 0;
+}
+
+// CSc24Controller::~CSc24Controller (18477C)
+Sc24Controller::~Sc24Controller() {
+}
+
+// CSc24Controller::OnShow (184800)
+void Sc24Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(7);
+	g_ngi->_chapterManager->setActiveChapter(7);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+		g_ngi->_taskManager->activateTask("FULL_RELEASE_POOL_SC24");
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_7", true);
+	}
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_water = _scene->findAniObjectById(ANI_WATER24, 0);
+	_jet = _scene->findAniObjectById(ANI_JET24, 0);
+	_drop = _scene->findAniObjectById(ANI_DROP_24, 0);
+	const int poolState = g_ngi->getStateId(sO_Pool);
+	const int overflowed = g_ngi->getStateValue(sO_Pool, sO_Overflowed);
+	if (poolState == overflowed) {
+		_jet->_flags |= 4;
+		_jetFlows = true;
+		_waterLowers = false;
+	} else {
+		_jet->_flags &= ~4;
+		_jetFlows = false;
+		_water->setStatic(ST_WTR24_FLOWLOWER, false);
+		_waterLowers = true;
+	}
+	const int filledState = g_ngi->getStateId(sO_Pool);
+	const int filled = g_ngi->getStateValue(sO_Pool, sO_Full);
+	_poolFilled = filledState >= filled;
+	if (_poolFilled) {
+		_water->_flags |= 4;
+		g_ngi->setState(sO_LadderDown_24, g_ngi->getStateValue(sO_LadderDown_24, sO_IsClosed));
+		g_ngi->_exitManager->setFixedZ(PIC_SC24_LADDERD, true);
+	} else {
+		_water->_flags &= ~4;
+		g_ngi->setState(sO_LadderDown_24, g_ngi->getStateValue(sO_LadderDown_24, sO_IsOpened));
+		g_ngi->_exitManager->setFixedZ(PIC_SC24_LADDERD, false);
+	}
+	BehaviorController *behavior = _scene->_behaviorController.get();
+	if (isState(sO_Pool, sO_Overflowed)) {
+		behavior->enableAllQueuesForAni(_drop, 0);
+	} else if (isState(sO_Pool, sO_Full)) {
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOFLOOR)->setEnabled(false);
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOWATER)->setEnabled(true);
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOWATER2)->setEnabled(false);
+	} else if (isState(sO_Pool, sO_HalfFull)) {
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOFLOOR)->setEnabled(false);
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOWATER)->setEnabled(false);
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOWATER2)->setEnabled(true);
+	} else {
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOFLOOR)->setEnabled(true);
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOWATER)->setEnabled(false);
+		behavior->getAniQueue(_drop->_id, QU_DRP24_TOWATER2)->setEnabled(false);
+	}
+	if (_scene->_currentEntranceId == 0)
+		onMessage("MSG_SC24_START_SOUND", "", nullptr);
+}
+
+// CSc24Controller::GetCursorType (184D10)
+int Sc24Controller::getCursorType(float x, float y) {
+	return FPController::getCursorType(x, y);
+}
+
+// CSc24Controller::OnUpdate (184D18)
+void Sc24Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	if (_poolFilled && !_water->_movement) {
+		if (_waterLowers)
+			_water->startMovement(MV_WTR24_FLOWLOWER, 0, -1);
+		else
+			_water->startMovement(MV_WTR24_FLOW, 0, -1);
+	}
+	if (_jetFlows && !_jet->_movement)
+		_jet->startMovement(MV_JET24_FLOW, 0, -1);
+}
+
+// CSc24Controller::OnMessage (184DAC)
+void Sc24Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC24_START_SOUND") {
+		if (isState(sO_Pool, sO_Overflowed))
+			g_ngi->playSound(SND_24_007, 1);
+		else if (isState(sO_Pool, sO_Full))
+			g_ngi->playSound(SND_24_006, 1);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc24controller.h b/engines/ngi/fullpipe/sc24controller.h
new file mode 100644
index 00000000000..19215814672
--- /dev/null
+++ b/engines/ngi/fullpipe/sc24controller.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC24CONTROLLER_H
+#define NGI_FULLPIPE_SC24CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc24Controller (pool, water, jet, drop); sceneHandler24 runs the scene until wired */
+class Sc24Controller : public FPController {
+public:
+	explicit Sc24Controller(int sceneId);
+	~Sc24Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+private:
+	AniObject *_water = nullptr; // +216: ANI_WATER24
+	AniObject *_jet = nullptr; // +220: ANI_JET24
+	AniObject *_drop = nullptr; // +224: ANI_DROP_24
+	bool _poolFilled = true; // +228: the pool is full or more
+	bool _waterLowers = false; // +229: the water flows in the lower position
+	bool _jetFlows = true; // +230
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC24CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index f8794ac6203..5372c08a7b1 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -42,6 +42,7 @@
 #include "ngi/fullpipe/sc21controller.h"
 #include "ngi/fullpipe/sc36controller.h"
 #include "ngi/fullpipe/sc20controller.h"
+#include "ngi/fullpipe/sc24controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -95,15 +96,6 @@ void Sc23Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc24Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc24Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc25Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc25Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index a94cd5162ab..fe96f745bca 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -52,12 +52,6 @@ public:
 	void onShow() override;
 };
 
-class Sc24Controller : public FPController {
-public:
-	explicit Sc24Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc25Controller : public FPController {
 public:
 	explicit Sc25Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 3a6239f5457..87ab49d1fb7 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -121,6 +121,7 @@ MODULE_OBJS = \
 	fullpipe/sc17controller.o \
 	fullpipe/sc20controller.o \
 	fullpipe/sc21controller.o \
+	fullpipe/sc24controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \
 	fullpipe/sc36controller.o \


Commit: e561ef506cb23e56ebc52134969a0d23289a63ff
    https://github.com/scummvm/scummvm/commit/e561ef506cb23e56ebc52134969a0d23289a63ff
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc31Controller

Changed paths:
  A engines/ngi/fullpipe/sc31controller.cpp
  A engines/ngi/fullpipe/sc31controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index d171793143e..4c69ff41937 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1937,4 +1937,7 @@ namespace NGI {
 // Android: names of obj.h that the ported controllers use
 #define PIC_SC24_LADDERD 1826
 
+// Android: names of obj.h that the ported controllers use
+#define PIC_SC31_DTRUBA 2441
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/sc31controller.cpp b/engines/ngi/fullpipe/sc31controller.cpp
new file mode 100644
index 00000000000..8b76dfb7357
--- /dev/null
+++ b/engines/ngi/fullpipe/sc31controller.cpp
@@ -0,0 +1,147 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/input.h"
+#include "ngi/messages.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc31controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc31Controller::CSc31Controller (18FE8C)
+Sc31Controller::Sc31Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc31Controller::~CSc31Controller (18FE54)
+Sc31Controller::~Sc31Controller() {
+}
+
+// CSc31Controller::DoTestCactus (18FEBC)
+void Sc31Controller::doTestCactus(MessageQueue *queue) {
+	if ((_cactus->_flags & 4) && _cactus->_statics->_staticsId == ST_CTS31_GROWN2 && queue)
+		queue->stop(false);
+}
+
+// CSc31Controller::OnShow (18FEE4)
+void Sc31Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(8);
+	g_ngi->_chapterManager->setActiveChapter(9);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_9", true);
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_chantTimer = 0;
+	_cactus = _scene->findAniObjectById(ANI_CACTUS_31, 0);
+	if (!isState(sO_Cactus, sO_HasGrown)) {
+		_cactus->_flags &= ~4;
+		hero()->_flags &= ~4;
+	} else {
+		_cactus->moveToStaticChain(ST_CTS31_GROWN2);
+		_cactus->_z = 22;
+		_cactus->_flags |= 4;
+	}
+	_plusMinus = _scene->findAniObjectById(ANI_PLUSMINUS, 3);
+	_plusMinus->setStatic(isState(sO_Guard_3, sO_Off) ? ST_PMS_MINUS : ST_PMS_PLUS, false);
+	unlockCatalogItem("ANI_GUARD3");
+}
+
+// CSc31Controller::GetCursorType (1900F4)
+int Sc31Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (!g_ngi->_inputController->isObjectHit(PIC_SC31_DTRUBA))
+		return FPController::getCursorType(x, y);
+	if (!(_cactus->_flags & 4))
+		return FPController::getCursorType(x, y);
+	return 0;
+}
+
+// CSc31Controller::OnUpdate (190158)
+void Sc31Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	if (_chantTimer > 0) {
+		_chantTimer--;
+		if (_chantTimer == 0)
+			g_ngi->playSound(SND_31_001, 1);
+	}
+}
+
+// CSc31Controller::OnMouseLKeyUp (190190)
+bool Sc31Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (controllerRunsSceneLogic() && (_cactus->_flags & 4) && _cactus->_movement)
+		return false;
+	return FPController::onMouseLKeyUp(id, x, y);
+}
+
+// CSc31Controller::OnMouseLKeyDown (1901B0)
+bool Sc31Controller::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (controllerRunsSceneLogic() && (_cactus->_flags & 4) && _cactus->_movement)
+		return false;
+	return FPController::onMouseLKeyDown(id, x, y);
+}
+
+// CSc31Controller::OnMessage (1901D0)
+void Sc31Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC31_PULL") {
+		_plusMinus->setStatic(_plusMinus->_statics->_staticsId == ST_PMS_MINUS ? ST_PMS_PLUS : ST_PMS_MINUS, false);
+	} else if (message == "MSG_SC15_STOPCHANTING") {
+		g_ngi->stopAllSoundInstances(SND_31_001);
+		_chantTimer = 120;
+	} else if (message == "MSG_SC31_TESTCACTUS") {
+		doTestCactus(queue);
+	} else if (message == "MSG_SET_ACHIEVEMENT_ACTIVITY") {
+		AchievementsManager *achievements = g_ngi->_achievementsManager.get();
+		if (achievements->isActivatingItem("ACHIEVEMENT_GUARD_2", "guard31")) {
+			if (achievements->isActivatingItem("ACHIEVEMENT_GUARD_2", "guard32"))
+				achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard33");
+			else
+				achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard32");
+		} else {
+			achievements->addActivatingCounter("ACHIEVEMENT_GUARD_2", 12, "guard31");
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc31controller.h b/engines/ngi/fullpipe/sc31controller.h
new file mode 100644
index 00000000000..207ddcefcae
--- /dev/null
+++ b/engines/ngi/fullpipe/sc31controller.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC31CONTROLLER_H
+#define NGI_FULLPIPE_SC31CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc31Controller (cactus, pull switch); sceneHandler31 runs the scene until wired */
+class Sc31Controller : public FPController {
+public:
+	explicit Sc31Controller(int sceneId);
+	~Sc31Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void doTestCactus(MessageQueue *queue);
+
+private:
+	AniObject *_cactus = nullptr; // +216: ANI_CACTUS_31
+	AniObject *_plusMinus = nullptr; // +220: ANI_PLUSMINUS (copy 3)
+	int _chantTimer = 0; // +224: updates until the chanting starts again
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC31CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 5372c08a7b1..3abd78da282 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -43,6 +43,7 @@
 #include "ngi/fullpipe/sc36controller.h"
 #include "ngi/fullpipe/sc20controller.h"
 #include "ngi/fullpipe/sc24controller.h"
+#include "ngi/fullpipe/sc31controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -132,15 +133,6 @@ void Sc30Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc31Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc31Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc32Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc32Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index fe96f745bca..f8c21e298e1 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -76,12 +76,6 @@ public:
 	void onShow() override;
 };
 
-class Sc31Controller : public FPController {
-public:
-	explicit Sc31Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc32Controller : public FPController {
 public:
 	explicit Sc32Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 87ab49d1fb7..86ccf101e30 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -124,6 +124,7 @@ MODULE_OBJS = \
 	fullpipe/sc24controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \
+	fullpipe/sc31controller.o \
 	fullpipe/sc36controller.o \
 	fullpipe/sc38controller.o \
 	fullpipe/scene01.o \


Commit: 417223980a9ba3a5b50ad64217dbc3395bc68960
    https://github.com/scummvm/scummvm/commit/417223980a9ba3a5b50ad64217dbc3395bc68960
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc30Controller

Changed paths:
  A engines/ngi/fullpipe/sc30controller.cpp
  A engines/ngi/fullpipe/sc30controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 4c69ff41937..09504dbf155 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1940,4 +1940,7 @@ namespace NGI {
 // Android: names of obj.h that the ported controllers use
 #define PIC_SC31_DTRUBA 2441
 
+// Android: names of obj.h that the ported controllers use
+#define ST_LEG_DOWN3 2337
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 1b7f156079c..8c9592c6a31 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -173,6 +173,7 @@ namespace NGI {
 #define sO_Overflowed "\xcf\xe5\xf0\xe5\xef\xee\xeb\xed\xe5\xed"	// "Переполнен"
 #define sO_Fireman "\xcf\xee\xe6\xe0\xf0\xed\xe8\xea"	// "Пожарник"
 #define sO_ShowingHeel "\xcf\xee\xea\xe0\xe7\xfb\xe2\xe0\xe5\xf2 \xef\xff\xf2\xea\xf3"	// "Показывает пятку"
+#define sO_ShowsHeel "\xcf\xee\xea\xe0\xe7\xfb\xe2\xe0\xe5\xf2 \xef\xff\xf2\xea\xf3"	// "Показывает пятку"
 #define sO_FullPipe "\xcf\xee\xeb\xed\xe0\xff \xd2\xf0\xf3\xe1\xe0"	// "Полная Труба"
 #define sO_IsFull "\xcf\xee\xeb\xee\xed"	// "Полон"
 #define sO_RightStairs_9 "\xcf\xf0\xe0\xe2\xe0\xff \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe0_9"	// "Правая лестница_9"
diff --git a/engines/ngi/fullpipe/sc30controller.cpp b/engines/ngi/fullpipe/sc30controller.cpp
new file mode 100644
index 00000000000..31197c8ee99
--- /dev/null
+++ b/engines/ngi/fullpipe/sc30controller.cpp
@@ -0,0 +1,166 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/lift.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc30controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+namespace {
+
+// the hit region of the pipe picture that the leg uncovers (left 80, top 40, right 95, bottom -40)
+void moveArrowRegion(Scene *scene) {
+	PictureObject *pipe = scene->findPictureObjectById(PIC_SC30_LTRUBA, 0);
+	const Dims size = pipe->getFullSize();
+	pipe->_hitRegion = Common::Rect(80, 40, size.x + 95, size.y - 40);
+	g_ngi->_exitManager->setExitOffset(PIC_SC30_LTRUBA, 0, 0);
+}
+
+} // End of anonymous namespace
+
+// CSc30Controller::CSc30Controller (18F890)
+Sc30Controller::Sc30Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc30Controller::~CSc30Controller (18F858)
+Sc30Controller::~Sc30Controller() {
+}
+
+// CSc30Controller::DoUpdatePath (18F8C0): the way to the pipe is locked while the leg is down
+void Sc30Controller::doUpdatePath() {
+	MovGraphLink *link = _scene->_motionController->getGraphLink(sO_WayToPipe);
+	if (!link)
+		return;
+	const int staticsId = _leg->_statics->_staticsId;
+	if (staticsId == ST_LEG_DOWN || (staticsId & ~4) == ST_LEG_DOWN1 || staticsId == ST_LEG_DOWN3)
+		link->_flags |= 0x20000000;
+	else
+		link->_flags &= ~0x20000000;
+}
+
+// CSc30Controller::OnLeaveScene (18F938): empty in the original
+void Sc30Controller::onLeaveScene() {
+}
+
+// CSc30Controller::OnShow (18F93C)
+void Sc30Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_taskManager->activateTask("USE_POTS_SC30");
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_leg = _scene->findAniObjectById(ANI_LEG, 0);
+	if (isState(sO_Leg, sO_ShowsHeel)) {
+		_leg->setStatic(ST_LEG_UP, false);
+	} else if (isState(sO_Leg, sO_WithoutJugs)) {
+		_leg->setStatic(ST_LEG_DOWN, false);
+	} else if (isState(sO_Leg, sO_WithBig)) {
+		_leg->setStatic(ST_LEG_DOWN1, false);
+	} else if (isState(sO_Leg, sO_WithSmall)) {
+		_leg->setStatic(ST_LEG_DOWN2, false);
+	} else if (isState(sO_Leg, sO_WithAll)) {
+		_leg->setStatic(ST_LEG_EMPTY, false);
+		moveArrowRegion(_scene);
+	}
+	doUpdatePath();
+	_fromLift = _scene->_currentEntranceId != LiftUp && _scene->_currentEntranceId != LiftDown;
+	g_ngi->lift().enableButton(sO_Level8, projectId("ST_LBN_8N"));
+	g_ngi->lift().initLift(_scene, hero(), QU_SC30_ENTERLIFT, QU_SC30_EXITLIFT);
+}
+
+// CSc30Controller::GetCursorType (18FC50)
+int Sc30Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (g_ngi->lift().getCursorType(x, y))
+		return 116;
+	if (g_ngi->_inputController->isObjectHit(PIC_SC30_LTRUBA))
+		return 3;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc30Controller::OnUpdate (18FCC0)
+void Sc30Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+}
+
+// CSc30Controller::OnMouseLKeyDown (18FCC8)
+bool Sc30Controller::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyDown(id, x, y);
+	if (FPController::onMouseLKeyDown(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonDown(x, y);
+}
+
+// CSc30Controller::OnMouseLKeyUp (18FCE4)
+bool Sc30Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	if (FPController::onMouseLKeyUp(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonUp(x, y);
+}
+
+// CSc30Controller::OnMessage (18FD00)
+void Sc30Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC30_UPDATEPATH") {
+		doUpdatePath();
+	} else if (message == "MSG_SC30_LEAVESCENE") {
+		onLeaveScene();
+	} else if (message == "MSG_SC30_MOVELEG") {
+		AniObject *leg = _scene->findAniObjectById(ANI_LEG, 0);
+		leg->setPosition(Common::Point(183, 488));
+		leg->_z = 30;
+	} else if (message == "MSG_SC30_MOVELEG1") {
+		AniObject *leg = _scene->findAniObjectById(ANI_LEG, 0);
+		leg->setPosition(Common::Point(183, 486));
+		leg->_z = 30;
+	} else if (message == "MSG_SC30_MOVE_ARROW") {
+		moveArrowRegion(_scene);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc30controller.h b/engines/ngi/fullpipe/sc30controller.h
new file mode 100644
index 00000000000..940f9450829
--- /dev/null
+++ b/engines/ngi/fullpipe/sc30controller.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC30CONTROLLER_H
+#define NGI_FULLPIPE_SC30CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc30Controller (lift, leg, pots); sceneHandler30 runs the scene until wired */
+class Sc30Controller : public FPController {
+public:
+	explicit Sc30Controller(int sceneId);
+	~Sc30Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void doUpdatePath();
+	void onLeaveScene();
+
+private:
+	AniObject *_leg = nullptr; // +216: ANI_LEG
+	bool _fromLift = true; // +220: the hero did not come by the lift
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC30CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 3abd78da282..8aa9866a107 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -44,6 +44,7 @@
 #include "ngi/fullpipe/sc20controller.h"
 #include "ngi/fullpipe/sc24controller.h"
 #include "ngi/fullpipe/sc31controller.h"
+#include "ngi/fullpipe/sc30controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -124,15 +125,6 @@ void Sc28Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc30Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc30Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc32Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc32Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index f8c21e298e1..cf4c486c4d9 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -70,12 +70,6 @@ public:
 	void onShow() override;
 };
 
-class Sc30Controller : public FPController {
-public:
-	explicit Sc30Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc32Controller : public FPController {
 public:
 	explicit Sc32Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 86ccf101e30..5553e01a751 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -124,6 +124,7 @@ MODULE_OBJS = \
 	fullpipe/sc24controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \
+	fullpipe/sc30controller.o \
 	fullpipe/sc31controller.o \
 	fullpipe/sc36controller.o \
 	fullpipe/sc38controller.o \


Commit: e3f53f8920ae505a24f4e9bacdcbcb36676ecc4d
    https://github.com/scummvm/scummvm/commit/e3f53f8920ae505a24f4e9bacdcbcb36676ecc4d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc35Controller

Changed paths:
  A engines/ngi/fullpipe/sc35controller.cpp
  A engines/ngi/fullpipe/sc35controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 09504dbf155..65522e1a347 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1943,4 +1943,9 @@ namespace NGI {
 // Android: names of obj.h that the ported controllers use
 #define ST_LEG_DOWN3 2337
 
+// Android: names of obj.h that the ported controllers use
+#define ST_BTN_UP 600
+#define ANI_FIREFIGHTER 2229
+#define PIC_HELP_9_01 23231
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 8c9592c6a31..fa3c0c776f4 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -113,6 +113,7 @@ namespace NGI {
 #define sO_LiftButtons "\xca\xed\xee\xef\xea\xe8 \xeb\xe8\xf4\xf2\xe0"	// "Кнопки лифта"
 #define sO_Carpet_35 "\xca\xee\xe2\xf0\xe8\xea_35"	// "Коврик_35"
 #define sO_Valve_35 "\xca\xf0\xe0\xed_35"	// "Кран_35"
+#define sO_Tap_35 "\xca\xf0\xe0\xed_35"	// "Кран_35"
 #define sO_Cup "\xca\xf0\xf3\xe6\xea\xe0"	// "Кружка"
 #define sO_Mug "\xca\xf0\xf3\xe6\xea\xe0"	// "Кружка"
 #define sO_Cube "\xca\xf3\xe1\xe8\xea"	// "Кубик"
diff --git a/engines/ngi/fullpipe/sc35controller.cpp b/engines/ngi/fullpipe/sc35controller.cpp
new file mode 100644
index 00000000000..3d6b4c235ec
--- /dev/null
+++ b/engines/ngi/fullpipe/sc35controller.cpp
@@ -0,0 +1,303 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/input.h"
+#include "ngi/inventory.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/lift.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc35controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+namespace {
+
+// n * lrand48() / 0x7FFFFFFF as the original, for a value that was drawn earlier
+int scaleRandom(int n, uint32 value) {
+	const int32 product = (int32)((uint32)n * value);
+	return product / 0x7FFFFFFF;
+}
+
+} // End of anonymous namespace
+
+// CSc35Controller::CSc35Controller (193BAC)
+Sc35Controller::Sc35Controller(int sceneId) : FPController(sceneId), _flyPack(new FlyPack()) {
+}
+
+// CSc35Controller::~CSc35Controller (193B60): the fly pack goes with it
+Sc35Controller::~Sc35Controller() {
+}
+
+// CSc35Controller::OnShrink (193C0C)
+void Sc35Controller::onShrink() {
+	_scene->_motionController->lockLink(sO_CloseThing, false);
+}
+
+// CSc35Controller::TryFly (193C40)
+void Sc35Controller::tryFly() {
+	AniObject *fly = _scene->findAniObjectById(ANI_FLY, 0);
+	if (fly && (fly->_flags & 4))
+		return;
+	if (random31() % 30 != 0)
+		return;
+	int exitY;
+	int baseY;
+	if (random31() & 1) {
+		exitY = 600;
+		baseY = 0;
+	} else {
+		exitY = 0;
+		baseY = 600;
+	}
+	const int count = scaledRandom(3);
+	for (int i = 0; count >= i; i++) {
+		const uint32 randomX = random31();
+		const uint32 randomY = random31();
+		_flyPack->addFly(_scene, scaleRandom(55, randomX) + 1057, 40 * i + baseY + scaleRandom(60, randomY), 4, 1);
+		GutlFly &added = _flyPack->_flies.back();
+		added.targetX = 1084;
+		added.targetY = exitY;
+		added.maxSpeed = 0.4000002443790436; // the bits 0x3FD9999AA0000000 of the original
+	}
+	_flyTimer = 0;
+}
+
+// CSc35Controller::StartFlagLeft (193D40)
+void Sc35Controller::startFlagLeft() {
+	_flag->setStatic(ST_FLG_NORM, false);
+	_flag->startMovement(MV_FLG_STARTL, 0, -1);
+	_flagStarts = true;
+}
+
+// CSc35Controller::StartFlagRight (193D84)
+void Sc35Controller::startFlagRight() {
+	_flag->setStatic(ST_FLG_NORM, false);
+	_flag->startMovement(MV_FLG_STARTR, 0, -1);
+	_flagStarts = true;
+}
+
+// CSc35Controller::TestHose (193DC8): the hose feeds the bellows, else the flow starts
+void Sc35Controller::testHose() {
+	if (!isState(sO_Tap_35, sO_TurnedOn))
+		return;
+	if ((_hose->_flags & 4) && _hose->_statics->_staticsId == ST_HZE_NORM) {
+		_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+		_scene->_behaviorController->getAniQueue(_bellows->_id, QU_PDV_SML_BLINK)->setEnabled(false);
+		_scene->_behaviorController->getAniQueue(_bellows->_id, QU_PDV_SML_TRY)->setEnabled(false);
+		_bellows->setStatic(ST_PDV_SMALL, false);
+		_scene->runQueueObject(copyQueue(_scene, QU_SC35_EATHOZE), _bellows, 2);
+		_scene->_motionController->lockLink(sO_CloseThing, true);
+		g_ngi->playSound(SND_35_012, 1);
+	} else {
+		if (_flowTimer == 0)
+			_flowTimer = 98;
+		g_ngi->playSound(SND_35_011, 1);
+	}
+}
+
+// CSc35Controller::StopFlow (193F2C)
+void Sc35Controller::stopFlow() {
+	g_ngi->setState(sO_Tap_35, g_ngi->getStateValue(sO_Tap_35, sO_TurnedOff));
+	g_ngi->stopAllSoundInstances(SND_35_011);
+	g_ngi->playSound(SND_35_026, 0);
+}
+
+// CSc35Controller::OnShow (193FB0)
+void Sc35Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(11);
+	g_ngi->_chapterManager->setActiveChapter(11);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+		g_ngi->_taskManager->activateTask("GET_PIPE_SC35");
+		g_ngi->_taskManager->activateTask("GET_COIN_SC35");
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_11", true);
+	}
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	AniObject *hammer = _scene->findAniObjectById(ANI_HAMMER38, 0);
+	if (g_ngi->_inventory->getItemByName("ANI_INV_HAMMER")->_counter != 0)
+		hammer->_flags &= ~4;
+	else
+		hammer->_flags |= 4;
+	_flagStarts = false;
+	_flagStops = false;
+	_hose = _scene->findAniObjectById(ANI_HOSE, 0);
+	_bellows = _scene->findAniObjectById(ANI_PUZODUV, 0);
+	_flag = _scene->findAniObjectById(ANI_FLAG, 0);
+	_flowTimer = 0;
+	_flyTimer = 0;
+	MovGraphLink *link = _scene->_motionController->getGraphLink(sO_CloseThing);
+	if (_bellows->_statics->_staticsId == ST_PDV_LARGE)
+		link->_flags |= 0x20000000;
+	else
+		link->_flags &= ~0x20000000;
+	if (g_ngi->getStateValue(sO_Tap_35, sO_TurnedOn) != 0 && (_hose->_flags & 4) && _hose->_statics->_staticsId == ST_HZE_NORM) {
+		g_ngi->playSound(SND_35_012, 1);
+		testHose();
+	}
+	g_ngi->lift().enableButton(sO_Level6, projectId("ST_LBN_6N"));
+	g_ngi->lift().initLift(_scene, hero(), QU_SC35_ENTERLIFT, QU_SC35_EXITLIFT);
+	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_35"));
+}
+
+// CSc35Controller::OnHide (1942A4)
+void Sc35Controller::onHide() {
+	if (controllerRunsSceneLogic())
+		_flyPack->deleteAllFlies();
+	FPController::onHide();
+}
+
+// CSc35Controller::GetCursorType (1942BA)
+int Sc35Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (g_ngi->lift().getCursorType(x, y))
+		return 116;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc35Controller::OnUpdate (1942E8)
+void Sc35Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	if (!_flag->_movement) {
+		if (_flagStarts) {
+			const int staticsId = _flag->_statics->_staticsId;
+			if (staticsId == ST_FLG_RIGHT)
+				_flag->startMovement(MV_FLG_CYCLER, 0, -1);
+			else if (staticsId == ST_FLG_LEFT)
+				_flag->startMovement(MV_FLG_CYCLEL, 0, -1);
+		} else if (_flagStops) {
+			const int staticsId = _flag->_statics->_staticsId;
+			if (staticsId == ST_FLG_RIGHT)
+				_flag->startMovement(MV_FLG_STOPR, 0, -1);
+			else if (staticsId == ST_FLG_LEFT)
+				_flag->startMovement(MV_FLG_STOPL, 0, -1);
+			_flagStops = false;
+		}
+	}
+	if (_flowTimer > 0) {
+		_flowTimer--;
+		if (_flowTimer == 0)
+			stopFlow();
+	}
+	_flyTimer += elapsed;
+	if (_flyTimer > 13280)
+		tryFly();
+	if (isSoundPlayed(SND_CMN_060)) {
+		if (_flyPack->_flies.empty() || _flyPack->_flies.back().y <= 0 || _flyPack->_flies.back().y >= 600)
+			_flyPack->deleteAllFlies();
+	}
+	_flyPack->onUpdate(elapsed);
+}
+
+// CSc35Controller::OnMouseLKeyDown (194440)
+bool Sc35Controller::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyDown(id, x, y);
+	if (FPController::onMouseLKeyDown(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonDown(x, y);
+}
+
+// CSc35Controller::OnMouseLKeyUp (19445C)
+bool Sc35Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	if (FPController::onMouseLKeyUp(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonUp(x, y);
+}
+
+// CSc35Controller::OnMessage (194478)
+void Sc35Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC32_STARTFLAGLEFT") {
+		startFlagLeft();
+	} else if (message == "MSG_SC32_STARTFLAGRIGHT") {
+		startFlagRight();
+	} else if (message == "MSG_SC32_STOPFLAG") {
+		_flagStarts = false;
+		_flagStops = true;
+	} else if (message == "MSG_SC35_STARTFLOW" || message == "MSG_SC35_PLUGHOSE") {
+		testHose();
+	} else if (message == "MSG_SC35_SHRINK") {
+		onShrink();
+	} else if (message == "MSG_SC35_CHECKPIPESOUND") {
+		if (isState(sO_Tap_35, sO_TurnedOn)) {
+			g_ngi->stopAllSoundInstances(SND_35_011);
+			g_ngi->playSound(SND_35_012, 1);
+			_flowTimer = 0;
+		}
+	} else if (message == "MSG_SC35_STOPFLOW") {
+		stopFlow();
+	} else if (message == "MSG_SC35_MOVEFIREFIGHTER") {
+		AniObject *firefighter = _scene->findAniObjectById(ANI_FIREFIGHTER, 0);
+		firefighter->setPosition(Common::Point(998, 411));
+		firefighter->_z = 30;
+	} else if (message == "MSG_DISABLE_HELP_9_1") {
+		g_ngi->_help->disableHelpWithId(PIC_HELP_9_01);
+	} else if (message == "MSG_SC35_TASK_ACT_COIN") {
+		if (!isState(sO_Tap_35, sO_TurnedOn))
+			return;
+		if ((_hose->_flags & 4) && _hose->_statics->_staticsId == ST_HZE_NORM)
+			return;
+		g_ngi->_taskManager->activateTask("GET_COIN_SC35");
+	} else if (message == "MSG_BREAK_GRIT") {
+		if (interactionCommandNum("INT_376") != -1) {
+			AniObject *grit = _scene->findAniObjectById(ANI_GRIT2, 0);
+			if (grit->_movement)
+				grit->setCurFrame(9, true, false);
+			else
+				grit->startMovement(MV_GRIT2_FALL, 0, -1);
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc35Controller::UpdateScroll (1947C0)
+void Sc35Controller::updateScroll() {
+	FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc35controller.h b/engines/ngi/fullpipe/sc35controller.h
new file mode 100644
index 00000000000..c509f5b0efa
--- /dev/null
+++ b/engines/ngi/fullpipe/sc35controller.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC35CONTROLLER_H
+#define NGI_FULLPIPE_SC35CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/floaters.h"
+
+namespace NGI {
+
+/** CSc35Controller (lift, hose, flag, flies); sceneHandler35 runs the scene until wired */
+class Sc35Controller : public FPController {
+public:
+	explicit Sc35Controller(int sceneId);
+	~Sc35Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void onShrink();
+	void tryFly();
+	void startFlagLeft();
+	void startFlagRight();
+	void testHose();
+	void stopFlow();
+
+private:
+	AniObject *_hose = nullptr; // +216: ANI_HOSE
+	AniObject *_bellows = nullptr; // +220: ANI_PUZODUV
+	AniObject *_flag = nullptr; // +224: ANI_FLAG
+	int _flyTimer = 0; // +228: ms since the last flies
+	int _flowTimer = 0; // +232: updates until the tap is turned off
+	Common::ScopedPtr<FlyPack> _flyPack; // +236
+	bool _flagStarts = false; // +240: the flag waves
+	bool _flagStops = false; // +241: the flag has to stop
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC35CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 8aa9866a107..2961aac4b27 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -45,6 +45,7 @@
 #include "ngi/fullpipe/sc24controller.h"
 #include "ngi/fullpipe/sc31controller.h"
 #include "ngi/fullpipe/sc30controller.h"
+#include "ngi/fullpipe/sc35controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -152,15 +153,6 @@ void Sc34Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc35Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc35Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc37Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc37Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index cf4c486c4d9..1bd529c17a6 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -88,12 +88,6 @@ public:
 	void onShow() override;
 };
 
-class Sc35Controller : public FPController {
-public:
-	explicit Sc35Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc37Controller : public FPController {
 public:
 	explicit Sc37Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 5553e01a751..7a654f2069b 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -126,6 +126,7 @@ MODULE_OBJS = \
 	fullpipe/sc29controller.o \
 	fullpipe/sc30controller.o \
 	fullpipe/sc31controller.o \
+	fullpipe/sc35controller.o \
 	fullpipe/sc36controller.o \
 	fullpipe/sc38controller.o \
 	fullpipe/scene01.o \


Commit: 1a5909e2c8031595c2b7aa5eda6d89d9b10f8b36
    https://github.com/scummvm/scummvm/commit/1a5909e2c8031595c2b7aa5eda6d89d9b10f8b36
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc37Controller

Changed paths:
  A engines/ngi/fullpipe/sc37controller.cpp
  A engines/ngi/fullpipe/sc37controller.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/sc37controller.cpp b/engines/ngi/fullpipe/sc37controller.cpp
new file mode 100644
index 00000000000..56341abf2fc
--- /dev/null
+++ b/engines/ngi/fullpipe/sc37controller.cpp
@@ -0,0 +1,254 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/input.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/gameloader.h"
+#include "ngi/interaction.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc37controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+namespace {
+
+// the ring is closed (or closing)
+bool ringClosed(const AniObject *ring) {
+	if (ring->_movement)
+		return ring->getLastMovementId() == MV_RNG_CLOSE;
+	return ring->_statics->_staticsId == ST_RNG_CLOSED2;
+}
+
+} // End of anonymous namespace
+
+// CSc37Controller::CSc37Controller (1949B8)
+Sc37Controller::Sc37Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc37Controller::~CSc37Controller (19496C)
+Sc37Controller::~Sc37Controller() {
+}
+
+// CSc37Controller::CheckRings (1949F8)
+void Sc37Controller::checkRings() {
+	_ringsOpen = true;
+	for (uint i = 0; i < _guards.size(); i++) {
+		for (int j = 0; j < _guards[i].ringCount; j++) {
+			AniObject *ring = _scene->findAniObjectById(ANI_RING, _guards[i].rings[j]);
+			if (ringClosed(ring))
+				_ringsOpen = false;
+		}
+	}
+	if (_ringsOpen)
+		g_ngi->setState(sO_LeftPipe_37, g_ngi->getStateValue(sO_LeftPipe_37, sO_IsOpened));
+	else
+		g_ngi->setState(sO_LeftPipe_37, g_ngi->getStateValue(sO_LeftPipe_37, sO_IsClosed));
+}
+
+// CSc37Controller::ClickGuard (194B18): the guard pulls, its rings turn
+void Sc37Controller::clickGuard(int index) {
+	Sc37Guard &guard = _guards[index];
+	guard.ani->setStatic(ST_GRD37_STAND, false);
+	guard.ani->startMovement(MV_GRD37_PULL, 0, -1);
+	guard.toggle = !guard.toggle;
+	for (int i = 0; i < guard.ringCount; i++) {
+		AniObject *ring = _scene->findAniObjectById(ANI_RING, guard.rings[i]);
+		if (ringClosed(ring)) {
+			ring->moveToStaticChain(ST_RNG_CLOSED2);
+			ring->startMovement(MV_RNG_OPEN, 0, -1);
+		} else {
+			ring->moveToStaticChain(ST_RNG_OPEN);
+			ring->startMovement(MV_RNG_CLOSE, 0, -1);
+		}
+	}
+	checkRings();
+}
+
+// CSc37Controller::TestGuards (194C20): the guards react when the hero passes them
+void Sc37Controller::testGuards() {
+	if (_lastHeroX != -1) {
+		bool allLeft = true;
+		for (uint i = 0; i < _guards.size(); i++) {
+			const int low = _guards[i].low;
+			const int high = _guards[i].high;
+			if (_lastHeroX > low && _heroCenterX <= (float)low && !_guards[i].toggle)
+				clickGuard(i);
+			if (_lastHeroX < high && _heroCenterX >= (float)high && _guards[i].toggle)
+				clickGuard(i);
+			allLeft = allLeft && _heroCenterX <= (float)_guards[i].low;
+		}
+		if (allLeft && _ringsOpen)
+			g_ngi->_taskManager->deactivateTask("USE_GUARDS_SC37");
+	}
+	_lastHeroX = (int)_heroCenterX;
+}
+
+// CSc37Controller::OnShow (194DEC)
+void Sc37Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	for (int i = 0; i <= 12; i++) {
+		_scene->findAniObjectById(ANI_RING, i)->setStatic(ST_RNG_OPEN, false);
+		_scene->findAniObjectById(ANI_RING, i)->setCenter(Common::Point(299 - 20 * i, 444));
+	}
+	_guards.clear();
+	_lastHeroX = -1;
+
+	static const int kRings[3][3] = { { 1, 4, 8 }, { 2, 5, 9 }, { 3, 7, 11 } };
+	for (int g = 0; g < 3; g++) {
+		Sc37Guard guard;
+		guard.ani = _scene->findAniObjectById(ANI_GUARD_37, g);
+		const int x = guard.ani->getPosition().x;
+		guard.low = x - 40;
+		guard.high = x + 40;
+		guard.ringCount = 3;
+		for (int i = 0; i < 3; i++)
+			guard.rings[i] = kRings[g][i];
+		guard.toggle = false;
+		_guards.push_back(guard);
+	}
+	g_ngi->setState(sO_LeftPipe_37, g_ngi->getStateValue(sO_LeftPipe_37, sO_IsClosed));
+	_ringsOpen = false;
+
+	_plusMinus1 = _scene->findAniObjectById(ANI_PLUSMINUS, 4);
+	for (int i = 0; i < _guards[0].ringCount; i++) {
+		AniObject *ring = _scene->findAniObjectById(ANI_RING, _guards[0].rings[i]);
+		const bool on = isState(sO_Guard_1, sO_On);
+		_plusMinus1->setStatic(on ? ST_PMS_PLUS : ST_PMS_MINUS, false);
+		const int staticsId = on ? ST_RNG_OPEN : ST_RNG_CLOSED2;
+		if (ring->_statics->_staticsId != staticsId)
+			ring->moveToStaticChain(staticsId);
+	}
+	_plusMinus2 = _scene->findAniObjectById(ANI_PLUSMINUS, 5);
+	for (int i = 0; i < _guards[1].ringCount; i++) {
+		AniObject *ring = _scene->findAniObjectById(ANI_RING, _guards[1].rings[i]);
+		const bool on = isState(sO_Guard_2, sO_On);
+		_plusMinus2->setStatic(on ? ST_PMS_PLUS : ST_PMS_MINUS, false);
+		const int staticsId = on ? ST_RNG_OPEN : ST_RNG_CLOSED2;
+		if (ring->_statics->_staticsId != staticsId)
+			ring->moveToStaticChain(staticsId);
+	}
+	_plusMinus3 = _scene->findAniObjectById(ANI_PLUSMINUS, 6);
+	for (int i = 0; i < _guards[2].ringCount; i++) {
+		AniObject *ring = _scene->findAniObjectById(ANI_RING, _guards[2].rings[i]);
+		const bool on = isState(sO_Guard_3, sO_On);
+		_plusMinus3->setStatic(on ? ST_PMS_PLUS : ST_PMS_MINUS, false);
+		const int staticsId = on ? ST_RNG_OPEN : ST_RNG_CLOSED2;
+		if (ring->_statics->_staticsId != staticsId)
+			ring->moveToStaticChain(staticsId);
+	}
+	unlockCatalogItem("ANI_GUARD_37");
+}
+
+// CSc37Controller::GetCursorType (195428)
+int Sc37Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	if (g_ngi->_inputController->isObjectHit(PIC_SC37_MASK) && _ringsOpen)
+		return 3;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc37Controller::OnUpdate (195488)
+void Sc37Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	testGuards();
+	_soundPending++;
+}
+
+// CSc37Controller::OnMessage (1954A0)
+void Sc37Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC37_PULL") {
+		static const char *const kStates[3] = { sO_Guard_1, sO_Guard_2, sO_Guard_3 };
+		AniObject *const plusMinus[3] = { _plusMinus1, _plusMinus2, _plusMinus3 };
+		for (int g = 0; g < 3; g++) {
+			const AniObject *guardAni = _guards[g].ani;
+			if (!guardAni->_movement || guardAni->getLastMovementId() != MV_GRD37_PULL)
+				continue;
+			bool set = false;
+			if (isState(kStates[g], sO_On) && !_guards[g].toggle)
+				set = true;
+			else if (isState(kStates[g], sO_Off))
+				set = _guards[g].toggle;
+			plusMinus[g]->setStatic(set ? ST_PMS_PLUS : ST_PMS_MINUS, false);
+			break;
+		}
+		if (_soundPending != 0) {
+			g_ngi->playSound(SND_37_007, 0);
+			_soundPending = 0;
+		}
+	} else if (message == "MSG_SC37_EXITLEFT") {
+		clickGuard(0);
+		clickGuard(1);
+		clickGuard(2);
+	} else if (message == "MSG_SC34_EXIT") {
+		if (isState(sO_LeftPipe_37, sO_IsClosed)) {
+			if (hero()->getMessageQueue())
+				hero()->getMessageQueue()->stop(false);
+		} else {
+			_scene->_motionController->deactivate();
+			getGameLoaderInteractionController()->disable();
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc37Controller::UpdateScroll (1958E0): left of x 500 the camera is turned round and limited
+void Sc37Controller::updateScroll() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::updateScroll();
+		return;
+	}
+	if (!_follow)
+		return;
+	const Common::Point center = _follow->getCenter();
+	_heroCenterY = center.y;
+	_heroCenterX = center.x;
+	if (_heroCenterX < 500.0f) {
+		_scene->_x = -_scene->_x;
+		limitScroll();
+	} else {
+		FPController::updateScroll();
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc37controller.h b/engines/ngi/fullpipe/sc37controller.h
new file mode 100644
index 00000000000..73f864f635b
--- /dev/null
+++ b/engines/ngi/fullpipe/sc37controller.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC37CONTROLLER_H
+#define NGI_FULLPIPE_SC37CONTROLLER_H
+
+#include "common/array.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** _SC37_GUARD (60 bytes): a guard, where the hero passes it, the rings that it turns */
+struct Sc37Guard {
+	AniObject *ani = nullptr; // +0
+	int low = 0; // +4: the hero passes it going right
+	int high = 0; // +8: and going left
+	int ringCount = 0; // +12
+	int rings[10] = {}; // +16: the copies of ANI_RING
+	bool toggle = false; // +56
+};
+
+/** CSc37Controller (guards and rings); sceneHandler37 runs the scene until wired */
+class Sc37Controller : public FPController {
+public:
+	explicit Sc37Controller(int sceneId);
+	~Sc37Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void checkRings();
+	void clickGuard(int index);
+	void testGuards();
+
+private:
+	AniObject *_plusMinus1 = nullptr; // +216: ANI_PLUSMINUS (copy 4)
+	AniObject *_plusMinus2 = nullptr; // +220: ANI_PLUSMINUS (copy 5)
+	AniObject *_plusMinus3 = nullptr; // +224: ANI_PLUSMINUS (copy 6)
+	bool _ringsOpen = false; // +228: all the rings are open
+	Common::Array<Sc37Guard> _guards; // +232
+	int _lastHeroX = -1; // +244
+	int _soundPending = 0; // +248: the sound of the rings after the pull
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC37CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 2961aac4b27..bc2cdd678f0 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -46,6 +46,7 @@
 #include "ngi/fullpipe/sc31controller.h"
 #include "ngi/fullpipe/sc30controller.h"
 #include "ngi/fullpipe/sc35controller.h"
+#include "ngi/fullpipe/sc37controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -153,15 +154,6 @@ void Sc34Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc37Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc37Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSplashScreenController::CreateControllers: the class of the scene number, else CFPController
 void createSceneController(int sceneId) {
 	switch (sceneId) {
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 1bd529c17a6..e85cab6e11f 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -88,12 +88,6 @@ public:
 	void onShow() override;
 };
 
-class Sc37Controller : public FPController {
-public:
-	explicit Sc37Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 } // End of namespace NGI
 
 #endif // NGI_FULLPIPE_SCENECONTROLLERS_H
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 7a654f2069b..8ca8c5440db 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -128,6 +128,7 @@ MODULE_OBJS = \
 	fullpipe/sc31controller.o \
 	fullpipe/sc35controller.o \
 	fullpipe/sc36controller.o \
+	fullpipe/sc37controller.o \
 	fullpipe/sc38controller.o \
 	fullpipe/scene01.o \
 	fullpipe/scene02.o \


Commit: 8d199cdeaeb97053f361357d0926994286addb15
    https://github.com/scummvm/scummvm/commit/8d199cdeaeb97053f361357d0926994286addb15
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Sc08 MoveToStatic and Sc09 PLVCLICK command as the original

Changed paths:
    engines/ngi/fullpipe/sc08controller.cpp
    engines/ngi/fullpipe/sc09controller.cpp


diff --git a/engines/ngi/fullpipe/sc08controller.cpp b/engines/ngi/fullpipe/sc08controller.cpp
index 468763bf4ea..17225a3a9be 100644
--- a/engines/ngi/fullpipe/sc08controller.cpp
+++ b/engines/ngi/fullpipe/sc08controller.cpp
@@ -157,7 +157,7 @@ void Sc08Controller::doManDryg() {
 void Sc08Controller::switchToArcadeNow() {
 	MovGraphLink *link = _scene->_motionController ? _scene->_motionController->getGraphLink(sO_Stairway) : nullptr;
 	g_ngi->setState(sO_TummyTrampie, g_ngi->getStateValue(sO_TummyTrampie, sO_IsSleeping));
-	_batuta->moveToStatic(ST_BTT_SLEEPS);
+	_batuta->moveToStaticChain(ST_BTT_SLEEPS);
 	if (link)
 		link->_flags |= 0x20000000;
 }
@@ -500,17 +500,17 @@ void Sc08Controller::onShow() {
 	MovGraphLink *lock = _scene->_motionController ? _scene->_motionController->getGraphLink(sO_CloseThing) : nullptr;
 	if (lock)
 		lock->_flags &= ~0x20000000;
-	_batuta->moveToStatic(ST_BTT_SLEEPS);
+	_batuta->moveToStaticChain(ST_BTT_SLEEPS);
 	if (tummyState == g_ngi->getStateValue(sO_TummyTrampie, sO_IsEating)) {
-		_batuta->moveToStatic(ST_BTT_SPOON);
+		_batuta->moveToStaticChain(ST_BTT_SPOON);
 		_clock->stopMovement();
 		_clock->setStatic(ST_CLK8_NORM);
 	} else if (tummyState == g_ngi->getStateValue(sO_TummyTrampie, sO_IsDrinking)) {
-		_batuta->moveToStatic(ST_BTT_NOSPOON);
+		_batuta->moveToStaticChain(ST_BTT_NOSPOON);
 		_clock->startMovement(MV_CLK8_GO, 0, -1);
 		_clock->setCurFrame(3);
 	} else if (tummyState == g_ngi->getStateValue(sO_TummyTrampie, sO_IsScratchingBelly)) {
-		_batuta->moveToStatic(ST_BTT_CHESHET);
+		_batuta->moveToStaticChain(ST_BTT_CHESHET);
 		_clock->startMovement(MV_CLK8_GO, 0, -1);
 		_clock->setCurFrame(8);
 	} else if (tummyState == g_ngi->getStateValue(sO_TummyTrampie, sO_IsSleeping)) {
diff --git a/engines/ngi/fullpipe/sc09controller.cpp b/engines/ngi/fullpipe/sc09controller.cpp
index 1eb23e67dca..2ad1b7a4ff2 100644
--- a/engines/ngi/fullpipe/sc09controller.cpp
+++ b/engines/ngi/fullpipe/sc09controller.cpp
@@ -547,7 +547,7 @@ void Sc09Controller::doStartShoot() {
 	if (fabsf(targetX - (float)hero()->getCenter().x) > 3.0f || fabsf(targetY - (float)hero()->getCenter().y) > 3.0f) {
 		MessageQueue *queue = mctlStartMove((int)targetX, (int)targetY, true, ST_MAN_UP, false);
 		if (queue)
-			queue->addCommandToEnd(messageCommand("MSG_SC9_PLVCLICK", 1, 3));
+			queue->addCommandToEnd(messageCommand("MSG_SC9_PLVCLICK"));
 	} else {
 		if (!hero()->_movement) {
 			_spitter->setStatic(ST_PLV_SIT);


Commit: 649d313484eae0e2df8c4d098e5e31820b4dc99b
    https://github.com/scummvm/scummvm/commit/649d313484eae0e2df8c4d098e5e31820b4dc99b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Per-queue timer in BehaviorMove, BehaviorAni Update/CanMove/TryStartMove as the original

Changed paths:
    engines/ngi/behavior.cpp
    engines/ngi/behavior.h
    engines/ngi/fullpipe/sc07controller.cpp
    engines/ngi/fullpipe/sc09controller.cpp
    engines/ngi/scene.cpp
    engines/ngi/scene.h


diff --git a/engines/ngi/behavior.cpp b/engines/ngi/behavior.cpp
index 0f998fbed54..24d0756cfea 100644
--- a/engines/ngi/behavior.cpp
+++ b/engines/ngi/behavior.cpp
@@ -90,7 +90,7 @@ void BehaviorController::attachAnimations(Scene &scene) {
 		if (behavior._ani != ani) {
 			behavior._ani = ani;
 			behavior._activeMove = nullptr;
-			behavior._elapsed = 0;
+			behavior.resetTimer();
 		}
 	}
 }
@@ -133,51 +133,90 @@ void BehaviorAni::stop(Scene *scene, bool stopQueues) {
 		return;
 	}
 	_activeMove = nullptr;
-	_elapsed = 0; // CBehaviorAni::ResetTimerForItem
+	resetTimer();
 }
 
-// CBehaviorAni::Update: the move queue runs in the behavior's scene (not the current one)
-bool BehaviorAni::update(uint32 elapsed, Scene *scene) {
+// CBehaviorAni::Update (F3110)
+bool BehaviorAni::update(uint32 elapsed, Scene *scene, bool behavered) {
 	if (!_ani)
 		return false;
-	if (_activeMove) {
+	if (canMove(scene, behavered)) {
+		for (BehaviorAnim &anim : _behaviorAnims) {
+			for (BehaviorMove &move : anim._behaviorMoves) {
+				move._timer += elapsed;
+				if (tryStartMove(anim._staticsId, move, scene)) {
+					resetTimer();
+					_activeMove = &move;
+					return true;
+				}
+			}
+		}
+	} else if (_activeMove) {
 		if (_activeMove->_movementId) {
-			if (_ani->_movement && _ani->_movement->_id == _activeMove->_movementId)
-				return false;
-		} else {
-			// the queue of the move is a queue of the scene: the move is over when it is stopped
+			if (!_ani->_movement || _ani->_movement->_id != _activeMove->_movementId)
+				_activeMove = nullptr;
+		} else if (_activeMove->_queueId) {
 			const MessageQueue *queue = scene->findMessageQueue(_activeMove->_queueId);
-			if (queue && queue->_state != 0)
-				return false;
+			if (queue && queue->_state == 0)
+				_activeMove = nullptr;
 		}
-		_activeMove = nullptr;
+	}
+	return false;
+}
+
+// CBehaviorAni::CanMove (F2FC4)
+bool BehaviorAni::canMove(Scene *scene, bool behavered) const {
+	if (_ani->_queue)
 		return false;
+	bool result = !_ani->_movement && (_ani->_flags & 4);
+	if (_flags & 1)
+		result &= !scene->isQueuesProcessed(true);
+	if (_flags & 2) {
+		static bool warned = false;
+		if (!warned)
+			warning("STUB/untested: CScene::IsTalked (CDialogController is not ported), the dialogs do not block the behavior");
+		warned = true;
 	}
-	// CBehaviorAni::CanMove (F2FC4): standing, visible, no queue; the behavior flags add conditions
-	if (_ani->_movement || !_ani->_statics || !(_ani->_flags & 4) || _ani->_queue)
+	if (_flags & 4)
+		result &= !behavered;
+	if (_flags & 8)
+		result &= !scene->isAnyoneMoves();
+	return _activeMove ? false : result;
+}
+
+// CBehaviorAni::TryStartMove (F306E)
+bool BehaviorAni::tryStartMove(int staticsId, const BehaviorMove &move, Scene *scene) {
+	if (!move.isEnabled() || move._timer < (uint32)move._delay)
 		return false;
-	if ((_flags & 1) && scene->isQueuesProcessed(true))
+	const int curStatics = _ani->_statics ? _ani->_statics->_staticsId : 0;
+	if (curStatics != staticsId || move._mirror != ((_ani->_flags & 8) != 0))
 		return false;
-
-	_elapsed += elapsed;
-	for (const BehaviorAnim &anim : _behaviorAnims) {
-		if (anim._staticsId != _ani->_statics->_staticsId)
-			continue;
-		for (const BehaviorMove &move : anim._behaviorMoves) {
-			if (move._mirror != ((_ani->_flags & 8) != 0) || !move.canStart(_elapsed, 99))
-				continue;
-			const bool started = move._movementId ? _ani->startMovement(move._movementId, 0, -1) :
-					runQueueByIdWithAni(_ani, move._queueId, kBehaviorQueue, scene);
-			if (started) {
-				_elapsed = 0;
-				_activeMove = &move;
-				return true;
-			}
-		}
+	if (!move._percent || g_ngi->_rnd.getRandomNumber(99) > move._percent)
+		return false;
+	if (move._movementId) {
+		_ani->startMovement(move._movementId, 0, -1);
+		return true;
+	}
+	if (move._queueId) {
+		runQueueByIdWithAni(_ani, move._queueId, kBehaviorQueue, scene);
+		return true;
 	}
 	return false;
 }
 
+// CBehaviorAni::IsBehavered (F2F88)
+bool BehaviorAni::isBehavered() const {
+	return (_flags & 4) && _activeMove;
+}
+
+// CBehaviorAni::ResetTimer (F2DE0)
+void BehaviorAni::resetTimer() {
+	for (BehaviorAnim &anim : _behaviorAnims) {
+		for (BehaviorMove &move : anim._behaviorMoves)
+			move._timer = 0;
+	}
+}
+
 bool BehaviorSound::update(uint32 elapsed) {
 	Sound *sound = g_ngi->findSound(_soundId);
 	if (!sound)
@@ -262,6 +301,39 @@ void BehaviorController::onStartQueue() {
 	}
 }
 
+// CBehaviorController::OnStartTalk (F3542), CBehaviorAni::OnStartTalk (F304A): flag 2 stops
+void BehaviorController::onStartTalk() {
+	for (BehaviorAni &beh : _behaviors) {
+		if (beh._flags & 2)
+			beh.stop(_scene, true);
+	}
+}
+
+// CBehaviorController::IsBehaveredAni (F34E8)
+bool BehaviorController::isBehaveredAni() const {
+	for (const BehaviorAni &beh : _behaviors) {
+		if (beh.isBehavered())
+			return true;
+	}
+	return false;
+}
+
+// CBehaviorController::ResetTimer (F3586)
+void BehaviorController::resetTimer(int id) {
+	for (BehaviorAni &beh : _behaviors) {
+		if (beh._ani && beh._ani->_id == id)
+			beh.resetTimer();
+	}
+	for (BehaviorSound &sound : _sounds) {
+		if (sound._soundId == id)
+			sound._elapsed = 0;
+	}
+	for (BehaviorSound &track : _music) {
+		if (track._soundId == id)
+			track._elapsed = 0;
+	}
+}
+
 bool BehaviorController::update(uint32 elapsed) {
 	if (!_isActive)
 		return false;
@@ -271,7 +343,7 @@ bool BehaviorController::update(uint32 elapsed) {
 	debugC(6, kDebugBehavior, "BehaviorController::update()");
 	for (BehaviorAni &beh : _behaviors) {
 		if (timedBehaviors) {
-			changed |= beh.update(elapsed, _scene);
+			changed |= beh.update(elapsed, _scene, isBehaveredAni());
 			continue;
 		}
 
@@ -456,7 +528,6 @@ void BehaviorAni::clear() {
 	_flags = 0;
 	_subIndex = 0;
 	_animsCount = 0;
-	_elapsed = 0;
 	_activeMove = nullptr;
 	_behaviorAnims.clear();
 }
diff --git a/engines/ngi/behavior.h b/engines/ngi/behavior.h
index 79d122fa29a..c9b22648d1c 100644
--- a/engines/ngi/behavior.h
+++ b/engines/ngi/behavior.h
@@ -39,6 +39,8 @@ struct BehaviorMove {
 	int16 _movementId = 0;
 	int16 _queueId = 0;
 	bool _mirror = false;
+	/** +12 of CBehaviorQueue: time since the move was last tried or started */
+	uint32 _timer = 0;
 
 	bool canStart(uint32 elapsed, uint32 randomMax) const;
 	/** +24 of CBehaviorQueue (EnableMove): bit 1 of _flags, set when the queue is disabled */
@@ -68,14 +70,21 @@ struct BehaviorAni {
 	Common::Array<BehaviorAnim> _behaviorAnims;
 	int16 _objectId = 0;
 	int16 _sourceSceneId = 0;
-	uint32 _elapsed = 0;
-	const BehaviorMove *_activeMove = nullptr;
+	BehaviorMove *_activeMove = nullptr;
 
 	BehaviorAni() { clear(); }
 
 	void clear();
 	BehaviorMove &addMove(int16 staticsId);
-	bool update(uint32 elapsed, Scene *scene);
+	bool update(uint32 elapsed, Scene *scene, bool behavered);
+	/** CBehaviorAni::CanMove (F2FC4) */
+	bool canMove(Scene *scene, bool behavered) const;
+	/** CBehaviorAni::TryStartMove (F306E) */
+	bool tryStartMove(int staticsId, const BehaviorMove &move, Scene *scene);
+	/** CBehaviorAni::IsBehavered (F2F88) */
+	bool isBehavered() const;
+	/** CBehaviorAni::ResetTimer (F2DE0), also ResetTimerForItem (F2E40) */
+	void resetTimer();
 	/** CBehaviorAni::Stop(scene, flag) (F2F08) */
 	void stop(Scene *scene, bool stopQueues);
 	void initAmbientBehavior(GameVar *var, Scene *sc);
@@ -121,6 +130,12 @@ class BehaviorController : public CObject {
 	/** CBehaviorController::OnSetQueue (F3774) and OnStartQueue (F3564) */
 	void onSetQueue(int aniId);
 	void onStartQueue();
+	/** CBehaviorController::OnStartTalk (F3542) */
+	void onStartTalk();
+	/** CBehaviorController::IsBehaveredAni (F34E8) */
+	bool isBehaveredAni() const;
+	/** CBehaviorController::ResetTimer (F3586) */
+	void resetTimer(int id);
 	void updateBehavior(BehaviorAni &behaviorInfo, BehaviorAnim &entry);
 	void updateStaticAniBehavior(AniObject &ani, int delay, const BehaviorAnim &beh);
 
diff --git a/engines/ngi/fullpipe/sc07controller.cpp b/engines/ngi/fullpipe/sc07controller.cpp
index 9565961f740..ca5bb80b82a 100644
--- a/engines/ngi/fullpipe/sc07controller.cpp
+++ b/engines/ngi/fullpipe/sc07controller.cpp
@@ -71,7 +71,7 @@ void Sc07Controller::doOpenLuke() {
 	if (!_hatchQueue)
 		_hatchQueue = _scene->_behaviorController->getAniQueue(ANI_CORNERSITTER, QU_CST_CLOSELUKE);
 	_hatchQueue->_percent = _hatchPercent;
-	warnOnce("CSc07Controller::DoOpenLuke: the timer of the behavior queue (+12) is kept per animation here");
+	_hatchQueue->_timer = 0;
 }
 
 // CSc07Controller::DoCloseLuke (16E3FC)
@@ -80,7 +80,7 @@ void Sc07Controller::doCloseLuke() {
 		_hatchQueue = _scene->_behaviorController->getAniQueue(ANI_CORNERSITTER, QU_CST_CLOSELUKE);
 	_hatchPercent = _hatchQueue->_percent;
 	_hatchQueue->_percent = 0;
-	warnOnce("CSc07Controller::DoCloseLuke: the timer of the behavior queue (+12) of QU_CST_CLOSELUKE and QU_HGN_OPENLUKE is kept per animation here");
+	_scene->_behaviorController->getAniQueue(ANI_HOOLIGAN, QU_HGN_OPENLUKE)->_timer = 0;
 	_hooligan->moveToStaticChain(ST_HGN_LUKE);
 	_hooligan->_flags |= 4;
 }
diff --git a/engines/ngi/fullpipe/sc09controller.cpp b/engines/ngi/fullpipe/sc09controller.cpp
index 2ad1b7a4ff2..29c724dd9e7 100644
--- a/engines/ngi/fullpipe/sc09controller.cpp
+++ b/engines/ngi/fullpipe/sc09controller.cpp
@@ -941,7 +941,7 @@ void Sc09Controller::onMessage(const Common::String &message, const Common::Stri
 		if (boot)
 			boot->_flags &= ~4;
 	} else if (message == "MSG_SC9_RESETBHVR") {
-		warnOnce("CBehaviorController::ResetTimer is not ported (CSc09Controller::OnMessage MSG_SC9_RESETBHVR)");
+		_scene->_behaviorController->resetTimer(ANI_MAN);
 	} else if (message == "MSG_BREAK_GRIT") {
 		if (interactionCommandNum("INT_238") != -1) {
 			AniObject *grit = _scene->findAniObjectById(ANI_GRIT_9, 0);
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 267fa1d5f32..18232bca4b7 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -1597,6 +1597,15 @@ bool Scene::isCursorObjectRender(float x, float y) {
 	return true;
 }
 
+// CScene::IsAnyoneMoves (11FD24)
+bool Scene::isAnyoneMoves() const {
+	for (const AniObject *ani : _aniObjects) {
+		if (ani->_movement)
+			return true;
+	}
+	return false;
+}
+
 // CScene::IsQueuesProcessed (11FB98): a queue that is not stopped (interaction queues first)
 bool Scene::isQueuesProcessed(bool ignoreInterruptState3) const {
 	if (g_ngi->_gameVersion >= 201509) {
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index 834710c07c5..2b3661fadbf 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -217,6 +217,8 @@ class Scene : public Background {
 	void stopAllQueues();
 	/** CScene::IsQueuesProcessed (11FB98): copies of the template queues run in the global list */
 	bool isQueuesProcessed(bool ignoreInterruptState3) const;
+	/** CScene::IsAnyoneMoves (11FD24) */
+	bool isAnyoneMoves() const;
 	MessageQueue *getMessageQueueByName(const Common::String &name);
 
 	void removeAni(AniObject *obj);


Commit: 6a064501d3887a3f9c6fc2195edbaf30801a15fb
    https://github.com/scummvm/scummvm/commit/6a064501d3887a3f9c6fc2195edbaf30801a15fb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port HitregionObject and give animations a hit region

Changed paths:
    engines/ngi/fullpipe/sc13controller.cpp
    engines/ngi/gfx.cpp
    engines/ngi/gfx.h
    engines/ngi/sceneobjects.cpp
    engines/ngi/sceneobjects.h
    engines/ngi/statics.cpp
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/fullpipe/sc13controller.cpp b/engines/ngi/fullpipe/sc13controller.cpp
index 77537b842c0..ea78f0af52b 100644
--- a/engines/ngi/fullpipe/sc13controller.cpp
+++ b/engines/ngi/fullpipe/sc13controller.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ngi/ngi.h"
+#include "ngi/sceneobjects.h"
 #include "ngi/behavior.h"
 #include "ngi/input.h"
 #include "ngi/interaction.h"
@@ -221,8 +222,9 @@ void Sc13Controller::onShow() {
 
 	g_ngi->_help->setChapter(4);
 	g_ngi->_chapterManager->setActiveChapter(4);
-	// the hit region of ANI_HANDLE_L (its top is set to -27) is not supported for animations
-	warnOnce("CSc13Controller::OnShow: the hit region (top -27) of ANI_HANDLE_L is not ported");
+	AniObject *handleL = _scene->findAniObjectById(ANI_HANDLE_L, 0);
+	if (handleL && handleL->_hitregion)
+		handleL->_hitregion->_top = -27;
 	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
 		g_ngi->_taskManager->activateTask("OPEN_BRIDGE_SC13");
 		g_ngi->_chapterManager->showChapterDialog("CHAPTER_4", true);
diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index 4cbf3e9906d..bfacff31327 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -26,6 +26,7 @@
 #include "ngi/modal.h"
 #include "ngi/statics.h"
 #include "ngi/scene.h"
+#include "ngi/sceneobjects.h"
 #include "ngi/interaction.h"
 #include "ngi/gameloader.h"
 
@@ -285,6 +286,14 @@ GameObject::GameObject(GameObject *src) {
 	_windowBottom = src->_windowBottom;
 	_hitAlpha = src->_hitAlpha;
 	_filter = src->_filter;
+	if (src->_hitregion) {
+		_hitregion = new HitregionObject(src->_hitregion);
+		_hitregion->_owner = this;
+	}
+}
+
+GameObject::~GameObject() {
+	delete _hitregion;
 }
 
 // Top left and size of the texture of a picture or the current animation phase, as in
diff --git a/engines/ngi/gfx.h b/engines/ngi/gfx.h
index d4a7be9d6e6..86ff094c999 100644
--- a/engines/ngi/gfx.h
+++ b/engines/ngi/gfx.h
@@ -176,6 +176,8 @@ class BigPicture : public Texture {
 	void render(int x, int y, int style, int angle) override;
 };
 
+class HitregionObject;
+
 class GameObject : public CObject {
   public:
 	int16 _copyId;
@@ -198,10 +200,12 @@ class GameObject : public CObject {
 	float _windowBottom = 1.0f;
 	int _hitAlpha = 128; // XML hitAlpha: the alpha above which a pixel counts as hit
 	int _filter = 0; // XML filter (0 nearest, 2 linear), no meaning for the software renderer
+	HitregionObject *_hitregion = nullptr; // +108 of CVisibleObject, the XML HITREGION child
 
   public:
 	GameObject();
 	GameObject(GameObject *src);
+	~GameObject() override;
 
 	virtual Common::String toXML();
 	bool load(MfcArchive &file) override;
diff --git a/engines/ngi/sceneobjects.cpp b/engines/ngi/sceneobjects.cpp
index 821a98fe8f3..a8df2419ead 100644
--- a/engines/ngi/sceneobjects.cpp
+++ b/engines/ngi/sceneobjects.cpp
@@ -116,16 +116,18 @@ void *Selection::update(uint32 arg2) {
 	return nullptr;
 }
 
-HitregionObject::HitregionObject() {
-	stub("HitregionObject::HitregionObject");
+HitregionObject::HitregionObject(GameObject *owner) : _owner(owner) {
 }
 
-HitregionObject::HitregionObject(GameObject *arg2) {
-	stub("HitregionObject::HitregionObject");
-}
-
-HitregionObject::HitregionObject(HitregionObject *arg2) {
-	stub("HitregionObject::HitregionObject");
+HitregionObject::HitregionObject(HitregionObject *src) {
+	if (src) {
+		_owner = src->_owner;
+		_left = src->_left;
+		_top = src->_top;
+		_right = src->_right;
+		_bottom = src->_bottom;
+		_rect = src->_rect;
+	}
 }
 
 void HitregionObject::setXmlData(void *arg2) {
@@ -136,32 +138,57 @@ void HitregionObject::getXmlData(int *arg2, int arg3) {
 	stub("HitregionObject::getXmlData");
 }
 
-HitregionObject *HitregionObject::calcPos(int arg2) {
-	stub("HitregionObject::calcPos");
-	return nullptr;
+Vector2 HitregionObject::calcPos() const {
+	Vector2 pos;
+	pos.x = 0;
+	pos.y = 0;
+	if (_owner && _rect) {
+		const Common::Point topLeft = _owner->getPosition();
+		pos.x = (float)topLeft.x + _left * _owner->_scaleX;
+		pos.y = (float)topLeft.y + _top * _owner->_scaleY;
+	}
+	return pos;
 }
 
-HitregionObject *HitregionObject::calcSize(float arg2, int arg3) {
-	stub("HitregionObject::calcSize");
-	return nullptr;
+Vector2 HitregionObject::calcSize() const {
+	Vector2 size;
+	size.x = 0;
+	size.y = 0;
+	if (_owner && _rect) {
+		const Common::Point ownerSize = _owner->getSize();
+		size.x = (float)ownerSize.x + (_right - _left) * _owner->_scaleX;
+		size.y = (float)ownerSize.y + (_bottom - _top) * _owner->_scaleY;
+	}
+	return size;
 }
 
-bool HitregionObject::hit(float arg2, float arg3) {
-	stub("HitregionObject::hit");
-	return false;
+bool HitregionObject::hit(float x, float y) const {
+	const Vector2 pos = calcPos();
+	const Vector2 size = calcSize();
+	const float dx = x - pos.x;
+	const float dy = y - pos.y;
+	return dx >= 0 && dy >= 0 && dx < size.x && dy < size.y;
 }
 
-HitregionObject *HitregionObject::getCenter(int arg2) {
-	stub("HitregionObject::getCenter");
-	return nullptr;
+Vector2 HitregionObject::getCenter() const {
+	const Vector2 pos = calcPos();
+	const Vector2 size = calcSize();
+	Vector2 center;
+	center.x = pos.x + size.x * 0.5f;
+	center.y = pos.y + size.y * 0.5f;
+	return center;
 }
 
 void HitregionObject::renderDbg(float arg2, float arg3) {
 	stub("HitregionObject::renderDbg");
 }
 
-void HitregionObject::init(void *arg2) {
-	stub("HitregionObject::init");
+void HitregionObject::init(const Common::StringMap &values) {
+	_right = strtof(values.getValOrDefault("right").c_str(), nullptr);
+	_left = strtof(values.getValOrDefault("left").c_str(), nullptr);
+	_top = strtof(values.getValOrDefault("top").c_str(), nullptr);
+	_bottom = strtof(values.getValOrDefault("bottom").c_str(), nullptr);
+	_rect = values.getValOrDefault("type") == "rect";
 }
 
 VisComposition::VisComposition() {
diff --git a/engines/ngi/sceneobjects.h b/engines/ngi/sceneobjects.h
index a0a2f92296d..a11d616f27d 100644
--- a/engines/ngi/sceneobjects.h
+++ b/engines/ngi/sceneobjects.h
@@ -25,6 +25,7 @@
 #include "ngi/objects.h"
 #include "ngi/gfx.h"
 #include "ngi/statics.h"
+#include "ngi/vector2.h"
 
 namespace NGI {
 
@@ -68,18 +69,24 @@ public:
 /** Android CHitregionObject: XML HITREGION: the clickable region of an object */
 class HitregionObject {
 public:
-	HitregionObject();
-	HitregionObject(GameObject *arg2);
-	HitregionObject(HitregionObject *arg2);
+	HitregionObject(GameObject *owner);
+	HitregionObject(HitregionObject *src);
 	virtual ~HitregionObject() {}
 	void setXmlData(void *arg2); // 104B14
 	void getXmlData(int *arg2, int arg3); // 104B88
-	HitregionObject *calcPos(int arg2); // 104CC4
-	HitregionObject *calcSize(float arg2, int arg3); // 104D04
-	bool hit(float arg2, float arg3); // 104D64
-	HitregionObject *getCenter(int arg2); // 104DD4
+	Vector2 calcPos() const; // 104CC4
+	Vector2 calcSize() const; // 104D04
+	bool hit(float x, float y) const; // 104D64
+	Vector2 getCenter() const; // 104DD4
 	void renderDbg(float arg2, float arg3); // 104E1C
-	void init(void *arg2); // 104EDC
+	void init(const Common::StringMap &values); // 104EDC
+
+	GameObject *_owner = nullptr;
+	float _left = 0;
+	float _top = 0;
+	float _right = 0;
+	float _bottom = 0;
+	bool _rect = false; // XML type "rect"
 };
 
 /** Android CVisComposition: several visible objects moved together */
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 1808445d408..865bcd58096 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -26,6 +26,7 @@
 #include "ngi/objects.h"
 #include "ngi/ngiarchive.h"
 #include "ngi/statics.h"
+#include "ngi/sceneobjects.h"
 #include "ngi/behavior.h"
 #include "ngi/preloadmanager.h"
 #include "ngi/messages.h"
@@ -472,6 +473,8 @@ Movement *AniObject::getMovementByName(const Common::String &name) {
 
 bool AniObject::hit(int x, int y) {
 	if (g_ngi->usesXMLProject()) {
+		if (_hitregion)
+			return _hitregion->hit((float)x, (float)y);
 		Phase *phase = _movement ? _movement->_curPhase : _statics;
 		if (!phase)
 			return false;
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index fd20280e498..3abbefef856 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1708,6 +1708,14 @@ private:
 			node->layout = _XMLkeys;
 			return true;
 		}
+		if (parent->name == "OLDANI" && node->name == "HITREGION") {
+			// CVisibleObject::Init: CHitregionObject::Init
+			AniObject *animation = _scene._aniObjects.back();
+			animation->_hitregion = new HitregionObject(animation);
+			animation->_hitregion->init(node->values);
+			node->layout = _XMLkeys;
+			return true;
+		}
 		if (parent->name == "INTERACTIONS") {
 			node->layout = _XMLkeys;
 			_interaction = nullptr;


Commit: be82744e93385011ab2eb19cfa3611bc4dd28c4f
    https://github.com/scummvm/scummvm/commit/be82744e93385011ab2eb19cfa3611bc4dd28c4f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Mark BehaviorAni CanMove flags 4 and 8 untested

Changed paths:
    engines/ngi/behavior.cpp


diff --git a/engines/ngi/behavior.cpp b/engines/ngi/behavior.cpp
index 24d0756cfea..14a239b5006 100644
--- a/engines/ngi/behavior.cpp
+++ b/engines/ngi/behavior.cpp
@@ -177,6 +177,12 @@ bool BehaviorAni::canMove(Scene *scene, bool behavered) const {
 			warning("STUB/untested: CScene::IsTalked (CDialogController is not ported), the dialogs do not block the behavior");
 		warned = true;
 	}
+	if (_flags & 12) {
+		static bool warnedUntested = false;
+		if (!warnedUntested)
+			warning("STUB/untested: CBehaviorAni::CanMove flags 4 and 8 (no data of the game uses them)");
+		warnedUntested = true;
+	}
 	if (_flags & 4)
 		result &= !behavered;
 	if (_flags & 8)


Commit: 6a4e264391fa9d754280690fbce72ca9d4423391
    https://github.com/scummvm/scummvm/commit/6a4e264391fa9d754280690fbce72ca9d4423391
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: GetAllRunableInteractions through the interaction index in the renderables order

Changed paths:
    engines/ngi/interaction.cpp
    engines/ngi/scene.cpp
    engines/ngi/scene.h


diff --git a/engines/ngi/interaction.cpp b/engines/ngi/interaction.cpp
index ef8b67dce9d..624b3b3490d 100644
--- a/engines/ngi/interaction.cpp
+++ b/engines/ngi/interaction.cpp
@@ -668,22 +668,26 @@ bool Interact::canBeRunNow(bool checkItem) const {
 	return true;
 }
 
+// CInteractionController::GetAllRunableInteractions (107420)
 void InteractionController::getAllRunnableInteractions(Scene *scene, Common::Array<Interact *> &result) {
 	result.clear();
+	if (!findSceneInteractions(scene->_sceneId))
+		return;
 
-	Common::Array<GameObject *> objects;
-	for (PictureObject *picture : scene->_pictureObjects)
-		objects.push_back(picture);
-	for (AniObject *ani : scene->_renderableAnis)
-		objects.push_back(ani);
-
-	for (GameObject *object : objects) {
+	Common::Array<GameObject *> renderables;
+	scene->getRenderables(renderables);
+	for (GameObject *object : renderables) {
 		// visible and not blocked (flag 4 of the object flags)
 		if (!(object->_flags & 4) || (object->_objectFlags & 4))
 			continue;
-		for (Interact *interaction : _interactions) {
-			if (interaction->_sceneId == scene->_sceneId && interaction->_objectId == object->_id && interaction->canBeRunNow())
-				result.push_back(interaction);
+		ObjectInteractions *entry = findObjectInteractions(scene->_sceneId, (uint16)object->_id);
+		if (!entry)
+			entry = findObjectInteractions(scene->_sceneId, (uint16)object->_id | (object->_copyId << 16));
+		if (!entry)
+			continue;
+		for (Interact *interact : entry->_interacts) {
+			if (interact->canBeRunNow())
+				result.push_back(interact);
 		}
 	}
 }
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 18232bca4b7..9e1f5497ea0 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -1597,6 +1597,33 @@ bool Scene::isCursorObjectRender(float x, float y) {
 	return true;
 }
 
+// the original keeps its objects in maps keyed by id | copy << 16
+static bool lessByKey(const GameObject *a, const GameObject *b) {
+	return ((uint16)a->_id | ((uint)a->_copyId << 16)) < ((uint16)b->_id | ((uint)b->_copyId << 16));
+}
+
+// CScene::RepopulateRenderables (123688): pictures, animations, then the roaming objects
+void Scene::getRenderables(Common::Array<GameObject *> &result) const {
+	result.clear();
+	Common::Array<GameObject *> group;
+	for (PictureObject *picture : _pictureObjects)
+		group.push_back(picture);
+	Common::sort(group.begin(), group.end(), lessByKey);
+	result.push_back(group);
+	group.clear();
+	for (AniObject *ani : _aniObjects)
+		group.push_back(ani);
+	Common::sort(group.begin(), group.end(), lessByKey);
+	result.push_back(group);
+	group.clear();
+	for (PictureObject *picture : _roamingPictures)
+		group.push_back(picture);
+	for (AniObject *ani : _roamingAnis)
+		group.push_back(ani);
+	Common::sort(group.begin(), group.end(), lessByKey);
+	result.push_back(group);
+}
+
 // CScene::IsAnyoneMoves (11FD24)
 bool Scene::isAnyoneMoves() const {
 	for (const AniObject *ani : _aniObjects) {
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index 2b3661fadbf..f60003766fe 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -217,6 +217,8 @@ class Scene : public Background {
 	void stopAllQueues();
 	/** CScene::IsQueuesProcessed (11FB98): copies of the template queues run in the global list */
 	bool isQueuesProcessed(bool ignoreInterruptState3) const;
+	/** the order of CScene::RepopulateRenderables (123688), without selections and grids */
+	void getRenderables(Common::Array<GameObject *> &result) const;
 	/** CScene::IsAnyoneMoves (11FD24) */
 	bool isAnyoneMoves() const;
 	MessageQueue *getMessageQueueByName(const Common::String &name);


Commit: 6a88530f3945857e7e8fe49a02320a3910a5c4ee
    https://github.com/scummvm/scummvm/commit/6a88530f3945857e7e8fe49a02320a3910a5c4ee
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CFPController::GetCursorType and FillCursorData

Changed paths:
    engines/ngi/fullpipe/fpcontroller.cpp
    engines/ngi/fullpipe/fpcontroller.h


diff --git a/engines/ngi/fullpipe/fpcontroller.cpp b/engines/ngi/fullpipe/fpcontroller.cpp
index 841b6fc803a..3bdef8519bc 100644
--- a/engines/ngi/fullpipe/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/fpcontroller.cpp
@@ -185,6 +185,7 @@ FPController &sceneController(Scene &scene) {
 
 // CFPController::CFPController; margins and offsets (+36 ... +48) are set by each OnShow
 FPController::FPController(int sceneId) : ISceneController(sceneId) {
+	fillCursorData();
 	initBorders();
 }
 
@@ -1214,17 +1215,37 @@ int scaledRandom(int n) {
 	return product / 0x7FFFFFFF;
 }
 
-// CFPController::GetCursorType (14EAC0); only the end: 101 with an item, 102 when usable
+// CFPController::GetCursorType (14EAC0)
 int FPController::getCursorType(float x, float y) {
-	// the original's end replaces what the borders and object helpers said before
+	int type = -1;
+	if (g_ngi->_objHelperManager && g_ngi->_objHelperManager->isHitObjHelper(_scene, x, y))
+		type = 116;
+	const GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	const uint id = hit ? (uint16)hit->_id : 0;
+	if (_cursorTypes.contains(id))
+		type = _cursorTypes[id];
+	const int border = checkBorders(x, y);
+	if (border == 1)
+		type = 5;
+	else if (border == -1)
+		type = 3;
 	if (g_ngi->_inputController->getObject())
 		return getGameLoaderInteractionController()->findInteractionUnderCursor() ? 102 : 101;
-	static bool reported = false;
-	if (!reported) {
-		reported = true;
-		warning("STUB/untested: CFPController::GetCursorType (D11: the cursor of the scene is chosen by the input code)");
+	return type;
+}
+
+// CFPController::FillCursorData (14F64C)
+void FPController::fillCursorData() {
+	GameVar *scenes = g_ngi->getGameLoaderGameVar();
+	GameVar *sceneVar = scenes ? scenes->getSubVarByName(g_ngi->gameIdToStr(_scene->_sceneId)) : nullptr;
+	GameVar *cursors = sceneVar ? sceneVar->getSubVarByName("CURSORS") : nullptr;
+	if (!cursors)
+		return;
+	for (GameVar *item = cursors->_subVars; item; item = item->_nextVarObj) {
+		uint32 id;
+		if (g_ngi->_gameProject->_objectIds.findId(item->_varName, id))
+			_cursorTypes[id] = item->_value.intValue;
 	}
-	return -1;
 }
 
 // CFPController::OnRenderBottom
@@ -1240,7 +1261,7 @@ bool FPController::onMouseMove(uint32 id, float x, float y) {
 	return false;
 }
 
-// CFPController::IsNeedReact (14B538); the cursor type map of the objects is not ported (D11)
+// CFPController::IsNeedReact (14B538)
 bool FPController::isNeedReact(float x, float y) {
 	if (g_ngi->_inputController->getObject() || !canInterruptManQueue())
 		return false;
diff --git a/engines/ngi/fullpipe/fpcontroller.h b/engines/ngi/fullpipe/fpcontroller.h
index f4dbee74f96..4c1d4811d8c 100644
--- a/engines/ngi/fullpipe/fpcontroller.h
+++ b/engines/ngi/fullpipe/fpcontroller.h
@@ -23,6 +23,7 @@
 #define NGI_FULLPIPE_FPCONTROLLER_H
 
 #include "common/scummsys.h"
+#include "common/hashmap.h"
 
 #include "ngi/scenecontroller.h"
 
@@ -72,8 +73,10 @@ public:
 	virtual bool controllerRunsSceneLogic() const { return false; }
 	/** CGObject::CleanXml (slot 5): resets the state; not called yet, CGame::CleanXml is not ported */
 	virtual void cleanXml() {}
-	/** CFPController::GetCursorType (14EAC0): only the item-in-cursor part (D11) */
+	/** CFPController::GetCursorType (14EAC0) */
 	int getCursorType(float x, float y) override;
+	/** CFPController::FillCursorData (14F64C): the cursor type of the objects of the scene (+96) */
+	void fillCursorData();
 	/** CScene init: OnSceneInit once before the first OnShow */
 	void initScene() {
 		if (!_sceneInitDone) {
@@ -173,6 +176,7 @@ protected:
 	MessageQueue *_walkQueue = nullptr;
 	MessageQueue *_interactionQueue = nullptr;
 	int _interactObjectId = 0; // +88: the object of the interaction under the cursor
+	Common::HashMap<uint, int> _cursorTypes; // +96: object id -> cursor type of the CURSORS of the scene
 	bool _hasLeftBorder = false; // +120: swipe target points of the borders (key -1 left, 1 right)
 	bool _hasRightBorder = false;
 	float _leftBorderX = 0;


Commit: fb589ce7b91bc735eb4cbc37f1a7391c4b3510dd
    https://github.com/scummvm/scummvm/commit/fb589ce7b91bc735eb4cbc37f1a7391c4b3510dd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Init the cursors where CGame::OnShow does, not lazily

Changed paths:
    engines/ngi/input.cpp
    engines/ngi/input.h
    engines/ngi/ngi.cpp


diff --git a/engines/ngi/input.cpp b/engines/ngi/input.cpp
index 2ea5765972c..20b5052a4f0 100644
--- a/engines/ngi/input.cpp
+++ b/engines/ngi/input.cpp
@@ -112,7 +112,6 @@ void CursorController::render() {
 
 void CursorController::initPointers() {
 	_pointers.clear();
-	bool complete = true;
 	for (const GameProject::PointerSpec &spec : g_ngi->_gameProject->_pointers) {
 		Pointer pointer;
 		pointer.type = spec.type;
@@ -125,12 +124,11 @@ void CursorController::initPointers() {
 				pointer.picture = scene->findVisibleObject(pictureId, 0);
 		}
 		if (!pointer.picture)
-			complete = false;
+			warning("CCursor::Init: the picture %s of the pointer %d was not found", spec.picture.c_str(), spec.type);
 		if (!spec.move.empty())
 			warning("STUB/untested: CCursor::Init starts the movement %s of the pointer", spec.move.c_str());
 		_pointers.push_back(pointer);
 	}
-	_pointersMade = complete;
 }
 
 // CGame +28 (a scene is being set: the type 7) is not modelled
@@ -151,8 +149,6 @@ void CursorController::calcCursorType() {
 }
 
 void CursorController::update(uint32 elapsed) {
-	if (!_pointersMade)
-		initPointers();
 	repopulateHitObjects(nullptr);
 	calcCursorType();
 }
diff --git a/engines/ngi/input.h b/engines/ngi/input.h
index 4ba2ebcdeb9..1141facdb72 100644
--- a/engines/ngi/input.h
+++ b/engines/ngi/input.h
@@ -85,7 +85,6 @@ public:
 		float offsetY = 0;
 	};
 	Common::Array<Pointer> _pointers;
-	bool _pointersMade = false;
 	int _cursorType = 0; // +80
 	bool _pointerShown = true; // +116
 
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 971bcfc93db..9b0982183cf 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -486,8 +486,9 @@ Common::Error NGIEngine::run() {
 			if (!_taskManager->isTaskClosed("FIND_APPLE_SC4"))
 				_taskManager->activateTask("FIND_APPLE_SC4");
 		}
+		// CGame::OnShow: the cursors are initialised, then the inventory (cursors, buttons) is loaded
+		_inputController->initPointers();
 		if (_preloadManager)
-			// CGame::OnShow: the inventory (cursors, buttons) is loaded before the first scene
 			_preloadManager->startGame();
 		if (!_gameLoader->setScene(startSceneId, startEntranceId))
 			return Common::Error(Common::kNoGameDataFoundError, "Could not load the Full Pipe start scene");


Commit: e215d1cc808fcb7b7d325bc90b4687ce0a0c36c5
    https://github.com/scummvm/scummvm/commit/e215d1cc808fcb7b7d325bc90b4687ce0a0c36c5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Scene::Update polls the queue map by key and waits for OnShow

Changed paths:
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/messages.h
    engines/ngi/scene.cpp
    engines/ngi/scene.h
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index ce53d7e34ea..ae6c8163dfc 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -709,6 +709,7 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 		_sceneStack.push_back(scene);
 		scene->_currentEntranceId = entrance._id;
 		FPController &controller = sceneController(*scene);
+		scene->_shown = true; // CScene::OnShow
 		if (scene->_behaviorController)
 			scene->_behaviorController->attachAnimations(*scene);
 		if (scene->_sceneId != SC_INTRO1) {
diff --git a/engines/ngi/messages.h b/engines/ngi/messages.h
index 0b7f38aa964..d8bfbe4a258 100644
--- a/engines/ngi/messages.h
+++ b/engines/ngi/messages.h
@@ -194,6 +194,8 @@ class MessageQueue : public CObject {
 	int _flags;
 	Common::String _title;
 	int16 _queueId;
+	/** key in the queue map of the scene (CScene +212): the queue id, or the counter of AddQueue */
+	uint _sceneKey = 0;
 	CObject *_field_14;
 	int _counter;
 	int _field_38;
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 9e1f5497ea0..11a7a82741c 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -374,6 +374,9 @@ Scene::~Scene() {
 	for (uint i = 0; i < _madeQueues.size(); i++)
 		delete _madeQueues[i];
 	_madeQueues.clear();
+	for (uint i = 0; i < _unmappedQueues.size(); i++)
+		delete _unmappedQueues[i];
+	_unmappedQueues.clear();
 	for (uint i = 0; i < _interactionQueues.size(); i++)
 		delete _interactionQueues[i];
 	_interactionQueues.clear();
@@ -443,6 +446,7 @@ bool Scene::load(MfcArchive &file) {
 		MessageQueue *mq = new MessageQueue();
 
 		mq->load(archive);
+		mq->_sceneKey = mq->_queueId;
 
 		_messageQueues.push_back(mq);
 
@@ -670,14 +674,20 @@ void Scene::removePicture(PictureObject *obj) {
 
 MessageQueue *Scene::findMessageQueue(int messageId) {
 	for (uint i = 0; i < _messageQueues.size(); i++)
-		if (_messageQueues[i]->_queueId == messageId)
+		if (_messageQueues[i]->_sceneKey == (uint)messageId)
 			return _messageQueues[i];
+	if (g_ngi->_gameVersion >= 201509) {
+		for (uint i = 0; i < _madeQueues.size(); i++)
+			if (_madeQueues[i]->_sceneKey == (uint)messageId)
+				return _madeQueues[i];
+	}
 
 	MessageQueue *shared = _commonQueueScene ? _commonQueueScene->findMessageQueue(messageId) : nullptr;
 	if (shared && g_ngi->_gameVersion >= 201509) {
 		// as in the original (CScene::FindMessageQueue): the common queue becomes one of this scene
 		MessageQueue *own = new MessageQueue(shared, 0, 0);
 		own->_scene = this;
+		own->_sceneKey = messageId;
 		_messageQueues.push_back(own);
 		return own;
 	}
@@ -704,9 +714,38 @@ void Scene::addQueue(MessageQueue *queue) {
 	if (Common::find(_messageQueues.begin(), _messageQueues.end(), queue) != _messageQueues.end() ||
 			Common::find(_madeQueues.begin(), _madeQueues.end(), queue) != _madeQueues.end())
 		return;
+	if (g_ngi->_gameVersion < 201509) {
+		_madeQueues.push_back(queue);
+		return;
+	}
+	// the map takes a key once (_M_insert_unique); the counter goes on
+	const uint key = _queueCounter++;
+	queue->_sceneKey = key;
+	MessageQueue *taken = nextQueueByKey(true, 0);
+	while (taken && taken->_sceneKey < key)
+		taken = nextQueueByKey(false, taken->_sceneKey);
+	if (taken && taken->_sceneKey == key) {
+		_unmappedQueues.push_back(queue);
+		return;
+	}
 	_madeQueues.push_back(queue);
 }
 
+MessageQueue *Scene::nextQueueByKey(bool first, uint key) const {
+	MessageQueue *next = nullptr;
+	for (uint i = 0; i < _messageQueues.size(); i++) {
+		MessageQueue *queue = _messageQueues[i];
+		if ((first || queue->_sceneKey > key) && (!next || queue->_sceneKey < next->_sceneKey))
+			next = queue;
+	}
+	for (uint i = 0; i < _madeQueues.size(); i++) {
+		MessageQueue *queue = _madeQueues[i];
+		if ((first || queue->_sceneKey > key) && (!next || queue->_sceneKey < next->_sceneKey))
+			next = queue;
+	}
+	return next;
+}
+
 // CScene::RunQueue(queue, state, 0) (12287E) / RunQueueWithAni (1228AE): SetQueue, AddQueue, Run
 bool Scene::runQueueObject(MessageQueue *queue, AniObject *ani, int interruptState) {
 	if (g_ngi->_gameVersion >= 201509) {
@@ -811,6 +850,12 @@ void Scene::forgetQueue(MessageQueue *queue) {
 			break;
 		}
 	}
+	for (uint i = 0; i < _unmappedQueues.size(); i++) {
+		if (_unmappedQueues[i] == queue) {
+			_unmappedQueues.remove_at(i);
+			break;
+		}
+	}
 	for (uint i = 0; i < _interactionQueues.size(); i++) {
 		if (_interactionQueues[i] == queue) {
 			_interactionQueues.remove_at(i);
@@ -1209,6 +1254,7 @@ uint Scene::unloadAdditional() {
 
 // CScene::OnShow (the parts that are ported): the controller, the behaviors
 void Scene::onShow() {
+	_shown = true;
 	if (_behaviorController)
 		_behaviorController->attachAnimations(*this);
 	if (_controller)
@@ -1542,27 +1588,32 @@ bool Scene::update(int counterdiff) {
 	bool changed = false;
 	if (g_ngi->_gameVersion >= 201509) {
 		// CScene::Update (120A3E): behaviors, queues check their current command, then objects move
-		if (_behaviorController)
-			changed |= _behaviorController->update(counterdiff);
-		for (uint i = 0; i < _messageQueues.size(); i++)
-			_messageQueues[i]->update(counterdiff);
-		for (uint i = 0; i < _madeQueues.size(); i++)
-			_madeQueues[i]->update(counterdiff);
-		for (uint i = 0; i < _interactionQueues.size(); i++)
-			_interactionQueues[i]->update(counterdiff);
-		processMessages();
-		for (uint i = 0; i < _renderableAnis.size(); i++)
-			changed |= _renderableAnis[i]->update(counterdiff);
-		if (_controller)
-			_controller->onUpdate(counterdiff);
-		if (_physListener)
-			_physListener->update(counterdiff);
-		if (_guiManager)
-			changed |= _guiManager->update(counterdiff);
-		if (_zController)
-			_zController->update();
-		if (_controller)
-			_controller->onUpdateTop(counterdiff);
+		if (_shown) {
+			if (_behaviorController)
+				changed |= _behaviorController->update(counterdiff);
+			bool first = true;
+			uint key = 0;
+			while (MessageQueue *queue = nextQueueByKey(first, key)) {
+				first = false;
+				key = queue->_sceneKey;
+				queue->update(counterdiff);
+			}
+			for (uint i = 0; i < _interactionQueues.size(); i++)
+				_interactionQueues[i]->update(counterdiff);
+			processMessages();
+			for (uint i = 0; i < _renderableAnis.size(); i++)
+				changed |= _renderableAnis[i]->update(counterdiff);
+			if (_controller)
+				_controller->onUpdate(counterdiff);
+			if (_physListener)
+				_physListener->update(counterdiff);
+			if (_guiManager)
+				changed |= _guiManager->update(counterdiff);
+			if (_zController)
+				_zController->update();
+			if (_controller)
+				_controller->onUpdateTop(counterdiff);
+		}
 		getGameLoaderInteractionController()->onUpdate(counterdiff);
 		removeObjectSafe();
 		return changed;
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index f60003766fe..052aee0a3ae 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -137,6 +137,14 @@ class Scene : public Background {
 	Scene *_commonQueueScene = nullptr;
 	/** Queues made by the code (CScene::AddQueue), owned, polled like _messageQueues (>= 201509) */
 	Common::Array<MessageQueue *> _madeQueues;
+	/** Made queues whose key was taken: the original's map did not take them, they are never polled */
+	Common::Array<MessageQueue *> _unmappedQueues;
+	/** CScene +264: key of the next made queue; the original never sets it, 0 breaks the tutorial */
+	uint _queueCounter = 0x10000;
+	/** CScene +38: set by OnShow, the objects and queues are updated only after it */
+	bool _shown = false;
+	/** The queue of the map after the key (the map of the original is ordered by key) */
+	MessageQueue *nextQueueByKey(bool first, uint key) const;
 	/** CScene +236 (>= 201509): the interaction queues (AddInteractionQueue), owned, polled too */
 	Common::Array<MessageQueue *> _interactionQueues;
 	/** CScene::AddInteractionQueue(CXmlNode &, CInteract *) (1227AE) */
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index 3abbefef856..9b7e87cf570 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1369,6 +1369,7 @@ private:
 		if (!readId(node->values["id"], queue->_queueId))
 			return parserError("Unknown queue ID " + node->values["id"]);
 		queue->_title = node->values.getValOrDefault("title");
+		queue->_sceneKey = queue->_queueId;
 		_scene._messageQueues.push_back(queue.release());
 		return true;
 	}


Commit: e938437ffb49f12e9c5a91027d9dab8a6e5ab44a
    https://github.com/scummvm/scummvm/commit/e938437ffb49f12e9c5a91027d9dab8a6e5ab44a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc32Controller

Changed paths:
  A engines/ngi/fullpipe/sc32controller.cpp
  A engines/ngi/fullpipe/sc32controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 65522e1a347..aaa35d6ccb0 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1947,5 +1947,9 @@ namespace NGI {
 #define ST_BTN_UP 600
 #define ANI_FIREFIGHTER 2229
 #define PIC_HELP_9_01 23231
+#define PIC_HELP_8_01 23226
+#define PIC_KADKA_SEL 28044
+#define MV_MAN32_POUR 2413
+#define MV_MAN32_SPIN 2403
 
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/sc32controller.cpp b/engines/ngi/fullpipe/sc32controller.cpp
new file mode 100644
index 00000000000..2c59d141f0f
--- /dev/null
+++ b/engines/ngi/fullpipe/sc32controller.cpp
@@ -0,0 +1,392 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/inventory.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/lift.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc32controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc32Controller::CSc32Controller (1906C4)
+Sc32Controller::Sc32Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc32Controller::~CSc32Controller (19044C): the highlight goes with it
+Sc32Controller::~Sc32Controller() {
+}
+
+// CSc32Controller::CleanXml (1903E8); SetXmlData, GetXmlData and GetSavePath are not ported
+void Sc32Controller::cleanXml() {
+	_sitting = false;
+	_onLadder = false;
+	_cactusCounter = -1;
+	_cactusStarted = false;
+	_timer = 0;
+}
+
+// CSc32Controller::CanSwipeMan (1906A0)
+bool Sc32Controller::canSwipeMan(float x, float y) {
+	if (_cactusCounter != -1)
+		return false;
+	if (_sitting)
+		return !_cactusStarted;
+	return true;
+}
+
+// CSc32Controller::IsCactusEnabled (190708)
+bool Sc32Controller::isCactusEnabled() const {
+	if (_cactusStarted)
+		return false;
+	return !_cactus->_movement && _cactus->_statics->_staticsId == ST_CTS_EMPTY && _cactusCounter <= 0x801;
+}
+
+// CSc32Controller::OnSpin (190750): the spin repeats while the cactus is not grown
+void Sc32Controller::onSpin(MessageQueue *queue) {
+	if (!queue || queue->getCount() == 0)
+		return;
+	if (queue->getCount() > 6) {
+		while (queue->getCount() > 7)
+			queue->removeCommand(queue->getCurCommandNum() + 1, true);
+	}
+	Command *next = queue->getCommandByIndex(queue->getCurCommandNum() + 1);
+	const bool growing = _cactus->_movement ? _cactus->_movement->_id == MV_CTS_DEFAULT : _cactus->_statics->_staticsId == ST_CTS_GROWUP;
+	if (_cactus->_movement && !growing)
+		return;
+	if (growing) {
+		for (int i = 0; i < 12; i++)
+			queue->addCommand(queue->getCurCommandNum() + 1, new Command(next));
+		_cactus->setStatic(ST_CTS_GROWUP, false);
+		_scene->runQueue(QU_CTS_BACK, 2);
+		_cactusStarted = false;
+		g_ngi->_taskManager->deactivateTask("USE_DEVICE_SC32");
+		if (g_ngi->_inventory->getItemByName("ANI_INV_MUGFULL")->_counter != 0)
+			g_ngi->_taskManager->activateTask("USE_CACTUS_SC32");
+		else
+			g_ngi->_taskManager->activateTask("GET_MUG_FULL_SC33");
+	} else if (_cactus->_statics->_staticsId == ST_CTS_EMPTY && _cactusCounter < 0) {
+		for (int i = 0; i < 2; i++)
+			queue->addCommand(queue->getCurCommandNum() + 1, new Command(next));
+		_scene->runQueue(QU_KDK_DRIZZLE, 4);
+	}
+}
+
+// CSc32Controller::OnPrepareCactus (190914)
+void Sc32Controller::onPrepareCactus() {
+	g_ngi->_help->disableHelpWithId(PIC_HELP_8_01);
+	_cactusCounter = 0;
+	_cactusStarted = false;
+}
+
+// CSc32Controller::TryKubik (190934)
+void Sc32Controller::tryKubik() {
+	if (isState(sO_Cube, sO_In_33)) {
+		random31();
+		_scene->runQueue(QU_KBK32_GO, 3);
+	}
+}
+
+// CSc32Controller::OnPushButton (1909AC)
+void Sc32Controller::onPushButton() {
+	if (isState(sO_ClockHandle, sO_In_32_Sticks)) {
+		AniObject *handle = _scene->findAniObjectById(ANI_INV_HANDLE, 1);
+		if (handle)
+			handle->setStatic(ST_HDL_PLUGGED, false);
+		_scene->runQueue(QU_SC32_FALLHANDLE, 2);
+		_button->setStatic(ST_BTN32_OFF, false);
+	}
+}
+
+// CSc32Controller::OnTrySit (190A54): the sit down command follows only if the cactus is free
+void Sc32Controller::onTrySit(MessageQueue *queue) {
+	if (!queue || queue->getCount() == 0)
+		return;
+	Command *next = queue->getCommandByIndex(queue->getCurCommandNum() + 1);
+	if (isCactusEnabled()) {
+		next->_cmd = kCmdStartMovement;
+		_sitting = true;
+		_scene->_motionController->deactivate();
+		getGameLoaderInteractionController()->disable();
+	} else {
+		next->_cmd = kCmdNone;
+	}
+}
+
+// CSc32Controller::OnCloseUpsell (190AA0)
+void Sc32Controller::onCloseUpsell() {
+	if (_cactus->_movement)
+		_cactus->stopMovement();
+	_cactus->moveToStaticChain(ST_CTS_EMPTY);
+	if (g_ngi->_inventory->getItemByName("ANI_INV_MUGFULL")->_counter == 0 && g_ngi->_inventory->getItemByName("ANI_INV_MUG")->_counter > 0) {
+		g_ngi->_inventory->removeItem("ANI_INV_MUG", -1);
+		g_ngi->_inventory->addItem("ANI_INV_MUGFULL", 1);
+	}
+	hero()->setStatic(ST_MAN_RIGHT, true);
+	hero()->setCenter(Common::Point(645, 466));
+	_sitting = false;
+	_cactusCounter = -1;
+	_cactusStarted = false;
+	getGameLoaderInteractionController()->enable();
+}
+
+// CSc32Controller::DoShowHandle (190BF8)
+void Sc32Controller::doShowHandle() {
+	if (!_scene->runQueue(QU_SC32_SHOWHANDLE, 4))
+		warning("sc32::DoShowHandle: m_scene->RunQueue() returned false!");
+	_button->setStatic(ST_BTN32_ON, false);
+}
+
+// CSc32Controller::DoStartCactus (190C68)
+void Sc32Controller::doStartCactus() {
+	if (hero()->_statics->_staticsId != ST_MAN32_SIT || !_sitting) {
+		g_ngi->_taskManager->activateTask("USE_DEVICE_SC32");
+		if (!_scene->runQueue(QU_CTS_GROW, 2))
+			warning("sc32::DoStartCactus: m_scene->RunQueue() returned false!");
+	} else {
+		g_ngi->_taskManager->deactivateTask("USE_CACTUS_SC32");
+		if (!_scene->runQueue(QU_CTS_GROWMAN, 2))
+			warning("sc32::DoStartCactus: m_scene->RunQueue() returned false!");
+	}
+	unlockCatalogItem("ANI_CACTUS");
+	_cactusCounter = -1;
+	_cactusStarted = true;
+}
+
+// CSc32Controller::OnTryStandup (190DB0)
+bool Sc32Controller::onTryStandup() {
+	if ((uint)_cactusCounter > 0x802 && !hero()->_movement) {
+		MessageQueue *queue = new MessageQueue(_scene, true, 1);
+		queue->addCommandToEnd(movementCommand(hero()->_id, MV_MAN32_STANDUP, hero()->_copyId));
+		if (_scene->runQueueObject(queue, hero(), 2)) {
+			_scene->_motionController->activate();
+			getGameLoaderInteractionController()->enable();
+			_sitting = false;
+			return true;
+		}
+		warning("sc32::OnTryStandup: m_scene->RunQueue() returned false!");
+	}
+	return false;
+}
+
+// CSc32Controller::TryLeaveLadder (190EB0)
+void Sc32Controller::tryLeaveLadder(float x, float y, GameObject *hit) {
+	MessageQueue *queue = copyQueue(_scene, QU_SC32_FROMLADDER);
+	queue->setIntState(2);
+	if (hit && hit->_id != PIC_SC32_LADDER)
+		queue->addCommandToEnd(createMouseCommand(_scene, x, y, g_ngi->_inputController->getObjectId()));
+	hero()->setStatic(ST_MAN_STANDLADDER, false);
+	_scene->runQueueObject(queue, hero(), 4);
+	_onLadder = false;
+}
+
+// CSc32Controller::OnSceneInit (190F4C)
+void Sc32Controller::onSceneInit() {
+	FPController::onSceneInit();
+	_highlight.reset(new Highlight(_scene, PIC_KADKA_SEL));
+}
+
+// CSc32Controller::OnShow (190F78)
+void Sc32Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	if (_scene->_currentEntranceId != 0)
+		g_ngi->_exitManager->setExitAngle(PIC_SC32_LADDER, 0.0f);
+	g_ngi->_help->setChapter(9);
+	if (_sitting || _cactusStarted) {
+		hero()->setStatic(ST_MAN_RIGHT, true);
+		hero()->setCenter(Common::Point(645, 466));
+	}
+	_sitting = false;
+	_cactusCounter = -1;
+	_cactusStarted = false;
+	_cactus = _scene->findAniObjectById(ANI_CACTUS, 0);
+	_orange = _scene->findAniObjectById(ANI_TESTO_ORANGE, 0);
+	_blue = _scene->findAniObjectById(ANI_TESTO_BLUE, 0);
+	_green = _scene->findAniObjectById(ANI_TESTO_GREEN, 0);
+	_button = _scene->findAniObjectById(ANI_BUTTON_32, 0);
+	_orange->startMovement(MV_TSTO_FLOW, 0, -1);
+	_orange->setCurFrame(15, true, false);
+	_green->startMovement(MV_TSTG_FLOW, 0, -1);
+	_green->setCurFrame(26, true, false);
+	AniObject *handle = _scene->findAniObjectById(ANI_INV_HANDLE, 1);
+	if (isState(sO_ClockHandle, sO_In_32_Lies)) {
+		if (handle)
+			handle->setStatic(ST_HDL_LAID, false);
+	} else if (isState(sO_ClockHandle, sO_In_32_Sticks)) {
+		if (handle)
+			handle->setStatic(ST_HDL_PLUGGED, false);
+		_button->setStatic(ST_BTN32_ON, false);
+	}
+	if (isState(sO_Cube, sO_In_32))
+		_scene->runQueueObject(copyQueue(_scene, QU_KBK32_START), nullptr, 3);
+	if (isState(sO_Cactus, sO_NotGrown))
+		_cactus->moveToStaticChain(ST_CTS_EMPTY);
+	g_ngi->lift().enableButton(sO_Level9, 23094);
+	g_ngi->lift().initLift(_scene, hero(), QU_SC32_ENTERLIFT, QU_SC32_EXITLIFT);
+	if (g_ngi->lift().isButtonEnabled(sO_Level6)) {
+		_scene->_behaviorController->disableAllMusic();
+		enableSound(SND_MUS_19, true);
+	}
+}
+
+// CSc32Controller::GetCursorType (191368): the lift buttons come first
+int Sc32Controller::getCursorType(float x, float y) {
+	if (g_ngi->lift().getCursorType(x, y))
+		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	CursorController *cursor = g_ngi->_inputController;
+	if (cursor->isObjectHit(PIC_SC32_LADDER))
+		return _onLadder ? 2 : 4;
+	if (cursor->isObjectHit(ANI_KADKA) && !cursor->getObjectId()) {
+		const int movementId = hero()->_lastMovementId;
+		if (_cactusCounter < 0 && !_cactusStarted && movementId != MV_MAN32_POUR && movementId != MV_MAN32_SPIN)
+			return 1;
+		if (_cactusStarted) {
+			if (_cactusCounter <= 0)
+				return 119;
+		} else if ((uint)(_cactusCounter - 1) <= 0x801) {
+			return 118;
+		}
+		if (movementId == MV_MAN32_POUR || movementId == MV_MAN32_SPIN)
+			return 119;
+	}
+	GameObject *hit = cursor->getInteractHitObject();
+	if (hit && (uint16)hit->_id == ANI_INV_HANDLE)
+		return 1;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc32Controller::OnUpdate (19144C)
+void Sc32Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+	_timer += elapsed;
+	if (_timer > 36900)
+		tryKubik();
+	if (_cactusCounter <= 3280) {
+		if ((uint)_cactusCounter <= 0xCCF)
+			_cactusCounter += elapsed;
+	} else {
+		doStartCactus();
+	}
+	_highlight->update(elapsed, !_cactusStarted && (uint)(_cactusCounter - 1) <= 0x801);
+}
+
+// CSc32Controller::OnMouseLKeyDown (1914BC)
+bool Sc32Controller::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (FPController::onMouseLKeyDown(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonDown(x, y);
+}
+
+// CSc32Controller::OnMouseLKeyUp (1914D8): the base first, the lift last
+bool Sc32Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (FPController::onMouseLKeyUp(id, x, y))
+		return true;
+	if (controllerRunsSceneLogic()) {
+		bool result = false;
+		GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+		if (_onLadder && !hero()->_movement && !hero()->_queue)
+			tryLeaveLadder(x, y, hit);
+		if (_sitting && !hero()->_movement && !_cactusStarted)
+			result = onTryStandup();
+		if (_cactusStarted && !_sitting && hit) {
+			if (hit->_id == ANI_LIFTBUTTON) {
+				if (MessageQueue *queue = _scene->findMessageQueue(QU_CTS_GROW))
+					queue->stop(false);
+				result = g_ngi->lift().onButtonUp(x, y);
+			} else if (hit->_id == PIC_SC32_RTRUBA) {
+				if (MessageQueue *queue = _scene->findMessageQueue(QU_CTS_GROW))
+					queue->stop(false);
+			}
+		}
+		if (result)
+			return true;
+	}
+	return g_ngi->lift().onButtonUp(x, y);
+}
+
+// CSc32Controller::OnMessage (1915CC)
+void Sc32Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC32_TRYSIT") {
+		onTrySit(queue);
+	} else if (message == "MSG_SC6_INSTHANDLE") {
+		doShowHandle();
+	} else if (message == "MSG_SC32_SPIN") {
+		onSpin(queue);
+	} else if (message == "MSG_SC32_STARTCACTUS") {
+		onPrepareCactus();
+	} else if (message == "MSG_SC6_BTNPUSH") {
+		onPushButton();
+	} else if (message == "MSG_TOLADDER") {
+		_onLadder = true;
+		_scene->_motionController->deactivate();
+		getGameLoaderInteractionController()->disable();
+	} else if (message == "MSG_FROMLADDER") {
+		_scene->_motionController->activate();
+		getGameLoaderInteractionController()->enable();
+	} else if (message == "MSG_SC33_TRYKUBIK") {
+		tryKubik();
+	} else if (message == "MSG_SC32_TRUBATOFRONT") {
+		_scene->findPictureObjectById(PIC_SC32_RTRUBA, 0)->_z = 0;
+	} else if (message == "MSG_SC32_TRUBATOBACK") {
+		_scene->findPictureObjectById(PIC_SC32_RTRUBA, 0)->_z = 20;
+	} else if (message == "MSG_SC32_CACTUS_STOPED") {
+		_cactusStarted = false;
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc32Controller::UpdateScroll (19176C)
+void Sc32Controller::updateScroll() {
+	if (_follow)
+		FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc32controller.h b/engines/ngi/fullpipe/sc32controller.h
new file mode 100644
index 00000000000..5748ea18a41
--- /dev/null
+++ b/engines/ngi/fullpipe/sc32controller.h
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC32CONTROLLER_H
+#define NGI_FULLPIPE_SC32CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/highlight.h"
+
+namespace NGI {
+
+/** CSc32Controller (lift, cactus, ladder); sceneHandler32 runs the scene until wired */
+class Sc32Controller : public FPController {
+public:
+	explicit Sc32Controller(int sceneId);
+	~Sc32Controller() override;
+
+	void onSceneInit() override;
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+	bool canSwipeMan(float x, float y) override;
+	void cleanXml() override;
+
+	bool isCactusEnabled() const;
+	void onSpin(MessageQueue *queue);
+	void onPrepareCactus();
+	void tryKubik();
+	void onPushButton();
+	void onTrySit(MessageQueue *queue);
+	void onCloseUpsell();
+	void doShowHandle();
+	void doStartCactus();
+	bool onTryStandup();
+	void tryLeaveLadder(float x, float y, GameObject *hit);
+
+private:
+	AniObject *_cactus = nullptr; // +216: ANI_CACTUS
+	AniObject *_orange = nullptr; // +220: ANI_TESTO_ORANGE
+	AniObject *_blue = nullptr; // +224: ANI_TESTO_BLUE
+	AniObject *_green = nullptr; // +228: ANI_TESTO_GREEN
+	AniObject *_button = nullptr; // +232: ANI_BUTTON_32
+	bool _sitting = false; // +236
+	bool _onLadder = false; // +237
+	int _cactusCounter = -1; // +240: ms since the cactus was prepared
+	bool _cactusStarted = false; // +244
+	int _timer = 0; // +248: ms until the cube is tried
+	Common::ScopedPtr<Highlight> _highlight; // +252: PIC_KADKA_SEL
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC32CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index bc2cdd678f0..37002bb313b 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -47,6 +47,7 @@
 #include "ngi/fullpipe/sc30controller.h"
 #include "ngi/fullpipe/sc35controller.h"
 #include "ngi/fullpipe/sc37controller.h"
+#include "ngi/fullpipe/sc32controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -127,15 +128,6 @@ void Sc28Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc32Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc32Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc33Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc33Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index e85cab6e11f..404ce4d6fcf 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -70,12 +70,6 @@ public:
 	void onShow() override;
 };
 
-class Sc32Controller : public FPController {
-public:
-	explicit Sc32Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc33Controller : public FPController {
 public:
 	explicit Sc33Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 8ca8c5440db..01773e2ae05 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -126,6 +126,7 @@ MODULE_OBJS = \
 	fullpipe/sc29controller.o \
 	fullpipe/sc30controller.o \
 	fullpipe/sc31controller.o \
+	fullpipe/sc32controller.o \
 	fullpipe/sc35controller.o \
 	fullpipe/sc36controller.o \
 	fullpipe/sc37controller.o \


Commit: 832f40753c5bd64bd32f43df6a1ef854d01d3ff7
    https://github.com/scummvm/scummvm/commit/832f40753c5bd64bd32f43df6a1ef854d01d3ff7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Lift parts of the controllers always active, remove tapOnLift

Changed paths:
    engines/ngi/fullpipe/fpcontroller.cpp
    engines/ngi/fullpipe/fpcontroller.h
    engines/ngi/fullpipe/sc03controller.cpp
    engines/ngi/fullpipe/sc06controller.cpp
    engines/ngi/fullpipe/sc10controller.cpp
    engines/ngi/fullpipe/sc14controller.cpp
    engines/ngi/fullpipe/sc15controller.cpp
    engines/ngi/fullpipe/sc30controller.cpp
    engines/ngi/fullpipe/sc35controller.cpp


diff --git a/engines/ngi/fullpipe/fpcontroller.cpp b/engines/ngi/fullpipe/fpcontroller.cpp
index 3bdef8519bc..84294d7a60e 100644
--- a/engines/ngi/fullpipe/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/fpcontroller.cpp
@@ -880,10 +880,6 @@ bool FPController::onMouseLKeyUp(uint32 id, float x, float y) {
 	_touching = false;
 	_dragged = false;
 
-	// the lift panel (the original: in the controllers of the scenes with a lift, after this)
-	if (!_swiped && !handled && tapOnLift(x, y))
-		return true;
-
 	MotionController *controller = _scene->_motionController.get();
 	if (!_swiped && !handled && controller && controller->_isEnabled) {
 		if (!cursor->getObject()) {
@@ -913,12 +909,6 @@ bool FPController::onMouseLKeyUp(uint32 id, float x, float y) {
 	return handled;
 }
 
-// CLift::OnButtonUp for all scenes (the original: the controllers of the scenes with a lift)
-bool FPController::tapOnLift(float x, float y) {
-	GameObject *target = _scene->findGameObjectAtPos((int)x, (int)y);
-	return target && g_ngi->isAndroidFullPipe() && (target->_id == ANI_LIFT || (target->_id >= 23116 && target->_id <= 23125)) && g_ngi->lift().onButtonUp(target);
-}
-
 // CFPController::OnMessage; not ported: INVENTORY_ITEM_INC / DEC_COUNTER, CHEATER_*, the tutorial
 void FPController::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
 	if (message == "MSG_LIFT_CLICKBUTTON") {
diff --git a/engines/ngi/fullpipe/fpcontroller.h b/engines/ngi/fullpipe/fpcontroller.h
index 4c1d4811d8c..338b9222a2d 100644
--- a/engines/ngi/fullpipe/fpcontroller.h
+++ b/engines/ngi/fullpipe/fpcontroller.h
@@ -131,8 +131,6 @@ public:
 	void checkQueues();
 	bool canInterruptManQueue() const;
 	bool moveBorders(float x, float y);
-	/** Tap on the lift door or its areas opens the button panel (CLift::OnButtonUp in the original) */
-	bool tapOnLift(float x, float y);
 	void calcFinPoint(float &x, float &y);
 	void initBorders();
 	/** CFPController::MctlStartMove */
diff --git a/engines/ngi/fullpipe/sc03controller.cpp b/engines/ngi/fullpipe/sc03controller.cpp
index e5e6e7b6a2d..eb4b07773c1 100644
--- a/engines/ngi/fullpipe/sc03controller.cpp
+++ b/engines/ngi/fullpipe/sc03controller.cpp
@@ -137,10 +137,10 @@ void Sc03Controller::onRender(Common::Point scroll) {
 
 // CSc03Controller::GetCursorType (164474): the lift buttons have their own cursor
 int Sc03Controller::getCursorType(float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::getCursorType(x, y);
 	if (g_ngi->lift().getCursorType(x, y))
 		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
 	return FPController::getCursorType(x, y);
 }
 
diff --git a/engines/ngi/fullpipe/sc06controller.cpp b/engines/ngi/fullpipe/sc06controller.cpp
index 0bc381b54f1..f3bcd860cd7 100644
--- a/engines/ngi/fullpipe/sc06controller.cpp
+++ b/engines/ngi/fullpipe/sc06controller.cpp
@@ -893,7 +893,7 @@ bool Sc06Controller::onMouseLKeyDown(uint32 id, float x, float y) {
 // CSc06Controller::OnMouseLKeyUp (16DA4E)
 bool Sc06Controller::onMouseLKeyUp(uint32 id, float x, float y) {
 	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyUp(id, x, y);
+		return g_ngi->lift().onButtonUp(x, y) || FPController::onMouseLKeyUp(id, x, y);
 
 	bool result;
 	bool onBall = false;
@@ -925,10 +925,10 @@ bool Sc06Controller::onMouseLKeyUp(uint32 id, float x, float y) {
 
 // CSc06Controller::GetCursorType (16DAE4): lift, then the aim cursor over hero or ball
 int Sc06Controller::getCursorType(float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::getCursorType(x, y);
 	if (g_ngi->lift().getCursorType(x, y))
 		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
 	if (!_arcadeRunning)
 		return FPController::getCursorType(x, y);
 	if (_aiming)
diff --git a/engines/ngi/fullpipe/sc10controller.cpp b/engines/ngi/fullpipe/sc10controller.cpp
index 7780a455c6e..a946979970a 100644
--- a/engines/ngi/fullpipe/sc10controller.cpp
+++ b/engines/ngi/fullpipe/sc10controller.cpp
@@ -138,10 +138,10 @@ void Sc10Controller::onShow() {
 
 // CSc10Controller::GetCursorType (173F0C): the lift buttons, the gum (the blower must be blowing)
 int Sc10Controller::getCursorType(float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::getCursorType(x, y);
 	if (g_ngi->lift().getCursorType(x, y))
 		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
 	if ((g_ngi->_inputController->isObjectHit(_gum) || g_ngi->_inputController->isObjectHit(_pack)) && _gumEnabled)
 		return !canTakeGum() + 118;
 	return FPController::getCursorType(x, y);
@@ -149,8 +149,6 @@ int Sc10Controller::getCursorType(float x, float y) {
 
 // CSc10Controller::OnMouseLKeyDown (173F72)
 bool Sc10Controller::onMouseLKeyDown(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyDown(id, x, y);
 	if (FPController::onMouseLKeyDown(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonDown(x, y);
@@ -158,8 +156,6 @@ bool Sc10Controller::onMouseLKeyDown(uint32 id, float x, float y) {
 
 // CSc10Controller::OnMouseLKeyUp (173F8E)
 bool Sc10Controller::onMouseLKeyUp(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyUp(id, x, y);
 	if (FPController::onMouseLKeyUp(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonUp(x, y);
diff --git a/engines/ngi/fullpipe/sc14controller.cpp b/engines/ngi/fullpipe/sc14controller.cpp
index 050bfbb7873..fb41264c59e 100644
--- a/engines/ngi/fullpipe/sc14controller.cpp
+++ b/engines/ngi/fullpipe/sc14controller.cpp
@@ -724,10 +724,10 @@ void Sc14Controller::onKeyUp(uint32 key) {
 
 // CSc14Controller::GetCursorType (17A738): the lift; the drag cursor while the arcade runs
 int Sc14Controller::getCursorType(float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::getCursorType(x, y);
 	if (g_ngi->lift().getCursorType(x, y))
 		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
 	if (!_arcadeRunning)
 		return FPController::getCursorType(x, y);
 	if (_manKicking)
@@ -764,7 +764,7 @@ void Sc14Controller::onUpdate(uint32 elapsed) {
 // CSc14Controller::OnMouseLKeyDown (17A828): takes the hero; before the arcade: plank (x 1237)
 bool Sc14Controller::onMouseLKeyDown(uint32 id, float x, float y) {
 	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyDown(id, x, y);
+		return g_ngi->lift().onButtonDown(x, y) || FPController::onMouseLKeyDown(id, x, y);
 
 	bool handled = false;
 	if (_arcadeRunning) {
@@ -797,7 +797,7 @@ bool Sc14Controller::onMouseLKeyDown(uint32 id, float x, float y) {
 // a tap at the grandma's ball takes it; lift buttons
 bool Sc14Controller::onMouseLKeyUp(uint32 id, float x, float y) {
 	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyUp(id, x, y);
+		return g_ngi->lift().onButtonUp(x, y) || FPController::onMouseLKeyUp(id, x, y);
 
 	_touching = false;
 	MotionController *motion = _scene->_motionController.get();
diff --git a/engines/ngi/fullpipe/sc15controller.cpp b/engines/ngi/fullpipe/sc15controller.cpp
index e076c51ba0e..750315158da 100644
--- a/engines/ngi/fullpipe/sc15controller.cpp
+++ b/engines/ngi/fullpipe/sc15controller.cpp
@@ -119,10 +119,10 @@ void Sc15Controller::onHide() {
 
 // CSc15Controller::GetCursorType (17B684): the lift buttons, the left pipe
 int Sc15Controller::getCursorType(float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::getCursorType(x, y);
 	if (g_ngi->lift().getCursorType(x, y))
 		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
 	if (g_ngi->_inputController->isObjectHit(PIC_SC15_LTRUBA))
 		return 3;
 	return FPController::getCursorType(x, y);
@@ -142,8 +142,6 @@ void Sc15Controller::onUpdate(uint32 elapsed) {
 
 // CSc15Controller::OnMouseLKeyDown (17B72C)
 bool Sc15Controller::onMouseLKeyDown(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyDown(id, x, y);
 	if (FPController::onMouseLKeyDown(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonDown(x, y);
@@ -151,8 +149,6 @@ bool Sc15Controller::onMouseLKeyDown(uint32 id, float x, float y) {
 
 // CSc15Controller::OnMouseLKeyUp (17B748)
 bool Sc15Controller::onMouseLKeyUp(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyUp(id, x, y);
 	if (FPController::onMouseLKeyUp(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonUp(x, y);
diff --git a/engines/ngi/fullpipe/sc30controller.cpp b/engines/ngi/fullpipe/sc30controller.cpp
index 31197c8ee99..b71bef20b4b 100644
--- a/engines/ngi/fullpipe/sc30controller.cpp
+++ b/engines/ngi/fullpipe/sc30controller.cpp
@@ -106,10 +106,10 @@ void Sc30Controller::onShow() {
 
 // CSc30Controller::GetCursorType (18FC50)
 int Sc30Controller::getCursorType(float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::getCursorType(x, y);
 	if (g_ngi->lift().getCursorType(x, y))
 		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
 	if (g_ngi->_inputController->isObjectHit(PIC_SC30_LTRUBA))
 		return 3;
 	return FPController::getCursorType(x, y);
@@ -122,8 +122,6 @@ void Sc30Controller::onUpdate(uint32 elapsed) {
 
 // CSc30Controller::OnMouseLKeyDown (18FCC8)
 bool Sc30Controller::onMouseLKeyDown(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyDown(id, x, y);
 	if (FPController::onMouseLKeyDown(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonDown(x, y);
@@ -131,8 +129,6 @@ bool Sc30Controller::onMouseLKeyDown(uint32 id, float x, float y) {
 
 // CSc30Controller::OnMouseLKeyUp (18FCE4)
 bool Sc30Controller::onMouseLKeyUp(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyUp(id, x, y);
 	if (FPController::onMouseLKeyUp(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonUp(x, y);
diff --git a/engines/ngi/fullpipe/sc35controller.cpp b/engines/ngi/fullpipe/sc35controller.cpp
index 3d6b4c235ec..ffdecf6b475 100644
--- a/engines/ngi/fullpipe/sc35controller.cpp
+++ b/engines/ngi/fullpipe/sc35controller.cpp
@@ -184,10 +184,10 @@ void Sc35Controller::onHide() {
 
 // CSc35Controller::GetCursorType (1942BA)
 int Sc35Controller::getCursorType(float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::getCursorType(x, y);
 	if (g_ngi->lift().getCursorType(x, y))
 		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
 	return FPController::getCursorType(x, y);
 }
 
@@ -229,8 +229,6 @@ void Sc35Controller::onUpdate(uint32 elapsed) {
 
 // CSc35Controller::OnMouseLKeyDown (194440)
 bool Sc35Controller::onMouseLKeyDown(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyDown(id, x, y);
 	if (FPController::onMouseLKeyDown(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonDown(x, y);
@@ -238,8 +236,6 @@ bool Sc35Controller::onMouseLKeyDown(uint32 id, float x, float y) {
 
 // CSc35Controller::OnMouseLKeyUp (19445C)
 bool Sc35Controller::onMouseLKeyUp(uint32 id, float x, float y) {
-	if (!controllerRunsSceneLogic())
-		return FPController::onMouseLKeyUp(id, x, y);
 	if (FPController::onMouseLKeyUp(id, x, y))
 		return true;
 	return g_ngi->lift().onButtonUp(x, y);


Commit: 951a2f183663cdc1c7b73a2fcb5d5aaf549a332c
    https://github.com/scummvm/scummvm/commit/951a2f183663cdc1c7b73a2fcb5d5aaf549a332c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CAniObject::StopMovement, StopMovementToPrev and CMovement::Stop exactly

Changed paths:
    engines/ngi/interaction.cpp
    engines/ngi/statics.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/interaction.cpp b/engines/ngi/interaction.cpp
index 624b3b3490d..90ba6e021d1 100644
--- a/engines/ngi/interaction.cpp
+++ b/engines/ngi/interaction.cpp
@@ -830,9 +830,7 @@ void Interact::run(Scene *scene) {
 				curFrame, (int)movement->_phases.size(), ani->_x, ani->_y, ani->getCenter().x, ani->getCenter().y);
 			fromStatics = movement->_nextStatic->_staticsId;
 			const bool mirror = (ani->_flags & 8) != 0;
-			if (movement->_reverse)
-				warning("STUB/untested: CInteract::Run: a movement that plays backwards is stopped by the engine's StopMovementToPrev (the reverse flag of the original is not toggled)");
-			ani->stopMovementToPrev(false, true);
+			ani->stopMovementToPrev(false);
 			restart = new Command(ani->_id, kCmdStartMovement, movement->_id, 0, 0, 0, 1, 0, 0, 0);
 			restart->_param = ani->_copyId;
 			restart->_mirror = mirror;
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 865bcd58096..a0d6c7fb25d 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -940,6 +940,7 @@ bool AniObject::updateAnimation(int counterdiff) {
 			// a movement that plays backwards (START_MOVEMENT reverse) ends at its first frame
 			// CMovement::SetNext (EFB8E)
 			const int lastFrame = (int)_movement->_phases.size() - 2; // last phase; the next statics follows
+			const int stopFrame = timedMovement ? movementStopFrame() : lastFrame;
 			if (timedMovement && _movement->_reverse) {
 				if (_movement->_curFrame > 0) {
 					_movement->gotoPrevFrame(_flags & 8);
@@ -952,12 +953,14 @@ bool AniObject::updateAnimation(int counterdiff) {
 				setPos(_movement->_x, _movement->_y);
 				_counter = _initialCounter;
 				_movement->_curPhase->enter(_id);
-			} else if (timedMovement && _movement->_cycled && _movement->_curFrame >= lastFrame) {
+			} else if (timedMovement && _movement->_cycled && _movement->_curFrame >= stopFrame) {
 				_movement->setFrame(0, _flags & 8);
 				setPos(_movement->_x, _movement->_y);
 				_counter = _initialCounter;
 				_movement->_curPhase->enter(_id);
-			} else if (!_movement->setNext(_callback1, _callback2, timedMovement && (_flags & 8)) || (timedMovement && _movement->_curPhase == _movement->_nextStatic)) {
+			} else if (timedMovement && _movement->_curFrame >= stopFrame) {
+				stopMovement();
+			} else if (!_movement->setNext(_callback1, _callback2, timedMovement && (_flags & 8))) {
 				stopMovement();
 			} else {
 				setPos(_movement->_x, _movement->_y);
@@ -982,7 +985,7 @@ bool AniObject::updateAnimation(int counterdiff) {
 			const Common::Point point = _stepArray.getCurrPoint();
 			setPos(point.x + _x, point.y + _y);
 			_stepArray.gotoNextPoint();
-			if (_targetFrame == _movement->_curFrame)
+			if (!timedMovement && _targetFrame == _movement->_curFrame)
 				adjustSomeXY();
 		} else if (_flags & 0x20) {
 			_flags ^= 0x20;
@@ -1017,12 +1020,6 @@ void AniObject::updateStepPos() {
 	int ox = _movement->_x;
 	int oy = _movement->_y;
 
-	if (g_ngi->_gameVersion >= 201509 && _movement->_curFrame < (int)_movement->_phases.size() - 1) {
-		const Common::Point pending = _stepArray.getPoint(-1, _stepArray.getPointsCount());
-		stopCutMovement(pending);
-		return;
-	}
-
 	point = _movement->getMovementSize(1, _targetFrame);
 	int x = point.x;
 	int y = point.y;
@@ -1074,6 +1071,11 @@ Common::Point *AniObject::calcNextStep(Common::Point *pRes) {
 }
 
 void AniObject::stopMovement(bool keepSounds) {
+	if (g_ngi->_gameVersion >= 201509) {
+		stopMovementAndroid(keepSounds);
+		return;
+	}
+
 	debugC(2, kDebugAnimation, "AniObject::stopMovement()");
 
 	if (!(_flags & 1))
@@ -1086,55 +1088,13 @@ void AniObject::stopMovement(bool keepSounds) {
 	Common::Point point;
 
 	if (_movement) {
-		const bool reversed = g_ngi->_gameVersion >= 201509 ? _movement->_reverse : (_flags & 0x40) != 0;
-		if (g_ngi->_gameVersion >= 201509) {
-			// CAniObject::StopMovement plays the rest of the movement before CMovement::Stop;
-			// a walk cut at a frame goes through stopCutMovement
-			const bool mirror = (_flags & 8) != 0;
-			if (reversed) {
-				while (_movement->_curFrame > 0) {
-					_movement->gotoPrevFrame(mirror);
-					if (!keepSounds)
-						_movement->_curPhase->enter(_id);
-				}
-			} else if (_targetFrame < 0) {
-				const int endFrame = (int)_movement->_phases.size() - 1;
-				while (_movement->_curFrame < endFrame && _movement->setNext(nullptr, nullptr, mirror)) {
-					if (!keepSounds)
-						_movement->_curPhase->enter(_id);
-				}
-			} else if (_movement->_curFrame < _targetFrame) {
-				warning("STUB/untested: AniObject::stopMovement(%d) before the stop frame of the movement %d (frame %d of %d)", _id, _movement->_id, _movement->_curFrame, _targetFrame);
-			}
-		}
-
 		setPos(_movement->_x, _movement->_y);
 
-		if (reversed) {
+		if (_flags & 0x40) {
 			if (!_movement->_currMovement) {
 				if (_movement->_curFrame)
 					goto L11;
 L8:
-				if (g_ngi->_gameVersion >= 201509) {
-					// CMovement::Stop with reverse: first frame position minus the previous step;
-					// mirrored: the other way about the center
-					Statics *previous = _movement->_prevStatic;
-					const Common::Point oldTopLeft = getPosition();
-					const int oldWidth = _movement->_curPhase->getDimensions().x;
-					const int newWidth = previous->getDimensions().x;
-					const bool mirrored = (_flags & 8) != 0;
-					const Common::Point newTopLeft(mirrored ? oldTopLeft.x + _movement->_prevStepX + oldWidth - newWidth : oldTopLeft.x - _movement->_prevStepX,
-						oldTopLeft.y - _movement->_prevStepY);
-					_statics = previous;
-					if (_movement->_mirrorPrev)
-						_flags ^= 8;
-					Common::Point anchor = previous->getSomeXY();
-					if (_flags & 8)
-						anchor.x = newWidth - anchor.x;
-					_x = newTopLeft.x + anchor.x;
-					_y = newTopLeft.y + anchor.y;
-					goto L12;
-				}
 				_statics = _movement->_prevStatic;
 				point = _movement->getCurrDynamicPhaseXY();
 				_x -= point.x;
@@ -1167,31 +1127,14 @@ L12:
 		_statics->_x = _x - point.x;
 		_statics->_y = _y - point.y;
 		oid = _movement->_id;
-		if (g_ngi->_gameVersion >= 201509) {
-			// unload the movement unless the preload manager keeps it; the sounds stop (not with keepSounds)
-			if (!keepSounds) {
-				if (!g_ngi->_preloadManager->isPreloaded(_movement->_id))
-					g_ngi->_preloadManager->onUnloadMove(_movement->unload());
-				for (int i = 0; i < g_ngi->_currSoundListCount; ++i)
-					g_ngi->_currSoundList1[i]->stopByCreator(_id);
-			}
-			_movement->_reverse = false;
-			_movement->_cycled = false;
-		}
 		_movement = nullptr;
 
-		debugC(1, kDebugAnimation, "movement stop: t %u ani %d copy %d movement %d pos %d,%d topleft %d,%d flags %x statics %d", g_system->getMillis(), _id, _copyId, oid, _x, _y, getPosition().x,
-			getPosition().y, _flags, _statics ? _statics->_staticsId : -1);
 		Command *ex = new Command(_id, kCmdMessage, kMsgAniMovementEnded, 0, 0, 0, 1, 0, 0, 0);
 		ex->_param = _copyId;
 		ex->_excFlags = 2;
 		ex->postMessage();
 	}
 
-	// nobody is told: the queue sees that the object stands (CMessageQueue::UpdateCmdStartMove)
-	if (g_ngi->_gameVersion >= 201509)
-		return;
-
 	int mqid = _messageQueueId;
 
 	if (_animExFlag) {
@@ -1200,28 +1143,82 @@ L12:
 	} else {
 		if (_messageQueueId == oldmqid) {
 			_messageQueueId = 0;
-			if (_field_34 == 1) {
-				debugC(1, kDebugInfo, "INFO t %u the movement of %d (%s) ends and goes on with the queue %d", g_system->getMillis(), _id, transCyrillic(_title), mqid);
+			if (_field_34 == 1)
 				updateGlobalMessageQueue(mqid, _id);
-			}
 		}
 	}
 }
 
-// CMovement::Stop of a movement cut before its last phase (a walk): the end statics goes to
-// the phase origin plus the last step (mirrored: backwards)
-void AniObject::stopCutMovement(const Common::Point &pending) {
-	Statics *statics = _movement->_nextStatic;
-	const bool mirrored = (_flags & 8) != 0;
-	const int originX = _x + (mirrored ? -_movement->_nextStepX : _movement->_nextStepX) + pending.x;
-	const int originY = _y + _movement->_nextStepY + pending.y;
-	const Common::Point some = statics->getSomeXY();
+// CMovement +92: forward the last phase (the end statics is the last element of the phases here),
+// backwards the first one, unless a stop frame was given
+int AniObject::movementStopFrame() const {
+	const int last = (int)_movement->_phases.size() - 2;
+	if (_targetFrame >= 0)
+		return MIN(_targetFrame, last);
+	return _movement->_reverse ? 0 : last;
+}
+
+// CAniObject::StopMovement (F0F28)
+void AniObject::stopMovementAndroid(bool keepSounds) {
+	debugC(2, kDebugAnimation, "AniObject::stopMovementAndroid(%d)", keepSounds);
+
+	if (!(_flags & 1) || !_movement)
+		return;
+
+	_flags &= ~1;
+
+	Movement *mov = _movement;
+	mov->_counter = 0;
+
+	const bool reverse = mov->_reverse;
+	const bool mirror = (_flags & 8) != 0;
+
+	// CMovement::SetCurFrame (EFB00): SetFrame frame by frame to the stop frame
+	const int stopFrame = movementStopFrame();
+	while (mov->_curFrame != stopFrame) {
+		const int frame = mov->_curFrame < stopFrame ? mov->_curFrame + 1 : mov->_curFrame - 1;
+		const bool forward = frame > mov->_curFrame;
+		mov->setFrame(frame, mirror);
+		setPos(mov->_x, mov->_y);
+		// the slide of the frames (+80, +84 of the movement): added going forward, taken back going back
+		if (forward) {
+			const Common::Point step = _stepArray.getCurrPoint();
+			setPos(_x + step.x, _y + step.y);
+			_stepArray.gotoNextPoint();
+		} else if (frame < _stepArray.getPointsCount()) {
+			const Common::Point step = _stepArray.getPoint(frame, 1);
+			setPos(_x - step.x, _y - step.y);
+		}
+		if (!keepSounds)
+			mov->_curPhase->enter(_id);
+	}
 
-	_statics = statics;
+	// +164 and +64: the end statics and the facing
+	Statics *end = reverse ? mov->_prevStatic : mov->_nextStatic;
+	const bool endMirror = (reverse ? mov->_mirrorPrev : mov->_mirrorNext) != mirror;
+
+	// CMovement::Stop with the size of the end statics (CVisibleObject::GetSize)
+	Common::Point topLeft = getPosition();
+	const Dims endSize = end->getDimensions();
+	mov->stop(topLeft, endSize.x * _scaleX * (_windowRight - _windowLeft), endSize.y * _scaleY * (_windowBottom - _windowTop), _scaleX, _scaleY, _rotation, mirror);
+
+	const int oid = mov->_id;
+	_statics = end;
 	_movement = nullptr;
 	_targetFrame = -1;
-	// the statics is placed by its anchor; mirrored, the sprite extends right of it by the some-offset
-	setPos(mirrored ? originX - some.x : originX + some.x, originY + some.y);
+	_flags = (_flags & ~8) | (endMirror ? 8 : 0);
+	setPosition(topLeft);
+
+	debugC(1, kDebugAnimation, "movement stop: t %u ani %d copy %d movement %d pos %d,%d topleft %d,%d flags %x statics %d", g_system->getMillis(), _id, _copyId, oid, _x, _y, topLeft.x, topLeft.y,
+		_flags, _statics->_staticsId);
+
+	if (keepSounds)
+		return;
+
+	if (!g_ngi->_preloadManager->isPreloaded(oid))
+		g_ngi->_preloadManager->onUnloadMove(mov->unload());
+	for (int i = 0; i < g_ngi->_currSoundListCount; ++i)
+		g_ngi->_currSoundList1[i]->stopByCreator(_id);
 }
 
 bool AniObject::isSlidingEnd(float endX, float endY) const {
@@ -1232,64 +1229,27 @@ bool AniObject::isSlidingEnd(float endX, float endY) const {
 	return _movement->_cycled;
 }
 
-// CAniObject::StopMovementToPrev: back to the previous statics, same horizontal center; the y is
-// that of the movement start minus the steps taken since
-void AniObject::stopMovementToPrev(bool keepSounds, bool exact) {
-	if (!_movement || !(_flags & 1))
+// CAniObject::SetReverse (F10BE)
+void AniObject::setReverse(bool reverse) {
+	if (!(_flags & 1) || !_movement)
 		return;
 
-	if (exact && g_ngi->_gameVersion >= 201509 && !_stepArray.getPointsCount() && !_movement->_currMovement) {
-		// CAniObject::StopMovementToPrev (F10F4): turn the movement round, StopMovement rewinds it;
-		// slides and mirrored movements keep the reconstruction below
-		_movement->_reverse = !_movement->_reverse;
-		stopMovement(keepSounds);
-		return;
-	}
-
-	Movement *mov = _movement;
-	Statics *prev = mov->_prevStatic;
-	const bool mirrored = (_flags & 8) != 0;
-
-	// The sliding steps applied so far (the last point stays applied when the array is exhausted)
-	Common::Point applied = _stepArray.getPoint(0, _stepArray.getCurrPointIndex());
-	if (_stepArray.isEndOfSteps())
-		applied += _stepArray.getCurrPoint();
-
-	int originY = _y - applied.y - mov->_prevStepY;
-	for (int i = 1; i <= mov->_curFrame && i < (int)mov->_framePosOffsets.size(); ++i)
-		originY -= mov->_framePosOffsets[i].y;
-
-	const Dims current = mov->_curPhase->getDimensions();
-	const Dims previous = prev->getDimensions();
-	const Common::Point some = prev->getSomeXY();
-	const int centerX = mirrored ? _x - current.x / 2 : _x + current.x / 2;
-
-	_statics = prev;
-	_movement = nullptr;
-	_targetFrame = -1;
-	_flags &= ~1;
-	_stepArray.clear();
-	if (mov->_mirrorPrev)
-		_flags ^= 8;
+	const int stopFrame = movementStopFrame();
+	_movement->_reverse = reverse;
+	_targetFrame = (int)_movement->_phases.size() - 2 - stopFrame;
+}
 
-	// anchor for the kept center: left + some-offset, mirrored right - some-offset
-	const bool nowMirrored = (_flags & 8) != 0;
-	setPos(nowMirrored ? centerX + previous.x / 2 - some.x : centerX - previous.x / 2 + some.x, originY + some.y);
+// CAniObject::StopMovementToPrev (F10F4): the movement runs the other way to its start
+void AniObject::stopMovementToPrev(bool keepSounds) {
+	if (!_movement || !(_flags & 1))
+		return;
 
-	if (!keepSounds && g_ngi->_gameVersion >= 201509) {
-		if (!g_ngi->_preloadManager->isPreloaded(mov->_id))
-			g_ngi->_preloadManager->onUnloadMove(mov->unload());
-		for (int i = 0; i < g_ngi->_currSoundListCount; ++i)
-			g_ngi->_currSoundList1[i]->stopByCreator(_id);
-	}
+	setReverse(!_movement->_reverse);
+	stopMovement(keepSounds);
+	// the second SetReverse of the original finds no running movement
 }
 
 void AniObject::adjustSomeXY() {
-	if (_movement && g_ngi->_gameVersion >= 201509 && _movement->_curFrame < (int)_movement->_phases.size() - 1) {
-		stopCutMovement(Common::Point());
-		return;
-	}
-
 	if (_movement) {
 		Common::Point point;
 
@@ -2865,6 +2825,39 @@ void Movement::setLast() {
 	}
 }
 
+// CMovement::Stop (EEE70): the top left moves by the next step (reverse: back by the previous one)
+// and the object keeps its center against the change of size to the end statics
+void Movement::stop(Common::Point &topLeft, float width, float height, float scaleX, float scaleY, float rotation, bool mirror) {
+	float stepX;
+	float stepY;
+	if (_reverse) {
+		stepX = 0.0f - _prevStepX * scaleX;
+		stepY = 0.0f - _prevStepY * scaleY;
+	} else {
+		stepX = _nextStepX * scaleX;
+		stepY = _nextStepY * scaleY;
+	}
+
+	const Dims texture = _curPhase->getDimensions();
+	const float oldCenterX = topLeft.x + texture.x * 0.5f * scaleX;
+	const float oldCenterY = topLeft.y + texture.y * 0.5f * scaleX;
+
+	_cycled = false;
+	_reverse = false;
+
+	const float halfWidth = width * 0.5f;
+	const float halfHeight = height * 0.5f;
+	float dx = (topLeft.x + stepX + halfWidth * scaleX) - oldCenterX;
+	const float dy = (topLeft.y + stepY + halfHeight * scaleX) - oldCenterY;
+	if (mirror)
+		dx = -dx;
+
+	const float c = cosf(rotation);
+	const float sn = sinf(rotation);
+	topLeft.x = static_cast<int>(roundf((oldCenterX + (dx * c - dy * sn)) - halfWidth));
+	topLeft.y = static_cast<int>(roundf((oldCenterY + (dx * sn + dy * c)) - halfHeight));
+}
+
 Common::Point Movement::getCenter() const {
 	Common::Rect rect(_curPhase->_rect);
 
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index d0701f218f0..9a2cbc24cfb 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -181,6 +181,8 @@ class Movement : public GameObject {
 	void setFrame(int frame, bool mirror);
 	void gotoFirstFrame();
 	void setLast();
+	/** CMovement::Stop (EEE70); width and height: the size of the end statics */
+	void stop(Common::Point &topLeft, float width, float height, float scaleX, float scaleY, float rotation, bool mirror);
 
 	/** CMovement::Load and Unload (Android): returns the size loaded / freed (a quarter for "dxt") */
 	uint load();
@@ -276,10 +278,10 @@ public:
 
 	void setTargetFrame(int val) { _targetFrame = val; }
 	void adjustSomeXY();
-	void stopCutMovement(const Common::Point &pending);
-	/** CAniObject::StopMovementToPrev (F10F4); `exact` is the original way, not the default:
-	 *  it moved the tutorial man by 440 pixels (movement 11015) */
-	void stopMovementToPrev(bool keepSounds, bool exact = false);
+	/** CAniObject::StopMovementToPrev (F10F4) */
+	void stopMovementToPrev(bool keepSounds);
+	/** CAniObject::SetReverse (F10BE): the stop frame (CMovement +92) is mirrored too */
+	void setReverse(bool reverse);
 
 	/** CAniObject::StartMovement (F0D46); cycled, reverse, startFrame are START_MOVEMENT attributes */
 	bool startMovement(int movementId, int messageQueueId, int dynPhaseIdx, bool mirror = false, bool cycled = false, bool reverse = false, int startFrame = -1);
@@ -308,6 +310,10 @@ public:
 	void updateStepPos();
 	/** CAniObject::StopMovement(bool) (F0F28); keepSounds skips sounds and phase commands */
 	void stopMovement(bool keepSounds = false);
+	/** CAniObject::StopMovement (F0F28), run by stopMovement from the 2015 build on */
+	void stopMovementAndroid(bool keepSounds);
+	/** CMovement +92: the last frame that the running movement shows */
+	int movementStopFrame() const;
 	/** CAniObject::IsSlidingEnd (F0EEE); the end point test for cycled movements is not ported */
 	bool isSlidingEnd(float endX, float endY) const;
 	Common::Point *calcNextStep(Common::Point *point);


Commit: 230c43f5b83e44f3fef4df575de82461ed32aa9d
    https://github.com/scummvm/scummvm/commit/230c43f5b83e44f3fef4df575de82461ed32aa9d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc26Controller

Changed paths:
  A engines/ngi/fullpipe/sc26controller.cpp
  A engines/ngi/fullpipe/sc26controller.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/sc26controller.cpp b/engines/ngi/fullpipe/sc26controller.cpp
new file mode 100644
index 00000000000..78e57ba6dd0
--- /dev/null
+++ b/engines/ngi/fullpipe/sc26controller.cpp
@@ -0,0 +1,315 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc26controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc26Controller::CSc26Controller (186968)
+Sc26Controller::Sc26Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc26Controller::~CSc26Controller (186930)
+Sc26Controller::~Sc26Controller() {
+}
+
+// CSc26Controller::DoHideChi (18699C)
+void Sc26Controller::doHideChi() {
+	_scene->runQueue(QU_CHI_HIDE, 2);
+}
+
+// CSc26Controller::DoShowChi (1869B0)
+void Sc26Controller::doShowChi() {
+	_scene->runQueue(QU_CHI_SHOW, 2);
+}
+
+// CSc26Controller::DoHideVent (1869C4)
+void Sc26Controller::doHideVent() {
+	if (_activeVent)
+		_activeVent->_flags &= ~4;
+}
+
+// CSc26Controller::DoShowVent (1869D8)
+void Sc26Controller::doShowVent() {
+	if (!_activeVent)
+		return;
+	if (_activeVent->_statics->_staticsId == ST_VNT26_UP2)
+		_activeVent->setStatic(ST_VNT26_RIGHT2, false);
+	else if (_activeVent->_statics->_staticsId == ST_VNT26_RIGHT2)
+		_activeVent->setStatic(ST_VNT26_UP2, false);
+	else
+		return;
+	_activeVent->_flags |= 4;
+}
+
+// CSc26Controller::SetAniState (186A20)
+void Sc26Controller::setAniState() {
+	static const char *const valves[] = { sO_Valve2_26, sO_Valve3_26, sO_Valve4_26, sO_Valve5_26 };
+	for (int i = 0; i < 4; i++) {
+		AniObject *vent = _scene->findAniObjectById(ANI_VENT, i + 1);
+		vent->_flags |= 4;
+		vent->setStatic(isState(valves[i], sO_Closed) ? ST_VNT26_RIGHT2 : ST_VNT26_UP2, false);
+	}
+}
+
+// CSc26Controller::UpdatePool (186C08)
+void Sc26Controller::updatePool() {
+	if (isState(sO_Valve1_26, sO_Opened))
+		g_ngi->setState(sO_Pool, g_ngi->getStateValue(sO_Pool, sO_Overfull));
+	else if (isState(sO_Pool, sO_Overfull))
+		g_ngi->setState(sO_Pool, g_ngi->getStateValue(sO_Pool, sO_Full));
+
+	if (isState(sO_Pool, sO_Overfull) || isState(sO_Pool, sO_Full)) {
+		Task *task = g_ngi->_taskManager->findTask("HALF_RELEASE_POOL_SC26");
+		if (!task || task->_state != 0)
+			g_ngi->_taskManager->activateTask("HALF_RELEASE_POOL_SC26");
+		else
+			g_ngi->_taskManager->activateTask("FULL_RELEASE_POOL_SC24");
+	}
+
+	// the states are compared as strings, like the original does
+	if (isState(sO_Valve2_26, sO_Opened) && g_ngi->getState(sO_Pool).compareTo(sO_Full) >= 0) {
+		g_ngi->setState(sO_Pool, g_ngi->getStateValue(sO_Pool, sO_HalfFull));
+		Task *task = g_ngi->_taskManager->findTask("HALF_RELEASE_POOL_SC26");
+		if (task && (task->_state == 1 || task->_state == 2)) {
+			g_ngi->_taskManager->deactivateTask("HALF_RELEASE_POOL_SC26");
+			g_ngi->_taskManager->activateTask("GET_TO_CURLING_SC25");
+		}
+	}
+
+	if (isState(sO_Valve3_26, sO_Opened) && g_ngi->getState(sO_Pool).compareTo(sO_HalfFull) >= 0) {
+		g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_POOL_3", 35, "UNDEF");
+		g_ngi->setState(sO_Pool, g_ngi->getStateValue(sO_Pool, sO_Empty));
+		g_ngi->_taskManager->deactivateTask("FULL_RELEASE_POOL_SC24");
+		g_ngi->_taskManager->activateTask("GET_POTTIE_LOPATA_SC25");
+	}
+}
+
+// CSc26Controller::DoSpinVent (187170)
+void Sc26Controller::doSpinVent(AniObject *vent) {
+	static const char *const valves[] = { sO_Valve1_26, sO_Valve2_26, sO_Valve3_26, sO_Valve4_26, sO_Valve5_26 };
+	static const int queues[][2] = {
+		{ QU_SC26_OPEN1, QU_SC26_CLOSE1 }, { QU_SC26_OPEN2, QU_SC26_CLOSE2 }, { QU_SC26_OPEN3, QU_SC26_CLOSE3 },
+		{ QU_SC26_OPEN4, QU_SC26_CLOSE4 }, { QU_SC26_OPEN5, QU_SC26_CLOSE5 }
+	};
+	const int copy = vent->_copyId;
+	if (copy < 0 || copy > 4)
+		return;
+	MessageQueue *queue = copyQueue(_scene, queues[copy][isState(valves[copy], sO_Closed) ? 0 : 1]);
+	if (queue) {
+		queue->setIntState(2);
+		_scene->runQueueObject(queue, hero(), 4);
+	}
+}
+
+// CSc26Controller::UpdateDrop (187444)
+void Sc26Controller::updateDrop() {
+	_scene->_behaviorController->enableAllQueuesForAni(_drop, !isState(sO_Valve5_26, sO_Closed));
+}
+
+// CSc26Controller::DoTestVent (1874B8)
+void Sc26Controller::doTestVent() {
+	if (!_activeVent)
+		return;
+	if (_activeVent->_copyId == 0) {
+		if (isState(sO_Valve1_26, sO_Opened))
+			g_ngi->stopAllSoundInstances(SND_26_018);
+		else
+			g_ngi->playSound(SND_26_018, 1);
+		if (isState(sO_Valve2_26, sO_Opened)) {
+			if (!_scene->runQueue(QU_SC26_AUTOCLOSE2, 4)) {
+				// CLogger::WriteLog(1, ...)
+				warning("sc26::DoTestVent: m_scene->RunQueue returned false!");
+			}
+			g_ngi->playSound(SND_26_020, 0);
+		}
+		if (isState(sO_Valve3_26, sO_Opened)) {
+			if (!_scene->runQueue(QU_SC26_AUTOCLOSE3, 4)) {
+				// CLogger::WriteLog(1, ...)
+				warning("sc26::DoTestVent: m_scene->RunQueue returned false!");
+			}
+			g_ngi->playSound(SND_26_020, 0);
+		}
+	} else if (_activeVent->_copyId == 1) {
+		g_ngi->playSound(isState(sO_Valve2_26, sO_Opened) ? SND_26_020 : SND_26_019, 0);
+		if (isState(sO_Pool, sO_Overfull) || isState(sO_Pool, sO_Full))
+			g_ngi->playSound(SND_26_003, 0);
+		if (isState(sO_Valve1_26, sO_Opened)) {
+			g_ngi->stopAllSoundInstances(SND_26_018);
+			if (!_scene->runQueue(QU_SC26_AUTOCLOSE1, 4)) {
+				// CLogger::WriteLog(1, ...)
+				warning("sc26::DoTestVent: m_scene->RunQueue returned false!");
+			}
+		}
+	} else if (_activeVent->_copyId == 2) {
+		g_ngi->playSound(isState(sO_Valve3_26, sO_Opened) ? SND_26_020 : SND_26_019, 0);
+		if (isState(sO_Pool, sO_Overfull) || isState(sO_Pool, sO_Full) || isState(sO_Pool, sO_HalfFull))
+			g_ngi->playSound(SND_26_003, 0);
+		if (isState(sO_Valve1_26, sO_Opened)) {
+			g_ngi->stopAllSoundInstances(SND_26_018);
+			if (!_scene->runQueue(QU_SC26_AUTOCLOSE1, 4)) {
+				// CLogger::WriteLog(1, ...)
+				warning("sc26::DoTestVent: m_scene->RunQueue returned false!");
+			}
+		}
+	}
+}
+
+// CSc26Controller::OnClickVent (187B78)
+bool Sc26Controller::onClickVent(AniObject *vent) {
+	if (vent->_copyId == 0 && isState(sO_Hatch_26, sO_Opened))
+		return false;
+	if (hero()->getMessageQueue()) {
+		MessageQueue *queue = hero()->getMessageQueue();
+		Command *cmd = queue->getCurCommand();
+		if (cmd) {
+			for (Common::StringMap::const_iterator it = cmd->_args.begin(); it != cmd->_args.end(); ++it) {
+				if (it->_value == "MSG_SC26_CLICKVENT") {
+					hero()->getMessageQueue()->interrupt(false);
+					hero()->setQueue(nullptr);
+				}
+			}
+		}
+	}
+	if (hero()->getMessageQueue() && canInterruptManQueue()) {
+		hero()->getMessageQueue()->interrupt(false);
+		hero()->setQueue(nullptr);
+	}
+	if (hero()->getMessageQueue())
+		return false;
+	_activeVent = vent;
+	const Common::Point ventCenter = vent->getCenter();
+	const float x = (float)ventCenter.x - 19.0f;
+	const float y = (float)ventCenter.y + 61.0f;
+	const Common::Point heroCenter = hero()->getCenter();
+	if (fabsf(x - (float)heroCenter.x) > 3.0f || fabsf(y - (float)heroCenter.y) > 3.0f || hero()->_movement) {
+		MessageQueue *queue = mctlStartMove((int)x, (int)y, true, ST_MAN_UP, false);
+		if (queue) {
+			queue->addCommandToEnd(messageCommand("MSG_SC26_CLICKVENT", 0, 2,
+					Common::String::format("%d", (vent->_copyId << 16) | (uint16)vent->_id).c_str()));
+			queue->setIntState(2);
+		}
+	} else {
+		doSpinVent(vent);
+	}
+	return true;
+}
+
+// CSc26Controller::OnShow (187E10)
+void Sc26Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_chi = _scene->findAniObjectById(ANI_CHHI, 0);
+	_drop = _scene->findAniObjectById(ANI_DROP_26, 0);
+	_sockPicture = _scene->findPictureObjectById(PIC_SC26_SOCK, 0);
+	_sock = _scene->findAniObjectById(ANI_SOCK_26, 0);
+	_vent = _scene->findAniObjectById(ANI_VENT, 0);
+	setAniState();
+	if (isState(sO_Valve1_26, sO_Opened))
+		g_ngi->playSound(SND_26_018, 1);
+	updateDrop();
+}
+
+// CSc26Controller::GetCursorType (187F24)
+int Sc26Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (!hit)
+		return FPController::getCursorType(x, y);
+	if ((uint16)hit->_id == ANI_VENT)
+		return 1;
+	if (hit->_id == PIC_SC26_LTRUBA && hit->_copyId == 0)
+		return 3;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc26Controller::OnUpdate (187F64)
+void Sc26Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+}
+
+// CSc26Controller::OnMouseLKeyUp (187F6C)
+bool Sc26Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (!hit || (uint16)hit->_id != ANI_VENT)
+		return FPController::onMouseLKeyUp(id, x, y);
+	onClickVent(static_cast<AniObject *>(hit));
+	return true;
+}
+
+// CSc26Controller::OnMessage (187FB0)
+void Sc26Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC26_CLICKVENT") {
+		const int fullId = atoi(param.c_str());
+		_vent = _scene->findAniObjectById(fullId & 0xFFFF, fullId >> 16);
+		if (_vent)
+			onClickVent(_vent);
+	} else if (message == "MSG_SC26_HIDEVENT") {
+		doHideVent();
+	} else if (message == "MSG_SC26_SHOWVENT") {
+		doShowVent();
+	} else if (message == "MSG_SC26_TESTVENT") {
+		doTestVent();
+	} else if (message == "MSG_SC26_UPDATEPOOL") {
+		updatePool();
+	} else if (message == "MSG_SC26_HIDECHI") {
+		doHideChi();
+	} else if (message == "MSG_SC26_SHOWCHI") {
+		doShowChi();
+	} else if (message == "MSG_SC26_UPDATEDROP") {
+		updateDrop();
+	} else if (message == "MSG_SC26_MOVELUK") {
+		AniObject *hatch = _scene->findAniObjectById(ANI_LUK26, 0);
+		hatch->setPosition(Common::Point(94, 381));
+		hatch->_z = 27;
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc26controller.h b/engines/ngi/fullpipe/sc26controller.h
new file mode 100644
index 00000000000..f3c1bdf6ff5
--- /dev/null
+++ b/engines/ngi/fullpipe/sc26controller.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC26CONTROLLER_H
+#define NGI_FULLPIPE_SC26CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+class PictureObject;
+
+/** CSc26Controller (the pool and the five valves); sceneHandler26 runs the scene until wired */
+class Sc26Controller : public FPController {
+public:
+	explicit Sc26Controller(int sceneId);
+	~Sc26Controller() override;
+
+	void onShow() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+
+	void doHideChi();
+	void doShowChi();
+	void doHideVent();
+	void doShowVent();
+	void setAniState();
+	void updatePool();
+	void doSpinVent(AniObject *vent);
+	void updateDrop();
+	void doTestVent();
+	bool onClickVent(AniObject *vent);
+
+private:
+	AniObject *_activeVent = nullptr; // +216: the valve that was clicked
+	AniObject *_chi = nullptr; // +220: ANI_CHHI
+	AniObject *_drop = nullptr; // +224: ANI_DROP_26
+	PictureObject *_sockPicture = nullptr; // +228: PIC_SC26_SOCK
+	AniObject *_sock = nullptr; // +232: ANI_SOCK_26
+	AniObject *_vent = nullptr; // +236: ANI_VENT, then the valve of MSG_SC26_CLICKVENT
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC26CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 37002bb313b..3cc17fd2edd 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -48,6 +48,7 @@
 #include "ngi/fullpipe/sc35controller.h"
 #include "ngi/fullpipe/sc37controller.h"
 #include "ngi/fullpipe/sc32controller.h"
+#include "ngi/fullpipe/sc26controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -110,15 +111,6 @@ void Sc25Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc26Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc26Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc28Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc28Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 404ce4d6fcf..74e3200de31 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -58,12 +58,6 @@ public:
 	void onShow() override;
 };
 
-class Sc26Controller : public FPController {
-public:
-	explicit Sc26Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc28Controller : public FPController {
 public:
 	explicit Sc28Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 01773e2ae05..e1b228c69e8 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -122,6 +122,7 @@ MODULE_OBJS = \
 	fullpipe/sc20controller.o \
 	fullpipe/sc21controller.o \
 	fullpipe/sc24controller.o \
+	fullpipe/sc26controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc29controller.o \
 	fullpipe/sc30controller.o \


Commit: 3145e7a562d24821094da4d8f0c76ef7760bb729
    https://github.com/scummvm/scummvm/commit/3145e7a562d24821094da4d8f0c76ef7760bb729
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc28Controller

Changed paths:
  A engines/ngi/fullpipe/sc28controller.cpp
  A engines/ngi/fullpipe/sc28controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/messages.cpp
    engines/ngi/messages.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index aaa35d6ccb0..cfff7e67774 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1952,4 +1952,21 @@ namespace NGI {
 #define MV_MAN32_POUR 2413
 #define MV_MAN32_SPIN 2403
 
+// Android: names of obj.h that the ported controllers use
+#define ST_LFT28_CLOSED 4240
+#define ST_LFT28_OPEN 4241
+#define QU_WMN_SHOWBEFORE 3450
+#define QU_SC28_ENTERWMN 3451
+#define QU_SC28_WORKINSIDE 3449
+#define QU_SC28_WMN_END 3453
+#define QU_SC28_LIFT1_END 4257
+#define QU_SC28_LIFT0_FINISH 28012
+#define ANI_BIGHEAD 4938
+#define ANI_WOMAN_28 3439
+#define ANI_INV_POT 986
+#define PIC_POT_SEL 28050
+#define PIC_HELP_7_01 23223
+#define SND_MUS_28 63305
+#define SND_MUS_5 63282
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/sc28controller.cpp b/engines/ngi/fullpipe/sc28controller.cpp
new file mode 100644
index 00000000000..9b6701cf8ba
--- /dev/null
+++ b/engines/ngi/fullpipe/sc28controller.cpp
@@ -0,0 +1,503 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/objects.h"
+#include "ngi/anihandler.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/sceneobjects.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc28controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc28Controller::CSc28Controller (18B118)
+Sc28Controller::Sc28Controller(int sceneId) : FPController(sceneId), _flyPack(new FlyPack()) {
+}
+
+// CSc28Controller::~CSc28Controller (18B0B8): the fly pack and the highlight go with it
+Sc28Controller::~Sc28Controller() {
+}
+
+// CSc28Controller::DoStartWork1 (18B198)
+void Sc28Controller::doStartWork1() {
+	hero()->_flags &= ~4;
+	AniObject *worker = _scene->findAniObjectById(ANI_MAN_28, 0);
+	worker->setStatic(ST_MAN28_RIGHT, false);
+	const Common::Point heroPos = hero()->getPosition();
+	worker->setPosition(Common::Point(heroPos.x + 50, heroPos.y + 50));
+	worker->_z = hero()->_z;
+	worker->_flags |= 4;
+	if (!_scene->isQueueStarted(QU_SC28_LIFT1_WORK))
+		_scene->runQueueWithAni(QU_SC28_LIFT1_WORK, hero(), 2);
+}
+
+// CSc28Controller::DoShowAfter1 (18B230)
+void Sc28Controller::doShowAfter1() {
+	AniObject *worker = _scene->findAniObjectById(ANI_MAN_28, 0);
+	hero()->setStatic(ST_MAN_SIT, false);
+	hero()->_flags |= 8; // CVisibleObject +64 (mirror)
+	hero()->_z = worker->_z;
+	hero()->_flags |= 4;
+}
+
+// CSc28Controller::TryFlies (18B270)
+void Sc28Controller::tryFlies() {
+	if (_flyPending) {
+		_flyPack->addFly(_scene, 1013, 329, 60, 4);
+		_flyPack->_flies.back().idleTicks = 2490;
+		_flyPack->_flies.back().countdown = scaledRandom(12) + 12;
+		_flyPack->addFly(_scene, 1074, 311, 60, 4);
+		_flyPack->_flies.back().idleTicks = 2490;
+		_flyPack->_flies.back().countdown = scaledRandom(12) + 12;
+	}
+	_flyPending = false;
+}
+
+// CSc28Controller::DoEnterLift6 (18B360)
+void Sc28Controller::doEnterLift6() {
+	g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_DOORS", 15, "DoEnterLift6");
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+	g_ngi->_aniHandler->detachAllObjects();
+	AniObject *aunt = _scene->findAniObjectById(ANI_TIOTIA, 1);
+	int queueId;
+	if (aunt && (aunt->_flags & 4))
+		queueId = QU_SC28_LIFT6_START2;
+	else
+		queueId = QU_SC28_LIFT6_START;
+	if (!_scene->isQueueStarted(queueId))
+		_scene->runQueueWithAni(queueId, hero(), 2);
+}
+
+// CSc28Controller::DoEnterLift5 (18B428)
+void Sc28Controller::doEnterLift5() {
+	g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_DOORS", 15, "DoEnterLift5");
+	if (!_scene->isQueueStarted(QU_SC28_LIFT5_START))
+		_scene->runQueueWithAni(QU_SC28_LIFT5_START, hero(), 2);
+}
+
+// CSc28Controller::DoEnterLift4 (18B4A8)
+void Sc28Controller::doEnterLift4() {
+	g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_DOORS", 15, "DoEnterLift4");
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+	g_ngi->_aniHandler->detachAllObjects();
+	if (!_scene->isQueueStarted(QU_SC28_WMN_START) && !_scene->isQueueStarted(QU_WMN_SHOWBEFORE) &&
+			!_scene->isQueueStarted(QU_SC28_ENTERWMN) && !_scene->isQueueStarted(QU_SC28_WORKINSIDE) &&
+			!_scene->isQueueStarted(QU_SC28_WMN_END))
+		_scene->runQueueWithAni(QU_SC28_WMN_START, hero(), 2);
+}
+
+// CSc28Controller::DoEnterLift3 (18B584)
+void Sc28Controller::doEnterLift3() {
+	g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_DOORS", 15, "DoEnterLift3");
+	if (!_scene->isQueueStarted(QU_SC28_LIFT3_START))
+		_scene->runQueueWithAni(QU_SC28_LIFT3_START, hero(), 2);
+}
+
+// CSc28Controller::DoEnterLift2 (18B604)
+void Sc28Controller::doEnterLift2() {
+	g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_DOORS", 15, "DoEnterLift2");
+	if (!_scene->isQueueStarted(QU_SC28_LIFT2_START))
+		_scene->runQueueWithAni(QU_SC28_LIFT2_START, hero(), 2);
+}
+
+// CSc28Controller::DoEnterLift1 (18B684)
+void Sc28Controller::doEnterLift1() {
+	g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_DOORS", 15, "DoEnterLift1");
+	hero()->_objectFlags |= 8;
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+	g_ngi->_aniHandler->detachAllObjects();
+	if (!_scene->isQueueStarted(QU_SC28_LIFT1_START) && !_scene->isQueueStarted(QU_SC28_LIFT1_END))
+		_scene->runQueueWithAni(QU_SC28_LIFT1_START, hero(), 2);
+}
+
+// CSc28Controller::DoEnterLift0 (18B734)
+void Sc28Controller::doEnterLift0() {
+	g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_DOORS", 15, "DoEnterLift0");
+	if (!_scene->isQueueStarted(QU_SC28_LIFT0_START) && !_scene->isQueueStarted(QU_SC28_LIFT0_FINISH))
+		_scene->runQueueWithAni(QU_SC28_LIFT0_START, hero(), 2);
+}
+
+// CSc28Controller::TryVtorpers (18B7C4)
+void Sc28Controller::tryVtorpers() {
+	random31();
+	if (!_secondGroup) {
+		unlockCatalogItem("ANI_BIGHEAD");
+		bool started;
+		if (_headLeft) {
+			MessageQueue *queue = copyQueue(_scene, QU_GLV28_GOR);
+			queue->getCommandByIndex(0)->setParamInt("x", _scene->_x - 40);
+			started = _scene->runQueueObject(queue, nullptr, 3);
+		} else {
+			MessageQueue *queue = copyQueue(_scene, QU_GLV28_GOL);
+			queue->getCommandByIndex(0)->setParamInt("x", _scene->_x + 840);
+			started = _scene->runQueueObject(queue, nullptr, 3);
+		}
+		if (!started) {
+			// CLogger::WriteLog(1, ...)
+			warning("sc28::TryVtorPers: m_scene->RunQueue returned false!");
+		}
+		_headLeft = !_headLeft;
+	} else {
+		// the three faces: the copy, x and the y offsets of each one
+		static const int leftX[3] = { -20, -40, -60 };
+		static const int rightX[3] = { 1044, 1064, 1084 };
+		static const int offsetY[3] = { 0, 20, 40 };
+		const int queueId = _vtorpersLeft ? QU_BRD28_GOR : QU_BRD28_GOL;
+		bool started = true;
+		for (int i = 0; i < 3; i++) {
+			MessageQueue *queue = copyQueue(_scene, queueId);
+			for (uint j = 0; j < queue->getCount(); j++)
+				queue->getCommandByIndex(j)->setParamInt("copy", i + 1);
+			queue->getCommandByIndex(0)->setParamInt("x", _scene->_x + (_vtorpersLeft ? leftX[i] : rightX[i]));
+			if (i > 0) {
+				Command *first = queue->getCommandByIndex(0);
+				first->setParamInt("y", first->getParamInt("y", 0) + offsetY[i]);
+			}
+			queue->setObjectCopyAll(i + 1);
+			started = _scene->runQueueObject(queue, nullptr, 3);
+			if (!started) {
+				// CLogger::WriteLog(1, ...)
+				warning("sc28::TryVtorPers: m_scene->RunQueue returned false!");
+			}
+		}
+		_vtorpersLeft = !_vtorpersLeft;
+	}
+	_secondGroup = !_secondGroup;
+}
+
+// CSc28Controller::OnClickLift (18BD30)
+void Sc28Controller::onClickLift(uint lift) {
+	if (!canInterruptManQueue())
+		return;
+	static const float liftX[7] = { 531.0f, 824.0f, 1055.0f, 1286.0f, 1517.0f, 1748.0f, 1979.0f };
+	static const float liftY[7] = { 412.0f, 472.0f, 472.0f, 472.0f, 472.0f, 472.0f, 472.0f };
+	float x = 0.0f;
+	float y = 0.0f;
+	int staticsId = ST_MAN_UP;
+	if (lift <= 6) {
+		x = liftX[lift];
+		y = liftY[lift];
+		if (lift == 0)
+			staticsId = ST_MAN_RIGHT;
+	}
+	const Common::Point center = hero()->getCenter();
+	if (fabsf(x - (float)center.x) > 20.0f || fabsf(y - (float)hero()->getCenter().y) > 20.0f ||
+			hero()->_movement || staticsId != hero()->_statics->_staticsId) {
+		if (!_scene->isQueueStarted(QU_SC28_WMN_START) && !_scene->isQueueStarted(QU_WMN_SHOWBEFORE) &&
+				!_scene->isQueueStarted(QU_SC28_ENTERWMN) && !_scene->isQueueStarted(QU_SC28_WORKINSIDE) &&
+				!_scene->isQueueStarted(QU_SC28_WMN_END) && !_scene->isQueueStarted(QU_SC28_LIFT1_END) &&
+				!_scene->isQueueStarted(QU_SC28_LIFT0_FINISH) && !_scene->isQueueStarted(QU_SC28_LIFT0_START)) {
+			if (!_walkQueue || (_lastTargetX - x) > 10.0f || (_lastTargetY - y) > 10.0f) {
+				MessageQueue *queue = mctlStartMove((int)x, (int)y, true, staticsId, false);
+				if (queue)
+					queue->addCommandToEnd(messageCommand("MSG_SC28_CLICKLIFT", 0, 2, Common::String::format("%d", lift).c_str()));
+			}
+		}
+		return;
+	}
+	switch (lift) {
+	case 0: {
+		AniObject *door = _scene->findAniObjectById(ANI_LIFT_28, 0);
+		if (_timer == -1 && door->_statics->_staticsId == ST_LFT28_CLOSED && !door->_movement)
+			doEnterLift0();
+		break;
+	}
+	case 1:
+		doEnterLift1();
+		break;
+	case 2:
+		doEnterLift2();
+		break;
+	case 3:
+		doEnterLift3();
+		break;
+	case 4:
+		doEnterLift4();
+		break;
+	case 5:
+		doEnterLift5();
+		break;
+	case 6:
+		doEnterLift6();
+		break;
+	default:
+		break;
+	}
+}
+
+// CSc28Controller::MakeFaces (18C0A8): the shuffle of the faces is drawn but not used
+void Sc28Controller::makeFaces(MessageQueue *queue) {
+	_scene->findPictureObjectById(PIC_SC28_DARK4, 0)->_flags &= ~4;
+	_pictureToShow = nullptr;
+	if (queue) {
+		Common::Array<uint> faces;
+		faces.push_back(MV_WMN28_IN_1);
+		faces.push_back(MV_WMN28_IN_2);
+		faces.push_back(MV_WMN28_IN_3);
+		faces.push_back(MV_WMN28_IN_4);
+		faces.push_back(MV_WMN28_IN_5);
+		for (int i = 5; i != 0; --i)
+			faces.remove_at((uint32)(faces.size() * random31()) >> 31);
+	}
+}
+
+// CSc28Controller::OnSceneInit (18C174)
+void Sc28Controller::onSceneInit() {
+	FPController::onSceneInit();
+	_highlight.reset(new Highlight(_scene, PIC_POT_SEL));
+}
+
+// CSc28Controller::OnShow (18C1A0)
+void Sc28Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(8);
+	g_ngi->_chapterManager->setActiveChapter(8);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+		g_ngi->_taskManager->activateTask("GET_POT_SC28");
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_8", true);
+	}
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_potion = _scene->findAniObjectById(ANI_INV_POT, 0);
+	_potionInteraction = getGameLoaderInteractionController()->findInteractionByName("INT_151_1");
+	_potionInteraction->_activity = 0.0f;
+	_flyPending = true;
+	_vtorpersLeft = true;
+	_pictureToHide = nullptr;
+	_pictureToShow = nullptr;
+	_headLeft = false;
+	_secondGroup = false;
+	_lift6Inside = false;
+	AniObject *door = _scene->findAniObjectById(ANI_LIFT_28, 0);
+	if (door->_statics->_staticsId == ST_LFT28_OPEN) {
+		door->moveToStaticChain(ST_LFT28_CLOSED);
+		_scene->findPictureObjectById(PIC_SC28_DARK0, 0)->_flags |= 4;
+	}
+	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_28"));
+}
+
+// CSc28Controller::OnHide (18C358)
+void Sc28Controller::onHide() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onHide();
+		return;
+	}
+	hideAction(_scene, ANI_BEARDED_CMN, 1);
+	hideAction(_scene, ANI_BIGHEAD, 0);
+	hideAction(_scene, ANI_TIOTIA, 0);
+	hideAction(_scene, ANI_MAN_28, 0);
+	hideAction(_scene, ANI_WOMAN_28, 0);
+	_flyPack->deleteAllFlies();
+	FPController::onHide();
+}
+
+// CSc28Controller::GetCursorType (18C3B4)
+int Sc28Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (hit) {
+		const uint16 id = hit->_id;
+		if (id == ANI_LIFT || id == ANI_LIFT_28)
+			return 1;
+		if (id == ANI_INV_POT)
+			return 119 - (_potionInteraction->_activity >= 1.0f ? 1 : 0);
+	}
+	return FPController::getCursorType(x, y);
+}
+
+// CSc28Controller::OnUpdate (18C410)
+void Sc28Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	FPController::onUpdate(elapsed);
+	if (_timer != -1) {
+		_timer += elapsed;
+		if (_timer >= _timerLimit) {
+			_timer = -1;
+			MessageQueue *queue = _scene->findMessageQueue(QU_SC28_LIFT0_FINISH);
+			if (queue)
+				_scene->runQueueObject(queue, nullptr, 3);
+		}
+	}
+	if (_pictureToHide) {
+		_pictureToHide->_flags &= ~4;
+		_pictureToHide = nullptr;
+	}
+	if (_pictureToShow) {
+		_pictureToShow->_flags |= 4;
+		_pictureToShow = nullptr;
+	}
+	for (uint i = 0; i < _flyPack->_flies.size(); i++) {
+		GutlFly &fly = _flyPack->_flies[i];
+		if (fly.idleTicks == 1)
+			fly.ani->_z = 15;
+	}
+	const bool active = _potionInteraction->_activity >= 1.0f && (_potion->_flags & 4);
+	_highlight->update(elapsed, active);
+	HitregionObject *region = _potion->_hitregion;
+	float edge = 20.0f;
+	if (_potionInteraction->_activity < 1.0f) {
+		edge = 0.0f;
+		region->_left = 0.0f;
+		region->_top = 0.0f;
+	} else {
+		region->_left = -20.0f;
+		region->_top = -20.0f;
+	}
+	region->_right = edge;
+	region->_bottom = edge;
+	_flyPack->onUpdate(elapsed);
+	for (uint i = 0; i < _flyPack->_flies.size(); i++) {
+		GutlFly &fly = _flyPack->_flies[i];
+		if ((uint)(fly.idleTicks - 1) <= 0x52)
+			fly.ani->_z = 15;
+	}
+}
+
+// CSc28Controller::OnMouseLKeyUp (18C540)
+bool Sc28Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	if (_lift6Inside) {
+		if (!_scene->isQueueStarted(QU_SC28_LIFT6_END))
+			_scene->runQueueWithAni(QU_SC28_LIFT6_END, hero(), 2);
+		_scene->_behaviorController->disableAllMusic();
+		enableSound(SND_MUS_5, true);
+		_lift6Inside = false;
+	}
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (!hit)
+		return FPController::onMouseLKeyUp(id, x, y);
+	if ((uint16)hit->_id != ANI_LIFT && (uint16)hit->_id != ANI_LIFT_28)
+		return FPController::onMouseLKeyUp(id, x, y);
+	onClickLift((uint16)hit->_copyId);
+	resetSwipeParams();
+	return true;
+}
+
+// CSc28Controller::OnMessage (18C5D4)
+void Sc28Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC28_ENDCABIN" || message == "MSG_SC28_ENDLIFT6" || message == "MSG_SC28_ENDLIFT1") {
+		_scene->_behaviorController->enableAllQueuesForAni(hero(), 1);
+		g_ngi->_aniHandler->detachAllObjects();
+		g_ngi->_aniHandler->attachObject(hero()->_id);
+	} else if (message == "MSG_SC28_LIFT6INSIDE") {
+		_lift6Inside = true;
+	} else if (message == "MSG_SC28_LIFT6MUSIC") {
+		_scene->_behaviorController->disableAllMusic();
+		enableSound(SND_MUS_28, true);
+	} else if (message == "MSG_SC28_STARTWORK1") {
+		doStartWork1();
+	} else if (message == "MSG_SC28_MAKEFACES") {
+		makeFaces(queue);
+	} else if (message == "MSG_SC28_LIFT1_SHOWAFTER") {
+		doShowAfter1();
+	} else if (message == "MSG_SC28_CLICKLIFT") {
+		onClickLift(atoi(param.c_str()));
+	} else if (message == "MSG_SC28_TURNON_1") {
+		_pictureToHide = _scene->findPictureObjectById(PIC_SC28_DARK1, 0);
+	} else if (message == "MSG_SC28_TURNOFF_1") {
+		_pictureToShow = _scene->findPictureObjectById(PIC_SC28_DARK1, 0);
+		_pictureToShow->_flags |= 4;
+	} else if (message == "MSG_SC28_TURNON_2") {
+		_pictureToHide = _scene->findPictureObjectById(PIC_SC28_DARK2, 0);
+		tryFlies();
+	} else if (message == "MSG_SC28_TURNOFF_2") {
+		_pictureToShow = _scene->findPictureObjectById(PIC_SC28_DARK2, 0);
+		_pictureToShow->_flags |= 4;
+	} else if (message == "MSG_SC28_TURNON_3") {
+		_pictureToHide = _scene->findPictureObjectById(PIC_SC28_DARK3, 0);
+	} else if (message == "MSG_SC28_TURNOFF_3") {
+		_pictureToShow = _scene->findPictureObjectById(PIC_SC28_DARK3, 0);
+		_pictureToShow->_flags |= 4;
+	} else if (message == "MSG_SC28_TURNON_4") {
+		_pictureToHide = _scene->findPictureObjectById(PIC_SC28_DARK4, 0);
+	} else if (message == "MSG_SC28_TURNOFF_4") {
+		_pictureToShow = _scene->findPictureObjectById(PIC_SC28_DARK4, 0);
+		_pictureToShow->_flags |= 4;
+	} else if (message == "MSG_SC28_TURNON_6") {
+		_pictureToHide = _scene->findPictureObjectById(PIC_SC28_DARK6, 0);
+	} else if (message == "MSG_SC28_TURNOFF_6") {
+		_pictureToShow = _scene->findPictureObjectById(PIC_SC28_DARK6, 0);
+		_pictureToShow->_flags |= 4;
+	} else if (message == "MSG_SC28_TURNON_0") {
+		_pictureToHide = _scene->findPictureObjectById(PIC_SC28_DARK0, 0);
+	} else if (message == "MSG_SC28_TURNOFF_0") {
+		_pictureToShow = _scene->findPictureObjectById(PIC_SC28_DARK0, 0);
+		_pictureToShow->_flags |= 4;
+	} else if (message == "MSG_SC28_TRYVTORPERS") {
+		tryVtorpers();
+	} else if (message == "MSG_SC28_START_TIME") {
+		_timer = 0;
+	} else if (message == "MSG_SC28_STOP_TIME" || (message == "INTERACT_PRESTART" && param == "INT_151_1")) {
+		_timer = -1;
+	} else if (message == "MSG_RESETDEST") {
+		// nothing, the base class does not see it
+	} else if (message == "MSG_DISABLE_HELP_7_1") {
+		g_ngi->_help->disableHelpWithId(PIC_HELP_7_01);
+	} else if (message == "MSG_BREAK_GRIT") {
+		if (interactionCommandNum("INT_351") != -1) {
+			AniObject *grit = _scene->findAniObjectById(ANI_GRIT1, 0);
+			if (grit->_movement)
+				grit->setCurFrame(7, true);
+			else
+				grit->startMovement(MV_GRIT1_FALL, 0, -1);
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc28Controller::UpdateScroll (18C9D4)
+void Sc28Controller::updateScroll() {
+	if (_follow)
+		FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc28controller.h b/engines/ngi/fullpipe/sc28controller.h
new file mode 100644
index 00000000000..7f60895f84a
--- /dev/null
+++ b/engines/ngi/fullpipe/sc28controller.h
@@ -0,0 +1,83 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC28CONTROLLER_H
+#define NGI_FULLPIPE_SC28CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/floaters.h"
+#include "ngi/fullpipe/highlight.h"
+
+namespace NGI {
+
+class Interact;
+class PictureObject;
+
+/** CSc28Controller (lift cabins, flies); sceneHandler28 runs the scene until wired */
+class Sc28Controller : public FPController {
+public:
+	explicit Sc28Controller(int sceneId);
+	~Sc28Controller() override;
+
+	void onSceneInit() override;
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void doStartWork1();
+	void doShowAfter1();
+	void tryFlies();
+	void doEnterLift6();
+	void doEnterLift5();
+	void doEnterLift4();
+	void doEnterLift3();
+	void doEnterLift2();
+	void doEnterLift1();
+	void doEnterLift0();
+	void tryVtorpers();
+	void onClickLift(uint lift);
+	void makeFaces(MessageQueue *queue);
+
+private:
+	PictureObject *_pictureToHide = nullptr; // +216: hidden by the next update
+	PictureObject *_pictureToShow = nullptr; // +220: shown by the next update
+	AniObject *_potion = nullptr; // +224: ANI_INV_POT
+	Interact *_potionInteraction = nullptr; // +228: INT_151_1
+	bool _flyPending = true; // +232: TryFlies adds the flies
+	bool _vtorpersLeft = true; // +233: the side of the second face group
+	bool _headLeft = false; // +234: the side of the first face
+	bool _secondGroup = false; // +235: the next TryVtorpers makes the group
+	bool _lift6Inside = false; // +236: the hero is in the cabin of lift 6
+	Common::ScopedPtr<FlyPack> _flyPack; // +240
+	int _timer = -1; // +244: milliseconds since MSG_SC28_START_TIME, -1 stopped
+	int _timerLimit = 2000; // +248: the queue QU_SC28_LIFT0_FINISH runs when the timer reaches it
+	Common::ScopedPtr<Highlight> _highlight; // +252: PIC_POT_SEL
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC28CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 3cc17fd2edd..6379b7d417d 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -49,6 +49,7 @@
 #include "ngi/fullpipe/sc37controller.h"
 #include "ngi/fullpipe/sc32controller.h"
 #include "ngi/fullpipe/sc26controller.h"
+#include "ngi/fullpipe/sc28controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -111,15 +112,6 @@ void Sc25Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc28Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc28Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc33Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc33Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 74e3200de31..7747a655fa2 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -58,12 +58,6 @@ public:
 	void onShow() override;
 };
 
-class Sc28Controller : public FPController {
-public:
-	explicit Sc28Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc33Controller : public FPController {
 public:
 	explicit Sc33Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/messages.cpp b/engines/ngi/messages.cpp
index 0b5e782e99b..100dbd14aa8 100644
--- a/engines/ngi/messages.cpp
+++ b/engines/ngi/messages.cpp
@@ -167,6 +167,22 @@ void Command::setParamFloat(const char *name, float value) {
 		_z = (int)value;
 }
 
+int Command::getParamInt(const char *name, int defaultValue) const {
+	return _args.contains(name) ? atoi(_args.getVal(name).c_str()) : defaultValue;
+}
+
+void Command::setParamInt(const char *name, int value) {
+	_args[name] = Common::String::format("%d", value);
+	if (!strcmp(name, "x"))
+		_x = value;
+	else if (!strcmp(name, "y"))
+		_y = value;
+	else if (!strcmp(name, "z"))
+		_z = value;
+	else if (!strcmp(name, "copy"))
+		_param = value;
+}
+
 void Command::setObjectCopy(int copyId) {
 	_args["copy"] = Common::String::format("%d", copyId);
 	_param = copyId;
diff --git a/engines/ngi/messages.h b/engines/ngi/messages.h
index d8bfbe4a258..8a94f0970e3 100644
--- a/engines/ngi/messages.h
+++ b/engines/ngi/messages.h
@@ -145,6 +145,10 @@ class Command : public Message {
 	float getParamFloat(const char *name, float defaultValue) const;
 	/** CCommand::SetParamFloat (10F494): sets the attribute and keeps the x, y, z fields in step */
 	void setParamFloat(const char *name, float value);
+	/** CCommand::GetParamInt (10CBF0): the attribute, the default when it has none */
+	int getParamInt(const char *name, int defaultValue) const;
+	/** CCommand::SetParamInt (10F384): sets the attribute and the matching fields */
+	void setParamInt(const char *name, int value);
 	/** CCommand::SetObjectCopy (10F45C): the parameter "copy", and the field of the copy */
 	void setObjectCopy(int copyId);
 	/** Command parameters as CMessageQueue::UpdateCmd* read them: ani, copy (-1 = all), mov */
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index e1b228c69e8..dbb77e0a506 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -124,6 +124,7 @@ MODULE_OBJS = \
 	fullpipe/sc24controller.o \
 	fullpipe/sc26controller.o \
 	fullpipe/sc27controller.o \
+	fullpipe/sc28controller.o \
 	fullpipe/sc29controller.o \
 	fullpipe/sc30controller.o \
 	fullpipe/sc31controller.o \


Commit: 812798e480437ceaf7039171cd4b7ee356264722
    https://github.com/scummvm/scummvm/commit/812798e480437ceaf7039171cd4b7ee356264722
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:48+01:00

Commit Message:
NGI: Port CSc33Controller

Changed paths:
  A engines/ngi/fullpipe/sc33controller.cpp
  A engines/ngi/fullpipe/sc33controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index cfff7e67774..860c6f55808 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1969,4 +1969,10 @@ namespace NGI {
 #define SND_MUS_28 63305
 #define SND_MUS_5 63282
 
+// Android: names of obj.h that the ported controllers use
+#define ST_MUG33_FALL 28021
+#define QU_SC33_MUGFALL 28023
+#define ANI_SC33_TUMBA 28066
+#define ST_SC33_TUMBA_STATE1 28067
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index fa3c0c776f4..98f93b14f05 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -59,6 +59,8 @@ namespace NGI {
 #define sO_In_32_Lies "\xc2_32 \xeb\xe5\xe6\xe8\xf2"	// "В_32 лежит"
 #define sO_In_32_Sticks "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2"	// "В_32 торчит"
 #define sO_In_33 "\xc2_33"	// "Ð’_33"
+#define sO_In_33_OnTap "\xc2_33_\xed\xe0 \xea\xf0\xe0\xed\xe5"	// "В_33_на кране"
+#define sO_In_33_OnFloor "\xc2_33_\xed\xe0 \xef\xee\xeb\xf3"	// "В_33_на полу"
 #define sO_In_7 "\xc2_7"	// "Ð’_7"
 #define sO_Together "\xc2\xe4\xe2\xee\xe5\xec"	// "Вдвоем"
 #define sO_Valve1_26 "\xc2\xe5\xed\xf2\xe8\xeb\xfc\x31_26"	// "Вентиль1_26"
diff --git a/engines/ngi/fullpipe/sc33controller.cpp b/engines/ngi/fullpipe/sc33controller.cpp
new file mode 100644
index 00000000000..780991af468
--- /dev/null
+++ b/engines/ngi/fullpipe/sc33controller.cpp
@@ -0,0 +1,328 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/objects.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/sceneobjects.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/lift.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc33controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc33Controller::CSc33Controller (1917B4)
+Sc33Controller::Sc33Controller(int sceneId) : FPController(sceneId) {
+	static const bool target[9] = { false, false, true, false, false, true, false, false, true };
+	for (int i = 0; i < 9; i++) {
+		_ventOpen[i] = false;
+		_ventTarget[i] = target[i];
+		_ventX[i] = 0;
+	}
+}
+
+// CSc33Controller::~CSc33Controller (19177C)
+Sc33Controller::~Sc33Controller() {
+}
+
+// CSc33Controller::OnHandleDown (191810)
+void Sc33Controller::onHandleDown() {
+	MessageQueue *queue = _scene->findMessageQueue(QU_SC33_STARTWATER);
+	if (queue && !_scene->isQueueRunning(QU_SC33_STARTWATER)) {
+		if (!_jettie->_movement && !_jettie->getMessageQueue())
+			queue->run(3);
+	}
+}
+
+// CSc33Controller::TurnVent (191848)
+void Sc33Controller::turnVent(AniObject *vent) {
+	if (vent->_copyId == 2) {
+		if (isState(sO_Mug, sO_In_33_OnTap)) {
+			if (_scene->findMessageQueue(QU_SC33_MUGFALL))
+				_scene->runQueueWithAni(QU_SC33_MUGFALL, _mug, 2);
+		}
+	}
+	if (vent->_statics->_staticsId == ST_VNT33_DOWN)
+		vent->startMovement(MV_VNT33_TURNR, 0, -1);
+	else if (vent->_statics->_staticsId == ST_VNT33_RIGHT)
+		vent->startMovement(MV_VNT33_TURND, 0, -1);
+	_ventOpen[vent->_copyId] = !_ventOpen[vent->_copyId];
+}
+
+// CSc33Controller::OnClickVent (191934)
+void Sc33Controller::onClickVent(AniObject *vent) {
+	if (vent->_movement)
+		return;
+	turnVent(vent);
+	switch (vent->_copyId) {
+	case 0:
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 2));
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 3));
+		break;
+	case 1:
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 3));
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 4));
+		break;
+	case 2:
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 4));
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 0));
+		break;
+	case 3:
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 0));
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 1));
+		break;
+	case 4:
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 1));
+		turnVent(_scene->findAniObjectById(ANI_VENT_33, 2));
+		break;
+	default:
+		break;
+	}
+}
+
+// CSc33Controller::TestKubikVents (1919EC)
+void Sc33Controller::testKubikVents() {
+	const int x = _kubik->getPosition().x;
+	for (int i = 0; i < 9; i++) {
+		if (((_kubikX - _ventX[i]) ^ (x - _ventX[i])) < 0 && _ventOpen[i] != _ventTarget[i])
+			turnVent(_scene->findAniObjectById(ANI_VENT_33, i));
+	}
+	_kubikX = x;
+}
+
+// CSc33Controller::TryKubik (191A54)
+void Sc33Controller::tryKubik() {
+	if (isState(sO_Cube, sO_In_32))
+		_scene->runQueue(QU_KBK33_GO, 3);
+}
+
+// CSc33Controller::OnPour (191AFC): the original builds the queue with CMessageQueueBuilder
+void Sc33Controller::onPour() {
+	MessageQueue *queue = new MessageQueue(_scene, true, 1);
+	int movementId = MV_JTI33_FLOW;
+	if (_mug->_flags & 4) {
+		if (_mug->_statics->_staticsId == ST_MUG33_EMPTY) {
+			if (!isState(sO_Mug, sO_In_33_OnTap) && !isState(sO_Mug, sO_In_33_OnFloor))
+				movementId = MV_JTI33_POUR;
+		} else if (_mug->_statics->_staticsId == ST_MUG33_FULL) {
+			movementId = MV_JTI33_POURFULL;
+		}
+	}
+	queue->addCommandToEnd(movementCommand(_jettie->_id, movementId, 0, false));
+	_scene->runQueueObject(queue, _jettie, 2);
+}
+
+// CSc33Controller::DoTestMug (191844)
+void Sc33Controller::doTestMug(MessageQueue *queue) {
+}
+
+// CSc33Controller::OnShow (191C94)
+void Sc33Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(9);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_taskManager->activateTask("GET_MUG_FULL_SC33");
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	HitregionObject *region = _scene->findAniObjectById(ANI_HANDLE_L, 0)->_hitregion;
+	if (region) {
+		region->_top = -47.0f;
+		region->_bottom = 0.0f;
+	}
+	AniObject *tumba = _scene->findAniObjectById(ANI_SC33_TUMBA, 0);
+	tumba->setStatic(ST_SC33_TUMBA_STATE1, false);
+	tumba->setPosition(Common::Point(289, 427));
+	tumba->_z = 40;
+	_mug = _scene->findAniObjectById(ANI_MUG_33, 0);
+	_jettie = _scene->findAniObjectById(ANI_JETTIE_FLOW, 0);
+	_kubikX = -1;
+	_kubik = nullptr;
+	_tryInteract = false;
+	if (!(_mug->_flags & 4)) {
+		if (isState(sO_Mug, sO_In_33_OnTap)) {
+			_mug->setStatic(ST_MUG33_EMPTY, false);
+			_mug->setCenter(Common::Point(652, 65));
+			_mug->_flags |= 4;
+		} else if (isState(sO_Mug, sO_In_33_OnFloor)) {
+			_mug->setStatic(ST_MUG33_FALL, false);
+			_mug->setCenter(Common::Point(653, 531));
+			_mug->_flags |= 4;
+		}
+	}
+	for (int i = 0; i < 9; i++)
+		_ventOpen[i] = _ventTarget[i];
+	for (int i = 0; i != 9; i++) {
+		AniObject *vent = _scene->findAniObjectById(ANI_VENT_33, i);
+		if (vent)
+			vent->moveToStaticChain(_ventOpen[i] ? ST_VNT33_RIGHT : ST_VNT33_DOWN);
+	}
+	if (isState(sO_Cube, sO_In_33)) {
+		MessageQueue *queue = copyQueue(_scene, QU_KBK33_START);
+		_scene->runQueueObject(queue, nullptr, 3);
+	}
+	for (int i = 0; i != 9; i++)
+		_ventX[i] = _scene->findAniObjectById(ANI_VENT_33, i)->getPosition().x;
+	if (g_ngi->lift().isButtonEnabled(sO_Level6)) {
+		_scene->_behaviorController->disableAllMusic();
+		enableSound(SND_MUS_19, true);
+	}
+}
+
+// CSc33Controller::OnHide (192068)
+void Sc33Controller::onHide() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onHide();
+		return;
+	}
+	for (int i = 0; i != 9; i++) {
+		AniObject *vent = _scene->findAniObjectById(ANI_VENT_33, i);
+		if (vent && vent->_movement)
+			vent->stopMovement();
+	}
+	FPController::onHide();
+}
+
+// CSc33Controller::GetCursorType (1920A4)
+int Sc33Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (hit && ((uint16)hit->_id == ANI_VENT_33 || hit == _mug))
+		return 1;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc33Controller::OnUpdate (1920E0)
+void Sc33Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	FPController::onUpdate(elapsed);
+	_kubikTimer += elapsed;
+	if (_kubikTimer > 36900)
+		tryKubik();
+	if (_kubik)
+		testKubikVents();
+	if (_tryInteract) {
+		if (!hero()->getMessageQueue() && !hero()->_movement && !_jettie->getMessageQueue() && !_jettie->_movement) {
+			if (_mug->_statics->_staticsId == ST_MUG33_EMPTY) {
+				Interact *interact = getGameLoaderInteractionController()->findInteractionByName("INT_362");
+				getGameLoaderInteractionController()->tryStartInteract(_scene, interact);
+			} else if (_mug->_statics->_staticsId == ST_MUG33_FULL) {
+				Interact *interact = getGameLoaderInteractionController()->findInteractionByName("INT_222");
+				getGameLoaderInteractionController()->tryStartInteract(_scene, interact);
+			}
+			_tryInteract = false;
+		}
+	}
+}
+
+// CSc33Controller::OnMouseLKeyUp (1921E8)
+bool Sc33Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	const bool handled = FPController::onMouseLKeyUp(id, x, y);
+	if (!handled) {
+		GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+		if (hit) {
+			if ((uint16)hit->_id == ANI_VENT_33) {
+				onClickVent(static_cast<AniObject *>(hit));
+			} else if (hit == _mug) {
+				if (_jettie->getMessageQueue()) {
+					_tryInteract = true;
+					mctlStartMove(243, 427, true, ST_MAN_RIGHT, false);
+					return true;
+				}
+				if (!isState(sO_Mug, sO_In_33_OnTap))
+					return _tryInteract;
+				onClickVent(_scene->findAniObjectById(ANI_VENT_33, 2));
+			}
+		}
+	}
+	return _tryInteract || handled;
+}
+
+// CSc33Controller::OnMessage (1922CC)
+void Sc33Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC33_POUR") {
+		onPour();
+	} else if (message == "MSG_SC33_HANDLEDOWN") {
+		onHandleDown();
+	} else if (message == "MSG_SC33_TRYKUBIK") {
+		tryKubik();
+	} else if (message == "MSG_SC32_TRUBATOFRONT") {
+		_scene->findPictureObjectById(PIC_SC33_LTRUBA, 0)->_z = 0;
+	} else if (message == "MSG_SC32_TRUBATOBACK") {
+		_scene->findPictureObjectById(PIC_SC33_LTRUBA, 0)->_z = 20;
+	} else if (message == "MSG_SC33_TESTMUG") {
+		doTestMug(queue);
+	} else if (message == "MSG_SC33_UPDATEKUBIK") {
+		_kubik = _scene->findAniObjectById(ANI_KUBIK, 0);
+		if (_kubik)
+			_kubikX = _kubik->getPosition().x;
+	} else if (message == "MSG_HIDE_MUG") {
+		_mug->_flags &= ~4;
+	} else if (message == "MSG_SC33_ACTIVATE_USE_CACTUS") {
+		if (!g_ngi->_taskManager->isTaskActivated("USE_DEVICE_SC32"))
+			g_ngi->_taskManager->activateTask("USE_CACTUS_SC32");
+	} else if (message == "MSG_BREAK_GRIT") {
+		if (interactionCommandNum("INT_357") != -1) {
+			AniObject *grit = _scene->findAniObjectById(ANI_GRIT2, 0);
+			if (grit->_movement)
+				grit->setCurFrame(9, true);
+			else
+				grit->startMovement(MV_GRIT2_FALL, 0, -1);
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc33Controller::UpdateScroll (192540)
+void Sc33Controller::updateScroll() {
+	if (_follow)
+		FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc33controller.h b/engines/ngi/fullpipe/sc33controller.h
new file mode 100644
index 00000000000..13ec63053f5
--- /dev/null
+++ b/engines/ngi/fullpipe/sc33controller.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC33CONTROLLER_H
+#define NGI_FULLPIPE_SC33CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc33Controller (mug, valves, cube); sceneHandler33 runs the scene until wired */
+class Sc33Controller : public FPController {
+public:
+	explicit Sc33Controller(int sceneId);
+	~Sc33Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void onHandleDown();
+	void turnVent(AniObject *vent);
+	void onClickVent(AniObject *vent);
+	void testKubikVents();
+	void tryKubik();
+	void onPour();
+	void doTestMug(MessageQueue *queue);
+
+private:
+	bool _ventOpen[9]; // +215: the valves as the player left them (1 = right)
+	bool _ventTarget[9]; // +224: the valves that let the cube pass
+	int _ventX[9]; // +244: x of the valves
+	AniObject *_mug = nullptr; // +280: ANI_MUG_33
+	AniObject *_jettie = nullptr; // +284: ANI_JETTIE_FLOW
+	AniObject *_kubik = nullptr; // +288: ANI_KUBIK
+	int _kubikX = -1; // +292: x of the cube at the last test
+	int _kubikTimer = 0; // +296: ms, the cube is tried at 36900
+	bool _tryInteract = false; // +300: the hero walks to the mug, then the interaction starts
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC33CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 6379b7d417d..55bd3fb492c 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -50,6 +50,7 @@
 #include "ngi/fullpipe/sc32controller.h"
 #include "ngi/fullpipe/sc26controller.h"
 #include "ngi/fullpipe/sc28controller.h"
+#include "ngi/fullpipe/sc33controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -112,15 +113,6 @@ void Sc25Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc33Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc33Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc34Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc34Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 7747a655fa2..b62fa10655b 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -58,12 +58,6 @@ public:
 	void onShow() override;
 };
 
-class Sc33Controller : public FPController {
-public:
-	explicit Sc33Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc34Controller : public FPController {
 public:
 	explicit Sc34Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index dbb77e0a506..b02033ccec4 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -129,6 +129,7 @@ MODULE_OBJS = \
 	fullpipe/sc30controller.o \
 	fullpipe/sc31controller.o \
 	fullpipe/sc32controller.o \
+	fullpipe/sc33controller.o \
 	fullpipe/sc35controller.o \
 	fullpipe/sc36controller.o \
 	fullpipe/sc37controller.o \


Commit: d43cd125ceb847e09284f7759556c3fe504a9f5b
    https://github.com/scummvm/scummvm/commit/d43cd125ceb847e09284f7759556c3fe504a9f5b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port CSc22Controller

Changed paths:
  A engines/ngi/fullpipe/sc22controller.cpp
  A engines/ngi/fullpipe/sc22controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 860c6f55808..7ebaad85f0f 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1975,4 +1975,8 @@ namespace NGI {
 #define ANI_SC33_TUMBA 28066
 #define ST_SC33_TUMBA_STATE1 28067
 
+// Android: names of obj.h that the ported controllers use
+#define PIC_INV_STOOL 1785
+#define PIC_INV_BOX 866
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 98f93b14f05..0c2c45d519e 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -27,6 +27,7 @@
 namespace NGI {
 
 #define sO_Grandma "\xc1\xe0\xe1\xf3\xeb\xff"	// "Бабуля"
+#define sO_GrandmaAndStool "\xc1\xe0\xe1\xf3\xeb\xff \xe8 \xf2\xe0\xe1\xf3\xf0\xe5\xf2"	// "Бабуля и табурет"
 #define sO_Jar_4 "\xc1\xe0\xed\xea\xe0_4"	// "Банка_4"
 #define sO_Pool "\xc1\xe0\xf1\xf1\xe5\xe9\xed"	// "Бассейн"
 #define sO_TummyTrampie "\xc1\xe0\xf2\xf3\xf2\xe0"	// "Батута"
@@ -45,6 +46,7 @@ namespace NGI {
 #define sO_Awaken "\xc1\xee\xe4\xf0\xf1\xf2\xe2\xf3\xe5\xf2"	// "Бодрствует"
 #define sO_Boot_15 "\xc1\xee\xf2\xe8\xed\xee\xea_15"	// "Ботинок_15"
 #define sO_Bottle_38 "\xc1\xf3\xf2\xfb\xeb\xea\xe0_38"	// "Бутылка_38"
+#define sO_WereInterrupted "\xc1\xfb\xeb\xe8 \xef\xf0\xe5\xf0\xe2\xe0\xed\xfb"	// "Были прерваны"
 #define sO_Fast "\xc1\xfb\xf1\xf2\xf0\xfb\xe9"	// "Быстрый"
 #define sO_InSmokeRoom "\xc2 \xea\xf3\xf0\xe8\xeb\xea\xe5"	// "В курилке"
 #define sO_InSock "\xc2 \xed\xee\xf1\xea\xe5"	// "В носке"
diff --git a/engines/ngi/fullpipe/sc22controller.cpp b/engines/ngi/fullpipe/sc22controller.cpp
new file mode 100644
index 00000000000..87257e9f4ff
--- /dev/null
+++ b/engines/ngi/fullpipe/sc22controller.cpp
@@ -0,0 +1,433 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/objects.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/inventory.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/sceneobjects.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc22controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc22Controller::CSc22Controller (181430)
+Sc22Controller::Sc22Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc22Controller::~CSc22Controller (1813D0)
+Sc22Controller::~Sc22Controller() {
+}
+
+// CSc22Controller::CleanXml (18139A)
+void Sc22Controller::cleanXml() {
+	_onStool = false;
+	_busy = false;
+}
+
+// CSc22Controller::CanSwipeMan (1813AC)
+bool Sc22Controller::canSwipeMan(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::canSwipeMan(x, y);
+	return !_busy;
+}
+
+// CSc22Controller::CheckConditions (181474)
+void Sc22Controller::checkConditions() {
+	_craneEnabled = _handleCount <= 1;
+	if (_craneEnabled) {
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_CRANEOUT)->setEnabled(true);
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_MOVE)->setEnabled(false);
+	} else {
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_CRANEOUT)->setEnabled(false);
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_MOVE)->setEnabled(true);
+	}
+	_craneEnabled = false;
+}
+
+// CSc22Controller::DoShowStool (1814E4)
+void Sc22Controller::doShowStool() {
+	_scene->runQueue(QU_SC22_SHOWSTOOL, 2);
+}
+
+// CSc22Controller::DoHideStool (1814F8)
+void Sc22Controller::doHideStool() {
+	_scene->findAniObjectById(ANI_TABURETTE, 0)->_flags &= ~4;
+}
+
+// CSc22Controller::OnHandleDown (18151C)
+void Sc22Controller::onHandleDown() {
+	if (_sack->_statics->_staticsId == ST_MSH_SIT) {
+		_scene->runQueueWithAni(QU_MSH_CRANEOUT, hero(), 2);
+		_busy = false;
+	} else {
+		_handleCount++;
+		int queueId;
+		if (_handleCount == 2) {
+			_scene->runQueueWithAni(QU_SC22_FALLBROOM, hero(), 2);
+			g_ngi->_taskManager->deactivateTask("USE_DEVICE_SC22");
+			g_ngi->_taskManager->activateTask("GET_COIN_SC21");
+			queueId = QU_SC22_FALLSACK_GMA;
+		} else {
+			queueId = QU_SC22_FALLSACK;
+		}
+		_scene->runQueueWithAni(queueId, hero(), 2);
+		if (_handleCount == 1)
+			g_ngi->setState(sO_Bag_22, g_ngi->getStateValue(sO_Bag_22, sO_FallenOnce));
+		else if (_handleCount == 2)
+			g_ngi->setState(sO_Bag_22, g_ngi->getStateValue(sO_Bag_22, sO_FallenTwice));
+		else if (_handleCount != 0)
+			g_ngi->setState(sO_Bag_22, g_ngi->getStateValue(sO_Bag_22, sO_BrushHasFallen));
+		else
+			g_ngi->setState(sO_Bag_22, g_ngi->getStateValue(sO_Bag_22, sO_NotFallen));
+	}
+	checkConditions();
+}
+
+// CSc22Controller::OnMouseDown (1816E8)
+void Sc22Controller::onMouseDown() {
+	if (hero()->getMessageQueue())
+		return;
+	MessageQueue *queue = copyQueue(_scene, QU_SC22_FROMSTOOL);
+	queue->addCommandToEnd(messageCommand("MSG_SC22_CLICK"));
+	queue->setIntState(2);
+	if (!_scene->runQueueObject(queue, nullptr, 2)) {
+		// CLogger::WriteLog(1, ...)
+		warning("sc22::OnMouseDown: m_scene->RunQueue returned false!");
+	}
+}
+
+// CSc22Controller::OnClickHandle (1817C8)
+void Sc22Controller::onClickHandle(bool fromQueue) {
+	MessageQueue *heroQueue = hero()->getMessageQueue();
+	if (heroQueue && heroQueue->getCount() && fromQueue) {
+		Command *last = heroQueue->getCommandByIndex(heroQueue->getCount() - 1);
+		const Common::String msg = last->_args.getValOrDefault("msg", "");
+		if (msg == "MSG_SC22_CLICKSTOOL") {
+			Scene *inventoryScene = g_ngi->findScene(SC_INV);
+			PictureObject *picture = inventoryScene ? inventoryScene->findPictureObjectById(last->getParamInt("inv", 0), 0) : nullptr;
+			g_ngi->_inputController->setObject(picture, 0, 0);
+		}
+		if (msg == "MSG_SC22_CLICKHANDLE" || msg == "MSG_SC22_CLICKSTOOL") {
+			if (heroQueue->getCurCommandNum() == (int)heroQueue->getCount() - 2) {
+				heroQueue->interrupt(false);
+				hero()->setQueue(nullptr);
+			}
+		}
+	}
+	if (hero()->getMessageQueue() && canInterruptManQueue() && !_busy) {
+		hero()->getMessageQueue()->interrupt(false);
+		hero()->stopMovement();
+		hero()->setQueue(nullptr);
+		if (_interactionQueue)
+			_interactionQueue->interrupt(false);
+		if (_walkQueue)
+			_walkQueue->interrupt(false);
+		checkQueues();
+	}
+	if (hero()->getMessageQueue())
+		return;
+
+	CursorController *cursor = g_ngi->_inputController;
+	if (cursor->getObjectId() == PIC_INV_STOOL) {
+		const Common::Point center = hero()->getCenter();
+		if (fabsf(841.0f - (float)center.x) <= 3.0f && fabsf(449.0f - (float)hero()->getCenter().y) <= 3.0f &&
+				hero()->_statics->_staticsId == ST_MAN_RIGHT) {
+			setSaving(false);
+			g_ngi->_inventory->removeItem("ANI_INV_STOOL", -1);
+			if (!_scene->runQueueWithAni(QU_SC22_PUTSTOOL, hero(), 2)) {
+				// CLogger::WriteLog(1, ...)
+				warning("sc22::OnClickHandle: m_scene->RunQueue returned false!");
+			}
+			_busy = true;
+			return;
+		}
+		MessageQueue *queue = mctlStartMove(841, 449, true, ST_MAN_RIGHT, false);
+		if (queue) {
+			Command *command = messageCommand("MSG_SC22_CLICKSTOOL");
+			command->setParamInt("inv", PIC_INV_STOOL);
+			queue->addCommandToEnd(command);
+			queue->setIntState(2);
+		}
+		return;
+	}
+	if (cursor->getObjectId() == PIC_INV_BOX) {
+		AniObject *stool = _scene->findAniObjectById(ANI_TABURETTE, 0);
+		if (stool && (stool->_flags & 4))
+			return;
+		const Common::Point center = hero()->getCenter();
+		if (fabsf(841.0f - (float)center.x) <= 3.0f && fabsf(449.0f - (float)hero()->getCenter().y) <= 3.0f &&
+				hero()->_statics->_staticsId == ST_MAN_UP) {
+			_scene->runQueueWithAni(QU_SC22_TRYBOX, hero(), 2);
+			cursor->setObject(nullptr, 0, 0);
+			return;
+		}
+		MessageQueue *queue = mctlStartMove(841, 449, true, ST_MAN_UP, false);
+		if (!queue)
+			return;
+		Command *command = messageCommand("MSG_SC22_CLICKSTOOL");
+		command->setParamInt("inv", PIC_INV_BOX);
+		queue->addCommandToEnd(command);
+		return;
+	}
+	if (cursor->getObjectId() != 0)
+		return;
+	if (_onStool) {
+		if (hero()->_movement)
+			return;
+		if (!_scene->runQueueWithAni(QU_SC22_HANDLEDOWN, hero(), 2)) {
+			// CLogger::WriteLog(1, ...)
+			warning("sc22::OnClickHandle: m_scene->RunQueue returned false!");
+		}
+		_busy = true;
+		return;
+	}
+	if (_stool && (_stool->_flags & 4)) {
+		const Common::Point center = hero()->getCenter();
+		if (fabsf(841.0f - (float)center.x) > 15.0f || fabsf(449.0f - (float)hero()->getCenter().y) > 15.0f ||
+				hero()->_statics->_staticsId != ST_MAN_RIGHT) {
+			MessageQueue *queue = mctlStartMove(841, 449, true, ST_MAN_RIGHT, false);
+			if (!queue)
+				return;
+			queue->addCommandToEnd(messageCommand("MSG_SC22_CLICKHANDLE"));
+			return;
+		}
+		if (!_scene->runQueueWithAni(QU_SC22_TOSTOOL, hero(), 2)) {
+			// CLogger::WriteLog(1, ...)
+			warning("sc22::OnClickHandle: m_scene->RunQueue returned false!");
+		}
+		_busy = true;
+		return;
+	}
+	const Common::Point center = hero()->getCenter();
+	if (fabsf(1010.0f - (float)center.x) > 15.0f || fabsf(443.0f - (float)hero()->getCenter().y) > 15.0f ||
+			hero()->_statics->_staticsId != ST_MAN_UP) {
+		MessageQueue *queue = mctlStartMove(1010, 443, true, ST_MAN_UP, false);
+		if (!queue)
+			return;
+		queue->addCommandToEnd(messageCommand("MSG_SC22_CLICKHANDLE"));
+		return;
+	}
+	if (!_scene->runQueueWithAni(QU_SC22_TRYHANDLE, hero(), 2)) {
+		// CLogger::WriteLog(1, ...)
+		warning("sc22::OnClickHandle: m_scene->RunQueue returned false!");
+	}
+}
+
+// CSc22Controller::OnShow (181FD0)
+void Sc22Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	HitregionObject *region = _scene->findAniObjectById(ANI_HANDLE_L, 0)->_hitregion;
+	if (region)
+		region->_bottom = 30.0f;
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+		g_ngi->_taskManager->activateTask("REPAIR_DEVICE_SC22");
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_sack = _scene->findAniObjectById(ANI_MESHOK, 0);
+	_giraffe = _scene->findAniObjectById(ANI_GIRAFFE_MIDDLE, 0);
+	_stool = _scene->findAniObjectById(ANI_TABURETTE, 0);
+	_scene->findAniObjectById(ANI_HANDLE_L, 0)->_flags |= 4;
+	_busy = false;
+	_onStool = false;
+	_craneEnabled = true;
+	if (isState(sO_Bag_22, sO_NotFallen)) {
+		_handleCount = 0;
+	} else if (isState(sO_Bag_22, sO_FallenOnce)) {
+		_handleCount = 1;
+	} else if (isState(sO_Bag_22, sO_FallenTwice)) {
+		_handleCount = 2;
+	} else if (isState(sO_GrandmaAndStool, sO_WereInterrupted)) {
+		_scene->_x = 450;
+		_scene->runQueueWithAni(QU_SC22_FALLSACK_GMA, hero(), 2);
+	} else {
+		_sack->_flags &= ~4;
+		_stool->_flags &= ~4;
+		_handleCount = 2;
+		_craneEnabled = false;
+	}
+	_giraffe->moveToStaticChain(isState(sO_LowerPipe_21, sO_IsOpened) ? ST_GRFM_AFTER : ST_GRFM_NORM);
+	if (isState(sO_LowerPipe_21, sO_IsOpened)) {
+		_scene->_behaviorController->enableAllMusic();
+		_musicPlaying = false;
+	} else if (isState(sO_CoinSlot_22, sO_IsFull)) {
+		_scene->_behaviorController->disableAllMusic();
+		if (isSoundPlayed(SND_MUS_SC04_LOOP)) {
+			warnOnce("CSound::Attenuate with the music volume and pan 50 is not ported");
+		} else {
+			warnOnce("CSoundManager::Play with the music volume and pan 50 is not ported (plays at full volume)");
+			g_ngi->playSound(SND_MUS_SC04_START, 0);
+		}
+		_musicPlaying = true;
+	} else {
+		_scene->_behaviorController->enableAllMusic();
+		_musicPlaying = false;
+	}
+	enableSound(SND_MUS_19, isState(sO_LowerHatch_23, sO_Opened));
+	if (_craneEnabled) {
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_CRANEOUT)->setEnabled(true);
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_MOVE)->setEnabled(false);
+	} else {
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_CRANEOUT)->setEnabled(false);
+		_scene->_behaviorController->getAniQueue(_sack->_id, QU_MSH_MOVE)->setEnabled(true);
+	}
+}
+
+// CSc22Controller::OnHide (182498)
+void Sc22Controller::onHide() {
+	FPController::onHide();
+	if (!controllerRunsSceneLogic())
+		return;
+	setSaving(true);
+}
+
+// CSc22Controller::GetCursorType (1824B0)
+int Sc22Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	CursorController *cursor = g_ngi->_inputController;
+	if (!cursor->isObjectHit(ANI_HANDLE_L))
+		return FPController::getCursorType(x, y);
+	if (!cursor->getObject())
+		return 1;
+	if (_onStool)
+		return FPController::getCursorType(x, y);
+	if (cursor->getObjectId() != PIC_INV_STOOL && cursor->getObjectId() != PIC_INV_BOX)
+		return FPController::getCursorType(x, y);
+	return 102;
+}
+
+// CSc22Controller::OnUpdate (182518)
+void Sc22Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	if (_musicPlaying) {
+		if (!isSoundPlayed(SND_MUS_SC04_START) && !isSoundPlayed(SND_MUS_SC04_LOOP) &&
+				!isSoundPlayed(SND_MUS_SC04_STOP1) && !isSoundPlayed(SND_MUS_SC04_STOP2)) {
+			warnOnce("CSoundManager::Play with the music volume and pan 50 is not ported (plays at full volume)");
+			if (_hammerKicked) {
+				_musicPlaying = false;
+				_hammerKicked = false;
+				g_ngi->playSound(SND_MUS_SC04_STOP2, 0);
+			} else {
+				g_ngi->playSound(SND_MUS_SC04_LOOP, 0);
+			}
+		}
+	} else if (!isSoundPlayed(SND_MUS_SC04_STOP2) && !isSoundPlayed(SND_MUS_SC04_LOOP)) {
+		_scene->_behaviorController->enableAllMusic();
+	}
+	FPController::onUpdate(elapsed);
+}
+
+// CSc22Controller::OnMouseLKeyUp (182624)
+bool Sc22Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+	const bool handled = FPController::onMouseLKeyUp(id, x, y);
+	if (!handled) {
+		GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+		if (hit && hit->_id == ANI_HANDLE_L && hit->_copyId == 0) {
+			onClickHandle(false);
+			return true;
+		}
+		if (_onStool && hero()->_statics->_staticsId == ST_MAN_RIGHT && !hero()->_movement)
+			onMouseDown();
+	}
+	return handled;
+}
+
+// CSc22Controller::OnMessage (182688)
+void Sc22Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC22_CLICKSTOOL" || message == "MSG_SC22_CLICKHANDLE") {
+		onClickHandle(true);
+	} else if (message == "MSG_SC22_HANDLEDOWN") {
+		onHandleDown();
+	} else if (message == "MSG_SHOW_INV_STOOL") {
+		g_ngi->_inventory->getItemByName("ANI_INV_STOOL")->setState(0);
+	} else if (message == "MSG_SC22_ONSTOOL") {
+		_onStool = true;
+		_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+	} else if (message == "MSG_SC22_FROMSTOOL") {
+		_onStool = false;
+		_busy = false;
+		_scene->_behaviorController->enableAllQueuesForAni(hero(), 1);
+	} else if (message == "MSG_SC22_SHOWSTOOL") {
+		doShowStool();
+	} else if (message == "MSG_SC22_HIDESTOOL") {
+		doHideStool();
+	} else if (message == "MSG_SC22_CHECKGMABOOT") {
+		// nothing, the base class does not see it
+	} else if (message == "MSG_SC22_CRANEOUT_GMA") {
+		_scene->runQueue(QU_MSH_CRANEOUT_GMA, 2);
+	} else if (message == "MSG_SC21_UPDATEASS") {
+		g_ngi->findScene(SC_21)->message(message, param, queue);
+	} else if (message == "MSG_SC22_PLAY_MUSIC") {
+		_scene->_behaviorController->disableAllMusic();
+		warnOnce("CSoundManager::Play with the music volume and pan 50 is not ported (plays at full volume)");
+		g_ngi->playSound(SND_MUS_SC04_START, 0);
+		_musicPlaying = true;
+	} else if (message == "MSG_SC22_OPEN_LUK") {
+		enableSound(SND_MUS_19, true);
+	} else if (message == "MSG_HMRKICK_METAL") {
+		_hammerKicked = true;
+		g_ngi->stopAllSoundInstances(SND_MUS_SC04_START);
+		g_ngi->stopAllSoundInstances(SND_MUS_SC04_LOOP);
+	} else if (message == "MSG_MUSIC_VOL_CHANGED") {
+		warnOnce("CSc22Controller::OnMessage MSG_MUSIC_VOL_CHANGED: CSound::Attenuate with the music volume is not ported");
+	} else if (message == "MSG_DISABLESAVES") {
+		setSaving(false);
+	} else if (message == "MSG_ENABLESAVES") {
+		setSaving(true);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc22Controller::UpdateScroll (182A24)
+void Sc22Controller::updateScroll() {
+	if (_follow)
+		FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc22controller.h b/engines/ngi/fullpipe/sc22controller.h
new file mode 100644
index 00000000000..030c5f3df70
--- /dev/null
+++ b/engines/ngi/fullpipe/sc22controller.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC22CONTROLLER_H
+#define NGI_FULLPIPE_SC22CONTROLLER_H
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc22Controller (sack, stool, handle); sceneHandler22 runs the scene until wired */
+class Sc22Controller : public FPController {
+public:
+	explicit Sc22Controller(int sceneId);
+	~Sc22Controller() override;
+
+	void cleanXml() override;
+	bool canSwipeMan(float x, float y) override;
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void checkConditions();
+	void doShowStool();
+	void doHideStool();
+	bool trySwitchUp() { return false; }
+	bool trySwitchDown() { return false; }
+	void onHandleDown();
+	void onMouseDown();
+	void onClickHandle(bool fromQueue);
+
+private:
+	bool _onStool = false; // +215: the hero stands on the stool
+	int _handleCount = 0; // +216: how often the handle was pushed
+	bool _craneEnabled = true; // +220: the crane queues of the sack are enabled
+	AniObject *_sack = nullptr; // +224: ANI_MESHOK
+	AniObject *_giraffe = nullptr; // +228: ANI_GIRAFFE_MIDDLE
+	AniObject *_stool = nullptr; // +232: ANI_TABURETTE
+	bool _busy = false; // +236: the hero works with the stool or the handle
+	bool _musicPlaying = false; // +244: the music of the coin slot plays
+	bool _hammerKicked = false; // +245: the hammer hit the metal, the end of the music is due
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC22CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 55bd3fb492c..23873ba2f22 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -51,6 +51,7 @@
 #include "ngi/fullpipe/sc26controller.h"
 #include "ngi/fullpipe/sc28controller.h"
 #include "ngi/fullpipe/sc33controller.h"
+#include "ngi/fullpipe/sc22controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -86,15 +87,6 @@ void Sc19Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc22Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc22Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc23Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc23Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index b62fa10655b..0593996e27e 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -40,12 +40,6 @@ public:
 	void onShow() override;
 };
 
-class Sc22Controller : public FPController {
-public:
-	explicit Sc22Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 class Sc23Controller : public FPController {
 public:
 	explicit Sc23Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index b02033ccec4..6b065f0e760 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -121,6 +121,7 @@ MODULE_OBJS = \
 	fullpipe/sc17controller.o \
 	fullpipe/sc20controller.o \
 	fullpipe/sc21controller.o \
+	fullpipe/sc22controller.o \
 	fullpipe/sc24controller.o \
 	fullpipe/sc26controller.o \
 	fullpipe/sc27controller.o \


Commit: 254ad72c59f0b8f16bea2038b0a38ecd0302845e
    https://github.com/scummvm/scummvm/commit/254ad72c59f0b8f16bea2038b0a38ecd0302845e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port CSc34Controller

Changed paths:
  A engines/ngi/fullpipe/sc34controller.cpp
  A engines/ngi/fullpipe/sc34controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/objectnames.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 7ebaad85f0f..4f9a8f4352e 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1979,4 +1979,8 @@ namespace NGI {
 #define PIC_INV_STOOL 1785
 #define PIC_INV_BOX 866
 
+// Android: names of obj.h that the ported controllers use
+#define ANI_BOARD_34 2506
+#define ST_BRD34_RIGHT 2509
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/objectnames.h b/engines/ngi/fullpipe/objectnames.h
index 0c2c45d519e..5cc66cf9c39 100644
--- a/engines/ngi/fullpipe/objectnames.h
+++ b/engines/ngi/fullpipe/objectnames.h
@@ -81,9 +81,11 @@ namespace NGI {
 #define sO_Off "\xc2\xfb\xea\xeb"	// "Выкл"
 #define sO_TurnedOff "\xc2\xfb\xea\xeb\xfe\xf7\xe5\xed"	// "Выключен"
 #define sO_HasGrown "\xc2\xfb\xf0\xee\xf1"	// "Вырос"
+#define sO_Grew "\xc2\xfb\xf0\xee\xf1"	// "Вырос"
 #define sO_Boss "\xc3\xeb\xe0\xe2\xe0\xf0\xfc"	// "Главарь"
 #define sO_Jug "\xc3\xee\xf0\xf8\xee\xea"	// "Горшок"
 #define sO_Strolling "\xc3\xf3\xeb\xff\xe5\xf2"	// "Гуляет"
+#define sO_Walking "\xc3\xf3\xeb\xff\xe5\xf2"	// "Гуляет"
 #define sO_Yes "\xc4\xe0"	// "Да"
 #define sO_FarAway "\xc4\xe0\xeb\xe5\xea\xee"	// "Далеко"
 #define sO_Girl "\xc4\xe5\xe2\xee\xf7\xea\xe0"	// "Девочка"
@@ -91,6 +93,7 @@ namespace NGI {
 #define sO_Grandpa "\xc4\xe5\xe4\xf3\xf8\xea\xe0"	// "Дедушка"
 #define sO_Board_25 "\xc4\xee\xf1\xea\xe0_25"	// "Доска_25"
 #define sO_Plank_34 "\xc4\xee\xf1\xea\xe0_34"	// "Доска_34"
+#define sO_Board_34 "\xc4\xee\xf1\xea\xe0_34"	// "Доска_34"
 #define sO_DudeHasJumped "\xc4\xff\xe4\xff \xef\xf0\xfb\xe3\xe0\xeb"	// "Дядя прыгал"
 #define sO_Dude "\xc4\xff\xe4\xff"	// "Дядя"
 #define sO_GuvTheDrawer "\xc4\xff\xe4\xff-\xff\xf9\xe8\xea"	// "Дядя-ящик"
diff --git a/engines/ngi/fullpipe/sc34controller.cpp b/engines/ngi/fullpipe/sc34controller.cpp
new file mode 100644
index 00000000000..63578847b28
--- /dev/null
+++ b/engines/ngi/fullpipe/sc34controller.cpp
@@ -0,0 +1,457 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/objects.h"
+#include "ngi/anihandler.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/inventory.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/lift.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc34controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc34Controller::CSc34Controller (192798)
+Sc34Controller::Sc34Controller(int sceneId) : FPController(sceneId), _flyPack(new FlyPack()) {
+}
+
+// CSc34Controller::~CSc34Controller (192594): the fly pack goes with it
+Sc34Controller::~Sc34Controller() {
+}
+
+// CSc34Controller::CleanXml (19254E)
+void Sc34Controller::cleanXml() {
+	_climbed = false;
+	_onBoard = false;
+	_onCactus = false;
+}
+
+// CSc34Controller::CanSwipeMan (19255E)
+bool Sc34Controller::canSwipeMan(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::canSwipeMan(x, y);
+	if (_onCactus)
+		return false;
+	return !_onBoard;
+}
+
+// CSc34Controller::DoShowBox (192808)
+void Sc34Controller::doShowBox() {
+	_stool->moveToStaticChain(ST_STL34_BOX2);
+	_scene->findAniObjectById(ANI_STOOL_34, 0)->setPosition(Common::Point(919, 410));
+}
+
+// CSc34Controller::DoHideStool (192844)
+void Sc34Controller::doHideStool() {
+	_stool->_flags &= ~4;
+}
+
+// CSc34Controller::OnShowVent (192854)
+void Sc34Controller::onShowVent() {
+	if (_vent->_statics->_staticsId == ST_VNT34_UP2)
+		_vent->setStatic(ST_VNT34_RIGHT3, false);
+	else if (_vent->_statics->_staticsId == ST_VNT34_RIGHT3)
+		_vent->setStatic(ST_VNT34_UP2, false);
+	_vent->_flags |= 4;
+}
+
+// CSc34Controller::StartFly (192898)
+void Sc34Controller::startFly() {
+	_flyPack->addFly(_scene, 1072, -50, 100, 6);
+	GutlFly &fly = _flyPack->_flies.back();
+	fly.countdown = 1;
+	fly.exitX = 1072;
+	fly.exitY = -50;
+	_flyTimer = scaledRandom(41500) + 41500;
+}
+
+// CSc34Controller::CheckBoard (192908)
+void Sc34Controller::checkBoard() {
+	if (isState(sO_Grandma, sO_AtPipeWithStool)) {
+		if (isState(sO_Hatch_34, sO_Closed))
+			g_ngi->setState(sO_Board_34, g_ngi->getStateValue(sO_Board_34, sO_ClosedWithBoot));
+		else
+			g_ngi->setState(sO_Board_34, g_ngi->getStateValue(sO_Board_34, sO_OpenedWithBoot));
+	} else if (!isState(sO_Grandma, sO_OnStool)) {
+		g_ngi->setState(sO_Board_34, g_ngi->getStateValue(sO_Board_34, sO_Passive));
+	} else if (isState(sO_Hatch_34, sO_Closed)) {
+		g_ngi->setState(sO_Board_34, g_ngi->getStateValue(sO_Board_34, sO_IsClosed));
+	} else {
+		g_ngi->setState(sO_Board_34, g_ngi->getStateValue(sO_Board_34, sO_IsOpened));
+	}
+}
+
+// CSc34Controller::OnCactusMouseDown (192B54): the original drops the mouse command it makes
+bool Sc34Controller::onCactusMouseDown(float x, float y) {
+	if (hero()->_movement || _cactus->_movement)
+		return false;
+	if (hero()->getMessageQueue())
+		return false;
+	MessageQueue *queue = copyQueue(_scene, QU_SC34_FROMCACTUS);
+	delete createMouseCommand(_scene, x, y, g_ngi->_inputController->getObjectId());
+	_scene->runQueueObject(queue, hero(), 4);
+	return true;
+}
+
+// CSc34Controller::OnUnclimb (192BD0)
+void Sc34Controller::onUnclimb() {
+	_scene->_motionController->activate();
+	getGameLoaderInteractionController()->_enabled = true;
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), 1);
+	_climbed = false;
+	_savedX = g_ngi->_inputController->_hotSceneX;
+	_savedY = g_ngi->_inputController->_hotSceneY;
+}
+
+// CSc34Controller::OnStandBoard (192C06)
+void Sc34Controller::onStandBoard() {
+	_scene->_motionController->deactivate();
+	getGameLoaderInteractionController()->_enabled = false;
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+	_onBoard = true;
+}
+
+// CSc34Controller::OnLeaveBoard (192C2E)
+void Sc34Controller::onLeaveBoard() {
+	_scene->_motionController->activate();
+	getGameLoaderInteractionController()->_enabled = true;
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), 1);
+	_onBoard = false;
+}
+
+// CSc34Controller::OnClimb (192C56)
+void Sc34Controller::onClimb() {
+	_scene->_motionController->deactivate();
+	getGameLoaderInteractionController()->_enabled = false;
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+	_climbed = true;
+	g_ngi->_aniHandler->detachAllObjects();
+}
+
+// CSc34Controller::DoShowStool (192C88)
+void Sc34Controller::doShowStool() {
+	if (!_scene->runQueue(QU_SC34_SHOWSTOOL, 4)) {
+		// CLogger::WriteLog(1, ...)
+		warning("sc34::DoShowStool: m_scene->RunQueue returned false!");
+	}
+}
+
+// CSc34Controller::OnTestVent (192CE0)
+void Sc34Controller::onTestVent() {
+	const int movementId = hero()->getLastMovementId();
+	if (movementId == MV_MAN34_TURNVENT_R) {
+		_hatch->setStatic(ST_LUK34_CLOSED, false);
+		if (!_scene->runQueue(QU_LUK34_OPEN, 4)) {
+			// CLogger::WriteLog(1, ...)
+			warning("sc34::OnTestVent: m_scene->RunQueue returned false!");
+		}
+		g_ngi->_taskManager->deactivateTask("USE_VENT_SC34");
+		g_ngi->_taskManager->activateTask("RECONCILE_GRANDMA_SC20");
+	} else if (movementId == MV_MAN34_TURNVENT_L) {
+		_hatch->setStatic(ST_LUK34_OPEN, false);
+		if (!_scene->runQueue(QU_LUK34_CLOSE, 4)) {
+			// CLogger::WriteLog(1, ...)
+			warning("sc34::OnTestVent: m_scene->RunQueue returned false!");
+		}
+		g_ngi->_taskManager->activateTask("USE_VENT_SC34");
+	}
+}
+
+// CSc34Controller::OnMouseDown (192E2C)
+bool Sc34Controller::onMouseDown(float x, float y) {
+	if (hero()->_movement)
+		return false;
+	const Common::Point center = hero()->getCenter();
+	const float heroX = (float)center.x;
+	const float heroY = (float)center.y;
+	AniObject *under = _scene->findAniObjectAtPos((int)x, (int)y);
+	MessageQueue *queue;
+	if (under && under->_id == ANI_VENT_34 && under->_copyId == 0) {
+		if (fabsf(heroX - 887.0f) > 3.0f || fabsf(heroY - 369.0f) > 3.0f) {
+			if (fabsf(heroX - 917.0f) <= 3.0f) {
+				if (fabsf(heroY - 285.0f) <= 3.0f) {
+					if (_vent->_statics->_staticsId == ST_VNT34_UP2)
+						hero()->startMovement(MV_MAN34_TURNVENT_R, 0, -1);
+					else if (_vent->_statics->_staticsId == ST_VNT34_RIGHT3)
+						hero()->startMovement(MV_MAN34_TURNVENT_L, 0, -1);
+				} else if (fabsf(heroY - 344.0f) <= 3.0f) {
+					hero()->startMovement(MV_MAN34_TRY, 0, -1);
+				}
+			}
+		} else {
+			hero()->startMovement(MV_MAN34_TRYTABUR, 0, -1, false, false, false, -1);
+		}
+		return false;
+	}
+	if (fabsf(heroX - 887.0f) <= 3.0f && fabsf(heroY - 369.0f) <= 3.0f) {
+		queue = copyQueue(_scene, QU_SC34_FROMSTOOL);
+	} else {
+		if (fabsf(heroX - 917.0f) > 3.0f)
+			return false;
+		if (fabsf(heroY - 285.0f) <= 3.0f) {
+			queue = copyQueue(_scene, QU_SC34_FROMBOX);
+			queue->addCommandToEnd(createMouseCommand(_scene, x, y, g_ngi->_inputController->getObjectId()));
+			_scene->runQueueObject(queue, hero(), 2);
+			checkBoard();
+			return true;
+		}
+		if (heroY - 344.0f > 3.0f)
+			return false;
+		queue = copyQueue(_scene, QU_SC34_FROMBOX_FLOOR);
+	}
+	queue->addCommandToEnd(createMouseCommand(_scene, x, y, g_ngi->_inputController->getObjectId()));
+	_scene->runQueueObject(queue, hero(), 2);
+	return true;
+}
+
+// CSc34Controller::OnBoardMouseDown (193110)
+bool Sc34Controller::onBoardMouseDown(float x, float y) {
+	if (hero()->_movement)
+		return false;
+	MessageQueue *queue = copyQueue(_scene, QU_SC34_LEAVEBOARD);
+	queue->addCommandToEnd(createMouseCommand(_scene, x, y, g_ngi->_inputController->getObjectId()));
+	_scene->runQueueObject(queue, hero(), 2);
+	return true;
+}
+
+// CSc34Controller::OnShow (193180)
+void Sc34Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_help->setChapter(10);
+	g_ngi->_chapterManager->setActiveChapter(10);
+	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+		g_ngi->_taskManager->activateTask("USE_VENT_SC34");
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_10", true);
+	}
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_cactus = _scene->findAniObjectById(ANI_CACTUS_34, 0);
+	_vent = _scene->findAniObjectById(ANI_VENT_34, 0);
+	_hatch = _scene->findAniObjectById(ANI_LUK_34, 0);
+	_boot = _scene->findAniObjectById(ANI_BOOT_34, 0);
+	_stool = _scene->findAniObjectById(ANI_STOOL_34, 0);
+	if (g_ngi->_inventory->getItemByName("ANI_INV_BOOT")->_counter > 0)
+		_scene->findAniObjectById(ANI_BOOT_34, 0)->_flags &= ~4;
+	if (isState(sO_Cactus, sO_Grew)) {
+		_cactus->setStatic(ST_CTS34_GROWNEMPTY2, false);
+		_cactus->_flags |= 4;
+	} else {
+		_cactus->_flags &= ~4;
+		hero()->_flags &= ~4;
+	}
+	AniObject *board = _scene->findAniObjectById(ANI_BOARD_34, 0);
+	if (board) {
+		board->moveToStaticChain(ST_BRD34_RIGHT);
+		board->_flags |= 4;
+	}
+	if (isState(sO_Grandma, sO_Walking))
+		g_ngi->setState(sO_Grandma, g_ngi->getStateValue(sO_Grandma, sO_OnStool));
+	if (isState(sO_Grandma, sO_AtPipeWithStool) && board)
+		board->moveToStaticChain(ST_BRD34_RIGHT);
+	checkBoard();
+	_onBoard = false;
+	_onCactus = false;
+	_flyTimer = scaledRandom(41500) + 41500;
+	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_34"));
+	g_ngi->lift().enableButton(sO_Level7, projectId("ST_LBN_7N"));
+	g_ngi->lift().initLift(_scene, hero(), QU_SC34_ENTERLIFT, QU_SC34_EXITLIFT);
+	_scene->_behaviorController->getAniQueue(_cactus->_id, QU_CTS34_FALLEFT)->setEnabled(false);
+	_scene->_behaviorController->getAniQueue(_cactus->_id, QU_CTS34_FALLRIGHT)->setEnabled(false);
+	_savedX = 0.0f;
+	_savedY = 0.0f;
+}
+
+// CSc34Controller::OnHide (193568)
+void Sc34Controller::onHide() {
+	if (controllerRunsSceneLogic())
+		_flyPack->deleteAllFlies();
+	FPController::onHide();
+}
+
+// CSc34Controller::GetCursorType (193580)
+int Sc34Controller::getCursorType(float x, float y) {
+	if (g_ngi->lift().getCursorType(x, y))
+		return 116;
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	CursorController *cursor = g_ngi->_inputController;
+	if (cursor->isObjectHit(ANI_STOOL_34) && g_ngi->_inventory->getItem(ANI_INV_BOX))
+		return 102;
+	if (cursor->isObjectHit(ANI_STOOL_34) && cursor->getObjectId() == PIC_INV_BOX)
+		return 102;
+	if (cursor->isObjectHit(ANI_BOX_34) && g_ngi->_inventory->getItem(ANI_INV_STOOL))
+		return 102;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc34Controller::OnUpdate (193620)
+void Sc34Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	FPController::onUpdate(elapsed);
+	const int timer = _flyTimer;
+	_flyTimer = timer - (int)elapsed;
+	if (_flyTimer < 0)
+		startFly();
+	_flyPack->onUpdate(elapsed);
+}
+
+// CSc34Controller::OnMouseLKeyDown (193648)
+bool Sc34Controller::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (FPController::onMouseLKeyDown(id, x, y))
+		return true;
+	return g_ngi->lift().onButtonDown(x, y);
+}
+
+// CSc34Controller::OnMouseLKeyUp (193664)
+bool Sc34Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (FPController::onMouseLKeyUp(id, x, y))
+		return true;
+	if (controllerRunsSceneLogic()) {
+		bool handled;
+		if (_climbed) {
+			handled = onMouseDown(x, y);
+		} else if (_onBoard) {
+			handled = onBoardMouseDown(x, y);
+		} else if (_onCactus) {
+			handled = onCactusMouseDown(x, y);
+		} else {
+			handled = false;
+		}
+		if (handled)
+			return true;
+	}
+	return g_ngi->lift().onButtonUp(x, y);
+}
+
+// CSc34Controller::OnMessage (1936D0)
+void Sc34Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+	if (message == "MSG_SC34_CLIMB") {
+		onClimb();
+	} else if (message == "MSG_SC34_UNCLIMB") {
+		onUnclimb();
+	} else if (message == "MSG_SC22_SHOWSTOOL") {
+		doShowStool();
+	} else if (message == "MSG_SC22_HIDESTOOL") {
+		doHideStool();
+	} else if (message == "MSG_SC34_SHOWBOX") {
+		doShowBox();
+	} else if (message == "MSG_SC34_SHOWVENT") {
+		onShowVent();
+	} else if (message == "MSG_SC34_TESTVENT") {
+		onTestVent();
+	} else if (message == "MSG_SC34_RETRYVENT") {
+		if (!hero()->_movement) {
+			const int objectId = g_ngi->_inputController->getObjectId();
+			if (objectId != 0)
+				onItemFromCursor(g_ngi->_inventory->getItem(objectId)->_id);
+			g_ngi->_inputController->setObject(nullptr, 0, 0);
+			hero()->setStatic(ST_MAN_RIGHT, false);
+			_scene->_behaviorController->enableAllQueuesForAni(hero(), 1);
+			Interact *interaction = getGameLoaderInteractionController()->findInteraction(_scene, _vent->_id, -1);
+			interaction->run(_scene);
+		}
+	} else if (message == "MSG_SC34_ONBOARD") {
+		onStandBoard();
+	} else if (message == "MSG_SC34_LEAVEBOARD") {
+		onLeaveBoard();
+	} else if (message == "MSG_SC34_ONCACTUS") {
+		_onCactus = true;
+		_scene->_motionController->deactivate();
+		getGameLoaderInteractionController()->_enabled = false;
+		_scene->_behaviorController->enableAllQueuesForAni(hero(), 0);
+	} else if (message == "MSG_SC34_FROMCACTUS") {
+		_onCactus = false;
+		_scene->_motionController->activate();
+		getGameLoaderInteractionController()->_enabled = true;
+		_scene->_behaviorController->enableAllQueuesForAni(hero(), 1);
+	} else if (message == "MSG_SC4_HIDEBOOT") {
+		_boot->_flags &= ~4;
+	} else if (message == "MSG_SC34_ONBUMP") {
+		_scene->_behaviorController->getAniQueue(_cactus->_id, QU_CTS34_FALLEFT)->setEnabled(true);
+		_scene->_behaviorController->getAniQueue(_cactus->_id, QU_CTS34_FALLRIGHT)->setEnabled(true);
+		g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_HEAD_2", 50, "UNDEF");
+	} else if (message == "MSG_SC34_ADD_MAN_TO_ANIHADLER") {
+		g_ngi->_aniHandler->detachAllObjects();
+		g_ngi->_aniHandler->attachObject(hero()->_id);
+		FPController::onMouseLKeyUp(0, _savedX, _savedY);
+	} else if (message == "MSG_MOVECACTUS") {
+		_cactus->setPosition(Common::Point(519, 371));
+	} else if (message == "MSG_BREAK_GRIT") {
+		AniObject *grit;
+		int frame;
+		if (interactionCommandNum("INT_358") != -1) {
+			grit = _scene->findAniObjectById(ANI_GRIT2, 0);
+			if (!grit->_movement) {
+				grit->startMovement(MV_GRIT2_FALL, 0, -1);
+				return;
+			}
+			frame = 9;
+		} else {
+			if (interactionCommandNum("INT_359") == -1)
+				return;
+			grit = _scene->findAniObjectById(ANI_GRIT1, 0);
+			if (!grit->_movement) {
+				grit->startMovement(MV_GRIT1_FALL, 0, -1);
+				return;
+			}
+			frame = 7;
+		}
+		grit->setCurFrame(frame, true);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc34Controller::UpdateScroll (193B50)
+void Sc34Controller::updateScroll() {
+	if (_follow)
+		FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc34controller.h b/engines/ngi/fullpipe/sc34controller.h
new file mode 100644
index 00000000000..d4160a172cd
--- /dev/null
+++ b/engines/ngi/fullpipe/sc34controller.h
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC34CONTROLLER_H
+#define NGI_FULLPIPE_SC34CONTROLLER_H
+
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/floaters.h"
+
+namespace NGI {
+
+/** CSc34Controller (cactus, vent, board, lift); sceneHandler34 runs the scene until wired */
+class Sc34Controller : public FPController {
+public:
+	explicit Sc34Controller(int sceneId);
+	~Sc34Controller() override;
+
+	void cleanXml() override;
+	bool canSwipeMan(float x, float y) override;
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void doShowBox();
+	void doHideStool();
+	void onShowVent();
+	void startFly();
+	void checkBoard();
+	bool onCactusMouseDown(float x, float y);
+	void onUnclimb();
+	void onStandBoard();
+	void onLeaveBoard();
+	void onClimb();
+	void doShowStool();
+	void onTestVent();
+	bool onMouseDown(float x, float y);
+	bool onBoardMouseDown(float x, float y);
+
+private:
+	AniObject *_cactus = nullptr; // +216: ANI_CACTUS_34
+	AniObject *_vent = nullptr; // +220: ANI_VENT_34
+	AniObject *_hatch = nullptr; // +224: ANI_LUK_34
+	AniObject *_boot = nullptr; // +228: ANI_BOOT_34
+	AniObject *_stool = nullptr; // +232: ANI_STOOL_34
+	bool _climbed = false; // +236: the hero stands on the stool and the box
+	bool _onBoard = false; // +237: the hero stands on the board
+	bool _onCactus = false; // +238: the hero is on the cactus
+	int _flyTimer = 0; // +240: ms until the next fly
+	Common::ScopedPtr<FlyPack> _flyPack; // +244
+	float _savedX = 0.0f; // +248: the hot spot when the hero climbed down
+	float _savedY = 0.0f; // +252
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC34CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 23873ba2f22..cbfd9f2af95 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -52,6 +52,7 @@
 #include "ngi/fullpipe/sc28controller.h"
 #include "ngi/fullpipe/sc33controller.h"
 #include "ngi/fullpipe/sc22controller.h"
+#include "ngi/fullpipe/sc34controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -105,15 +106,6 @@ void Sc25Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc34Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc34Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSplashScreenController::CreateControllers: the class of the scene number, else CFPController
 void createSceneController(int sceneId) {
 	switch (sceneId) {
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 0593996e27e..821806a8dde 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -52,12 +52,6 @@ public:
 	void onShow() override;
 };
 
-class Sc34Controller : public FPController {
-public:
-	explicit Sc34Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 } // End of namespace NGI
 
 #endif // NGI_FULLPIPE_SCENECONTROLLERS_H
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 6b065f0e760..02419f68ef4 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -131,6 +131,7 @@ MODULE_OBJS = \
 	fullpipe/sc31controller.o \
 	fullpipe/sc32controller.o \
 	fullpipe/sc33controller.o \
+	fullpipe/sc34controller.o \
 	fullpipe/sc35controller.o \
 	fullpipe/sc36controller.o \
 	fullpipe/sc37controller.o \


Commit: 7a9de247f0b37cf27c0f9f73102207171e6e4f2e
    https://github.com/scummvm/scummvm/commit/7a9de247f0b37cf27c0f9f73102207171e6e4f2e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: CArcadeInterface::Render draws the icons with RenderAtPos (loads the texture)

Changed paths:
    engines/ngi/fullpipe/arcadeinterface.cpp


diff --git a/engines/ngi/fullpipe/arcadeinterface.cpp b/engines/ngi/fullpipe/arcadeinterface.cpp
index ea6d7128ea3..8909222b028 100644
--- a/engines/ngi/fullpipe/arcadeinterface.cpp
+++ b/engines/ngi/fullpipe/arcadeinterface.cpp
@@ -128,11 +128,12 @@ void ArcadeInterface::render(Common::Point scroll) {
 
 	for (int i = 0; i < _total; i++) {
 		PictureObject *icon = i < _active ? _full : _passive;
-		if (!icon || !icon->_picture)
+		if (!icon)
 			continue;
 		const float x = (_x - _offsetX) - scroll.x + i * _stepX;
 		const float y = (_y - _offsetY) - scroll.y + i * _stepY;
-		icon->_picture->blitTo(g_ngi->_backgroundSurface, Common::Point((int)x, (int)y));
+		// CArcadeInterface::Render (146768): CVisibleObject::RenderAtPos loads the texture
+		icon->renderAtPos((int)x, (int)y);
 	}
 }
 


Commit: f516926e682c6b082a083a048b7652940936a107
    https://github.com/scummvm/scummvm/commit/f516926e682c6b082a083a048b7652940936a107
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port CMessageQueueBuilder

Changed paths:
  A engines/ngi/messagequeuebuilder.cpp
  A engines/ngi/messagequeuebuilder.h
    engines/ngi/fullpipe/sc33controller.cpp
    engines/ngi/module.mk
    engines/ngi/ngi.cpp
    engines/ngi/ngi.h
    engines/ngi/vector2.h


diff --git a/engines/ngi/fullpipe/sc33controller.cpp b/engines/ngi/fullpipe/sc33controller.cpp
index 780991af468..dfd7ebce598 100644
--- a/engines/ngi/fullpipe/sc33controller.cpp
+++ b/engines/ngi/fullpipe/sc33controller.cpp
@@ -27,6 +27,7 @@
 #include "ngi/input.h"
 #include "ngi/interaction.h"
 #include "ngi/messages.h"
+#include "ngi/messagequeuebuilder.h"
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/sceneobjects.h"
@@ -126,9 +127,11 @@ void Sc33Controller::tryKubik() {
 		_scene->runQueue(QU_KBK33_GO, 3);
 }
 
-// CSc33Controller::OnPour (191AFC): the original builds the queue with CMessageQueueBuilder
+// CSc33Controller::OnPour (191AFC)
 void Sc33Controller::onPour() {
 	MessageQueue *queue = new MessageQueue(_scene, true, 1);
+	MessageQueueBuilder &builder = g_ngi->messageQueueBuilder();
+	builder.setMessageQueue(queue);
 	int movementId = MV_JTI33_FLOW;
 	if (_mug->_flags & 4) {
 		if (_mug->_statics->_staticsId == ST_MUG33_EMPTY) {
@@ -138,7 +141,7 @@ void Sc33Controller::onPour() {
 			movementId = MV_JTI33_POURFULL;
 		}
 	}
-	queue->addCommandToEnd(movementCommand(_jettie->_id, movementId, 0, false));
+	builder.addCmdStartMove(_jettie->_id, movementId, false, false, false, -1, -1, -1, true, 0);
 	_scene->runQueueObject(queue, _jettie, 2);
 }
 
diff --git a/engines/ngi/messagequeuebuilder.cpp b/engines/ngi/messagequeuebuilder.cpp
new file mode 100644
index 00000000000..2f9215bed4c
--- /dev/null
+++ b/engines/ngi/messagequeuebuilder.cpp
@@ -0,0 +1,420 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/gameloader.h"
+#include "ngi/messages.h"
+#include "ngi/messagequeuebuilder.h"
+#include "ngi/objects.h"
+#include "ngi/scene.h"
+
+namespace NGI {
+
+static int projectId(const Common::String &name) {
+	uint32 id = 0;
+	g_ngi->_gameProject->_objectIds.findId(name, id);
+	return (int)id;
+}
+
+// CMessageQueueBuilder::CreateMessageQueue (ED740)
+MessageQueue *MessageQueueBuilder::createMessageQueue(Scene *scene, bool deleteAfter) {
+	if (!scene)
+		return nullptr;
+	_queue = new MessageQueue(scene, deleteAfter, 1);
+	return _queue;
+}
+
+// CCommand::CCommand(kind, wait): the XML loader sets excFlags 2 for the commands of a queue
+Command *MessageQueueBuilder::newCommand(int kind, bool wait) {
+	Command *command = new Command();
+	command->_cmd = kind;
+	command->_wait = wait;
+	command->_excFlags = 2;
+	return command;
+}
+
+// the tail of every AddCmd*: push_back at -1, else CMessageQueue::AddCommand
+void MessageQueueBuilder::place(Command *command, int position) {
+	if (position == -1)
+		_queue->addCommandToEnd(command);
+	else
+		_queue->addCommand(position, command);
+}
+
+void MessageQueueBuilder::setParamString(Command *command, const char *name, const Common::String &value) {
+	command->_args[name] = value;
+}
+
+void MessageQueueBuilder::setParamBool(Command *command, const char *name, bool value) {
+	command->_args[name] = value ? "1" : "0";
+}
+
+// CIDList::FindName, then SetParamString
+void MessageQueueBuilder::setParamName(Command *command, const char *name, uint id) {
+	Common::String value = g_ngi->_gameProject->_objectIds.findName(id);
+	if (value.empty())
+		warning("Name not found in ID list: %i", (int)id);
+	command->_args[name] = value;
+}
+
+// CMessageQueueBuilder::AddCmdShowAni (ED84C)
+void MessageQueueBuilder::addCmdShowAni(uint aniId, uint staticId, uint moveId, uint sceneId, Vector3 pos, int position, bool wait, bool mirror, int copy) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdShow, wait);
+	command->setParamInt("aniId", aniId);
+	command->setParamInt("copy", copy);
+	setParamName(command, "static", staticId);
+	command->setParamInt("moveId", moveId);
+	setParamBool(command, "mirror", mirror);
+	if (sceneId != 0)
+		setParamName(command, "scene", sceneId);
+	command->_x = -1;
+	command->_y = -1;
+	command->_z = -1;
+	if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f) {
+		command->setParamFloat("x", pos.x);
+		command->setParamFloat("y", pos.y);
+		command->setParamFloat("z", pos.z);
+	}
+	command->_parentId = aniId;
+	command->_messageNum = moveId;
+	command->_auxParam = mirror;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdShowPic (ED9D8)
+void MessageQueueBuilder::addCmdShowPic(uint objId, uint sceneId, Vector3 pos, int position, bool wait, int copy) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdShow, wait);
+	command->setParamInt("objId", objId);
+	command->setParamInt("copy", copy);
+	if (sceneId != 0)
+		setParamName(command, "scene", sceneId);
+	command->_x = -1;
+	command->_y = -1;
+	command->_z = -1;
+	if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f) {
+		command->setParamFloat("x", pos.x);
+		command->setParamFloat("y", pos.y);
+		command->setParamFloat("z", pos.z);
+	}
+	command->_parentId = objId;
+	command->_messageNum = -1;
+	command->_auxParam = -1;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdHide (EDB00)
+void MessageQueueBuilder::addCmdHide(uint objId, uint sceneId, int position, bool wait, int copy) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdHide, wait);
+	command->setParamInt("objId", objId);
+	command->setParamInt("copy", copy);
+	if (sceneId != 0)
+		setParamName(command, "scene", sceneId);
+	command->_parentId = objId;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdStartMove (EDBC0)
+void MessageQueueBuilder::addCmdStartMove(uint aniId, uint moveId, bool cycled, bool mirror, bool reverse, int stopFrame, int startFrame, int position, bool wait, int copy) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdStartMovement, wait);
+	command->setParamInt("aniId", aniId);
+	command->setParamInt("copy", copy);
+	command->setParamInt("moveId", moveId);
+	setParamBool(command, "cycled", cycled);
+	setParamBool(command, "reverse", reverse);
+	setParamBool(command, "mirror", mirror);
+	command->setParamInt("stopFrame", stopFrame);
+	command->setParamInt("startFrame", startFrame);
+	command->_parentId = aniId;
+	command->_messageNum = moveId;
+	command->_mirror = mirror;
+	command->_reverse = reverse;
+	command->_z = stopFrame;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdStartSliding (EDC9C)
+void MessageQueueBuilder::addCmdStartSliding(uint aniId, uint moveId, Vector2 step, bool cycled, bool mirror, int stopFrame, int position, bool wait, int copy) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdStartSliding (the queue cannot run START_SLIDING without the points)");
+	Command *command = newCommand(kCmdStartSliding, wait);
+	command->setParamInt("aniId", aniId);
+	command->setParamInt("copy", copy);
+	command->setParamInt("moveId", moveId);
+	setParamBool(command, "cycled", cycled);
+	setParamBool(command, "mirror", mirror);
+	command->setParamInt("stopFrame", stopFrame);
+	command->setParamFloat("stepX", step.x);
+	command->setParamFloat("stepY", step.y);
+	command->_parentId = aniId;
+	command->_messageNum = moveId;
+	command->_mirror = mirror;
+	command->_z = stopFrame;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdTalk (EDD84)
+void MessageQueueBuilder::addCmdTalk(uint dialogPartId, uint sceneId, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdTalk (the queue cannot run TALK)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamName(command, "dialogpart", dialogPartId);
+	if (sceneId != 0)
+		setParamName(command, "scene", sceneId);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdMessage (EDE4C)
+void MessageQueueBuilder::addCmdMessage(uint sceneId, const Common::String &msg, const Common::String &param, int position, bool wait) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdMessage, wait);
+	setParamName(command, "scene", sceneId);
+	setParamString(command, "msg", msg);
+	setParamString(command, "param", param);
+	command->_messageName = msg;
+	command->_messageNum = projectId(msg);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdSetScene (EDF2C)
+void MessageQueueBuilder::addCmdSetScene(uint sceneId, uint entranceId, int push, int position, bool wait) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdSetScene, wait);
+	setParamName(command, "scene", sceneId);
+	if (entranceId != 0)
+		setParamName(command, "entr", entranceId);
+	command->setParamInt("push", push);
+	command->_parentId = sceneId;
+	command->_messageNum = entranceId;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdSound (EE004)
+void MessageQueueBuilder::addCmdSound(uint soundId, bool cycled, bool stop, int position, bool wait) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdSound, wait);
+	setParamName(command, "id", soundId);
+	setParamBool(command, "cycled", cycled);
+	setParamBool(command, "stop", stop);
+	command->_param = cycled;
+	command->_z = stop ? 2 : 1;
+	command->_messageNum = soundId;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdSetVesInteraction (EE0C0)
+void MessageQueueBuilder::addCmdSetVesInteraction(const Common::String &interaction, uint sceneId, uint objId, int ves, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdSetVesInteraction (the queue cannot run this command)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamString(command, "int", interaction);
+	setParamName(command, "scene", sceneId);
+	setParamName(command, "obj", objId);
+	command->setParamInt("ves", ves);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdSetImpInteraction (EE1B8)
+void MessageQueueBuilder::addCmdSetImpInteraction(const Common::String &id, float impMax, float impMin, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdSetImpInteraction (the queue cannot run this command)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamString(command, "id", id);
+	command->setParamFloat("impMax", impMax);
+	command->setParamFloat("impMin", impMin);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdSetActiveInteraction (EE254)
+void MessageQueueBuilder::addCmdSetActiveInteraction(const Common::String &interaction, uint sceneId, uint objId, float act, float add, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdSetActiveInteraction (the queue cannot run this command)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamString(command, "int", interaction);
+	setParamName(command, "scene", sceneId);
+	setParamName(command, "obj", objId);
+	command->setParamFloat("act", act);
+	command->setParamFloat("add", add);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdMovie (EE35C)
+void MessageQueueBuilder::addCmdMovie(const Common::String &fileName, bool dontStretch, bool finalMovie, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdMovie (the queue cannot run MOVIE)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamString(command, "fname", fileName);
+	setParamBool(command, "dontStretch", dontStretch);
+	setParamBool(command, "finalMovie", finalMovie);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdAddInvItem (EE3F8)
+void MessageQueueBuilder::addCmdAddInvItem(const Common::String &id, int position, bool wait) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdAddInvItem, wait);
+	setParamString(command, "id", id);
+	command->_parentId = projectId(id);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdRemoveInvItem (EE46C)
+void MessageQueueBuilder::addCmdRemoveInvItem(const Common::String &id, int position, bool wait) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdRemoveInvItem, wait);
+	setParamString(command, "id", id);
+	command->_parentId = projectId(id);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdRemoveAllInvItems (EE4E0)
+void MessageQueueBuilder::addCmdRemoveAllInvItems(int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdRemoveAllInvItems (the queue cannot run this command)");
+	place(newCommand(kCmdNone, wait), position);
+}
+
+// CMessageQueueBuilder::AddCmdFade (EE528)
+void MessageQueueBuilder::addCmdFade(int state, float alpha, int delayIn, int delayOut, int delayWait, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdFade (the queue cannot run FADE)");
+	Command *command = newCommand(kCmdNone, wait);
+	command->setParamInt("state", state);
+	command->setParamFloat("alpha", alpha);
+	command->setParamInt("delayin", delayIn);
+	command->setParamInt("delayout", delayOut);
+	command->setParamInt("delaywait", delayWait);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdEnableBhvrAni (EE5CC)
+void MessageQueueBuilder::addCmdEnableBhvrAni(uint aniId, bool enable, uint moveId, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdEnableBhvrAni (the queue cannot run this command)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamName(command, "ani", aniId);
+	setParamName(command, "move", moveId);
+	setParamBool(command, "enable", enable);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdEnableBhvrSound (EE684)
+void MessageQueueBuilder::addCmdEnableBhvrSound(uint soundId, bool enable, int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdEnableBhvrSound (the queue cannot run this command)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamName(command, "sound", soundId);
+	setParamBool(command, "enable", enable);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdSetFlags (EE714)
+void MessageQueueBuilder::addCmdSetFlags(uint sceneId, uint objId, int flags, int position, bool wait, int copy) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdSetFlags (the queue cannot run SET_FLAGS)");
+	Command *command = newCommand(kCmdNone, wait);
+	setParamName(command, "scene", sceneId);
+	setParamName(command, "vis", objId);
+	command->setParamInt("copy", copy);
+	command->setParamInt("flags", flags);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdPopScene (EE7F8)
+void MessageQueueBuilder::addCmdPopScene(int position, bool wait) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdPopScene (the queue cannot run POP_SCENE)");
+	place(newCommand(kCmdNone, wait), position);
+}
+
+// CMessageQueueBuilder::AddCmdPause (EE840)
+void MessageQueueBuilder::addCmdPause(float delay, int position, bool wait) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdPause, wait);
+	command->setParamFloat("delay", delay);
+	command->_messageNum = MAX(0, (int)delay);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdStopMovement (EE89C)
+void MessageQueueBuilder::addCmdStopMovement(uint aniId, uint moveId, int position, bool wait, int copy) {
+	if (!_queue)
+		return;
+	warning("STUB/untested: CMessageQueueBuilder::AddCmdStopMovement (the queue cannot run STOP_MOVEMENT)");
+	Command *command = newCommand(kCmdNone, wait);
+	command->setParamInt("aniId", aniId);
+	setParamName(command, "mov", moveId);
+	command->setParamInt("copy", copy);
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdQueue (EE93C)
+void MessageQueueBuilder::addCmdQueue(uint queueId, uint sceneId, const Common::String &interrupt, int position, bool wait) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdQueue, wait);
+	setParamName(command, "scene", sceneId);
+	setParamName(command, "id", queueId);
+	setParamString(command, "interupt", interrupt);
+	command->_messageNum = queueId;
+	place(command, position);
+}
+
+// CMessageQueueBuilder::AddCmdStatic (EEA04)
+void MessageQueueBuilder::addCmdStatic(uint aniId, uint staticId, int position, bool wait, int copy) {
+	if (!_queue)
+		return;
+	Command *command = newCommand(kCmdSetStatic, wait);
+	command->setParamInt("aniId", aniId);
+	setParamName(command, "stat", staticId);
+	command->setParamInt("copy", copy);
+	command->_parentId = aniId;
+	command->_auxParam = -1;
+	command->_messageNum = staticId;
+	place(command, position);
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/messagequeuebuilder.h b/engines/ngi/messagequeuebuilder.h
new file mode 100644
index 00000000000..49e0bc06fa3
--- /dev/null
+++ b/engines/ngi/messagequeuebuilder.h
@@ -0,0 +1,83 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_MESSAGEQUEUEBUILDER_H
+#define NGI_MESSAGEQUEUEBUILDER_H
+
+#include "common/str.h"
+
+#include "ngi/vector2.h"
+
+namespace NGI {
+
+class Command;
+class MessageQueue;
+class Scene;
+
+// CMessageQueueBuilder: fills a queue with commands for the scene code (ids become names)
+class MessageQueueBuilder {
+public:
+	MessageQueueBuilder() : _queue(nullptr) {}
+
+	MessageQueue *createMessageQueue(Scene *scene, bool deleteAfter);
+	void setMessageQueue(MessageQueue *queue) { _queue = queue; }
+
+	// pos -1 appends the command, else it is inserted at pos
+	void addCmdShowAni(uint aniId, uint staticId, uint moveId, uint sceneId, Vector3 pos, int position, bool wait, bool mirror, int copy);
+	void addCmdShowPic(uint objId, uint sceneId, Vector3 pos, int position, bool wait, int copy);
+	void addCmdHide(uint objId, uint sceneId, int position, bool wait, int copy);
+	void addCmdStartMove(uint aniId, uint moveId, bool cycled, bool mirror, bool reverse, int stopFrame, int startFrame, int position, bool wait,
+		int copy);
+	void addCmdStartSliding(uint aniId, uint moveId, Vector2 step, bool cycled, bool mirror, int stopFrame, int position, bool wait, int copy);
+	void addCmdTalk(uint dialogPartId, uint sceneId, int position, bool wait);
+	void addCmdMessage(uint sceneId, const Common::String &msg, const Common::String &param, int position, bool wait);
+	void addCmdSetScene(uint sceneId, uint entranceId, int push, int position, bool wait);
+	void addCmdSound(uint soundId, bool cycled, bool stop, int position, bool wait);
+	void addCmdSetVesInteraction(const Common::String &interaction, uint sceneId, uint objId, int ves, int position, bool wait);
+	void addCmdSetImpInteraction(const Common::String &id, float impMax, float impMin, int position, bool wait);
+	void addCmdSetActiveInteraction(const Common::String &interaction, uint sceneId, uint objId, float act, float add, int position, bool wait);
+	void addCmdMovie(const Common::String &fileName, bool dontStretch, bool finalMovie, int position, bool wait);
+	void addCmdAddInvItem(const Common::String &id, int position, bool wait);
+	void addCmdRemoveInvItem(const Common::String &id, int position, bool wait);
+	void addCmdRemoveAllInvItems(int position, bool wait);
+	void addCmdFade(int state, float alpha, int delayIn, int delayOut, int delayWait, int position, bool wait);
+	void addCmdEnableBhvrAni(uint aniId, bool enable, uint moveId, int position, bool wait);
+	void addCmdEnableBhvrSound(uint soundId, bool enable, int position, bool wait);
+	void addCmdSetFlags(uint sceneId, uint objId, int flags, int position, bool wait, int copy);
+	void addCmdPopScene(int position, bool wait);
+	void addCmdPause(float delay, int position, bool wait);
+	void addCmdStopMovement(uint aniId, uint moveId, int position, bool wait, int copy);
+	void addCmdQueue(uint queueId, uint sceneId, const Common::String &interrupt, int position, bool wait);
+	void addCmdStatic(uint aniId, uint staticId, int position, bool wait, int copy);
+
+private:
+	Command *newCommand(int kind, bool wait);
+	void place(Command *command, int position);
+	void setParamString(Command *command, const char *name, const Common::String &value);
+	void setParamBool(Command *command, const char *name, bool value);
+	void setParamName(Command *command, const char *name, uint id);
+
+	MessageQueue *_queue; // +8
+};
+
+} // End of namespace NGI
+
+#endif
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 02419f68ef4..75dd2027978 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -15,6 +15,7 @@ MODULE_OBJS = \
 	interaction.o \
 	inventory.o \
 	messagehandlers.o \
+	messagequeuebuilder.o \
 	messages.o \
 	metaengine.o \
 	modal.o \
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 9b0982183cf..224ea9dd3dc 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -58,6 +58,7 @@
 #include "ngi/detection.h"
 #include "ngi/gameloader.h"
 #include "ngi/messages.h"
+#include "ngi/messagequeuebuilder.h"
 #include "ngi/behavior.h"
 #include "ngi/modal.h"
 #include "ngi/input.h"
@@ -742,6 +743,12 @@ ArcadeInterface &NGIEngine::arcadeInterface() {
 	return *_arcadeInterface;
 }
 
+MessageQueueBuilder &NGIEngine::messageQueueBuilder() {
+	if (!_messageQueueBuilder)
+		_messageQueueBuilder.reset(new MessageQueueBuilder());
+	return *_messageQueueBuilder;
+}
+
 void NGIEngine::freeGameLoader() {
 	_preloadManager.reset();
 	// the effects of the tremble items belong to the scenes that are destroyed with the loader
diff --git a/engines/ngi/ngi.h b/engines/ngi/ngi.h
index d76063db65b..ff427eaec62 100644
--- a/engines/ngi/ngi.h
+++ b/engines/ngi/ngi.h
@@ -106,6 +106,7 @@ class ExitManager;
 class Tremble;
 class Map;
 class ArcadeInterface;
+class MessageQueueBuilder;
 class BitmapFont;
 class TextContainer;
 class ChapterManager;
@@ -191,6 +192,8 @@ public:
 	const char *getResourceLocale() const;
 	/** CSingleton<CArcadeInterface>::GetInst: created when first needed */
 	ArcadeInterface &arcadeInterface();
+	/** CSingleton<CMessageQueueBuilder>::GetInst (191AC8): created when first needed */
+	MessageQueueBuilder &messageQueueBuilder();
 	/** CTextContainer::GetText: the string of the game language (empty when there is none) */
 	Common::String getText(const Common::String &id);
 	/** CFontController::GetFont: the font file of res_<locale>/Fonts, loaded once; null on failure */
@@ -327,6 +330,7 @@ public:
 	/** CSingleton<CMap>: the state of the map of the game (Android) */
 	Common::ScopedPtr<Map> _map;
 	Common::ScopedPtr<ArcadeInterface> _arcadeInterface;
+	Common::ScopedPtr<MessageQueueBuilder> _messageQueueBuilder;
 	Common::ScopedPtr<ChapterManager> _chapterManager;
 	/** CSingleton<CStateManager>: objstates.xml (201509 and later), null in older builds */
 	Common::ScopedPtr<StateManager> _stateManager;
diff --git a/engines/ngi/vector2.h b/engines/ngi/vector2.h
index 09ca867a3d0..ed6b299a95a 100644
--- a/engines/ngi/vector2.h
+++ b/engines/ngi/vector2.h
@@ -30,6 +30,13 @@ struct Vector2 {
 	float y;
 };
 
+/** Android: vector3 (a position with the depth) */
+struct Vector3 {
+	float x;
+	float y;
+	float z;
+};
+
 } // End of namespace NGI
 
 #endif // NGI_VECTOR2_H


Commit: e4c811fc8146f843a772d9aecb7194cd290fdb75
    https://github.com/scummvm/scummvm/commit/e4c811fc8146f843a772d9aecb7194cd290fdb75
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port CSc18Controller

Changed paths:
  A engines/ngi/fullpipe/sc18controller.cpp
  A engines/ngi/fullpipe/sc18controller.h
  A engines/ngi/fullpipe/sc19controller.cpp
  A engines/ngi/fullpipe/sc19controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 4f9a8f4352e..a0307ea8485 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1983,4 +1983,16 @@ namespace NGI {
 #define ANI_BOARD_34 2506
 #define ST_BRD34_RIGHT 2509
 
+// Android: names of obj.h that the ported controllers use
+#define ST_BOY18_FLYFROM 1479
+#define ST_GRL18_FLYFROM 1486
+#define ST_MAN18_JUMP 1512
+#define ENT_SC19_LADDER2 20006
+#define ENT_SC18_UPRIGHT 23002
+#define PIC_SC18_BIGWHEEL 23007
+#define PIC_SC19_BIGWHEEL 23008
+#define ANI_SC18_BOARD 28063
+#define ST_SC18_BOARD_STATE1 28064
+#define ST_CDI_SUGAR 1532
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/sc18controller.cpp b/engines/ngi/fullpipe/sc18controller.cpp
new file mode 100644
index 00000000000..812b222dbd5
--- /dev/null
+++ b/engines/ngi/fullpipe/sc18controller.cpp
@@ -0,0 +1,931 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+
+#include "ngi/ngi.h"
+#include "ngi/objects.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/sceneobjects.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc18controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+static const double kTwoPi = 6.28318530717958;
+
+// CUtils::SetVes (14FCC8): the weights of the two ladder interactions
+static void setLadderVes(const char *first, const char *second, const Common::String &message) {
+	if (message == "MSG_TOLADDER") {
+		setInteractionWeight(first, 1);
+		setInteractionWeight(second, 5);
+	} else if (message == "MSG_FROMLADDER") {
+		setInteractionWeight(first, 5);
+		setInteractionWeight(second, 1);
+	}
+}
+
+// CVisibleObject::SetPos(vector3) with the depth
+static void setPos(AniObject *ani, float x, float y, int z) {
+	ani->setPosition(Common::Point((int)x, (int)y));
+	ani->_z = z;
+}
+
+// CSc18Controller::CSc18Controller (17D710)
+Sc18Controller::Sc18Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc18Controller::~CSc18Controller (17D6C0)
+Sc18Controller::~Sc18Controller() {
+}
+
+// CSc18Controller::CanSwipeMan (17D670)
+bool Sc18Controller::canSwipeMan(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::canSwipeMan(x, y);
+
+	if (_manOnWheel)
+		return false;
+	return !_manReady;
+}
+
+// CSc18Controller::SetCloseUpsell (17D68C)
+void Sc18Controller::setCloseUpsell() {
+	_closeUpsell = true;
+}
+
+// CSc18Controller::SaveState (17D7D0)
+void Sc18Controller::saveState() {
+	_state.manCell = _manCell;
+	_state.angle = _lastAngle;
+	_state.lastAngle = _lastAngle;
+	_state.targetCell = _targetCell;
+	_state.boyCell = _boyCell;
+	_state.riderKind = _riderKind;
+	_state.manJumpCell = _manJumpCell;
+	_state.boyRides = _boyRides;
+	_state.girlRides = _girlRides;
+	_state.boyWaiting = _boyWaiting;
+	_state.manReady = _manReady;
+	_state.manOnWheel = _manOnWheel;
+	_state.flag303 = _flag303;
+	_state.flag308 = _flag308;
+	_state.girlWaiting = _girlWaiting;
+	if (_boy->_movement) {
+		_state.boyMovementId = _boy->_movement->_id;
+		_state.boyFrame = _boy->getCurFrame();
+	} else {
+		_state.boyMovementId = -1;
+		_state.boyFrame = -1;
+	}
+	if (_girl->_movement) {
+		_state.girlMovementId = _girl->_movement->_id;
+		_state.girlFrame = _girl->getCurFrame();
+	} else {
+		_state.girlMovementId = -1;
+		_state.girlFrame = -1;
+	}
+}
+
+// CSc18Controller::PrepareBoyTo (17D8AC)
+void Sc18Controller::prepareBoyTo() {
+	_boy->stopMovement(false);
+	_boy->_flags |= 4;
+	setPos(_boy, _boyX, _boyY, 50);
+	_boy->startMovement(MV_BOY18_JUMPTO, 0, -1);
+}
+
+// CSc18Controller::PrepareGirlTo (17D914)
+void Sc18Controller::prepareGirlTo() {
+	_girl->stopMovement(false);
+	_girl->_flags |= 4;
+	setPos(_girl, _girlX, _girlY, 50);
+	_girl->startMovement(MV_GRL18_JUMPTO, 0, -1);
+}
+
+// CSc18Controller::PrepareManTo (17D978)
+void Sc18Controller::prepareManTo() {
+	hero()->setCenter(Common::Point(967, 379));
+	hero()->setStatic(ST_MAN_RIGHT, false);
+	hero()->_z = 35;
+	hero()->startMovement(MV_MAN18_STANDKRESLO, 0, -1);
+}
+
+// CSc18Controller::TickCellsNoswing (17D9D4)
+void Sc18Controller::tickCellsNoswing() {
+	for (uint i = 0; i < _cells.size(); i++) {
+		AniObject *ani = _cells[i].ani;
+		if (ani->_movement)
+			continue;
+		const int kind = _cells[i].kind;
+		if (kind & 2)
+			ani->startMovement(MV_KSL_SWINGBOY, 0, -1);
+		else if (kind & 4)
+			ani->startMovement(MV_KSL_SWINGGIRL, 0, -1);
+		else if (kind & 0x20)
+			ani->startMovement(MV_KSL_SWINGMAN, 0, -1);
+		if (!_cells[i].ani->_movement)
+			warning("STUB/untested: CSc18Controller::TickCellsNoswing (CMovement +24 of the last movement of a still swing); not called by the original");
+	}
+}
+
+// CSc18Controller::DoShowBoyJump (17DA88)
+void Sc18Controller::doShowBoyJump() {
+	const Common::Point center = _cells[_boyCell].ani->getCenter();
+	_boy->_flags |= 4;
+	_boy->setStatic(ST_BOY18_FLYFROM, false);
+	_boy->setCenter(Common::Point((int)((float)center.x - 48.0f), (int)((float)center.y + 8.0f)));
+	_boy->_z = 50;
+	_boy->startMovement(MV_BOY18_JUMPFROM, 0, -1);
+	_cells[_boyCell].kind = 1;
+	_cells[_boyCell].ani->setStatic(ST_KSL_REACT, false);
+	_cells[_boyCell].ani->startMovement(MV_KSL_CALMDOWN, 0, -1);
+	_boyWaiting = true;
+}
+
+// CSc18Controller::DoShowGirlJump (17DB6C)
+void Sc18Controller::doShowGirlJump() {
+	const Common::Point center = _cells[_boyCell].ani->getCenter();
+	float x = (float)center.x - 62.0f;
+	float y = (float)center.y - 10.0f;
+	if (_scene->_sceneId == SC_18)
+		y -= 40.0f;
+	_girl->_flags |= 4;
+	_girl->setCenter(Common::Point((int)x, (int)y));
+	_girl->setStatic(ST_GRL18_FLYFROM, false);
+	_girl->_z = 50;
+	_girl->startMovement(MV_GRL18_JUMPFROM, 0, -1);
+	_cells[_boyCell].kind = 1;
+	_cells[_boyCell].ani->setStatic(ST_KSL_REACT, false);
+	_cells[_boyCell].ani->startMovement(MV_KSL_CALMDOWN, 0, -1);
+	_riderKind = 1;
+	_girlRides++;
+}
+
+// CSc18Controller::DoShowBoyJumpto (17DC60)
+void Sc18Controller::doShowBoyJumpto() {
+	_boy->stopMovement(false);
+	_boy->_flags &= ~4;
+	_cells[_targetCell].kind = 2;
+	_cells[_targetCell].ani->setStatic(ST_KSL_JUMPBOY, false);
+	_cells[_targetCell].ani->startMovement(MV_KSL_INBOY, 0, -1);
+	_riderKind--;
+	_boyRides--;
+}
+
+// CSc18Controller::DoShowGirlJumpto (17DCD8)
+void Sc18Controller::doShowGirlJumpto() {
+	_girl->stopMovement(false);
+	_girl->_flags &= ~4;
+	_cells[_targetCell].kind = 4;
+	_cells[_targetCell].ani->setStatic(ST_KSL_JUMPGIRL, false);
+	_cells[_targetCell].ani->startMovement(MV_KSL_INGIRL, 0, -1);
+	_riderKind--;
+	_girlRides--;
+}
+
+// CSc18Controller::GetManDist (17DD50)
+float Sc18Controller::getManDist() {
+	const Common::Point center = hero()->getCenter();
+	const float dx = 967.0f - (float)center.x;
+	const float dy = 379.0f - (float)center.y;
+	return sqrt((double)(dx * dx + dy * dy));
+}
+
+// CSc18Controller::ResetCells (17DDB0)
+void Sc18Controller::resetCells() {
+	for (uint i = 0; i < 8; i++) {
+		WheelCell &cell = _cells[i];
+		cell.angle = (double)i * kTwoPi * 0.125;
+		cell.homeX = _centerX + (float)(int)(cos(cell.angle) * 575.0);
+		cell.homeY = _centerY + (float)(int)(sin(cell.angle) * 575.0);
+		cell.homeY += 87.0f;
+		cell.x = cell.homeX;
+		cell.y = cell.homeY;
+		cell.ani->setStatic(ST_KSL_NORM, false);
+		setPos(cell.ani, cell.homeX, cell.homeY, cell.ani->_z);
+		_cells[i].ani->_flags |= 4;
+	}
+	_wheel->_rotation = 0.0f;
+}
+
+// CSc18Controller::InitState (17DEB8)
+void Sc18Controller::initState() {
+	_angle = _state.angle;
+	_lastAngle = _state.lastAngle;
+	_boyCell = _state.boyCell;
+	_targetCell = _state.targetCell;
+	_manCell = _state.manCell;
+	_manJumpCell = _state.manJumpCell;
+	_riderKind = _state.riderKind;
+	_boyRides = _state.boyRides;
+	_girlRides = _state.girlRides;
+	_boyWaiting = _state.boyWaiting;
+	_manReady = _state.manReady;
+	_manOnWheel = _state.manOnWheel;
+	_flag303 = _state.flag303;
+	_flag308 = _state.flag308;
+	_girlWaiting = _state.girlWaiting;
+	_savedBoyMovementId = _state.boyMovementId;
+	_savedGirlMovementId = _state.girlMovementId;
+	_savedBoyFrame = _state.boyFrame;
+	_savedGirlFrame = _state.girlFrame;
+	_field149 = !_state.manOnWheel;
+	setSaving(!_manOnWheel);
+}
+
+// CSc18Controller::OnCloseUpsell (17DF84)
+void Sc18Controller::onCloseUpsell() {
+	if (_scene->_sceneId == SC_18) {
+		_follow = hero();
+		_scene->_x = 668;
+		_scene->_y = 0;
+		_manOnWheel = false;
+		_field149 = true;
+		setSaving(true);
+		hero()->_flags |= 4;
+		hero()->setStatic(ST_MAN_RIGHT, false);
+		hero()->setCenter(Common::Point(967, 379));
+		_closeUpsell = false;
+	} else {
+		g_ngi->_gameLoader->preloadScene(SC_18, 0); // CGame::SetScene
+		static_cast<Sc18Controller *>(g_ngi->findScene(SC_18)->_controller.get())->setCloseUpsell();
+	}
+}
+
+// CSc18Controller::PrepareSwitch1819 (17E018)
+void Sc18Controller::prepareSwitch1819(uint entranceId) {
+	bool saving;
+	if (entranceId == TrubaRight) {
+		_manOnWheel = true;
+		saving = false;
+	} else {
+		_manOnWheel = false;
+		_flag303 = entranceId == PIC_SC19_RTRUBA3;
+		saving = true;
+	}
+	_field149 = saving;
+	setSaving(saving);
+}
+
+// CSc18Controller::TickCells (17E068)
+void Sc18Controller::tickCells() {
+	for (uint i = 0; i < _cells.size(); i++) {
+		WheelCell &cell = _cells[i];
+		const double prev = cell.angle;
+		cell.angle = cell.startAngle + (double)_angle;
+		if (cell.angle > kTwoPi)
+			cell.angle -= kTwoPi;
+		const double angle = cell.angle;
+		float x = (float)(int)(cos(angle) * 575.0) + _centerX;
+		float y = ((float)(int)(sin(angle) * 575.0) + _centerY) + 87.0f;
+		cell.x = x;
+		cell.y = y;
+		if (cell.ani->_movement)
+			warning("STUB/untested: CMovement::GetStepToFrame (the slide of the swing movement is not added)");
+		AniObject *ani = _cells[i].ani;
+		if (ani->_movement) {
+			const int movementId = ani->_movement->_id;
+			if ((movementId & ~2) == MV_KSL_JUMPBOY) {
+				x -= 5.0f;
+			} else if (movementId == MV_KSL_CALMDOWN) {
+				x += 50.0f;
+			} else if (movementId == MV_KSL_INBOY) {
+				x -= 50.0f;
+			} else if (movementId == MV_KSL_INGIRL) {
+				x -= 60.0f;
+			}
+		}
+		ani->setCenter(Common::Point((int)x, (int)y));
+		if (_wheelActive) {
+			const int kind = cell.kind;
+			if ((kind & 2) && cell.angle >= 2.7925268031909245 && prev < 2.7925268031909245) {
+				cell.kind = 8;
+				_cells[i].ani->setStatic(ST_KSL_BOY, false);
+				_cells[i].ani->startMovement(MV_KSL_JUMPBOY, 0, -1);
+				_boyCell = i;
+			} else if ((kind & 4) && cell.angle >= 2.827433388230811 && prev < 2.827433388230811) {
+				cell.kind = 16;
+				_cells[i].ani->setStatic(ST_KSL_GIRL, false);
+				_cells[i].ani->startMovement(MV_KSL_JUMPGIRL, 0, -1);
+				_boyCell = i;
+			} else {
+				bool handled = false;
+				if (_riderKind == 1) {
+					if (_boyCell == (int)i && _girlRides > 0 && (kind & 1) && cell.angle >= 3.2637657012293926 && prev < 3.2637657012293926) {
+						_targetCell = i;
+						prepareGirlTo();
+						handled = true;
+					}
+				} else if (_boyCell == (int)i && _boyRides > 0 && (kind & 1) && cell.angle >= 3.2288591161895064 && prev < 3.2288591161895064) {
+					_targetCell = i;
+					prepareBoyTo();
+					handled = true;
+				}
+				if (!handled && cell.angle >= 3.4906585039886555 && prev < 3.4906585039886555) {
+					if (_boyWaiting)
+						_boyRides++;
+					_boyWaiting = false;
+				}
+			}
+		}
+		if (_manReady) {
+			if ((_cells[i].kind & 1) && _cells[i].angle >= 1.448623279155292 && prev < 1.448623279155292) {
+				_manCell = i;
+				prepareManTo();
+			}
+		}
+		if (_manOnWheel) {
+			if ((int)i == _manCell) {
+				const double a = _cells[i].angle;
+				if (a >= 2.9670597283903573 && prev < 2.9670597283903573) {
+					g_ngi->_gameLoader->preloadScene(SC_19, TrubaRight); // CGame::SetScene
+				} else if (a >= 0.43633231299858194 && prev < 0.43633231299858194) {
+					g_ngi->_gameLoader->preloadScene(SC_18, TrubaRight); // CGame::SetScene
+				} else if (a >= 4.188790204786387 && prev < 4.188790204786387) {
+					_scene->_x += 1200;
+				}
+			}
+			if (_manRides > 0) {
+				if (_cells[i].kind & 0x20) {
+					const double limit = (double)_manJumpAngle * 3.14159265358979 / 180.0;
+					if (_cells[i].angle >= limit && prev < limit) {
+						_cells[i].ani->setStatic(ST_KSL_MAN, false);
+						_cells[i].ani->startMovement(MV_KSL_JUMPMAN, 0, -1);
+						_cells[i].ani->_z = 35;
+						_manJumpCell = i;
+					}
+				}
+			}
+		}
+		if (_cells[i].ani->isOnScreen(_scene))
+			_cells[i].ani->_flags |= 4;
+		else
+			_cells[i].ani->_flags &= ~4;
+	}
+}
+
+// CSc18Controller::DoShowManJump (17E620)
+void Sc18Controller::doShowManJump() {
+	const Common::Point center = _cells[_manJumpCell].ani->getCenter();
+	hero()->_flags |= 4;
+	hero()->setCenter(Common::Point((int)((float)center.x + 62.0f), (int)((float)center.y + 5.0f)));
+	hero()->setStatic(ST_MAN18_JUMP, false);
+	hero()->_z = 35;
+	MessageQueue *queue = nullptr;
+	switch (_riderKind) {
+	case 1:
+		queue = copyQueue(_scene, QU_SC19_MANJUMP1);
+		break;
+	case 2:
+		queue = copyQueue(_scene, QU_SC19_MANJUMP2);
+		break;
+	case 3:
+		queue = copyQueue(_scene, QU_SC19_MANJUMP3);
+		break;
+	default:
+		break;
+	}
+	if (queue) {
+		_follow = hero();
+		_manOnWheel = false;
+		_field149 = true;
+		setSaving(true);
+		_scene->runQueueObject(queue, hero(), 2);
+	}
+	_cells[_manJumpCell].kind = 1;
+	_cells[_manJumpCell].ani->setStatic(ST_KSL_NORM, false);
+	_cells[_manJumpCell].ani->_z = 30;
+	_smooth = false;
+}
+
+// CSc18Controller::DoShowManJumpto (17E770)
+void Sc18Controller::doShowManJumpto() {
+	hero()->setStatic(ST_MAN_RIGHT, false);
+	setSaving(false);
+	hero()->_flags &= ~4;
+	_cells[_manCell].kind = 32;
+	_cells[_manCell].ani->setStatic(ST_KSL_JUMPMAN, false);
+	_cells[_manCell].ani->startMovement(MV_KSL_INMAN, 0, -1);
+	_cells[_manCell].ani->_z = 20;
+	_manReady = false;
+	_manOnWheel = true;
+	_field149 = false;
+	_follow = _cells[_manCell].ani;
+	g_ngi->_taskManager->deactivateTask("RIDE_BIGWHEEL_SC18");
+	_smooth = true;
+}
+
+// CSc18Controller::UpdateNumRides (17E850)
+void Sc18Controller::updateNumRides() {
+	int rides = atoi(g_ngi->getState(sO_DudeSwinged).c_str());
+	rides++;
+	if (rides > 1) {
+		g_ngi->setState(sO_Girl, g_ngi->getStateValue(sO_Girl, sO_IsRiding));
+		_girlRides++;
+		_riderKind = 1;
+		rides = 0;
+	}
+	g_ngi->setState(sO_DudeSwinged, rides);
+}
+
+// CSc18Controller::OnBoardClick (17E978)
+void Sc18Controller::onBoardClick() {
+	const Common::Point center = hero()->getCenter();
+	if (fabsf(967.0f - (float)center.x) <= 2.0f && fabsf(379.0f - (float)center.y) <= 2.0f && hero()->getStaticsId() == ST_MAN_RIGHT) {
+		_manReady = true;
+		return;
+	}
+	MessageQueue *queue = mctlStartMove(967, 379, true, ST_MAN_RIGHT, false);
+	if (queue)
+		queue->addCommandToEnd(messageCommand("MSG_SC18_MANREADY"));
+}
+
+// CSc18Controller::CreateCells (17EB48)
+void Sc18Controller::createCells(AniObject *chair) {
+	Common::Array<WheelCell> cells;
+	for (int i = 0; i < 8; i++) {
+		WheelCell cell;
+		double angle;
+		int kind;
+		if (!_keepCells) {
+			cell.startAngle = (double)i * kTwoPi * 0.125;
+			angle = cell.startAngle + (double)_angle;
+			if (angle > kTwoPi)
+				angle -= kTwoPi;
+			cell.angle = angle;
+			cell.homeX = _centerX + (float)(int)(cos(angle) * 575.0);
+			cell.homeY = ((float)(int)(sin(angle) * 575.0) + _centerY) + 87.0f;
+			cell.x = cell.homeX;
+			cell.y = cell.homeY;
+			kind = i == 0 ? (_girlWaiting ? 4 : 1) : 2;
+		} else {
+			const WheelCell &old = _cells[i];
+			angle = old.angle;
+			cell.angle = old.angle;
+			cell.startAngle = old.startAngle;
+			cell.homeX = _centerX + (float)(int)(cos(angle) * 575.0);
+			cell.homeY = ((float)(int)(sin(angle) * 575.0) + _centerY) + 87.0f;
+			kind = old.kind;
+		}
+		cell.kind = kind;
+		if (i == 0) {
+			cell.ani = chair;
+		} else {
+			cell.ani = new AniObject(chair);
+			_scene->addAni(cell.ani, true);
+		}
+		cell.ani->setStatic(ST_KSL_NORM, false);
+		if (!_keepCells || _cells[i].visible)
+			cell.ani->_flags |= 4;
+		else
+			cell.ani->_flags &= ~4;
+		cell.ani->setCenter(Common::Point((int)cell.homeX, (int)cell.homeY));
+		cell.ani->_z = 30;
+		int movementId;
+		if (_keepCells) {
+			movementId = _cells[i].movementId;
+		} else if (kind & 2) {
+			movementId = MV_KSL_SWINGBOY;
+		} else if (kind & 4) {
+			movementId = MV_KSL_SWINGGIRL;
+		} else {
+			movementId = MV_KSL_SWING;
+		}
+		cell.ani->startMovement(movementId, 0, -1);
+		if (cell.ani->_movement)
+			cell.ani->_movement->_loopDelay = 83;
+		int frame;
+		if (_keepCells) {
+			frame = _cells[i].frame;
+		} else {
+			frame = scaledRandom(17);
+		}
+		if (frame != -1)
+			cell.ani->setCurFrame(frame, true);
+		cells.push_back(cell);
+	}
+	_cells = cells;
+}
+
+// CSc18Controller::InitSwitch1819 (17EEA0)
+void Sc18Controller::initSwitch1819() {
+	if (_scene->_sceneId == SC_18) {
+		_wheel = _scene->findPictureObjectById(PIC_SC18_BIGWHEEL, 0);
+		_wheel->_flags |= 4;
+		_boy = _scene->findAniObjectById(ANI_BOY18, 0);
+		_girl = _scene->findAniObjectById(ANI_GIRL18, 0);
+		_chair = _scene->findAniObjectById(ANI_KRESLO, 0);
+		_chair->_sceneId = _scene->_sceneId; // CAniObject +20
+		_domino = _scene->findAniObjectById(ANI_DOMINO_18, 0);
+		_wheel->_flags |= 4;
+		_centerX = 1032.0f;
+		_centerY = -318.0f;
+		_wheelActive = true;
+	} else {
+		Scene *wheelScene = g_ngi->findScene(SC_18);
+		_wheel = _scene->findPictureObjectById(PIC_SC19_BIGWHEEL, 0);
+		_wheel->_flags |= 4;
+		_boy = wheelScene->findAniObjectById(ANI_BOY18, 0);
+		_girl = wheelScene->findAniObjectById(ANI_GIRL18, 0);
+		_chair = wheelScene->findAniObjectById(ANI_KRESLO, 0);
+		_centerX = 1024.0f;
+		_centerY = 242.0f;
+		_scene->addAni(_chair, false);
+		_scene->addAni(_boy, false);
+		_scene->addAni(_girl, false);
+		_wheelActive = true;
+	}
+	_angle = 0.0f;
+	_cells.clear();
+	const int sceneId = _scene->_sceneId;
+	if (sceneId == SC_19 || sceneId == SC_18) {
+		if (_keepCells) {
+			Sc18Controller *other = static_cast<Sc18Controller *>(g_ngi->findScene(sceneId == SC_19 ? SC_18 : SC_19)->_controller.get());
+			_cells = other->_cells;
+			other->_cells.clear();
+			_state = other->_state;
+			initState();
+			if (_savedBoyMovementId != -1) {
+				_boy->startMovement(_savedBoyMovementId, 0, -1);
+				_boy->setCurFrame(_savedBoyFrame, true);
+			}
+			if (_savedGirlMovementId != -1) {
+				_girl->startMovement(_savedGirlMovementId, 0, -1);
+				_girl->setCurFrame(_savedGirlFrame, true);
+			}
+		}
+	}
+	if (_wheelRuns) {
+		_wheel->_rotation = _angle;
+		_lastAngle = _angle;
+	}
+	createCells(_chair);
+	if (_manOnWheel)
+		doShowManJumpto();
+	else
+		_follow = hero();
+	_manRides = 3;
+	_manJumpAngle = 13;
+	if (_scene->_sceneId == SC_19)
+		g_ngi->playSound(_wheelRuns ? SND_19_015 : SND_19_016, 1);
+	else
+		g_ngi->playSound(_wheelRuns ? SND_18_006 : SND_18_010, 1);
+}
+
+// CSc18Controller::OnShow (17F1C0)
+void Sc18Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	if (_scene->_sceneId == SC_18) {
+		AniObject *board = _scene->findAniObjectById(ANI_SC18_BOARD, 0);
+		board->setStatic(ST_SC18_BOARD_STATE1, false);
+		setPos(board, 920.0f, 410.0f, 50);
+		if (_scene->_currentEntranceId != 0 && _scene->_currentEntranceId != TrubaUp) {
+			if (_scene->_currentEntranceId != ENT_SC18_UPRIGHT) {
+				g_ngi->_exitManager->setExitAngle(PIC_SC18_LADDER2, 0.0f);
+				g_ngi->_exitManager->setExitAngle(PIC_SC18_LADDER3, 0.0f);
+			}
+		}
+	}
+	_wheelRuns = true;
+	_wheel = nullptr;
+	_angle = 0.0f;
+	_centerX = 0.0f;
+	_centerY = 0.0f;
+	_manRides = 3;
+	_boy = nullptr;
+	_girl = nullptr;
+	_domino = nullptr;
+	_boyCell = 0;
+	_targetCell = 0;
+	_manCell = -1;
+	_manJumpCell = -1;
+	_boyX = 0.0f;
+	_boyY = 0.0f;
+	_girlX = 0.0f;
+	_girlY = 0.0f;
+	_wheelActive = false;
+	_riderKind = -1;
+	_boyRides = 0;
+	_girlRides = 0;
+	_boyWaiting = true;
+	_manReady = false;
+	_manOnWheel = false;
+	_flag303 = false;
+	_manJumpAngle = 13;
+	_flag308 = false;
+	_girlWaiting = true;
+	_lastAngle = 0.0f;
+	if (_scene->_currentEntranceId != 0) {
+		if (_scene->_currentEntranceId == TrubaUp)
+			setLadderVes("INT_103", "INT_108", "MSG_TOLADDER");
+		else
+			setLadderVes("INT_103", "INT_108", "MSG_FROMLADDER");
+	}
+	_marginY = 200;
+	_marginX = 300;
+	_offsetY = 300;
+	_offsetX = 400;
+	_boyX = 290.0f;
+	_boyY = -363.0f;
+	_girlX = 283.0f;
+	_girlY = -350.0f;
+	if (g_ngi->getState(sO_Bridge) != sO_Convoluted) {
+		_wheelRuns = false;
+		g_ngi->playSound(SND_18_010, 1);
+	} else {
+		_wheelRuns = true;
+		g_ngi->playSound(SND_18_006, 1);
+	}
+	_girlWaiting = g_ngi->getState(sO_Girl) == sO_IsRiding;
+	_keepCells = false;
+	const uint entrance = _scene->_currentEntranceId;
+	if (entrance == TrubaLeft) {
+		g_ngi->_exitManager->setExitAngle(PIC_SC18_LADDER1, 0.0f);
+	} else if (entrance == ENT_SC18_UPRIGHT || entrance == TrubaUp || entrance - ENT_SC19_LADDER2 <= 1 || entrance - TrubaRight <= 1) {
+		_keepCells = true;
+	}
+	prepareSwitch1819(entrance);
+	initSwitch1819();
+	if (_closeUpsell)
+		onCloseUpsell();
+	const Common::Point center = hero()->getCenter();
+	if (fabsf(967.0f - (float)center.x) < 2.0f && fabsf(379.0f - (float)center.y) < 2.0f && hero()->getStaticsId() == ST_MAN_RIGHT)
+		_manReady = true;
+}
+
+// CSc18Controller::OnHide (17F5AC)
+void Sc18Controller::onHide() {
+	FPController::onHide();
+	if (!controllerRunsSceneLogic())
+		return;
+
+	for (uint i = 0; i < _cells.size(); i++) {
+		WheelCell &cell = _cells[i];
+		cell.movementId = cell.ani->_movement ? cell.ani->_movement->_id : 0;
+		cell.visible = (cell.ani->_flags & 4) != 0;
+		cell.staticsId = cell.ani->getStaticsId();
+		cell.frame = cell.ani->getCurFrame();
+		if (i != 0) {
+			if (_scene->_sceneId != SC_18)
+				_scene->removeAni(cell.ani);
+			warning("STUB/untested: CAniObject::RemoveThis (the extra swings are not released)");
+		} else {
+			cell.ani->_flags &= ~4;
+			if (_scene->_sceneId != SC_18)
+				_scene->removeAni(cell.ani);
+		}
+	}
+	saveState();
+	_boy->_flags &= ~4;
+	_girl->_flags &= ~4;
+	_wheel->_flags &= ~4;
+	_chair->_flags &= ~4;
+	if (_scene->_sceneId != SC_18) {
+		_scene->removeAni(_boy);
+		_scene->removeAni(_girl);
+		_scene->removeAni(_chair);
+	}
+	_boy = nullptr;
+	_girl = nullptr;
+	_wheel = nullptr;
+	_chair = nullptr;
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), true);
+}
+
+// CSc18Controller::GetCursorType (17F6C4)
+int Sc18Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+
+	if (g_ngi->_inputController->isObjectHit(PIC_SC18_LADDER1)) {
+		const Common::Point center = hero()->getCenter();
+		if ((float)center.y <= 250.0f)
+			return 2;
+		return 4;
+	}
+	if (g_ngi->_inputController->isObjectHit(PIC_SC18_LADDER2))
+		return 4;
+	if (g_ngi->_inputController->isObjectHit(PIC_SC18_LADDER3))
+		return 4;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc18Controller::OnUpdate (17F738)
+void Sc18Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+
+	for (uint i = 0; i < _cells.size(); i++) {
+		AniObject *ani = _cells[i].ani;
+		if (ani->_movement)
+			continue;
+		const int kind = _cells[i].kind;
+		if (kind & 2) {
+			ani->startMovement(MV_KSL_SWINGBOY, 0, -1);
+			if (ani->isOnScreen(_scene))
+				unlockCatalogItem("ANI_BOY");
+		} else if (kind & 4) {
+			ani->startMovement(MV_KSL_SWINGGIRL, 0, -1);
+			if (ani->isOnScreen(_scene))
+				unlockCatalogItem("ANI_GIRL");
+		} else if (kind & 0x20) {
+			ani->startMovement(MV_KSL_SWINGMAN, 0, -1);
+		} else if (kind & 1) {
+			ani->startMovement(MV_KSL_SWING, 0, -1);
+		}
+		if (ani->_movement)
+			ani->_movement->_loopDelay = 83;
+	}
+	if (_wheelRuns && _lastAngle != _angle) {
+		if (_wheel->_rotation == 0.0f)
+			g_ngi->playSound(_scene->_sceneId == SC_18 ? SND_18_006 : SND_19_015, 0);
+		_lastAngle = _angle;
+		tickCells();
+	}
+	if (_manReady && getManDist() >= 17.0f)
+		_manReady = false;
+	if (!_manReady && getManDist() < 17.0f)
+		_manReady = true;
+	_scene->_behaviorController->enableAllQueuesForAni(hero(), !_manReady);
+	if ((_cells[0].kind & 1) && _manReady && _cells[0].ani->isOnScreen(_scene))
+		_scene->_motionController->deactivate();
+	else
+		_scene->_motionController->activate();
+	if (_wheelRuns) {
+		float angle = (float)((double)_lastAngle + (double)elapsed * 0.013962634224014083 / 83.0);
+		if (angle > kTwoPi)
+			angle = (float)(angle - kTwoPi);
+		_angle = angle;
+		_wheel->_rotation = _angle;
+	}
+}
+
+// CSc18Controller::OnMouseLKeyUp (17FA50)
+bool Sc18Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+
+	if (_manOnWheel) {
+		_touchOffsetX = -1;
+		_touchStartCameraX = -1;
+		_touchStartCameraY = -1;
+		_touchOffsetY = -1;
+		_touchCameraX = -1;
+		_touchCameraY = -1;
+		_touchX = -1;
+		_touchY = -1;
+		_touching = false;
+		_dragged = false;
+		return true;
+	}
+	bool handled = FPController::onMouseLKeyUp(id, x, y);
+	if (!handled) {
+		Interact *interact = findInteractionUnderCursor();
+		if (interact && canInterruptManQueue() && _interactObjectId != interact->_objectId) {
+			const Common::String &name = interact->_actionName;
+			bool turnedDown = false;
+			if (name == "INT_295" || name == "INT_102")
+				turnedDown = g_ngi->_exitManager->getExitDestAngle(PIC_SC18_LADDER1) == 180.0f;
+			if (turnedDown) {
+				runInteractionWithMouse("INT_108", x, y);
+				_interactObjectId = interact->_objectId;
+				handled = true;
+			} else {
+				bool turnedUp = false;
+				if (name == "INT_104")
+					turnedUp = g_ngi->_exitManager->getExitDestAngle(PIC_SC18_LADDER1) == 0.0f;
+				if (turnedUp) {
+					runInteractionWithMouse("INT_103", x, y);
+					_interactObjectId = interact->_objectId;
+					handled = true;
+				}
+			}
+		}
+	}
+	if (_scene->_sceneId == SC_19 && !_manOnWheel && g_ngi->_inputController->getInteractHitObjectId() == PIC_SC19_RTRUBA31)
+		return true;
+	return handled;
+}
+
+// CSc18Controller::OnMessage (17FC58)
+void Sc18Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+
+	if (message == "MSG_SC18_SHOWMANJUMPTO") {
+		doShowManJumpto();
+	} else if (message == "MSG_SC18_SHOWBOYJUMP") {
+		doShowBoyJump();
+	} else if (message == "MSG_SC18_SHOWGIRLJUMP") {
+		doShowGirlJump();
+	} else if (message == "MSG_SC18_SHOWMANJUMP") {
+		doShowManJump();
+	} else if (message == "MSG_SC18_SHOWBOYJUMPTO") {
+		doShowBoyJumpto();
+	} else if (message == "MSG_SC18_SHOWGIRLJUMPTO") {
+		doShowGirlJumpto();
+	} else if (message == "MSG_SC18_MANREADY") {
+		_manReady = true;
+	} else if (message == "MSG_SC3_HIDEDOMINO") {
+		_domino->_flags &= ~4;
+	} else if (message == "MSG_SC18_CLICKBOARD") {
+		onBoardClick();
+	} else if (message == "MSG_TOLADDER" || message == "MSG_FROMLADDER") {
+		setLadderVes("INT_103", "INT_108", message);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc18Controller::OnRender (17FE1C)
+void Sc18Controller::onRender(Common::Point scroll) {
+	FPController::onRender(scroll);
+}
+
+// CSc18Controller::UpdateScroll (17FE24)
+void Sc18Controller::updateScroll() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::updateScroll();
+		return;
+	}
+	if (_follow)
+		FPController::updateScroll();
+}
+
+// CSc18Controller::DefaultScroll (17FE32)
+void Sc18Controller::defaultScroll() {
+	if (!controllerRunsSceneLogic() || !_smooth) {
+		FPController::defaultScroll();
+		return;
+	}
+
+	if (_follow) {
+		const Common::Point center = _follow->getCenter();
+		_heroCenterX = center.x;
+		_heroCenterY = center.y;
+	}
+	const float margin = marginX();
+	const int viewWidth = g_ngi->gameWidth();
+	const int viewHeight = g_ngi->_backgroundSurface.h;
+	if (_scrollX && isScrollXScene()) {
+		if (_heroCenterX >= (_scene->_x - margin) + _marginX) {
+			if (_heroCenterX > ((_scene->_x + viewWidth) + margin) - _marginX)
+				_targetX = (_heroCenterX - ((_scene->_x + viewWidth) + margin)) + _offsetX;
+		} else {
+			_targetX = ((_heroCenterX - _scene->_x) + margin) - _offsetX;
+		}
+	}
+	if (_scrollY && isScrollYScene()) {
+		if (_heroCenterY >= _scene->_y + _marginY) {
+			if (_heroCenterY > (_scene->_y + viewHeight) - _marginY)
+				_targetY = (_heroCenterY - (_scene->_y + viewHeight)) + _offsetY;
+		} else {
+			_targetY = (_heroCenterY - _scene->_y) - _offsetY;
+		}
+	}
+	limitScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc18controller.h b/engines/ngi/fullpipe/sc18controller.h
new file mode 100644
index 00000000000..e72b80cbe27
--- /dev/null
+++ b/engines/ngi/fullpipe/sc18controller.h
@@ -0,0 +1,159 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC18CONTROLLER_H
+#define NGI_FULLPIPE_SC18CONTROLLER_H
+
+#include "common/array.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+class PictureObject;
+
+/** CSc18Controller (the big wheel with the swings; CSc19Controller is the other side of it) */
+class Sc18Controller : public FPController {
+public:
+	explicit Sc18Controller(int sceneId);
+	~Sc18Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void onRender(Common::Point scroll) override;
+	void updateScroll() override;
+	void defaultScroll() override;
+	bool canSwipeMan(float x, float y) override;
+	/** vtable slot 72 (288) */
+	virtual void onCloseUpsell();
+
+	void setCloseUpsell();
+	void saveState();
+	void prepareBoyTo();
+	void prepareGirlTo();
+	void prepareManTo();
+	void tickCellsNoswing();
+	void doShowBoyJump();
+	void doShowGirlJump();
+	void doShowBoyJumpto();
+	void doShowGirlJumpto();
+	float getManDist();
+	void resetCells();
+	void initState();
+	void prepareSwitch1819(uint entranceId);
+	void tickCells();
+	void doShowManJump();
+	void doShowManJumpto();
+	void updateNumRides();
+	void onBoardClick();
+	void createCells(AniObject *chair);
+	void initSwitch1819();
+
+protected:
+	/** _WHEELCELL (64 bytes): one swing of the wheel */
+	struct WheelCell {
+		AniObject *ani = nullptr; // +0
+		double angle = 0.0; // +8
+		double startAngle = 0.0; // +16
+		float homeX = 0.0f; // +24
+		float homeY = 0.0f; // +28
+		float x = 0.0f; // +32
+		float y = 0.0f; // +36
+		int kind = 0; // +40: 1 empty, 2 boy, 4 girl, 8 boy in the air, 16 girl in the air, 32 man
+		int staticsId = 0; // +44
+		int movementId = 0; // +48
+		int frame = 0; // +52
+		bool visible = false; // +56
+	};
+
+	/** +348: what a scene keeps when it is left; scenes 18 and 19 pass it on */
+	struct State {
+		float angle = 0.0f; // +348
+		float lastAngle = 0.0f; // +352
+		int boyCell = 0; // +356
+		int targetCell = 0; // +360
+		int manCell = 0; // +364
+		int manJumpCell = 0; // +368
+		int riderKind = 0; // +372
+		int field376 = 0;
+		int field380 = 0;
+		int boyRides = 0; // +384
+		int girlRides = 0; // +388
+		bool boyWaiting = false; // +392
+		bool manReady = false;
+		bool manOnWheel = false;
+		bool flag303 = false;
+		int field396 = 0;
+		bool flag308 = false; // +400
+		bool girlWaiting = false;
+		int boyMovementId = 0; // +404
+		int girlMovementId = 0; // +408
+		int boyFrame = 0; // +412
+		int girlFrame = 0; // +416
+	};
+
+	bool _wheelRuns = true; // +215
+	PictureObject *_wheel = nullptr; // +216
+	float _angle = 0.0f; // +220
+	float _lastAngle = 0.0f; // +224
+	float _centerX = 0.0f; // +228
+	float _centerY = 0.0f; // +232
+	float _boyX = 0.0f; // +236
+	float _boyY = 0.0f; // +240
+	float _girlX = 0.0f; // +244
+	float _girlY = 0.0f; // +248
+	AniObject *_boy = nullptr; // +252
+	AniObject *_girl = nullptr; // +256
+	AniObject *_domino = nullptr; // +260
+	int _boyCell = 0; // +264
+	int _targetCell = 0; // +268
+	int _manCell = -1; // +272
+	int _manJumpCell = -1; // +276
+	int _manRides = 3; // +280
+	bool _wheelActive = false; // +284
+	int _riderKind = -1; // +288
+	int _boyRides = 0; // +292
+	int _girlRides = 0; // +296
+	bool _boyWaiting = true; // +300
+	bool _manReady = false; // +301
+	bool _manOnWheel = false; // +302
+	bool _flag303 = false; // +303
+	int _manJumpAngle = 13; // +304
+	bool _flag308 = false; // +308
+	bool _girlWaiting = true; // +309
+	Common::Array<WheelCell> _cells; // +312
+	AniObject *_chair = nullptr; // +324
+	int _savedBoyMovementId = -1; // +328
+	int _savedGirlMovementId = -1; // +332
+	int _savedBoyFrame = -1; // +336
+	int _savedGirlFrame = -1; // +340
+	bool _keepCells = false; // +344
+	State _state; // +348
+	bool _closeUpsell = false; // +420
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC18CONTROLLER_H
diff --git a/engines/ngi/fullpipe/sc19controller.cpp b/engines/ngi/fullpipe/sc19controller.cpp
new file mode 100644
index 00000000000..6b12f8087c0
--- /dev/null
+++ b/engines/ngi/fullpipe/sc19controller.cpp
@@ -0,0 +1,117 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/objects.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc19controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+// CSc19Controller::CSc19Controller (17FFE8)
+Sc19Controller::Sc19Controller(int sceneId) : Sc18Controller(sceneId) {
+}
+
+// CSc19Controller::~CSc19Controller (17FFB0)
+Sc19Controller::~Sc19Controller() {
+}
+
+// CSc19Controller::OnShow (18000C)
+void Sc19Controller::onShow() {
+	_keepCells = false;
+	Sc18Controller::onShow();
+	_follow = nullptr;
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	AniObject *cordie = _scene->findAniObjectById(ANI_CORDIE, 0);
+	cordie->stopMovement(false);
+	if (g_ngi->getState(sO_Sugar) == sO_Present) {
+		cordie->setPosition(Common::Point(227, 377));
+		cordie->setStatic(ST_CDI_SUGAR, false);
+	} else {
+		cordie->setPosition(Common::Point(230, 315));
+		cordie->setStatic(ST_CDI_EMPTY2, false);
+	}
+}
+
+// CSc19Controller::OnHide (18014C)
+void Sc19Controller::onHide() {
+	Sc18Controller::onHide();
+}
+
+// CSc19Controller::GetCursorType (180154)
+int Sc19Controller::getCursorType(float x, float y) {
+	return Sc18Controller::getCursorType(x, y);
+}
+
+// CSc19Controller::OnUpdate (18015C)
+void Sc19Controller::onUpdate(uint32 elapsed) {
+	Sc18Controller::onUpdate(elapsed);
+}
+
+// CSc19Controller::OnMouseLKeyUp (180164)
+bool Sc19Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	return Sc18Controller::onMouseLKeyUp(id, x, y);
+}
+
+// CSc19Controller::OnMessage (18016C)
+void Sc19Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		Sc18Controller::onMessage(message, param, queue);
+		return;
+	}
+
+	if (message == "MSG_SC18_SHOWBOYJUMP") {
+		doShowBoyJump();
+	} else if (message == "MSG_SC18_SHOWGIRLJUMP") {
+		doShowGirlJump();
+	} else if (message == "MSG_SC18_SHOWMANJUMP") {
+		doShowManJump();
+	} else if (message == "MSG_SC18_SHOWBOYJUMPTO") {
+		doShowBoyJumpto();
+	} else if (message == "MSG_SC18_SHOWGIRLJUMPTO") {
+		doShowGirlJumpto();
+	} else if (message == "MSG_SC19_UPDATENUMRIDES") {
+		updateNumRides();
+	} else if (message == "MSG_REMOVE_GIRL") {
+		g_ngi->setState(sO_Girl, g_ngi->getStateValue(sO_Girl, sO_IsRiding));
+	} else if (message == "MSG_SC19_MOVESUGAR") {
+		AniObject *cordie = _scene->findAniObjectById(ANI_CORDIE, 0);
+		cordie->setStatic(ST_CDI_SUGAR, false);
+		cordie = _scene->findAniObjectById(ANI_CORDIE, 0);
+		cordie->setPosition(Common::Point(227, 377));
+		cordie->_z = 20;
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc19controller.h b/engines/ngi/fullpipe/sc19controller.h
new file mode 100644
index 00000000000..9661b295b19
--- /dev/null
+++ b/engines/ngi/fullpipe/sc19controller.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC19CONTROLLER_H
+#define NGI_FULLPIPE_SC19CONTROLLER_H
+
+#include "ngi/fullpipe/sc18controller.h"
+
+namespace NGI {
+
+/** CSc19Controller: the other side of the big wheel */
+class Sc19Controller : public Sc18Controller {
+public:
+	explicit Sc19Controller(int sceneId);
+	~Sc19Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC19CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index cbfd9f2af95..1bdf8accc7a 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -53,6 +53,8 @@
 #include "ngi/fullpipe/sc33controller.h"
 #include "ngi/fullpipe/sc22controller.h"
 #include "ngi/fullpipe/sc34controller.h"
+#include "ngi/fullpipe/sc18controller.h"
+#include "ngi/fullpipe/sc19controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -69,25 +71,6 @@
 
 namespace NGI {
 
-// CSc18Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc18Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
-// CSc19Controller::OnShow: after CSc18Controller::OnShow the margins and offsets of the camera
-void Sc19Controller::onShow() {
-	Sc18Controller::onShow();
-	_follow = nullptr; // +60: set by CSc19Controller::OnShow, the camera does not follow the hero
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSc23Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
 void Sc23Controller::onShow() {
 	FPController::onShow();
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index 821806a8dde..ad1518189bc 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,18 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc18Controller : public FPController {
-public:
-	explicit Sc18Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
-class Sc19Controller : public Sc18Controller {
-public:
-	explicit Sc19Controller(int sceneId) : Sc18Controller(sceneId) {}
-	void onShow() override;
-};
-
 class Sc23Controller : public FPController {
 public:
 	explicit Sc23Controller(int sceneId) : FPController(sceneId) {}
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 75dd2027978..d3da02420f1 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -120,6 +120,8 @@ MODULE_OBJS = \
 	fullpipe/sc15controller.o \
 	fullpipe/sc16controller.o \
 	fullpipe/sc17controller.o \
+	fullpipe/sc18controller.o \
+	fullpipe/sc19controller.o \
 	fullpipe/sc20controller.o \
 	fullpipe/sc21controller.o \
 	fullpipe/sc22controller.o \


Commit: af108f6f8a6e1c1015cf78f873beb78843b8eb85
    https://github.com/scummvm/scummvm/commit/af108f6f8a6e1c1015cf78f873beb78843b8eb85
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port CSc25Controller

Changed paths:
  A engines/ngi/fullpipe/sc25controller.cpp
  A engines/ngi/fullpipe/sc25controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index a0307ea8485..0e37d96224e 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -1995,4 +1995,12 @@ namespace NGI {
 #define ST_SC18_BOARD_STATE1 28064
 #define ST_CDI_SUGAR 1532
 
+// Android: names of obj.h that the ported controllers use
+#define PIC_INV_BOARD 1245
+#define PIC_INV_BROOM 1783
+#define PIC_INV_SWAB 1923
+#define PIC_INV_LOPAT 1924
+#define PIC_HELP_6_01 23220
+#define SND_MUS_2 63279
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/sc25controller.cpp b/engines/ngi/fullpipe/sc25controller.cpp
new file mode 100644
index 00000000000..70b1e0685cf
--- /dev/null
+++ b/engines/ngi/fullpipe/sc25controller.cpp
@@ -0,0 +1,637 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/inventory.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc25controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+namespace {
+
+bool isNear(float value, float target) {
+	return ABS(value - target) <= 3.0f;
+}
+
+// CUtils::ResetManLadderQueue (14FADC)
+void resetManLadderQueue(AniObject *man, float x, float y, MessageQueue *queue) {
+	const Common::Point center = man->getCenter();
+	float centerY = center.y;
+	if (!man->_movement) {
+		// CAniObject::GetMovement() is 0 while the hero has no movement
+		Movement *current = nullptr;
+		if (current) {
+			const Common::Point size = current->getCenterMovementSize(0, -1);
+			centerY -= size.y;
+		}
+	}
+	float nextX = x;
+	float nextY = y;
+	float bestX = 0;
+	float bestY = 0;
+	int cur = queue->getCurCommandNum();
+	int bestDistance = 20000;
+	int bestIndex = -1;
+	while (cur < (int)queue->getCount()) {
+		Command *cmd = queue->getCommandByIndex(cur);
+		Movement *movement = cmd ? man->getMovement(cmd->getMovementId()) : nullptr;
+		if (movement) {
+			if ((int)ABS(nextY - centerY) < bestDistance || bestIndex < 0) {
+				bestX = nextX;
+				bestY = nextY;
+				bestDistance = (int)ABS(nextY - centerY);
+				bestIndex = cur;
+			}
+			const Common::Point size = movement->getCenterMovementSize(0, -1);
+			nextX += size.x;
+			nextY += size.y;
+		}
+		cur++;
+	}
+	for (int i = 0; i < bestIndex; i++)
+		queue->removeCommand(0, true);
+
+	Command *first = queue->getCommandByIndex(0);
+	if (man->_movement || !first || man->_lastMovementId != first->getMovementId()) {
+		man->setCenter(Common::Point((int)bestX, (int)bestY));
+		man->setQueue(nullptr);
+	} else {
+		queue->removeCommand(0, true);
+		const int num = queue->getCurCommandNum();
+		man->setStatic(man->_lastMovementId, false);
+		man->setCenter(Common::Point((int)bestX, (int)bestY));
+		man->_lastMovementId = num;
+	}
+}
+
+} // End of anonymous namespace
+
+// CSc25Controller::CSc25Controller (184EC8)
+Sc25Controller::Sc25Controller(int sceneId) : FPController(sceneId) {
+}
+
+// CSc25Controller::~CSc25Controller (185284): the scene deletes its animations itself when it goes
+Sc25Controller::~Sc25Controller() {
+	if (_scene && !_scene->_destroying)
+		cleanBeardeds();
+}
+
+// CSc25Controller::OnEnterMan (184F10)
+void Sc25Controller::onEnterMan() {
+	_scene->runQueue(_waterPresent ? QU_SC25_ENTERUP_WATER : QU_SC25_ENTERUP_FLOOR, 2, false);
+}
+
+// CSc25Controller::TryPutBoard (184F38)
+void Sc25Controller::tryPutBoard() {
+	const int staticsId = hero()->getStaticsId();
+	if (staticsId == ST_MAN_STANDLADDER || staticsId == ST_MAN_LADDERDOWN_R) {
+		hero()->setStatic(ST_MAN_STANDLADDER, false);
+		hero()->setPosition(Common::Point(281, 481));
+		_scene->runQueueWithAni(QU_SC25_PUTBOARD, hero(), 2);
+		_onBoard = true;
+		_idleReady = false;
+		_boardSelectable = false;
+	}
+}
+
+// CSc25Controller::TryRowHand (184FB0)
+void Sc25Controller::tryRowHand() {
+	hero()->stopMovement(false);
+	hero()->setStatic(hero()->getStaticsId(), (hero()->_flags & 8) != 0);
+	const Common::Point center = hero()->getCenter();
+	if (hero()->getStaticsId() != ST_MAN25_ONBOARD)
+		return;
+
+	if (isNear(center.x, 371) && isNear(center.y, 502)) {
+		hero()->setStatic(ST_MAN25_ONBOARD, false);
+		_scene->runQueueWithAni(QU_SC25_TRYROWHAND, hero(), 2);
+		_idleReady = false;
+	} else if (hero()->_flags & 8) {
+		if (isNear(center.x, 633) && isNear(center.y, 502)) {
+			hero()->setStatic(ST_MAN25_ONBOARD, true);
+			_scene->runQueueWithAni(QU_SC25_TRYROWHAND_R, hero(), 2);
+			_idleReady = false;
+		}
+	}
+}
+
+// CSc25Controller::TryWater (1850B8)
+void Sc25Controller::tryWater() {
+	const int staticsId = hero()->getStaticsId();
+	if (staticsId == ST_MAN_STANDLADDER || staticsId == ST_MAN_LADDERDOWN_R) {
+		hero()->setStatic(ST_MAN_STANDLADDER, false);
+		_scene->runQueueWithAni(QU_SC25_TRYWATER, hero(), 2);
+	}
+}
+
+// CSc25Controller::ShowBoardL (185100)
+void Sc25Controller::showBoardL() {
+	_board->_flags |= 4;
+	_board->setStatic(ST_BRD25_RIGHT2, false);
+	_board->setCenter(Common::Point(453, 557));
+	_board->_z = 28;
+}
+
+// CSc25Controller::ShowBoardLClose (185140)
+void Sc25Controller::showBoardLClose() {
+	_board->_flags |= 4;
+	_board->setStatic(ST_BRD25_RIGHT2, true);
+	_board->setCenter(Common::Point(632, 557));
+	_board->_z = 28;
+}
+
+// CSc25Controller::TryBackToTruba (185180)
+void Sc25Controller::tryBackToTruba() {
+	if (!hero()->_movement && hero()->getStaticsId() == ST_MAN_RIGHT && (hero()->_flags & 8)) {
+		hero()->setStatic(ST_MAN_RIGHT, false);
+		_scene->runQueueWithAni(QU_SC25_BACKTOTRUBA, hero(), 2);
+	}
+}
+
+// CSc25Controller::OnManIdleOnboard (1851D0)
+void Sc25Controller::onManIdleOnboard() {
+	const int staticsId = hero()->getStaticsId();
+	const uint32 value = random31();
+	if (value % 10 != 0) {
+		if (staticsId == ST_MAN25_ONBOARD)
+			hero()->startMovement(MV_MAN25_ONBOARD, 0, -1, (hero()->_flags & 8) != 0);
+	} else if (staticsId == ST_MAN25_ONBOARD) {
+		hero()->startMovement(MV_MAN25_CHIH, 0, -1, (hero()->_flags & 8) != 0);
+	}
+}
+
+// CSc25Controller::DoStopBeardeds (185244)
+void Sc25Controller::doStopBeardeds() {
+	_beardedsActive = false;
+}
+
+// CSc25Controller::CleanBeardeds (18524C)
+void Sc25Controller::cleanBeardeds() {
+	for (AniObject *ani : _beardeds) {
+		if (ani->_copyId != 0) {
+			_scene->removeAni(ani);
+			delete ani;
+		}
+	}
+	_beardeds.clear();
+}
+
+// CSc25Controller::TrySwitchUp (1852D0)
+bool Sc25Controller::trySwitchUp() {
+	AniObject *man = hero();
+	const int current = man->_movement ? man->_lastMovementId : man->getStaticsId();
+	if (current != (man->_movement ? MV_MAN_GOLADDERDOWN : ST_MAN_STANDLADDER))
+		return false;
+
+	InteractionController *controller = getGameLoaderInteractionController();
+	Interact *interact = controller->findInteraction(_scene, PIC_SC25_LADDERDOWN, g_ngi->_inputController->getObjectId());
+	if (!interact)
+		return false;
+
+	MessageQueue *queue = new MessageQueue(interact->_messageQueue, 0, 0);
+	queue->_scene = _scene;
+	if (queue->getCommandByIndex(0)->_args.getValOrDefault("type") == "GO_MCTL")
+		queue->removeCommand(0, true);
+	const Common::Point heroPos = interact->getHeroPos();
+	_scene->runQueueObject(queue, nullptr, 0);
+	resetManLadderQueue(man, heroPos.x, heroPos.y, queue);
+	return true;
+}
+
+// CSc25Controller::TryRow (1853F8)
+void Sc25Controller::tryRow() {
+	hero()->stopMovement(false);
+	hero()->setStatic(hero()->getStaticsId(), (hero()->_flags & 8) != 0);
+	const Common::Point center = hero()->getCenter();
+	if (hero()->getStaticsId() != ST_MAN25_ONBOARD)
+		return;
+
+	if (hero()->_flags & 8) {
+		if (isNear(center.x, 633) && isNear(center.y, 502)) {
+			hero()->setStatic(ST_MAN25_ONBOARD, true);
+			if (!_scene->runQueueWithAni(QU_SC25_ROWTOLADDER, hero(), 2))
+				warning("sc25::TryRow: m_scene->RunQueue() returned false!");
+			_idleReady = false;
+			g_ngi->playSound(SND_25_030, 0);
+		}
+	} else if (isNear(center.x, 371) && isNear(center.y, 502)) {
+		hero()->setStatic(ST_MAN25_ONBOARD, (hero()->_flags & 8) != 0);
+		if (!_scene->runQueueWithAni(QU_SC25_ROWTOTRUBA, hero(), 2))
+			warning("sc25::TryRow: m_scene->RunQueue() returned false!");
+		_idleReady = false;
+	}
+}
+
+// CSc25Controller::TryBoardToTruba (185594)
+void Sc25Controller::tryBoardToTruba() {
+	hero()->stopMovement(false);
+	hero()->setStatic(hero()->getStaticsId(), (hero()->_flags & 8) != 0);
+	const Common::Point center = hero()->getCenter();
+	if (hero()->getStaticsId() != ST_MAN25_ONBOARD)
+		return;
+
+	if (isNear(center.x, 635) && isNear(center.y, 502)) {
+		hero()->setStatic(ST_MAN25_ONBOARD, false);
+		if (!_scene->runQueueWithAni(QU_SC25_MANTOTRUBA, hero(), 2))
+			warning("sc25::TryBoardToTruba: m_scene->RunQueue() returned false!");
+	} else {
+		if (!(hero()->_flags & 8))
+			return;
+		if (!isNear(center.x, 633))
+			return;
+		if ((float)center.y - 502.0f > 3.0f)
+			return;
+		hero()->setStatic(ST_MAN25_ONBOARD, true);
+		if (!_scene->runQueueWithAni(QU_SC25_MANTOTRUBA_R, hero(), 2))
+			warning("sc25::TryBoardToTruba: m_scene->RunQueue() returned false!");
+	}
+	_idleReady = false;
+}
+
+// CSc25Controller::TryGetBoard (1856FC)
+void Sc25Controller::tryGetBoard(int itemId) {
+	hero()->stopMovement(false);
+	const Common::Point center = hero()->getCenter();
+	if (!isNear(center.x, 788) || !isNear(center.y, 468))
+		return;
+
+	if (!hero()->_movement)
+		hero()->setStatic(ST_MAN_RIGHT, true);
+	if (_board->getStaticsId() != ST_BRD25_RIGHT2)
+		return;
+
+	if (_board->_flags & 8) {
+		if (itemId == 0) {
+			hero()->setStatic(ST_MAN_RIGHT, true);
+			if (!_scene->runQueueWithAni(QU_SC25_TRUBATOBOARD, hero(), 2))
+				warning("sc25::TryGetBoard: m_scene->RunQueue() returned false!");
+			_onBoard = true;
+		}
+		return;
+	}
+
+	switch (itemId) {
+	case PIC_INV_BROOM:
+		hero()->setStatic(ST_MAN_RIGHT, true);
+		if (!_scene->runQueueWithAni(QU_SC25_TRYBROOM, hero(), 2))
+			warning("sc25::TryGetBoard: m_scene->RunQueue() returned false!");
+		g_ngi->playSound(SND_25_028, 0);
+		break;
+	case PIC_INV_LOPAT:
+		hero()->setStatic(ST_MAN_RIGHT, true);
+		if (!_scene->runQueueWithAni(QU_SC25_TRYSPADE, hero(), 2))
+			warning("sc25::TryGetBoard: m_scene->RunQueue() returned false!");
+		g_ngi->playSound(SND_25_028, 0);
+		break;
+	case PIC_INV_SWAB:
+		hero()->setStatic(ST_MAN_RIGHT, true);
+		if (!_scene->runQueueWithAni(QU_SC25_TRYSWAB, hero(), 2))
+			warning("sc25::TryGetBoard: m_scene->RunQueue() returned false!");
+		break;
+	case 0:
+		hero()->setStatic(ST_MAN_RIGHT, true);
+		_scene->runQueueWithAni(QU_SC25_TRYHAND, hero(), 2);
+		g_ngi->playSound(SND_25_028, 0);
+		break;
+	default:
+		break;
+	}
+}
+
+// CSc25Controller::TryLadderUp (185954)
+void Sc25Controller::tryLadderUp() {
+	const int staticsId = hero()->getStaticsId();
+	if (staticsId == ST_MAN_STANDLADDER || staticsId == ST_MAN_LADDERDOWN_R) {
+		hero()->setStatic(ST_MAN_STANDLADDER, false);
+		if (!_scene->runQueueWithAni(QU_SC25_LADDERUP, hero(), 2))
+			warning("sc25::TryLadderUp: m_scene->RunQueue() returned false!");
+	}
+}
+
+// CSc25Controller::TryBearded (1859E0)
+void Sc25Controller::tryBearded() {
+	static const int queues[3] = { QU_SC25_BEARDED, QU_SC25_BEARDED2, QU_SC25_BEARDED3 };
+
+	if (random31() > 14316556)
+		return;
+
+	for (int i = 0; i < 3; i++) {
+		MessageQueue *queue = copyQueue(_scene, queues[i]);
+		queue->setObjectCopyAll(_beardeds[i]->_copyId);
+		queue->getCommandByIndex(0)->setParamFloat("x", (float)(random31() / 3904515 + 100));
+		if (!_scene->runQueueObject(queue, nullptr, 3))
+			warning("sc25::TryBearded: m_scene->RunQueue() returned false!");
+		if (i == 0)
+			_beardedTimer = 0;
+		if (i < 2 && random31() > 536870910)
+			break;
+	}
+}
+
+// CSc25Controller::TryBoardToLadder (185BC0)
+void Sc25Controller::tryBoardToLadder() {
+	hero()->stopMovement(false);
+	hero()->setStatic(hero()->getStaticsId(), (hero()->_flags & 8) != 0);
+	const Common::Point center = hero()->getCenter();
+	if (hero()->getStaticsId() != ST_MAN25_ONBOARD)
+		return;
+
+	if ((hero()->_flags & 8) && isNear(center.x, 191) && (float)center.y - 502.0f <= 3.0f) {
+		hero()->setStatic(ST_MAN25_ONBOARD, true);
+		if (!_scene->runQueueWithAni(QU_SC25_BOARDTOLADDER, hero(), 2))
+			warning("sc25::TryBoardToLadder: m_scene->RunQueue() returned false!");
+	} else {
+		if (!isNear(center.x, 371))
+			return;
+		if (!isNear(center.y, 502))
+			return;
+		hero()->setStatic(ST_MAN25_ONBOARD, false);
+		if (!_scene->runQueueWithAni(QU_SC25_BACKTOLADDER, hero(), 2))
+			warning("sc25::TryBoardToLadder: m_scene->RunQueue() returned false!");
+	}
+	_onBoard = false;
+	_boardSelectable = true;
+	_idleReady = false;
+	const Task *task = g_ngi->_taskManager->findTask("GET_FROM_CURLING_SC27");
+	if (task && (task->_state == Task::kStateActivated || task->_state == Task::kStateSeen)) {
+		g_ngi->_taskManager->deactivateTask("GET_FROM_CURLING_SC27");
+		g_ngi->_taskManager->activateTask("FIND_EXIT_VENTEL_SC26");
+	}
+}
+
+// CSc25Controller::DoStartBeardeds (185E80)
+void Sc25Controller::doStartBeardeds() {
+	_beardedTimer = 0;
+	AniObject *source = g_ngi->findScene(SC_COMMON)->findAniObjectById(ANI_BEARDED_CMN, 0);
+	for (int i = 0; i < 3; i++) {
+		AniObject *ani = new AniObject(source);
+		_beardeds.push_back(ani);
+		ani->setStatic(ST_BRDCMN_EMPTY, false);
+		_scene->addAni(ani, false);
+	}
+	_beardedsActive = true;
+}
+
+// CSc25Controller::OnShow (185F08)
+void Sc25Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	_water = _scene->findAniObjectById(ANI_WATER25, 0);
+	_board = _scene->findAniObjectById(ANI_BOARD25, 0);
+	_board->_flags &= ~4;
+	_drop = _scene->findAniObjectById(ANI_DROP_25, 0);
+	_onBoard = false;
+	if (g_ngi->getStateId(sO_Pool) < g_ngi->getStateValue(sO_Pool, sO_HalfFull)) {
+		_waterPresent = false;
+		_scrollY = true;
+	} else {
+		_waterPresent = true;
+		_scrollY = false;
+		g_ngi->playSound(SND_25_006, 1);
+	}
+	_boardSelectable = false;
+	_idleReady = false;
+	if (_waterPresent)
+		_water->_flags |= 4;
+	else
+		_water->_flags &= ~4;
+
+	if (hero()->getPosition().x > 700) {
+		const Common::String state = g_ngi->getState(sO_Board_25);
+		if (state != sO_FarAway) {
+			if (state == sO_Nearby || state == sO_WithDudeOnRight)
+				showBoardLClose();
+		} else {
+			showBoardL();
+			g_ngi->playSound(SND_25_029, 0);
+		}
+		_boardSelectable = false;
+	} else if (g_ngi->getState(sO_Board_25) != sO_WithDudeOnLeft) {
+		_boardSelectable = true;
+	} else if (g_ngi->_inventory->getItemByName("ANI_INV_BOARD")->_counter <= 0) {
+		g_ngi->_inventory->addItem("ANI_INV_BOARD", 1);
+	}
+	_beardedsActive = false;
+	_beardedTimer = 0;
+
+	BehaviorController *behavior = _scene->_behaviorController.get();
+	if (_waterPresent) {
+		behavior->getAniQueue(_drop->_id, QU_DRP25_TOFLOOR)->setEnabled(false);
+		behavior->getAniQueue(_drop->_id, QU_DRP25_TOWATER)->setEnabled(true);
+		if (_scene->_currentEntranceId == TrubaRight) {
+			behavior->disableAllMusic();
+		} else {
+			behavior->disableAllMusic();
+			enableSound(SND_MUS_2, true);
+		}
+	} else {
+		behavior->getAniQueue(_drop->_id, QU_DRP25_TOFLOOR)->setEnabled(true);
+		behavior->getAniQueue(_drop->_id, QU_DRP25_TOWATER)->setEnabled(false);
+	}
+}
+
+// CSc25Controller::OnHide (1862C8)
+void Sc25Controller::onHide() {
+	cleanBeardeds();
+	FPController::onHide();
+}
+
+// CSc25Controller::GetCursorType (1862D8)
+int Sc25Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic() || !_waterPresent)
+		return FPController::getCursorType(x, y);
+
+	CursorController *cursor = g_ngi->_inputController;
+	const int objectId = cursor->getObjectId();
+	if (cursor->isObjectHit(ANI_WATER25)) {
+		if ((_boardSelectable && objectId == PIC_INV_BOARD) || (_onBoard && objectId == PIC_INV_LOPAT))
+			return 102;
+		if (objectId == 0)
+			return 1;
+	}
+	if (!cursor->isObjectHit(ANI_BOARD25)
+		|| (objectId != 0 && (uint)(objectId - PIC_INV_SWAB) > 1 && objectId != PIC_INV_BROOM))
+		return FPController::getCursorType(x, y);
+	return 102;
+}
+
+// CSc25Controller::OnUpdate (186374)
+void Sc25Controller::onUpdate(uint32 elapsed) {
+	FPController::onUpdate(elapsed);
+	if (!controllerRunsSceneLogic())
+		return;
+
+	if (_beardedsActive) {
+		_beardedTimer += elapsed;
+		if (_beardedTimer > 9959)
+			tryBearded();
+	}
+	if (_waterPresent && !_water->_movement)
+		_water->startMovement(MV_WTR25_FLOW, 0, -1);
+	if (_onBoard && !hero()->_movement && !hero()->_queue && _idleReady)
+		onManIdleOnboard();
+	_idleReady = true;
+	if ((_board->_flags & 4) && !_board->_movement)
+		_board->startMovement(MV_BRD25_RIGHT, 0, -1, (_board->_flags & 8) != 0);
+}
+
+// CSc25Controller::OnMouseLKeyUp (186448)
+bool Sc25Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	const bool handled = FPController::onMouseLKeyUp(id, x, y);
+	if (!controllerRunsSceneLogic() || handled)
+		return handled;
+
+	CursorController *cursor = g_ngi->_inputController;
+	GameObject *hit = cursor->getInteractHitObject();
+	if (_waterPresent) {
+		if (hit && hero() != hit && !hero()->_queue) {
+			switch (hit->_id) {
+			case ANI_WATER25:
+				if (_onBoard || cursor->getObjectId() != PIC_INV_BOARD) {
+					if (_onBoard || cursor->getObjectId() != 0) {
+						if (_onBoard && cursor->getObjectId() == PIC_INV_LOPAT)
+							tryRow();
+						else if (_onBoard && cursor->getObjectId() == 0)
+							tryRowHand();
+					} else {
+						tryWater();
+					}
+				} else {
+					tryPutBoard();
+				}
+				break;
+			case ANI_BOARD25:
+				tryGetBoard(cursor->getObjectId());
+				break;
+			case PIC_SC25_LADDERUP:
+				trySwitchUp();
+				break;
+			default:
+				break;
+			}
+			if (!hero()->_queue) {
+				if (_onBoard && hit->_id == PIC_SC25_RTRUBA && cursor->getObjectId() == 0) {
+					tryBoardToTruba();
+				} else if (hit->_id != PIC_SC25_RTRUBA || cursor->getObjectId() != 0) {
+					if (_onBoard && hit->_id == PIC_SC25_LADDERUP && cursor->getObjectId() == 0)
+						tryBoardToLadder();
+					else if (!_onBoard && hit->_id == PIC_SC25_LADDERUP && cursor->getObjectId() == 0)
+						tryLadderUp();
+				} else {
+					tryBackToTruba();
+				}
+			}
+		}
+	} else if (hit && (uint)(hit->_id - PIC_SC25_LADDERUP) <= 1) {
+		trySwitchUp();
+	}
+	return handled;
+}
+
+// CSc25Controller::OnRender (1865E4)
+void Sc25Controller::onRender(Common::Point scroll) {
+	FPController::onRender(scroll);
+}
+
+// CSc25Controller::OnMessage (1865EC)
+void Sc25Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+
+	if (message == "MSG_SC25_ENTERTRUBA") {
+		tryBoardToTruba();
+	} else if (message == "MSG_SC25_TOLADDER") {
+		tryBoardToLadder();
+	} else if (message == "MSG_SC25_ENTERMAN") {
+		onEnterMan();
+	} else if (message == "MSG_SC25_STARTBEARDEDS") {
+		doStartBeardeds();
+	} else if (message == "MSG_SC25_STOPBEARDEDS") {
+		doStopBeardeds();
+	} else if (message == "MSG_BRD_TURN") {
+		const int sound = scaledRandom(3);
+		if (sound == 0)
+			g_ngi->playSound(SND_25_025, 0);
+		else if (sound == 1)
+			g_ngi->playSound(SND_25_026, 0);
+		else
+			g_ngi->playSound(SND_25_027, 0);
+	} else if (message == "MSG_DISABLE_HELP_6_01") {
+		g_ngi->_help->disableHelpWithId(PIC_HELP_6_01);
+		bool hasBoth = false;
+		const InventoryItem *pottie = g_ngi->_inventory->getItemByName("ANI_INV_POTTIE");
+		if (pottie && pottie->_counter > 0) {
+			const InventoryItem *spade = g_ngi->_inventory->getItemByName("ANI_INV_LOPAT");
+			hasBoth = spade && spade->_counter > 0;
+		}
+		if (hasBoth) {
+			g_ngi->_taskManager->deactivateTask("GET_POTTIE_LOPATA_SC25");
+			g_ngi->_taskManager->activateTask("HALF_RELEASE_POOL_SC26");
+		}
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc25Controller::UpdateScroll (1868BC)
+void Sc25Controller::updateScroll() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::updateScroll();
+		return;
+	}
+
+	bool started = true;
+	Interact *interact = getGameLoaderInteractionController()->findInteractionByName("INT_144");
+	if (interact->_messageQueue->getCurCommandNum() == -1) {
+		MessageQueue *queue = _scene->findMessageQueue(QU_SC25_ENTERUP_FLOOR);
+		started = queue->getCurCommandNum() != -1;
+	}
+	_smooth = started;
+	FPController::updateScroll();
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc25controller.h b/engines/ngi/fullpipe/sc25controller.h
new file mode 100644
index 00000000000..c8e6dd13818
--- /dev/null
+++ b/engines/ngi/fullpipe/sc25controller.h
@@ -0,0 +1,80 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC25CONTROLLER_H
+#define NGI_FULLPIPE_SC25CONTROLLER_H
+
+#include "common/array.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+
+namespace NGI {
+
+/** CSc25Controller (pool, board, beardeds); sceneHandler25 runs the scene until wired */
+class Sc25Controller : public FPController {
+public:
+	explicit Sc25Controller(int sceneId);
+	~Sc25Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onRender(Common::Point scroll) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void updateScroll() override;
+
+	void onEnterMan();
+	void tryPutBoard();
+	void tryRowHand();
+	void tryWater();
+	void showBoardL();
+	void showBoardLClose();
+	void tryBackToTruba();
+	void onManIdleOnboard();
+	void doStopBeardeds();
+	void cleanBeardeds();
+	bool trySwitchUp();
+	void tryRow();
+	void tryBoardToTruba();
+	void tryGetBoard(int itemId);
+	void tryLadderUp();
+	void tryBearded();
+	void tryBoardToLadder();
+	void doStartBeardeds();
+
+private:
+	AniObject *_water = nullptr; // +216: ANI_WATER25
+	AniObject *_board = nullptr; // +220: ANI_BOARD25
+	AniObject *_drop = nullptr; // +224: ANI_DROP_25
+	Common::Array<AniObject *> _beardeds; // +228: copies of ANI_BEARDED_CMN
+	bool _waterPresent = true; // +240
+	bool _onBoard = false; // +241: the hero rides the board
+	bool _boardSelectable = false; // +242
+	bool _idleReady = false; // +243: OnManIdleOnboard may run
+	bool _beardedsActive = false; // +244
+	int _beardedTimer = 0; // +248
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC25CONTROLLER_H
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index 1bdf8accc7a..de44e2b3dc7 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -55,6 +55,7 @@
 #include "ngi/fullpipe/sc34controller.h"
 #include "ngi/fullpipe/sc18controller.h"
 #include "ngi/fullpipe/sc19controller.h"
+#include "ngi/fullpipe/sc25controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -80,15 +81,6 @@ void Sc23Controller::onShow() {
 	_offsetY = 300;
 }
 
-// CSc25Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc25Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSplashScreenController::CreateControllers: the class of the scene number, else CFPController
 void createSceneController(int sceneId) {
 	switch (sceneId) {
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index ad1518189bc..e31e250eaff 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -34,12 +34,6 @@ public:
 	void onShow() override;
 };
 
-class Sc25Controller : public FPController {
-public:
-	explicit Sc25Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 } // End of namespace NGI
 
 #endif // NGI_FULLPIPE_SCENECONTROLLERS_H
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index d3da02420f1..520ef347657 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -126,6 +126,7 @@ MODULE_OBJS = \
 	fullpipe/sc21controller.o \
 	fullpipe/sc22controller.o \
 	fullpipe/sc24controller.o \
+	fullpipe/sc25controller.o \
 	fullpipe/sc26controller.o \
 	fullpipe/sc27controller.o \
 	fullpipe/sc28controller.o \


Commit: a9fff976d6a8e35f3a476355a4b6f61c418f567f
    https://github.com/scummvm/scummvm/commit/a9fff976d6a8e35f3a476355a4b6f61c418f567f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port CSc23Controller

Changed paths:
  A engines/ngi/fullpipe/sc23controller.cpp
  A engines/ngi/fullpipe/sc23controller.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/sc25controller.cpp
    engines/ngi/fullpipe/scenecontrollers.cpp
    engines/ngi/fullpipe/scenecontrollers.h
    engines/ngi/module.mk


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 0e37d96224e..3b482db0cfd 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -2003,4 +2003,25 @@ namespace NGI {
 #define PIC_HELP_6_01 23220
 #define SND_MUS_2 63279
 
+// Android: names of obj.h that the ported controllers use
+#define ST_LUK23_CLOSED 1815
+#define SC_23_MINI 10004
+#define GD_SC23_MINI 23126
+
+// Android: names of obj.h that the ported controllers use
+#define PIC_23M_BGR 23090
+#define ANI_23M_BUTTON 23113
+#define MV_23M_BUTTON 23115
+#define ANI_23M_CALENDWHEEL 23116
+#define ST_23M_CND_0 23093
+#define ST_23M_CND_1 23094
+#define ST_23M_CND_2 23095
+#define ST_23M_CND_3 23096
+#define ST_23M_CND_4 23097
+#define ST_23M_CND_5 23098
+#define ST_23M_CND_6 23099
+#define ST_23M_CND_7 23100
+#define ST_23M_CND_8 23101
+#define ST_23M_CND_9 23102
+
 #endif /* NGI_CONSTANTS_H */
diff --git a/engines/ngi/fullpipe/sc23controller.cpp b/engines/ngi/fullpipe/sc23controller.cpp
new file mode 100644
index 00000000000..075dae84180
--- /dev/null
+++ b/engines/ngi/fullpipe/sc23controller.cpp
@@ -0,0 +1,771 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/input.h"
+#include "ngi/interaction.h"
+#include "ngi/messages.h"
+#include "ngi/motion.h"
+#include "ngi/objects.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/sc23controller.h"
+#include "ngi/fullpipe/taskmanager.h"
+
+namespace NGI {
+
+namespace {
+
+bool isNear(float value, float target) {
+	return ABS(value - target) <= 3.0f;
+}
+
+} // End of anonymous namespace
+
+// CSc23Controller::CSc23Controller (182A90)
+Sc23Controller::Sc23Controller(int sceneId) : FPController(sceneId), _flyPack(new FlyPack()) {
+	_wheelPos[0] = 367;
+	_wheelPos[1] = 129;
+	_wheelPos[2] = 390;
+	_wheelPos[3] = 129;
+	_wheelPos[4] = 419;
+	_wheelPos[5] = 129;
+	_wheelPos[6] = 444;
+	_wheelPos[7] = 129;
+}
+
+// CSc23Controller::~CSc23Controller (182A34)
+Sc23Controller::~Sc23Controller() {
+}
+
+// CSc23Controller::CheckOnCalendar (182B4C)
+void Sc23Controller::checkOnCalendar() {
+	bool onCalendar = false;
+	if (!hero()->_movement && hero()->getStaticsId() == ST_MAN_STANDLADDER) {
+		if (hero()->getCenter().x == 405) {
+			if (hero()->getCenter().y == 220)
+				onCalendar = true;
+		}
+	}
+	_onCalendar = onCalendar;
+}
+
+// CSc23Controller::DoCalendarExit (182BB0)
+void Sc23Controller::doCalendarExit() {
+	if (!hero()->_movement && hero()->getStaticsId() == ST_MAN_STANDLADDER && !hero()->_queue) {
+		MessageQueue *queue = copyQueue(_scene, QU_SC23_FROMCALENDAREXIT);
+		_scene->runQueueObject(queue, nullptr, 2);
+		_calendarState = 2;
+	}
+}
+
+// the statics a wheel is in, or ends in
+int Sc23Controller::wheelStage(const AniObject *wheel) const {
+	if (wheel->_movement)
+		return wheel->_movement->_nextStatic->_staticsId;
+	return wheel->getStaticsId();
+}
+
+// CSc23Controller::CanStartKiss (182C10)
+bool Sc23Controller::canStartKiss() {
+	const int stage0 = wheelStage(_wheels[0]);
+	const int stage1 = wheelStage(_wheels[1]);
+	const int stage2 = wheelStage(_wheels[2]);
+	const int stage3 = wheelStage(_wheels[3]);
+	int expected;
+	if (stage0 == ST_CND_1) {
+		if (stage1 != ST_CND_4) {
+			if (stage1 == ST_CND_1 && stage2 == ST_CND_1 && stage3 == ST_CND_1)
+				g_ngi->_achievementsManager->addActivatingCounter("ACHIEVEMENT_1111", 100, "UNDEF");
+			return false;
+		}
+		if (stage2 != ST_CND_0)
+			return false;
+		expected = ST_CND_2;
+	} else {
+		if (stage0 != ST_CND_0 || stage1 != ST_CND_2 || stage2 != ST_CND_1)
+			return false;
+		expected = ST_CND_4;
+	}
+	if (stage3 != expected)
+		return false;
+	return (_giraffee->_flags & 4) != 0;
+}
+
+// CSc23Controller::GetWheelToWheelStat (182D68)
+int Sc23Controller::getWheelToWheelStat(int staticsId) const {
+	static const int stages[10] = { ST_CND_0, ST_CND_1, ST_CND_2, ST_CND_3, ST_CND_4, ST_CND_5, ST_CND_6, ST_CND_7, ST_CND_8, ST_CND_9 };
+	const uint index = (uint)(staticsId - ST_23M_CND_0);
+	if (index <= 9)
+		return stages[index];
+	return 0;
+}
+
+// CSc23Controller::OnHideStool (182D88)
+void Sc23Controller::onHideStool() {
+	_scene->findAniObjectById(ANI_TABURETTE, 0)->_flags &= ~4;
+}
+
+// CSc23Controller::OnShowStool (182DA4)
+void Sc23Controller::onShowStool() {
+	_scene->runQueue(QU_SC23_SHOWSTOOL, 4, false);
+}
+
+// CSc23Controller::DoStartKiss (182DC4)
+void Sc23Controller::doStartKiss() {
+	_kiss->stopQueue();
+	_kiss->stopMovement(false);
+	_kiss->moveToStaticChain(ST_GRFU_UP);
+	g_ngi->stopAllSoundInstances(SND_MUS_SC04_LOOP);
+	g_ngi->playSound(SND_MUS_SC04_STOP2, 0);
+	_scene->runQueue(QU_SC23_STARTKISS, 4, false);
+	g_ngi->_taskManager->deactivateTask("USE_CALENDAR_SC23");
+}
+
+// CSc23Controller::DoSpinWheel1 (182E60)
+void Sc23Controller::doSpinWheel1() {
+	AniObject *wheel = _wheels[0];
+	switch (wheel->getStaticsId()) {
+	case ST_CND_0:
+		wheel->startMovement(MV_CND_0_1, 0, -1);
+		break;
+	case ST_CND_1:
+		wheel->startMovement(MV_CND_1_2, 0, -1);
+		break;
+	case ST_CND_2:
+		wheel->startMovement(MV_CND_2_3, 0, -1);
+		break;
+	case ST_CND_3:
+		wheel->setStatic(ST_CND_9, false);
+		_wheels[0]->startMovement(MV_CND_9_0, 0, -1);
+		break;
+	default:
+		break;
+	}
+	if (canStartKiss())
+		doStartKiss();
+}
+
+// CSc23Controller::DoSpinWheel2 (182F2C)
+void Sc23Controller::doSpinWheel2() {
+	AniObject *wheel = _wheels[1];
+	switch (wheel->getStaticsId()) {
+	case ST_CND_0:
+		wheel->startMovement(MV_CND_0_1, 0, -1);
+		break;
+	case ST_CND_1:
+		wheel->startMovement(MV_CND_1_2, 0, -1);
+		break;
+	case ST_CND_2:
+		wheel->startMovement(MV_CND_2_3, 0, -1);
+		break;
+	case ST_CND_3:
+		wheel->startMovement(MV_CND_3_4, 0, -1);
+		break;
+	case ST_CND_4:
+		_wheels[1]->startMovement(MV_CND_4_5, 0, -1);
+		break;
+	case ST_CND_5:
+		wheel->startMovement(MV_CND_5_6, 0, -1);
+		break;
+	case ST_CND_6:
+		wheel->startMovement(MV_CND_6_7, 0, -1);
+		break;
+	case ST_CND_7:
+		wheel->startMovement(MV_CND_7_8, 0, -1);
+		break;
+	case ST_CND_8:
+		_wheels[1]->startMovement(MV_CND_8_9, 0, -1);
+		break;
+	case ST_CND_9:
+		_wheels[1]->startMovement(MV_CND_9_0, 0, -1);
+		break;
+	default:
+		break;
+	}
+	if (canStartKiss())
+		doStartKiss();
+}
+
+// CSc23Controller::DoSpinWheel3 (1830A0)
+void Sc23Controller::doSpinWheel3() {
+	AniObject *wheel = _wheels[2];
+	const int staticsId = wheel->getStaticsId();
+	if (staticsId == ST_CND_0) {
+		wheel->startMovement(MV_CND_0_1, 0, -1);
+	} else if (staticsId == ST_CND_1) {
+		wheel->setStatic(ST_CND_9, false);
+		_wheels[2]->startMovement(MV_CND_9_0, 0, -1);
+	}
+	if (canStartKiss())
+		doStartKiss();
+}
+
+// CSc23Controller::DoSpinWheel4 (18312C)
+void Sc23Controller::doSpinWheel4() {
+	AniObject *wheel = _wheels[3];
+	switch (wheel->getStaticsId()) {
+	case ST_CND_0:
+		wheel->startMovement(MV_CND_0_1, 0, -1);
+		break;
+	case ST_CND_1:
+		wheel->startMovement(MV_CND_1_2, 0, -1);
+		break;
+	case ST_CND_2:
+		wheel->startMovement(MV_CND_2_3, 0, -1);
+		break;
+	case ST_CND_3:
+		wheel->startMovement(MV_CND_3_4, 0, -1);
+		break;
+	case ST_CND_4:
+		_wheels[3]->startMovement(MV_CND_4_5, 0, -1);
+		break;
+	case ST_CND_5:
+		wheel->startMovement(MV_CND_5_6, 0, -1);
+		break;
+	case ST_CND_6:
+		wheel->startMovement(MV_CND_6_7, 0, -1);
+		break;
+	case ST_CND_7:
+		wheel->startMovement(MV_CND_7_8, 0, -1);
+		break;
+	case ST_CND_8:
+		_wheels[3]->startMovement(MV_CND_8_9, 0, -1);
+		break;
+	case ST_CND_9:
+		_wheels[3]->startMovement(MV_CND_9_0, 0, -1);
+		break;
+	default:
+		break;
+	}
+	if (canStartKiss())
+		doStartKiss();
+}
+
+// CSc23Controller::SyncWheels (1832A0)
+void Sc23Controller::syncWheels(const Common::Array<AniObject *> &miniWheels) {
+	for (uint i = 0; i < _wheels.size(); i++)
+		_wheels[i]->setStatic(getWheelToWheelStat(miniWheels[i]->getStaticsId()), false);
+	if (canStartKiss())
+		doStartKiss();
+}
+
+// CSc23Controller::OnBtnClick (1832F8)
+void Sc23Controller::onBtnClick() {
+	if (_onCalendar)
+		return;
+
+	if (hero()->_queue) {
+		if (canInterruptManQueue()) {
+			hero()->_queue->stop(false);
+			hero()->setQueue(nullptr);
+		}
+	}
+	if (hero()->_queue) {
+		if (!hero()->_movement && hero()->getStaticsId() == ST_MAN_STANDLADDER) {
+			if (g_ngi->getState(sO_UpperHatch_23) == sO_Opened) {
+				g_ngi->pushScene(SC_23_MINI);
+				_mini->syncWheels(_wheels);
+			}
+		}
+		return;
+	}
+
+	Common::Point center = hero()->getCenter();
+	if (isNear(center.x, 405)) {
+		center = hero()->getCenter();
+		if (isNear(center.y, 220)) {
+			_onCalendar = true;
+			return;
+		}
+	}
+	center = hero()->getCenter();
+	bool mirror = isNear(center.x, 276);
+	if (mirror) {
+		center = hero()->getCenter();
+		mirror = isNear(center.y, 438);
+		if (mirror) {
+			if (hero()->_movement) {
+				mirror = false;
+			} else {
+				mirror = hero()->getStaticsId() == ST_MAN_RIGHT;
+				if (mirror) {
+					MessageQueue *queue = copyQueue(_scene, QU_SC23_TOCALENDAR);
+					queue->addCommandToEnd(messageCommand("MSG_SC23_TOCALENDAR"));
+					_scene->runQueueObject(queue, hero(), 2);
+					return;
+				}
+			}
+		}
+	}
+	MessageQueue *started = mctlStartMove(276, 438, true, ST_MAN_RIGHT, mirror);
+	if (started)
+		started->addCommandToEnd(messageCommand("MSG_SC23_TOCALENDAR"));
+}
+
+// CSc23Controller::DoCalendarFrom (183568)
+void Sc23Controller::doCalendarFrom(float x, float y) {
+	if (!hero()->_movement && hero()->getStaticsId() == ST_MAN_STANDLADDER && !hero()->_queue) {
+		CursorController *cursor = g_ngi->_inputController;
+		if (cursor->getHitObjectId() != GD_SC23_MINI) {
+			MessageQueue *queue = copyQueue(_scene, QU_SC23_FROMCALENDAR);
+			if (cursor->getInteractHitObjectId() != PIC_SC23_LADDERU)
+				queue->addCommandToEnd(createMouseCommand(_scene, x, y, cursor->getObjectId()));
+			hero()->setQueue(queue);
+			_scene->runQueueObject(queue, nullptr, 2);
+			_onCalendar = false;
+			_calendarState = 0;
+		}
+	}
+}
+
+// CSc23Controller::OnstoolMousedown (183624)
+bool Sc23Controller::onStoolMouseDown(float x, float y) {
+	const bool canInterrupt = canInterruptManQueue();
+	if (canInterrupt) {
+		MessageQueue *queue = copyQueue(_scene, QU_SC23_FROMSTOOL);
+		queue->addCommandToEnd(createMouseCommand(_scene, x, y, g_ngi->_inputController->getObjectId()));
+		_scene->runQueueObject(queue, hero(), 2);
+	}
+	return canInterrupt;
+}
+
+// CSc23Controller::OnShow (183690)
+void Sc23Controller::onShow() {
+	FPController::onShow();
+	_marginX = 300;
+	_marginY = 200;
+	_offsetX = 400;
+	_offsetY = 300;
+	if (!controllerRunsSceneLogic())
+		return;
+
+	g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	if (_scene->_currentEntranceId != 0)
+		g_ngi->_exitManager->setExitAngle(PIC_SC23_LADDERU, 0.0f);
+	_wheels.clear();
+	AniObject *source = _scene->findAniObjectById(ANI_CALENDWHEEL, 0);
+	for (int i = 0; i < 4; i++) {
+		AniObject *wheel = _scene->findAniObjectById(ANI_CALENDWHEEL, i);
+		if (!wheel) {
+			wheel = new AniObject(source);
+			_scene->addAni(wheel, false);
+			wheel->setStatic(ST_CND_0, false);
+			wheel->setPosition(Common::Point((int)_wheelPos[i * 2], (int)_wheelPos[i * 2 + 1]));
+		}
+		_wheels.push_back(wheel);
+	}
+	_onCalendar = false;
+	_field261 = false;
+	_calendarState = 0;
+	_kiss = _scene->findAniObjectById(ANI_GIRAFFE_TOP, 0);
+	_giraffee = _scene->findAniObjectById(ANI_GIRAFFEE, 0);
+	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_23"));
+
+	if (g_ngi->getState(sO_UpperHatch_23) == sO_Opened) {
+		_scene->findPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags |= 4;
+		_scene->findPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags &= ~4;
+		_scene->findPictureObjectById(PIC_SC23_BTN1, 0)->_flags |= 4;
+		_scene->findPictureObjectById(PIC_SC23_BTN2, 0)->_flags |= 4;
+		_scene->findPictureObjectById(PIC_SC23_BTN3, 0)->_flags |= 4;
+		_scene->findPictureObjectById(PIC_SC23_BTN4, 0)->_flags |= 4;
+		if (_giraffee->getStaticsId() == ST_GRFG_EMPTY || !(_giraffee->_flags & 4)) {
+			_giraffee->moveToStaticChain(ST_GRFG_BALD);
+			_giraffee->_flags |= 4;
+		}
+		for (uint i = 0; i < 4; i++)
+			_wheels[i]->_flags |= 4;
+		_scene->findAniObjectById(ANI_LUK23_U, 0)->moveToStaticChain(ST_LUK23U_OPEN);
+	} else {
+		_scene->findPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags &= ~4;
+		_scene->findPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags |= 4;
+		_scene->findPictureObjectById(PIC_SC23_BTN1, 0)->_flags &= ~4;
+		_scene->findPictureObjectById(PIC_SC23_BTN2, 0)->_flags &= ~4;
+		_scene->findPictureObjectById(PIC_SC23_BTN3, 0)->_flags &= ~4;
+		_scene->findPictureObjectById(PIC_SC23_BTN4, 0)->_flags &= ~4;
+		_giraffee->_flags &= ~4;
+		for (uint i = 0; i < 4; i++)
+			_wheels[i]->_flags &= ~4;
+		_scene->findAniObjectById(ANI_LUK23_U, 0)->moveToStaticChain(ST_LUK23U_CLOSED);
+		_flyPack->addFly(_scene, 600, 90, 0, 0);
+	}
+
+	if (g_ngi->getState(sO_LowerHatch_23) == sO_Opened) {
+		_kiss->_flags |= 4;
+		if (g_ngi->getState(sO_LowerPipe_21) == sO_IsOpened) {
+			_kiss->moveToStaticChain(ST_GRFU_KISS);
+			_giraffee->_flags &= ~4;
+		} else {
+			_kiss->moveToStaticChain(ST_GRFU_UP);
+			bool giraffeeShown = false;
+			if (g_ngi->getState(sO_UpperHatch_23) == sO_Opened)
+				giraffeeShown = (_giraffee->_flags & 4) != 0;
+			if (giraffeeShown)
+				_kiss->setCenter(Common::Point(614, 362));
+			else
+				_kiss->setCenter(Common::Point(618, 350));
+			if (canStartKiss())
+				_wheels[1]->setStatic(ST_CND_5, false);
+		}
+		_scene->findAniObjectById(ANI_LUK23_D, 0)->moveToStaticChain(ST_LUK23_OPEN);
+		_scene->findAniObjectById(ANI_TABURETTE, 0)->setCenter(Common::Point(700, 535));
+	} else {
+		_kiss->_flags &= ~4;
+		_scene->findAniObjectById(ANI_LUK23_D, 0)->moveToStaticChain(ST_LUK23_CLOSED);
+	}
+	if (g_ngi->getState(sO_UpperHatch_23) == sO_Opened)
+		_scene->_behaviorController->getAniQueue(_kiss->_id, QU_GRFU_TURN_UD)->setEnabled(false);
+
+	_mini = static_cast<Sc23MiniController *>(&sceneController(*g_ngi->findScene(SC_23_MINI)));
+	BehaviorController *behavior = _scene->_behaviorController.get();
+	if (g_ngi->getState(sO_LowerPipe_21) == sO_IsOpened) {
+		behavior->enableAllMusic();
+	} else if (g_ngi->getState(sO_CoinSlot_22) != sO_IsFull) {
+		behavior->enableAllMusic();
+	} else {
+		behavior->disableAllMusic();
+		if (isSoundPlayed(SND_MUS_SC04_LOOP))
+			warning("STUB/untested: CSc23Controller::OnShow: CSound::Attenuate with the music volume and pan 50");
+		else
+			g_ngi->playSound(SND_MUS_SC04_LOOP, 0);
+	}
+}
+
+// CSc23Controller::OnHide (183D34)
+void Sc23Controller::onHide() {
+	_wheels.clear();
+	_flyPack->deleteAllFlies();
+	FPController::onHide();
+}
+
+// CSc23Controller::GetCursorType (183D54)
+int Sc23Controller::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+
+	CursorController *cursor = g_ngi->_inputController;
+	if (cursor->isObjectHit(PIC_SC23_LADDERU) && !_onCalendar)
+		return cursor->getObject() ? 101 : 4;
+	if (cursor->isObjectHit(PIC_SC23_BTN1) || cursor->isObjectHit(PIC_SC23_BTN2)
+		|| cursor->isObjectHit(PIC_SC23_BTN3) || cursor->isObjectHit(PIC_SC23_BTN4)
+		|| cursor->isObjectHit(ANI_CALENDWHEEL))
+		return 1;
+	return FPController::getCursorType(x, y);
+}
+
+// CSc23Controller::OnUpdate (183DF4)
+void Sc23Controller::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+
+	if (g_ngi->getState(sO_CoinSlot_22) == sO_IsFull) {
+		if (g_ngi->getState(sO_LowerPipe_21) == sO_IsOpened) {
+			if (!isSoundPlayed(SND_MUS_SC04_STOP2))
+				_scene->_behaviorController->enableAllMusic();
+		} else if (!isSoundPlayed(SND_MUS_SC04_LOOP)) {
+			if (!isSoundPlayed(SND_MUS_SC04_STOP2))
+				g_ngi->playSound(SND_MUS_SC04_LOOP, 0);
+		}
+	}
+	FPController::onUpdate(elapsed);
+	_flyPack->onUpdate(elapsed);
+}
+
+// CSc23Controller::OnMouseLKeyUp (183F10)
+bool Sc23Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	const bool handled = FPController::onMouseLKeyUp(id, x, y);
+	if (!controllerRunsSceneLogic() || handled)
+		return handled;
+
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (hit && hit->_id == ANI_CALENDWHEEL)
+		onWheelClick(static_cast<AniObject *>(hit));
+	checkOnCalendar();
+	if (_onCalendar) {
+		// the original reads the id of the hit object without a test
+		const int hitId = hit ? hit->_id : 0;
+		if (hitId == PIC_SC23_LADDER) {
+			doCalendarExit();
+		} else if (hitId == GD_SC23_MINI) {
+			if (g_ngi->getState(sO_UpperHatch_23) == sO_Opened) {
+				g_ngi->pushScene(SC_23_MINI);
+				_mini->syncWheels(_wheels);
+			}
+		} else {
+			doCalendarFrom(x, y);
+		}
+	} else if (hit && hit->_id == PIC_SC23_LADDERU) {
+		onBtnClick();
+	}
+	return handled;
+}
+
+// CSc23Controller::OnMessage (184030)
+void Sc23Controller::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onMessage(message, param, queue);
+		return;
+	}
+
+	if (message == "MSG_SC23_CLICKBTN1" || message == "MSG_SC23_CLICKBTN2" || message == "MSG_SC23_CLICKBTN3"
+		|| message == "MSG_SC23_CLICKBTN4" || message == "MSG_SC23_TOCALENDAR") {
+		onBtnClick();
+	} else if (message == "MSG_SC23_SPINWHEEL1") {
+		doSpinWheel1();
+	} else if (message == "MSG_SC23_SPINWHEEL2") {
+		doSpinWheel2();
+	} else if (message == "MSG_SC23_SPINWHEEL3") {
+		doSpinWheel3();
+	} else if (message == "MSG_SC23_SPINWHEEL4") {
+		doSpinWheel4();
+	} else if (message == "MSG_SC22_HIDESTOOL") {
+		onHideStool();
+	} else if (message == "MSG_SC23_HIDEGIRAFFEE") {
+		_giraffee->_flags &= ~4;
+	} else if (message == "MSG_SC23_TAKETABURETTE") {
+		Interact *interact = getGameLoaderInteractionController()->findInteraction(_scene, ANI_TABURETTE, -1);
+		interact->run(_scene);
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CSc23Controller::IsNeedReact (1841C0)
+bool Sc23Controller::isNeedReact(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::isNeedReact(x, y);
+
+	if (g_ngi->_inputController->getObject() || !canInterruptManQueue())
+		return FPController::isNeedReact(x, y);
+	GameObject *hit = _scene->getVisObjVHitInteract(x, y);
+	if (_interactObjectId == (hit ? hit->_id : 0))
+		return FPController::isNeedReact(x, y);
+	Interact *interact = getGameLoaderInteractionController()->findInteraction(x, y);
+	if (!interact)
+		return FPController::isNeedReact(x, y);
+	interact = getGameLoaderInteractionController()->findInteraction(x, y);
+	bool needed = false;
+	if (interact->_actionName == "INT_125A")
+		needed = g_ngi->getState(sO_UpperHatch_23) != sO_Opened;
+	if (!needed)
+		return FPController::isNeedReact(x, y);
+	return false;
+}
+
+// CSc23MiniController::CSc23MiniController (184574)
+Sc23MiniController::Sc23MiniController(int sceneId) : FPController(sceneId) {
+	static const float buttonOffsets[8] = { 108, 409, 99, 0, 124, 0, 97, 0 };
+	static const float wheelOffsets[8] = { 116, 314, 94, 0, 118, 0, 98, 0 };
+	for (int i = 0; i < 8; i++) {
+		_buttonOffsets[i] = buttonOffsets[i];
+		_wheelOffsets[i] = wheelOffsets[i];
+	}
+	_stage[0] = 0;
+	_stage[1] = ST_23M_CND_3;
+	_stage[2] = 0;
+	_stage[3] = ST_23M_CND_1;
+	_stage[4] = 0;
+	_sc23 = static_cast<Sc23Controller *>(&sceneController(*g_ngi->findScene(SC_23)));
+}
+
+// CSc23MiniController::~CSc23MiniController (184514)
+Sc23MiniController::~Sc23MiniController() {
+}
+
+// CSc23MiniController::OnShow (184678)
+void Sc23MiniController::onShow() {
+	FPController::onShow();
+	if (!controllerRunsSceneLogic())
+		return;
+
+	const Common::Point origin = _scene->findPictureObjectById(PIC_23M_BGR, 0)->getPosition();
+	AniObject *button = _scene->findAniObjectById(ANI_23M_BUTTON, 0);
+	AniObject *wheel = _scene->findAniObjectById(ANI_23M_CALENDWHEEL, 0);
+	float buttonX = origin.x;
+	float buttonY = origin.y;
+	float wheelX = origin.x;
+	float wheelY = origin.y;
+	for (int i = 0; i < 4; i++) {
+		button = new AniObject(button);
+		_scene->addAni(button, false);
+		button->_flags |= 4;
+		buttonX += _buttonOffsets[i * 2];
+		buttonY += _buttonOffsets[i * 2 + 1];
+		button->setCenter(Common::Point((int)buttonX, (int)buttonY));
+
+		wheel = new AniObject(wheel);
+		_scene->addAni(wheel, false);
+		wheel->_flags |= 4;
+		wheelX += _wheelOffsets[i * 2];
+		wheelY += _wheelOffsets[i * 2 + 1];
+		wheel->setCenter(Common::Point((int)wheelX, (int)wheelY));
+
+		_buttons.push_back(button);
+		_wheels.push_back(wheel);
+	}
+}
+
+// CSc23MiniController::OnHide (1842F6)
+void Sc23MiniController::onHide() {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onHide();
+		return;
+	}
+	_scene->removeCopies();
+	_buttons.clear();
+	_wheels.clear();
+}
+
+// CSc23MiniController::OnMouseLKeyDown (1842E0)
+bool Sc23MiniController::onMouseLKeyDown(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyDown(id, x, y);
+	return false;
+}
+
+// CSc23MiniController::OnMouseRKeyUp (1842E4)
+bool Sc23MiniController::onMouseRKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseRKeyUp(id, x, y);
+	return false;
+}
+
+// CSc23MiniController::OnMouseRKeyDown (1842E8)
+bool Sc23MiniController::onMouseRKeyDown(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseRKeyDown(id, x, y);
+	return false;
+}
+
+// CSc23MiniController::OnMouseLKeyUpTop (1842EC)
+bool Sc23MiniController::onMouseLKeyUpTop(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUpTop(id, x, y);
+	return false;
+}
+
+// CSc23MiniController::IsInventoryEnabled (1842F2)
+bool Sc23MiniController::isInventoryEnabled() {
+	if (!controllerRunsSceneLogic())
+		return FPController::isInventoryEnabled();
+	return false;
+}
+
+// CSc23MiniController::TryStartNextMove (184318)
+void Sc23MiniController::tryStartNextMove(AniObject *wheel) {
+	int staticsId = wheel->getStaticsId();
+	if ((uint)wheel->_copyId < 5 && _stage[wheel->_copyId] == staticsId)
+		wheel->setStatic(ST_23M_CND_9, false);
+	// CAniObject::FindMovement(i): the i-th movement in the order of the ids
+	Common::Array<int> ids;
+	for (uint i = 0; i < wheel->_movements.size(); i++)
+		ids.push_back(wheel->_movements[i]->_id);
+	Common::sort(ids.begin(), ids.end());
+	for (uint i = 0; i < ids.size(); i++) {
+		Movement *movement = wheel->getMovement(ids[i]);
+		staticsId = wheel->getStaticsId();
+		if (movement->_prevStatic->_staticsId == staticsId) {
+			wheel->startMovement(movement->_id, 0, -1);
+			return;
+		}
+	}
+}
+
+// CSc23MiniController::GetWheelToWheelStat (184384)
+int Sc23MiniController::getWheelToWheelStat(int staticsId) const {
+	static const int stages[18] = {
+		ST_23M_CND_0, ST_23M_CND_1, 0, ST_23M_CND_2, 0, ST_23M_CND_3, 0, ST_23M_CND_4, 0,
+		ST_23M_CND_5, 0, ST_23M_CND_6, 0, ST_23M_CND_7, 0, ST_23M_CND_8, 0, ST_23M_CND_9
+	};
+	const uint index = (uint)(staticsId - ST_CND_0);
+	if (index <= 0x11)
+		return stages[index];
+	return 0;
+}
+
+// CSc23MiniController::SyncWheels (1843A4)
+void Sc23MiniController::syncWheels(const Common::Array<AniObject *> &mainWheels) {
+	for (uint i = 0; i < mainWheels.size(); i++)
+		_wheels[i]->setStatic(getWheelToWheelStat(mainWheels[i]->getStaticsId()), false);
+}
+
+// CSc23MiniController::OnUpdate (1843EA)
+void Sc23MiniController::onUpdate(uint32 elapsed) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onUpdate(elapsed);
+		return;
+	}
+	g_ngi->getSceneInStack(0)->update((int)elapsed);
+}
+
+// CSc23MiniController::OnGuiEvent (184404)
+void Sc23MiniController::onGuiEvent(const Common::String &id, const Common::String &event) {
+	if (!controllerRunsSceneLogic()) {
+		FPController::onGuiEvent(id, event);
+		return;
+	}
+	if (event == "unpress" && id == "PIC_23M_OK") {
+		_sc23->syncWheels(_wheels);
+		g_ngi->popScene();
+	}
+}
+
+// CSc23MiniController::GetCursorType (184448)
+int Sc23MiniController::getCursorType(float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::getCursorType(x, y);
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (hit)
+		return hit->_id == ANI_23M_BUTTON;
+	return 0;
+}
+
+// CSc23MiniController::OnMouseLKeyUp (184468)
+bool Sc23MiniController::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (!controllerRunsSceneLogic())
+		return FPController::onMouseLKeyUp(id, x, y);
+
+	GameObject *hit = g_ngi->_inputController->getInteractHitObject();
+	if (hit) {
+		if (hit->_id == ANI_23M_BUTTON) {
+			g_ngi->playSound(SND_CMN_080, 0);
+			tryStartNextMove(_wheels[hit->_copyId - 1]);
+			static_cast<AniObject *>(hit)->startMovement(MV_23M_BUTTON, 0, -1, false, false, false, -1);
+		}
+	} else {
+		g_ngi->popScene();
+	}
+	return true;
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc23controller.h b/engines/ngi/fullpipe/sc23controller.h
new file mode 100644
index 00000000000..9440222bc45
--- /dev/null
+++ b/engines/ngi/fullpipe/sc23controller.h
@@ -0,0 +1,119 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SC23CONTROLLER_H
+#define NGI_FULLPIPE_SC23CONTROLLER_H
+
+#include "common/array.h"
+#include "common/ptr.h"
+
+#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/floaters.h"
+
+namespace NGI {
+
+class Sc23MiniController;
+
+/** CSc23Controller (calendar, giraffe, kiss); sceneHandler23 runs the scene until wired */
+class Sc23Controller : public FPController {
+public:
+	explicit Sc23Controller(int sceneId);
+	~Sc23Controller() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	bool isNeedReact(float x, float y) override;
+
+	void checkOnCalendar();
+	void doCalendarExit();
+	bool canStartKiss();
+	int getWheelToWheelStat(int staticsId) const;
+	void onHideStool();
+	void onShowStool();
+	bool trySwitchUp() { return false; }
+	bool trySwitchDown() { return false; }
+	void doStartKiss();
+	void doSpinWheel1();
+	void doSpinWheel2();
+	void doSpinWheel3();
+	void doSpinWheel4();
+	/** CSc23Controller::SyncWheels: the wheels take the statics of the wheels of the mini scene */
+	void syncWheels(const Common::Array<AniObject *> &miniWheels);
+	void onBtnClick();
+	void doCalendarFrom(float x, float y);
+	bool onStoolMouseDown(float x, float y);
+	void onWheelClick(AniObject *wheel) {}
+
+private:
+	int wheelStage(const AniObject *wheel) const;
+
+	Common::Array<AniObject *> _wheels; // +216: ANI_CALENDWHEEL, the copies 0 to 3
+	float _wheelPos[8]; // +228: x and y of the four wheels
+	bool _onCalendar = false; // +260: the hero is at the calendar
+	bool _field261 = false; // +261
+	AniObject *_kiss = nullptr; // +264: ANI_GIRAFFE_TOP
+	AniObject *_giraffee = nullptr; // +268: ANI_GIRAFFEE
+	int _calendarState = 0; // +272: 2 after the exit from the calendar
+	Common::ScopedPtr<FlyPack> _flyPack; // +276
+	Sc23MiniController *_mini = nullptr; // +280: the controller of SC_23_MINI
+};
+
+/** CSc23MiniController (the calendar close-up, scene SC_23_MINI) */
+class Sc23MiniController : public FPController {
+public:
+	explicit Sc23MiniController(int sceneId);
+	~Sc23MiniController() override;
+
+	void onShow() override;
+	void onHide() override;
+	int getCursorType(float x, float y) override;
+	void onUpdate(uint32 elapsed) override;
+	void onGuiEvent(const Common::String &id, const Common::String &event) override;
+	bool onMouseLKeyDown(uint32 id, float x, float y) override;
+	bool onMouseRKeyUp(uint32 id, float x, float y) override;
+	bool onMouseRKeyDown(uint32 id, float x, float y) override;
+	bool onMouseLKeyUp(uint32 id, float x, float y) override;
+	bool onMouseLKeyUpTop(uint32 id, float x, float y) override;
+	bool isInventoryEnabled() override;
+
+	void tryStartNextMove(AniObject *wheel);
+	int getWheelToWheelStat(int staticsId) const;
+	/** CSc23MiniController::SyncWheels: the wheels take the statics of the wheels of the main scene */
+	void syncWheels(const Common::Array<AniObject *> &mainWheels);
+
+	const Common::Array<AniObject *> &wheels() const { return _wheels; }
+
+private:
+	float _buttonOffsets[8]; // +216: x and y step of the four buttons
+	float _wheelOffsets[8]; // +248: x and y step of the four wheels
+	int _stage[5]; // +276: statics of a wheel (by copy) that is followed by the first one again
+	Common::Array<AniObject *> _buttons; // +296: ANI_23M_BUTTON copies
+	Common::Array<AniObject *> _wheels; // +308: ANI_23M_CALENDWHEEL copies
+	Sc23Controller *_sc23 = nullptr; // +320: the controller of SC_23
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_SC23CONTROLLER_H
diff --git a/engines/ngi/fullpipe/sc25controller.cpp b/engines/ngi/fullpipe/sc25controller.cpp
index 70b1e0685cf..287fa7eae08 100644
--- a/engines/ngi/fullpipe/sc25controller.cpp
+++ b/engines/ngi/fullpipe/sc25controller.cpp
@@ -87,7 +87,7 @@ void resetManLadderQueue(AniObject *man, float x, float y, MessageQueue *queue)
 		queue->removeCommand(0, true);
 
 	Command *first = queue->getCommandByIndex(0);
-	if (man->_movement || !first || man->_lastMovementId != first->getMovementId()) {
+	if (man->_movement || !first || man->_lastMovementId != first->_cmd) {
 		man->setCenter(Common::Point((int)bestX, (int)bestY));
 		man->setQueue(nullptr);
 	} else {
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/scenecontrollers.cpp
index de44e2b3dc7..0e503b8bc0a 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/scenecontrollers.cpp
@@ -56,6 +56,7 @@
 #include "ngi/fullpipe/sc18controller.h"
 #include "ngi/fullpipe/sc19controller.h"
 #include "ngi/fullpipe/sc25controller.h"
+#include "ngi/fullpipe/sc23controller.h"
 #include "ngi/fullpipe/scenecontrollers.h"
 #include "ngi/fullpipe/sc03controller.h"
 #include "ngi/fullpipe/sc04controller.h"
@@ -72,15 +73,6 @@
 
 namespace NGI {
 
-// CSc23Controller::OnShow: after CFPController::OnShow the margins and offsets of the camera
-void Sc23Controller::onShow() {
-	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-}
-
 // CSplashScreenController::CreateControllers: the class of the scene number, else CFPController
 void createSceneController(int sceneId) {
 	switch (sceneId) {
@@ -153,6 +145,9 @@ void createSceneController(int sceneId) {
 	case SC_23:
 		new Sc23Controller(sceneId);
 		break;
+	case SC_23_MINI:
+		new Sc23MiniController(sceneId);
+		break;
 	case SC_24:
 		new Sc24Controller(sceneId);
 		break;
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/scenecontrollers.h
index e31e250eaff..da65cb22c34 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/scenecontrollers.h
@@ -28,12 +28,6 @@ namespace NGI {
 
 // The scene controllers (CScNNController), generated by scripts/ngi_gen_scene_controllers.py
 
-class Sc23Controller : public FPController {
-public:
-	explicit Sc23Controller(int sceneId) : FPController(sceneId) {}
-	void onShow() override;
-};
-
 } // End of namespace NGI
 
 #endif // NGI_FULLPIPE_SCENECONTROLLERS_H
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 520ef347657..f3c10f9109b 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -125,6 +125,7 @@ MODULE_OBJS = \
 	fullpipe/sc20controller.o \
 	fullpipe/sc21controller.o \
 	fullpipe/sc22controller.o \
+	fullpipe/sc23controller.o \
 	fullpipe/sc24controller.o \
 	fullpipe/sc25controller.o \
 	fullpipe/sc26controller.o \


Commit: 3a6483f06c19d91e3b01c2df2f0545893b89c877
    https://github.com/scummvm/scummvm/commit/3a6483f06c19d91e3b01c2df2f0545893b89c877
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc04Controller runs the scene logic of scene 4

Changed paths:
    engines/ngi/fullpipe/sc04controller.cpp
    engines/ngi/fullpipe/sc04controller.h
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/ngi.h


diff --git a/engines/ngi/fullpipe/sc04controller.cpp b/engines/ngi/fullpipe/sc04controller.cpp
index 2d580b05007..00d2a0447bc 100644
--- a/engines/ngi/fullpipe/sc04controller.cpp
+++ b/engines/ngi/fullpipe/sc04controller.cpp
@@ -1767,6 +1767,8 @@ void Sc04Controller::onShow() {
 	_marginY = 200;
 	_offsetX = 400;
 	_offsetY = 300;
+	if (controllerRunsSceneLogic())
+		onShowScene();
 }
 
 // CSc04Controller::OnRender: CFPController::OnRender, then the arcade interface over the scene
@@ -1777,12 +1779,32 @@ void Sc04Controller::onRender(Common::Point scroll) {
 
 // CSc04Controller::CanSwipeMan: not while the camera is held
 bool Sc04Controller::canSwipeMan(float, float) {
+	if (controllerRunsSceneLogic())
+		return !_cameraLocked;
 	return !g_vars->scene04_cameraLocked;
 }
 
 // CSc04Controller::UpdateScroll: camera held at x 380 while the arcade runs or the hand moves;
 // follows the hero again when no ladder, arcade or demo scroll is active
 void Sc04Controller::updateScroll() {
+	if (controllerRunsSceneLogic()) {
+		if (!heroOnLadder() && !_arcade)
+			_cameraLocked = false;
+		const bool moves = _hand && (_hand->_flags & 4) && _hand->_movement;
+		if (moves)
+			_cameraLocked = true;
+		if (_cameraLocked) {
+			if (moves || (_arcade && g_ngi->_aniMan)) {
+				setFollowHero(false);
+				if (fabsf(_scene->_x - 380.0f) > 3.0f)
+					setScrollTarget(380.0f - _scene->_x);
+			}
+		} else if (!_demoScroll) {
+			setFollowHero(true);
+		}
+		FPController::updateScroll();
+		return;
+	}
 	if (!g_vars->scene04_dudeOnLadder && !g_vars->scene04_soundPlaying)
 		g_vars->scene04_cameraLocked = false;
 
@@ -1805,6 +1827,8 @@ void Sc04Controller::updateScroll() {
 // CSc04Controller::OnMouseLKeyUp: base first, then ladder, plank, hero on the ladder. Not ported:
 // jump from the bottle (+654), exit 0x59E at 180 degrees (Windows scene04_click does them)
 bool Sc04Controller::onMouseLKeyUp(uint32 id, float x, float y) {
+	if (controllerRunsSceneLogic())
+		return onMouseLKeyUpController(id, x, y);
 	if (FPController::onMouseLKeyUp(id, x, y))
 		return true;
 	return scene04_click(Common::Point(x - _scene->_x, y - _scene->_y));
@@ -1812,6 +1836,10 @@ bool Sc04Controller::onMouseLKeyUp(uint32 id, float x, float y) {
 
 // CSc04Controller::SkipArcade (skip button): the Windows handler logic (scene04_skipArcade)
 void Sc04Controller::skipArcade() {
+	if (controllerRunsSceneLogic()) {
+		skipArcadeController();
+		return;
+	}
 	scene04_skipArcade();
 }
 
diff --git a/engines/ngi/fullpipe/sc04controller.h b/engines/ngi/fullpipe/sc04controller.h
index 0fada883ff0..6850e4716b2 100644
--- a/engines/ngi/fullpipe/sc04controller.h
+++ b/engines/ngi/fullpipe/sc04controller.h
@@ -41,6 +41,7 @@ public:
 	explicit Sc04Controller(int sceneId);
 	~Sc04Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	// the methods that scene04.cpp implements (they work on g_vars->scene04_*)
 	void onShow() override;
 	void onRender(Common::Point scroll) override;
diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index ae6c8163dfc..7ca419e8e54 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -553,19 +553,6 @@ void NGIEngine::sceneAutoScrolling() {
 	}
 }
 
-bool NGIEngine::initSceneLogic(Scene *scene, int entranceId) {
-	_floaters->deleteAllFlies();
-	switch (scene->_sceneId) {
-	// scenes 1, 2 and 3 run from their controllers (controllerRunsSceneLogic())
-	case SC_4:
-		scene04_initScene(scene);
-		addMessageHandler(sceneHandler04, 2);
-		return true;
-	default:
-		return false;
-	}
-}
-
 // Android calls the controller's OnUpdate(ms) every frame; the scene handler gets kMsgUpdate
 // with the elapsed milliseconds in _param.
 void NGIEngine::updateSceneLogic(uint32 elapsed) {
@@ -730,8 +717,7 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 		} else {
 			if (isAndroidFullPipe())
 				sceneController_initInventory();
-			if (!initSceneLogic(scene, entrance._id))
-				debugC(1, kDebugLoading, "Scene %d has no scene logic yet", scene->_sceneId);
+			_floaters->deleteAllFlies();
 			// Every scene controller of the original ends its OnShow with CTaskManager::VisitScene
 			if (_taskManager)
 				_taskManager->visitScene(scene->_sceneId);
diff --git a/engines/ngi/ngi.h b/engines/ngi/ngi.h
index ff427eaec62..89338d572b1 100644
--- a/engines/ngi/ngi.h
+++ b/engines/ngi/ngi.h
@@ -415,8 +415,7 @@ public:
 	Common::String getState(const Common::String &name);
 
 	void sceneAutoScrolling();
-	// XML projects: the shared per-scene logic (initScene, message handler)
-	bool initSceneLogic(Scene *scene, int entranceId);
+	// XML projects: the per-frame update of the scene logic
 	void updateSceneLogic(uint32 elapsed);
 	bool doSetScene(const Entrance &entrance);
 	Scene *findScene(int sceneId);


Commit: af55f1a08e47494398ba14034cc53158b99de27b
    https://github.com/scummvm/scummvm/commit/af55f1a08e47494398ba14034cc53158b99de27b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Scene 4 test aid plankjump=N, SHOOTKOZAW log line

Changed paths:
    engines/ngi/debugger/testmode.cpp
    engines/ngi/fullpipe/sc04controller.cpp
    engines/ngi/fullpipe/sc04controller.h


diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 8db026bb66f..77f7d247eee 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -82,6 +82,7 @@ Common::Array<LadderStep> &ladderSteps() {
 	return list;
 }
 uint g_nextLadderStep = 0;
+int g_plankJump = -1; // plankjump=N: the hero jumps when the kozawka walks at its frame N
 uint32 g_ladderTimer = 0;
 
 Common::String toGameEncoding(const Common::String &utf8) {
@@ -126,6 +127,8 @@ void runSetup() {
 			const int at = value.findFirstOf('@');
 			ladder.delay = at == (int)Common::String::npos ? 0 : atoi(value.substr(at + 1).c_str());
 			ladderSteps().push_back(ladder);
+		} else if (key == "plankjump") {
+			g_plankJump = atoi(value.c_str());
 		} else if (key == "visit") {
 			Common::StringTokenizer scenes(value, ",");
 			while (!scenes.empty())
@@ -309,6 +312,12 @@ void testmode_update(uint32 elapsed) {
 		}
 	}
 
+	if (g_setupDone && g_plankJump >= 0 && g_ngi->_currentScene && g_ngi->_currentScene->_sceneId == SC_4) {
+		Sc04Controller &controller = static_cast<Sc04Controller &>(sceneController(*g_ngi->_currentScene));
+		if (controller.testPlankJump(g_plankJump))
+			warning("TESTMODE: plank jump");
+	}
+
 	if ((g_setupDone && !g_spot) || !hero || !g_ngi->_currentScene)
 		return;
 
diff --git a/engines/ngi/fullpipe/sc04controller.cpp b/engines/ngi/fullpipe/sc04controller.cpp
index 00d2a0447bc..435213c935e 100644
--- a/engines/ngi/fullpipe/sc04controller.cpp
+++ b/engines/ngi/fullpipe/sc04controller.cpp
@@ -902,6 +902,7 @@ void Sc04Controller::doShootKozawka() {
 		}
 		if (_handIsDown && result == 6)
 			result = 7;
+		debugC(1, kDebugInfo, "INFO t %u SHOOTKOZAW frame %d x %d result %d", g_system->getMillis(), kozaw->_movement->_curFrame, x, result);
 		kozaw->stopQueue();
 		kozaw->setStatic(ST_KZW_RIGHT);
 		MessageQueue *queue;
@@ -1011,6 +1012,16 @@ bool Sc04Controller::testLadderStep(int step) {
 	return true;
 }
 
+bool Sc04Controller::testPlankJump(int frame) {
+	AniObject *kozaw = _walkingKozaw;
+	if (!kozaw || !kozaw->_movement || kozaw->_movement->_id != MV_KZW_WALKPLANK || kozaw->_movement->_curFrame < frame)
+		return false;
+	if (!testLadderReady() || !manCanJump())
+		return false;
+	onClickPlank();
+	return true;
+}
+
 bool Sc04Controller::testLadderReady() {
 	return _ladder && hero() && !hero()->_movement && !hero()->_queue;
 }
diff --git a/engines/ngi/fullpipe/sc04controller.h b/engines/ngi/fullpipe/sc04controller.h
index 6850e4716b2..b339f87d437 100644
--- a/engines/ngi/fullpipe/sc04controller.h
+++ b/engines/ngi/fullpipe/sc04controller.h
@@ -116,6 +116,8 @@ public:
 	void putKozawToBottle(AniObject *kozaw, PictureObject *bottle);
 	/** Test mode (--start-movie="ladder=STEP at MS"): ladder queue to the step, like TryLeaveLadder */
 	bool testLadderStep(int step);
+	/** Test mode (plankjump=N): click the plank when the kozawka is at its frame N */
+	bool testPlankJump(int frame);
 	/** Test mode: the ladder exists and the hero stands on it without a queue */
 	bool testLadderReady();
 


Commit: 675438d6c2958cb7269c42a48240b17e84286025
    https://github.com/scummvm/scummvm/commit/675438d6c2958cb7269c42a48240b17e84286025
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Test mode visitdelay

Changed paths:
    engines/ngi/debugger/testmode.cpp


diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 77f7d247eee..5d7f2bdd0e9 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -72,6 +72,7 @@ Common::Array<int> &visits() { // function-local statics: no global destructors
 }
 uint g_nextVisit = 0;
 uint32 g_visitTimer = 0;
+uint32 g_firstVisit = 7000; // visitdelay=MS: the wait before the first visit
 struct LadderStep {
 	int step;
 	uint32 delay;
@@ -129,6 +130,8 @@ void runSetup() {
 			ladderSteps().push_back(ladder);
 		} else if (key == "plankjump") {
 			g_plankJump = atoi(value.c_str());
+		} else if (key == "visitdelay") {
+			g_firstVisit = atoi(value.c_str());
 		} else if (key == "visit") {
 			Common::StringTokenizer scenes(value, ",");
 			while (!scenes.empty())
@@ -289,7 +292,7 @@ void testmode_update(uint32 elapsed) {
 
 	if (g_setupDone && g_nextVisit < visits().size()) {
 		g_visitTimer += elapsed;
-		if (g_visitTimer >= 7000) {
+		if (g_visitTimer >= (g_nextVisit == 0 ? g_firstVisit : 7000)) {
 			g_visitTimer = 0;
 			const int sceneId = g_ngi->convertScene(visits()[g_nextVisit++]);
 			warning("TESTMODE: visit scene %d", sceneId);


Commit: 00bbdd77fb30a8fedd9e6a002ce797aff6c897e7
    https://github.com/scummvm/scummvm/commit/00bbdd77fb30a8fedd9e6a002ce797aff6c897e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc04Controller moves the plank with MoveToStatic, more scene 4 test aids

Changed paths:
    engines/ngi/debugger/testmode.cpp
    engines/ngi/fullpipe/sc04controller.cpp
    engines/ngi/fullpipe/sc04controller.h


diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 5d7f2bdd0e9..27855d282e7 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -70,9 +70,20 @@ Common::Array<int> &visits() { // function-local statics: no global destructors
 	static Common::Array<int> list;
 	return list;
 }
+Common::Array<int> &visitEntrances() {
+	static Common::Array<int> list;
+	return list;
+}
 uint g_nextVisit = 0;
 uint32 g_visitTimer = 0;
 uint32 g_firstVisit = 7000; // visitdelay=MS: the wait before the first visit
+int g_itemAt = -1; // itemat=MS:ITEM: the item is put into the inventory after MS ms
+Common::String &itemAtName() { // function-local static: no global destructor
+	static Common::String name;
+	return name;
+}
+uint32 g_setupTime = 0;
+int g_visitScene = 0; // visitscene=N: the visit timer only runs while scene N is shown
 struct LadderStep {
 	int step;
 	uint32 delay;
@@ -83,7 +94,9 @@ Common::Array<LadderStep> &ladderSteps() {
 	return list;
 }
 uint g_nextLadderStep = 0;
-int g_plankJump = -1; // plankjump=N: the hero jumps when the kozawka walks at its frame N
+int g_shootX = -1; // shootx=X: DoShootKozawka judges the shot by this x
+const int kNoPlankJump = -1000;
+int g_plankJump = kNoPlankJump; // plankjump=N: the hero jumps when the kozawka walks at its frame N (N < 0: on its way up)
 uint32 g_ladderTimer = 0;
 
 Common::String toGameEncoding(const Common::String &utf8) {
@@ -130,12 +143,27 @@ void runSetup() {
 			ladderSteps().push_back(ladder);
 		} else if (key == "plankjump") {
 			g_plankJump = atoi(value.c_str());
+		} else if (key == "shootx") {
+			g_shootX = atoi(value.c_str());
+		} else if (key == "itemat") {
+			// itemat=MS:ITEM
+			g_itemAt = atoi(value.c_str());
+			const int colon = value.findFirstOf(':');
+			if (colon != (int)Common::String::npos)
+				itemAtName() = value.substr(colon + 1);
+		} else if (key == "visitscene") {
+			g_visitScene = atoi(value.c_str());
 		} else if (key == "visitdelay") {
 			g_firstVisit = atoi(value.c_str());
 		} else if (key == "visit") {
 			Common::StringTokenizer scenes(value, ",");
-			while (!scenes.empty())
-				visits().push_back(atoi(scenes.nextToken().c_str()));
+			while (!scenes.empty()) {
+				// SCENE or SCENE/ENTRANCE (4/696 = SC_4 TrubaRight)
+				const Common::String token = scenes.nextToken();
+				const int slash = token.findFirstOf('/');
+				visits().push_back(atoi(token.c_str()));
+				visitEntrances().push_back(slash == (int)Common::String::npos ? 0 : atoi(token.substr(slash + 1).c_str()));
+			}
 			g_visitTimer = 7000;
 		}
 	}
@@ -290,13 +318,27 @@ void testmode_update(uint32 elapsed) {
 		}
 	}
 
-	if (g_setupDone && g_nextVisit < visits().size()) {
+	if (g_setupDone && g_itemAt >= 0) {
+		g_setupTime += elapsed;
+		if (g_setupTime >= (uint32)g_itemAt) {
+			warning("TESTMODE: item %s", itemAtName().c_str());
+			g_ngi->_inventory->addItem(itemAtName(), 1);
+			g_itemAt = -1;
+		}
+	}
+
+	if (g_setupDone && g_nextVisit < visits().size() && (!g_visitScene || (g_ngi->_currentScene && g_ngi->_currentScene->_sceneId == g_ngi->convertScene(g_visitScene)))) {
 		g_visitTimer += elapsed;
 		if (g_visitTimer >= (g_nextVisit == 0 ? g_firstVisit : 7000)) {
 			g_visitTimer = 0;
+			const int entranceId = visitEntrances()[g_nextVisit];
 			const int sceneId = g_ngi->convertScene(visits()[g_nextVisit++]);
-			warning("TESTMODE: visit scene %d", sceneId);
-			g_ngi->_gameLoader->setScene(sceneId, 0);
+			warning("TESTMODE: visit scene %d entrance %d", sceneId, entranceId);
+			// with an entrance it is the SETSCENE command of the game (scene change at the end of the frame)
+			if (entranceId)
+				g_ngi->_gameLoader->preloadScene(sceneId, entranceId);
+			else
+				g_ngi->_gameLoader->setScene(sceneId, 0);
 			return;
 		}
 	}
@@ -315,8 +357,9 @@ void testmode_update(uint32 elapsed) {
 		}
 	}
 
-	if (g_setupDone && g_plankJump >= 0 && g_ngi->_currentScene && g_ngi->_currentScene->_sceneId == SC_4) {
+	if (g_setupDone && g_plankJump != kNoPlankJump && g_ngi->_currentScene && g_ngi->_currentScene->_sceneId == SC_4) {
 		Sc04Controller &controller = static_cast<Sc04Controller &>(sceneController(*g_ngi->_currentScene));
+		controller._testShootX = g_shootX;
 		if (controller.testPlankJump(g_plankJump))
 			warning("TESTMODE: plank jump");
 	}
diff --git a/engines/ngi/fullpipe/sc04controller.cpp b/engines/ngi/fullpipe/sc04controller.cpp
index 435213c935e..b05b0c61caa 100644
--- a/engines/ngi/fullpipe/sc04controller.cpp
+++ b/engines/ngi/fullpipe/sc04controller.cpp
@@ -555,6 +555,7 @@ void Sc04Controller::tryBall() {
 
 // CSc04Controller::DoStartArcade (1656E0): coin in and hand up: clock, lamps and music start
 void Sc04Controller::doStartArcade() {
+	debugC(1, kDebugInfo, "INFO t %u ARCADESTART", g_system->getMillis());
 	// CFPController::FlurryArcadeStart (analytics): not ported
 	startKozawka(true);
 
@@ -652,6 +653,7 @@ void Sc04Controller::doStartHand() {
 
 	int queueId;
 	const uint count = _bottleKozaws.size();
+	debugC(1, kDebugInfo, "INFO t %u HANDSTART kozawkas in the jar %u", g_system->getMillis(), count);
 	if (count < 3) {
 		activateTasks();
 		g_ngi->_achievementsManager->blockActivatingCounter("ACHIEVEMENT_ARCADE_4", 100);
@@ -884,13 +886,13 @@ MessageQueue *Sc04Controller::makeJumpOver(AniObject *kozaw, double factor) {
 // CSc04Controller::DoShootKozawka (166BE0): plank goes down, the kozawka on it flies; by its x it
 // misses short, hits the jar (high or low), gets in or flies over
 void Sc04Controller::doShootKozawka() {
-	warnOnce("CAniObject::MoveToStatic (the chain of movements to ST_PNK_WEIGHTRIGHT of the plank)");
+	_plank->moveToStaticChain(ST_PNK_WEIGHTRIGHT);
 	AniObject *kozaw = _walkingKozaw;
 	if (!kozaw)
 		return;
 
 	if (kozaw->_movement && kozaw->_movement->_id == MV_KZW_WALKPLANK && kozaw->_movement->_curFrame <= 40) {
-		const int x = kozaw->getCenter().x;
+		const int x = _testShootX >= 0 ? _testShootX : kozaw->getCenter().x;
 		int result = 7;
 		if ((uint)(x - 615) > 0x27) {
 			result = 6;
@@ -923,6 +925,8 @@ void Sc04Controller::doShootKozawka() {
 		if (queue)
 			_scene->runQueueObject(queue, kozaw, 3);
 		g_ngi->_hintManager->setHideCondition(_scene, 0);
+	} else {
+		debugC(1, kDebugInfo, "INFO t %u SHOOTKOZAW nothing to shoot: movement %d frame %d", g_system->getMillis(), kozaw->_movement ? kozaw->_movement->_id : -1, kozaw->_movement ? kozaw->_movement->_curFrame : -1);
 	}
 	_kozawShot = true;
 }
@@ -1014,7 +1018,10 @@ bool Sc04Controller::testLadderStep(int step) {
 
 bool Sc04Controller::testPlankJump(int frame) {
 	AniObject *kozaw = _walkingKozaw;
-	if (!kozaw || !kozaw->_movement || kozaw->_movement->_id != MV_KZW_WALKPLANK || kozaw->_movement->_curFrame < frame)
+	// negative frame: still on the way up to the plank (MV_KZW_TOPLANK frame -frame - 1)
+	const int movementId = frame < 0 ? MV_KZW_TOPLANK : MV_KZW_WALKPLANK;
+	const int minFrame = frame < 0 ? -frame - 1 : frame;
+	if (!kozaw || !kozaw->_movement || kozaw->_movement->_id != movementId || kozaw->_movement->_curFrame < minFrame)
 		return false;
 	if (!testLadderReady() || !manCanJump())
 		return false;
@@ -1229,7 +1236,7 @@ void Sc04Controller::onShowScene() {
 	_domino = _scene->findAniObjectById(ANI_DOMINO_3, 0);
 	_ladder = nullptr;
 	_springState = 0;
-	warnOnce("CAniObject::MoveToStatic (the chain of movements to ST_PNK_WEIGHTLEFT of the plank)");
+	_plank->moveToStaticChain(ST_PNK_WEIGHTLEFT);
 
 	AniObject *kozaw = _scene->findAniObjectById(ANI_KOZAWKA, 0);
 	if (kozaw) {
diff --git a/engines/ngi/fullpipe/sc04controller.h b/engines/ngi/fullpipe/sc04controller.h
index b339f87d437..5a269fdf593 100644
--- a/engines/ngi/fullpipe/sc04controller.h
+++ b/engines/ngi/fullpipe/sc04controller.h
@@ -120,6 +120,8 @@ public:
 	bool testPlankJump(int frame);
 	/** Test mode: the ladder exists and the hero stands on it without a queue */
 	bool testLadderReady();
+	/** Test mode (shootx=X): the x that DoShootKozawka judges the shot by, -1 = the kozawka's own */
+	int _testShootX = -1;
 
 private:
 	/** +148 of CFPController (arcade flag): set while the hero is on the ladder in this scene */


Commit: 9a9b79d9e1a6dbd2a3b9e0d3aa397258c4ea87f0
    https://github.com/scummvm/scummvm/commit/9a9b79d9e1a6dbd2a3b9e0d3aa397258c4ea87f0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc05Controller runs the scene logic of scene 5

Changed paths:
    engines/ngi/fullpipe/sc05controller.h


diff --git a/engines/ngi/fullpipe/sc05controller.h b/engines/ngi/fullpipe/sc05controller.h
index 85bbac4bada..60b68cfba38 100644
--- a/engines/ngi/fullpipe/sc05controller.h
+++ b/engines/ngi/fullpipe/sc05controller.h
@@ -35,6 +35,7 @@ public:
 	explicit Sc05Controller(int sceneId);
 	~Sc05Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	void onHide() override;
 	int getCursorType(float x, float y) override;


Commit: 9cabfb0b7d04f703164bc782a3e10a2f195f041a
    https://github.com/scummvm/scummvm/commit/9cabfb0b7d04f703164bc782a3e10a2f195f041a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc07Controller runs the scene logic of scene 7

Changed paths:
    engines/ngi/fullpipe/sc07controller.h


diff --git a/engines/ngi/fullpipe/sc07controller.h b/engines/ngi/fullpipe/sc07controller.h
index ece8d42505d..1345138045a 100644
--- a/engines/ngi/fullpipe/sc07controller.h
+++ b/engines/ngi/fullpipe/sc07controller.h
@@ -34,6 +34,7 @@ public:
 	explicit Sc07Controller(int sceneId);
 	~Sc07Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	void onUpdate(uint32 elapsed) override;


Commit: a7000d2a1e37c2e09d47124d84f8a7b8d859b2ce
    https://github.com/scummvm/scummvm/commit/a7000d2a1e37c2e09d47124d84f8a7b8d859b2ce
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc12Controller runs the scene logic of scene 12

Changed paths:
    engines/ngi/fullpipe/sc12controller.h


diff --git a/engines/ngi/fullpipe/sc12controller.h b/engines/ngi/fullpipe/sc12controller.h
index 28827a0d25d..1be61514ee4 100644
--- a/engines/ngi/fullpipe/sc12controller.h
+++ b/engines/ngi/fullpipe/sc12controller.h
@@ -35,6 +35,7 @@ public:
 	explicit Sc12Controller(int sceneId);
 	~Sc12Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	void onHide() override;
 	int getCursorType(float x, float y) override;


Commit: 9227ba2deec5bf9c491bb64a87351ff3401efb83
    https://github.com/scummvm/scummvm/commit/9227ba2deec5bf9c491bb64a87351ff3401efb83
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc13Controller runs the scene logic of scene 13

Changed paths:
    engines/ngi/fullpipe/sc13controller.h


diff --git a/engines/ngi/fullpipe/sc13controller.h b/engines/ngi/fullpipe/sc13controller.h
index 806fde6e5ce..b3fa6eb4260 100644
--- a/engines/ngi/fullpipe/sc13controller.h
+++ b/engines/ngi/fullpipe/sc13controller.h
@@ -32,6 +32,7 @@ public:
 	explicit Sc13Controller(int sceneId);
 	~Sc13Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	bool onMouseLKeyUp(uint32 id, float x, float y) override;


Commit: 0885e8521ba6fd877a138d8bf878e6676725831d
    https://github.com/scummvm/scummvm/commit/0885e8521ba6fd877a138d8bf878e6676725831d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc20Controller runs the scene logic of scene 20

Changed paths:
    engines/ngi/fullpipe/sc20controller.h


diff --git a/engines/ngi/fullpipe/sc20controller.h b/engines/ngi/fullpipe/sc20controller.h
index 72d5b15ac2e..75d747879b9 100644
--- a/engines/ngi/fullpipe/sc20controller.h
+++ b/engines/ngi/fullpipe/sc20controller.h
@@ -35,6 +35,7 @@ public:
 	explicit Sc20Controller(int sceneId);
 	~Sc20Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	void onHide() override;
 	void onUpdate(uint32 elapsed) override;


Commit: e593aa79825ea6db35dcbff30969972be21fd1bc
    https://github.com/scummvm/scummvm/commit/e593aa79825ea6db35dcbff30969972be21fd1bc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc10Controller runs the scene logic of scene 10

Changed paths:
    engines/ngi/fullpipe/sc10controller.h


diff --git a/engines/ngi/fullpipe/sc10controller.h b/engines/ngi/fullpipe/sc10controller.h
index 03ed68bc9a0..0f3f52ffd20 100644
--- a/engines/ngi/fullpipe/sc10controller.h
+++ b/engines/ngi/fullpipe/sc10controller.h
@@ -38,6 +38,7 @@ public:
 	~Sc10Controller() override;
 
 	void onSceneInit() override;
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	bool onMouseLKeyDown(uint32 id, float x, float y) override;


Commit: c625c0a9346583def9d26afcbbccd1bb818f7507
    https://github.com/scummvm/scummvm/commit/c625c0a9346583def9d26afcbbccd1bb818f7507
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Test mode aids showstate and watch

Changed paths:
    engines/ngi/debugger/testmode.cpp


diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 27855d282e7..74385c5ff6e 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -94,6 +94,14 @@ Common::Array<LadderStep> &ladderSteps() {
 	return list;
 }
 uint g_nextLadderStep = 0;
+Common::StringArray &watched() {
+	static Common::StringArray list;
+	return list;
+}
+Common::Array<uint> &watchedHash() {
+	static Common::Array<uint> list;
+	return list;
+}
 int g_shootX = -1; // shootx=X: DoShootKozawka judges the shot by this x
 const int kNoPlankJump = -1000;
 int g_plankJump = kNoPlankJump; // plankjump=N: the hero jumps when the kozawka walks at its frame N (N < 0: on its way up)
@@ -123,6 +131,13 @@ void runSetup() {
 			const Common::String state = toGameEncoding(value.substr(colon + 1));
 			warning("TESTMODE: state %s = %s", value.substr(0, colon).c_str(), value.substr(colon + 1).c_str());
 			g_ngi->setState(object, g_ngi->getStateValue(object, state.c_str()));
+		} else if (key == "watch") {
+			// watch=ANI_NAME: a log line whenever its statics or movement changes
+			watched().push_back(value);
+			watchedHash().push_back(0);
+		} else if (key == "showstate") {
+			// showstate=Object: logs the number of its state
+			warning("TESTMODE: state of %s is %d", value.c_str(), g_ngi->getStateId(toGameEncoding(value)));
 		} else if (key == "item") {
 			warning("TESTMODE: item %s", value.c_str());
 			g_ngi->_inventory->addItem(value, 1);
@@ -318,6 +333,24 @@ void testmode_update(uint32 elapsed) {
 		}
 	}
 
+	for (uint i = 0; i < watched().size() && g_ngi->_currentScene && g_ngi->_gameProject; i++) {
+		uint32 id = 0;
+		if (!g_ngi->_gameProject->_objectIds.findId(watched()[i], id))
+			continue;
+		const AniObject *ani = g_ngi->_currentScene->findAniObjectById(id, 0);
+		if (!ani)
+			continue;
+		const Common::String line = ani->_movement ? Common::String::format("movement %s", name(ani->_movement->_id).c_str()) :
+			ani->_statics ? Common::String::format("statics %s", name(ani->_statics->_staticsId).c_str()) : Common::String("none");
+		const Common::String state = Common::String::format("%s flags %02x z %d at %d,%d", line.c_str(), ani->_flags, ani->_z, ani->_x, ani->_y);
+		// the position changes with every frame of a movement: not part of the hash
+		const uint hash = Common::hashit(Common::String::format("%s %02x", line.c_str(), ani->_flags).c_str());
+		if (hash != watchedHash()[i]) {
+			watchedHash()[i] = hash;
+			debugC(1, kDebugInfo, "INFO t %u WATCH %s %s", g_system->getMillis(), watched()[i].c_str(), state.c_str());
+		}
+	}
+
 	if (g_setupDone && g_itemAt >= 0) {
 		g_setupTime += elapsed;
 		if (g_setupTime >= (uint32)g_itemAt) {


Commit: badd6168ad91b627a4ed835abf543ec59a6fb404
    https://github.com/scummvm/scummvm/commit/badd6168ad91b627a4ed835abf543ec59a6fb404
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc15Controller runs the scene logic of scene 15

Changed paths:
    engines/ngi/fullpipe/sc15controller.h


diff --git a/engines/ngi/fullpipe/sc15controller.h b/engines/ngi/fullpipe/sc15controller.h
index d39bb5ac538..1a901398ae8 100644
--- a/engines/ngi/fullpipe/sc15controller.h
+++ b/engines/ngi/fullpipe/sc15controller.h
@@ -34,6 +34,7 @@ public:
 	explicit Sc15Controller(int sceneId);
 	~Sc15Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	void onHide() override;
 	int getCursorType(float x, float y) override;


Commit: b5150ab8ed7f7ca5f9f5555a9f272d1f169d55bf
    https://github.com/scummvm/scummvm/commit/b5150ab8ed7f7ca5f9f5555a9f272d1f169d55bf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Keep the scene key of XML queue ids above 32767

Changed paths:
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index 9b7e87cf570..bc452f82177 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1369,7 +1369,7 @@ private:
 		if (!readId(node->values["id"], queue->_queueId))
 			return parserError("Unknown queue ID " + node->values["id"]);
 		queue->_title = node->values.getValOrDefault("title");
-		queue->_sceneKey = queue->_queueId;
+		queue->_sceneKey = (uint16)queue->_queueId; // the ids go up to 65535
 		_scene._messageQueues.push_back(queue.release());
 		return true;
 	}


Commit: 7e0e2b62397b285831d690ffba1eac4fb316177d
    https://github.com/scummvm/scummvm/commit/7e0e2b62397b285831d690ffba1eac4fb316177d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: SHOW keeps the statics offsets for the Android version

Changed paths:
    engines/ngi/statics.cpp


diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index a0d6c7fb25d..87f0913b756 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -1628,9 +1628,12 @@ void AniObject::show1(int x, int y, int movId, int mqId) {
 
 	_statics = mov->_prevStatic;
 
-	const Common::Point point = mov->_prevStatic->getSomeXY();
-	_statics->_x = x - point.x;
-	_statics->_y = y - point.y;
+	// the Android SetStatic reads Statics::_x/_y as offsets: ExecuteCmdShow does not write them
+	if (g_ngi->_gameVersion < 201509) {
+		const Common::Point point = mov->_prevStatic->getSomeXY();
+		_statics->_x = x - point.x;
+		_statics->_y = y - point.y;
+	}
 
 	_statics->_countdown = _statics->_delay;
 


Commit: 497003bd16dc389dfc8684db081b20ec087cd8cc
    https://github.com/scummvm/scummvm/commit/497003bd16dc389dfc8684db081b20ec087cd8cc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port COldAniObject::SetPos

Changed paths:
    engines/ngi/statics.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 87f0913b756..e900f4ede51 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -221,6 +221,18 @@ void AniObject::setPos(int x, int y) {
 		_movement->setPos(x, y);
 }
 
+// COldAniObject::SetPos (161924): x, y is the pivot of a standing object, its static is set again
+void AniObject::setOldAniPos(int x, int y, int z) {
+	const Common::Point topLeft = getPosition();
+	_z = z;
+	if (topLeft.x == x && topLeft.y == y)
+		return;
+	if (_movement)
+		setPosition(Common::Point(x, y));
+	else
+		setPos(x, y);
+}
+
 void AniObject::clearFlags() {
 	_flags = 0;
 
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index 9a2cbc24cfb..39989d2800f 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -232,6 +232,7 @@ public:
 	bool load(MfcArchive &file) override;
 
 	void setPos(int x, int y) override;
+	void setOldAniPos(int x, int y, int z);
 	Statics *getStatic(int id);
 	Statics *getStaticsByName(const Common::String &name);
 	Movement *getMovement(int id);


Commit: 69a52cf2961b655b7b613297d189201589884926
    https://github.com/scummvm/scummvm/commit/69a52cf2961b655b7b613297d189201589884926
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc16Controller runs the scene logic of scene 16

Changed paths:
    engines/ngi/fullpipe/sc16controller.cpp
    engines/ngi/fullpipe/sc16controller.h


diff --git a/engines/ngi/fullpipe/sc16controller.cpp b/engines/ngi/fullpipe/sc16controller.cpp
index 26c0ed0fdcf..af4a321f78e 100644
--- a/engines/ngi/fullpipe/sc16controller.cpp
+++ b/engines/ngi/fullpipe/sc16controller.cpp
@@ -322,8 +322,7 @@ void Sc16Controller::onShow() {
 	if (isState(sO_Mug, sO_In_16)) {
 		_mug->setStatic(ST_MUG_EMPTY, false);
 		_mug->_flags |= 4;
-		_mug->setPosition(Common::Point(409, 459));
-		_mug->_z = 5;
+		_mug->setOldAniPos(409, 459, 5);
 	}
 	_beardedTimer = 0;
 }
diff --git a/engines/ngi/fullpipe/sc16controller.h b/engines/ngi/fullpipe/sc16controller.h
index 3e20e9e3b7f..5a3456cace9 100644
--- a/engines/ngi/fullpipe/sc16controller.h
+++ b/engines/ngi/fullpipe/sc16controller.h
@@ -37,6 +37,7 @@ public:
 	~Sc16Controller() override;
 
 	void onSceneInit() override;
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	void onHide() override;
 	int getCursorType(float x, float y) override;


Commit: d14a6caa41d13642042920c506969521a0cdc43c
    https://github.com/scummvm/scummvm/commit/d14a6caa41d13642042920c506969521a0cdc43c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc17Controller runs the scene logic of scene 17

Changed paths:
    engines/ngi/fullpipe/sc17controller.cpp
    engines/ngi/fullpipe/sc17controller.h


diff --git a/engines/ngi/fullpipe/sc17controller.cpp b/engines/ngi/fullpipe/sc17controller.cpp
index 86cd3e42e0c..0b7226e9d6c 100644
--- a/engines/ngi/fullpipe/sc17controller.cpp
+++ b/engines/ngi/fullpipe/sc17controller.cpp
@@ -44,9 +44,8 @@ Sc17Controller::Sc17Controller(int sceneId) : FPController(sceneId), _tutorial("
 Sc17Controller::~Sc17Controller() {
 }
 
-// CSc17Controller::CleanXml (17CBD4)
+// CSc17Controller::CleanXml (17CBD4): only compares the tutorial with the PREV_EXTRA name
 void Sc17Controller::cleanXml() {
-	_tutorial = "PREV_EXTRA_TUTORIAL_SEE_HIGHLIGHT";
 }
 
 // CSc17Controller::DoShowSugar (17CC80)
@@ -70,15 +69,15 @@ void Sc17Controller::doShowBottle() {
 // CSc17Controller::DoTakeSugar (17CCD0)
 void Sc17Controller::doTakeSugar() {
 	AniObject *moonshiner = _scene->findAniObjectById(ANI_SAMOGONSHCHIK, 0);
-	moonshiner->setStatic(ST_SMG_SIT);
-	_scene->runQueue(QU_SMG_FILLBOTTLE);
+	moonshiner->setStatic(ST_SMG_SIT, false);
+	_scene->runQueue(QU_SMG_FILLBOTTLE, 2);
 	_sugarShown = false;
 }
 
 // CSc17Controller::DoTestTruba (17CD0C): the hand shows the fig unless it does
 void Sc17Controller::doTestTruba() {
 	if (!_hand->_movement || _hand->_movement->_id != MV_HND17_FIGA) {
-		_hand->setStatic(ST_HND17_EMPTY);
+		_hand->setStatic(ST_HND17_EMPTY, false);
 		_hand->startMovement(MV_HND17_FIGA, 0, -1);
 	}
 }
@@ -88,7 +87,7 @@ void Sc17Controller::doDrop() {
 	AniObject *mug = _scene->findAniObjectById(ANI_MUG_17, 0);
 	AniObject *jet = _scene->findAniObjectById(ANI_JET_17, 0);
 	if (mug && (mug->_flags & 4)) {
-		mug->setStatic(ST_MUG17_EMPTY);
+		mug->setStatic(ST_MUG17_EMPTY, false);
 		_scene->runQueue(QU_SC17_FILLMUG_DROP);
 	} else if (jet) {
 		_scene->runQueue(QU_JET17_DROP);
@@ -130,15 +129,15 @@ void Sc17Controller::doFillBottle() {
 	AniObject *mug = _scene->findAniObjectById(ANI_MUG_17, 0);
 	AniObject *boot = _scene->findAniObjectById(ANI_BOOT_17, 0);
 	if (bottle && (bottle->_flags & 4)) {
-		_scene->runQueue(QU_SC17_FILLBOTTLE);
+		_scene->runQueue(QU_SC17_FILLBOTTLE, 2);
 	} else if (mug && (mug->_flags & 4) && mug->_statics->_staticsId == ST_MUG17_EMPTY) {
-		_scene->runQueue(QU_SC17_FILLMUG);
+		_scene->runQueue(QU_SC17_FILLMUG, 2);
 		g_ngi->_taskManager->activateTask("GET_SUGAR_SC19");
 	} else if (boot && (boot->_flags & 4)) {
-		_scene->runQueue(QU_SC17_FILLBOOT);
+		_scene->runQueue(QU_SC17_FILLBOOT, 2);
 		g_ngi->_taskManager->activateTask("GET_SUGAR_SC19");
 	} else {
-		_scene->runQueue(QU_JET17_FLOW);
+		_scene->runQueue(QU_JET17_FLOW, 2);
 		g_ngi->_taskManager->activateTask("GET_SUGAR_SC19");
 	}
 }
@@ -158,9 +157,8 @@ void Sc17Controller::onShow() {
 	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 
 	AniObject *tumba = _scene->findAniObjectById(ANI_SC17_TUMBA, 0);
-	tumba->setStatic(ST_SC17_TUMBA_STATE1);
-	tumba->setPosition(Common::Point(470, 419));
-	tumba->_z = 40;
+	tumba->setStatic(ST_SC17_TUMBA_STATE1, false);
+	tumba->setOldAniPos(470, 419, 40);
 
 	_sugarShown = false;
 	_heroX = 0;
@@ -174,8 +172,7 @@ void Sc17Controller::onShow() {
 	_handAsks = !withCoin;
 
 	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_17"));
-	// the original reads the state "Муха_17" as a number (GetState, atoi); here it is the id
-	_flyState = g_ngi->getStateId(sO_Fly_17);
+	_flyState = atoi(g_ngi->getState(sO_Fly_17).c_str());
 	bool flyPending = false;
 	if (_flyState <= 0) {
 		_flyTimer = scaledRandom(49800) + 49800;
diff --git a/engines/ngi/fullpipe/sc17controller.h b/engines/ngi/fullpipe/sc17controller.h
index ded61fbe98c..5b3ad6d35cc 100644
--- a/engines/ngi/fullpipe/sc17controller.h
+++ b/engines/ngi/fullpipe/sc17controller.h
@@ -37,6 +37,7 @@ public:
 
 	void cleanXml() override;
 	void checkTutorial() override;
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	void onHide() override;
 	int getCursorType(float x, float y) override;


Commit: 7ab15e338a4d4f3fd4c780b8d20d3bc7ae46f63a
    https://github.com/scummvm/scummvm/commit/7ab15e338a4d4f3fd4c780b8d20d3bc7ae46f63a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc21Controller runs the scene logic of scene 21

Changed paths:
    engines/ngi/fullpipe/sc21controller.cpp
    engines/ngi/fullpipe/sc21controller.h


diff --git a/engines/ngi/fullpipe/sc21controller.cpp b/engines/ngi/fullpipe/sc21controller.cpp
index 8372c96873d..c3660e342a1 100644
--- a/engines/ngi/fullpipe/sc21controller.cpp
+++ b/engines/ngi/fullpipe/sc21controller.cpp
@@ -159,7 +159,8 @@ void Sc21Controller::onMessage(const Common::String &message, const Common::Stri
 
 // CSc21Controller::UpdateScroll (18138C)
 void Sc21Controller::updateScroll() {
-	FPController::updateScroll();
+	if (_follow)
+		FPController::updateScroll();
 }
 
 } // End of namespace NGI
diff --git a/engines/ngi/fullpipe/sc21controller.h b/engines/ngi/fullpipe/sc21controller.h
index e6aec11d64b..44676c706c3 100644
--- a/engines/ngi/fullpipe/sc21controller.h
+++ b/engines/ngi/fullpipe/sc21controller.h
@@ -32,6 +32,7 @@ public:
 	explicit Sc21Controller(int sceneId);
 	~Sc21Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	void onUpdate(uint32 elapsed) override;


Commit: 952a0e330349e23129360f097b5cfc20abf1ef56
    https://github.com/scummvm/scummvm/commit/952a0e330349e23129360f097b5cfc20abf1ef56
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: EnableAllQueuesForAni switches the queues for the Android version

Changed paths:
    engines/ngi/behavior.cpp


diff --git a/engines/ngi/behavior.cpp b/engines/ngi/behavior.cpp
index 14a239b5006..6ad40c82389 100644
--- a/engines/ngi/behavior.cpp
+++ b/engines/ngi/behavior.cpp
@@ -483,12 +483,22 @@ void BehaviorController::enableAllQueuesForAni(AniObject *ani, int flag) {
 	for (uint i = 0; i < _behaviors.size(); i++) {
 		BehaviorAni &beh = _behaviors[i];
 
-		if (ani == beh._ani) {
-			if (flag)
-				beh._flags &= 0xfffffffe;
-			else
-				beh._flags |= 1;
+		if (ani != beh._ani)
+			continue;
+		if (g_ngi->_gameVersion >= 201509) {
+			// CBehaviorAni::EnableAllQueues (F3314): every move that has a queue
+			for (BehaviorAnim &anim : beh._behaviorAnims) {
+				for (BehaviorMove &move : anim._behaviorMoves) {
+					if (move._queueId)
+						move.setEnabled(flag != 0);
+				}
+			}
+			continue;
 		}
+		if (flag)
+			beh._flags &= 0xfffffffe;
+		else
+			beh._flags |= 1;
 	}
 }
 


Commit: 4c56fde1be94e09e4cc12b88f665724a99947579
    https://github.com/scummvm/scummvm/commit/4c56fde1be94e09e4cc12b88f665724a99947579
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc24Controller runs the scene logic of scene 24

Changed paths:
    engines/ngi/fullpipe/sc24controller.h


diff --git a/engines/ngi/fullpipe/sc24controller.h b/engines/ngi/fullpipe/sc24controller.h
index 19215814672..e5ef5c516be 100644
--- a/engines/ngi/fullpipe/sc24controller.h
+++ b/engines/ngi/fullpipe/sc24controller.h
@@ -32,6 +32,7 @@ public:
 	explicit Sc24Controller(int sceneId);
 	~Sc24Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	void onUpdate(uint32 elapsed) override;


Commit: abc2a39f5a679805fd1c0b33a0783e8aed9ac59e
    https://github.com/scummvm/scummvm/commit/abc2a39f5a679805fd1c0b33a0783e8aed9ac59e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Sc30Controller runs the scene logic of scene 30

Changed paths:
    engines/ngi/fullpipe/sc30controller.cpp
    engines/ngi/fullpipe/sc30controller.h


diff --git a/engines/ngi/fullpipe/sc30controller.cpp b/engines/ngi/fullpipe/sc30controller.cpp
index b71bef20b4b..348bc36164d 100644
--- a/engines/ngi/fullpipe/sc30controller.cpp
+++ b/engines/ngi/fullpipe/sc30controller.cpp
@@ -146,12 +146,10 @@ void Sc30Controller::onMessage(const Common::String &message, const Common::Stri
 		onLeaveScene();
 	} else if (message == "MSG_SC30_MOVELEG") {
 		AniObject *leg = _scene->findAniObjectById(ANI_LEG, 0);
-		leg->setPosition(Common::Point(183, 488));
-		leg->_z = 30;
+		leg->setOldAniPos(183, 488, 30);
 	} else if (message == "MSG_SC30_MOVELEG1") {
 		AniObject *leg = _scene->findAniObjectById(ANI_LEG, 0);
-		leg->setPosition(Common::Point(183, 486));
-		leg->_z = 30;
+		leg->setOldAniPos(183, 486, 30);
 	} else if (message == "MSG_SC30_MOVE_ARROW") {
 		moveArrowRegion(_scene);
 	} else {
diff --git a/engines/ngi/fullpipe/sc30controller.h b/engines/ngi/fullpipe/sc30controller.h
index 940f9450829..70ff1dd500e 100644
--- a/engines/ngi/fullpipe/sc30controller.h
+++ b/engines/ngi/fullpipe/sc30controller.h
@@ -32,6 +32,7 @@ public:
 	explicit Sc30Controller(int sceneId);
 	~Sc30Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	void onUpdate(uint32 elapsed) override;


Commit: 316e3dcf3521638431d3fb2894b91a6c05dd520a
    https://github.com/scummvm/scummvm/commit/316e3dcf3521638431d3fb2894b91a6c05dd520a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: PassMouseActions follows the listing: SEE_ALL_TASKS and LAST refuse touches, cursor type of the scene below

Changed paths:
    engines/ngi/fullpipe/tutorialcontroller.cpp
    engines/ngi/fullpipe/tutorialcontroller.h


diff --git a/engines/ngi/fullpipe/tutorialcontroller.cpp b/engines/ngi/fullpipe/tutorialcontroller.cpp
index dfd8f303f5c..c950a5db578 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.cpp
+++ b/engines/ngi/fullpipe/tutorialcontroller.cpp
@@ -652,162 +652,140 @@ int TutorialController::getCursorType(float x, float y) {
 	if (tutorial) {
 		Scene *scene = g_ngi->getSceneInStack(0);
 		if (tutorial->_id == "TUTORIAL_DO_EGG" && g_ngi->_inputController->getObject()) {
-			GameObject *object = scene->findVisibleObject(ANI_DADAYASHIK, 0);
-			if (object && static_cast<AniObject *>(object)->hit(x, y))
+			AniObject *drawer = scene->findAniObjectById(ANI_DADAYASHIK, 0);
+			if (drawer && drawer->hit(x, y))
 				return 102;
 		}
 		if (tutorial->_id == "TUTORIAL_GIVE_EGG" && g_ngi->_inputController->getObject()) {
-			GameObject *object = scene->findVisibleObject(ANI_EGGEATER, 0);
-			if (object && static_cast<AniObject *>(object)->hit(x, y))
+			AniObject *eater = scene->findAniObjectById(ANI_EGGEATER, 0);
+			if (eater && eater->hit(x, y))
 				return 102;
 		}
 	}
 	if (!passMouseActions(x, y, 0) || g_ngi->_sceneStack.size() < 2)
 		return 0;
-	if (ISceneController *controller = sceneBelow()->_controller.get())
-		return controller->getCursorType(x, y);
-	return -1;
+	// CScene::GetCursorType of the scene below
+	return sceneBelow()->getCursorType(x, y);
 }
 
-// CTutorialController::PassMouseActions (1A4854): action 1 move, 2 finger down, 3 finger up
-// no zone, from the disassembly: FIRST, SEE_TASK, USE_TASK, SEE_INVENTORY, SEE_MAP don't pass;
-// SEE_ALL_TASKS, SEE_EGGEATER, LAST pass
+// CTutorialController::PassMouseActions (1A4854): does the touch go on to the scene below;
+// action 0 cursor, 1 move, 2 finger down, 3 finger up (docs/android-tutorial-passmouse.md)
 bool TutorialController::passMouseActions(float x, float y, int action) {
-	const bool pass = passMouseActionsZone(x, y, action);
-	debugC(2, kDebugEvents, "TutorialController::passMouseActions(%g, %g, %d) = %d", x, y, action, pass);
-	return pass;
-}
-
-bool TutorialController::passMouseActionsZone(float x, float y, int action) {
-	if (_state == 1)
-		return false;
-	Tutorial *tutorial = g_ngi->_tutorialManager->findActiveTutorial();
-	if (!tutorial)
-		return false;
-	const Common::String &id = tutorial->_id;
-	if (tutorial->_isExtra && !tutorial->_isArcade && id != "EXTRA_TUTORIAL_SEE_LIFT" && id != "EXTRA_TUTORIAL_SEE_HELP" && id != "EXTRA_TUTORIAL_SEE_EXTRA_HELP")
-		return false;
-	if (id == "TUTORIAL_FIRST" || id == "TUTORIAL_SEE_TASK" || id == "TUTORIAL_USE_TASK")
-		return false;
-	if (id == "TUTORIAL_SEE_ALL_TASKS" || id == "TUTORIAL_SEE_EGGEATER" || id == "TUTORIAL_LAST")
-		return true;
-	// 1A4A7E..1A4B68: both jump to 1A4D64 (return 0), only the bubble button counts
-	if (id == "TUTORIAL_SEE_INVENTORY" || id == "TUTORIAL_SEE_MAP")
-		return false;
-
-	Scene *scene = g_ngi->getSceneInStack(0);
-	if (id == "TUTORIAL_MOVE_MAN") {
-		// passes when no interaction is under the finger and it is on the motion graph of the scene below
-		if (g_ngi->_sceneStack.size() < 2)
-			return false;
-		if (getGameLoaderInteractionController()->findInteractionUnderCursor())
-			return false;
-		return sceneBelow()->_motionController->checkPoint((int)x, (int)y);
-	}
-	// object hit: finger up finishes (CTutorialController::Finish), a touch in the zone passes
-	if (id == "TUTORIAL_USE_TRANSITION" || id == "TUTORIAL_USE_LADDER") {
-		Exit *exit = g_ngi->_exitManager->find(id == "TUTORIAL_USE_TRANSITION" ? PIC_SC1_RTRUBA : PIC_SC3_LADDER);
+	bool pass = false;
+	Tutorial *tutorial = nullptr;
+	if (_state != 1)
+		tutorial = g_ngi->_tutorialManager->findActiveTutorial();
+	const Common::String id = tutorial ? tutorial->_id : Common::String();
+	if (!tutorial || (tutorial->_isExtra && !tutorial->_isArcade && id != "EXTRA_TUTORIAL_SEE_LIFT" && id != "EXTRA_TUTORIAL_SEE_HELP" && id != "EXTRA_TUTORIAL_SEE_EXTRA_HELP") ||
+			id == "TUTORIAL_FIRST" || id == "TUTORIAL_SEE_TASK" || id == "TUTORIAL_USE_TASK" || id == "TUTORIAL_SEE_ALL_TASKS" || id == "TUTORIAL_SEE_EGGEATER" ||
+			id == "TUTORIAL_LAST" || id == "TUTORIAL_SEE_INVENTORY" || id == "TUTORIAL_SEE_MAP") {
+		// the man still falls, or only the bubble and its button take the touch
+		pass = false;
+	} else if (id == "TUTORIAL_MOVE_MAN") {
+		// no interaction under the finger and the point is on the motion graph of the scene below
+		if (g_ngi->_sceneStack.size() >= 2 && !getGameLoaderInteractionController()->findInteractionUnderCursor())
+			pass = sceneBelow()->_motionController->checkPoint((int)x, (int)y);
+	} else if (id == "TUTORIAL_USE_TRANSITION") {
 		// (the exits of a scene that was not visited are not made yet, see ExitManager::init)
-		if (!exit || !exit->hitPicture(x, y))
-			return false;
-		if (_state == 3)
-			return false;
-		if (action == 3)
-			finish();
-		return true;
-	}
-	if (id == "TUTORIAL_MAKE_TASK_BOOT") {
-		AniObject *boot = scene->findAniObjectById(ANI_SC4_BOOT, 0);
-		return boot && boot->hit(x, y);
-	}
-	if (id == "TUTORIAL_SEE_COMPLETE_TASK") {
+		Exit *exit = g_ngi->_exitManager->find(PIC_SC1_RTRUBA);
+		if (exit && exit->hitPicture(x, y) && _state != 3) {
+			if (action == 3)
+				finish();
+			pass = true;
+		}
+	} else if (id == "TUTORIAL_MAKE_TASK_BOOT") {
+		AniObject *boot = g_ngi->getSceneInStack(0)->findAniObjectById(ANI_SC4_BOOT, 0);
+		pass = boot && boot->hit(x, y);
+	} else if (id == "TUTORIAL_SEE_COMPLETE_TASK") {
 		// the bookmarks of the notebook, the scene over the one of the game
-		if (!g_ngi->getSceneInStack(1)->_controller || !static_cast<Notebook *>(g_ngi->getSceneInStack(1)->_controller.get())->isBookMarksHit(Common::Point((int)x, (int)y)))
-			return false;
-		if (action == 3)
-			finish();
-		return true;
-	}
-	if (id == "TUTORIAL_DO_EGG" || id == "TUTORIAL_GIVE_EGG") {
+		ISceneController *notebook = g_ngi->getSceneInStack(1)->_controller.get();
+		if (notebook && static_cast<Notebook *>(notebook)->isBookMarksHit(Common::Point((int)x, (int)y))) {
+			if (action == 3)
+				finish();
+			pass = true;
+		}
+	} else if (id == "TUTORIAL_USE_LADDER") {
+		Exit *exit = g_ngi->_exitManager->find(PIC_SC3_LADDER);
+		if (exit && exit->hitPicture(x, y) && _state != 3) {
+			if (action == 3)
+				finish();
+			pass = true;
+		}
+	} else if (id == "TUTORIAL_DO_EGG") {
+		// the drop finishes the tutorial and is sent on by TransmitCoord, nothing passes here
 		if (g_ngi->_inputController->getObject())
-			mouseActions(x, y, action, id == "TUTORIAL_DO_EGG" ? ANI_DADAYASHIK : ANI_EGGEATER);
-		return false;
-	}
-	if (id == "TUTORIAL_USE_CONTINUE_BUTTON") {
+			mouseActions(x, y, action, ANI_DADAYASHIK);
+	} else if (id == "TUTORIAL_GIVE_EGG") {
+		if (g_ngi->_inputController->getObject())
+			mouseActions(x, y, action, ANI_EGGEATER);
+	} else if (id == "TUTORIAL_USE_CONTINUE_BUTTON") {
 		PictureObject *continueButton = g_ngi->getSceneInStack(1)->findPictureObjectById(PIC_MNU_CONTINUE, 0);
-		if (!continueButton || !continueButton->hit(x, y))
-			return false;
-		if (action == 3)
-			finish();
-		return true;
-	}
-	if (id == "EXTRA_TUTORIAL_SEE_LIFT") {
-		GameObject *lift = scene->findVisibleObject(GD_SC38_LIFT, 0);
-		if (!lift || !static_cast<PictureObject *>(lift)->hit(x, y))
-			return false;
-		if (action == 3) {
-			finish();
-			setTransmitCoord(x, y, nullptr);
+		if (continueButton && continueButton->hit(x, y)) {
+			if (action == 3)
+				finish();
+			pass = true;
 		}
-		return true;
-	}
-	if (id == "EXTRA_TUTORIAL_SEE_HELP") {
-		if (!g_ngi->_notebook->isFoilHit(Common::Point(x, y)))
-			return false;
-		if (action == 2)
-			finish();
-		return true;
-	}
-	if (id == "EXTRA_TUTORIAL_SEE_EXTRA_HELP") {
-		// GIVE_HINT of the notebook GUI (scene over the game): finger down finishes the tutorial
-		GuiElement *button = g_ngi->getSceneInStack(1)->_guiManager->getElement("GIVE_HINT");
-		if (!button->hit(Common::Point(x, y)))
-			return false;
-		if (action == 2)
-			finish();
-		return true;
-	}
-	// arcade tutorials: a touch on the arcade object (ladder, ball ...) finishes; returns MouseActions
-	if (id == "ARCADE_TUTORIAL_04")
-		return mouseActions(x, y, action, PIC_SC4_LADDER);
-	if (id == "ARCADE_TUTORIAL_06")
-		return mouseActions(x, y, action, ANI_NEWBALL);
-	if (id == "ARCADE_TUTORIAL_08")
-		return mouseActions(x, y, action, ANI_BATUTA);
-	if (id == "ARCADE_TUTORIAL_09")
-		return mouseActions(x, y, action, ANI_PLEVATEL);
-	if (id == "ARCADE_TUTORIAL_11")
-		return mouseActions(x, y, action, ANI_KACHELI);
-	if (id == "ARCADE_TUTORIAL_14")
-		return mouseActionsZone(x, y, action, Common::Rect(1100, 480, 1260, 580));
-	if (id == "ARCADE_TUTORIAL_27")
-		return mouseActions(x, y, action, ANI_BITA);
-	if (id == "ARCADE_TUTORIAL_29")
-		return mouseActions(x, y, action, ANI_PORTER);
-	if (id == "TUTORIAL_USE_MAP") {
-		// scene 3 picture on the map (scene below): finger up leaves the map for scene 3 and finishes
-		// TUTORIAL_SEE_MAP, the touch never reaches the map; analytics event not ported
+	} else if (id == "EXTRA_TUTORIAL_SEE_LIFT") {
+		GameObject *lift = g_ngi->getSceneInStack(0)->findVisibleObject(GD_SC38_LIFT, 0);
+		if (lift && static_cast<PictureObject *>(lift)->hit(x, y)) {
+			if (action == 3) {
+				finish();
+				setTransmitCoord(x, y, nullptr);
+			}
+			pass = true;
+		}
+	} else if (id == "EXTRA_TUTORIAL_SEE_HELP") {
+		// finger down on a foil of the notebook (the scene over the game) finishes
+		Notebook *notebook = static_cast<Notebook *>(g_ngi->getSceneInStack(1)->_controller.get());
+		if (notebook->isFoilHit(Common::Point((int)x, (int)y))) {
+			if (action == 2)
+				finish();
+			pass = true;
+		}
+	} else if (id == "EXTRA_TUTORIAL_SEE_EXTRA_HELP") {
+		// CGuiElement::Hit(x, y, 0, 0) of GIVE_HINT in the notebook GUI
+		GuiElement *hint = g_ngi->getSceneInStack(1)->_guiManager->getElement("GIVE_HINT");
+		if (hint->hit(Common::Point((int)x, (int)y))) {
+			if (action == 2)
+				finish();
+			pass = true;
+		}
+	} else if (id == "ARCADE_TUTORIAL_04") {
+		pass = mouseActions(x, y, action, PIC_SC4_LADDER);
+	} else if (id == "ARCADE_TUTORIAL_06") {
+		pass = mouseActions(x, y, action, ANI_NEWBALL);
+	} else if (id == "ARCADE_TUTORIAL_08") {
+		pass = mouseActions(x, y, action, ANI_BATUTA);
+	} else if (id == "ARCADE_TUTORIAL_09") {
+		pass = mouseActions(x, y, action, ANI_PLEVATEL);
+	} else if (id == "ARCADE_TUTORIAL_11") {
+		pass = mouseActions(x, y, action, ANI_KACHELI);
+	} else if (id == "ARCADE_TUTORIAL_14") {
+		pass = mouseActionsZone(x, y, action, Common::Rect(1100, 480, 1260, 580));
+	} else if (id == "ARCADE_TUTORIAL_27") {
+		pass = mouseActions(x, y, action, ANI_BITA);
+	} else if (id == "ARCADE_TUTORIAL_29") {
+		pass = mouseActions(x, y, action, ANI_PORTER);
+	} else if (id == "TUTORIAL_USE_MAP") {
+		// the picture of scene 3 on the map: finger up leaves the map for scene 3, nothing passes;
+		// analytics event (CFlurryEventManager) not ported
 		Scene *map = g_ngi->getSceneInStack(1);
 		PictureObject *picture = map->findPictureObjectById(PIC_MAP_S03, 0);
-		const float mapX = x + map->_x;
-		const float mapY = y + map->_y;
 		MapWindowController *controller = static_cast<MapWindowController *>(map->_controller.get());
-		if (!picture || !picture->hit((int)mapX, (int)mapY)) {
+		if (!picture || !picture->hit((int)(x + map->_x), (int)(y + map->_y))) {
 			controller->setHitObject(nullptr);
-			return false;
-		}
-		if (action == 2) {
+		} else if (action == 2) {
 			controller->setHitObject(picture);
-			return false;
+		} else if (action == 3) {
+			g_ngi->popScene();
+			g_ngi->_gameLoader->preloadScene(SC_3, TrubaUp); // CGame::SetScene
+			g_ngi->_tutorialManager->findTutorial("TUTORIAL_SEE_MAP")->setState(4);
 		}
-		if (action != 3)
-			return false;
-		g_ngi->popScene();
-		g_ngi->_gameLoader->preloadScene(SC_3, TrubaUp); // CGame::SetScene
-		g_ngi->_tutorialManager->findTutorial("TUTORIAL_SEE_MAP")->setState(4);
-		return false;
+	} else {
+		pass = true;
 	}
-	return true;
+	debugC(2, kDebugEvents, "TutorialController::passMouseActions(%g, %g, %d) = %d (%s, state %d)", x, y, action, pass, id.c_str(), _state);
+	return pass;
 }
 
 } // End of namespace NGI
diff --git a/engines/ngi/fullpipe/tutorialcontroller.h b/engines/ngi/fullpipe/tutorialcontroller.h
index dba36fed8c5..7351b3db3a3 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.h
+++ b/engines/ngi/fullpipe/tutorialcontroller.h
@@ -37,7 +37,7 @@ class Tutorial;
 class XmlNode;
 
 /** CTutorialController: the scene SC_TUTORIAL; field offsets as in the original.
- * Not ported: PassMouseActions, AddContinueBtnIfNeed MOVE_MAN, notebook hints, analytics */
+ * Not ported: CNotebookController::SetAutoFoil, analytics (CFlurryEventManager) */
 class TutorialController : public ISceneController {
 public:
 	explicit TutorialController(int sceneId);
@@ -75,7 +75,6 @@ public:
 	bool mouseActions(float x, float y, int action, uint pictureId);
 	bool mouseActionsZone(float x, float y, int action, const Common::Rect &zone);
 	bool passMouseActions(float x, float y, int action);
-	bool passMouseActionsZone(float x, float y, int action);
 
 	void setInventoryItemsActivity();
 	void resetInventoryItemsActivity();


Commit: 3e0c5becf7daac7f45999aaa19a7f28627774b6b
    https://github.com/scummvm/scummvm/commit/3e0c5becf7daac7f45999aaa19a7f28627774b6b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Move the Android-only Full Pipe files to fullpipe/mobile

Changed paths:
  A engines/ngi/fullpipe/mobile/achievements.cpp
  A engines/ngi/fullpipe/mobile/achievements.h
  A engines/ngi/fullpipe/mobile/arcadeinterface.cpp
  A engines/ngi/fullpipe/mobile/arcadeinterface.h
  A engines/ngi/fullpipe/mobile/chaptercontroller.cpp
  A engines/ngi/fullpipe/mobile/chaptercontroller.h
  A engines/ngi/fullpipe/mobile/chaptermanager.cpp
  A engines/ngi/fullpipe/mobile/chaptermanager.h
  A engines/ngi/fullpipe/mobile/controllerhelpers.cpp
  A engines/ngi/fullpipe/mobile/controllerhelpers.h
  A engines/ngi/fullpipe/mobile/exitmanager.cpp
  A engines/ngi/fullpipe/mobile/exitmanager.h
  A engines/ngi/fullpipe/mobile/fpcontroller.cpp
  A engines/ngi/fullpipe/mobile/fpcontroller.h
  A engines/ngi/fullpipe/mobile/fpguicontroller.cpp
  A engines/ngi/fullpipe/mobile/fpguicontroller.h
  A engines/ngi/fullpipe/mobile/help.cpp
  A engines/ngi/fullpipe/mobile/help.h
  A engines/ngi/fullpipe/mobile/highlight.cpp
  A engines/ngi/fullpipe/mobile/highlight.h
  A engines/ngi/fullpipe/mobile/hintmanager.cpp
  A engines/ngi/fullpipe/mobile/hintmanager.h
  A engines/ngi/fullpipe/mobile/inventorycontroller.cpp
  A engines/ngi/fullpipe/mobile/inventorycontroller.h
  A engines/ngi/fullpipe/mobile/liftcontroller.cpp
  A engines/ngi/fullpipe/mobile/liftcontroller.h
  A engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
  A engines/ngi/fullpipe/mobile/mainmenucontroller.h
  A engines/ngi/fullpipe/mobile/map.cpp
  A engines/ngi/fullpipe/mobile/map.h
  A engines/ngi/fullpipe/mobile/mapwindowcontroller.cpp
  A engines/ngi/fullpipe/mobile/mapwindowcontroller.h
  A engines/ngi/fullpipe/mobile/noactionlogger.cpp
  A engines/ngi/fullpipe/mobile/noactionlogger.h
  A engines/ngi/fullpipe/mobile/notebook.cpp
  A engines/ngi/fullpipe/mobile/notebook.h
  A engines/ngi/fullpipe/mobile/objhelper.cpp
  A engines/ngi/fullpipe/mobile/objhelper.h
  A engines/ngi/fullpipe/mobile/sc01controller.cpp
  A engines/ngi/fullpipe/mobile/sc01controller.h
  A engines/ngi/fullpipe/mobile/sc02controller.cpp
  A engines/ngi/fullpipe/mobile/sc02controller.h
  A engines/ngi/fullpipe/mobile/sc03controller.cpp
  A engines/ngi/fullpipe/mobile/sc03controller.h
  A engines/ngi/fullpipe/mobile/sc04controller.cpp
  A engines/ngi/fullpipe/mobile/sc04controller.h
  A engines/ngi/fullpipe/mobile/sc05controller.cpp
  A engines/ngi/fullpipe/mobile/sc05controller.h
  A engines/ngi/fullpipe/mobile/sc06controller.cpp
  A engines/ngi/fullpipe/mobile/sc06controller.h
  A engines/ngi/fullpipe/mobile/sc07controller.cpp
  A engines/ngi/fullpipe/mobile/sc07controller.h
  A engines/ngi/fullpipe/mobile/sc08controller.cpp
  A engines/ngi/fullpipe/mobile/sc08controller.h
  A engines/ngi/fullpipe/mobile/sc09controller.cpp
  A engines/ngi/fullpipe/mobile/sc09controller.h
  A engines/ngi/fullpipe/mobile/sc10controller.cpp
  A engines/ngi/fullpipe/mobile/sc10controller.h
  A engines/ngi/fullpipe/mobile/sc11controller.cpp
  A engines/ngi/fullpipe/mobile/sc11controller.h
  A engines/ngi/fullpipe/mobile/sc12controller.cpp
  A engines/ngi/fullpipe/mobile/sc12controller.h
  A engines/ngi/fullpipe/mobile/sc13controller.cpp
  A engines/ngi/fullpipe/mobile/sc13controller.h
  A engines/ngi/fullpipe/mobile/sc14controller.cpp
  A engines/ngi/fullpipe/mobile/sc14controller.h
  A engines/ngi/fullpipe/mobile/sc15controller.cpp
  A engines/ngi/fullpipe/mobile/sc15controller.h
  A engines/ngi/fullpipe/mobile/sc16controller.cpp
  A engines/ngi/fullpipe/mobile/sc16controller.h
  A engines/ngi/fullpipe/mobile/sc17controller.cpp
  A engines/ngi/fullpipe/mobile/sc17controller.h
  A engines/ngi/fullpipe/mobile/sc18controller.cpp
  A engines/ngi/fullpipe/mobile/sc18controller.h
  A engines/ngi/fullpipe/mobile/sc19controller.cpp
  A engines/ngi/fullpipe/mobile/sc19controller.h
  A engines/ngi/fullpipe/mobile/sc20controller.cpp
  A engines/ngi/fullpipe/mobile/sc20controller.h
  A engines/ngi/fullpipe/mobile/sc21controller.cpp
  A engines/ngi/fullpipe/mobile/sc21controller.h
  A engines/ngi/fullpipe/mobile/sc22controller.cpp
  A engines/ngi/fullpipe/mobile/sc22controller.h
  A engines/ngi/fullpipe/mobile/sc23controller.cpp
  A engines/ngi/fullpipe/mobile/sc23controller.h
  A engines/ngi/fullpipe/mobile/sc24controller.cpp
  A engines/ngi/fullpipe/mobile/sc24controller.h
  A engines/ngi/fullpipe/mobile/sc25controller.cpp
  A engines/ngi/fullpipe/mobile/sc25controller.h
  A engines/ngi/fullpipe/mobile/sc26controller.cpp
  A engines/ngi/fullpipe/mobile/sc26controller.h
  A engines/ngi/fullpipe/mobile/sc27controller.cpp
  A engines/ngi/fullpipe/mobile/sc27controller.h
  A engines/ngi/fullpipe/mobile/sc28controller.cpp
  A engines/ngi/fullpipe/mobile/sc28controller.h
  A engines/ngi/fullpipe/mobile/sc29controller.cpp
  A engines/ngi/fullpipe/mobile/sc29controller.h
  A engines/ngi/fullpipe/mobile/sc30controller.cpp
  A engines/ngi/fullpipe/mobile/sc30controller.h
  A engines/ngi/fullpipe/mobile/sc31controller.cpp
  A engines/ngi/fullpipe/mobile/sc31controller.h
  A engines/ngi/fullpipe/mobile/sc32controller.cpp
  A engines/ngi/fullpipe/mobile/sc32controller.h
  A engines/ngi/fullpipe/mobile/sc33controller.cpp
  A engines/ngi/fullpipe/mobile/sc33controller.h
  A engines/ngi/fullpipe/mobile/sc34controller.cpp
  A engines/ngi/fullpipe/mobile/sc34controller.h
  A engines/ngi/fullpipe/mobile/sc35controller.cpp
  A engines/ngi/fullpipe/mobile/sc35controller.h
  A engines/ngi/fullpipe/mobile/sc36controller.cpp
  A engines/ngi/fullpipe/mobile/sc36controller.h
  A engines/ngi/fullpipe/mobile/sc37controller.cpp
  A engines/ngi/fullpipe/mobile/sc37controller.h
  A engines/ngi/fullpipe/mobile/sc38controller.cpp
  A engines/ngi/fullpipe/mobile/sc38controller.h
  A engines/ngi/fullpipe/mobile/scenecontrollers.cpp
  A engines/ngi/fullpipe/mobile/scenecontrollers.h
  A engines/ngi/fullpipe/mobile/statemanager.cpp
  A engines/ngi/fullpipe/mobile/statemanager.h
  A engines/ngi/fullpipe/mobile/taskmanager.cpp
  A engines/ngi/fullpipe/mobile/taskmanager.h
  A engines/ngi/fullpipe/mobile/tremble.cpp
  A engines/ngi/fullpipe/mobile/tremble.h
  A engines/ngi/fullpipe/mobile/tutorialcontroller.cpp
  A engines/ngi/fullpipe/mobile/tutorialcontroller.h
  A engines/ngi/fullpipe/mobile/tutorialmanager.cpp
  A engines/ngi/fullpipe/mobile/tutorialmanager.h
  A engines/ngi/fullpipe/mobile/waitscreen.cpp
  A engines/ngi/fullpipe/mobile/waitscreen.h
  R engines/ngi/fullpipe/achievements.cpp
  R engines/ngi/fullpipe/achievements.h
  R engines/ngi/fullpipe/arcadeinterface.cpp
  R engines/ngi/fullpipe/arcadeinterface.h
  R engines/ngi/fullpipe/chaptercontroller.cpp
  R engines/ngi/fullpipe/chaptercontroller.h
  R engines/ngi/fullpipe/chaptermanager.cpp
  R engines/ngi/fullpipe/chaptermanager.h
  R engines/ngi/fullpipe/controllerhelpers.cpp
  R engines/ngi/fullpipe/controllerhelpers.h
  R engines/ngi/fullpipe/exitmanager.cpp
  R engines/ngi/fullpipe/exitmanager.h
  R engines/ngi/fullpipe/fpcontroller.cpp
  R engines/ngi/fullpipe/fpcontroller.h
  R engines/ngi/fullpipe/fpguicontroller.cpp
  R engines/ngi/fullpipe/fpguicontroller.h
  R engines/ngi/fullpipe/help.cpp
  R engines/ngi/fullpipe/help.h
  R engines/ngi/fullpipe/highlight.cpp
  R engines/ngi/fullpipe/highlight.h
  R engines/ngi/fullpipe/hintmanager.cpp
  R engines/ngi/fullpipe/hintmanager.h
  R engines/ngi/fullpipe/inventorycontroller.cpp
  R engines/ngi/fullpipe/inventorycontroller.h
  R engines/ngi/fullpipe/liftcontroller.cpp
  R engines/ngi/fullpipe/liftcontroller.h
  R engines/ngi/fullpipe/mainmenucontroller.cpp
  R engines/ngi/fullpipe/mainmenucontroller.h
  R engines/ngi/fullpipe/map.cpp
  R engines/ngi/fullpipe/map.h
  R engines/ngi/fullpipe/mapwindowcontroller.cpp
  R engines/ngi/fullpipe/mapwindowcontroller.h
  R engines/ngi/fullpipe/noactionlogger.cpp
  R engines/ngi/fullpipe/noactionlogger.h
  R engines/ngi/fullpipe/notebook.cpp
  R engines/ngi/fullpipe/notebook.h
  R engines/ngi/fullpipe/objhelper.cpp
  R engines/ngi/fullpipe/objhelper.h
  R engines/ngi/fullpipe/sc01controller.cpp
  R engines/ngi/fullpipe/sc01controller.h
  R engines/ngi/fullpipe/sc02controller.cpp
  R engines/ngi/fullpipe/sc02controller.h
  R engines/ngi/fullpipe/sc03controller.cpp
  R engines/ngi/fullpipe/sc03controller.h
  R engines/ngi/fullpipe/sc04controller.cpp
  R engines/ngi/fullpipe/sc04controller.h
  R engines/ngi/fullpipe/sc05controller.cpp
  R engines/ngi/fullpipe/sc05controller.h
  R engines/ngi/fullpipe/sc06controller.cpp
  R engines/ngi/fullpipe/sc06controller.h
  R engines/ngi/fullpipe/sc07controller.cpp
  R engines/ngi/fullpipe/sc07controller.h
  R engines/ngi/fullpipe/sc08controller.cpp
  R engines/ngi/fullpipe/sc08controller.h
  R engines/ngi/fullpipe/sc09controller.cpp
  R engines/ngi/fullpipe/sc09controller.h
  R engines/ngi/fullpipe/sc10controller.cpp
  R engines/ngi/fullpipe/sc10controller.h
  R engines/ngi/fullpipe/sc11controller.cpp
  R engines/ngi/fullpipe/sc11controller.h
  R engines/ngi/fullpipe/sc12controller.cpp
  R engines/ngi/fullpipe/sc12controller.h
  R engines/ngi/fullpipe/sc13controller.cpp
  R engines/ngi/fullpipe/sc13controller.h
  R engines/ngi/fullpipe/sc14controller.cpp
  R engines/ngi/fullpipe/sc14controller.h
  R engines/ngi/fullpipe/sc15controller.cpp
  R engines/ngi/fullpipe/sc15controller.h
  R engines/ngi/fullpipe/sc16controller.cpp
  R engines/ngi/fullpipe/sc16controller.h
  R engines/ngi/fullpipe/sc17controller.cpp
  R engines/ngi/fullpipe/sc17controller.h
  R engines/ngi/fullpipe/sc18controller.cpp
  R engines/ngi/fullpipe/sc18controller.h
  R engines/ngi/fullpipe/sc19controller.cpp
  R engines/ngi/fullpipe/sc19controller.h
  R engines/ngi/fullpipe/sc20controller.cpp
  R engines/ngi/fullpipe/sc20controller.h
  R engines/ngi/fullpipe/sc21controller.cpp
  R engines/ngi/fullpipe/sc21controller.h
  R engines/ngi/fullpipe/sc22controller.cpp
  R engines/ngi/fullpipe/sc22controller.h
  R engines/ngi/fullpipe/sc23controller.cpp
  R engines/ngi/fullpipe/sc23controller.h
  R engines/ngi/fullpipe/sc24controller.cpp
  R engines/ngi/fullpipe/sc24controller.h
  R engines/ngi/fullpipe/sc25controller.cpp
  R engines/ngi/fullpipe/sc25controller.h
  R engines/ngi/fullpipe/sc26controller.cpp
  R engines/ngi/fullpipe/sc26controller.h
  R engines/ngi/fullpipe/sc27controller.cpp
  R engines/ngi/fullpipe/sc27controller.h
  R engines/ngi/fullpipe/sc28controller.cpp
  R engines/ngi/fullpipe/sc28controller.h
  R engines/ngi/fullpipe/sc29controller.cpp
  R engines/ngi/fullpipe/sc29controller.h
  R engines/ngi/fullpipe/sc30controller.cpp
  R engines/ngi/fullpipe/sc30controller.h
  R engines/ngi/fullpipe/sc31controller.cpp
  R engines/ngi/fullpipe/sc31controller.h
  R engines/ngi/fullpipe/sc32controller.cpp
  R engines/ngi/fullpipe/sc32controller.h
  R engines/ngi/fullpipe/sc33controller.cpp
  R engines/ngi/fullpipe/sc33controller.h
  R engines/ngi/fullpipe/sc34controller.cpp
  R engines/ngi/fullpipe/sc34controller.h
  R engines/ngi/fullpipe/sc35controller.cpp
  R engines/ngi/fullpipe/sc35controller.h
  R engines/ngi/fullpipe/sc36controller.cpp
  R engines/ngi/fullpipe/sc36controller.h
  R engines/ngi/fullpipe/sc37controller.cpp
  R engines/ngi/fullpipe/sc37controller.h
  R engines/ngi/fullpipe/sc38controller.cpp
  R engines/ngi/fullpipe/sc38controller.h
  R engines/ngi/fullpipe/scenecontrollers.cpp
  R engines/ngi/fullpipe/scenecontrollers.h
  R engines/ngi/fullpipe/statemanager.cpp
  R engines/ngi/fullpipe/statemanager.h
  R engines/ngi/fullpipe/taskmanager.cpp
  R engines/ngi/fullpipe/taskmanager.h
  R engines/ngi/fullpipe/tremble.cpp
  R engines/ngi/fullpipe/tremble.h
  R engines/ngi/fullpipe/tutorialcontroller.cpp
  R engines/ngi/fullpipe/tutorialcontroller.h
  R engines/ngi/fullpipe/tutorialmanager.cpp
  R engines/ngi/fullpipe/tutorialmanager.h
  R engines/ngi/fullpipe/waitscreen.cpp
  R engines/ngi/fullpipe/waitscreen.h
    engines/ngi/debugger/testmode.cpp
    engines/ngi/fullpipe/lift.cpp
    engines/ngi/fullpipe/scene01.cpp
    engines/ngi/fullpipe/scene03.cpp
    engines/ngi/fullpipe/scene04.cpp
    engines/ngi/fullpipe/sceneIntro.cpp
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/init.cpp
    engines/ngi/module.mk
    engines/ngi/ngi.cpp
    engines/ngi/scene.cpp
    engines/ngi/stateloader.cpp
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 74385c5ff6e..5ff3d6d7f34 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -37,8 +37,8 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/sc04controller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/sc04controller.h"
 #include "ngi/debugger/testmode.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/lift.cpp b/engines/ngi/fullpipe/lift.cpp
index f36a559835a..f96e1e81a9b 100644
--- a/engines/ngi/fullpipe/lift.cpp
+++ b/engines/ngi/fullpipe/lift.cpp
@@ -32,9 +32,9 @@
 #include "ngi/gameloader.h"
 #include "ngi/modal.h"
 #include "ngi/motion.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/lift.h"
-#include "ngi/fullpipe/liftcontroller.h"
+#include "ngi/fullpipe/mobile/liftcontroller.h"
 #include "ngi/guimanager.h"
 #include "ngi/interaction.h"
 
diff --git a/engines/ngi/fullpipe/achievements.cpp b/engines/ngi/fullpipe/mobile/achievements.cpp
similarity index 99%
rename from engines/ngi/fullpipe/achievements.cpp
rename to engines/ngi/fullpipe/mobile/achievements.cpp
index 858aeb27e09..c5c5d866343 100644
--- a/engines/ngi/fullpipe/achievements.cpp
+++ b/engines/ngi/fullpipe/mobile/achievements.cpp
@@ -28,9 +28,9 @@
 #include "ngi/gameloader.h"
 #include "ngi/gfx.h"
 #include "ngi/scene.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/achievements.h b/engines/ngi/fullpipe/mobile/achievements.h
similarity index 100%
rename from engines/ngi/fullpipe/achievements.h
rename to engines/ngi/fullpipe/mobile/achievements.h
diff --git a/engines/ngi/fullpipe/arcadeinterface.cpp b/engines/ngi/fullpipe/mobile/arcadeinterface.cpp
similarity index 98%
rename from engines/ngi/fullpipe/arcadeinterface.cpp
rename to engines/ngi/fullpipe/mobile/arcadeinterface.cpp
index 8909222b028..0bf7b36e9d2 100644
--- a/engines/ngi/fullpipe/arcadeinterface.cpp
+++ b/engines/ngi/fullpipe/mobile/arcadeinterface.cpp
@@ -30,9 +30,9 @@
 #include "ngi/objects.h"
 #include "ngi/scene.h"
 #include "ngi/sound.h"
-#include "ngi/fullpipe/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/arcadeinterface.h b/engines/ngi/fullpipe/mobile/arcadeinterface.h
similarity index 100%
rename from engines/ngi/fullpipe/arcadeinterface.h
rename to engines/ngi/fullpipe/mobile/arcadeinterface.h
diff --git a/engines/ngi/fullpipe/chaptercontroller.cpp b/engines/ngi/fullpipe/mobile/chaptercontroller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/chaptercontroller.cpp
rename to engines/ngi/fullpipe/mobile/chaptercontroller.cpp
index 31e024d11ae..408b14be547 100644
--- a/engines/ngi/fullpipe/chaptercontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/chaptercontroller.cpp
@@ -24,8 +24,8 @@
 
 #include "ngi/ngi.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/chaptercontroller.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptercontroller.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/font.h"
 #include "ngi/scene.h"
 #include "ngi/sound.h"
diff --git a/engines/ngi/fullpipe/chaptercontroller.h b/engines/ngi/fullpipe/mobile/chaptercontroller.h
similarity index 100%
rename from engines/ngi/fullpipe/chaptercontroller.h
rename to engines/ngi/fullpipe/mobile/chaptercontroller.h
diff --git a/engines/ngi/fullpipe/chaptermanager.cpp b/engines/ngi/fullpipe/mobile/chaptermanager.cpp
similarity index 96%
rename from engines/ngi/fullpipe/chaptermanager.cpp
rename to engines/ngi/fullpipe/mobile/chaptermanager.cpp
index 0baeb241372..271167a85c4 100644
--- a/engines/ngi/fullpipe/chaptermanager.cpp
+++ b/engines/ngi/fullpipe/mobile/chaptermanager.cpp
@@ -30,15 +30,15 @@
 #include "ngi/gameloader.h"
 #include "ngi/objects.h"
 #include "ngi/anihandler.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/chaptercontroller.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptercontroller.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/scene.h"
 #include "ngi/messages.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/chaptermanager.h b/engines/ngi/fullpipe/mobile/chaptermanager.h
similarity index 100%
rename from engines/ngi/fullpipe/chaptermanager.h
rename to engines/ngi/fullpipe/mobile/chaptermanager.h
diff --git a/engines/ngi/fullpipe/controllerhelpers.cpp b/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
similarity index 98%
rename from engines/ngi/fullpipe/controllerhelpers.cpp
rename to engines/ngi/fullpipe/mobile/controllerhelpers.cpp
index 451ff5f3db2..7d5fb5b30fe 100644
--- a/engines/ngi/fullpipe/controllerhelpers.cpp
+++ b/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
@@ -28,8 +28,8 @@
 #include "ngi/scene.h"
 #include "ngi/sound.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/controllerhelpers.h b/engines/ngi/fullpipe/mobile/controllerhelpers.h
similarity index 100%
rename from engines/ngi/fullpipe/controllerhelpers.h
rename to engines/ngi/fullpipe/mobile/controllerhelpers.h
diff --git a/engines/ngi/fullpipe/exitmanager.cpp b/engines/ngi/fullpipe/mobile/exitmanager.cpp
similarity index 99%
rename from engines/ngi/fullpipe/exitmanager.cpp
rename to engines/ngi/fullpipe/mobile/exitmanager.cpp
index 1f76da8fb9c..5d584f46953 100644
--- a/engines/ngi/fullpipe/exitmanager.cpp
+++ b/engines/ngi/fullpipe/mobile/exitmanager.cpp
@@ -30,7 +30,7 @@
 #include "ngi/sound.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/exitmanager.h b/engines/ngi/fullpipe/mobile/exitmanager.h
similarity index 100%
rename from engines/ngi/fullpipe/exitmanager.h
rename to engines/ngi/fullpipe/mobile/exitmanager.h
diff --git a/engines/ngi/fullpipe/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/fpcontroller.cpp
rename to engines/ngi/fullpipe/mobile/fpcontroller.cpp
index 84294d7a60e..aaea3d84533 100644
--- a/engines/ngi/fullpipe/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -35,22 +35,22 @@
 #include "ngi/sound.h"
 #include "ngi/statics.h"
 #include "ngi/scene.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/hintmanager.h"
-#include "ngi/fullpipe/noactionlogger.h"
-#include "ngi/fullpipe/objhelper.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
+#include "ngi/fullpipe/mobile/noactionlogger.h"
+#include "ngi/fullpipe/mobile/objhelper.h"
 #include "ngi/fullpipe/lift.h"
-#include "ngi/fullpipe/map.h"
+#include "ngi/fullpipe/mobile/map.h"
 #include "ngi/guimanager.h"
 #include "ngi/inventory.h"
-#include "ngi/fullpipe/tremble.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/tremble.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/fpcontroller.h b/engines/ngi/fullpipe/mobile/fpcontroller.h
similarity index 100%
rename from engines/ngi/fullpipe/fpcontroller.h
rename to engines/ngi/fullpipe/mobile/fpcontroller.h
diff --git a/engines/ngi/fullpipe/fpguicontroller.cpp b/engines/ngi/fullpipe/mobile/fpguicontroller.cpp
similarity index 95%
rename from engines/ngi/fullpipe/fpguicontroller.cpp
rename to engines/ngi/fullpipe/mobile/fpguicontroller.cpp
index 43c4a9b76df..e5354a3c1e3 100644
--- a/engines/ngi/fullpipe/fpguicontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpguicontroller.cpp
@@ -22,8 +22,8 @@
 #include "ngi/ngi.h"
 #include "ngi/scene.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/fpguicontroller.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/fpguicontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/fpguicontroller.h b/engines/ngi/fullpipe/mobile/fpguicontroller.h
similarity index 100%
rename from engines/ngi/fullpipe/fpguicontroller.h
rename to engines/ngi/fullpipe/mobile/fpguicontroller.h
diff --git a/engines/ngi/fullpipe/help.cpp b/engines/ngi/fullpipe/mobile/help.cpp
similarity index 98%
rename from engines/ngi/fullpipe/help.cpp
rename to engines/ngi/fullpipe/mobile/help.cpp
index 143cc53c0e6..e57b86d2f32 100644
--- a/engines/ngi/fullpipe/help.cpp
+++ b/engines/ngi/fullpipe/mobile/help.cpp
@@ -29,9 +29,9 @@
 #include "ngi/statics.h"
 #include "ngi/xmlnode.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/help.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/help.h b/engines/ngi/fullpipe/mobile/help.h
similarity index 98%
rename from engines/ngi/fullpipe/help.h
rename to engines/ngi/fullpipe/mobile/help.h
index 91473a56c76..22b2af4eef2 100644
--- a/engines/ngi/fullpipe/help.h
+++ b/engines/ngi/fullpipe/mobile/help.h
@@ -26,7 +26,7 @@
 #include "common/str.h"
 
 #include "ngi/scenecontroller.h"
-#include "ngi/fullpipe/statemanager.h" // LogicState
+#include "ngi/fullpipe/mobile/statemanager.h" // LogicState
 
 namespace Common {
 class Serializer;
diff --git a/engines/ngi/fullpipe/highlight.cpp b/engines/ngi/fullpipe/mobile/highlight.cpp
similarity index 97%
rename from engines/ngi/fullpipe/highlight.cpp
rename to engines/ngi/fullpipe/mobile/highlight.cpp
index adbba38003e..28ba518341f 100644
--- a/engines/ngi/fullpipe/highlight.cpp
+++ b/engines/ngi/fullpipe/mobile/highlight.cpp
@@ -23,7 +23,7 @@
 #include "ngi/behavior.h"
 #include "ngi/gfx.h"
 #include "ngi/scene.h"
-#include "ngi/fullpipe/highlight.h"
+#include "ngi/fullpipe/mobile/highlight.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/highlight.h b/engines/ngi/fullpipe/mobile/highlight.h
similarity index 100%
rename from engines/ngi/fullpipe/highlight.h
rename to engines/ngi/fullpipe/mobile/highlight.h
diff --git a/engines/ngi/fullpipe/hintmanager.cpp b/engines/ngi/fullpipe/mobile/hintmanager.cpp
similarity index 99%
rename from engines/ngi/fullpipe/hintmanager.cpp
rename to engines/ngi/fullpipe/mobile/hintmanager.cpp
index 0ebdf395b14..0edb1e93e5f 100644
--- a/engines/ngi/fullpipe/hintmanager.cpp
+++ b/engines/ngi/fullpipe/mobile/hintmanager.cpp
@@ -26,7 +26,7 @@
 #include "ngi/guimanager.h"
 #include "ngi/scene.h"
 #include "ngi/xmlnode.h"
-#include "ngi/fullpipe/hintmanager.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/hintmanager.h b/engines/ngi/fullpipe/mobile/hintmanager.h
similarity index 100%
rename from engines/ngi/fullpipe/hintmanager.h
rename to engines/ngi/fullpipe/mobile/hintmanager.h
diff --git a/engines/ngi/fullpipe/inventorycontroller.cpp b/engines/ngi/fullpipe/mobile/inventorycontroller.cpp
similarity index 96%
rename from engines/ngi/fullpipe/inventorycontroller.cpp
rename to engines/ngi/fullpipe/mobile/inventorycontroller.cpp
index 18319eda41d..7da7a2321f0 100644
--- a/engines/ngi/fullpipe/inventorycontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/inventorycontroller.cpp
@@ -23,12 +23,12 @@
 
 #include "ngi/ngi.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/inventorycontroller.h"
-#include "ngi/fullpipe/objhelper.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialcontroller.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/objhelper.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialcontroller.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 #include "ngi/gfx.h"
 #include "ngi/guimanager.h"
 #include "ngi/input.h"
diff --git a/engines/ngi/fullpipe/inventorycontroller.h b/engines/ngi/fullpipe/mobile/inventorycontroller.h
similarity index 100%
rename from engines/ngi/fullpipe/inventorycontroller.h
rename to engines/ngi/fullpipe/mobile/inventorycontroller.h
diff --git a/engines/ngi/fullpipe/liftcontroller.cpp b/engines/ngi/fullpipe/mobile/liftcontroller.cpp
similarity index 97%
rename from engines/ngi/fullpipe/liftcontroller.cpp
rename to engines/ngi/fullpipe/mobile/liftcontroller.cpp
index 70933a9d706..4971c2b16db 100644
--- a/engines/ngi/fullpipe/liftcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/liftcontroller.cpp
@@ -24,10 +24,10 @@
 #include "ngi/ngi.h"
 #include "ngi/input.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/hintmanager.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
 #include "ngi/fullpipe/lift.h"
-#include "ngi/fullpipe/liftcontroller.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/liftcontroller.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 
diff --git a/engines/ngi/fullpipe/liftcontroller.h b/engines/ngi/fullpipe/mobile/liftcontroller.h
similarity index 98%
rename from engines/ngi/fullpipe/liftcontroller.h
rename to engines/ngi/fullpipe/mobile/liftcontroller.h
index 526a6781daa..ee406b3bea8 100644
--- a/engines/ngi/fullpipe/liftcontroller.h
+++ b/engines/ngi/fullpipe/mobile/liftcontroller.h
@@ -24,7 +24,7 @@
 
 #include "common/array.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/mainmenucontroller.cpp b/engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
similarity index 96%
rename from engines/ngi/fullpipe/mainmenucontroller.cpp
rename to engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
index 83392479da1..fcdfacd63d8 100644
--- a/engines/ngi/fullpipe/mainmenucontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
@@ -27,16 +27,16 @@
 #include "ngi/inventory.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/mainmenucontroller.h"
-#include "ngi/fullpipe/map.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/mainmenucontroller.h"
+#include "ngi/fullpipe/mobile/map.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/mainmenucontroller.h b/engines/ngi/fullpipe/mobile/mainmenucontroller.h
similarity index 98%
rename from engines/ngi/fullpipe/mainmenucontroller.h
rename to engines/ngi/fullpipe/mobile/mainmenucontroller.h
index f97250bb184..4f6404f9da4 100644
--- a/engines/ngi/fullpipe/mainmenucontroller.h
+++ b/engines/ngi/fullpipe/mobile/mainmenucontroller.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/str.h"
 
-#include "ngi/fullpipe/fpguicontroller.h"
+#include "ngi/fullpipe/mobile/fpguicontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/map.cpp b/engines/ngi/fullpipe/mobile/map.cpp
similarity index 98%
rename from engines/ngi/fullpipe/map.cpp
rename to engines/ngi/fullpipe/mobile/map.cpp
index 2a2d4956a98..6dde0529b3a 100644
--- a/engines/ngi/fullpipe/map.cpp
+++ b/engines/ngi/fullpipe/mobile/map.cpp
@@ -22,9 +22,9 @@
 #include "ngi/ngi.h"
 #include "ngi/scene.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/map.h"
-#include "ngi/fullpipe/mapwindowcontroller.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/map.h"
+#include "ngi/fullpipe/mobile/mapwindowcontroller.h"
 #include "ngi/fullpipe/objectnames.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/map.h b/engines/ngi/fullpipe/mobile/map.h
similarity index 100%
rename from engines/ngi/fullpipe/map.h
rename to engines/ngi/fullpipe/mobile/map.h
diff --git a/engines/ngi/fullpipe/mapwindowcontroller.cpp b/engines/ngi/fullpipe/mobile/mapwindowcontroller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/mapwindowcontroller.cpp
rename to engines/ngi/fullpipe/mobile/mapwindowcontroller.cpp
index 81b3eb08151..2fa3989aca2 100644
--- a/engines/ngi/fullpipe/mapwindowcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/mapwindowcontroller.cpp
@@ -26,13 +26,13 @@
 #include "ngi/gfx.h"
 #include "ngi/input.h"
 #include "ngi/scene.h"
-#include "ngi/fullpipe/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/map.h"
-#include "ngi/fullpipe/mapwindowcontroller.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/map.h"
+#include "ngi/fullpipe/mobile/mapwindowcontroller.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/mapwindowcontroller.h b/engines/ngi/fullpipe/mobile/mapwindowcontroller.h
similarity index 99%
rename from engines/ngi/fullpipe/mapwindowcontroller.h
rename to engines/ngi/fullpipe/mobile/mapwindowcontroller.h
index af09ddd5c40..550e3f5bac2 100644
--- a/engines/ngi/fullpipe/mapwindowcontroller.h
+++ b/engines/ngi/fullpipe/mobile/mapwindowcontroller.h
@@ -24,7 +24,7 @@
 
 #include "common/str.h"
 
-#include "ngi/fullpipe/fpguicontroller.h"
+#include "ngi/fullpipe/mobile/fpguicontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/noactionlogger.cpp b/engines/ngi/fullpipe/mobile/noactionlogger.cpp
similarity index 90%
rename from engines/ngi/fullpipe/noactionlogger.cpp
rename to engines/ngi/fullpipe/mobile/noactionlogger.cpp
index 0c6aed3661f..22678554115 100644
--- a/engines/ngi/fullpipe/noactionlogger.cpp
+++ b/engines/ngi/fullpipe/mobile/noactionlogger.cpp
@@ -20,11 +20,11 @@
  */
 
 #include "ngi/ngi.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/notebook.h"
-#include "ngi/fullpipe/noactionlogger.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/notebook.h"
+#include "ngi/fullpipe/mobile/noactionlogger.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/noactionlogger.h b/engines/ngi/fullpipe/mobile/noactionlogger.h
similarity index 100%
rename from engines/ngi/fullpipe/noactionlogger.h
rename to engines/ngi/fullpipe/mobile/noactionlogger.h
diff --git a/engines/ngi/fullpipe/notebook.cpp b/engines/ngi/fullpipe/mobile/notebook.cpp
similarity index 99%
rename from engines/ngi/fullpipe/notebook.cpp
rename to engines/ngi/fullpipe/mobile/notebook.cpp
index 6d3309258a6..c93a9ca1184 100644
--- a/engines/ngi/fullpipe/notebook.cpp
+++ b/engines/ngi/fullpipe/mobile/notebook.cpp
@@ -27,17 +27,17 @@
 #include "ngi/gameloader.h"
 #include "ngi/objects.h"
 #include "ngi/anihandler.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/guimanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/notebook.h"
+#include "ngi/fullpipe/mobile/notebook.h"
 #include "ngi/scene.h"
 #include "ngi/fullpipe/scenes.h"
 #include "ngi/sound.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/notebook.h b/engines/ngi/fullpipe/mobile/notebook.h
similarity index 100%
rename from engines/ngi/fullpipe/notebook.h
rename to engines/ngi/fullpipe/mobile/notebook.h
diff --git a/engines/ngi/fullpipe/objhelper.cpp b/engines/ngi/fullpipe/mobile/objhelper.cpp
similarity index 99%
rename from engines/ngi/fullpipe/objhelper.cpp
rename to engines/ngi/fullpipe/mobile/objhelper.cpp
index fa82f7796ac..3b8ccba9109 100644
--- a/engines/ngi/fullpipe/objhelper.cpp
+++ b/engines/ngi/fullpipe/mobile/objhelper.cpp
@@ -33,9 +33,9 @@
 #include "ngi/sceneobjects.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/objhelper.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/objhelper.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/objhelper.h b/engines/ngi/fullpipe/mobile/objhelper.h
similarity index 100%
rename from engines/ngi/fullpipe/objhelper.h
rename to engines/ngi/fullpipe/mobile/objhelper.h
diff --git a/engines/ngi/fullpipe/sc01controller.cpp b/engines/ngi/fullpipe/mobile/sc01controller.cpp
similarity index 96%
rename from engines/ngi/fullpipe/sc01controller.cpp
rename to engines/ngi/fullpipe/mobile/sc01controller.cpp
index 884277d149f..f3acecfc3a2 100644
--- a/engines/ngi/fullpipe/sc01controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc01controller.cpp
@@ -31,17 +31,17 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc01controller.h"
+#include "ngi/fullpipe/mobile/sc01controller.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc01controller.h b/engines/ngi/fullpipe/mobile/sc01controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc01controller.h
rename to engines/ngi/fullpipe/mobile/sc01controller.h
index dd87658f696..f50ead4329e 100644
--- a/engines/ngi/fullpipe/sc01controller.h
+++ b/engines/ngi/fullpipe/mobile/sc01controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC01CONTROLLER_H
 #define NGI_FULLPIPE_SC01CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc02controller.cpp b/engines/ngi/fullpipe/mobile/sc02controller.cpp
similarity index 95%
rename from engines/ngi/fullpipe/sc02controller.cpp
rename to engines/ngi/fullpipe/mobile/sc02controller.cpp
index f6f5148043c..8daccc4a66e 100644
--- a/engines/ngi/fullpipe/sc02controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc02controller.cpp
@@ -31,16 +31,16 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc02controller.h"
+#include "ngi/fullpipe/mobile/sc02controller.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc02controller.h b/engines/ngi/fullpipe/mobile/sc02controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc02controller.h
rename to engines/ngi/fullpipe/mobile/sc02controller.h
index ebcee93262a..3f232d74992 100644
--- a/engines/ngi/fullpipe/sc02controller.h
+++ b/engines/ngi/fullpipe/mobile/sc02controller.h
@@ -26,7 +26,7 @@
 #include "common/str.h"
 
 #include "ngi/fullpipe/floaters.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc03controller.cpp b/engines/ngi/fullpipe/mobile/sc03controller.cpp
similarity index 97%
rename from engines/ngi/fullpipe/sc03controller.cpp
rename to engines/ngi/fullpipe/mobile/sc03controller.cpp
index eb4b07773c1..b8e94de463f 100644
--- a/engines/ngi/fullpipe/sc03controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc03controller.cpp
@@ -32,17 +32,17 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc03controller.h"
+#include "ngi/fullpipe/mobile/sc03controller.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc03controller.h b/engines/ngi/fullpipe/mobile/sc03controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc03controller.h
rename to engines/ngi/fullpipe/mobile/sc03controller.h
index 9763d7810d1..271317a308d 100644
--- a/engines/ngi/fullpipe/sc03controller.h
+++ b/engines/ngi/fullpipe/mobile/sc03controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC03CONTROLLER_H
 #define NGI_FULLPIPE_SC03CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc04controller.cpp b/engines/ngi/fullpipe/mobile/sc04controller.cpp
similarity index 99%
rename from engines/ngi/fullpipe/sc04controller.cpp
rename to engines/ngi/fullpipe/mobile/sc04controller.cpp
index b05b0c61caa..4347f504587 100644
--- a/engines/ngi/fullpipe/sc04controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc04controller.cpp
@@ -35,19 +35,19 @@
 #include "ngi/sound.h"
 #include "ngi/statics.h"
 #include "ngi/anihandler.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/hintmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/map.h"
-#include "ngi/fullpipe/sc04controller.h"
+#include "ngi/fullpipe/mobile/map.h"
+#include "ngi/fullpipe/mobile/sc04controller.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc04controller.h b/engines/ngi/fullpipe/mobile/sc04controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc04controller.h
rename to engines/ngi/fullpipe/mobile/sc04controller.h
index 5a269fdf593..908f62a3763 100644
--- a/engines/ngi/fullpipe/sc04controller.h
+++ b/engines/ngi/fullpipe/mobile/sc04controller.h
@@ -26,7 +26,7 @@
 #include "common/str.h"
 
 #include "ngi/vector2.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc05controller.cpp b/engines/ngi/fullpipe/mobile/sc05controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc05controller.cpp
rename to engines/ngi/fullpipe/mobile/sc05controller.cpp
index c4855f1f1b3..98c30331670 100644
--- a/engines/ngi/fullpipe/sc05controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc05controller.cpp
@@ -25,10 +25,10 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc05controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc05controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc05controller.h b/engines/ngi/fullpipe/mobile/sc05controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc05controller.h
rename to engines/ngi/fullpipe/mobile/sc05controller.h
index 60b68cfba38..7e075571f0b 100644
--- a/engines/ngi/fullpipe/sc05controller.h
+++ b/engines/ngi/fullpipe/mobile/sc05controller.h
@@ -24,7 +24,7 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc06controller.cpp b/engines/ngi/fullpipe/mobile/sc06controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc06controller.cpp
rename to engines/ngi/fullpipe/mobile/sc06controller.cpp
index f3bcd860cd7..2d1393e7da5 100644
--- a/engines/ngi/fullpipe/sc06controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc06controller.cpp
@@ -33,18 +33,18 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/hintmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc06controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc06controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc06controller.h b/engines/ngi/fullpipe/mobile/sc06controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc06controller.h
rename to engines/ngi/fullpipe/mobile/sc06controller.h
index 82f7094ffed..6897c7756ee 100644
--- a/engines/ngi/fullpipe/sc06controller.h
+++ b/engines/ngi/fullpipe/mobile/sc06controller.h
@@ -26,7 +26,7 @@
 #include "common/str.h"
 
 #include "ngi/region.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc07controller.cpp b/engines/ngi/fullpipe/mobile/sc07controller.cpp
similarity index 96%
rename from engines/ngi/fullpipe/sc07controller.cpp
rename to engines/ngi/fullpipe/mobile/sc07controller.cpp
index ca5bb80b82a..106747df1db 100644
--- a/engines/ngi/fullpipe/sc07controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc07controller.cpp
@@ -23,12 +23,12 @@
 #include "ngi/behavior.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc07controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc07controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc07controller.h b/engines/ngi/fullpipe/mobile/sc07controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc07controller.h
rename to engines/ngi/fullpipe/mobile/sc07controller.h
index 1345138045a..1a64d164820 100644
--- a/engines/ngi/fullpipe/sc07controller.h
+++ b/engines/ngi/fullpipe/mobile/sc07controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC07CONTROLLER_H
 #define NGI_FULLPIPE_SC07CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc08controller.cpp b/engines/ngi/fullpipe/mobile/sc08controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc08controller.cpp
rename to engines/ngi/fullpipe/mobile/sc08controller.cpp
index 17225a3a9be..fc113834cb1 100644
--- a/engines/ngi/fullpipe/sc08controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc08controller.cpp
@@ -34,16 +34,16 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/xmlnode.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/hintmanager.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc08controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc08controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc08controller.h b/engines/ngi/fullpipe/mobile/sc08controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc08controller.h
rename to engines/ngi/fullpipe/mobile/sc08controller.h
index 96d1052a498..50063371ed6 100644
--- a/engines/ngi/fullpipe/sc08controller.h
+++ b/engines/ngi/fullpipe/mobile/sc08controller.h
@@ -26,7 +26,7 @@
 #include "common/ptr.h"
 
 #include "ngi/region.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc09controller.cpp b/engines/ngi/fullpipe/mobile/sc09controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc09controller.cpp
rename to engines/ngi/fullpipe/mobile/sc09controller.cpp
index 29c724dd9e7..7a7fbd4d785 100644
--- a/engines/ngi/fullpipe/sc09controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc09controller.cpp
@@ -33,19 +33,19 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/hintmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc09controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc09controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc09controller.h b/engines/ngi/fullpipe/mobile/sc09controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc09controller.h
rename to engines/ngi/fullpipe/mobile/sc09controller.h
index 181e7da2aa5..37861277034 100644
--- a/engines/ngi/fullpipe/sc09controller.h
+++ b/engines/ngi/fullpipe/mobile/sc09controller.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/list.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc10controller.cpp b/engines/ngi/fullpipe/mobile/sc10controller.cpp
similarity index 97%
rename from engines/ngi/fullpipe/sc10controller.cpp
rename to engines/ngi/fullpipe/mobile/sc10controller.cpp
index a946979970a..ab94718e4d8 100644
--- a/engines/ngi/fullpipe/sc10controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc10controller.cpp
@@ -28,11 +28,11 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc10controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc10controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc10controller.h b/engines/ngi/fullpipe/mobile/sc10controller.h
similarity index 96%
rename from engines/ngi/fullpipe/sc10controller.h
rename to engines/ngi/fullpipe/mobile/sc10controller.h
index 0f3f52ffd20..dce28f7aef0 100644
--- a/engines/ngi/fullpipe/sc10controller.h
+++ b/engines/ngi/fullpipe/mobile/sc10controller.h
@@ -24,8 +24,8 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/highlight.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/highlight.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc11controller.cpp b/engines/ngi/fullpipe/mobile/sc11controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc11controller.cpp
rename to engines/ngi/fullpipe/mobile/sc11controller.cpp
index 828a7a2902c..75d6220b6a0 100644
--- a/engines/ngi/fullpipe/sc11controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc11controller.cpp
@@ -37,16 +37,16 @@
 #include "ngi/scene.h"
 #include "ngi/sound.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/hintmanager.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc11controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc11controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc11controller.h b/engines/ngi/fullpipe/mobile/sc11controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc11controller.h
rename to engines/ngi/fullpipe/mobile/sc11controller.h
index 6ed0c23fa94..d1b6c3cddaa 100644
--- a/engines/ngi/fullpipe/sc11controller.h
+++ b/engines/ngi/fullpipe/mobile/sc11controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC11CONTROLLER_H
 #define NGI_FULLPIPE_SC11CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc12controller.cpp b/engines/ngi/fullpipe/mobile/sc12controller.cpp
similarity index 96%
rename from engines/ngi/fullpipe/sc12controller.cpp
rename to engines/ngi/fullpipe/mobile/sc12controller.cpp
index 3d74e581212..58d3bd0fd78 100644
--- a/engines/ngi/fullpipe/sc12controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc12controller.cpp
@@ -27,10 +27,10 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc12controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc12controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc12controller.h b/engines/ngi/fullpipe/mobile/sc12controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc12controller.h
rename to engines/ngi/fullpipe/mobile/sc12controller.h
index 1be61514ee4..cd2ef9af946 100644
--- a/engines/ngi/fullpipe/sc12controller.h
+++ b/engines/ngi/fullpipe/mobile/sc12controller.h
@@ -24,7 +24,7 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc13controller.cpp b/engines/ngi/fullpipe/mobile/sc13controller.cpp
similarity index 97%
rename from engines/ngi/fullpipe/sc13controller.cpp
rename to engines/ngi/fullpipe/mobile/sc13controller.cpp
index ea78f0af52b..ef5598d16fb 100644
--- a/engines/ngi/fullpipe/sc13controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc13controller.cpp
@@ -29,13 +29,13 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc13controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc13controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc13controller.h b/engines/ngi/fullpipe/mobile/sc13controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc13controller.h
rename to engines/ngi/fullpipe/mobile/sc13controller.h
index b3fa6eb4260..4d0c25b857a 100644
--- a/engines/ngi/fullpipe/sc13controller.h
+++ b/engines/ngi/fullpipe/mobile/sc13controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC13CONTROLLER_H
 #define NGI_FULLPIPE_SC13CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc14controller.cpp b/engines/ngi/fullpipe/mobile/sc14controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc14controller.cpp
rename to engines/ngi/fullpipe/mobile/sc14controller.cpp
index fb41264c59e..c1a0f9efc4d 100644
--- a/engines/ngi/fullpipe/sc14controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc14controller.cpp
@@ -33,16 +33,16 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/hintmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc14controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc14controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc14controller.h b/engines/ngi/fullpipe/mobile/sc14controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc14controller.h
rename to engines/ngi/fullpipe/mobile/sc14controller.h
index f6bb5ba8135..2390303227c 100644
--- a/engines/ngi/fullpipe/sc14controller.h
+++ b/engines/ngi/fullpipe/mobile/sc14controller.h
@@ -25,7 +25,7 @@
 #include "common/list.h"
 #include "common/str.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc15controller.cpp b/engines/ngi/fullpipe/mobile/sc15controller.cpp
similarity index 95%
rename from engines/ngi/fullpipe/sc15controller.cpp
rename to engines/ngi/fullpipe/mobile/sc15controller.cpp
index 750315158da..892bdc3bed3 100644
--- a/engines/ngi/fullpipe/sc15controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc15controller.cpp
@@ -25,15 +25,15 @@
 #include "ngi/input.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc15controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc15controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc15controller.h b/engines/ngi/fullpipe/mobile/sc15controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc15controller.h
rename to engines/ngi/fullpipe/mobile/sc15controller.h
index 1a901398ae8..f0bf0dfa0ce 100644
--- a/engines/ngi/fullpipe/sc15controller.h
+++ b/engines/ngi/fullpipe/mobile/sc15controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC15CONTROLLER_H
 #define NGI_FULLPIPE_SC15CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc16controller.cpp b/engines/ngi/fullpipe/mobile/sc16controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc16controller.cpp
rename to engines/ngi/fullpipe/mobile/sc16controller.cpp
index af4a321f78e..6d8ca3506a2 100644
--- a/engines/ngi/fullpipe/sc16controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc16controller.cpp
@@ -28,10 +28,10 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc16controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc16controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc16controller.h b/engines/ngi/fullpipe/mobile/sc16controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc16controller.h
rename to engines/ngi/fullpipe/mobile/sc16controller.h
index 5a3456cace9..382b40b15f9 100644
--- a/engines/ngi/fullpipe/sc16controller.h
+++ b/engines/ngi/fullpipe/mobile/sc16controller.h
@@ -25,8 +25,8 @@
 #include "common/array.h"
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/highlight.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/highlight.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc17controller.cpp b/engines/ngi/fullpipe/mobile/sc17controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc17controller.cpp
rename to engines/ngi/fullpipe/mobile/sc17controller.cpp
index 0b7226e9d6c..863fe9d1fe6 100644
--- a/engines/ngi/fullpipe/sc17controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc17controller.cpp
@@ -30,9 +30,9 @@
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc17controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc17controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc17controller.h b/engines/ngi/fullpipe/mobile/sc17controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc17controller.h
rename to engines/ngi/fullpipe/mobile/sc17controller.h
index 5b3ad6d35cc..50417763952 100644
--- a/engines/ngi/fullpipe/sc17controller.h
+++ b/engines/ngi/fullpipe/mobile/sc17controller.h
@@ -24,7 +24,7 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc18controller.cpp b/engines/ngi/fullpipe/mobile/sc18controller.cpp
similarity index 99%
rename from engines/ngi/fullpipe/sc18controller.cpp
rename to engines/ngi/fullpipe/mobile/sc18controller.cpp
index 812b222dbd5..c07b0dc4415 100644
--- a/engines/ngi/fullpipe/sc18controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc18controller.cpp
@@ -34,11 +34,11 @@
 #include "ngi/sceneobjects.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc18controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc18controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc18controller.h b/engines/ngi/fullpipe/mobile/sc18controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc18controller.h
rename to engines/ngi/fullpipe/mobile/sc18controller.h
index e72b80cbe27..77d24e7b18f 100644
--- a/engines/ngi/fullpipe/sc18controller.h
+++ b/engines/ngi/fullpipe/mobile/sc18controller.h
@@ -24,7 +24,7 @@
 
 #include "common/array.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc19controller.cpp b/engines/ngi/fullpipe/mobile/sc19controller.cpp
similarity index 97%
rename from engines/ngi/fullpipe/sc19controller.cpp
rename to engines/ngi/fullpipe/mobile/sc19controller.cpp
index 6b12f8087c0..bd498731aa0 100644
--- a/engines/ngi/fullpipe/sc19controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc19controller.cpp
@@ -25,8 +25,8 @@
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc19controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc19controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc19controller.h b/engines/ngi/fullpipe/mobile/sc19controller.h
similarity index 96%
rename from engines/ngi/fullpipe/sc19controller.h
rename to engines/ngi/fullpipe/mobile/sc19controller.h
index 9661b295b19..26424e307cd 100644
--- a/engines/ngi/fullpipe/sc19controller.h
+++ b/engines/ngi/fullpipe/mobile/sc19controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC19CONTROLLER_H
 #define NGI_FULLPIPE_SC19CONTROLLER_H
 
-#include "ngi/fullpipe/sc18controller.h"
+#include "ngi/fullpipe/mobile/sc18controller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc20controller.cpp b/engines/ngi/fullpipe/mobile/sc20controller.cpp
similarity index 97%
rename from engines/ngi/fullpipe/sc20controller.cpp
rename to engines/ngi/fullpipe/mobile/sc20controller.cpp
index a5de6dab5c2..06f40c22d2f 100644
--- a/engines/ngi/fullpipe/sc20controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc20controller.cpp
@@ -27,9 +27,9 @@
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/sc20controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/sc20controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc20controller.h b/engines/ngi/fullpipe/mobile/sc20controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc20controller.h
rename to engines/ngi/fullpipe/mobile/sc20controller.h
index 75d747879b9..6ae1c8b47de 100644
--- a/engines/ngi/fullpipe/sc20controller.h
+++ b/engines/ngi/fullpipe/mobile/sc20controller.h
@@ -24,7 +24,7 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc21controller.cpp b/engines/ngi/fullpipe/mobile/sc21controller.cpp
similarity index 94%
rename from engines/ngi/fullpipe/sc21controller.cpp
rename to engines/ngi/fullpipe/mobile/sc21controller.cpp
index c3660e342a1..407e0ea70b6 100644
--- a/engines/ngi/fullpipe/sc21controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc21controller.cpp
@@ -26,14 +26,14 @@
 #include "ngi/inventory.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc21controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc21controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc21controller.h b/engines/ngi/fullpipe/mobile/sc21controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc21controller.h
rename to engines/ngi/fullpipe/mobile/sc21controller.h
index 44676c706c3..780f7960cd4 100644
--- a/engines/ngi/fullpipe/sc21controller.h
+++ b/engines/ngi/fullpipe/mobile/sc21controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC21CONTROLLER_H
 #define NGI_FULLPIPE_SC21CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc22controller.cpp b/engines/ngi/fullpipe/mobile/sc22controller.cpp
similarity index 99%
rename from engines/ngi/fullpipe/sc22controller.cpp
rename to engines/ngi/fullpipe/mobile/sc22controller.cpp
index 87257e9f4ff..7262a25f729 100644
--- a/engines/ngi/fullpipe/sc22controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc22controller.cpp
@@ -33,10 +33,10 @@
 #include "ngi/sceneobjects.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc22controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc22controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc22controller.h b/engines/ngi/fullpipe/mobile/sc22controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc22controller.h
rename to engines/ngi/fullpipe/mobile/sc22controller.h
index 030c5f3df70..d2b599e885e 100644
--- a/engines/ngi/fullpipe/sc22controller.h
+++ b/engines/ngi/fullpipe/mobile/sc22controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC22CONTROLLER_H
 #define NGI_FULLPIPE_SC22CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc23controller.cpp b/engines/ngi/fullpipe/mobile/sc23controller.cpp
similarity index 99%
rename from engines/ngi/fullpipe/sc23controller.cpp
rename to engines/ngi/fullpipe/mobile/sc23controller.cpp
index 075dae84180..dce46b16cdb 100644
--- a/engines/ngi/fullpipe/sc23controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc23controller.cpp
@@ -32,13 +32,13 @@
 #include "ngi/objects.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc23controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc23controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc23controller.h b/engines/ngi/fullpipe/mobile/sc23controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc23controller.h
rename to engines/ngi/fullpipe/mobile/sc23controller.h
index 9440222bc45..1fd2d2a9b0f 100644
--- a/engines/ngi/fullpipe/sc23controller.h
+++ b/engines/ngi/fullpipe/mobile/sc23controller.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc24controller.cpp b/engines/ngi/fullpipe/mobile/sc24controller.cpp
similarity index 94%
rename from engines/ngi/fullpipe/sc24controller.cpp
rename to engines/ngi/fullpipe/mobile/sc24controller.cpp
index ff620ce50ba..7dd14f7f8fb 100644
--- a/engines/ngi/fullpipe/sc24controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc24controller.cpp
@@ -23,14 +23,14 @@
 #include "ngi/behavior.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc24controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc24controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc24controller.h b/engines/ngi/fullpipe/mobile/sc24controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc24controller.h
rename to engines/ngi/fullpipe/mobile/sc24controller.h
index e5ef5c516be..08e73301f6c 100644
--- a/engines/ngi/fullpipe/sc24controller.h
+++ b/engines/ngi/fullpipe/mobile/sc24controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC24CONTROLLER_H
 #define NGI_FULLPIPE_SC24CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc25controller.cpp b/engines/ngi/fullpipe/mobile/sc25controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc25controller.cpp
rename to engines/ngi/fullpipe/mobile/sc25controller.cpp
index 287fa7eae08..8390b652f4f 100644
--- a/engines/ngi/fullpipe/sc25controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc25controller.cpp
@@ -32,13 +32,13 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc25controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc25controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc25controller.h b/engines/ngi/fullpipe/mobile/sc25controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc25controller.h
rename to engines/ngi/fullpipe/mobile/sc25controller.h
index c8e6dd13818..7ac3c832358 100644
--- a/engines/ngi/fullpipe/sc25controller.h
+++ b/engines/ngi/fullpipe/mobile/sc25controller.h
@@ -24,7 +24,7 @@
 
 #include "common/array.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc26controller.cpp b/engines/ngi/fullpipe/mobile/sc26controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc26controller.cpp
rename to engines/ngi/fullpipe/mobile/sc26controller.cpp
index 78e57ba6dd0..26c248686c0 100644
--- a/engines/ngi/fullpipe/sc26controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc26controller.cpp
@@ -27,12 +27,12 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc26controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc26controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc26controller.h b/engines/ngi/fullpipe/mobile/sc26controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc26controller.h
rename to engines/ngi/fullpipe/mobile/sc26controller.h
index f3c1bdf6ff5..ad5fbb7455a 100644
--- a/engines/ngi/fullpipe/sc26controller.h
+++ b/engines/ngi/fullpipe/mobile/sc26controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC26CONTROLLER_H
 #define NGI_FULLPIPE_SC26CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc27controller.cpp b/engines/ngi/fullpipe/mobile/sc27controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc27controller.cpp
rename to engines/ngi/fullpipe/mobile/sc27controller.cpp
index 90588813905..e7f07f5561a 100644
--- a/engines/ngi/fullpipe/sc27controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc27controller.cpp
@@ -34,15 +34,15 @@
 #include "ngi/objects.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/hintmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc27controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc27controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc27controller.h b/engines/ngi/fullpipe/mobile/sc27controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc27controller.h
rename to engines/ngi/fullpipe/mobile/sc27controller.h
index 8be278f24c3..111f496fa2b 100644
--- a/engines/ngi/fullpipe/sc27controller.h
+++ b/engines/ngi/fullpipe/mobile/sc27controller.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/list.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc28controller.cpp b/engines/ngi/fullpipe/mobile/sc28controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc28controller.cpp
rename to engines/ngi/fullpipe/mobile/sc28controller.cpp
index 9b6701cf8ba..e4c15d1ec5e 100644
--- a/engines/ngi/fullpipe/sc28controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc28controller.cpp
@@ -32,14 +32,14 @@
 #include "ngi/scene.h"
 #include "ngi/sceneobjects.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc28controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc28controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc28controller.h b/engines/ngi/fullpipe/mobile/sc28controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc28controller.h
rename to engines/ngi/fullpipe/mobile/sc28controller.h
index 7f60895f84a..5ec590b4b5a 100644
--- a/engines/ngi/fullpipe/sc28controller.h
+++ b/engines/ngi/fullpipe/mobile/sc28controller.h
@@ -24,9 +24,9 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
-#include "ngi/fullpipe/highlight.h"
+#include "ngi/fullpipe/mobile/highlight.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc29controller.cpp b/engines/ngi/fullpipe/mobile/sc29controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc29controller.cpp
rename to engines/ngi/fullpipe/mobile/sc29controller.cpp
index bfc2c374e3b..75a01a1034b 100644
--- a/engines/ngi/fullpipe/sc29controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc29controller.cpp
@@ -35,16 +35,16 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/xmlnode.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/hintmanager.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc29controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc29controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc29controller.h b/engines/ngi/fullpipe/mobile/sc29controller.h
similarity index 99%
rename from engines/ngi/fullpipe/sc29controller.h
rename to engines/ngi/fullpipe/mobile/sc29controller.h
index 407652b7b80..ff28c3a6d84 100644
--- a/engines/ngi/fullpipe/sc29controller.h
+++ b/engines/ngi/fullpipe/mobile/sc29controller.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/list.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc30controller.cpp b/engines/ngi/fullpipe/mobile/sc30controller.cpp
similarity index 96%
rename from engines/ngi/fullpipe/sc30controller.cpp
rename to engines/ngi/fullpipe/mobile/sc30controller.cpp
index 348bc36164d..2826482e57b 100644
--- a/engines/ngi/fullpipe/sc30controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc30controller.cpp
@@ -27,12 +27,12 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc30controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc30controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc30controller.h b/engines/ngi/fullpipe/mobile/sc30controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc30controller.h
rename to engines/ngi/fullpipe/mobile/sc30controller.h
index 70ff1dd500e..2385e63d970 100644
--- a/engines/ngi/fullpipe/sc30controller.h
+++ b/engines/ngi/fullpipe/mobile/sc30controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC30CONTROLLER_H
 #define NGI_FULLPIPE_SC30CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc31controller.cpp b/engines/ngi/fullpipe/mobile/sc31controller.cpp
similarity index 94%
rename from engines/ngi/fullpipe/sc31controller.cpp
rename to engines/ngi/fullpipe/mobile/sc31controller.cpp
index 8b76dfb7357..b1a173a9620 100644
--- a/engines/ngi/fullpipe/sc31controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc31controller.cpp
@@ -24,14 +24,14 @@
 #include "ngi/messages.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc31controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc31controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc31controller.h b/engines/ngi/fullpipe/mobile/sc31controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc31controller.h
rename to engines/ngi/fullpipe/mobile/sc31controller.h
index 207ddcefcae..00e76fde52f 100644
--- a/engines/ngi/fullpipe/sc31controller.h
+++ b/engines/ngi/fullpipe/mobile/sc31controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC31CONTROLLER_H
 #define NGI_FULLPIPE_SC31CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc32controller.cpp b/engines/ngi/fullpipe/mobile/sc32controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc32controller.cpp
rename to engines/ngi/fullpipe/mobile/sc32controller.cpp
index 2c59d141f0f..adf45650d2b 100644
--- a/engines/ngi/fullpipe/sc32controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc32controller.cpp
@@ -30,13 +30,13 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc32controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc32controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc32controller.h b/engines/ngi/fullpipe/mobile/sc32controller.h
similarity index 96%
rename from engines/ngi/fullpipe/sc32controller.h
rename to engines/ngi/fullpipe/mobile/sc32controller.h
index 5748ea18a41..f3e62bab2b1 100644
--- a/engines/ngi/fullpipe/sc32controller.h
+++ b/engines/ngi/fullpipe/mobile/sc32controller.h
@@ -24,8 +24,8 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/highlight.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/highlight.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc33controller.cpp b/engines/ngi/fullpipe/mobile/sc33controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc33controller.cpp
rename to engines/ngi/fullpipe/mobile/sc33controller.cpp
index dfd7ebce598..edd1b074e29 100644
--- a/engines/ngi/fullpipe/sc33controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc33controller.cpp
@@ -33,12 +33,12 @@
 #include "ngi/sceneobjects.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc33controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc33controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc33controller.h b/engines/ngi/fullpipe/mobile/sc33controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc33controller.h
rename to engines/ngi/fullpipe/mobile/sc33controller.h
index 13ec63053f5..e7b1c412014 100644
--- a/engines/ngi/fullpipe/sc33controller.h
+++ b/engines/ngi/fullpipe/mobile/sc33controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC33CONTROLLER_H
 #define NGI_FULLPIPE_SC33CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc34controller.cpp b/engines/ngi/fullpipe/mobile/sc34controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc34controller.cpp
rename to engines/ngi/fullpipe/mobile/sc34controller.cpp
index 63578847b28..4e9f932af4d 100644
--- a/engines/ngi/fullpipe/sc34controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc34controller.cpp
@@ -32,15 +32,15 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc34controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc34controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc34controller.h b/engines/ngi/fullpipe/mobile/sc34controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc34controller.h
rename to engines/ngi/fullpipe/mobile/sc34controller.h
index d4160a172cd..cb292ca2cc5 100644
--- a/engines/ngi/fullpipe/sc34controller.h
+++ b/engines/ngi/fullpipe/mobile/sc34controller.h
@@ -24,7 +24,7 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc35controller.cpp b/engines/ngi/fullpipe/mobile/sc35controller.cpp
similarity index 97%
rename from engines/ngi/fullpipe/sc35controller.cpp
rename to engines/ngi/fullpipe/mobile/sc35controller.cpp
index ffdecf6b475..316d7816d70 100644
--- a/engines/ngi/fullpipe/sc35controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc35controller.cpp
@@ -28,14 +28,14 @@
 #include "ngi/motion.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
-#include "ngi/fullpipe/help.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc35controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc35controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc35controller.h b/engines/ngi/fullpipe/mobile/sc35controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc35controller.h
rename to engines/ngi/fullpipe/mobile/sc35controller.h
index c509f5b0efa..97d25a350e3 100644
--- a/engines/ngi/fullpipe/sc35controller.h
+++ b/engines/ngi/fullpipe/mobile/sc35controller.h
@@ -24,7 +24,7 @@
 
 #include "common/ptr.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/floaters.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/sc36controller.cpp b/engines/ngi/fullpipe/mobile/sc36controller.cpp
similarity index 96%
rename from engines/ngi/fullpipe/sc36controller.cpp
rename to engines/ngi/fullpipe/mobile/sc36controller.cpp
index 9cb5a242380..a9e0cc59f70 100644
--- a/engines/ngi/fullpipe/sc36controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc36controller.cpp
@@ -24,8 +24,8 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/sc36controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc36controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc36controller.h b/engines/ngi/fullpipe/mobile/sc36controller.h
similarity index 97%
rename from engines/ngi/fullpipe/sc36controller.h
rename to engines/ngi/fullpipe/mobile/sc36controller.h
index d420b44ddfb..996ee756fe8 100644
--- a/engines/ngi/fullpipe/sc36controller.h
+++ b/engines/ngi/fullpipe/mobile/sc36controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC36CONTROLLER_H
 #define NGI_FULLPIPE_SC36CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc37controller.cpp b/engines/ngi/fullpipe/mobile/sc37controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc37controller.cpp
rename to engines/ngi/fullpipe/mobile/sc37controller.cpp
index 56341abf2fc..d0480f566a2 100644
--- a/engines/ngi/fullpipe/sc37controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc37controller.cpp
@@ -28,10 +28,10 @@
 #include "ngi/gameloader.h"
 #include "ngi/interaction.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc37controller.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc37controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc37controller.h b/engines/ngi/fullpipe/mobile/sc37controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc37controller.h
rename to engines/ngi/fullpipe/mobile/sc37controller.h
index 73f864f635b..9711836defa 100644
--- a/engines/ngi/fullpipe/sc37controller.h
+++ b/engines/ngi/fullpipe/mobile/sc37controller.h
@@ -24,7 +24,7 @@
 
 #include "common/array.h"
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc38controller.cpp b/engines/ngi/fullpipe/mobile/sc38controller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/sc38controller.cpp
rename to engines/ngi/fullpipe/mobile/sc38controller.cpp
index e25d0c83707..fc02dbb3637 100644
--- a/engines/ngi/fullpipe/sc38controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc38controller.cpp
@@ -26,12 +26,12 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/sc38controller.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc38controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/sc38controller.h b/engines/ngi/fullpipe/mobile/sc38controller.h
similarity index 98%
rename from engines/ngi/fullpipe/sc38controller.h
rename to engines/ngi/fullpipe/mobile/sc38controller.h
index 5f3addeb0aa..f6c91c3458f 100644
--- a/engines/ngi/fullpipe/sc38controller.h
+++ b/engines/ngi/fullpipe/mobile/sc38controller.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SC38CONTROLLER_H
 #define NGI_FULLPIPE_SC38CONTROLLER_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/scenecontrollers.cpp b/engines/ngi/fullpipe/mobile/scenecontrollers.cpp
similarity index 62%
rename from engines/ngi/fullpipe/scenecontrollers.cpp
rename to engines/ngi/fullpipe/mobile/scenecontrollers.cpp
index 0e503b8bc0a..b4584f62b40 100644
--- a/engines/ngi/fullpipe/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/mobile/scenecontrollers.cpp
@@ -21,54 +21,54 @@
 
 #include "ngi/ngi.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/sc01controller.h"
-#include "ngi/fullpipe/sc02controller.h"
-#include "ngi/fullpipe/sc06controller.h"
-#include "ngi/fullpipe/sc08controller.h"
-#include "ngi/fullpipe/sc09controller.h"
-#include "ngi/fullpipe/sc11controller.h"
-#include "ngi/fullpipe/sc14controller.h"
-#include "ngi/fullpipe/sc27controller.h"
-#include "ngi/fullpipe/sc29controller.h"
-#include "ngi/fullpipe/sc17controller.h"
-#include "ngi/fullpipe/sc38controller.h"
-#include "ngi/fullpipe/sc05controller.h"
-#include "ngi/fullpipe/sc07controller.h"
-#include "ngi/fullpipe/sc10controller.h"
-#include "ngi/fullpipe/sc12controller.h"
-#include "ngi/fullpipe/sc13controller.h"
-#include "ngi/fullpipe/sc15controller.h"
-#include "ngi/fullpipe/sc16controller.h"
-#include "ngi/fullpipe/sc21controller.h"
-#include "ngi/fullpipe/sc36controller.h"
-#include "ngi/fullpipe/sc20controller.h"
-#include "ngi/fullpipe/sc24controller.h"
-#include "ngi/fullpipe/sc31controller.h"
-#include "ngi/fullpipe/sc30controller.h"
-#include "ngi/fullpipe/sc35controller.h"
-#include "ngi/fullpipe/sc37controller.h"
-#include "ngi/fullpipe/sc32controller.h"
-#include "ngi/fullpipe/sc26controller.h"
-#include "ngi/fullpipe/sc28controller.h"
-#include "ngi/fullpipe/sc33controller.h"
-#include "ngi/fullpipe/sc22controller.h"
-#include "ngi/fullpipe/sc34controller.h"
-#include "ngi/fullpipe/sc18controller.h"
-#include "ngi/fullpipe/sc19controller.h"
-#include "ngi/fullpipe/sc25controller.h"
-#include "ngi/fullpipe/sc23controller.h"
-#include "ngi/fullpipe/scenecontrollers.h"
-#include "ngi/fullpipe/sc03controller.h"
-#include "ngi/fullpipe/sc04controller.h"
-#include "ngi/fullpipe/chaptercontroller.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/notebook.h"
-#include "ngi/fullpipe/inventorycontroller.h"
-#include "ngi/fullpipe/liftcontroller.h"
-#include "ngi/fullpipe/mainmenucontroller.h"
-#include "ngi/fullpipe/mapwindowcontroller.h"
-#include "ngi/fullpipe/tutorialcontroller.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/sc01controller.h"
+#include "ngi/fullpipe/mobile/sc02controller.h"
+#include "ngi/fullpipe/mobile/sc06controller.h"
+#include "ngi/fullpipe/mobile/sc08controller.h"
+#include "ngi/fullpipe/mobile/sc09controller.h"
+#include "ngi/fullpipe/mobile/sc11controller.h"
+#include "ngi/fullpipe/mobile/sc14controller.h"
+#include "ngi/fullpipe/mobile/sc27controller.h"
+#include "ngi/fullpipe/mobile/sc29controller.h"
+#include "ngi/fullpipe/mobile/sc17controller.h"
+#include "ngi/fullpipe/mobile/sc38controller.h"
+#include "ngi/fullpipe/mobile/sc05controller.h"
+#include "ngi/fullpipe/mobile/sc07controller.h"
+#include "ngi/fullpipe/mobile/sc10controller.h"
+#include "ngi/fullpipe/mobile/sc12controller.h"
+#include "ngi/fullpipe/mobile/sc13controller.h"
+#include "ngi/fullpipe/mobile/sc15controller.h"
+#include "ngi/fullpipe/mobile/sc16controller.h"
+#include "ngi/fullpipe/mobile/sc21controller.h"
+#include "ngi/fullpipe/mobile/sc36controller.h"
+#include "ngi/fullpipe/mobile/sc20controller.h"
+#include "ngi/fullpipe/mobile/sc24controller.h"
+#include "ngi/fullpipe/mobile/sc31controller.h"
+#include "ngi/fullpipe/mobile/sc30controller.h"
+#include "ngi/fullpipe/mobile/sc35controller.h"
+#include "ngi/fullpipe/mobile/sc37controller.h"
+#include "ngi/fullpipe/mobile/sc32controller.h"
+#include "ngi/fullpipe/mobile/sc26controller.h"
+#include "ngi/fullpipe/mobile/sc28controller.h"
+#include "ngi/fullpipe/mobile/sc33controller.h"
+#include "ngi/fullpipe/mobile/sc22controller.h"
+#include "ngi/fullpipe/mobile/sc34controller.h"
+#include "ngi/fullpipe/mobile/sc18controller.h"
+#include "ngi/fullpipe/mobile/sc19controller.h"
+#include "ngi/fullpipe/mobile/sc25controller.h"
+#include "ngi/fullpipe/mobile/sc23controller.h"
+#include "ngi/fullpipe/mobile/scenecontrollers.h"
+#include "ngi/fullpipe/mobile/sc03controller.h"
+#include "ngi/fullpipe/mobile/sc04controller.h"
+#include "ngi/fullpipe/mobile/chaptercontroller.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/notebook.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/liftcontroller.h"
+#include "ngi/fullpipe/mobile/mainmenucontroller.h"
+#include "ngi/fullpipe/mobile/mapwindowcontroller.h"
+#include "ngi/fullpipe/mobile/tutorialcontroller.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 #include "ngi/inventory.h"
 
 namespace NGI {
diff --git a/engines/ngi/fullpipe/scenecontrollers.h b/engines/ngi/fullpipe/mobile/scenecontrollers.h
similarity index 96%
rename from engines/ngi/fullpipe/scenecontrollers.h
rename to engines/ngi/fullpipe/mobile/scenecontrollers.h
index da65cb22c34..0f20b17ce5d 100644
--- a/engines/ngi/fullpipe/scenecontrollers.h
+++ b/engines/ngi/fullpipe/mobile/scenecontrollers.h
@@ -22,7 +22,7 @@
 #ifndef NGI_FULLPIPE_SCENECONTROLLERS_H
 #define NGI_FULLPIPE_SCENECONTROLLERS_H
 
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/statemanager.cpp b/engines/ngi/fullpipe/mobile/statemanager.cpp
similarity index 99%
rename from engines/ngi/fullpipe/statemanager.cpp
rename to engines/ngi/fullpipe/mobile/statemanager.cpp
index 54e9c3989dc..3aebb978eb4 100644
--- a/engines/ngi/fullpipe/statemanager.cpp
+++ b/engines/ngi/fullpipe/mobile/statemanager.cpp
@@ -26,10 +26,10 @@
 #include "ngi/interaction.h"
 #include "ngi/objects.h"
 #include "ngi/utils.h"
-#include "ngi/fullpipe/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/lift.h"
 #include "ngi/fullpipe/objectnames.h"
-#include "ngi/fullpipe/statemanager.h"
+#include "ngi/fullpipe/mobile/statemanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/statemanager.h b/engines/ngi/fullpipe/mobile/statemanager.h
similarity index 100%
rename from engines/ngi/fullpipe/statemanager.h
rename to engines/ngi/fullpipe/mobile/statemanager.h
diff --git a/engines/ngi/fullpipe/taskmanager.cpp b/engines/ngi/fullpipe/mobile/taskmanager.cpp
similarity index 99%
rename from engines/ngi/fullpipe/taskmanager.cpp
rename to engines/ngi/fullpipe/mobile/taskmanager.cpp
index 6ed9539f563..28879ba1120 100644
--- a/engines/ngi/fullpipe/taskmanager.cpp
+++ b/engines/ngi/fullpipe/mobile/taskmanager.cpp
@@ -30,11 +30,11 @@
 #include "ngi/gameloader.h"
 #include "ngi/objects.h"
 #include "ngi/anihandler.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/notebook.h"
+#include "ngi/fullpipe/mobile/notebook.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/taskmanager.h b/engines/ngi/fullpipe/mobile/taskmanager.h
similarity index 100%
rename from engines/ngi/fullpipe/taskmanager.h
rename to engines/ngi/fullpipe/mobile/taskmanager.h
diff --git a/engines/ngi/fullpipe/tremble.cpp b/engines/ngi/fullpipe/mobile/tremble.cpp
similarity index 99%
rename from engines/ngi/fullpipe/tremble.cpp
rename to engines/ngi/fullpipe/mobile/tremble.cpp
index 8f8364fc74f..65fccce2c57 100644
--- a/engines/ngi/fullpipe/tremble.cpp
+++ b/engines/ngi/fullpipe/mobile/tremble.cpp
@@ -32,7 +32,7 @@
 #include "ngi/statics.h"
 #include "ngi/gameloader.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/tremble.h"
+#include "ngi/fullpipe/mobile/tremble.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/tremble.h b/engines/ngi/fullpipe/mobile/tremble.h
similarity index 100%
rename from engines/ngi/fullpipe/tremble.h
rename to engines/ngi/fullpipe/mobile/tremble.h
diff --git a/engines/ngi/fullpipe/tutorialcontroller.cpp b/engines/ngi/fullpipe/mobile/tutorialcontroller.cpp
similarity index 98%
rename from engines/ngi/fullpipe/tutorialcontroller.cpp
rename to engines/ngi/fullpipe/mobile/tutorialcontroller.cpp
index c950a5db578..76667759b6f 100644
--- a/engines/ngi/fullpipe/tutorialcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/tutorialcontroller.cpp
@@ -35,16 +35,16 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/behavior.h"
-#include "ngi/fullpipe/achievements.h"
+#include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/inventorycontroller.h"
-#include "ngi/fullpipe/mapwindowcontroller.h"
-#include "ngi/fullpipe/notebook.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/tutorialcontroller.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/mapwindowcontroller.h"
+#include "ngi/fullpipe/mobile/notebook.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/tutorialcontroller.h"
 #include "ngi/motion.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/tutorialcontroller.h b/engines/ngi/fullpipe/mobile/tutorialcontroller.h
similarity index 100%
rename from engines/ngi/fullpipe/tutorialcontroller.h
rename to engines/ngi/fullpipe/mobile/tutorialcontroller.h
diff --git a/engines/ngi/fullpipe/tutorialmanager.cpp b/engines/ngi/fullpipe/mobile/tutorialmanager.cpp
similarity index 99%
rename from engines/ngi/fullpipe/tutorialmanager.cpp
rename to engines/ngi/fullpipe/mobile/tutorialmanager.cpp
index 65c8a84d4f0..c17cccbd2c6 100644
--- a/engines/ngi/fullpipe/tutorialmanager.cpp
+++ b/engines/ngi/fullpipe/mobile/tutorialmanager.cpp
@@ -24,7 +24,7 @@
 #include "ngi/objects.h"
 #include "ngi/scene.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/tutorialmanager.h b/engines/ngi/fullpipe/mobile/tutorialmanager.h
similarity index 100%
rename from engines/ngi/fullpipe/tutorialmanager.h
rename to engines/ngi/fullpipe/mobile/tutorialmanager.h
diff --git a/engines/ngi/fullpipe/waitscreen.cpp b/engines/ngi/fullpipe/mobile/waitscreen.cpp
similarity index 98%
rename from engines/ngi/fullpipe/waitscreen.cpp
rename to engines/ngi/fullpipe/mobile/waitscreen.cpp
index 2ff790daae6..2f78e834987 100644
--- a/engines/ngi/fullpipe/waitscreen.cpp
+++ b/engines/ngi/fullpipe/mobile/waitscreen.cpp
@@ -25,7 +25,7 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/waitscreen.h"
+#include "ngi/fullpipe/mobile/waitscreen.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/fullpipe/waitscreen.h b/engines/ngi/fullpipe/mobile/waitscreen.h
similarity index 100%
rename from engines/ngi/fullpipe/waitscreen.h
rename to engines/ngi/fullpipe/mobile/waitscreen.h
diff --git a/engines/ngi/fullpipe/scene01.cpp b/engines/ngi/fullpipe/scene01.cpp
index 91a78f26bd1..2e84b698f87 100644
--- a/engines/ngi/fullpipe/scene01.cpp
+++ b/engines/ngi/fullpipe/scene01.cpp
@@ -20,14 +20,14 @@
  */
 
 #include "ngi/ngi.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/scenecontrollers.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/scenecontrollers.h"
 #include "ngi/guimanager.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/inventorycontroller.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/inventorycontroller.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 #include "ngi/input.h"
 #include "ngi/inventory.h"
 
diff --git a/engines/ngi/fullpipe/scene03.cpp b/engines/ngi/fullpipe/scene03.cpp
index ff671ad6321..a03c0a0c639 100644
--- a/engines/ngi/fullpipe/scene03.cpp
+++ b/engines/ngi/fullpipe/scene03.cpp
@@ -31,11 +31,11 @@
 
 #include "ngi/interaction.h"
 #include "ngi/behavior.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/font.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/sc03controller.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc03controller.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 #include "ngi/inventory.h"
 #include "ngi/input.h"
 
diff --git a/engines/ngi/fullpipe/scene04.cpp b/engines/ngi/fullpipe/scene04.cpp
index 0346b7dd9b2..706ab731398 100644
--- a/engines/ngi/fullpipe/scene04.cpp
+++ b/engines/ngi/fullpipe/scene04.cpp
@@ -21,7 +21,7 @@
 
 #include "ngi/ngi.h"
 
-#include "ngi/fullpipe/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
 #include "ngi/fullpipe/objectnames.h"
 #include "ngi/fullpipe/constants.h"
 #include "ngi/utils.h"
@@ -34,8 +34,8 @@
 #include "ngi/interaction.h"
 #include "ngi/gameloader.h"
 #include "ngi/behavior.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/sc04controller.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/sc04controller.h"
 #include "ngi/sound.h"
 
 #include "common/formats/xmlparser.h"
diff --git a/engines/ngi/fullpipe/sceneIntro.cpp b/engines/ngi/fullpipe/sceneIntro.cpp
index a4f995a9f1a..b11d34f6b2d 100644
--- a/engines/ngi/fullpipe/sceneIntro.cpp
+++ b/engines/ngi/fullpipe/sceneIntro.cpp
@@ -23,7 +23,7 @@
 
 #include "ngi/fullpipe/constants.h"
 #include "ngi/behavior.h"
-#include "ngi/fullpipe/chaptermanager.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/gameloader.h"
 #include "ngi/motion.h"
 #include "ngi/fullpipe/scenes.h"
diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index 7ca419e8e54..a32c8832b0f 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -29,19 +29,19 @@
 #include "ngi/motion.h"
 #include "ngi/input.h"
 #include "ngi/behavior.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
 #include "ngi/fullpipe/floaters.h"
-#include "ngi/fullpipe/taskmanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
 #include "ngi/debugger/testmode.h"
 
 #include "ngi/fullpipe/constants.h"
 #include "ngi/fullpipe/objectnames.h"
 #include "ngi/fullpipe/scenes.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/font.h"
-#include "ngi/fullpipe/tremble.h"
-#include "ngi/fullpipe/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/tremble.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
 #include "ngi/interaction.h"
 
 namespace NGI {
diff --git a/engines/ngi/init.cpp b/engines/ngi/init.cpp
index 672584678f2..4a8db9f9dc6 100644
--- a/engines/ngi/init.cpp
+++ b/engines/ngi/init.cpp
@@ -27,7 +27,7 @@
 #include "ngi/input.h"
 
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/statemanager.h"
+#include "ngi/fullpipe/mobile/statemanager.h"
 
 namespace NGI {
 
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index f3c10f9109b..23515f7a817 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -82,65 +82,72 @@ MODULE_OBJS = \
 	box2d/Dynamics/b2WorldCallbacks.o \
 	box2d/Rope/b2Rope.o \
 	debugger/testmode.o \
-	fullpipe/achievements.o \
-	fullpipe/arcadeinterface.o \
-	fullpipe/chaptercontroller.o \
-	fullpipe/chaptermanager.o \
-	fullpipe/controllerhelpers.o \
-	fullpipe/exitmanager.o \
 	fullpipe/floaters.o \
-	fullpipe/fpcontroller.o \
-	fullpipe/fpguicontroller.o \
-	fullpipe/help.o \
-	fullpipe/hintmanager.o \
-	fullpipe/highlight.o \
-	fullpipe/inventorycontroller.o \
 	fullpipe/lift.o \
-	fullpipe/liftcontroller.o \
-	fullpipe/mainmenucontroller.o \
-	fullpipe/map.o \
-	fullpipe/mapwindowcontroller.o \
-	fullpipe/noactionlogger.o \
-	fullpipe/notebook.o \
-	fullpipe/objhelper.o \
-	fullpipe/sc01controller.o \
-	fullpipe/sc02controller.o \
-	fullpipe/sc03controller.o \
-	fullpipe/sc04controller.o \
-	fullpipe/sc05controller.o \
-	fullpipe/sc06controller.o \
-	fullpipe/sc07controller.o \
-	fullpipe/sc08controller.o \
-	fullpipe/sc09controller.o \
-	fullpipe/sc10controller.o \
-	fullpipe/sc11controller.o \
-	fullpipe/sc12controller.o \
-	fullpipe/sc13controller.o \
-	fullpipe/sc14controller.o \
-	fullpipe/sc15controller.o \
-	fullpipe/sc16controller.o \
-	fullpipe/sc17controller.o \
-	fullpipe/sc18controller.o \
-	fullpipe/sc19controller.o \
-	fullpipe/sc20controller.o \
-	fullpipe/sc21controller.o \
-	fullpipe/sc22controller.o \
-	fullpipe/sc23controller.o \
-	fullpipe/sc24controller.o \
-	fullpipe/sc25controller.o \
-	fullpipe/sc26controller.o \
-	fullpipe/sc27controller.o \
-	fullpipe/sc28controller.o \
-	fullpipe/sc29controller.o \
-	fullpipe/sc30controller.o \
-	fullpipe/sc31controller.o \
-	fullpipe/sc32controller.o \
-	fullpipe/sc33controller.o \
-	fullpipe/sc34controller.o \
-	fullpipe/sc35controller.o \
-	fullpipe/sc36controller.o \
-	fullpipe/sc37controller.o \
-	fullpipe/sc38controller.o \
+	fullpipe/mobile/achievements.o \
+	fullpipe/mobile/arcadeinterface.o \
+	fullpipe/mobile/chaptercontroller.o \
+	fullpipe/mobile/chaptermanager.o \
+	fullpipe/mobile/controllerhelpers.o \
+	fullpipe/mobile/exitmanager.o \
+	fullpipe/mobile/fpcontroller.o \
+	fullpipe/mobile/fpguicontroller.o \
+	fullpipe/mobile/help.o \
+	fullpipe/mobile/highlight.o \
+	fullpipe/mobile/hintmanager.o \
+	fullpipe/mobile/inventorycontroller.o \
+	fullpipe/mobile/liftcontroller.o \
+	fullpipe/mobile/mainmenucontroller.o \
+	fullpipe/mobile/map.o \
+	fullpipe/mobile/mapwindowcontroller.o \
+	fullpipe/mobile/noactionlogger.o \
+	fullpipe/mobile/notebook.o \
+	fullpipe/mobile/objhelper.o \
+	fullpipe/mobile/sc01controller.o \
+	fullpipe/mobile/sc02controller.o \
+	fullpipe/mobile/sc03controller.o \
+	fullpipe/mobile/sc04controller.o \
+	fullpipe/mobile/sc05controller.o \
+	fullpipe/mobile/sc06controller.o \
+	fullpipe/mobile/sc07controller.o \
+	fullpipe/mobile/sc08controller.o \
+	fullpipe/mobile/sc09controller.o \
+	fullpipe/mobile/sc10controller.o \
+	fullpipe/mobile/sc11controller.o \
+	fullpipe/mobile/sc12controller.o \
+	fullpipe/mobile/sc13controller.o \
+	fullpipe/mobile/sc14controller.o \
+	fullpipe/mobile/sc15controller.o \
+	fullpipe/mobile/sc16controller.o \
+	fullpipe/mobile/sc17controller.o \
+	fullpipe/mobile/sc18controller.o \
+	fullpipe/mobile/sc19controller.o \
+	fullpipe/mobile/sc20controller.o \
+	fullpipe/mobile/sc21controller.o \
+	fullpipe/mobile/sc22controller.o \
+	fullpipe/mobile/sc23controller.o \
+	fullpipe/mobile/sc24controller.o \
+	fullpipe/mobile/sc25controller.o \
+	fullpipe/mobile/sc26controller.o \
+	fullpipe/mobile/sc27controller.o \
+	fullpipe/mobile/sc28controller.o \
+	fullpipe/mobile/sc29controller.o \
+	fullpipe/mobile/sc30controller.o \
+	fullpipe/mobile/sc31controller.o \
+	fullpipe/mobile/sc32controller.o \
+	fullpipe/mobile/sc33controller.o \
+	fullpipe/mobile/sc34controller.o \
+	fullpipe/mobile/sc35controller.o \
+	fullpipe/mobile/sc36controller.o \
+	fullpipe/mobile/sc37controller.o \
+	fullpipe/mobile/sc38controller.o \
+	fullpipe/mobile/scenecontrollers.o \
+	fullpipe/mobile/statemanager.o \
+	fullpipe/mobile/taskmanager.o \
+	fullpipe/mobile/tremble.o \
+	fullpipe/mobile/tutorialcontroller.o \
+	fullpipe/mobile/tutorialmanager.o \
+	fullpipe/mobile/waitscreen.o \
 	fullpipe/scene01.o \
 	fullpipe/scene02.o \
 	fullpipe/scene03.o \
@@ -182,14 +189,7 @@ MODULE_OBJS = \
 	fullpipe/sceneFinal.o \
 	fullpipe/sceneIntro.o \
 	fullpipe/sceneIntroDemo.o \
-	fullpipe/scenecontrollers.o \
-	fullpipe/scenes.o \
-	fullpipe/statemanager.o \
-	fullpipe/taskmanager.o \
-	fullpipe/tremble.o \
-	fullpipe/tutorialcontroller.o \
-	fullpipe/tutorialmanager.o \
-	fullpipe/waitscreen.o
+	fullpipe/scenes.o
 
 ifdef USE_IMGUI
 MODULE_OBJS += \
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 224ea9dd3dc..5a43abae562 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -37,24 +37,24 @@
 #include "ngi/determinism.h"
 #include "ngi/scenecontroller.h"
 #include "ngi/fullpipe/lift.h"
-#include "ngi/fullpipe/arcadeinterface.h"
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/map.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/statemanager.h"
-#include "ngi/fullpipe/notebook.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/exitmanager.h"
+#include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/map.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/statemanager.h"
+#include "ngi/fullpipe/mobile/notebook.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/preloadmanager.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/objhelper.h"
-#include "ngi/fullpipe/tutorialmanager.h"
-#include "ngi/fullpipe/hintmanager.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/noactionlogger.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/objhelper.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/noactionlogger.h"
 #include "ngi/debugger/testmode.h"
 #include "ngi/debugger/debugtools.h"
-#include "ngi/fullpipe/tremble.h"
+#include "ngi/fullpipe/mobile/tremble.h"
 #include "ngi/detection.h"
 #include "ngi/gameloader.h"
 #include "ngi/messages.h"
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 11a7a82741c..e525499485a 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -22,10 +22,10 @@
 #include "math/utils.h"
 
 #include "ngi/ngi.h"
-#include "ngi/fullpipe/waitscreen.h"
+#include "ngi/fullpipe/mobile/waitscreen.h"
 #include "ngi/preloadmanager.h"
 #include "ngi/scenecontroller.h"
-#include "ngi/fullpipe/fpcontroller.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
 
 #include "ngi/objects.h"
 #include "ngi/behavior.h"
diff --git a/engines/ngi/stateloader.cpp b/engines/ngi/stateloader.cpp
index 9d8ccfaa1ef..1628b8b7f03 100644
--- a/engines/ngi/stateloader.cpp
+++ b/engines/ngi/stateloader.cpp
@@ -22,7 +22,7 @@
 #include "ngi/ngi.h"
 
 #include "ngi/fullpipe/constants.h"
-#include "ngi/fullpipe/statemanager.h"
+#include "ngi/fullpipe/mobile/statemanager.h"
 #include "ngi/detection.h"
 #include "ngi/gameloader.h"
 #include "ngi/interaction.h"
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index bc452f82177..6d73f44796e 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -28,15 +28,15 @@
 #include "common/tokenizer.h"
 
 #include "ngi/ngi.h"
-#include "ngi/fullpipe/fpcontroller.h"
-#include "ngi/fullpipe/map.h"
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+#include "ngi/fullpipe/mobile/map.h"
 #include "ngi/fullpipe/objectnames.h"
 #include "ngi/gameloader.h"
 #include "ngi/inventory.h"
 #include "ngi/behavior.h"
 #include "ngi/physics.h"
 #include "ngi/sceneobjects.h"
-#include "ngi/fullpipe/tremble.h"
+#include "ngi/fullpipe/mobile/tremble.h"
 #include "ngi/zcontroller.h"
 #include "ngi/fullpipe/constants.h"
 #include "ngi/detection.h"
@@ -48,19 +48,19 @@
 #include "ngi/xmlnode.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
-#include "ngi/fullpipe/chaptermanager.h"
-#include "ngi/fullpipe/exitmanager.h"
-#include "ngi/fullpipe/notebook.h"
-#include "ngi/fullpipe/statemanager.h"
-#include "ngi/fullpipe/taskmanager.h"
-#include "ngi/fullpipe/achievements.h"
-#include "ngi/fullpipe/objhelper.h"
-#include "ngi/fullpipe/tutorialmanager.h"
-#include "ngi/fullpipe/waitscreen.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/notebook.h"
+#include "ngi/fullpipe/mobile/statemanager.h"
+#include "ngi/fullpipe/mobile/taskmanager.h"
+#include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/objhelper.h"
+#include "ngi/fullpipe/mobile/tutorialmanager.h"
+#include "ngi/fullpipe/mobile/waitscreen.h"
 #include "ngi/preloadmanager.h"
-#include "ngi/fullpipe/hintmanager.h"
-#include "ngi/fullpipe/help.h"
-#include "ngi/fullpipe/noactionlogger.h"
+#include "ngi/fullpipe/mobile/hintmanager.h"
+#include "ngi/fullpipe/mobile/help.h"
+#include "ngi/fullpipe/mobile/noactionlogger.h"
 
 namespace NGI {
 


Commit: 01c2d66bf5b1d6d5f6db8023dcaceb08eb864d8e
    https://github.com/scummvm/scummvm/commit/01c2d66bf5b1d6d5f6db8023dcaceb08eb864d8e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Port the silent flag of CAniObject::StartMovement for FastStartMovement

Changed paths:
    engines/ngi/statics.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index e900f4ede51..ec0e86e8189 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -1410,21 +1410,15 @@ void AniObject::setCurFrame(int frame, bool keepPhaseTimer, bool silent) {
 		warning("STUB/untested: CAniObject::SetCurFrame: the commands and sounds of the phases that are stepped over are not run, the flag +63 is not kept");
 	}
 	_movement->setCurFrame(frame);
-	// CMovement::SetFrame: the texture is loaded unless the preload manager keeps the movement (D27)
-	if (g_ngi->_gameVersion >= 201509 && g_ngi->_preloadManager && !g_ngi->_preloadManager->isPreloaded(_movement->_id))
+	// CMovement::SetFrame: loads the texture unless preloaded (D27) or silent
+	if (!silent && g_ngi->_gameVersion >= 201509 && g_ngi->_preloadManager && !g_ngi->_preloadManager->isPreloaded(_movement->_id))
 		_movement->_curPhase->loadIfNeeded();
 	setPos(_movement->_x, _movement->_y);
 }
 
-// CAniObject::FastStartMovement (F0CC4): StartMovement, last frame (first if reversed),
-// StopMovement(0); the silent flag (CMovement::SetNext a12) is not modelled
+// CAniObject::FastStartMovement (F0CC4): silent start, last frame (first if reversed), stop
 bool AniObject::fastStartMovement(int movementId, bool reverse) {
-	static bool reported = false;
-	if (!reported) {
-		reported = true;
-		warning("STUB/untested: CAniObject::FastStartMovement: the silent flag of CMovement::Start is not modelled");
-	}
-	if (!startMovement(movementId, 0, -1, (_flags & 8) != 0, false, reverse, -1))
+	if (!startMovement(movementId, 0, -1, (_flags & 8) != 0, false, reverse, -1, true))
 		return false;
 	int frame = 0;
 	if (!reverse) {
@@ -1847,7 +1841,7 @@ void AniObject::startMovementWithoutPhases(Movement *movement, bool mirror, bool
 	setPosition(Common::Point(topLeft.x + (int)(dx * c - dy * sn), topLeft.y + (int)(dx * sn + dy * c)));
 }
 
-bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseIdx, bool mirror, bool cycled, bool reverse, int startFrame) {
+bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseIdx, bool mirror, bool cycled, bool reverse, int startFrame, bool silent) {
 	if (_flags & 0x80)
 		return false;
 
@@ -2000,7 +1994,8 @@ bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseId
 
 	newex->postMessage();
 
-	if (timedMovement)
+	// CMovement::SetFrame (EF8B8): a silent start skips the load, sound and command of the phase
+	if (timedMovement && !silent)
 		mov->_curPhase->enter(_id);
 
 	return true;
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index 39989d2800f..48f02178d95 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -285,7 +285,8 @@ public:
 	void setReverse(bool reverse);
 
 	/** CAniObject::StartMovement (F0D46); cycled, reverse, startFrame are START_MOVEMENT attributes */
-	bool startMovement(int movementId, int messageQueueId, int dynPhaseIdx, bool mirror = false, bool cycled = false, bool reverse = false, int startFrame = -1);
+	bool startMovement(int movementId, int messageQueueId, int dynPhaseIdx, bool mirror = false, bool cycled = false, bool reverse = false, int startFrame = -1,
+		bool silent = false);
 	void startMovementWithoutPhases(Movement *movement, bool mirror, bool reverse, int startFrame);
 	bool startAnimEx(int movid, int parId, int flag1, int flag2);
 	void startSliding(int movementId, int messageQueueId, int x, int y, const PointList &points, int someDynamicPhaseIndex, bool mirror);


Commit: d63169e909fdaffa652b29cb7dcba95e96c34695
    https://github.com/scummvm/scummvm/commit/d63169e909fdaffa652b29cb7dcba95e96c34695
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: The cursor follows the mouse in the Android game

Changed paths:
    engines/ngi/ngi.cpp


diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 5a43abae562..be3412b09cb 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -321,12 +321,12 @@ Common::Error NGIEngine::initGame() {
 }
 
 bool NGIEngine::handleGuiEvent(const Common::Event &event) {
-	// CCursorController::OnMouseMove: the cursor is the last touch (no hover on the device),
-	// updated while the button is down; the scene controllers read it
+	// D47, accepted deviation: the cursor follows the mouse as on Windows, not only a touch
+	// (CCursorController::OnMouseMove). noRandom keeps the device rule for the tests
 	if (event.type == Common::EVENT_LBUTTONDOWN)
 		_touchDown = true;
 	if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_LBUTTONUP || event.type == Common::EVENT_RBUTTONDOWN ||
-			event.type == Common::EVENT_RBUTTONUP || (event.type == Common::EVENT_MOUSEMOVE && _touchDown)) {
+			event.type == Common::EVENT_RBUTTONUP || (event.type == Common::EVENT_MOUSEMOVE && (_touchDown || !determinismActive()))) {
 		_mouseScreenPos = event.mouse;
 		// CRender::EventProc: a pointer move goes to CCursorController::OnMouseMove
 		if (_inputController)


Commit: 9a1d629b68a589f00cf3b3a1a168294a5e72be76
    https://github.com/scummvm/scummvm/commit/9a1d629b68a589f00cf3b3a1a168294a5e72be76
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Hit test of the Android objects by the texture rectangle (CVisibleObject::Hit)

Changed paths:
    engines/ngi/gfx.cpp
    engines/ngi/gfx.h
    engines/ngi/statics.cpp


diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index bfacff31327..ee294733512 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -235,6 +235,8 @@ bool PictureObject::isPointInside(int x, int y) {
 bool PictureObject::hit(int x, int y) {
 	if (!_hitRegion.isEmpty())
 		return _hitRegion.contains(x - _x, y - _y);
+	if (g_ngi->_gameVersion >= 201509)
+		return hitTextureRect(x, y);
 	int oldx = _picture->_x;
 	int oldy = _picture->_y;
 
@@ -341,6 +343,30 @@ Common::Rect GameObject::getBounds() const {
 	return Common::Rect(topLeft.x, topLeft.y, topLeft.x + static_cast<int>(size.x * _scaleX), topLeft.y + static_cast<int>(size.y * _scaleY));
 }
 
+// CVisibleObject::Hit (1277B6) without a hit region: the rectangle of the texture, no alpha test
+bool GameObject::hitTextureRect(float x, float y) const {
+	Common::Point topLeft;
+	Common::Point anchor;
+	Dims size;
+	if (!textureQuad(this, topLeft, size, anchor))
+		return false;
+	float dx = x - topLeft.x;
+	float dy = y - topLeft.y;
+	if (_rotation != 0.0f) {
+		// CRender::CalcRotatePoints (11CFD0): the point is turned back about the middle of the window
+		const float pivotX = size.x * _scaleX * (_windowRight - _windowLeft) * (_windowLeft + _windowRight) * 0.5f;
+		const float pivotY = size.y * _scaleY * (_windowBottom - _windowTop) * (_windowTop + _windowBottom) * 0.5f;
+		const float c = cosf(-_rotation);
+		const float sn = sinf(-_rotation);
+		const float rx = (dx - pivotX) * c - (dy - pivotY) * sn + pivotX;
+		dy = (dx - pivotX) * sn + (dy - pivotY) * c + pivotY;
+		dx = rx;
+	}
+	const float u = dx / _scaleX;
+	const float v = dy / _scaleY;
+	return u >= 0.0f && v >= 0.0f && u < size.x && v < size.y;
+}
+
 Common::Point GameObject::getPosition() const {
 	Common::Point topLeft;
 	Common::Point anchor;
diff --git a/engines/ngi/gfx.h b/engines/ngi/gfx.h
index 86ff094c999..6793b73f786 100644
--- a/engines/ngi/gfx.h
+++ b/engines/ngi/gfx.h
@@ -230,6 +230,8 @@ class GameObject : public CObject {
 	bool isOnScreen(const Scene *scene) const;
 	/** the quad of the texture as drawn (CVisibleObject::GetRect without the rotation) */
 	Common::Rect getBounds() const;
+	/** CVisibleObject::Hit (1277B6) of an object without a hit region */
+	bool hitTextureRect(float x, float y) const;
 
 	bool getPicAniInfo(PicAniInfo &info);
 	bool setPicAniInfo(const PicAniInfo &info);
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index ec0e86e8189..82641c25c5a 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -487,6 +487,8 @@ bool AniObject::hit(int x, int y) {
 	if (g_ngi->usesXMLProject()) {
 		if (_hitregion)
 			return _hitregion->hit((float)x, (float)y);
+		if (g_ngi->_gameVersion >= 201509)
+			return hitTextureRect(x, y);
 		Phase *phase = _movement ? _movement->_curPhase : _statics;
 		if (!phase)
 			return false;


Commit: c0b8ce04fae2ef28a2847d23a75b5a7aea711f4e
    https://github.com/scummvm/scummvm/commit/c0b8ce04fae2ef28a2847d23a75b5a7aea711f4e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: Draw the cursor of the Android game under the noRandom test flag

Changed paths:
    engines/ngi/detection.cpp
    engines/ngi/ngi.cpp


diff --git a/engines/ngi/detection.cpp b/engines/ngi/detection.cpp
index 1828b932ae2..cfc5932ae5e 100644
--- a/engines/ngi/detection.cpp
+++ b/engines/ngi/detection.cpp
@@ -43,7 +43,7 @@ static const DebugChannelDef debugFlagList[] = {
 	{NGI::kDebugInfo, "info", "Log the state of Dude (movement, phase, position) whenever it changes"},
 	{NGI::kDebugFast, "fast", "Six times faster game, for test runs"},
 	{NGI::kDebugSkipIntro, "skipIntro", "Starts without the initial tutorial (the Skip button of it is pressed at the start)"},
-	{NGI::kDebugNoRandom, "noRandom", "Repeatable runs for tests: fixed random seed, fixed update steps, no cursor, --start-movie=freeze=N stops the updates"},
+	{NGI::kDebugNoRandom, "noRandom", "Repeatable runs for tests: fixed random seed, fixed update steps, no cursor in the Windows games, --start-movie=freeze=N stops the updates"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index be3412b09cb..97cb2c63978 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -895,7 +895,7 @@ Common::Error NGIEngine::updateScreen(uint32 elapsed, byte &brightness, bool red
 		if (redraw) {
 			drawWidescreenBars();
 			// CCursorController::Render comes after CGame::Render
-			if (usesXMLProject() && _inputController && !determinismActive())
+			if (usesXMLProject() && _inputController)
 				_inputController->render();
 			_system->copyRectToScreen(_backgroundSurface.getPixels(), _backgroundSurface.pitch, 0, 0, _backgroundSurface.w, _backgroundSurface.h);
 		}


Commit: 0572ff2936b502c64587b7d3d9d13679ec1a6dc2
    https://github.com/scummvm/scummvm/commit/0572ff2936b502c64587b7d3d9d13679ec1a6dc2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:49+01:00

Commit Message:
NGI: The watch test aid logs the top left and the frame

Changed paths:
    engines/ngi/debugger/testmode.cpp


diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 5ff3d6d7f34..a5532f4dafd 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -98,6 +98,11 @@ Common::StringArray &watched() {
 	static Common::StringArray list;
 	return list;
 }
+bool &watchPositions() {
+	static bool positions = false;
+	return positions;
+}
+
 Common::Array<uint> &watchedHash() {
 	static Common::Array<uint> list;
 	return list;
@@ -131,6 +136,8 @@ void runSetup() {
 			const Common::String state = toGameEncoding(value.substr(colon + 1));
 			warning("TESTMODE: state %s = %s", value.substr(0, colon).c_str(), value.substr(colon + 1).c_str());
 			g_ngi->setState(object, g_ngi->getStateValue(object, state.c_str()));
+		} else if (key == "watchpos") {
+			watchPositions() = value != "0";
 		} else if (key == "watch") {
 			// watch=ANI_NAME: a log line whenever its statics or movement changes
 			watched().push_back(value);
@@ -342,9 +349,12 @@ void testmode_update(uint32 elapsed) {
 			continue;
 		const Common::String line = ani->_movement ? Common::String::format("movement %s", name(ani->_movement->_id).c_str()) :
 			ani->_statics ? Common::String::format("statics %s", name(ani->_statics->_staticsId).c_str()) : Common::String("none");
-		const Common::String state = Common::String::format("%s flags %02x z %d at %d,%d", line.c_str(), ani->_flags, ani->_z, ani->_x, ani->_y);
-		// the position changes with every frame of a movement: not part of the hash
-		const uint hash = Common::hashit(Common::String::format("%s %02x", line.c_str(), ani->_flags).c_str());
+		const Common::Point topLeft = ani->getPosition();
+		const int frame = ani->_movement ? ani->_movement->_curFrame : -1;
+		const Common::String state = Common::String::format("%s flags %02x z %d at %d,%d topleft %d,%d frame %d", line.c_str(), ani->_flags, ani->_z, ani->_x, ani->_y,
+			topLeft.x, topLeft.y, frame);
+		// watchpos=1: also a line for every frame and position change
+		const uint hash = watchPositions() ? Common::hashit(state.c_str()) : Common::hashit(Common::String::format("%s %02x", line.c_str(), ani->_flags).c_str());
 		if (hash != watchedHash()[i]) {
 			watchedHash()[i] = hash;
 			debugC(1, kDebugInfo, "INFO t %u WATCH %s %s", g_system->getMillis(), watched()[i].c_str(), state.c_str());


Commit: 5d4066dc260f39dcf5c1f1bf73f36d556fa55334
    https://github.com/scummvm/scummvm/commit/5d4066dc260f39dcf5c1f1bf73f36d556fa55334
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: SetPos of an OLDANI is COldAniObject::SetPos, the pivot of a standing object

Changed paths:
    engines/ngi/gfx.cpp
    engines/ngi/gfx.h
    engines/ngi/statics.cpp
    engines/ngi/statics.h
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index ee294733512..bb160d892ca 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -376,7 +376,7 @@ Common::Point GameObject::getPosition() const {
 	return topLeft;
 }
 
-void GameObject::setPosition(Common::Point topLeft) {
+void GameObject::setTopLeft(Common::Point topLeft) {
 	Common::Point current;
 	Common::Point anchor;
 	Dims size;
@@ -386,6 +386,11 @@ void GameObject::setPosition(Common::Point topLeft) {
 		setPos(topLeft.x + anchor.x, topLeft.y + anchor.y);
 }
 
+// CVisibleObject::SetPos(vector3) (EEACC)
+void GameObject::setPosition(Common::Point pos) {
+	setTopLeft(pos);
+}
+
 Common::Point GameObject::getCenter() const {
 	Common::Point topLeft;
 	Common::Point anchor;
diff --git a/engines/ngi/gfx.h b/engines/ngi/gfx.h
index 6793b73f786..6877420cc5f 100644
--- a/engines/ngi/gfx.h
+++ b/engines/ngi/gfx.h
@@ -217,9 +217,11 @@ class GameObject : public CObject {
 	Common::String getName() { return _title; }
 	/** The Android drawing parameters of this object. */
 	RenderParams getRenderParams(bool mirror = false) const;
-	/** CVisibleObject::GetPosition / SetPos: the texture's top left (_x, _y are a pivot) */
+	/** the texture's top left, +40/+44 of CVisibleObject (_x, _y are a pivot) */
 	Common::Point getPosition() const;
-	void setPosition(Common::Point topLeft);
+	void setTopLeft(Common::Point topLeft);
+	/** CVisibleObject::SetPos (11F648): the virtual SetPos (slot 20), the z stays */
+	virtual void setPosition(Common::Point pos);
 	/** CVisibleObject::GetSize: the size of the drawn part of the texture, scale not applied */
 	Common::Point getSize() const;
 	/** CVisibleObject::GetCenter / SetCenter: the center of the texture window */
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 82641c25c5a..032574e80c5 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -136,6 +136,7 @@ AniObject::AniObject(AniObject *src) : GameObject(src) {
 	_counter = 0;
 	_targetFrame = -1;
 	_sceneId = src->_sceneId;
+	_oldAni = src->_oldAni;
 	_callback1 = src->_callback1;
 	_callback2 = src->_callback2;
 	_objtype = kObjTypeStaticANIObject;
@@ -228,11 +229,19 @@ void AniObject::setOldAniPos(int x, int y, int z) {
 	if (topLeft.x == x && topLeft.y == y)
 		return;
 	if (_movement)
-		setPosition(Common::Point(x, y));
+		setTopLeft(Common::Point(x, y));
 	else
 		setPos(x, y);
 }
 
+// slot 20 of an OLDANI is COldAniObject::SetPos, of an ANI CVisibleObject::SetPos
+void AniObject::setPosition(Common::Point pos) {
+	if (_oldAni)
+		setOldAniPos(pos.x, pos.y, _z);
+	else
+		setTopLeft(pos);
+}
+
 void AniObject::clearFlags() {
 	_flags = 0;
 
@@ -1221,7 +1230,7 @@ void AniObject::stopMovementAndroid(bool keepSounds) {
 	_movement = nullptr;
 	_targetFrame = -1;
 	_flags = (_flags & ~8) | (endMirror ? 8 : 0);
-	setPosition(topLeft);
+	setTopLeft(topLeft);
 
 	debugC(1, kDebugAnimation, "movement stop: t %u ani %d copy %d movement %d pos %d,%d topleft %d,%d flags %x statics %d", g_system->getMillis(), _id, _copyId, oid, _x, _y, topLeft.x, topLeft.y,
 		_flags, _statics->_staticsId);
@@ -1840,7 +1849,7 @@ void AniObject::startMovementWithoutPhases(Movement *movement, bool mirror, bool
 	if (_flags & 8)
 		endMirror = !endMirror;
 	_flags = (_flags & ~8) | (endMirror ? 8 : 0);
-	setPosition(Common::Point(topLeft.x + (int)(dx * c - dy * sn), topLeft.y + (int)(dx * sn + dy * c)));
+	setTopLeft(Common::Point(topLeft.x + (int)(dx * c - dy * sn), topLeft.y + (int)(dx * sn + dy * c)));
 }
 
 bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseIdx, bool mirror, bool cycled, bool reverse, int startFrame, bool silent) {
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index 48f02178d95..b75144255b5 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -223,6 +223,7 @@ class AniObject : public GameObject {
 
 public:
 	int16 _sceneId;
+	bool _oldAni = false; // COldAniObject (XML OLDANI)
 
 public:
 	AniObject();
@@ -233,6 +234,7 @@ public:
 
 	void setPos(int x, int y) override;
 	void setOldAniPos(int x, int y, int z);
+	void setPosition(Common::Point pos) override;
 	Statics *getStatic(int id);
 	Statics *getStaticsByName(const Common::String &name);
 	Movement *getMovement(int id);
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index 6d73f44796e..417b392168f 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1557,6 +1557,7 @@ private:
 		if (boolProperty(*node, "mirror"))
 			animation->_flags |= 8;
 		animation->_sceneId = _scene._sceneId;
+		animation->_oldAni = node->name == "OLDANI";
 		return true;
 	}
 


Commit: 5f997693aad14fb58297055361245347de9ca6d5
    https://github.com/scummvm/scummvm/commit/5f997693aad14fb58297055361245347de9ca6d5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: SetStatic moves the top left as CAniObject::SetStatic, also mirrored

Changed paths:
    engines/ngi/statics.cpp


diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 032574e80c5..a2bcfdc55cd 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -1335,44 +1335,40 @@ void AniObject::setStatic(int objId, bool mirror, bool useMirror) {
 	}
 
 	if (g_ngi->_gameVersion >= 201509) {
-		// CAniObject::SetStatic (F22BC): rewinds a running movement, then moves the anchor by the offset
-		// difference of the two statics, about the center; the mirror argument is bit 8 of the flags
+		// CAniObject::SetStatic (F22BC): the top left moves by the offset difference of the two
+		// statics, turned and mirrored about the center of the old texture
 		stopMovementToPrev(false);
 		Statics *statics = getStatic(objId);
 		if (statics) {
-			if (statics != _statics || (useMirror && mirror != ((_flags & 8) != 0))) {
-				const float oldX = _x;
-				const float oldY = _y;
+			if (_movement) // not rewound (no running flag): drop it
+				_movement = nullptr;
+			const bool newMirror = useMirror ? mirror : (_flags & 8) != 0;
+			if (statics != _statics || newMirror != ((_flags & 8) != 0)) {
+				const Common::Point topLeft = getPosition();
 				const Dims oldSize = _statics ? _statics->getDimensions() : Dims();
-				const float centerX = oldX + oldSize.x * 0.5f * _scaleX;
-				const float centerY = oldY + oldSize.y * 0.5f * _scaleY;
-				const float oldOffsetX = _statics ? _statics->_x * _scaleX : 0.0f;
-				const float oldOffsetY = _statics ? _statics->_y * _scaleY : 0.0f;
+				const float centerX = topLeft.x + oldSize.x * 0.5f * _scaleX;
+				const float centerY = topLeft.y + oldSize.y * 0.5f * _scaleX;
+				// the offset of a statics (XML x, y) is -someXY
+				const float oldOffsetX = _statics ? -_statics->_someX * _scaleX : 0.0f;
+				const float oldOffsetY = _statics ? -_statics->_someY * _scaleY : 0.0f;
 
 				_statics = statics;
+				_flags = (_flags & ~8) | (newMirror ? 8 : 0);
 
-				const float newX = oldX + statics->_x * _scaleX - oldOffsetX;
-				const float newY = oldY + statics->_y * _scaleY - oldOffsetY;
+				const float newX = topLeft.x - statics->_someX * _scaleX - oldOffsetX;
+				const float newY = topLeft.y - statics->_someY * _scaleY - oldOffsetY;
 				const Dims newSize = statics->getDimensions();
 				const float halfWidth = newSize.x * 0.5f * _scaleX;
-				const float halfHeight = newSize.y * 0.5f * _scaleY;
+				const float halfHeight = newSize.y * 0.5f * _scaleX;
 				float dx = newX + halfWidth - centerX;
 				const float dy = newY + halfHeight - centerY;
-				if (useMirror && mirror)
+				if (newMirror)
 					dx = -dx;
 				const float c = cosf(_rotation);
 				const float sn = sinf(_rotation);
-				_x = (centerX + (dx * c - dy * sn)) - halfWidth;
-				_y = (centerY + (dx * sn + dy * c)) - halfHeight;
-			}
-			if (useMirror) {
-				if (mirror)
-					_flags |= 8;
-				else
-					_flags &= ~8;
+				setTopLeft(Common::Point(static_cast<int>(roundf((centerX + (dx * c - dy * sn)) - halfWidth)),
+					static_cast<int>(roundf((centerY + (dx * sn + dy * c)) - halfHeight))));
 			}
-			if (_movement) // not rewound (no running flag): drop it
-				_movement = nullptr;
 		}
 	} else if (_movement || _statics) {
 		g_ngi->_aniHandler->attachObject(_id);


Commit: 72d1fddc2a5903777aa98dde692982b85235d7f0
    https://github.com/scummvm/scummvm/commit/72d1fddc2a5903777aa98dde692982b85235d7f0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: SetCurFrame steps frame by frame (CMovement::SetCurFrame) and keeps the timer flag

Changed paths:
    engines/ngi/fullpipe/mobile/sc08controller.cpp
    engines/ngi/fullpipe/mobile/sc09controller.cpp
    engines/ngi/fullpipe/mobile/sc14controller.cpp
    engines/ngi/statics.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/fullpipe/mobile/sc08controller.cpp b/engines/ngi/fullpipe/mobile/sc08controller.cpp
index fc113834cb1..82af7a2b3c5 100644
--- a/engines/ngi/fullpipe/mobile/sc08controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc08controller.cpp
@@ -752,7 +752,7 @@ void Sc08Controller::onMessage(const Common::String &message, const Common::Stri
 		if (queueStarted) {
 			AniObject *grit = _scene->findAniObjectById(ANI_GRIT2, 0);
 			if (grit->_movement)
-				grit->setCurFrame(9);
+				grit->setCurFrame(9, true);
 			else
 				grit->startMovement(MV_GRIT2_FALL, 0, -1);
 		}
diff --git a/engines/ngi/fullpipe/mobile/sc09controller.cpp b/engines/ngi/fullpipe/mobile/sc09controller.cpp
index 7a7fbd4d785..0188bb5eec0 100644
--- a/engines/ngi/fullpipe/mobile/sc09controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc09controller.cpp
@@ -947,7 +947,7 @@ void Sc09Controller::onMessage(const Common::String &message, const Common::Stri
 			AniObject *grit = _scene->findAniObjectById(ANI_GRIT_9, 0);
 			if (grit) {
 				if (grit->_movement)
-					grit->setCurFrame(9);
+					grit->setCurFrame(9, true);
 				else
 					grit->startMovement(MV_GRT9_FALL, 0, -1);
 			}
diff --git a/engines/ngi/fullpipe/mobile/sc14controller.cpp b/engines/ngi/fullpipe/mobile/sc14controller.cpp
index c1a0f9efc4d..6a18cb66ded 100644
--- a/engines/ngi/fullpipe/mobile/sc14controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc14controller.cpp
@@ -892,7 +892,7 @@ void Sc14Controller::onMessage(const Common::String &message, const Common::Stri
 		if (isInteractionQueueRunning("INT_239")) {
 			AniObject *grit = _scene->findAniObjectById(ANI_GRIT_14, 0);
 			if (grit->_movement)
-				grit->setCurFrame(7);
+				grit->setCurFrame(7, true);
 			else
 				grit->startMovement(MV_GRT14_FALL, 0, -1);
 		}
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index a2bcfdc55cd..2f2761b0c4c 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -1181,25 +1181,12 @@ int AniObject::movementStopFrame() const {
 	return _movement->_reverse ? 0 : last;
 }
 
-// CAniObject::StopMovement (F0F28)
-void AniObject::stopMovementAndroid(bool keepSounds) {
-	debugC(2, kDebugAnimation, "AniObject::stopMovementAndroid(%d)", keepSounds);
-
-	if (!(_flags & 1) || !_movement)
-		return;
-
-	_flags &= ~1;
-
+// CMovement::SetCurFrame (EFB00): SetFrame frame by frame
+void AniObject::stepToFrame(int target, bool silent) {
 	Movement *mov = _movement;
-	mov->_counter = 0;
-
-	const bool reverse = mov->_reverse;
 	const bool mirror = (_flags & 8) != 0;
-
-	// CMovement::SetCurFrame (EFB00): SetFrame frame by frame to the stop frame
-	const int stopFrame = movementStopFrame();
-	while (mov->_curFrame != stopFrame) {
-		const int frame = mov->_curFrame < stopFrame ? mov->_curFrame + 1 : mov->_curFrame - 1;
+	while (mov->_curFrame != target) {
+		const int frame = mov->_curFrame < target ? mov->_curFrame + 1 : mov->_curFrame - 1;
 		const bool forward = frame > mov->_curFrame;
 		mov->setFrame(frame, mirror);
 		setPos(mov->_x, mov->_y);
@@ -1212,9 +1199,27 @@ void AniObject::stopMovementAndroid(bool keepSounds) {
 			const Common::Point step = _stepArray.getPoint(frame, 1);
 			setPos(_x - step.x, _y - step.y);
 		}
-		if (!keepSounds)
+		if (!silent)
 			mov->_curPhase->enter(_id);
 	}
+}
+
+// CAniObject::StopMovement (F0F28)
+void AniObject::stopMovementAndroid(bool keepSounds) {
+	debugC(2, kDebugAnimation, "AniObject::stopMovementAndroid(%d)", keepSounds);
+
+	if (!(_flags & 1) || !_movement)
+		return;
+
+	_flags &= ~1;
+
+	Movement *mov = _movement;
+	mov->_counter = 0;
+
+	const bool reverse = mov->_reverse;
+	const bool mirror = (_flags & 8) != 0;
+
+	stepToFrame(movementStopFrame(), keepSounds);
 
 	// +164 and +64: the end statics and the facing
 	Statics *end = reverse ? mov->_prevStatic : mov->_nextStatic;
@@ -1411,16 +1416,8 @@ int AniObject::getCurFrame() const {
 void AniObject::setCurFrame(int frame, bool keepPhaseTimer, bool silent) {
 	if (!_movement)
 		return;
-	static bool reported = false;
-	if (!silent && !reported) {
-		reported = true;
-		warning("STUB/untested: CAniObject::SetCurFrame: the commands and sounds of the phases that are stepped over are not run, the flag +63 is not kept");
-	}
-	_movement->setCurFrame(frame);
-	// CMovement::SetFrame: loads the texture unless preloaded (D27) or silent
-	if (!silent && g_ngi->_gameVersion >= 201509 && g_ngi->_preloadManager && !g_ngi->_preloadManager->isPreloaded(_movement->_id))
-		_movement->_curPhase->loadIfNeeded();
-	setPos(_movement->_x, _movement->_y);
+	_movement->_timerRuns = keepPhaseTimer;
+	stepToFrame(frame, silent);
 }
 
 // CAniObject::FastStartMovement (F0CC4): silent start, last frame (first if reversed), stop
@@ -1969,6 +1966,7 @@ bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseId
 	if (timedMovement) {
 		_movement->_cycled = cycled;
 		_movement->_reverse = reverse;
+		_movement->_timerRuns = true;
 		if (reverse) {
 			_movement->gotoPrevFrame(mirror);
 			setPos(_movement->_x, _movement->_y);
@@ -2861,6 +2859,7 @@ void Movement::stop(Common::Point &topLeft, float width, float height, float sca
 
 	_cycled = false;
 	_reverse = false;
+	_timerRuns = true;
 
 	const float halfWidth = width * 0.5f;
 	const float halfHeight = height * 0.5f;
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index b75144255b5..808980fd63d 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -126,6 +126,8 @@ class Movement : public GameObject {
 	/** CMovement +60, +61: starts again when over, plays backwards */
 	bool _cycled = false;
 	bool _reverse = false;
+	/** CMovement +63: false holds the frame, the phase timer stands (SetCurFrame) */
+	bool _timerRuns = true;
 	int _prevStepX;
 	int _prevStepY;
 	int _nextStepX;
@@ -334,6 +336,7 @@ public:
 	int getCurFrame() const;
 	/** CAniObject::SetCurFrame (F0C76); not modelled: keepPhaseTimer, commands of skipped phases */
 	void setCurFrame(int frame, bool keepPhaseTimer = false, bool silent = false);
+	void stepToFrame(int target, bool silent);
 	/** CAniObject::FastStartMovement (F0CC4) */
 	bool fastStartMovement(int movementId, bool reverse);
 	/** CAniObject::MoveToStatic (F1B0C), Android; moveToStatic(int) is the Windows version */


Commit: c9e80fc5030763c37de9ca9413263253e445e778
    https://github.com/scummvm/scummvm/commit/c9e80fc5030763c37de9ca9413263253e445e778
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Sc03Controller moves the egg eater with the SetPos of the original

Changed paths:
    engines/ngi/fullpipe/mobile/sc03controller.cpp


diff --git a/engines/ngi/fullpipe/mobile/sc03controller.cpp b/engines/ngi/fullpipe/mobile/sc03controller.cpp
index b8e94de463f..5901b68093c 100644
--- a/engines/ngi/fullpipe/mobile/sc03controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc03controller.cpp
@@ -290,6 +290,8 @@ void Sc03Controller::addLastEaten(const Common::String &item) {
 		g_ngi->setState(sO_EggGulperGaveCoin, g_ngi->getStateValue(sO_EggGulperGaveCoin, sO_Yes));
 		updateBehavior();
 	}
+	debugC(1, kDebugInfo, "INFO SC3 egg %s eaten: eggs %d %d %d, hint time %d", item.c_str(), _egg1->_value.intValue, _egg2->_value.intValue,
+		_egg3->_value.intValue, _hintTime);
 }
 
 // CSc03Controller::OnInvDrop (1641F8): an egg that left the inventory (the egg eater swallowed it)
@@ -320,10 +322,7 @@ void Sc03Controller::onMessage(const Common::String &message, const Common::Stri
 			onInvDrop(param);
 		FPController::onMessage(message, param, queue);
 	} else if (message == "MSG_SC3_MOVEEGGEATER") {
-		// CVisibleObject::SetPos (vtable slot 20): the position sc_3.xml gives the egg eater (609, 425),
-		// not the picture corner (setPosition put him 70 px right and 86 down)
-		_eggeater->setPos(609, 424);
-		_eggeater->_z = 60;
+		_eggeater->setOldAniPos(609, 424, 60);
 	} else if (message == "MSG_SC4_HIDEBOOT") {
 		_boot->_flags &= ~4;
 	} else if (message == "MSG_HIDE_BOX") {


Commit: fbb6dfa3116c749457908537973d2a5e0df91adf
    https://github.com/scummvm/scummvm/commit/fbb6dfa3116c749457908537973d2a5e0df91adf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Sc04Controller passes the mirror of SetStatic and stops the lamps at the last phase

Changed paths:
    engines/ngi/fullpipe/mobile/sc04controller.cpp


diff --git a/engines/ngi/fullpipe/mobile/sc04controller.cpp b/engines/ngi/fullpipe/mobile/sc04controller.cpp
index 4347f504587..29c75e5455c 100644
--- a/engines/ngi/fullpipe/mobile/sc04controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc04controller.cpp
@@ -526,7 +526,7 @@ void Sc04Controller::doStopArcade() {
 // CSc04Controller::SkipArcade (16550C): clock closes, music stops, hand takes the jar, arcade ends
 void Sc04Controller::skipArcadeController() {
 	g_ngi->arcadeInterface().scrollOut();
-	_clock->setStatic(ST_CLK_CLOSED);
+	_clock->setStatic(ST_CLK_CLOSED, false);
 	_scene->stopQueue(QU_SC4_GOCLOCK);
 	onMessage("MSG_STOP_MUS", "", nullptr);
 	g_ngi->_taskManager->deactivateTask("FIND_EXIT_BOTLE_SC4");
@@ -665,7 +665,7 @@ void Sc04Controller::doStartHand() {
 			queueId = QU_HND_TAKE2;
 		// analytics lose_count_ANI_KOZAWKA, game_ANI_KOZAWKA_lose: not ported
 	} else {
-		_clock->setStatic(ST_CLK_CLOSED);
+		_clock->setStatic(ST_CLK_CLOSED, false);
 		_scene->stopQueue(QU_SC4_GOCLOCK);
 		onMessage("MSG_STOP_MUS", "", nullptr);
 		g_ngi->_taskManager->deactivateTask("FIND_EXIT_BOTLE_SC4");
@@ -700,7 +700,7 @@ MessageQueue *Sc04Controller::doManJump() {
 	if (statics != ST_MAN_STANDLADDER && statics != ST_MAN_LADDERDOWN)
 		return nullptr;
 
-	man->setStatic(ST_MAN_LADDERDOWN);
+	man->setStatic(ST_MAN_LADDERDOWN, false);
 	g_ngi->_aniHandler->attachObject(ANI_MAN);
 	MakeQueueStruct queueInfo;
 	queueInfo.ani = man;
@@ -906,7 +906,7 @@ void Sc04Controller::doShootKozawka() {
 			result = 7;
 		debugC(1, kDebugInfo, "INFO t %u SHOOTKOZAW frame %d x %d result %d", g_system->getMillis(), kozaw->_movement->_curFrame, x, result);
 		kozaw->stopQueue();
-		kozaw->setStatic(ST_KZW_RIGHT);
+		kozaw->setStatic(ST_KZW_RIGHT, false);
 		MessageQueue *queue;
 		if (result > 2) {
 			if (result > 5) {
@@ -1094,7 +1094,7 @@ void Sc04Controller::onUtrubaClick(MessageQueue *queue) {
 
 // CSc04Controller::DoJumpFromBottle (1676F4): hero jumps out of the jar (QU_SC4_MANFROMBOTTLE)
 void Sc04Controller::doJumpFromBottle(MessageQueue *queue) {
-	hero()->setStatic(ST_MAN_SIT);
+	hero()->setStatic(ST_MAN_SIT, false);
 	if (queue)
 		warnOnce("CMessageQueue::GetCurCommand (the queue of the engine drops the commands that ran): DoJumpFromBottle does not continue the command");
 	MessageQueue *jump = copyQueue(_scene, QU_SC4_MANFROMBOTTLE);
@@ -1111,12 +1111,12 @@ void Sc04Controller::doWinArcade() {
 	if (!isState(sO_LowerPipe, sO_IsClosed) || !_arcade)
 		return;
 
-	_clock->setStatic(ST_CLK_CLOSED);
-	_hand->setStatic(ST_HND_EMPTY);
+	_clock->setStatic(ST_CLK_CLOSED, false);
+	_hand->setStatic(ST_HND_EMPTY, false);
 	_scene->runQueue(QU_HND_TAKEBOTTLE, 3);
 	if (_walkingKozaw) {
 		_waitingKozaws.push_back(_walkingKozaw);
-		_walkingKozaw->setStatic(ST_KZW_EMPTY);
+		_walkingKozaw->setStatic(ST_KZW_EMPTY, false);
 		_walkingKozaw->_flags &= ~4;
 		_walkingKozaw = nullptr;
 	}
@@ -1160,7 +1160,7 @@ void Sc04Controller::doDropBottle() {
 		kozaw->_flags &= ~4;
 		_waitingKozaws.push_back(kozaw);
 	}
-	_hand->setStatic(ST_HND_EMPTY);
+	_hand->setStatic(ST_HND_EMPTY, false);
 	_hand->setPosition(Common::Point(429, 21));
 	_hand->_z = 15;
 }
@@ -1275,7 +1275,7 @@ void Sc04Controller::onShowScene() {
 		mask->setPosition(Common::Point(mask->getPosition().x, 235));
 		_bottleObjects.push_back(mask);
 		if (kozaw) {
-			kozaw->setStatic(ST_KZW_EMPTY);
+			kozaw->setStatic(ST_KZW_EMPTY, false);
 			kozaw->setPosition(Common::Point(0, 0));
 			kozaw->_flags &= ~4;
 			_waitingKozaws.push_back(kozaw);
@@ -1284,7 +1284,7 @@ void Sc04Controller::onShowScene() {
 				AniObject *copy = new AniObject(last);
 				last = copy;
 				_scene->addAni(copy, true);
-				copy->setStatic(ST_KZW_EMPTY);
+				copy->setStatic(ST_KZW_EMPTY, false);
 				copy->setPosition(Common::Point(0, 0));
 				copy->_flags &= ~4;
 				_waitingKozaws.push_back(copy);
@@ -1371,7 +1371,7 @@ void Sc04Controller::onHide() {
 	}
 	_waitingKozaws.clear();
 	_bottleKozaws.clear();
-	_clock->setStatic(ST_CLK_CLOSED);
+	_clock->setStatic(ST_CLK_CLOSED, false);
 	_lamps->_flags &= ~4;
 	FPController::onHide();
 	g_ngi->_hintManager->hideHint(_scene);
@@ -1549,7 +1549,8 @@ void Sc04Controller::onMessage(const Common::String &message, const Common::Stri
 		if (!_lamps->_movement || _lamps->_movement->_id != MV_SC4_LAMPS_TORED)
 			return;
 		const int frame = _lamps->_movement->_curFrame;
-		if (frame >= (int)_lamps->_movement->_phases.size() - 1)
+		// the last phase: the end statics follows it in _phases
+		if (frame >= (int)_lamps->_movement->_phases.size() - 2)
 			return;
 		_lamps->setCurFrame(frame + 1);
 		return;
@@ -1668,7 +1669,7 @@ void Sc04Controller::onMessage(const Common::String &message, const Common::Stri
 		return;
 	}
 	if (message == "MSG_SC4_COINOUT") {
-		_clock->setStatic(ST_CLK_CLOSED);
+		_clock->setStatic(ST_CLK_CLOSED, false);
 		_coinPut = false;
 		doStopArcade();
 		if (!_bottleKozaws.empty() && !_bottleTaken) {


Commit: f2f699ad8e2732d226165aa562a89d4de545bfca
    https://github.com/scummvm/scummvm/commit/f2f699ad8e2732d226165aa562a89d4de545bfca
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: A held frame of a movement does not count its time

Changed paths:
    engines/ngi/statics.cpp


diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 2f2761b0c4c..0e436816456 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -915,6 +915,9 @@ bool AniObject::updateAnimation(int counterdiff) {
 
 		const bool timedMovement = g_ngi->_gameVersion >= 201509;
 		if (timedMovement) {
+			// CMovement::Update (EFC0E): a held frame does not count its time
+			if (!_movement->_timerRuns)
+				_movement->_counter = 0;
 			const Phase &phase = *_movement->_curPhase;
 			const int delay = _movement->_loopDelay * (1 + phase._delayRelative) + phase._delayMs;
 			if (_movement->_counter <= delay)


Commit: 85bcf4e76b5597f016d45662fdbf64a71ae13374
    https://github.com/scummvm/scummvm/commit/85bcf4e76b5597f016d45662fdbf64a71ae13374
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Port CMovement::SetNext and SetFrame, CPhase::SetCurrent and ExecCmd for the Android frame stepping

Changed paths:
    engines/ngi/statics.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 0e436816456..c7e7d22bb1a 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -929,6 +929,12 @@ bool AniObject::updateAnimation(int counterdiff) {
 		_movement->_counter = 0;
 
 		if (_flags & 1) {
+			if (timedMovement) {
+				if (!setNextFrame(false))
+					stopMovement();
+				return true;
+			}
+
 			if (_counter) {
 				_counter--;
 
@@ -936,7 +942,7 @@ bool AniObject::updateAnimation(int counterdiff) {
 			}
 
 			Phase *dyn = _movement->_curPhase;
-			if (!timedMovement && dyn->_delay == dyn->_countdown) {
+			if (dyn->_delay == dyn->_countdown) {
 
 				ex = dyn->getCommand();
 				if (ex && ex->_cmd != kCmdSound) {
@@ -963,38 +969,13 @@ bool AniObject::updateAnimation(int counterdiff) {
 					return true;
 			}
 
-			// a movement that plays backwards (START_MOVEMENT reverse) ends at its first frame
-			// CMovement::SetNext (EFB8E)
-			const int lastFrame = (int)_movement->_phases.size() - 2; // last phase; the next statics follows
-			const int stopFrame = timedMovement ? movementStopFrame() : lastFrame;
-			if (timedMovement && _movement->_reverse) {
-				if (_movement->_curFrame > 0) {
-					_movement->gotoPrevFrame(_flags & 8);
-				} else if (_movement->_cycled) {
-					_movement->setFrame(lastFrame, _flags & 8);
-				} else {
-					stopMovement();
-					return true;
-				}
-				setPos(_movement->_x, _movement->_y);
-				_counter = _initialCounter;
-				_movement->_curPhase->enter(_id);
-			} else if (timedMovement && _movement->_cycled && _movement->_curFrame >= stopFrame) {
-				_movement->setFrame(0, _flags & 8);
-				setPos(_movement->_x, _movement->_y);
-				_counter = _initialCounter;
-				_movement->_curPhase->enter(_id);
-			} else if (timedMovement && _movement->_curFrame >= stopFrame) {
-				stopMovement();
-			} else if (!_movement->setNext(_callback1, _callback2, timedMovement && (_flags & 8))) {
+			if (!_movement->setNext(_callback1, _callback2)) {
 				stopMovement();
 			} else {
 				setPos(_movement->_x, _movement->_y);
 				_counter = _initialCounter;
 
-				if (timedMovement) {
-					_movement->_curPhase->enter(_id);
-				} else if (dyn->_delay == dyn->_countdown) {
+				if (dyn->_delay == dyn->_countdown) {
 					ex = dyn->getCommand();
 					if (ex) {
 						if (ex->_cmd == kCmdSound) {
@@ -1011,7 +992,7 @@ bool AniObject::updateAnimation(int counterdiff) {
 			const Common::Point point = _stepArray.getCurrPoint();
 			setPos(point.x + _x, point.y + _y);
 			_stepArray.gotoNextPoint();
-			if (!timedMovement && _targetFrame == _movement->_curFrame)
+			if (_targetFrame == _movement->_curFrame)
 				adjustSomeXY();
 		} else if (_flags & 0x20) {
 			_flags ^= 0x20;
@@ -1187,24 +1168,63 @@ int AniObject::movementStopFrame() const {
 // CMovement::SetCurFrame (EFB00): SetFrame frame by frame
 void AniObject::stepToFrame(int target, bool silent) {
 	Movement *mov = _movement;
-	const bool mirror = (_flags & 8) != 0;
-	while (mov->_curFrame != target) {
-		const int frame = mov->_curFrame < target ? mov->_curFrame + 1 : mov->_curFrame - 1;
-		const bool forward = frame > mov->_curFrame;
-		mov->setFrame(frame, mirror);
-		setPos(mov->_x, mov->_y);
-		// the slide of the frames (+80, +84 of the movement): added going forward, taken back going back
-		if (forward) {
-			const Common::Point step = _stepArray.getCurrPoint();
-			setPos(_x + step.x, _y + step.y);
-			_stepArray.gotoNextPoint();
-		} else if (frame < _stepArray.getPointsCount()) {
-			const Common::Point step = _stepArray.getPoint(frame, 1);
-			setPos(_x - step.x, _y - step.y);
+	while (mov->_curFrame != target)
+		setMovementFrame(mov, mov->_curFrame < target ? mov->_curFrame + 1 : mov->_curFrame - 1, silent);
+}
+
+// CMovement::SetNext (EFB8E): false when the movement is at its end
+bool AniObject::setNextFrame(bool silent) {
+	Movement *mov = _movement;
+	const int endFrame = movementStopFrame();
+	int next;
+	if (mov->_reverse) {
+		next = mov->_curFrame - 1;
+		if (next < endFrame) {
+			if (!mov->_cycled)
+				return false;
+			next = (int)mov->_phases.size() - 2;
 		}
-		if (!silent)
-			mov->_curPhase->enter(_id);
+	} else {
+		next = mov->_curFrame + 1;
+		if (next > endFrame) {
+			if (!mov->_cycled)
+				return false;
+			next = 0;
+		}
+	}
+	setMovementFrame(mov, next, silent);
+	return true;
+}
+
+// CMovement::SetFrame (EF8B8)
+void AniObject::setMovementFrame(Movement *mov, int frame, bool silent) {
+	const int old = mov->_curFrame;
+	const bool forward = old < frame;
+	const bool load = !g_ngi->_preloadManager->isPreloaded(mov->_id);
+
+	// going back (or wrapping to the first frame) it is the phase that is left
+	if (forward)
+		mov->_phases[frame]->setCurrent(_id, load, silent);
+	else if (old < (int)mov->_phases.size() - 1)
+		mov->_phases[old]->setCurrent(_id, load, silent);
+
+	const Common::Point before(_x, _y);
+	mov->setFrame(frame, (_flags & 8) != 0);
+	setPos(mov->_x, mov->_y);
+	if ((_x != before.x || _y != before.y) && (_scaleX != 1.0f || _scaleY != 1.0f || _rotation != 0.0f))
+		warning("STUB/untested: CMovement::SetFrame of ani %d with scale %f, %f, rotation %f: the step is not scaled or rotated", _id, _scaleX, _scaleY, _rotation);
+	// the slide of the frames (+80, +84 of the movement): added going forward, taken back going back
+	if (forward) {
+		const Common::Point step = _stepArray.getCurrPoint();
+		setPos(_x + step.x, _y + step.y);
+		_stepArray.gotoNextPoint();
+	} else if (frame < _stepArray.getPointsCount()) {
+		const Common::Point step = _stepArray.getPoint(frame, 1);
+		setPos(_x - step.x, _y - step.y);
 	}
+
+	if (!silent)
+		mov->_curPhase->execCmd();
 }
 
 // CAniObject::StopMovement (F0F28)
@@ -1982,13 +2002,7 @@ bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseId
 	_movement->_counter = 0;
 
 	_counter = _initialCounter;
-	_targetFrame = reverse ? -1 : dynPhaseIdx;
-
-	if (timedMovement && startFrame != -1) {
-		// CAniObject::SetCurFrame
-		_movement->setCurFrame(startFrame);
-		setPos(_movement->_x, _movement->_y);
-	}
+	_targetFrame = dynPhaseIdx;
 
 	_stepArray.clear();
 
@@ -2002,9 +2016,16 @@ bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseId
 
 	newex->postMessage();
 
-	// CMovement::SetFrame (EF8B8): a silent start skips the load, sound and command of the phase
-	if (timedMovement && !silent)
-		mov->_curPhase->enter(_id);
+	if (timedMovement) {
+		// CMovement::SetFrame (EF8B8) of the first frame: a reverse start leaves no phase, so no sound
+		if (!reverse)
+			mov->_curPhase->setCurrent(_id, !g_ngi->_preloadManager->isPreloaded(movementId), silent);
+		if (!silent)
+			mov->_curPhase->execCmd();
+		// CAniObject::SetCurFrame (F0C76) of the start frame
+		if (startFrame != -1)
+			setCurFrame(startFrame, true, false);
+	}
 
 	return true;
 }
@@ -2971,15 +2992,29 @@ Common::String Phase::toXML() {
 			StaticPhase::toXML().c_str());
 }
 
-void Phase::enter(int objectId) {
-	loadIfNeeded();
+// CPhase::SetCurrent (EF77C)
+void Phase::setCurrent(int objectId, bool load, bool silent) {
+	if (silent)
+		return;
+	if (load)
+		g_ngi->_preloadManager->onLoadMove(loadTexture());
 	if (_soundId && g_ngi->_soundEnabled)
 		g_ngi->playSound(_soundId, _loopSound, objectId);
-	if (_command) {
-		Command *cmd = _command->createClone();
+}
+
+// CPhase::ExecCmd (EF7D0)
+void Phase::execCmd() {
+	Command *command = getCommand();
+	if (!command)
+		return;
+	if (command->_cmd == kCmdMessage) {
+		// sent, not CScene::Message: the scenes without a controller get it from the handlers
+		Command *cmd = command->createClone();
 		cmd->_excFlags |= 2;
 		cmd->sendMessage();
+		return;
 	}
+	g_ngi->getSceneInStack(0)->execCmd(command, command->getParamInt("interupt", 1));
 }
 
 bool Phase::load(MfcArchive &file) {
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index 808980fd63d..3796d7b3e33 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -82,7 +82,8 @@ class Phase : public StaticPhase {
   public:
 	Phase();
 	Phase(Phase *src, bool reverse);
-	void enter(int objectId);
+	void setCurrent(int objectId, bool load, bool silent);
+	void execCmd();
 
 	bool load(MfcArchive &file) override;
 
@@ -337,6 +338,8 @@ public:
 	/** CAniObject::SetCurFrame (F0C76); not modelled: keepPhaseTimer, commands of skipped phases */
 	void setCurFrame(int frame, bool keepPhaseTimer = false, bool silent = false);
 	void stepToFrame(int target, bool silent);
+	bool setNextFrame(bool silent);
+	void setMovementFrame(Movement *mov, int frame, bool silent);
 	/** CAniObject::FastStartMovement (F0CC4) */
 	bool fastStartMovement(int movementId, bool reverse);
 	/** CAniObject::MoveToStatic (F1B0C), Android; moveToStatic(int) is the Windows version */


Commit: c47c67e99cea811bb17d2203ead260e9312172ed
    https://github.com/scummvm/scummvm/commit/c47c67e99cea811bb17d2203ead260e9312172ed
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: StartSliding finishes a running movement, takes cycled and slides before the command of the first frame

Changed paths:
    engines/ngi/messagehandlers.cpp
    engines/ngi/statics.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/messagehandlers.cpp b/engines/ngi/messagehandlers.cpp
index 73ac5c1bb9b..760f4fe7424 100644
--- a/engines/ngi/messagehandlers.cpp
+++ b/engines/ngi/messagehandlers.cpp
@@ -615,10 +615,13 @@ int global_messageHandler4(Command *cmd) {
 		if (cmd->_objtype == kObjTypeExCommand2) {
 			ExCommand2 *cmd2 = static_cast<ExCommand2 *>(cmd);
 
+			// CMessageQueue::ExecuteCmdStartSliding (10D49C) reads "cycled" too
+			const Common::String cycled = cmd->_args.getValOrDefault("cycled");
+			const bool isCycled = cycled == "1" || cycled.equalsIgnoreCase("true");
 			if (cmd->_excFlags & 1) {
-				ani->startSliding(cmd->_messageNum, 0, cmd->_x, cmd->_y, cmd2->_points, flags, cmd->_mirror);
+				ani->startSliding(cmd->_messageNum, 0, cmd->_x, cmd->_y, cmd2->_points, flags, cmd->_mirror, isCycled);
 			} else {
-				ani->startSliding(cmd->_messageNum, cmd->_parId, cmd->_x, cmd->_y, cmd2->_points, flags, cmd->_mirror);
+				ani->startSliding(cmd->_messageNum, cmd->_parId, cmd->_x, cmd->_y, cmd2->_points, flags, cmd->_mirror, isCycled);
 			}
 		}
 		break;
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index c7e7d22bb1a..14b8b96ecd5 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -1735,13 +1735,20 @@ void AniObject::playIdle() {
 		adjustSomeXY();
 }
 
-void AniObject::startSliding(int movementId, int messageQueueId, int x, int y, const PointList &points, int someDynamicPhaseIndex, bool mirror) {
+void AniObject::startSliding(int movementId, int messageQueueId, int x, int y, const PointList &points, int someDynamicPhaseIndex, bool mirror, bool cycled) {
 	if (g_ngi->_gameVersion >= 201509) {
-		if (startMovement(movementId, messageQueueId, someDynamicPhaseIndex, mirror)) {
+		// CAniObject::StartSliding (F0E3C): a running movement is finished, not rewound
+		if (_movement && (_flags & 1))
+			stopMovement(false);
+		if (startMovement(movementId, messageQueueId, someDynamicPhaseIndex, mirror, cycled, false, -1, true)) {
 			_stepArray.insertPoints(points);
 			const Common::Point offset = _stepArray.getCurrPoint();
 			setPos(_x + offset.x, _y + offset.y);
 			_stepArray.gotoNextPoint();
+			// CMovement::SetFrame (EF8B8): the sound and the command of the first frame, after the slide
+			Phase *phase = _movement->_curPhase;
+			phase->setCurrent(_id, !g_ngi->_preloadManager->isPreloaded(movementId), false);
+			phase->execCmd();
 		}
 		return;
 	}
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index 3796d7b3e33..1b4d1f6324c 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -294,7 +294,7 @@ public:
 		bool silent = false);
 	void startMovementWithoutPhases(Movement *movement, bool mirror, bool reverse, int startFrame);
 	bool startAnimEx(int movid, int parId, int flag1, int flag2);
-	void startSliding(int movementId, int messageQueueId, int x, int y, const PointList &points, int someDynamicPhaseIndex, bool mirror);
+	void startSliding(int movementId, int messageQueueId, int x, int y, const PointList &points, int someDynamicPhaseIndex, bool mirror, bool cycled = false);
 
 	void hide();
 	void show1(int x, int y, int movementId, int mqId);


Commit: b46cebbc1180ba13d81f9fb417554969ec9d41c0
    https://github.com/scummvm/scummvm/commit/b46cebbc1180ba13d81f9fb417554969ec9d41c0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Sc10 and Sc11 set the interrupt state of a running queue with SetIntState

Changed paths:
    engines/ngi/fullpipe/mobile/sc10controller.cpp
    engines/ngi/fullpipe/mobile/sc11controller.cpp


diff --git a/engines/ngi/fullpipe/mobile/sc10controller.cpp b/engines/ngi/fullpipe/mobile/sc10controller.cpp
index ab94718e4d8..9fc567c97cd 100644
--- a/engines/ngi/fullpipe/mobile/sc10controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc10controller.cpp
@@ -75,7 +75,7 @@ void Sc10Controller::doTakeGum() {
 		MessageQueue *queue = mctlStartMove((int)targetX, (int)targetY, true, ST_MAN_RIGHT, false);
 		if (queue) {
 			queue->addCommandToEnd(messageCommand("MSG_SC10_CLICKGUM"));
-			queue->_interruptState = 2; // CMessageQueue::SetIntState(2)
+			queue->setIntState(2);
 		}
 	} else {
 		_gumEnabled = false;
diff --git a/engines/ngi/fullpipe/mobile/sc11controller.cpp b/engines/ngi/fullpipe/mobile/sc11controller.cpp
index 75d6220b6a0..e2323177ed3 100644
--- a/engines/ngi/fullpipe/mobile/sc11controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc11controller.cpp
@@ -723,7 +723,7 @@ void Sc11Controller::doManToPipe() {
 			MessageQueue *started = mctlStartMove(158, 524, true, ST_MAN_RIGHT, true);
 			if (started) {
 				started->addCommandToEnd(messageCommand("MSG_SC11_MAN_TO_PIPE"));
-				started->_interruptState = 2;
+				started->setIntState(2);
 			}
 		} else {
 			Interact *interaction = findInteractionByName("INT_070", PIC_SC11_LTRUBA);


Commit: 8a06a7796ae3f969e13a8c7c931f6afbe5c765e6
    https://github.com/scummvm/scummvm/commit/8a06a7796ae3f969e13a8c7c931f6afbe5c765e6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: FPController edge scrolling needs an enabled motion controller

Changed paths:
    engines/ngi/fullpipe/mobile/fpcontroller.cpp


diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
index aaea3d84533..b0ca1c3fc45 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -384,8 +384,8 @@ void FPController::defaultScroll() {
 	_heroCenterY = center.y;
 	const float cx = cursorX();
 	const float cy = cursorY();
-	// CCursorController +88
-	const bool free = _scene->_motionController && !g_ngi->_inputController->getObject();
+	// the enabled flag of the motion controller (+12), CCursorController +88
+	const bool free = _scene->_motionController && _scene->_motionController->_isEnabled && !g_ngi->_inputController->getObject();
 	bool edge = false;
 	const int viewWidth = g_ngi->gameWidth();
 	const int viewHeight = g_ngi->_backgroundSurface.h;


Commit: 61c2e35ef61184700d4f46256071631e019b4899
    https://github.com/scummvm/scummvm/commit/61c2e35ef61184700d4f46256071631e019b4899
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: FPController::checkQueues resets when the hero has no queue

Changed paths:
    engines/ngi/fullpipe/mobile/fpcontroller.cpp


diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
index b0ca1c3fc45..5eb9222aa3a 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -600,7 +600,7 @@ bool FPController::canInterruptManQueue() const {
 
 // CFPController::CheckQueues (hero's queue part: +72, +76, +88, +192) and the swipe flag (+212)
 void FPController::checkQueues() {
-	if (hero() && !hero()->getMessageQueue() && !hero()->_messageQueueId) {
+	if (hero() && !hero()->getMessageQueue()) {
 		_walkQueue = nullptr;
 		_interactionQueue = nullptr;
 		_lastTargetX = 0;


Commit: 30e94ef1479f587a7317d38f83272b3e62f75bbb
    https://github.com/scummvm/scummvm/commit/30e94ef1479f587a7317d38f83272b3e62f75bbb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Keep the scene render list like CScene +176

Changed paths:
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/gameloader.cpp
    engines/ngi/gfx.cpp
    engines/ngi/gfx.h
    engines/ngi/scene.cpp
    engines/ngi/scene.h
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index a32c8832b0f..eeb97906d0b 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -655,6 +655,7 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 		if (scene->_heroId && !_aniMan)
 			return false;
 
+		scene->repopulateRenderables(); // CScene::AddRoamingObject, once for all (D53)
 		scene->updateLoadingTotal(); // CScene::Init sums the objects after AddRoamingObjects
 
 		clearGlobalMessageQueueList1();
diff --git a/engines/ngi/gameloader.cpp b/engines/ngi/gameloader.cpp
index c8cd581052a..8cb11956366 100644
--- a/engines/ngi/gameloader.cpp
+++ b/engines/ngi/gameloader.cpp
@@ -497,6 +497,7 @@ void GameLoader::applyPicAniInfos(Scene *sc, const PicAniInfoList &picAniInfo) {
 				PictureObject *pictNew = new PictureObject(pict);
 
 				sc->_pictureObjects.push_back(pictNew);
+				sc->renderableAdded(pictNew);
 				pictNew->setPicAniInfo(info);
 				continue;
 			}
diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index bb160d892ca..fff66dd5412 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -95,6 +95,8 @@ void Background::addPicture(PictureObject *pct) {
 	if (!inserted) {
 		_pictureObjects.push_back(pct);
 	}
+
+	renderableAdded(pct);
 }
 
 PictureObject::PictureObject() {
diff --git a/engines/ngi/gfx.h b/engines/ngi/gfx.h
index 6877420cc5f..8773953adef 100644
--- a/engines/ngi/gfx.h
+++ b/engines/ngi/gfx.h
@@ -299,6 +299,8 @@ public:
 
 	bool load(MfcArchive &file) override;
 	void addPicture(PictureObject *pct);
+	// CScene::AddPicture / AddAni keep the object in the render order list (Scene)
+	virtual void renderableAdded(GameObject *object) {}
 
 	BigPicture *getBigPicture(int x, int y) { return _bigPictureArray[y * _bigPictureXDim + x]; }
 };
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index e525499485a..f87cae33433 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -576,6 +576,12 @@ void Scene::removeAni(AniObject *obj) {
 			_renderableAnis.remove_at(i);
 			break;
 		}
+
+	for (uint i = 0; i < _renderables.size(); i++)
+		if (_renderables[i] == obj) {
+			_renderables.remove_at(i);
+			break;
+		}
 }
 
 // CScene::RemoveCopies (the roaming parameters of the copies are not ported)
@@ -596,6 +602,8 @@ void Scene::removeCopies() {
 			warning("STUB/untested: CScene::RemoveRoamingObjectAnyCopes (the roaming parameters of the removed copies)");
 		}
 	}
+	if (g_ngi->_gameVersion >= 201509)
+		repopulateRenderables();
 	if (_controller)
 		_controller->onRemoveCopies();
 }
@@ -609,6 +617,7 @@ void Scene::addAni(AniObject *obj, bool addList2) {
 		obj->assignCopyId(&_aniObjects);
 
 	_aniObjects.push_back(obj);
+	renderableAdded(obj);
 
 	if (addList2) {
 		if (!obj->_copyId)
@@ -665,6 +674,12 @@ void Scene::removePicture(PictureObject *obj) {
 	for (uint i = 0; i < _pictureObjects.size(); i++) {
 		if (_pictureObjects[i] == obj) {
 			_pictureObjects.remove_at(i);
+			for (uint j = 0; j < _renderables.size(); j++) {
+				if (_renderables[j] == obj) {
+					_renderables.remove_at(j);
+					break;
+				}
+			}
 			delete obj;
 
 			return;
@@ -987,6 +1002,60 @@ void Scene::initObjectCursors(const char *varname) {
 	}
 }
 
+// CScene::RepopulateRenderables (123688)
+void Scene::repopulateRenderables() {
+	struct ByKey {
+		static uint key(const GameObject *object) {
+			return ((uint)(uint16)object->_copyId << 16) | (uint16)object->_id;
+		}
+		static bool less(const GameObject *a, const GameObject *b) {
+			return key(a) < key(b);
+		}
+	};
+
+	Common::Array<GameObject *> pictures;
+	for (PictureObject *picture : _pictureObjects)
+		pictures.push_back(picture);
+	Common::sort(pictures.begin(), pictures.end(), ByKey::less);
+
+	Common::Array<GameObject *> anis;
+	for (AniObject *ani : _aniObjects)
+		anis.push_back(ani);
+	Common::sort(anis.begin(), anis.end(), ByKey::less);
+
+	Common::Array<GameObject *> roamings;
+	for (PictureObject *picture : _roamingPictures)
+		roamings.push_back(picture);
+	for (AniObject *ani : _roamingAnis)
+		roamings.push_back(ani);
+	Common::sort(roamings.begin(), roamings.end(), ByKey::less);
+
+	_renderables.clear();
+	_renderables.push_back(pictures);
+	_renderables.push_back(anis);
+	_renderables.push_back(roamings);
+}
+
+// CScene::SortRenderables (11FA20): bubble sort, highest z first, equal z keeps its place
+void Scene::sortRenderablesPersistent() {
+	bool swapped;
+	do {
+		swapped = false;
+		for (uint i = 1; i < _renderables.size(); i++) {
+			if (_renderables[i - 1]->_z < _renderables[i]->_z) {
+				SWAP(_renderables[i - 1], _renderables[i]);
+				swapped = true;
+			}
+		}
+	} while (swapped);
+}
+
+// CScene::AddPicture (122F5C), CScene::AddAni (122E60): the object goes to the end of the list
+void Scene::renderableAdded(GameObject *object) {
+	if (g_ngi->_gameVersion >= 201509)
+		_renderables.push_back(object);
+}
+
 template<typename T>
 void Scene::sortRenderables(Common::Array<T *> &list, uint startIndex) {
 	// The XML loader saves the declaration order across pictures and animations.
@@ -1026,22 +1095,19 @@ void Scene::render(bool clear) {
 	if (clear)
 		g_ngi->_backgroundSurface.clear(0);
 	if (g_ngi->_gameVersion >= 201509) {
-		Common::Array<GameObject *> visibleObjects;
-		for (PictureObject *picture : _pictureObjects) {
-			if (picture->_flags & 4)
-				visibleObjects.push_back(picture);
-		}
-		for (PictureObject *picture : _roamingPictures) {
-			if (picture->_flags & 4)
-				visibleObjects.push_back(picture);
+		static bool warned = false;
+		if (!warned && _renderables.size() != _pictureObjects.size() + _aniObjects.size() + _roamingPictures.size() + _roamingAnis.size()) {
+			warned = true;
+			warning("STUB/untested: CScene +176: the render list does not hold every object of the scene %d (%u of %u + %u + %u + %u)", _sceneId, _renderables.size(), _pictureObjects.size(),
+				_aniObjects.size(), _roamingPictures.size(), _roamingAnis.size());
 		}
-		for (AniObject *animation : _renderableAnis) {
-			if (animation->_flags & 4)
-				visibleObjects.push_back(animation);
+		sortRenderablesPersistent();
+		Common::Array<GameObject *> visibleObjects;
+		for (GameObject *object : _renderables) {
+			if (object->_flags & 4)
+				visibleObjects.push_back(object);
 		}
 
-		sortRenderables(visibleObjects);
-
 		// CScene::Render: controller bottom layer, objects with z >= 0, OnRender hook, GUI, physics,
 		// objects with z < 0, controller top layer
 		if (_controller)
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index 052aee0a3ae..d7982f4cee9 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -50,6 +50,11 @@ class Scene : public Background {
 
 	// Includes non-owning references to roaming XML actors from other scenes.
 	Common::Array<AniObject *> _renderableAnis;
+	/** CScene +176 (201509): every object in render order, kept between the frames */
+	Common::Array<GameObject *> _renderables;
+	void repopulateRenderables();
+	void sortRenderablesPersistent();
+	void renderableAdded(GameObject *object) override;
 	// Non-owning references to pictures of other scenes (XML ADDPIC, CScene roaming pictures).
 	Common::Array<PictureObject *> _roamingPictures;
 	PicAniInfoList _roamingObjects;
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index 417b392168f..58c0064adf7 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1824,6 +1824,7 @@ void SceneTag::loadSceneXML(const GameProject &project) {
 	debugC(1, kDebugXML, "Loaded Full Pipe scene %s with %u pictures and %u animations",
 		_tag.c_str(), scene->_pictureObjects.size(), scene->_aniObjects.size());
 	scene->updateLoadingTotal();
+	scene->repopulateRenderables(); // CScene::Init
 	delete _scene;
 	_scene = scene.release();
 	// exits.xml exists from the 2015 revision on (the original reads all scenes at once)
@@ -1838,6 +1839,7 @@ static bool createWaitScreen(GameProject &project) {
 	XMLSceneParser parser(project, *scene, g_ngi->getResourceLocale());
 	if (!parser.loadFile("data/res/sc_waitscreen.xml") || !parser.parse())
 		return false;
+	scene->repopulateRenderables(); // CWaitScreen::Init: CScene::Init
 	project._sceneTagList->emplace_back();
 	SceneTag &tag = project._sceneTagList->back();
 	tag._sceneId = 1;


Commit: 7f6e3d63e74172d8b27a430fee7a0cd16e3d277e
    https://github.com/scummvm/scummvm/commit/7f6e3d63e74172d8b27a430fee7a0cd16e3d277e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Cursor hit objects from the scene render list

Changed paths:
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/input.cpp
    engines/ngi/ngi.h


diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index eeb97906d0b..10d77e3f7ef 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -578,6 +578,13 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 	GameVar *sceneVar;
 	Common::Point sceneDim;
 
+	// CGame::DoSetScene sets CGame +28 first and clears it at the end
+	struct SceneSetting {
+		bool &_flag;
+		explicit SceneSetting(bool &flag) : _flag(flag) { _flag = true; }
+		~SceneSetting() { _flag = false; }
+	} sceneSetting(_sceneSetting);
+
 	Scene *scene = findScene(entrance._sceneId);
 
 	if (!scene)
diff --git a/engines/ngi/input.cpp b/engines/ngi/input.cpp
index 20b5052a4f0..aea73a3e472 100644
--- a/engines/ngi/input.cpp
+++ b/engines/ngi/input.cpp
@@ -505,20 +505,31 @@ void CursorController::repopulateHitObjects(Scene *scene) {
 		scene = g_ngi->getCurrentScene();
 	}
 
-	if (scene) {
-		// shown and hit objects of the scene (CVisibleObject::Hit(x, y, 256), flag 2 of the XML objects)
+	if (scene && !(g_ngi->_gameVersion >= 201509 && g_ngi->_sceneSetting)) {
 		Common::Array<GameObject *> hit;
-		for (PictureObject *picture : scene->_pictureObjects) {
-			if ((picture->_flags & 4) && (picture->_objectFlags & 2) && picture->hit(_hotSceneX, _hotSceneY))
-				hit.push_back(picture);
-		}
-		for (PictureObject *picture : scene->_roamingPictures) {
-			if ((picture->_flags & 4) && (picture->_objectFlags & 2) && picture->hit(_hotSceneX, _hotSceneY))
-				hit.push_back(picture);
-		}
-		for (AniObject *ani : scene->_renderableAnis) {
-			if ((ani->_flags & 4) && (ani->_objectFlags & 2) && ani->hit(_hotSceneX, _hotSceneY))
-				hit.push_back(ani);
+		if (g_ngi->_gameVersion >= 201509) {
+			// CScene +176 in its list order, CVisibleObject::Hit(x, y, 256)
+			for (GameObject *object : scene->_renderables) {
+				if (!(object->_flags & 4))
+					continue;
+				const bool isPicture = object->_objtype == kObjTypePictureObject;
+				if (isPicture ? static_cast<PictureObject *>(object)->hit(_hotSceneX, _hotSceneY) : static_cast<AniObject *>(object)->hit(_hotSceneX, _hotSceneY))
+					hit.push_back(object);
+			}
+		} else {
+			// shown and hit objects of the scene (flag 2 of the XML objects)
+			for (PictureObject *picture : scene->_pictureObjects) {
+				if ((picture->_flags & 4) && (picture->_objectFlags & 2) && picture->hit(_hotSceneX, _hotSceneY))
+					hit.push_back(picture);
+			}
+			for (PictureObject *picture : scene->_roamingPictures) {
+				if ((picture->_flags & 4) && (picture->_objectFlags & 2) && picture->hit(_hotSceneX, _hotSceneY))
+					hit.push_back(picture);
+			}
+			for (AniObject *ani : scene->_renderableAnis) {
+				if ((ani->_flags & 4) && (ani->_objectFlags & 2) && ani->hit(_hotSceneX, _hotSceneY))
+					hit.push_back(ani);
+			}
 		}
 		// std::multiset with zCompare: ascending z, equal ones in insertion order
 		for (GameObject *object : hit) {
diff --git a/engines/ngi/ngi.h b/engines/ngi/ngi.h
index 89338d572b1..4be864d22a7 100644
--- a/engines/ngi/ngi.h
+++ b/engines/ngi/ngi.h
@@ -521,6 +521,7 @@ public:
 public:
 
 	bool _isSaveAllowed;
+	bool _sceneSetting = false; // CGame +28: DoSetScene is running
 
 	Common::Error loadGameState(int slot) override;
 	Common::Error saveGameState(int slot, const Common::String &description, bool isAutosave = false) override;


Commit: cc948a6210f843bdc702d7192311acfdee7a5285
    https://github.com/scummvm/scummvm/commit/cc948a6210f843bdc702d7192311acfdee7a5285
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: MOVE_TO_STATIC of the controllers shows the object

Changed paths:
    engines/ngi/fullpipe/mobile/controllerhelpers.cpp


diff --git a/engines/ngi/fullpipe/mobile/controllerhelpers.cpp b/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
index 7d5fb5b30fe..747565b44f7 100644
--- a/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
+++ b/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
@@ -82,6 +82,7 @@ Command *queueCommand(int queueId, const char *name, const char *interrupt) {
 Command *moveToStaticCommand(int aniId, int copyId, int staticId) {
 	Command *command = new Command(aniId, kCmdMoveToStatic, staticId, 0, 0, 0, 1, 0, 0, 0);
 	command->_param = copyId;
+	command->_auxParam = 1; // needShow: ExecCmdToStatic default
 	command->_excFlags |= 2;
 	return command;
 }


Commit: 9675669ba3cf367d1402898fbc965eae543b6191
    https://github.com/scummvm/scummvm/commit/9675669ba3cf367d1402898fbc965eae543b6191
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: First SHOW of a line queue has no wait

Changed paths:
    engines/ngi/motion.cpp


diff --git a/engines/ngi/motion.cpp b/engines/ngi/motion.cpp
index 5522cc3343f..e8e4705f24d 100644
--- a/engines/ngi/motion.cpp
+++ b/engines/ngi/motion.cpp
@@ -2872,7 +2872,7 @@ MessageQueue *MctlGraph::makeLineQueue(GmctlMqStruct *info) {
 		ex->_z = info->sourceZ;
 
 		ex->_param = _aniData[info->objectIndex]._ani->_copyId;
-		ex->_wait = 1;
+		ex->_wait = g_ngi->_gameVersion >= 201509 ? 0 : 1; // CCommand(1) has no wait
 		ex->_excFlags |= 2;
 		// CMctlGraph::MakeLineQueue: Show carries the mirror of its movement
 		if (g_ngi->_gameVersion >= 201509)
@@ -2893,7 +2893,7 @@ MessageQueue *MctlGraph::makeLineQueue(GmctlMqStruct *info) {
 		ex->_z = info->sourceZ;
 
 		ex->_param = _aniData[info->objectIndex]._ani->_copyId;
-		ex->_wait = 1;
+		ex->_wait = g_ngi->_gameVersion >= 201509 ? 0 : 1; // CCommand(1) has no wait
 		ex->_excFlags |= 2;
 		if (g_ngi->_gameVersion >= 201509)
 			ex->_auxParam = walk[0]._mirror;


Commit: 2c53a0d32191136597fd6a24df6f27caec1288dc
    https://github.com/scummvm/scummvm/commit/2c53a0d32191136597fd6a24df6f27caec1288dc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Graphs and ladders share the animation handler, as in 201509

Changed paths:
    engines/ngi/anihandler.cpp
    engines/ngi/anihandler.h
    engines/ngi/fullpipe/mobile/fpcontroller.cpp
    engines/ngi/motion.cpp
    engines/ngi/motion.h


diff --git a/engines/ngi/anihandler.cpp b/engines/ngi/anihandler.cpp
index 52352fe2938..aafe9027cee 100644
--- a/engines/ngi/anihandler.cpp
+++ b/engines/ngi/anihandler.cpp
@@ -40,7 +40,14 @@ void AniHandler::detachAllObjects() {
 	_items.clear();
 }
 
-MessageQueue *AniHandler::makeQueue(AniObject *ani, int staticsIndex, int, int *, Common::Point **) {
+// CMctrlMessageQueue(scene, 1, 1) in 201509, the Windows queue gets a global id
+MessageQueue *AniHandler::newQueue() {
+	if (g_ngi->_gameVersion >= 201509)
+		return new MctrlMessageQueue(_scene, true, 1);
+	return new MessageQueue(g_ngi->_globalMessageQueueList->compact());
+}
+
+MessageQueue *AniHandler::makeQueue(AniObject *ani, int staticsIndex, int staticsId, int *, Common::Point **) {
 	debugC(4, kDebugPathfinding, "AniHandler::makeQueue(*%d, %d, id, res, point)", ani->_id, staticsIndex);
 
 	int idx = getIndex(ani->_id);
@@ -48,13 +55,9 @@ MessageQueue *AniHandler::makeQueue(AniObject *ani, int staticsIndex, int, int *
 	if (idx == -1)
 		return nullptr;
 
-#if 0
 	int stid = staticsId;
 
 	if (!staticsId) {
-#else
-	int stid;
-#endif
 		if (ani->_movement) {
 			stid = ani->_movement->_nextStatic->_staticsId;
 		} else {
@@ -63,12 +66,10 @@ MessageQueue *AniHandler::makeQueue(AniObject *ani, int staticsIndex, int, int *
 
 			stid = ani->_statics->_staticsId;
 		}
-#if 0
 	}
-#endif
 
 	if (stid == staticsIndex)
-		return new MessageQueue(g_ngi->_globalMessageQueueList->compact());
+		return newQueue();
 
 	int startidx = getStaticIndex(idx, stid);
 	int endidx = getStaticIndex(idx, staticsIndex);
@@ -82,7 +83,7 @@ MessageQueue *AniHandler::makeQueue(AniObject *ani, int staticsIndex, int, int *
 	if (!_items[idx].transitions[subidx].movement)
 		return nullptr;
 
-	MessageQueue *mq = new MessageQueue(g_ngi->_globalMessageQueueList->compact());
+	MessageQueue *mq = newQueue();
 	Common::Point point;
 	Command *ex;
 
diff --git a/engines/ngi/anihandler.h b/engines/ngi/anihandler.h
index eea9e2d807c..b5e6d37d332 100644
--- a/engines/ngi/anihandler.h
+++ b/engines/ngi/anihandler.h
@@ -93,6 +93,8 @@ protected:
 	Common::Array<MGMItem> _items;
 
 public:
+	Scene *_scene = nullptr; // CAniHandler +8, set by CFPController::OnShow
+
 	void detachAllObjects();
 	void attachObject(int objId);
 	void resetData(int objId);
@@ -109,6 +111,7 @@ public:
 	int seekWay(int idx, int st1idx, int st2idx, bool allowReverse, bool linkedOnly);
 	Common::Point getNumCycles(Movement *mov, int x, int y, int *mult, int *len, int flag);
 	ExCommand2 *createCommand(Movement *mov, int objId, int x1, int y1, Common::Point &x2, Common::Point &y2, int len);
+	MessageQueue *newQueue();
 	MessageQueue *makeQueue(AniObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
 	int getFramesCount(int idx, int subIdx, int subOffset, int flag);
 	int getNumMovements(int objectId, int idx1, int idx2);
diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
index 5eb9222aa3a..de4459522fe 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -217,6 +217,7 @@ bool FPController::isScrollYScene() const {
 
 // CFPController::OnShow, the camera part and the resets; not ported: flurry, hints
 void FPController::onShow() {
+	g_ngi->_aniHandler->_scene = _scene; // CFPController::OnShow (14D70C)
 	// CMap::Update: the scene and the entrance it was entered through appear on the map
 	if (g_ngi->_map)
 		g_ngi->_map->update(_scene->_sceneId, _scene->_currentEntranceId);
diff --git a/engines/ngi/motion.cpp b/engines/ngi/motion.cpp
index e8e4705f24d..981a9b57689 100644
--- a/engines/ngi/motion.cpp
+++ b/engines/ngi/motion.cpp
@@ -375,6 +375,10 @@ MessageQueue *MctlCompound::makeQueue(AniObject *subj, int xpos, int ypos, int f
 	return mq;
 }
 
+AniHandler &sharedAniHandler(AniHandler &own) {
+	return g_ngi->_gameVersion >= 201509 && g_ngi->_aniHandler ? *g_ngi->_aniHandler : own;
+}
+
 MctlLadder::MctlLadder() {
 	_stepX = 0;
 	_x = 0;
@@ -387,7 +391,11 @@ MctlLadder::MctlLadder() {
 }
 
 MctlLadder::~MctlLadder() {
-	detachAllObjects();
+	// CMctlLadder::~CMctlLadder (1ACC98) frees the list only, the shared handler is not touched
+	if (g_ngi->_gameVersion >= 201509)
+		freeMovements();
+	else
+		detachAllObjects();
 }
 
 int MctlLadder::getCurrentStep(AniObject *man) {
@@ -493,7 +501,10 @@ void MctlLadder::detachAllObjects() {
 	debugC(4, kDebugPathfinding, "MctlLadder::detachAllObjects()");
 
 	_aniHandler.detachAllObjects();
+	freeMovements();
+}
 
+void MctlLadder::freeMovements() {
 	for (uint i = 0; i < _ladmovements.size(); i++) {
 		delete _ladmovements[i]->movementIds;
 		delete[] _ladmovements[i]->staticIds;
@@ -2024,6 +2035,14 @@ bool MctlGraph::fillData(AniObject *obj, GmctlAni &item) {
 void MctlGraph::attachObject(AniObject *obj) {
 	debugC(4, kDebugPathfinding, "MctlGraph::attachObject(*%d)", obj->_id);
 
+	// CMctlGraph::AttachObject (1ABE24): FillData and push_back, the base class is not called
+	if (g_ngi->_gameVersion >= 201509) {
+		_aniData.push_back(GmctlAni());
+		if (!fillData(obj, _aniData.back()))
+			_aniData.pop_back();
+		return;
+	}
+
 	MovGraph::attachObject(obj);
 
 	int id = getObjIndex(obj->_id);
diff --git a/engines/ngi/motion.h b/engines/ngi/motion.h
index 6ce8b5ecb71..027b9140e14 100644
--- a/engines/ngi/motion.h
+++ b/engines/ngi/motion.h
@@ -137,6 +137,9 @@ struct LmctlAni {
 	int *staticIds;
 };
 
+/** the 201509 graphs and ladders use the one CSingleton<CAniHandler>, the Windows ones their own */
+AniHandler &sharedAniHandler(AniHandler &own);
+
 class MctlLadder : public MotionController {
 public:
 	int _x;
@@ -147,7 +150,10 @@ public:
 	int _entryOffsetX;
 	int _entryOffsetY;
 	Common::Array<LmctlAni *> _ladmovements;
-	AniHandler _aniHandler;
+	AniHandler _ownAniHandler;
+	AniHandler &_aniHandler = sharedAniHandler(_ownAniHandler);
+
+	void freeMovements();
 
 public:
 	MctlLadder();
@@ -292,7 +298,8 @@ private:
 	int _linkItemOffset;
 	Common::Array<NavDatum> _items;
 	GrPathDesc *(*_selFunc)(AniObject *ani, Common::Array<PathDesc *> *items, signed int counter);
-	AniHandler _aniHandler;
+	AniHandler _ownAniHandler;
+	AniHandler &_aniHandler = sharedAniHandler(_ownAniHandler);
 
 public:
 	MovGraph();


Commit: 110abf4d351bf92159b7398049d4b4f67a2fcb2d
    https://github.com/scummvm/scummvm/commit/110abf4d351bf92159b7398049d4b4f67a2fcb2d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: TutorialController::OnUpdate passes 0,0,0 to AddContinueBtnIfNeed

Changed paths:
    engines/ngi/fullpipe/mobile/tutorialcontroller.cpp


diff --git a/engines/ngi/fullpipe/mobile/tutorialcontroller.cpp b/engines/ngi/fullpipe/mobile/tutorialcontroller.cpp
index 76667759b6f..9e832d2e195 100644
--- a/engines/ngi/fullpipe/mobile/tutorialcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/tutorialcontroller.cpp
@@ -387,7 +387,7 @@ void TutorialController::onUpdate(uint32 elapsed) {
 		sceneBelow()->update(elapsed);
 	}
 	checkArrowPos();
-	addContinueBtnIfNeed(-1, -1, 0);
+	addContinueBtnIfNeed(0, 0, 0);
 }
 
 // CTutorialController::OnRender (1A378C)


Commit: 8cd1023b0464cf0ecb129edf31f3b6dd31f502ab
    https://github.com/scummvm/scummvm/commit/8cd1023b0464cf0ecb129edf31f3b6dd31f502ab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Controllers set the interrupt state of queues through SetIntState

Changed paths:
    engines/ngi/fullpipe/mobile/sc04controller.cpp
    engines/ngi/fullpipe/mobile/sc08controller.cpp
    engines/ngi/fullpipe/mobile/sc11controller.cpp
    engines/ngi/fullpipe/mobile/sc27controller.cpp


diff --git a/engines/ngi/fullpipe/mobile/sc04controller.cpp b/engines/ngi/fullpipe/mobile/sc04controller.cpp
index 29c75e5455c..b5d8d9deffc 100644
--- a/engines/ngi/fullpipe/mobile/sc04controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc04controller.cpp
@@ -713,7 +713,7 @@ MessageQueue *Sc04Controller::doManJump() {
 	queueInfo.flags = 78;
 	MessageQueue *queue = g_ngi->_aniHandler->makeRunQueue(&queueInfo);
 	if (queue) {
-		queue->_interruptState = 2;
+		queue->setIntState(2);
 		_scene->runQueueObject(queue, man, 2);
 		man->_z = 10;
 		queue->addCommandToEnd(exitRotateCommand("MSG_FROMLADDER"));
@@ -1099,7 +1099,7 @@ void Sc04Controller::doJumpFromBottle(MessageQueue *queue) {
 		warnOnce("CMessageQueue::GetCurCommand (the queue of the engine drops the commands that ran): DoJumpFromBottle does not continue the command");
 	MessageQueue *jump = copyQueue(_scene, QU_SC4_MANFROMBOTTLE);
 	if (jump) {
-		jump->_interruptState = 2;
+		jump->setIntState(2);
 		_scene->runQueueObject(jump, hero(), 4);
 	}
 	_dudeInBottle = false;
diff --git a/engines/ngi/fullpipe/mobile/sc08controller.cpp b/engines/ngi/fullpipe/mobile/sc08controller.cpp
index 82af7a2b3c5..af82eb694e8 100644
--- a/engines/ngi/fullpipe/mobile/sc08controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc08controller.cpp
@@ -377,7 +377,7 @@ void Sc08Controller::doStep1() {
 	command->_param = hero()->_copyId;
 	command->_excFlags |= 2;
 	queue->addCommandToEnd(command);
-	queue->_interruptState = 2; // CMessageQueue::SetIntState(2)
+	queue->setIntState(2);
 	if (!queue->run(nullptr)) // CScene::RunQueue(queue, 4, 0)
 		delete queue;
 
diff --git a/engines/ngi/fullpipe/mobile/sc11controller.cpp b/engines/ngi/fullpipe/mobile/sc11controller.cpp
index e2323177ed3..7512ae724c8 100644
--- a/engines/ngi/fullpipe/mobile/sc11controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc11controller.cpp
@@ -542,7 +542,7 @@ void Sc11Controller::doJumpToTruba() {
 	mkQueue.flags = 66;
 	MessageQueue *queue = g_ngi->_aniHandler->makeRunQueue(&mkQueue);
 	if (queue) {
-		queue->_interruptState = 2;
+		queue->setIntState(2);
 		_crySound = SND_11_024;
 		Scene *tubeScene = g_ngi->findScene(SC_5);
 		AniObject *biglu = tubeScene ? tubeScene->findAniObjectById(ANI_BIGLUK, 0) : nullptr;
@@ -614,7 +614,7 @@ void Sc11Controller::doBumpTruba(double angle) {
 	mkQueue.flags = 78;
 	MessageQueue *queue = g_ngi->_aniHandler->makeRunQueue(&mkQueue);
 	if (queue) {
-		queue->_interruptState = 2;
+		queue->setIntState(2);
 		_crySound = SND_11_022;
 		queue->addCommandToEnd(messageCommand("MSG_SC11_RESTARTMAN"));
 		_scene->runQueueObject(queue, nullptr, 4);
@@ -650,7 +650,7 @@ void Sc11Controller::doMissTruba(double angle) {
 	mkQueue.flags = 78;
 	MessageQueue *queue = g_ngi->_aniHandler->makeRunQueue(&mkQueue);
 	if (queue) {
-		queue->_interruptState = 2;
+		queue->setIntState(2);
 		_crySound = SND_11_022;
 		queue->addCommandToEnd(messageCommand("MSG_SC11_RESTARTMAN"));
 		_scene->runQueueObject(queue, nullptr, 4);
@@ -731,7 +731,7 @@ void Sc11Controller::doManToPipe() {
 				// CScene::RunQueueWithAni(scene, queue, hero, 2)
 				MessageQueue *queue = new MessageQueue(interaction->_messageQueue, 0, 0);
 				queue->_scene = _scene;
-				queue->_interruptState = 2;
+				queue->setIntState(2);
 				if (!queue->run(hero())) {
 					delete queue;
 				}
diff --git a/engines/ngi/fullpipe/mobile/sc27controller.cpp b/engines/ngi/fullpipe/mobile/sc27controller.cpp
index e7f07f5561a..72635e721d8 100644
--- a/engines/ngi/fullpipe/mobile/sc27controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc27controller.cpp
@@ -494,7 +494,7 @@ void Sc27Controller::prepareNextBet(int highlighted) {
 	if (rack <= 8 && kRackMovements[rack] != 0) {
 		const int movementId = kRackMovements[rack];
 		MessageQueue *queue = new MessageQueue(_scene, true, 1); // CMessageQueue(scene, 1, 1)
-		queue->_interruptState = 2; // SetIntState(2)
+		queue->setIntState(2);
 		_batHandler->_z = 985;
 		queue->addCommandToEnd(movementCommand(_batHandler, movementId));
 		queue->addCommandToEnd(messageCommand("MSG_SC27_CLICKBET", 0, 3));


Commit: c9e221f18bb29811ff20d49bcdc2d3c61d788e0d
    https://github.com/scummvm/scummvm/commit/c9e221f18bb29811ff20d49bcdc2d3c61d788e0d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: canInteractAny uses the interactions of the object on 201509

Changed paths:
    engines/ngi/interaction.cpp


diff --git a/engines/ngi/interaction.cpp b/engines/ngi/interaction.cpp
index 90ba6e021d1..1cb5ab93c64 100644
--- a/engines/ngi/interaction.cpp
+++ b/engines/ngi/interaction.cpp
@@ -43,6 +43,22 @@ bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId) {
 		sceneId = g_ngi->_currentScene->_sceneId;
 
 	InteractionController *intC = getGameLoaderInteractionController();
+
+	if (g_ngi->_gameVersion >= 201509) {
+		// no counterpart in the original: the interactions of the object are looked up by key like
+		// FindInteraction does, CanRun decides (D56, goes away with D02)
+		if (!obj2)
+			return false;
+		ObjectInteractions *entry = intC->findObjectInteractions(sceneId, (uint16)obj2->_id | (obj2->_copyId << 16));
+		if (!entry)
+			return false;
+		for (Interact *interact : entry->_interacts) {
+			if (interact->canRun())
+				return true;
+		}
+		return false;
+	}
+
 	for (InteractionController::InteractionList::iterator i = intC->_interactions.begin(); i != intC->_interactions.end(); ++i) {
 		Interact *intr = *i;
 


Commit: df6a6d4f6cdba0256783ccbc75b6eddcb7af10a5
    https://github.com/scummvm/scummvm/commit/df6a6d4f6cdba0256783ccbc75b6eddcb7af10a5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: AniObject destructor leaves the shared animation handler alone on 201509

Changed paths:
    engines/ngi/anihandler.cpp
    engines/ngi/debugger/testmode.cpp
    engines/ngi/statics.cpp


diff --git a/engines/ngi/anihandler.cpp b/engines/ngi/anihandler.cpp
index aafe9027cee..eab7b930b89 100644
--- a/engines/ngi/anihandler.cpp
+++ b/engines/ngi/anihandler.cpp
@@ -262,6 +262,10 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
 
 
 	int itemIdx = getIndex(mkQueue->ani->_id);
+	if (itemIdx == -1) {
+		warning("STUB/untested: CAniHandler::MakeRunQueue: object %d is not attached to the handler (the original reads garbage)!", mkQueue->ani->_id);
+		return nullptr;
+	}
 	int subIdx = getStaticIndex(itemIdx, mkQueue->staticsId1);
 	int st2idx = getStaticIndex(itemIdx, mov->_prevStatic->_staticsId);
 	int st1idx = getStaticIndex(itemIdx, mov->_nextStatic->_staticsId);
diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index a5532f4dafd..28be2eed6b9 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -418,6 +418,9 @@ void testmode_update(uint32 elapsed) {
 	if (!g_setupDone) {
 		g_setupDone = true;
 		runSetup();
+		// an earlier scene leaves Dude in the shared animation handler, a direct boot has to do it
+		if (g_ngi->_gameVersion >= 201509 && g_ngi->_aniHandler)
+			g_ngi->_aniHandler->attachObject(hero->_id);
 	}
 	if (!g_spot)
 		return;
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 14b8b96ecd5..580dbb28eb5 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -118,7 +118,9 @@ AniObject::AniObject() {
 AniObject::~AniObject() {
 	Common::for_each(_staticsList.begin(), _staticsList.end(), Common::DefaultDeleter<Statics>());
 	Common::for_each(_movements.begin(), _movements.end(), Common::DefaultDeleter<Movement>());
-	g_ngi->_aniHandler->detachAllObjects();
+	// CAniObject::~CAniObject (F0AEC) leaves the shared handler alone
+	if (g_ngi->_gameVersion < 201509)
+		g_ngi->_aniHandler->detachAllObjects();
 }
 
 AniObject::AniObject(AniObject *src) : GameObject(src) {


Commit: b0b960b6160e948f4b5a7d612fb867ed955b079c
    https://github.com/scummvm/scummvm/commit/b0b960b6160e948f4b5a7d612fb867ed955b079c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: AniObject position is read through pivotX() and pivotY()

Changed paths:
    engines/ngi/anihandler.cpp
    engines/ngi/debugger/testmode.cpp
    engines/ngi/fullpipe/floaters.cpp
    engines/ngi/fullpipe/lift.cpp
    engines/ngi/fullpipe/mobile/exitmanager.cpp
    engines/ngi/fullpipe/mobile/liftcontroller.cpp
    engines/ngi/fullpipe/scene01.cpp
    engines/ngi/fullpipe/scene02.cpp
    engines/ngi/fullpipe/scene03.cpp
    engines/ngi/fullpipe/scene04.cpp
    engines/ngi/fullpipe/scene05.cpp
    engines/ngi/fullpipe/scene06.cpp
    engines/ngi/fullpipe/scene07.cpp
    engines/ngi/fullpipe/scene08.cpp
    engines/ngi/fullpipe/scene09.cpp
    engines/ngi/fullpipe/scene10.cpp
    engines/ngi/fullpipe/scene11.cpp
    engines/ngi/fullpipe/scene12.cpp
    engines/ngi/fullpipe/scene13.cpp
    engines/ngi/fullpipe/scene14.cpp
    engines/ngi/fullpipe/scene15.cpp
    engines/ngi/fullpipe/scene16.cpp
    engines/ngi/fullpipe/scene17.cpp
    engines/ngi/fullpipe/scene18and19.cpp
    engines/ngi/fullpipe/scene20.cpp
    engines/ngi/fullpipe/scene21.cpp
    engines/ngi/fullpipe/scene22.cpp
    engines/ngi/fullpipe/scene23.cpp
    engines/ngi/fullpipe/scene24.cpp
    engines/ngi/fullpipe/scene25.cpp
    engines/ngi/fullpipe/scene26.cpp
    engines/ngi/fullpipe/scene27.cpp
    engines/ngi/fullpipe/scene28.cpp
    engines/ngi/fullpipe/scene29.cpp
    engines/ngi/fullpipe/scene30.cpp
    engines/ngi/fullpipe/scene31.cpp
    engines/ngi/fullpipe/scene32.cpp
    engines/ngi/fullpipe/scene33.cpp
    engines/ngi/fullpipe/scene34.cpp
    engines/ngi/fullpipe/scene35.cpp
    engines/ngi/fullpipe/scene36.cpp
    engines/ngi/fullpipe/scene37.cpp
    engines/ngi/fullpipe/scene38.cpp
    engines/ngi/fullpipe/sceneFinal.cpp
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/gfx.cpp
    engines/ngi/input.cpp
    engines/ngi/interaction.cpp
    engines/ngi/messagehandlers.cpp
    engines/ngi/modal.cpp
    engines/ngi/motion.cpp
    engines/ngi/sound.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/anihandler.cpp b/engines/ngi/anihandler.cpp
index eab7b930b89..aedf6d55d9e 100644
--- a/engines/ngi/anihandler.cpp
+++ b/engines/ngi/anihandler.cpp
@@ -238,8 +238,8 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
 	Common::Point point;
 
 	if (!(mkQueue->flags & 0x10) || !(mkQueue->flags & 0x20)) {
-		int nx = mkQueue->ani->_x;
-		int ny = mkQueue->ani->_y;
+		int nx = mkQueue->ani->pivotX();
+		int ny = mkQueue->ani->pivotY();
 
 		if (mkQueue->ani->_movement) {
 			mkQueue->ani->calcNextStep(&point);
@@ -471,7 +471,7 @@ void AniHandler::putObjectToStatic(AniObject *ani, int staticsId) {
 	if (ani->_statics) {
 		const Common::Point point = getTransitionSize(ani->_id, ani->_statics->_staticsId, staticsId);
 
-		ani->setPos(ani->_x + point.x, ani->_y + point.y);
+		ani->setPos(ani->pivotX() + point.x, ani->pivotY() + point.y);
 
 		ani->_statics = ani->getStatic(staticsId);
 	}
diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 28be2eed6b9..1e6ca7372f5 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -279,7 +279,7 @@ void testmode_getInfo(TestInfo &info) {
 	if (!hero)
 		return;
 	info.hero = true;
-	info.heroPos = Common::Point(hero->_x, hero->_y);
+	info.heroPos = Common::Point(hero->pivotX(), hero->pivotY());
 	info.heroZ = hero->_z;
 	info.heroFlags = hero->_flags;
 	info.heroQueue = hero->_queue ? hero->_queue->_id : hero->_messageQueueId;
@@ -351,7 +351,7 @@ void testmode_update(uint32 elapsed) {
 			ani->_statics ? Common::String::format("statics %s", name(ani->_statics->_staticsId).c_str()) : Common::String("none");
 		const Common::Point topLeft = ani->getPosition();
 		const int frame = ani->_movement ? ani->_movement->_curFrame : -1;
-		const Common::String state = Common::String::format("%s flags %02x z %d at %d,%d topleft %d,%d frame %d", line.c_str(), ani->_flags, ani->_z, ani->_x, ani->_y,
+		const Common::String state = Common::String::format("%s flags %02x z %d at %d,%d topleft %d,%d frame %d", line.c_str(), ani->_flags, ani->_z, ani->pivotX(), ani->pivotY(),
 			topLeft.x, topLeft.y, frame);
 		// watchpos=1: also a line for every frame and position change
 		const uint hash = watchPositions() ? Common::hashit(state.c_str()) : Common::hashit(Common::String::format("%s %02x", line.c_str(), ani->_flags).c_str());
diff --git a/engines/ngi/fullpipe/floaters.cpp b/engines/ngi/fullpipe/floaters.cpp
index 54f3b841754..641d1a74612 100644
--- a/engines/ngi/fullpipe/floaters.cpp
+++ b/engines/ngi/fullpipe/floaters.cpp
@@ -154,7 +154,7 @@ void FlyPack::onUpdate(uint32 elapsed) {
 
 				a2.x += newX;
 				a2.y += newY;
-				a2.ani->setPos(newX + a2.ani->_x, newY + a2.ani->_y);
+				a2.ani->setPos(newX + a2.ani->pivotX(), newY + a2.ani->pivotY());
 
 				if (a2.x == a2.targetX && a2.y == a2.targetY) {
 					a2.speed = 0.0;
diff --git a/engines/ngi/fullpipe/lift.cpp b/engines/ngi/fullpipe/lift.cpp
index f96e1e81a9b..d3af945507d 100644
--- a/engines/ngi/fullpipe/lift.cpp
+++ b/engines/ngi/fullpipe/lift.cpp
@@ -406,7 +406,7 @@ void NGIEngine::lift_walkAndGo() {
 	MessageQueue *mq;
 	Command *ex;
 
-	if (abs(_liftX - _aniMan->_x) > 1 || abs(_liftY - _aniMan->_y) > 1 || _aniMan->_movement || _aniMan->_statics->_staticsId != ST_MAN_UP) {
+	if (abs(_liftX - _aniMan->pivotX()) > 1 || abs(_liftY - _aniMan->pivotY()) > 1 || _aniMan->_movement || _aniMan->_statics->_staticsId != ST_MAN_UP) {
 		mq = getCurrSceneSc2MotionController()->startMove(_aniMan, _liftX, _liftY, 1, ST_MAN_UP);
 
 		if (mq) {
@@ -672,7 +672,7 @@ Command *staticCommand(const AniObject *ani, int staticsId) {
 
 // LiftButtonSort: by the position (y, then x)
 bool liftButtonSort(const AniObject *a, const AniObject *b) {
-	return a->_y == b->_y ? a->_x < b->_x : a->_y < b->_y;
+	return a->pivotY() == b->pivotY() ? a->pivotX() < b->pivotX() : a->pivotY() < b->pivotY();
 }
 
 } // End of anonymous namespace
diff --git a/engines/ngi/fullpipe/mobile/exitmanager.cpp b/engines/ngi/fullpipe/mobile/exitmanager.cpp
index 5d584f46953..cb3886fccb8 100644
--- a/engines/ngi/fullpipe/mobile/exitmanager.cpp
+++ b/engines/ngi/fullpipe/mobile/exitmanager.cpp
@@ -310,11 +310,11 @@ void Exit::onRender(float scrollX, float scrollY) {
 	} else if (_angle == -90.0f) {
 		offsetX = -25.0f;
 	}
-	if ((_arrow->_y - scrollY) + offsetY < 50.0f)
+	if ((_arrow->pivotY() - scrollY) + offsetY < 50.0f)
 		offsetY = 100.0f;
 	const BitmapFont *font = g_ngi->getFont("impact_20.fnt");
 	if (font)
-		font->print(g_ngi->_backgroundSurface, _hint, (_arrow->_x - scrollX) + offsetX, (_arrow->_y - scrollY) + offsetY, 120.0f, 0, BitmapFont::kAlignCenter, 0);
+		font->print(g_ngi->_backgroundSurface, _hint, (_arrow->pivotX() - scrollX) + offsetX, (_arrow->pivotY() - scrollY) + offsetY, 120.0f, 0, BitmapFont::kAlignCenter, 0);
 }
 
 // CExit::OnMouseLKeyDown (144150)
diff --git a/engines/ngi/fullpipe/mobile/liftcontroller.cpp b/engines/ngi/fullpipe/mobile/liftcontroller.cpp
index 4971c2b16db..b1c4d3e9824 100644
--- a/engines/ngi/fullpipe/mobile/liftcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/liftcontroller.cpp
@@ -88,7 +88,7 @@ void LiftController::sortButtons(const Common::Array<AniObject *> &buttons) {
 		const float y = background->_y + 64.0f + (i >> 1) * 85.0f;
 		big->setCenter(Common::Point(x, y));
 		big->setStatic(buttons[i]->_statics->_staticsId - 30);
-		if (i + 1 == buttons.size() && buttons[i]->_x > buttons[0]->_x)
+		if (i + 1 == buttons.size() && buttons[i]->pivotX() > buttons[0]->pivotX())
 			big->setCenter(Common::Point(background->_x + 52 + 65, y));
 
 		Button button;
diff --git a/engines/ngi/fullpipe/scene01.cpp b/engines/ngi/fullpipe/scene01.cpp
index 2e84b698f87..77a648de95e 100644
--- a/engines/ngi/fullpipe/scene01.cpp
+++ b/engines/ngi/fullpipe/scene01.cpp
@@ -144,12 +144,12 @@ int sceneHandler01(Command *cmd) {
 		return 0; // Scene::update drives timed behavior and audio.
 
 	if (g_ngi->_aniMan2) {
-		if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200) {
-			g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+		if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200) {
+			g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 		}
 
-		if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-			g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+		if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+			g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 		res = 1;
 	}
diff --git a/engines/ngi/fullpipe/scene02.cpp b/engines/ngi/fullpipe/scene02.cpp
index ccfa3367d86..d087024118f 100644
--- a/engines/ngi/fullpipe/scene02.cpp
+++ b/engines/ngi/fullpipe/scene02.cpp
@@ -106,11 +106,11 @@ int sceneHandler02(Command *ex) {
 	case kMsgUpdate:
 		// Android: CFPController scrolls, Scene::update drives behaviors and audio.
 		if (g_ngi->_aniMan2 && !g_ngi->isAndroidFullPipe()) {
-			if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200)
-				g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+			if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200)
+				g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 
-			if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-				g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+			if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+				g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 			res = 1;
 		}
diff --git a/engines/ngi/fullpipe/scene03.cpp b/engines/ngi/fullpipe/scene03.cpp
index a03c0a0c639..a97a67b0ca7 100644
--- a/engines/ngi/fullpipe/scene03.cpp
+++ b/engines/ngi/fullpipe/scene03.cpp
@@ -418,11 +418,11 @@ int sceneHandler03(Command *ex) {
 			}
 
 			if (g_ngi->_aniMan2) {
-				if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+				if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 
-				if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+				if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 				res = 1;
 			}
diff --git a/engines/ngi/fullpipe/scene04.cpp b/engines/ngi/fullpipe/scene04.cpp
index 706ab731398..a275936a5cd 100644
--- a/engines/ngi/fullpipe/scene04.cpp
+++ b/engines/ngi/fullpipe/scene04.cpp
@@ -481,8 +481,8 @@ void sceneHandler04_walkClimbLadder(Command *ex) {
 }
 
 void sceneHandler04_clickLadder() {
-	g_vars->scene04_dudePosX = g_ngi->_aniMan->_x;
-	g_vars->scene04_dudePosY = g_ngi->_aniMan->_y;
+	g_vars->scene04_dudePosX = g_ngi->_aniMan->pivotX();
+	g_vars->scene04_dudePosY = g_ngi->_aniMan->pivotY();
 
 	if (g_vars->scene04_dudeOnLadder) {
 		if (!g_ngi->_aniMan->isIdle() || (g_ngi->_aniMan->_flags & 0x100)) {
@@ -1078,7 +1078,7 @@ void sceneHandler04_bottleUpdateObjects(int off) {
 		if ((*it)->_objtype == kObjTypeStaticANIObject) {
 			AniObject *st = static_cast<AniObject *>(*it);
 
-			st->setPos(st->_x, off + st->_y);
+			st->setPos(st->pivotX(), off + st->pivotY());
 		} else {
 			GameObject *obj = *it;
 
@@ -1167,18 +1167,18 @@ void sceneHandler04_leaveScene() {
 }
 
 void sceneHandler04_liftBottle() {
-	int newy = g_vars->scene04_bottleY + g_vars->scene04_spring->_y;
+	int newy = g_vars->scene04_bottleY + g_vars->scene04_spring->pivotY();
 
 	g_vars->scene04_bottleY += 5;
 
-	sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->_y);
+	sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->pivotY());
 
-	g_vars->scene04_spring->setPos(g_vars->scene04_spring->_x, newy);
+	g_vars->scene04_spring->setPos(g_vars->scene04_spring->pivotX(), newy);
 
 	if (g_vars->scene04_bottle->_y >= 226) {
 		sceneHandler04_bottleUpdateObjects(226 - g_vars->scene04_bottle->_y);
 
-		g_vars->scene04_spring->setPos(g_vars->scene04_spring->_x, 437);
+		g_vars->scene04_spring->setPos(g_vars->scene04_spring->pivotX(), 437);
 		g_vars->scene04_bottleIsDropped = false;
 		g_vars->scene04_handIsDown = false;
 		g_vars->scene04_objectIsTaken = true;
@@ -1452,7 +1452,7 @@ void sceneHandler04_updateBottle() {
 		const int delta = hand.bottom + 108 - (spring.top + spring.height() / 2);
 
 		sceneHandler04_bottleUpdateObjects(delta);
-		g_vars->scene04_spring->setPos(g_vars->scene04_spring->_x, g_vars->scene04_spring->_y + delta);
+		g_vars->scene04_spring->setPos(g_vars->scene04_spring->pivotX(), g_vars->scene04_spring->pivotY() + delta);
 		return;
 	}
 
@@ -1461,13 +1461,13 @@ void sceneHandler04_updateBottle() {
 	if (g_vars->scene04_hand->_movement)
 		yoff = g_vars->scene04_hand->_movement->_y;
 	else
-		yoff = g_vars->scene04_hand->_y;
+		yoff = g_vars->scene04_hand->pivotY();
 
 	int newy = g_vars->scene04_hand->getSomeXY().y + yoff + 140;
 
-	sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->_y);
+	sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->pivotY());
 
-	g_vars->scene04_spring->setPos(g_vars->scene04_spring->_x, newy);
+	g_vars->scene04_spring->setPos(g_vars->scene04_spring->pivotX(), newy);
 }
 
 void sceneHandler04_doWinArcade() {
@@ -1917,8 +1917,8 @@ int sceneHandler04(Command *ex) {
 
 	case kMsgUpdate:
 		{
-			g_vars->scene04_dudePosX = g_ngi->_aniMan->_x;
-			g_vars->scene04_dudePosY = g_ngi->_aniMan->_y;
+			g_vars->scene04_dudePosX = g_ngi->_aniMan->pivotX();
+			g_vars->scene04_dudePosY = g_ngi->_aniMan->pivotY();
 
 			int res = 0;
 
@@ -1950,12 +1950,12 @@ int sceneHandler04(Command *ex) {
 			}
 
 			if (g_ngi->_aniMan2) {
-				if (g_ngi->_aniMan->_x < g_ngi->_sceneRect.left + 200) {
-					g_ngi->_currentScene->_x = g_ngi->_aniMan->_x - g_ngi->_sceneRect.left - 300;
-					g_ngi->_aniMan->_x = g_vars->scene04_dudePosX;
+				if (g_ngi->_aniMan->pivotX() < g_ngi->_sceneRect.left + 200) {
+					g_ngi->_currentScene->_x = g_ngi->_aniMan->pivotX() - g_ngi->_sceneRect.left - 300;
+					g_ngi->_aniMan->setPivotX(g_vars->scene04_dudePosX);
 				}
-				if (g_ngi->_aniMan->_x > g_ngi->_sceneRect.right - 200) {
-					g_ngi->_currentScene->_x = g_ngi->_aniMan->_x - g_ngi->_sceneRect.right + 300;
+				if (g_ngi->_aniMan->pivotX() > g_ngi->_sceneRect.right - 200) {
+					g_ngi->_currentScene->_x = g_ngi->_aniMan->pivotX() - g_ngi->_sceneRect.right + 300;
 				}
 
 				res = 1;
diff --git a/engines/ngi/fullpipe/scene05.cpp b/engines/ngi/fullpipe/scene05.cpp
index 51f4523587b..418b6226d8b 100644
--- a/engines/ngi/fullpipe/scene05.cpp
+++ b/engines/ngi/fullpipe/scene05.cpp
@@ -364,11 +364,11 @@ int sceneHandler05(Command *ex) {
 		{
 			int res = 0;
 			if (g_ngi->_aniMan2) {
-				if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+				if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 
-				if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+				if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 				res = 1;
 			}
diff --git a/engines/ngi/fullpipe/scene06.cpp b/engines/ngi/fullpipe/scene06.cpp
index b23b1bb42dc..6fe2ccb5559 100644
--- a/engines/ngi/fullpipe/scene06.cpp
+++ b/engines/ngi/fullpipe/scene06.cpp
@@ -309,8 +309,8 @@ void sceneHandler06_startAiming() {
 
 void sceneHandler06_takeBall() {
 	if (g_vars->scene06_currentBall && !g_vars->scene06_currentBall->_movement && g_vars->scene06_currentBall->_statics->_staticsId == ST_NBL_NORM) {
-		if (abs(1158 - g_ngi->_aniMan->_x) > 1
-			|| abs(452 - g_ngi->_aniMan->_y) > 1
+		if (abs(1158 - g_ngi->_aniMan->pivotX()) > 1
+			|| abs(452 - g_ngi->_aniMan->pivotY()) > 1
 			|| g_ngi->_aniMan->_movement
 			|| g_ngi->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) {
 			MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, 1158, 452, 1, (0x4000 | ST_MAN_RIGHT));
@@ -351,7 +351,7 @@ void sceneHandler06_ballStartFly() {
 	if (g_vars->scene06_ballInHands) {
 		g_vars->scene06_flyingBall = g_vars->scene06_ballInHands;
 		g_vars->scene06_ballInHands = nullptr;
-		g_vars->scene06_flyingBall->show1(g_ngi->_aniMan->_x - 60, g_ngi->_aniMan->_y - 60, -1, 0);
+		g_vars->scene06_flyingBall->show1(g_ngi->_aniMan->pivotX() - 60, g_ngi->_aniMan->pivotY() - 60, -1, 0);
 
 		g_vars->scene06_flyingBall->_z = 27;
 	}
@@ -461,8 +461,8 @@ void sceneHandler06_catchBall() {
 			}
 
 			g_vars->scene06_mumsy->setStatic(ST_MOM_STANDS);
-			g_vars->scene06_mumsy->setPos(point.x + g_vars->scene06_mumsy->_x,
-										  point.y + g_vars->scene06_mumsy->_y);
+			g_vars->scene06_mumsy->setPos(point.x + g_vars->scene06_mumsy->pivotX(),
+										  point.y + g_vars->scene06_mumsy->pivotY());
 		} else {
 			g_vars->scene06_mumsy->setStatic(ST_MOM_STANDS);
 		}
@@ -682,8 +682,8 @@ int sceneHandler06(Command *ex) {
 			int res = 0;
 
 			if (g_ngi->_aniMan2) {
-				int ox = g_ngi->_aniMan2->_x;
-				int oy = g_ngi->_aniMan2->_y;
+				int ox = g_ngi->_aniMan2->pivotX();
+				int oy = g_ngi->_aniMan2->pivotY();
 
 				g_vars->scene06_manX = ox;
 				g_vars->scene06_manY = oy;
@@ -733,8 +733,8 @@ int sceneHandler06(Command *ex) {
 			}
 
 			if (g_vars->scene06_flyingBall) {
-				g_vars->scene06_ballX = g_vars->scene06_flyingBall->_x - g_vars->scene06_ballDeltaX;
-				g_vars->scene06_ballY = g_vars->scene06_flyingBall->_y - g_vars->scene06_ballDeltaY;
+				g_vars->scene06_ballX = g_vars->scene06_flyingBall->pivotX() - g_vars->scene06_ballDeltaX;
+				g_vars->scene06_ballY = g_vars->scene06_flyingBall->pivotY() - g_vars->scene06_ballDeltaY;
 
 				g_vars->scene06_flyingBall->setPos(g_vars->scene06_ballX, g_vars->scene06_ballY);
 
diff --git a/engines/ngi/fullpipe/scene07.cpp b/engines/ngi/fullpipe/scene07.cpp
index 4323cf85324..4b9ceeac2f7 100644
--- a/engines/ngi/fullpipe/scene07.cpp
+++ b/engines/ngi/fullpipe/scene07.cpp
@@ -153,11 +153,11 @@ int sceneHandler07(Command *ex) {
 			int res = 0;
 
 			if (g_ngi->_aniMan2) {
-				if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+				if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 
-				if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+				if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 				res = 1;
 			}
diff --git a/engines/ngi/fullpipe/scene08.cpp b/engines/ngi/fullpipe/scene08.cpp
index 4a2f027b1dc..3c36a3fef9a 100644
--- a/engines/ngi/fullpipe/scene08.cpp
+++ b/engines/ngi/fullpipe/scene08.cpp
@@ -123,8 +123,8 @@ int scene08_updateCursor() {
 		}
 	} else {
 		if (g_ngi->_objectIdAtCursor == PIC_SC8_LADDERD && g_ngi->_cursorId == PIC_CSR_ITN) {
-			if (g_ngi->_aniMan2->_y >= 520) {
-				if (g_ngi->_aniMan2->_y <= 750)
+			if (g_ngi->_aniMan2->pivotY() >= 520) {
+				if (g_ngi->_aniMan2->pivotY() <= 750)
 					g_ngi->_cursorId = PIC_CSR_GOU;
 			} else {
 				g_ngi->_cursorId = PIC_CSR_GOD;
@@ -192,7 +192,7 @@ int sceneHandler08_calcOffset(int off, int flag) {
 }
 
 void sceneHandler08_pushCallback(int *par) {
-	int y = g_ngi->_aniMan->_y + g_ngi->_aniMan->getSomeXY().y;
+	int y = g_ngi->_aniMan->pivotY() + g_ngi->_aniMan->getSomeXY().y;
 
 	if (g_ngi->_aniMan->_statics && g_ngi->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN)
 		y -= 25;
@@ -246,8 +246,8 @@ void sceneHandler08_startArcade() {
 
 void sceneHandler08_airMoves() {
 	if (g_ngi->_aniMan->isIdle() && !(g_ngi->_aniMan->_flags & 0x100)) {
-		int x = g_ngi->_aniMan->_x;
-		int y = g_ngi->_aniMan->_y;
+		int x = g_ngi->_aniMan->pivotX();
+		int y = g_ngi->_aniMan->pivotY();
 
 		if (703 - g_ngi->_aniMan->getSomeXY().y - y < 150) {
 			if (g_ngi->_aniMan->_statics) {
@@ -331,7 +331,7 @@ void sceneHandler08_badLuck() {
 }
 
 void sceneHandler08_sitDown() {
-	g_ngi->_aniMan->setPos(380, g_ngi->_aniMan->_y);
+	g_ngi->_aniMan->setPos(380, g_ngi->_aniMan->pivotY());
 
 	g_ngi->_aniMan->setStatic(ST_MAN8_FLYDOWN);
 	g_ngi->_aniMan->startMovement(MV_MAN8_SITDOWN, 0, -1);
@@ -344,9 +344,9 @@ void sceneHandler08_sitDown() {
 }
 
 void sceneHandler08_calcFlight() {
-	int y = g_vars->scene08_manOffsetY + g_ngi->_aniMan->_y;
+	int y = g_vars->scene08_manOffsetY + g_ngi->_aniMan->pivotY();
 
-	g_ngi->_aniMan->setPos(g_ngi->_aniMan->_x, y);
+	g_ngi->_aniMan->setPos(g_ngi->_aniMan->pivotX(), y);
 
 	g_vars->scene08_manOffsetY += 2;
 
@@ -358,7 +358,7 @@ void sceneHandler08_calcFlight() {
 	if (g_ngi->_aniMan->_statics && g_ngi->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN)
 		y -= 25;
 
-	if (y <= g_vars->scene08_vmyats->_y) {
+	if (y <= g_vars->scene08_vmyats->pivotY()) {
 		g_vars->scene08_vmyats->hide();
 	} else {
 		g_vars->scene08_vmyats->show1(-1, -1, -1, 0);
@@ -367,12 +367,12 @@ void sceneHandler08_calcFlight() {
 			g_vars->scene08_vmyats->startMovement(MV_VMT_DEF, 0, -1);
 	}
 
-	if (g_ngi->_aniMan->_y <= 280 && g_vars->scene08_stairsVisible
+	if (g_ngi->_aniMan->pivotY() <= 280 && g_vars->scene08_stairsVisible
 		&& g_ngi->_aniMan->_statics && g_ngi->_aniMan->_statics->_staticsId == ST_MAN8_HANDSUP) {
 		sceneHandler08_badLuck();
-	} else if (g_ngi->_aniMan->_y > 236 || g_vars->scene08_stairsVisible
+	} else if (g_ngi->_aniMan->pivotY() > 236 || g_vars->scene08_stairsVisible
 				|| !g_ngi->_aniMan->_statics || g_ngi->_aniMan->_statics->_staticsId != ST_MAN8_HANDSUP) {
-		if (g_ngi->_aniMan->_movement || g_ngi->_aniMan->_y < 660
+		if (g_ngi->_aniMan->_movement || g_ngi->_aniMan->pivotY() < 660
 			|| (g_vars->scene08_vmyats->_movement && g_vars->scene08_vmyats->_movement->_curFrame > 0)
 			|| abs(g_vars->scene08_manOffsetY) > 2) {
 			if (g_vars->scene08_manOffsetY >= 0 && !g_ngi->_aniMan->_movement) {
@@ -382,7 +382,7 @@ void sceneHandler08_calcFlight() {
 					g_ngi->_aniMan->setStatic(ST_MAN8_FLYDOWN);
 			}
 
-			if (g_ngi->_aniMan->_y < 500 && !g_ngi->_aniMan->_movement && g_ngi->_aniMan->_statics->_staticsId == ST_MAN8_FLYUP && g_vars->scene08_manOffsetY < 0)
+			if (g_ngi->_aniMan->pivotY() < 500 && !g_ngi->_aniMan->_movement && g_ngi->_aniMan->_statics->_staticsId == ST_MAN8_FLYUP && g_vars->scene08_manOffsetY < 0)
 				g_ngi->_aniMan->startMovement(MV_MAN8_HANDSUP, 0, -1);
 		} else {
 			sceneHandler08_sitDown();
@@ -394,10 +394,10 @@ void sceneHandler08_calcFlight() {
 
 void sceneHandler08_checkEndArcade() {
 	if (g_vars->scene08_flyingUp) {
-		int x = g_ngi->_aniMan->_x;
-		int y = g_vars->scene08_manOffsetY + g_ngi->_aniMan->_y;
+		int x = g_ngi->_aniMan->pivotX();
+		int y = g_vars->scene08_manOffsetY + g_ngi->_aniMan->pivotY();
 
-		if (!((g_vars->scene08_manOffsetY + g_ngi->_aniMan->_y) % 3))
+		if (!((g_vars->scene08_manOffsetY + g_ngi->_aniMan->pivotY()) % 3))
 			g_vars->scene08_manOffsetY--;
 
 		g_ngi->_aniMan->setPos(x, y);
@@ -488,8 +488,8 @@ int sceneHandler08(Command *cmd) {
 				if (g_vars->scene08_inArcade) {
 					int scHeight = g_ngi->_sceneRect.bottom - g_ngi->_sceneRect.top;
 
-					if (g_ngi->_aniMan2->_y < g_ngi->_sceneRect.top + 200) {
-						g_ngi->_sceneRect.top = g_ngi->_aniMan2->_y - 200;
+					if (g_ngi->_aniMan2->pivotY() < g_ngi->_sceneRect.top + 200) {
+						g_ngi->_sceneRect.top = g_ngi->_aniMan2->pivotY() - 200;
 
 						if (g_ngi->_sceneRect.top < 0)
 							g_ngi->_sceneRect.top = 0;
@@ -497,16 +497,16 @@ int sceneHandler08(Command *cmd) {
 						g_ngi->_sceneRect.bottom = scHeight + g_ngi->_sceneRect.top;
 					}
 
-					if (g_ngi->_aniMan2->_y > g_ngi->_sceneRect.bottom - 350) {
-						g_ngi->_sceneRect.bottom = g_ngi->_aniMan2->_y + 350;
-						g_ngi->_sceneRect.top = g_ngi->_aniMan2->_y + 350 - scHeight;
+					if (g_ngi->_aniMan2->pivotY() > g_ngi->_sceneRect.bottom - 350) {
+						g_ngi->_sceneRect.bottom = g_ngi->_aniMan2->pivotY() + 350;
+						g_ngi->_sceneRect.top = g_ngi->_aniMan2->pivotY() + 350 - scHeight;
 					}
 				} else {
-					if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200)
-						g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+					if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200)
+						g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 
-					if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-						g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+					if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+						g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 					res = 1;
 				}
diff --git a/engines/ngi/fullpipe/scene09.cpp b/engines/ngi/fullpipe/scene09.cpp
index 176d9841409..9c8ce33bc39 100644
--- a/engines/ngi/fullpipe/scene09.cpp
+++ b/engines/ngi/fullpipe/scene09.cpp
@@ -89,7 +89,7 @@ void scene09_initScene(Scene *sc) {
 	for (int x = 75; x < 300; x += 75) {
 		AniObject *ani = new AniObject(hanger);
 
-		ani->show1(x + hanger->_x, hanger->_y, MV_VSN_CYCLE2, 0);
+		ani->show1(x + hanger->pivotX(), hanger->pivotY(), MV_VSN_CYCLE2, 0);
 		sc->addAni(ani, 1);
 
 		hng = new Hanger;
@@ -191,12 +191,12 @@ void sceneHandler09_spitterClick() {
 		g_vars->scene09_spitter->resetQueue();
 		g_vars->scene09_spitter->setStatic(ST_PLV_SIT);
 
-		int x = g_vars->scene09_spitter->_x - 10;
-		int y = g_vars->scene09_spitter->_y + 145;
+		int x = g_vars->scene09_spitter->pivotX() - 10;
+		int y = g_vars->scene09_spitter->pivotY() + 145;
 
 		g_vars->scene09_spitter->setPicAniInfo(info);
 
-		if (ABS(x - g_ngi->_aniMan->_x) > 1 || ABS(y - g_ngi->_aniMan->_y) > 1) {
+		if (ABS(x - g_ngi->_aniMan->pivotX()) > 1 || ABS(y - g_ngi->_aniMan->pivotY()) > 1) {
 			MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, x, y, 1, ST_MAN_UP);
 
 			if (mq) {
@@ -264,7 +264,7 @@ void sceneHandler09_showBall() {
 
 		g_vars->scene09_flyingBalls.insert_at(0, ani);
 
-		ani->show1(g_ngi->_aniMan->_x + 94, g_ngi->_aniMan->_y - 162, MV_BALL9_EXPLODE, 0);
+		ani->show1(g_ngi->_aniMan->pivotX() + 94, g_ngi->_aniMan->pivotY() - 162, MV_BALL9_EXPLODE, 0);
 	}
 }
 
@@ -349,9 +349,9 @@ void sceneHandler09_checkHangerCollide() {
 	for (uint b = 0; b < g_vars->scene09_flyingBalls.size(); b++) {
 		AniObject *ball = g_vars->scene09_flyingBalls[b];
 
-		int newx = ball->_x + 5;
+		int newx = ball->pivotX() + 5;
 
-		ball->setPos(newx, ball->_y);
+		ball->setPos(newx, ball->pivotY());
 
 		if (newx <= 1398 || g_vars->scene09_flyingBall) {
 			if (g_vars->scene09_gulperIsPresent)
@@ -372,7 +372,7 @@ void sceneHandler09_checkHangerCollide() {
 		for (int i = 0; i < g_vars->scene09_numMovingHangers; i++) {
 			for (int j = 0; j < 4; j++) {
 				int x1 = newx + g_vars->scene09_hangerOffsets[j].x;
-				int y1 = ball->_y + g_vars->scene09_hangerOffsets[j].y;
+				int y1 = ball->pivotY() + g_vars->scene09_hangerOffsets[j].y;
 
 				// Check 2 pixels to compensate cord width
 				hit = g_vars->scene09_hangers[i]->ani->hit(x1, y1)
@@ -471,9 +471,9 @@ int sceneHandler09(Command *cmd) {
 			int res = 0;
 
 			if (g_ngi->_aniMan2) {
-				int x = g_ngi->_aniMan2->_x;
+				int x = g_ngi->_aniMan2->pivotX();
 
-				g_vars->scene09_dudeY = g_ngi->_aniMan2->_y;
+				g_vars->scene09_dudeY = g_ngi->_aniMan2->pivotY();
 
 				if (x < g_ngi->_sceneRect.left + 200)
 					g_ngi->_currentScene->_x = x - g_ngi->_sceneRect.left - 300;
diff --git a/engines/ngi/fullpipe/scene10.cpp b/engines/ngi/fullpipe/scene10.cpp
index 766f3decad9..57fc214a899 100644
--- a/engines/ngi/fullpipe/scene10.cpp
+++ b/engines/ngi/fullpipe/scene10.cpp
@@ -77,10 +77,10 @@ void sceneHandler10_clickGum() {
 	if (g_vars->scene10_hasGum) {
 		if (sceneHandler10_inflaterIsBlind()) {
 			if (g_vars->scene10_hasGum) {
-				int x = g_vars->scene10_gum->_x - 139;
-				int y = g_vars->scene10_gum->_y - 48;
+				int x = g_vars->scene10_gum->pivotX() - 139;
+				int y = g_vars->scene10_gum->pivotY() - 48;
 
-				if (abs(x - g_ngi->_aniMan->_x) > 1 || abs(y - g_ngi->_aniMan->_y) > 1) {
+				if (abs(x - g_ngi->_aniMan->pivotX()) > 1 || abs(y - g_ngi->_aniMan->pivotY()) > 1) {
 					MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, x, y, 1, ST_MAN_RIGHT);
 					if (mq) {
 						Command *ex = new Command(0, kCmdMessage, MSG_SC10_CLICKGUM, 0, 0, 0, 1, 0, 0, 0);
@@ -197,11 +197,11 @@ int sceneHandler10(Command *ex) {
 			int res = 0;
 
 			if (g_ngi->_aniMan2) {
-				if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+				if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 
-				if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-					g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+				if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+					g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 				res = 1;
 			}
diff --git a/engines/ngi/fullpipe/scene11.cpp b/engines/ngi/fullpipe/scene11.cpp
index 1eaa42d6fcc..c35fb9e752a 100644
--- a/engines/ngi/fullpipe/scene11.cpp
+++ b/engines/ngi/fullpipe/scene11.cpp
@@ -193,7 +193,7 @@ void sceneHandler11_restartMan() {
 }
 
 void sceneHandler11_hitMan() {
-	if (g_ngi->_aniMan->_x > 345 && g_ngi->_aniMan->_x < 355) {
+	if (g_ngi->_aniMan->pivotX() > 345 && g_ngi->_aniMan->pivotX() < 355) {
 		g_ngi->_aniMan->setStatic(ST_MAN_RIGHT);
 
 		MessageQueue *mq = new MessageQueue(g_ngi->_currentScene->findMessageQueue(QU_SC11_MANFALL), 0, 0);
@@ -267,7 +267,7 @@ void sceneHandler11_putABoot() {
 }
 
 void sceneHandler11_putBoot() {
-	if (abs(353 - g_ngi->_aniMan->_x) > 1 || abs(498 - g_ngi->_aniMan->_y) > 1
+	if (abs(353 - g_ngi->_aniMan->pivotX()) > 1 || abs(498 - g_ngi->_aniMan->pivotY()) > 1
 		|| g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
 		MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, 353, 498, 1, ST_MAN_RIGHT);
 
@@ -641,8 +641,8 @@ int sceneHandler11(Command *cmd) {
 
 			if (g_ngi->_aniMan2) {
 				int x, y;
-				x = g_ngi->_aniMan2->_x;
-				y = g_ngi->_aniMan2->_y;
+				x = g_ngi->_aniMan2->pivotX();
+				y = g_ngi->_aniMan2->pivotY();
 
 				g_vars->scene11_dudeX = x;
 				g_vars->scene11_dudeY = y;
diff --git a/engines/ngi/fullpipe/scene12.cpp b/engines/ngi/fullpipe/scene12.cpp
index 5ef38688fcc..4f6da3b058b 100644
--- a/engines/ngi/fullpipe/scene12.cpp
+++ b/engines/ngi/fullpipe/scene12.cpp
@@ -59,11 +59,11 @@ int sceneHandler12(Command *cmd) {
 
 	if (cmd->_cmd == kCmdMessage && cmd->_messageNum == kMsgUpdate) {
 		if (g_ngi->_aniMan2) {
-			if (g_ngi->_aniMan2->_x < g_ngi->_sceneRect.left + 200)
-				g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.left - 300;
+			if (g_ngi->_aniMan2->pivotX() < g_ngi->_sceneRect.left + 200)
+				g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.left - 300;
 
-			if (g_ngi->_aniMan2->_x > g_ngi->_sceneRect.right - 200)
-				g_ngi->_currentScene->_x = g_ngi->_aniMan2->_x - g_ngi->_sceneRect.right + 300;
+			if (g_ngi->_aniMan2->pivotX() > g_ngi->_sceneRect.right - 200)
+				g_ngi->_currentScene->_x = g_ngi->_aniMan2->pivotX() - g_ngi->_sceneRect.right + 300;
 
 			res = 1;
 		}
diff --git a/engines/ngi/fullpipe/scene13.cpp b/engines/ngi/fullpipe/scene13.cpp
index bdf60316617..15602639fe0 100644
--- a/engines/ngi/fullpipe/scene13.cpp
+++ b/engines/ngi/fullpipe/scene13.cpp
@@ -341,7 +341,7 @@ int sceneHandler13(Command *cmd) {
 			int x;
 
 			if (g_ngi->_aniMan2) {
-				x = g_ngi->_aniMan2->_x;
+				x = g_ngi->_aniMan2->pivotX();
 				g_vars->scene13_dudeX = x;
 
 				if (x < g_ngi->_sceneRect.left + 200)
diff --git a/engines/ngi/fullpipe/scene14.cpp b/engines/ngi/fullpipe/scene14.cpp
index fd5b2bae66e..49a08ce33bb 100644
--- a/engines/ngi/fullpipe/scene14.cpp
+++ b/engines/ngi/fullpipe/scene14.cpp
@@ -387,7 +387,7 @@ void sceneHandler14_kickAnimation() {
 	if (g_ngi->_aniMan->_movement) {
 		sceneHandler14_clearCallback();
 
-		if (g_vars->scene14_flyingBall && g_vars->scene14_dudeX - g_vars->scene14_flyingBall->_x < 180) {
+		if (g_vars->scene14_flyingBall && g_vars->scene14_dudeX - g_vars->scene14_flyingBall->pivotX() < 180) {
 			g_ngi->_aniMan->setStatic(g_ngi->_aniMan->_movement->_nextStatic->_staticsId);
 			g_ngi->_aniMan->startMovement(MV_MAN14_KICK, 0, -1);
 
@@ -435,7 +435,7 @@ bool sceneHandler14_arcadeProcessClick(Command *cmd) {
 		if (!cmd->_param) {
 			if (g_vars->scene14_pink) {
 				if (g_vars->scene14_pink->_flags & 4) {
-					if (cmd->_sceneClickX < g_vars->scene14_pink->_x + 40) {
+					if (cmd->_sceneClickX < g_vars->scene14_pink->pivotX() + 40) {
 						handleObjectInteraction(g_ngi->_aniMan, g_vars->scene14_pink, 0);
 						cmd->_cmd = kCmdNone;
 						return true;
@@ -760,8 +760,8 @@ int sceneHandler14(Command *cmd) {
 				if (mov->_id == MV_MAN14_KICK)
 					g_vars->scene14_dudeX = mov->_x + 2 * g_ngi->_aniMan->_movement->_curFrame;
 			} else {
-				g_vars->scene14_dudeX = g_ngi->_aniMan->_x;
-				g_vars->scene14_dudeY = g_ngi->_aniMan->_y;
+				g_vars->scene14_dudeX = g_ngi->_aniMan->pivotX();
+				g_vars->scene14_dudeY = g_ngi->_aniMan->pivotY();
 			}
 
 			mov = g_vars->scene14_grandma->_movement;
@@ -769,12 +769,12 @@ int sceneHandler14(Command *cmd) {
 				g_vars->scene14_grandmaX = mov->_x;
 				g_vars->scene14_grandmaY = mov->_y;
 			} else {
-				g_vars->scene14_grandmaX = g_vars->scene14_grandma->_x;
-				g_vars->scene14_grandmaY = g_vars->scene14_grandma->_y;
+				g_vars->scene14_grandmaX = g_vars->scene14_grandma->pivotX();
+				g_vars->scene14_grandmaY = g_vars->scene14_grandma->pivotY();
 			}
 
 			if (g_ngi->_aniMan2) {
-				int x = g_ngi->_aniMan2->_x;
+				int x = g_ngi->_aniMan2->pivotX();
 				g_vars->scene14_dude2X = x;
 
 				if (x < g_ngi->_sceneRect.left + g_vars->scene14_sceneDeltaX) {
diff --git a/engines/ngi/fullpipe/scene15.cpp b/engines/ngi/fullpipe/scene15.cpp
index 1af62562c3e..34fe7e209cc 100644
--- a/engines/ngi/fullpipe/scene15.cpp
+++ b/engines/ngi/fullpipe/scene15.cpp
@@ -183,7 +183,7 @@ int sceneHandler15(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene16.cpp b/engines/ngi/fullpipe/scene16.cpp
index f98581834b9..e0c3fc186a4 100644
--- a/engines/ngi/fullpipe/scene16.cpp
+++ b/engines/ngi/fullpipe/scene16.cpp
@@ -296,7 +296,7 @@ void sceneHandler16_drink() {
 }
 
 void sceneHandler16_onMugClick() {
-	if (abs(310 - g_ngi->_aniMan->_x) >= 1 || abs(449 - g_ngi->_aniMan->_y) >= 1
+	if (abs(310 - g_ngi->_aniMan->pivotX()) >= 1 || abs(449 - g_ngi->_aniMan->pivotY()) >= 1
 		|| g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
 		MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, 310, 449, 1, ST_MAN_RIGHT);
 
@@ -448,7 +448,7 @@ int sceneHandler16(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene17.cpp b/engines/ngi/fullpipe/scene17.cpp
index 4e66715a962..e56a65d20e8 100644
--- a/engines/ngi/fullpipe/scene17.cpp
+++ b/engines/ngi/fullpipe/scene17.cpp
@@ -230,7 +230,7 @@ int sceneHandler17(Command *cmd) {
 			g_vars->scene17_sceneOldEdgeX = g_vars->scene17_sceneEdgeX;
 
 			if (g_ngi->_aniMan2) {
-				x = g_ngi->_aniMan2->_x;
+				x = g_ngi->_aniMan2->pivotX();
 
 				g_vars->scene17_sceneEdgeX = x;
 
diff --git a/engines/ngi/fullpipe/scene18and19.cpp b/engines/ngi/fullpipe/scene18and19.cpp
index 271e0a9479b..f779a31c654 100644
--- a/engines/ngi/fullpipe/scene18and19.cpp
+++ b/engines/ngi/fullpipe/scene18and19.cpp
@@ -265,8 +265,8 @@ void scene18_initScene1(Scene *sc) {
 		x = g_vars->scene18_boy->_movement->_x;
 		y = g_vars->scene18_boy->_movement->_y;
 	} else {
-		x = g_vars->scene18_boy->_x;
-		y = g_vars->scene18_boy->_y;
+		x = g_vars->scene18_boy->pivotX();
+		y = g_vars->scene18_boy->pivotY();
 	}
 
 	g_vars->scene18_boy->setPos(newx + x, newy + y);
@@ -279,8 +279,8 @@ void scene18_initScene1(Scene *sc) {
 		x = g_vars->scene18_girl->_movement->_x;
 		y = g_vars->scene18_girl->_movement->_y;
 	} else {
-		x = g_vars->scene18_girl->_x;
-		y = g_vars->scene18_girl->_y;
+		x = g_vars->scene18_girl->pivotX();
+		y = g_vars->scene18_girl->pivotY();
 	}
 
 	g_vars->scene18_girl->setPos(newx + x, newy + y);
@@ -377,7 +377,7 @@ int scene19_updateCursor() {
 }
 
 void sceneHandler18_clickBoard() {
-	if (ABS(967 - g_ngi->_aniMan->_x) > 1 || ABS(379 - g_ngi->_aniMan->_y) > 1 || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
+	if (ABS(967 - g_ngi->_aniMan->pivotX()) > 1 || ABS(379 - g_ngi->_aniMan->pivotY()) > 1 || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
 		MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, 967, 379, 1, ST_MAN_RIGHT);
 		Command *ex = new Command(0, kCmdMessage, MSG_SC18_MANREADY, 0, 0, 0, 1, 0, 0, 0);
 
@@ -414,8 +414,8 @@ void sceneHandler18and19_showManJump() {
 		x = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement->_x;
 		y = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement->_y;
 	} else {
-		x = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_x;
-		y = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_y;
+		x = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->pivotX();
+		y = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->pivotY();
 	}
 
 	g_ngi->_aniMan->show1(x + 62, y + 5, MV_MAN18_JUMPTOTRUBA, 0);
@@ -468,8 +468,8 @@ void sceneHandler18and19_showGirlJump() {
 		x = ani->_movement->_x;
 		y = ani->_movement->_y;
 	} else {
-		x = ani->_x;
-		y = ani->_y;
+		x = ani->pivotX();
+		y = ani->pivotY();
 	}
 
 	g_vars->scene18_girl->show1(x - 62, y - 10, MV_GRL18_JUMPFROM, 0);
@@ -505,8 +505,8 @@ void sceneHandler18and19_showBoyJump() {
 		x = ani->_movement->_x;
 		y = ani->_movement->_y;
 	} else {
-		x = ani->_x;
-		y = ani->_y;
+		x = ani->pivotX();
+		y = ani->pivotY();
 	}
 
 	g_vars->scene18_boy->show1(x - 48, y + 8, MV_BOY18_JUMPFROM, 0);
@@ -572,7 +572,7 @@ void sceneHandler18and19_drawRiders() {
 		if (swinger->ani->_movement)
 			swinger->ani->setPos(ix - swinger->ix + swinger->ani->_movement->_x, iy - swinger->iy + swinger->ani->_movement->_y);
 		else
-			swinger->ani->setPos(ix - swinger->ix + swinger->ani->_x, iy - swinger->iy + swinger->ani->_y);
+			swinger->ani->setPos(ix - swinger->ix + swinger->ani->pivotX(), iy - swinger->iy + swinger->ani->pivotY());
 
 		swinger->ix = ix;
 		swinger->iy = iy;
@@ -763,9 +763,9 @@ int sceneHandler18(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
-			g_vars->scene18_manY = g_ngi->_aniMan2->_y;
+			g_vars->scene18_manY = g_ngi->_aniMan2->pivotY();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
@@ -895,9 +895,9 @@ int sceneHandler19(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
-			g_vars->scene18_manY = g_ngi->_aniMan2->_y;
+			g_vars->scene18_manY = g_ngi->_aniMan2->pivotY();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene20.cpp b/engines/ngi/fullpipe/scene20.cpp
index 38ced23175f..ad891186c87 100644
--- a/engines/ngi/fullpipe/scene20.cpp
+++ b/engines/ngi/fullpipe/scene20.cpp
@@ -125,7 +125,7 @@ int sceneHandler20(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene21.cpp b/engines/ngi/fullpipe/scene21.cpp
index 5a3b0f92afd..57884b471cb 100644
--- a/engines/ngi/fullpipe/scene21.cpp
+++ b/engines/ngi/fullpipe/scene21.cpp
@@ -45,8 +45,8 @@ void scene21_initScene(Scene *sc) {
 		g_vars->scene21_giraffeBottom->setStatic(ST_GRFB_HANG);
 		g_vars->scene21_pipeIsOpen = true;
 		g_vars->scene21_wigglePos = 0.0;
-		g_vars->scene21_giraffeBottomX = g_vars->scene21_giraffeBottom->_x;
-		g_vars->scene21_giraffeBottomY = g_vars->scene21_giraffeBottom->_y;
+		g_vars->scene21_giraffeBottomX = g_vars->scene21_giraffeBottom->pivotX();
+		g_vars->scene21_giraffeBottomY = g_vars->scene21_giraffeBottom->pivotY();
 		g_vars->scene21_wiggleTrigger = false;
 	} else {
 		g_vars->scene21_pipeIsOpen = false;
@@ -66,8 +66,8 @@ int scene21_updateCursor() {
 }
 
 void sceneHandler21_doWiggle() {
-	g_vars->scene21_giraffeBottom->setPos((int)(cos(g_vars->scene21_wigglePos) * 4.0) + g_vars->scene21_giraffeBottom->_x,
-										  g_vars->scene21_giraffeBottom->_y);
+	g_vars->scene21_giraffeBottom->setPos((int)(cos(g_vars->scene21_wigglePos) * 4.0) + g_vars->scene21_giraffeBottom->pivotX(),
+										  g_vars->scene21_giraffeBottom->pivotY());
 
 	g_vars->scene21_wigglePos += 0.19635;
 
@@ -116,7 +116,7 @@ int sceneHandler21(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x <= g_ngi->_sceneWidth - 460) {
 				if (x < g_ngi->_sceneRect.left + 200)
diff --git a/engines/ngi/fullpipe/scene22.cpp b/engines/ngi/fullpipe/scene22.cpp
index 3d220536a74..6afa38a751a 100644
--- a/engines/ngi/fullpipe/scene22.cpp
+++ b/engines/ngi/fullpipe/scene22.cpp
@@ -166,8 +166,8 @@ void sceneHandler22_stoolLogic(Command *cmd) {
 
 	if (g_ngi->_aniMan->isIdle() && !(g_ngi->_aniMan->_flags & 0x100)) {
 		if (cmd->_param == ANI_INV_STOOL) {
-			if (abs(841 - g_ngi->_aniMan->_x) <= 1) {
-				if (abs(449 - g_ngi->_aniMan->_y) <= 1) {
+			if (abs(841 - g_ngi->_aniMan->pivotX()) <= 1) {
+				if (abs(449 - g_ngi->_aniMan->pivotY()) <= 1) {
 					runQueue(QU_SC22_PUTSTOOL, 1);
 					g_vars->scene22_interactionIsDisabled = true;
 
@@ -180,8 +180,8 @@ void sceneHandler22_stoolLogic(Command *cmd) {
 		if (cmd->_param == ANI_INV_BOX) {
 			ani = g_ngi->_currentScene->findAniObjectById(ANI_TABURETTE, -1);
 			if (!ani || !(ani->_flags & 4)) {
-				if (abs(841 - g_ngi->_aniMan->_x) <= 1) {
-					if (abs(449 - g_ngi->_aniMan->_y) <= 1) {
+				if (abs(841 - g_ngi->_aniMan->pivotX()) <= 1) {
+					if (abs(449 - g_ngi->_aniMan->pivotY()) <= 1) {
 						runQueueByIdWithAni(g_ngi->_aniMan, QU_SC22_TRYBOX, 1);
 						return;
 					}
@@ -216,8 +216,8 @@ void sceneHandler22_stoolLogic(Command *cmd) {
 
 			ani = g_ngi->_currentScene->findAniObjectById(ANI_TABURETTE, -1);
 			if (ani && (ani->_flags & 4)) {
-				int x = g_ngi->_aniMan->_x;
-				int y = g_ngi->_aniMan->_y;
+				int x = g_ngi->_aniMan->pivotX();
+				int y = g_ngi->_aniMan->pivotY();
 
 				if (sqrt((double)((841 - x) * (841 - x) + (449 - y) * (449 - y)))
 					< sqrt((double)((1075 - x) * (1075 - x) + (449 - y) * (449 - y)))) {
@@ -270,8 +270,8 @@ void sceneHandler22_stoolLogic(Command *cmd) {
 
 				g_vars->scene22_interactionIsDisabled = true;
 			} else {
-				if (abs(1010 - g_ngi->_aniMan->_x) <= 1) {
-					if (abs(443 - g_ngi->_aniMan->_y) <= 1) {
+				if (abs(1010 - g_ngi->_aniMan->pivotX()) <= 1) {
+					if (abs(443 - g_ngi->_aniMan->pivotY()) <= 1) {
 						runQueue(QU_SC22_TRYHANDLE, 1);
 						return;
 					}
@@ -368,7 +368,7 @@ int sceneHandler22(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x <= g_ngi->_sceneWidth - 460) {
 				if (x < g_ngi->_sceneRect.left + 200)
diff --git a/engines/ngi/fullpipe/scene23.cpp b/engines/ngi/fullpipe/scene23.cpp
index d410d794691..8f90acf941d 100644
--- a/engines/ngi/fullpipe/scene23.cpp
+++ b/engines/ngi/fullpipe/scene23.cpp
@@ -289,8 +289,8 @@ void sceneHandler23_spinWheel3() {
 void sceneHandler23_pushButton(Command *cmd) {
 	if (g_ngi->_aniMan->isIdle() || !(g_ngi->_aniMan->_flags & 0x100)) {
 		if (!g_vars->scene23_topReached) {
-			if (g_ngi->_aniMan->_x != 405 || g_ngi->_aniMan->_y != 220) {
-				if (g_ngi->_aniMan->_x != 276 || g_ngi->_aniMan->_y != 438
+			if (g_ngi->_aniMan->pivotX() != 405 || g_ngi->_aniMan->pivotY() != 220) {
+				if (g_ngi->_aniMan->pivotX() != 276 || g_ngi->_aniMan->pivotY() != 438
 					|| g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
 					if (g_ngi->_msgX == 276 && g_ngi->_msgY == 438 )
 						return;
@@ -375,7 +375,7 @@ void sceneHandler23_sendClick(AniObject *ani) {
 
 void sceneHandler23_checkReachingTop() {
 	if (g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_STANDLADDER
-		|| g_ngi->_aniMan->_x != 405 || g_ngi->_aniMan->_y != 220)
+		|| g_ngi->_aniMan->pivotX() != 405 || g_ngi->_aniMan->pivotY() != 220)
 		g_vars->scene23_topReached = false;
 	else
 		g_vars->scene23_topReached = true;
@@ -476,7 +476,7 @@ int sceneHandler23(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene24.cpp b/engines/ngi/fullpipe/scene24.cpp
index 31c3daed6b2..d1dbee1ee99 100644
--- a/engines/ngi/fullpipe/scene24.cpp
+++ b/engines/ngi/fullpipe/scene24.cpp
@@ -99,7 +99,7 @@ void scene24_setPoolState() {
 int sceneHandler24(Command *cmd) {
 	if (cmd->_cmd == kCmdMessage && cmd->_messageNum == kMsgUpdate) {
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200) {
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene25.cpp b/engines/ngi/fullpipe/scene25.cpp
index 73107886fab..f46e8e9ffde 100644
--- a/engines/ngi/fullpipe/scene25.cpp
+++ b/engines/ngi/fullpipe/scene25.cpp
@@ -167,8 +167,8 @@ void sceneHandler25_enterTruba() {
 	g_ngi->_aniMan->resetQueue();
 	g_ngi->_aniMan->setStatic(g_ngi->_aniMan->_statics->_staticsId);
 
-	int x = g_ngi->_aniMan->_x;
-	int y = g_ngi->_aniMan->_y;
+	int x = g_ngi->_aniMan->pivotX();
+	int y = g_ngi->_aniMan->pivotY();
 
 	g_ngi->_aniMan->setPicAniInfo(info);
 
@@ -202,8 +202,8 @@ void sceneHandler25_toLadder() {
 	g_ngi->_aniMan->resetQueue();
 	g_ngi->_aniMan->setStatic(g_ngi->_aniMan->_statics->_staticsId);
 
-	int x = g_ngi->_aniMan->_x;
-	int y = g_ngi->_aniMan->_y;
+	int x = g_ngi->_aniMan->pivotX();
+	int y = g_ngi->_aniMan->pivotY();
 
 	g_ngi->_aniMan->setPicAniInfo(info);
 
@@ -281,8 +281,8 @@ void sceneHandler25_rowShovel() {
 	g_ngi->_aniMan->resetQueue();
 	g_ngi->_aniMan->setStatic(g_ngi->_aniMan->_statics->_staticsId);
 
-	int x = g_ngi->_aniMan->_x;
-	int y = g_ngi->_aniMan->_y;
+	int x = g_ngi->_aniMan->pivotX();
+	int y = g_ngi->_aniMan->pivotY();
 
 	g_ngi->_aniMan->setPicAniInfo(info);
 
@@ -315,8 +315,8 @@ void sceneHandler25_rowHand() {
 	g_ngi->_aniMan->resetQueue();
 	g_ngi->_aniMan->setStatic(g_ngi->_aniMan->_statics->_staticsId);
 
-	int x = g_ngi->_aniMan->_x;
-	int y = g_ngi->_aniMan->_y;
+	int x = g_ngi->_aniMan->pivotX();
+	int y = g_ngi->_aniMan->pivotY();
 
 	g_ngi->_aniMan->setPicAniInfo(info);
 
@@ -369,8 +369,8 @@ void sceneHandler25_tryRow(int obj) {
 	g_ngi->_aniMan->resetQueue();
 	g_ngi->_aniMan->setStatic(ST_MAN_RIGHT | 0x4000);
 
-	int x = g_ngi->_aniMan->_x;
-	int y = g_ngi->_aniMan->_y;
+	int x = g_ngi->_aniMan->pivotX();
+	int y = g_ngi->_aniMan->pivotY();
 
 	g_ngi->_aniMan->setPicAniInfo(info);
 
@@ -436,7 +436,7 @@ void sceneHandler25_backToPipe() {
 }
 
 void sceneHandler25_walkOnLadder(AniObject *ani, Common::Point *pnt, MessageQueue *mq, int flag) {
-	int aniY = ani->_y;
+	int aniY = ani->pivotY();
 	int newx = 0, newy = 0;
 	Common::Point point;
 	Command *ex;
@@ -445,7 +445,7 @@ void sceneHandler25_walkOnLadder(AniObject *ani, Common::Point *pnt, MessageQueu
 		if (ani->_movement) {
 			point = ani->_movement->getMovementSize(0, ani->_movement->_curFrame);
 			newx = point.x;
-			aniY = ani->_y - point.y;
+			aniY = ani->pivotY() - point.y;
 		}
 	}
 
@@ -590,8 +590,8 @@ int sceneHandler25(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
-			int y = g_ngi->_aniMan2->_y;
+			int x = g_ngi->_aniMan2->pivotX();
+			int y = g_ngi->_aniMan2->pivotY();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene26.cpp b/engines/ngi/fullpipe/scene26.cpp
index b96c864ee6e..d32419d78c1 100644
--- a/engines/ngi/fullpipe/scene26.cpp
+++ b/engines/ngi/fullpipe/scene26.cpp
@@ -257,10 +257,10 @@ void sceneHandler26_clickVent(AniObject *ani, Command *cmd) {
 		if (g_ngi->_aniMan->isIdle() && !(g_ngi->_aniMan->_flags & 0x100)) {
 			g_vars->scene26_activeVent = ani;
 
-			int x = ani->_x - 20;
-			int y = ani->_y + 61;
+			int x = ani->pivotX() - 20;
+			int y = ani->pivotY() + 61;
 
-			if (abs(x - g_ngi->_aniMan->_x) > 1 || abs(y - g_ngi->_aniMan->_y) > 1 || g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_UP) {
+			if (abs(x - g_ngi->_aniMan->pivotX()) > 1 || abs(y - g_ngi->_aniMan->pivotY()) > 1 || g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_UP) {
 				MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, x, y, 1, ST_MAN_UP);
 
 				if (mq) {
@@ -337,7 +337,7 @@ int sceneHandler26(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene27.cpp b/engines/ngi/fullpipe/scene27.cpp
index 810f782fc41..c21b19f73ec 100644
--- a/engines/ngi/fullpipe/scene27.cpp
+++ b/engines/ngi/fullpipe/scene27.cpp
@@ -191,15 +191,15 @@ void sceneHandler27_throwBat() {
 }
 
 void sceneHandler27_clickBat(Command *cmd) {
-	int bx = g_vars->scene27_bat->_x - 5;
-	int by = g_vars->scene27_bat->_y - 71;
+	int bx = g_vars->scene27_bat->pivotX() - 5;
+	int by = g_vars->scene27_bat->pivotY() - 71;
 
 #if DBG
 	sceneHandler27_throwBat();
 	return;
 #endif
 
-	if (ABS(bx - g_ngi->_aniMan->_x) > 1 || ABS(by - g_ngi->_aniMan->_y) > 1
+	if (ABS(bx - g_ngi->_aniMan->pivotX()) > 1 || ABS(by - g_ngi->_aniMan->pivotY()) > 1
 		|| g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
 		MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, bx, by, 1, ST_MAN_RIGHT);
 
@@ -231,8 +231,8 @@ void sceneHandler27_startBat(AniObject *bat) {
 	newbat->ani = bat;
 	newbat->powerCos = newbat->power * cos(0.0);
 	newbat->powerSin = newbat->power * sin(0.0);
-	newbat->currX = newbat->powerCos + (double)g_ngi->_aniMan->_x + 42.0;
-	newbat->currY = newbat->powerSin + (double)g_ngi->_aniMan->_y + 58.0;
+	newbat->currX = newbat->powerCos + (double)g_ngi->_aniMan->pivotX() + 42.0;
+	newbat->currY = newbat->powerSin + (double)g_ngi->_aniMan->pivotY() + 58.0;
 
 	bat->_statics = bat->_staticsList[0];
 	bat->setPos((int)newbat->currX, (int)newbat->currY);
@@ -669,7 +669,7 @@ int sceneHandler27(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene28.cpp b/engines/ngi/fullpipe/scene28.cpp
index 6e40cde18da..7e32c37d18d 100644
--- a/engines/ngi/fullpipe/scene28.cpp
+++ b/engines/ngi/fullpipe/scene28.cpp
@@ -62,7 +62,7 @@ void sceneHandler28_lift1ShowAfter() {
 	AniObject *ani = g_ngi->_currentScene->findAniObjectById(ANI_MAN_28, -1);
 
 	g_ngi->_aniMan->_statics = g_ngi->_aniMan->getStatic(ST_MAN_SIT|0x4000);
-	g_ngi->_aniMan->setPos(ani->_x + 7, ani->_y);
+	g_ngi->_aniMan->setPos(ani->pivotX() + 7, ani->pivotY());
 	g_ngi->_aniMan->_z = ani->_z;
 	g_ngi->_aniMan->show1(-1, -1, -1, 0);
 }
@@ -191,7 +191,7 @@ void sceneHandler28_startWork1() {
 	AniObject *man = g_ngi->_currentScene->findAniObjectById(ANI_MAN_28, -1);
 
 	man->_statics = man->getStatic(ST_MAN28_RIGHT);
-	man->setPos(g_ngi->_aniMan->_x, g_ngi->_aniMan->_y);
+	man->setPos(g_ngi->_aniMan->pivotX(), g_ngi->_aniMan->pivotY());
 	man->_z = g_ngi->_aniMan->_z;
 	man->show1(-1, -1, -1, 0);
 
@@ -259,7 +259,7 @@ void sceneHandler28_clickLift(int numLift) {
 	default: break;
 	}
 
-	if (abs(x - g_ngi->_aniMan->_x) > 1 || abs(472 - g_ngi->_aniMan->_y) > 1
+	if (abs(x - g_ngi->_aniMan->pivotX()) > 1 || abs(472 - g_ngi->_aniMan->pivotY()) > 1
 		|| g_ngi->_aniMan->_movement
 		|| g_ngi->_aniMan->_statics->_staticsId != ST_MAN_UP) {
 		debugC(2, kDebugSceneLogic, "scene28: clickLift: overwrite");
@@ -433,7 +433,7 @@ int sceneHandler28(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene29.cpp b/engines/ngi/fullpipe/scene29.cpp
index c463cd40574..f43f93af836 100644
--- a/engines/ngi/fullpipe/scene29.cpp
+++ b/engines/ngi/fullpipe/scene29.cpp
@@ -148,8 +148,8 @@ void sceneHandler29_winArcade() {
 
 void sceneHandler29_shootGreen() {
 	if (g_vars->scene29_greenBalls.size()) {
-		int x = g_vars->scene29_shooter1->_x - 113;
-		int y = g_vars->scene29_shooter1->_y - 48;
+		int x = g_vars->scene29_shooter1->pivotX() - 113;
+		int y = g_vars->scene29_shooter1->pivotY() - 48;
 		AniObject *ani = g_vars->scene29_greenBalls.front();
 		g_vars->scene29_greenBalls.remove_at(0);
 
@@ -162,8 +162,8 @@ void sceneHandler29_shootGreen() {
 
 void sceneHandler29_shootRed() {
 	if (g_vars->scene29_redBalls.size()) {
-		int x = g_vars->scene29_shooter1->_x - 101;
-		int y = g_vars->scene29_shooter1->_y - 14;
+		int x = g_vars->scene29_shooter1->pivotX() - 101;
+		int y = g_vars->scene29_shooter1->pivotY() - 14;
 		AniObject *ani = g_vars->scene29_redBalls.front();
 		g_vars->scene29_redBalls.remove_at(0);
 
@@ -184,8 +184,8 @@ void sceneHandler29_manJump() {
 		g_ngi->_aniMan->startMovement(MV_MAN29_JUMP, 0, -1);
 	}
 
-	g_vars->scene29_manX = g_ngi->_aniMan->_x;
-	g_vars->scene29_manY = g_ngi->_aniMan->_y;
+	g_vars->scene29_manX = g_ngi->_aniMan->pivotX();
+	g_vars->scene29_manY = g_ngi->_aniMan->pivotY();
 }
 
 void sceneHandler29_manBend() {
@@ -198,8 +198,8 @@ void sceneHandler29_manBend() {
 		g_ngi->_aniMan->startMovement(MV_MAN29_BEND, 0, -1);
 	}
 
-	g_vars->scene29_manX = g_ngi->_aniMan->_x;
-	g_vars->scene29_manY = g_ngi->_aniMan->_y;
+	g_vars->scene29_manX = g_ngi->_aniMan->pivotX();
+	g_vars->scene29_manY = g_ngi->_aniMan->pivotY();
 }
 
 bool sceneHandler29_checkRedBallHit(AniObject *ani, int maxx) {
@@ -210,8 +210,8 @@ bool sceneHandler29_checkRedBallHit(AniObject *ani, int maxx) {
 	if (!g_vars->scene29_arcadeIsOn || g_vars->scene29_manIsHit)
 		return false;
 
-	if ((ani->_x >= g_vars->scene29_manX + 42 || ani->_x <= g_vars->scene29_manX + 8)
-		&& (ani->_x < g_vars->scene29_manX + 8 || maxx > g_vars->scene29_manX + 27))
+	if ((ani->pivotX() >= g_vars->scene29_manX + 42 || ani->pivotX() <= g_vars->scene29_manX + 8)
+		&& (ani->pivotX() < g_vars->scene29_manX + 8 || maxx > g_vars->scene29_manX + 27))
 		return false;
 
 	if (!g_ngi->_aniMan->_movement)
@@ -234,12 +234,12 @@ bool sceneHandler29_checkGreenBallHit(AniObject *ani, int maxx) {
 	if (!g_vars->scene29_arcadeIsOn || g_vars->scene29_manIsHit)
 		return false;
 
-	if (ani->_x >= g_vars->scene29_manX + 40) {
+	if (ani->pivotX() >= g_vars->scene29_manX + 40) {
 		if (maxx > g_vars->scene29_manX + 27)
 			return false;
 	} else {
-		if (ani->_x <= g_vars->scene29_manX + 10) {
-			if (ani->_x < g_vars->scene29_manX + 40)
+		if (ani->pivotX() <= g_vars->scene29_manX + 10) {
+			if (ani->pivotX() < g_vars->scene29_manX + 40)
 				return false;
 
 			if (maxx > g_vars->scene29_manX + 27)
@@ -333,8 +333,8 @@ void sceneHandler29_ballHitCheck() {
 	for (int i = (int)g_vars->scene29_flyingGreenBalls.size() - 1; i >= 0; i--) {
 		AniObject *ani = g_vars->scene29_flyingGreenBalls[i];
 
-		x = ani->_x - 30;
-		y = ani->_y;
+		x = ani->pivotX() - 30;
+		y = ani->pivotY();
 
 		if (x >= 186) {
 			if (sceneHandler29_checkGreenBallHit(ani, x)) {
@@ -366,8 +366,8 @@ void sceneHandler29_ballHitCheck() {
 	for (int i = (int)g_vars->scene29_flyingRedBalls.size() - 1; i >= 0; i--) {
 		AniObject *ani = g_vars->scene29_flyingRedBalls[i];
 
-		x = ani->_x - 30;
-		y = ani->_y;
+		x = ani->pivotX() - 30;
+		y = ani->pivotY();
 
 		if (x >= 147) {
 			if (sceneHandler29_checkRedBallHit(ani, x)) {
@@ -479,7 +479,7 @@ void sceneHandler29_clickPorter(Command *cmd) {
 		return;
 	}
 
-	if (g_vars->scene29_manX <= g_vars->scene29_porter->_x) {
+	if (g_vars->scene29_manX <= g_vars->scene29_porter->pivotX()) {
 		if (ABS(351 - g_vars->scene29_manX) > 1 || ABS(443 - g_vars->scene29_manY) > 1
 			|| g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
 			if (g_ngi->_msgX != 351 || g_ngi->_msgY != 443) {
@@ -495,10 +495,10 @@ void sceneHandler29_clickPorter(Command *cmd) {
 			sceneHandler29_manToL();
 		}
 	} else {
-		g_vars->scene29_manX = g_ngi->_aniMan->_x;
-		g_vars->scene29_manY = g_ngi->_aniMan->_y;
+		g_vars->scene29_manX = g_ngi->_aniMan->pivotX();
+		g_vars->scene29_manY = g_ngi->_aniMan->pivotY();
 
-		if (ABS(1582 - g_vars->scene29_manX) > 1 || ABS(445 - g_ngi->_aniMan->_y) > 1
+		if (ABS(1582 - g_vars->scene29_manX) > 1 || ABS(445 - g_ngi->_aniMan->pivotY()) > 1
 			|| g_ngi->_aniMan->_movement || g_ngi->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) {
 			if (g_ngi->_msgX != 1582 || g_ngi->_msgY != 445) {
 				MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_ngi->_aniMan, 1582, 445, 1, (0x4000 | ST_MAN_RIGHT));
@@ -527,8 +527,8 @@ void sceneHandler29_shootersProcess() {
 		}
 	}
 
-	g_vars->scene29_manX = g_ngi->_aniMan->_x;
-	g_vars->scene29_manY = g_ngi->_aniMan->_y;
+	g_vars->scene29_manX = g_ngi->_aniMan->pivotX();
+	g_vars->scene29_manY = g_ngi->_aniMan->pivotY();
 }
 
 void sceneHandler29_shootersEscape() {
@@ -591,8 +591,8 @@ void sceneHandler29_animBearded() {
 		AniObject *ani = g_vars->scene29_bearders[i]->ani;
 
 		if (g_vars->scene29_bearders[i]->wbflag) {
-			int x = ani->_x;
-			int y = ani->_y;
+			int x = ani->pivotX();
+			int y = ani->pivotY();
 
 			if (!ani->_movement && ani->_statics->_staticsId == (ST_BRDCMN_RIGHT | 0x4000)) {
 				x -= 4;
@@ -782,7 +782,7 @@ int sceneHandler29(Command *cmd) {
 				g_ngi->_currentScene->_x = g_vars->scene29_manX - g_ngi->_sceneRect.left - 100;
 
 		} else if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 300)
 				g_ngi->_currentScene->_x = x - 400 - g_ngi->_sceneRect.left;
@@ -791,8 +791,8 @@ int sceneHandler29(Command *cmd) {
 				g_ngi->_currentScene->_x = x + 400 - g_ngi->_sceneRect.right;
 		}
 
-		g_vars->scene29_manX = g_ngi->_aniMan->_x;
-		g_vars->scene29_manY = g_ngi->_aniMan->_y;
+		g_vars->scene29_manX = g_ngi->_aniMan->pivotX();
+		g_vars->scene29_manY = g_ngi->_aniMan->pivotY();
 
 		sceneHandler29_ballHitCheck();
 
diff --git a/engines/ngi/fullpipe/scene30.cpp b/engines/ngi/fullpipe/scene30.cpp
index 5c44b70a86f..a65ffa392a2 100644
--- a/engines/ngi/fullpipe/scene30.cpp
+++ b/engines/ngi/fullpipe/scene30.cpp
@@ -131,7 +131,7 @@ int sceneHandler30(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene31.cpp b/engines/ngi/fullpipe/scene31.cpp
index 0d55730e5a5..d424620c266 100644
--- a/engines/ngi/fullpipe/scene31.cpp
+++ b/engines/ngi/fullpipe/scene31.cpp
@@ -98,7 +98,7 @@ int sceneHandler31(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene32.cpp b/engines/ngi/fullpipe/scene32.cpp
index 7583ac7a01f..a0a259b9b28 100644
--- a/engines/ngi/fullpipe/scene32.cpp
+++ b/engines/ngi/fullpipe/scene32.cpp
@@ -356,7 +356,7 @@ int sceneHandler32(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene33.cpp b/engines/ngi/fullpipe/scene33.cpp
index 98e142d7bb6..f21df54d4d8 100644
--- a/engines/ngi/fullpipe/scene33.cpp
+++ b/engines/ngi/fullpipe/scene33.cpp
@@ -52,7 +52,7 @@ void scene33_initScene(Scene *sc) {
 
 
 	for (int i = 0; i < 9; i++) {
-		g_vars->scene33_ventsX[i] = sc->findAniObjectById(ANI_VENT_33, i)->_x;
+		g_vars->scene33_ventsX[i] = sc->findAniObjectById(ANI_VENT_33, i)->pivotX();
 
 		g_vars->scene33_ventsState[i] = ventsInit[i];
 	}
@@ -111,11 +111,11 @@ void sceneHandler33_switchVent(AniObject *ani) {
 
 void sceneHandler33_processVents() {
 	for (int i = 0; i < 9; i++)
-		if (((g_vars->scene33_cubeX < g_vars->scene33_ventsX[i]) != (g_vars->scene33_cube->_x < g_vars->scene33_ventsX[i]))
+		if (((g_vars->scene33_cubeX < g_vars->scene33_ventsX[i]) != (g_vars->scene33_cube->pivotX() < g_vars->scene33_ventsX[i]))
 			&& g_vars->scene33_ventsState[i] != ventsInit[i])
 				sceneHandler33_switchVent(g_ngi->_currentScene->findAniObjectById(ANI_VENT_33, i));
 
-	g_vars->scene33_cubeX = g_vars->scene33_cube->_x;
+	g_vars->scene33_cubeX = g_vars->scene33_cube->pivotX();
 }
 
 void sceneHandler33_tryCube() {
@@ -213,8 +213,8 @@ void sceneHandler33_clickZones(Command *cmd) {
 		AniObject *ani = g_ngi->_currentScene->_aniObjects[i];
 
 		if (ani->_id == ANI_VENT_33) {
-			int dx = ani->_x - cmd->_sceneClickX;
-			int dy = ani->_y - cmd->_sceneClickY;
+			int dx = ani->pivotX() - cmd->_sceneClickX;
+			int dy = ani->pivotY() - cmd->_sceneClickY;
 			double dist = sqrt((double)(dx * dx + dy * dy));
 
 			if (dist < mindist) {
@@ -249,7 +249,7 @@ int sceneHandler33(Command *cmd) {
 		g_vars->scene33_cube = g_ngi->_currentScene->findAniObjectById(ANI_KUBIK, -1);
 
 		if (g_vars->scene33_cube)
-			g_vars->scene33_cubeX = g_vars->scene33_cube->_x;
+			g_vars->scene33_cubeX = g_vars->scene33_cube->pivotX();
 
 		break;
 
@@ -288,7 +288,7 @@ int sceneHandler33(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene34.cpp b/engines/ngi/fullpipe/scene34.cpp
index 3bbead06d26..1f076ccf2fc 100644
--- a/engines/ngi/fullpipe/scene34.cpp
+++ b/engines/ngi/fullpipe/scene34.cpp
@@ -207,8 +207,8 @@ void sceneHandler34_animateAction(Command *cmd) {
 	if (g_ngi->_aniMan->_movement)
 		return;
 
-	int ox = g_ngi->_aniMan->_x;
-	int oy = g_ngi->_aniMan->_y;
+	int ox = g_ngi->_aniMan->pivotX();
+	int oy = g_ngi->_aniMan->pivotY();
 	AniObject *ani = g_ngi->_currentScene->findAniObjectAtPos(g_ngi->_sceneRect.left + cmd->_x, g_ngi->_sceneRect.top + cmd->_y);
 
 	if (!ani || ani->_id != ANI_VENT_34) {
@@ -447,7 +447,7 @@ int sceneHandler34(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene35.cpp b/engines/ngi/fullpipe/scene35.cpp
index 714867e3d23..c0df3c2db2b 100644
--- a/engines/ngi/fullpipe/scene35.cpp
+++ b/engines/ngi/fullpipe/scene35.cpp
@@ -227,7 +227,7 @@ int sceneHandler35(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene36.cpp b/engines/ngi/fullpipe/scene36.cpp
index 0c8b4ad4f23..476c0610be1 100644
--- a/engines/ngi/fullpipe/scene36.cpp
+++ b/engines/ngi/fullpipe/scene36.cpp
@@ -72,7 +72,7 @@ int sceneHandler36(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/scene37.cpp b/engines/ngi/fullpipe/scene37.cpp
index 43404ad4802..59a5f8078c6 100644
--- a/engines/ngi/fullpipe/scene37.cpp
+++ b/engines/ngi/fullpipe/scene37.cpp
@@ -61,8 +61,8 @@ void scene37_initScene(Scene *sc) {
 	ring = new Ring();
 	ani = sc->findAniObjectById(ANI_GUARD_37, 0);
 	ring->ani = ani;
-	ring->x = ani->_x - 40;
-	ring->y = ani->_x + 40;
+	ring->x = ani->pivotX() - 40;
+	ring->y = ani->pivotX() + 40;
 	ring->numSubRings = 3;
 	ring->subRings[0] = 1;
 	ring->subRings[1] = 4;
@@ -73,8 +73,8 @@ void scene37_initScene(Scene *sc) {
 	ring = new Ring();
 	ani = sc->findAniObjectById(ANI_GUARD_37, 1);
 	ring->ani = ani;
-	ring->x = ani->_x - 40;
-	ring->y = ani->_x + 40;
+	ring->x = ani->pivotX() - 40;
+	ring->y = ani->pivotX() + 40;
 	ring->numSubRings = 3;
 	ring->subRings[0] = 2;
 	ring->subRings[1] = 5;
@@ -85,8 +85,8 @@ void scene37_initScene(Scene *sc) {
 	ring = new Ring();
 	ani = sc->findAniObjectById(ANI_GUARD_37, 2);
 	ring->ani = ani;
-	ring->x = ani->_x - 40;
-	ring->y = ani->_x + 40;
+	ring->x = ani->pivotX() - 40;
+	ring->y = ani->pivotX() + 40;
 	ring->numSubRings = 3;
 	ring->subRings[0] = 3;
 	ring->subRings[1] = 7;
@@ -263,7 +263,7 @@ int sceneHandler37(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			g_vars->scene37_dudeX = x;
 
diff --git a/engines/ngi/fullpipe/scene38.cpp b/engines/ngi/fullpipe/scene38.cpp
index 632b8f12dc9..eee62a0a70e 100644
--- a/engines/ngi/fullpipe/scene38.cpp
+++ b/engines/ngi/fullpipe/scene38.cpp
@@ -38,7 +38,7 @@ namespace NGI {
 void scene38_setBottleState(Scene *sc) {
 	Command *ex = sc->findMessageQueue(QU_SC38_SHOWBOTTLE_ONTABLE)->getCommandByIndex(0);
 
-	if (g_vars->scene38_bottle->_x == ex->_x && g_vars->scene38_bottle->_y == ex->_y) {
+	if (g_vars->scene38_bottle->pivotX() == ex->_x && g_vars->scene38_bottle->pivotY() == ex->_y) {
 		if (g_ngi->lift_checkButton(sO_Level5) ) {
 			ex = sc->findMessageQueue(QU_SC38_SHOWBOTTLE)->getCommandByIndex(0);
 
@@ -93,7 +93,7 @@ void sceneHandler38_tryTakeBottle() {
 }
 
 void sceneHandler38_onPostHmrKick() {
-	g_vars->scene38_domino1->setPos(g_vars->scene38_domino1->_x, g_vars->scene38_domino1->_y + 2);
+	g_vars->scene38_domino1->setPos(g_vars->scene38_domino1->pivotX(), g_vars->scene38_domino1->pivotY() + 2);
 }
 
 void sceneHandler38_onPropose() {
@@ -136,7 +136,7 @@ void sceneHandler38_hammerKick() {
 		}
 	}
 
-	g_vars->scene38_domino1->setPos(g_vars->scene38_domino1->_x, g_vars->scene38_domino1->_y - 2);
+	g_vars->scene38_domino1->setPos(g_vars->scene38_domino1->pivotX(), g_vars->scene38_domino1->pivotY() - 2);
 
 	if (g_vars->scene38_dominos->_statics->_staticsId == ST_DMS_3)
 		g_vars->scene38_dominos->startMovement(MV_DMS_THREE, 0, -1);
@@ -384,7 +384,7 @@ int sceneHandler38(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			int x = g_ngi->_aniMan2->_x;
+			int x = g_ngi->_aniMan2->pivotX();
 
 			if (x < g_ngi->_sceneRect.left + 200)
 				g_ngi->_currentScene->_x = x - 300 - g_ngi->_sceneRect.left;
diff --git a/engines/ngi/fullpipe/sceneFinal.cpp b/engines/ngi/fullpipe/sceneFinal.cpp
index 42579d8008f..38cdf525eb3 100644
--- a/engines/ngi/fullpipe/sceneFinal.cpp
+++ b/engines/ngi/fullpipe/sceneFinal.cpp
@@ -165,7 +165,7 @@ int sceneHandlerFinal(Command *cmd) {
 
 	case kMsgUpdate:
 		if (g_ngi->_aniMan2) {
-			g_vars->sceneFinal_var03 = g_ngi->_aniMan2->_x;
+			g_vars->sceneFinal_var03 = g_ngi->_aniMan2->pivotX();
 
 			if (g_vars->sceneFinal_var03 < 450 && g_vars->sceneFinal_var02 >= 450 )
 				sceneHandlerFinal_fallCoin();
diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index 10d77e3f7ef..6c5f49cf3fd 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -544,8 +544,8 @@ int NGIEngine::getSceneFromTag(int tag) {
 
 void NGIEngine::sceneAutoScrolling() {
 	if (_aniMan2 == _aniMan && _currentScene && !_currentScene->_messageQueueId) {
-		if (800 - _mouseScreenPos.x >= 47 || _sceneRect.right >= _sceneWidth - 1 || _aniMan->_x <= _sceneRect.left + 230) {
-			if (_mouseScreenPos.x < 47 && _sceneRect.left > 0 && _aniMan->_x < _sceneRect.right - 230)
+		if (800 - _mouseScreenPos.x >= 47 || _sceneRect.right >= _sceneWidth - 1 || _aniMan->pivotX() <= _sceneRect.left + 230) {
+			if (_mouseScreenPos.x < 47 && _sceneRect.left > 0 && _aniMan->pivotX() < _sceneRect.right - 230)
 				_currentScene->_x = -10;
 		} else {
 			_currentScene->_x = 10;
@@ -647,7 +647,7 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 			}
 			if (ref.staticsId)
 				actor->_statics = actor->getStatic(ref.staticsId);
-			actor->setPos(ref.ox == -1 ? actor->_x : ref.ox, ref.oy == -1 ? actor->_y : ref.oy);
+			actor->setPos(ref.ox == -1 ? actor->pivotX() : ref.ox, ref.oy == -1 ? actor->pivotY() : ref.oy);
 			if (ref.priority != -1)
 				actor->_z = ref.priority;
 			if (ref.objectFlags != -1) {
diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index fff66dd5412..4a84fd93271 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -322,7 +322,7 @@ static bool textureQuad(const GameObject *object, Common::Point &topLeft, Dims &
 	anchor = ani->getSomeXY();
 	if (ani->_flags & 8)
 		anchor.x = size.x - anchor.x;
-	topLeft = Common::Point(ani->_x, ani->_y) - anchor;
+	topLeft = Common::Point(ani->pivotX(), ani->pivotY()) - anchor;
 	return true;
 }
 
@@ -563,8 +563,8 @@ bool GameObject::getPicAniInfo(PicAniInfo &info) {
 			info.ox = ani->_movement->_x;
 			info.oy = ani->_movement->_y;
 		} else {
-			info.ox = ani->_x;
-			info.oy = ani->_y;
+			info.ox = ani->pivotX();
+			info.oy = ani->pivotY();
 		}
 		info.priority = ani->_z;
 
diff --git a/engines/ngi/input.cpp b/engines/ngi/input.cpp
index aea73a3e472..ff81b44d951 100644
--- a/engines/ngi/input.cpp
+++ b/engines/ngi/input.cpp
@@ -340,9 +340,9 @@ void NGIEngine::processArcade(Command *cmd) {
 
 	int idx;
 
-	if (cmd->_sceneClickX <= g_ngi->_aniMan2->_x) {
+	if (cmd->_sceneClickX <= g_ngi->_aniMan2->pivotX()) {
 		for (idx = (int)_arcadeKeys.size() - 1; idx >= 0; idx--) {
-			if (_arcadeKeys[idx].x < g_ngi->_aniMan2->_x)
+			if (_arcadeKeys[idx].x < g_ngi->_aniMan2->pivotX())
 				break;
 		}
 
@@ -350,7 +350,7 @@ void NGIEngine::processArcade(Command *cmd) {
 			return;
 	} else {
 		for (idx = 0; idx < (int)_arcadeKeys.size(); idx++) {
-			if (_arcadeKeys[idx].x > g_ngi->_aniMan2->_x)
+			if (_arcadeKeys[idx].x > g_ngi->_aniMan2->pivotX())
 				break;
 		}
 
diff --git a/engines/ngi/interaction.cpp b/engines/ngi/interaction.cpp
index 1cb5ab93c64..c5438ea37a1 100644
--- a/engines/ngi/interaction.cpp
+++ b/engines/ngi/interaction.cpp
@@ -229,7 +229,7 @@ bool InteractionController::handleInteraction(AniObject *subj, GameObject *obj,
 
 			obj->setPicAniInfo(aniInfo);
 
-			if (abs(xpos - subj->_x) > 1 || abs(ypos - subj->_y) > 1) {
+			if (abs(xpos - subj->pivotX()) > 1 || abs(ypos - subj->pivotY()) > 1) {
 				debugC(0, kDebugPathfinding, "Calling makeQueue() at [%d, %d]", xpos, ypos);
 				mq = getSc2MctlCompoundBySceneId(g_ngi->_currentScene->_sceneId)->makeQueue(subj, xpos, ypos, 1, cinter->_heroStaticId, cinter->_heroMirror);
 				if (mq) {
@@ -401,7 +401,7 @@ bool InteractionController::handleInteraction(AniObject *subj, GameObject *obj,
 
 		obj->setPicAniInfo(aniInfo);
 
-		if (abs(xpos - subj->_x) > 1 || abs(ypos - subj->_y) > 1
+		if (abs(xpos - subj->pivotX()) > 1 || abs(ypos - subj->pivotY()) > 1
 				|| (inter->_heroStaticId != 0 && (subj->_statics == nullptr || subj->_statics->_staticsId != inter->_heroStaticId))) {
 			mq = getSc2MctlCompoundBySceneId(g_ngi->_currentScene->_sceneId)->startMove(subj, xpos, ypos, 1, inter->_heroStaticId, inter->_heroMirror);
 
@@ -617,8 +617,8 @@ bool Interact::canRun(GameObject *obj1, GameObject *obj2, int invId) {
 }
 
 bool Interact::isOverlapping(AniObject *subj, GameObject *obj) {
-	if (abs(_heroOffsetX + obj->_x - subj->_x) <= 1
-		&& abs(obj->_y + _heroOffsetY - subj->_y) <= 1) {
+	if (abs(_heroOffsetX + obj->_x - subj->pivotX()) <= 1
+		&& abs(obj->_y + _heroOffsetY - subj->pivotY()) <= 1) {
 		if (!_heroStaticId || (subj->_statics != nullptr && subj->_statics->_staticsId == _heroStaticId)) {
 			if (!_objectStaticId || !(_flags & 1))
 				return true;
@@ -843,7 +843,7 @@ void Interact::run(Scene *scene) {
 			const int curFrame = ani->getCurFrame();
 			Movement *movement = ani->_movement;
 			debugC(1, kDebugInfo, "INFO t %u INTERACTION %s: the movement %d of %d runs (frame %d of %d) at %d,%d, center %d,%d", g_system->getMillis(), _actionName.c_str(), movement->_id, ani->_id,
-				curFrame, (int)movement->_phases.size(), ani->_x, ani->_y, ani->getCenter().x, ani->getCenter().y);
+				curFrame, (int)movement->_phases.size(), ani->pivotX(), ani->pivotY(), ani->getCenter().x, ani->getCenter().y);
 			fromStatics = movement->_nextStatic->_staticsId;
 			const bool mirror = (ani->_flags & 8) != 0;
 			ani->stopMovementToPrev(false);
@@ -858,7 +858,7 @@ void Interact::run(Scene *scene) {
 
 		MessageQueue *linked = ani->getLinkedMovements(fromStatics, _objectStaticId);
 		debugC(1, kDebugInfo, "INFO t %u INTERACTION %s runs: the object %d stands at %d,%d (center %d,%d) in the statics %d, wants %d, restart %d, %d linked movements", g_system->getMillis(),
-			_actionName.c_str(), ani->_id, ani->_x, ani->_y, ani->getCenter().x, ani->getCenter().y, ani->getStaticsId(), _objectStaticId, restart != nullptr, (int)linked->getCount());
+			_actionName.c_str(), ani->_id, ani->pivotX(), ani->pivotY(), ani->getCenter().x, ani->getCenter().y, ani->getStaticsId(), _objectStaticId, restart != nullptr, (int)linked->getCount());
 		if (linked->getCount() != 0 || restart) {
 			MessageQueue *queue = scene->addInteractionQueue(linked, this);
 			if (restart)
diff --git a/engines/ngi/messagehandlers.cpp b/engines/ngi/messagehandlers.cpp
index 760f4fe7424..272693397ed 100644
--- a/engines/ngi/messagehandlers.cpp
+++ b/engines/ngi/messagehandlers.cpp
@@ -480,7 +480,7 @@ int global_messageHandler3(Command *cmd) {
 			}
 			ani = g_ngi->_currentScene->findAniObjectById(g_ngi->_gameLoader->_heroId, -1);
 			if (ani) {
-				getGameLoaderInventory()->removeItem2(g_ngi->_currentScene, cmd->_parentId, ani->_x + cmd->_x, ani->_y + cmd->_y, ani->_z + cmd->_z);
+				getGameLoaderInventory()->removeItem2(g_ngi->_currentScene, cmd->_parentId, ani->pivotX() + cmd->_x, ani->pivotY() + cmd->_y, ani->_z + cmd->_z);
 				getGameLoaderInventory()->recalcItemPos();
 				return 1;
 			}
@@ -749,7 +749,7 @@ int global_messageHandler4(Command *cmd) {
 
 		if (g_ngi->_gameVersion >= 201509) {
 			const bool mirror = cmd->_auxParam < 0 ? (ani->_flags & 8) != 0 : cmd->_auxParam != 0;
-			ani->show1(cmd->_x == -1 ? ani->_x : cmd->_x, cmd->_y == -1 ? ani->_y : cmd->_y, cmd->_messageNum, (cmd->_excFlags & 1) ? 0 : cmd->_parId);
+			ani->show1(cmd->_x == -1 ? ani->pivotX() : cmd->_x, cmd->_y == -1 ? ani->pivotY() : cmd->_y, cmd->_messageNum, (cmd->_excFlags & 1) ? 0 : cmd->_parId);
 			ani->_flags = (ani->_flags & ~8) | (mirror ? 8 : 0);
 		} else {
 			ani->show1(cmd->_x, cmd->_y, cmd->_messageNum, cmd->_parId);
@@ -868,8 +868,8 @@ int MovGraph::messageHandler(Command *cmd) {
 	Common::Point point;
 
 	for (LinkList::iterator i = gr->_links.begin(); i != gr->_links.end(); ++i) {
-		point.x = ani->_x;
-		point.y = ani->_y;
+		point.x = ani->pivotX();
+		point.y = ani->pivotY();
 
 		double dst = gr->putToLink(&point, *i, 0);
 		if (dst >= 0.0 && dst < mindistance) {
@@ -883,13 +883,13 @@ int MovGraph::messageHandler(Command *cmd) {
 	if (link) {
 		MovGraphNode *node = link->_graphSrc;
 
-		double sq = (ani->_y - node->_y) * (ani->_y - node->_y) + (ani->_x - node->_x) * (ani->_x - node->_x);
+		double sq = (ani->pivotY() - node->_y) * (ani->pivotY() - node->_y) + (ani->pivotX() - node->_x) * (ani->pivotX() - node->_x);
 		int off = (node->_z >> 16) & 0xFF;
 		double off2 = ((link->_graphDst->_z >> 8) & 0xff) - off;
 
 		top = off + (int)(sqrt(sq) * off2 / link->_length);
 	} else {
-		top = (gr->findNearestNode(ani->_x, ani->_y)->_z >> 8) & 0xff;
+		top = (gr->findNearestNode(ani->pivotX(), ani->pivotY())->_z >> 8) & 0xff;
 	}
 
 	if (ani->_movement) {
diff --git a/engines/ngi/modal.cpp b/engines/ngi/modal.cpp
index 1c97f284b0d..37a7aa13662 100644
--- a/engines/ngi/modal.cpp
+++ b/engines/ngi/modal.cpp
@@ -1573,21 +1573,21 @@ void MainMenu::updateSoundVolume(Sound &snd) {
 
 	int a, b;
 
-	if (ani->_x >= _screct.left) {
+	if (ani->pivotX() >= _screct.left) {
 		int par, pan;
 
-		if (ani->_x <= _screct.right) {
+		if (ani->pivotX() <= _screct.right) {
 			int dx;
 
-			if (ani->_y <= _screct.bottom) {
-				if (ani->_y >= _screct.top) {
+			if (ani->pivotY() <= _screct.bottom) {
+				if (ani->pivotY() >= _screct.top) {
 					snd.attenuate(g_ngi->_sfxVolume, 0);
 
 					return;
 				}
-				dx = _screct.top - ani->_y;
+				dx = _screct.top - ani->pivotY();
 			} else {
-				dx = ani->_y - _screct.bottom;
+				dx = ani->pivotY() - _screct.bottom;
 			}
 
 			par = 0;
@@ -1601,7 +1601,7 @@ void MainMenu::updateSoundVolume(Sound &snd) {
 			a = g_ngi->_sfxVolume - (-3500);
 			b = 800 - dx;
 		} else {
-			int dx = ani->_x - _screct.right;
+			int dx = ani->pivotX() - _screct.right;
 
 			if (dx > 800) {
 				snd.attenuate(-3500, 0);
@@ -1621,7 +1621,7 @@ void MainMenu::updateSoundVolume(Sound &snd) {
 		return;
 	}
 
-	int dx = _screct.left - ani->_x;
+	int dx = _screct.left - ani->pivotX();
 	if (dx <= 800) {
 		int32 s = (800 - dx) * (g_ngi->_sfxVolume - (-3500));
 		int32 p = -3500 + s / 800;
diff --git a/engines/ngi/motion.cpp b/engines/ngi/motion.cpp
index 981a9b57689..597b146a95f 100644
--- a/engines/ngi/motion.cpp
+++ b/engines/ngi/motion.cpp
@@ -239,7 +239,7 @@ MessageQueue *MctlCompound::startMove(AniObject *ani, int sourceX, int sourceY,
 
 	for (uint i = 0; i < _motionControllers.size(); i++) {
 		if (_motionControllers[i]->_movGraphReactObj) {
-			if (_motionControllers[i]->_movGraphReactObj->hitTest(ani->_x, ani->_y)) {
+			if (_motionControllers[i]->_movGraphReactObj->hitTest(ani->pivotX(), ani->pivotY())) {
 				idx = i;
 				break;
 			}
@@ -266,7 +266,7 @@ MessageQueue *MctlCompound::startMove(AniObject *ani, int sourceX, int sourceY,
 		return _motionControllers[idx]->_motionControllerObj->startMove(ani, sourceX, sourceY, fuzzyMatch, staticsId, mirror);
 
 	double dist;
-	MctlConnectionPoint *cp = getNextPoint(ani->_x, ani->_y, idx, sourceX, sourceY, sourceIdx, &dist);
+	MctlConnectionPoint *cp = getNextPoint(ani->pivotX(), ani->pivotY(), idx, sourceX, sourceY, sourceIdx, &dist);
 
 	if (!cp)
 		return nullptr;
@@ -310,11 +310,11 @@ MessageQueue *MctlCompound::makeQueue(AniObject *subj, int xpos, int ypos, int f
 		return nullptr;
 
 	// --debugflags=info: logged walks (scripts/ngi_play_actions.sh keeps them)
-	debugC(1, kDebugInfo, "INFO t %u WALK of %d from %d,%d to %d,%d fuzzy %d statics %d", g_system->getMillis(), subj->_id, subj->_x, subj->_y, xpos, ypos, fuzzyMatch, staticsId);
+	debugC(1, kDebugInfo, "INFO t %u WALK of %d from %d,%d to %d,%d fuzzy %d statics %d", g_system->getMillis(), subj->_id, subj->pivotX(), subj->pivotY(), xpos, ypos, fuzzyMatch, staticsId);
 
 	for (uint i = 0; i < _motionControllers.size(); i++) {
 		if (_motionControllers[i]->_movGraphReactObj) {
-			if (_motionControllers[i]->_movGraphReactObj->hitTest(subj->_x, subj->_y)) {
+			if (_motionControllers[i]->_movGraphReactObj->hitTest(subj->pivotX(), subj->pivotY())) {
 				match1 = i;
 				break;
 			}
@@ -322,7 +322,7 @@ MessageQueue *MctlCompound::makeQueue(AniObject *subj, int xpos, int ypos, int f
 	}
 
 	if (match1 == -1) {
-		debugC(1, kDebugInfo, "INFO t %u WALK refused: the start %d,%d is on no motion controller", g_system->getMillis(), subj->_x, subj->_y);
+		debugC(1, kDebugInfo, "INFO t %u WALK refused: the start %d,%d is on no motion controller", g_system->getMillis(), subj->pivotX(), subj->pivotY());
 		return nullptr;
 	}
 
@@ -347,7 +347,7 @@ MessageQueue *MctlCompound::makeQueue(AniObject *subj, int xpos, int ypos, int f
 	}
 
 	double dist;
-	MctlConnectionPoint *closestP = getNextPoint(subj->_x, subj->_y, match1, xpos, ypos, match2, &dist);
+	MctlConnectionPoint *closestP = getNextPoint(subj->pivotX(), subj->pivotY(), match1, xpos, ypos, match2, &dist);
 
 	if (!closestP)
 		return nullptr;
@@ -405,7 +405,7 @@ int MctlLadder::getCurrentStep(AniObject *man) {
 	double delta;
 
 	// CMctlLadder::GetCurrentStep (1AD008): the height is the y of the center
-	const int manY = g_ngi->_gameVersion >= 201509 ? man->getCenter().y : man->_y;
+	const int manY = g_ngi->_gameVersion >= 201509 ? man->getCenter().y : man->pivotY();
 
 	if ((double)(manY - _y) / (double)_stepY < 0.0)
 		delta = -0.5;
@@ -548,7 +548,7 @@ MessageQueue *MctlLadder::makeQueue(AniObject *ani, int xpos, int ypos, int fuzz
 		warning("STUB/untested: CMctlLadder::MakeQueue / StartMove (the ladder of scene 4): played up and down from the foot, from ST_MAN_STANDLADDER and from the idle ST_MAN_LADDERDOWN with the scene 4 controller running the scene (not the shipped state, D02); not played: the cases of the idle statics ST_MAN_GOLADDER / ST_MAN_GOLADDERD and a call while a movement runs");
 	}
 	// CMctlLadder::MakeQueue (1AD110): every height is the y of the center of the object
-	const int aniY = revised ? ani->getCenter().y : ani->_y;
+	const int aniY = revised ? ani->getCenter().y : ani->pivotY();
 	double dh = _stepY;
 	double corr = (double)(aniY - _y) / dh;
 	int dl = (int)(corr + (corr < 0.0 ? -0.5 : 0.5));
@@ -578,8 +578,8 @@ MessageQueue *MctlLadder::makeQueue(AniObject *ani, int xpos, int ypos, int fuzz
 			ani->stopMovement(false);
 			return makeQueue(ani, normx, normy, fuzzyMatch, staticsId, mirror);
 		} else {
-			int ox = ani->_x;
-			int oy = ani->_y;
+			int ox = ani->pivotX();
+			int oy = ani->pivotY();
 
 			point = ani->_movement->getMovementSize(1, ani->_targetFrame);
 			ani->_statics = ani->_movement->_nextStatic;
@@ -630,7 +630,7 @@ MessageQueue *MctlLadder::makeQueue(AniObject *ani, int xpos, int ypos, int fuzz
 		}
 
 		// CMctlLadder::MakeQueue reads +40, +44 (top left), not the center
-		const Common::Point topLeft = revised ? ani->getPosition() : Common::Point(ani->_x, ani->_y);
+		const Common::Point topLeft = revised ? ani->getPosition() : Common::Point(ani->pivotX(), ani->pivotY());
 		int ox = topLeft.x;
 		int oy = topLeft.y;
 
@@ -689,8 +689,8 @@ MessageQueue *MctlLadder::makeQueue(AniObject *ani, int xpos, int ypos, int fuzz
 			return mq;
 		}
 
-		int nx = ani->_x;
-		int ny = ani->_y;
+		int nx = ani->pivotX();
+		int ny = ani->pivotY();
 
 		point = _aniHandler.getTransitionSize(ani->_id, ani->_statics->_staticsId, _ladmovements[pos]->staticIds[0]);
 
@@ -716,7 +716,7 @@ MessageQueue *MctlLadder::makeQueue(AniObject *ani, int xpos, int ypos, int fuzz
 
 	if (!direction) {
 		// +40, +44
-		const Common::Point topLeft = revised ? ani->getPosition() : Common::Point(ani->_x, ani->_y);
+		const Common::Point topLeft = revised ? ani->getPosition() : Common::Point(ani->pivotX(), ani->pivotY());
 		int nx = topLeft.x;
 		int ny = topLeft.y;
 
@@ -1028,10 +1028,10 @@ Common::Array<PathDesc *> *MovGraph::getPaths(AniObject *ani, int x, int y, int
 
 	Common::Point point;
 
-	point.x = ani->_x;
-	point.y = ani->_y;
+	point.x = ani->pivotX();
+	point.y = ani->pivotY();
 
-	if (!getHitPoint(idx, ani->_x, ani->_y, &_items[idx].currentPath, 0))
+	if (!getHitPoint(idx, ani->pivotX(), ani->pivotY(), &_items[idx].currentPath, 0))
 		getNearestPoint(idx, &point, &_items[idx].currentPath);
 
 	_items[idx].candidatePathCount = 0;
@@ -1137,7 +1137,7 @@ MessageQueue *MovGraph::startMove(AniObject *ani, int xpos, int ypos, int fuzzyM
 		ani = _items[0].ani;
 	}
 
-	if (ABS(ani->_x - xpos) < 50 && ABS(ani->_y - ypos) < 50)
+	if (ABS(ani->pivotX() - xpos) < 50 && ABS(ani->pivotY() - ypos) < 50)
 		return nullptr;
 
 	if (!ani->isIdle())
@@ -1157,7 +1157,7 @@ MessageQueue *MovGraph::startMove(AniObject *ani, int xpos, int ypos, int fuzzyM
 
 		ani->calcStepLen(&point);
 
-		MessageQueue *mq = sub1(ani, ani->_x - point.x, ani->_y - point.y, ani->_movement->_prevStatic->_staticsId, xpos, ypos, 0, fuzzyMatch);
+		MessageQueue *mq = sub1(ani, ani->pivotX() - point.x, ani->pivotY() - point.y, ani->_movement->_prevStatic->_staticsId, xpos, ypos, 0, fuzzyMatch);
 
 		if (!mq || !mq->getCommandByIndex(0))
 			return nullptr;
@@ -1217,8 +1217,8 @@ bool MovGraph::resetPosition(AniObject *ani, int flag) {
 	Common::Point point;
 	GrPathDesc movarr;
 
-	point.x = ani->_x;
-	point.y = ani->_y;
+	point.x = ani->pivotX();
+	point.y = ani->pivotY();
 
 	getNearestPoint(idx, &point, &movarr);
 	ani->setPos(point.x, point.y);
@@ -1262,7 +1262,7 @@ bool MovGraph::canDropInventory(AniObject *ani, int x, int y) {
 						return true;
 				}
 			}
-		} else if (getHitPoint(idx, ani->_x, ani->_y, &m, 0) && m._link && (m._link->_flags & 0x4000000)) {
+		} else if (getHitPoint(idx, ani->pivotX(), ani->pivotY(), &m, 0) && m._link && (m._link->_flags & 0x4000000)) {
 			return true;
 		}
 	}
@@ -1291,7 +1291,7 @@ MessageQueue *MovGraph::makeQueue(AniObject *subj, int xpos, int ypos, int fuzzy
 
 					subj->calcStepLen(&point);
 
-					MessageQueue *mq = sub1(subj, subj->_x - point.x, subj->_y - point.y, subj->_movement->_prevStatic->_staticsId, xpos, ypos, 0, fuzzyMatch);
+					MessageQueue *mq = sub1(subj, subj->pivotX() - point.x, subj->pivotY() - point.y, subj->_movement->_prevStatic->_staticsId, xpos, ypos, 0, fuzzyMatch);
 
 					if (!mq || !mq->getCommandByIndex(0))
 						return nullptr;
@@ -1405,8 +1405,8 @@ MessageQueue *MovGraph::makeWholeQueue(AniObject *ani, GrPathDesc *movarr, int s
 		return nullptr;
 
 	MessageQueue *mq = nullptr;
-	int ox = ani->_x;
-	int oy = ani->_y;
+	int ox = ani->pivotX();
+	int oy = ani->pivotY();
 	int id1 = 0;
 	int id2;
 
@@ -1934,7 +1934,7 @@ int MctlGraph::getDirByTurn(int idx, int movId, bool mirror) {
 }
 
 int MctlGraph::getDirByPoint(int index, AniObject *ani) {
-	if (getHitNode(ani->_x, ani->_y, 0) || getHitLink(ani->_x, ani->_y, -1, 0) || getNearestLink(ani->_x, ani->_y)) {
+	if (getHitNode(ani->pivotX(), ani->pivotY(), 0) || getHitLink(ani->pivotX(), ani->pivotY(), -1, 0) || getNearestLink(ani->pivotX(), ani->pivotY())) {
 		int minidx = -1;
 		int min = 0;
 
@@ -2392,7 +2392,7 @@ MessageQueue *MctlGraph::makeQueue(AniObject *obj, int xpos, int ypos, int fuzzy
 
 	debugC(1, kDebugPathfinding, "MctlGraph::makeQueue(%d, %d, %d, %d, %d)", obj->_id, xpos, ypos, fuzzyMatch, staticsId);
 	// --debugflags=info: walks asked for and refusals
-	debugC(1, kDebugInfo, "INFO t %u WALK of %d from %d,%d to %d,%d fuzzy %d statics %d%s", g_system->getMillis(), obj->_id, obj->_x, obj->_y, xpos, ypos, fuzzyMatch, staticsId,
+	debugC(1, kDebugInfo, "INFO t %u WALK of %d from %d,%d to %d,%d fuzzy %d statics %d%s", g_system->getMillis(), obj->_id, obj->pivotX(), obj->pivotY(), xpos, ypos, fuzzyMatch, staticsId,
 		obj->_movement ? " (while a movement runs)" : "");
 
 	int idx = getObjIndex(obj->_id);
@@ -2466,8 +2466,8 @@ MessageQueue *MctlGraph::makeQueue(AniObject *obj, int xpos, int ypos, int fuzzy
 		if (subMgm) {
 			obj->_messageQueueId = 0;
 			obj->setStatic(_aniData[idx]._directions[idxsub]._prevStaticId);
-			newx = obj->_x;
-			newy = obj->_y;
+			newx = obj->pivotX();
+			newy = obj->pivotY();
 		} else {
 			point = obj->_movement->getMovementSize(0, picAniInfo.curFrame);
 			newx = obj->_movement->_x - point.x;
@@ -2486,7 +2486,7 @@ MessageQueue *MctlGraph::makeQueue(AniObject *obj, int xpos, int ypos, int fuzzy
 	}
 
 	// CMctlGraph::MakeQueue: already there within one pixel (of the sprite center)
-	const bool near = revised ? (abs(obj->_x - xpos) <= 1 && abs(obj->_y - ypos) <= 1) : (obj->_x == xpos && obj->_y == ypos);
+	const bool near = revised ? (abs(obj->pivotX() - xpos) <= 1 && abs(obj->pivotY() - ypos) <= 1) : (obj->pivotX() == xpos && obj->pivotY() == ypos);
 	if (near) {
 		MessageQueue *mq = newWalkQueue();
 
@@ -2519,7 +2519,7 @@ MessageQueue *MctlGraph::makeQueue(AniObject *obj, int xpos, int ypos, int fuzzy
 			ex->_excFlags |= 3;
 			mq->addCommandToEnd(ex);
 
-			ex = new Command(picAniInfo.objectId, kCmdShow, -1, obj->_x, obj->_y, 0, 1, 0, 0, 0);
+			ex = new Command(picAniInfo.objectId, kCmdShow, -1, obj->pivotX(), obj->pivotY(), 0, 1, 0, 0, 0);
 
 			ex->_z = -1;
 			ex->_param = picAniInfo.copyId;
@@ -2534,16 +2534,16 @@ MessageQueue *MctlGraph::makeQueue(AniObject *obj, int xpos, int ypos, int fuzzy
 		return mq;
 	}
 
-	linkInfoSource.node = getHitNode(obj->_x, obj->_y, 0);
+	linkInfoSource.node = getHitNode(obj->pivotX(), obj->pivotY(), 0);
 
 	if (!linkInfoSource.node) {
-		linkInfoSource.link = getHitLink(obj->_x, obj->_y, idxsub, 0);
+		linkInfoSource.link = getHitLink(obj->pivotX(), obj->pivotY(), idxsub, 0);
 
 		if (!linkInfoSource.link) {
-			linkInfoSource.link = getNearestLink(obj->_x, obj->_y);
+			linkInfoSource.link = getNearestLink(obj->pivotX(), obj->pivotY());
 
 			if (!linkInfoSource.link) {
-				debugC(1, kDebugInfo, "INFO t %u WALK refused: no link near the start %d,%d", g_system->getMillis(), obj->_x, obj->_y);
+				debugC(1, kDebugInfo, "INFO t %u WALK refused: no link near the start %d,%d", g_system->getMillis(), obj->pivotX(), obj->pivotY());
 				if (revised)
 					resetObjMove(obj, resetMovementId, resetCenter, resetFrame);
 				else
@@ -2585,11 +2585,11 @@ MessageQueue *MctlGraph::makeQueue(AniObject *obj, int xpos, int ypos, int fuzzy
 	mctlMQ1.clear();
 
 	mctlMQ1.sourceDir = idxsub;
-	mctlMQ1.sourcePos.x = obj->_x;
-	mctlMQ1.sourcePos.y = obj->_y;
+	mctlMQ1.sourcePos.x = obj->pivotX();
+	mctlMQ1.sourcePos.y = obj->pivotY();
 
-	int dx1 = obj->_x;
-	int dy1 = obj->_y;
+	int dx1 = obj->pivotX();
+	int dy1 = obj->pivotY();
 	int dx2, dy2;
 
 	if (linkInfoSource.node)
@@ -2657,7 +2657,7 @@ MessageQueue *MctlGraph::makeQueue(AniObject *obj, int xpos, int ypos, int fuzzy
 					&& picAniInfo.targetFrame == ex->_z) {
 				mq->removeCommand(0, 1);
 			} else {
-				ex = new Command(picAniInfo.objectId, kCmdShow, ex->_messageNum, obj->_x, obj->_y, 0, 1, 0, 0, 0);
+				ex = new Command(picAniInfo.objectId, kCmdShow, ex->_messageNum, obj->pivotX(), obj->pivotY(), 0, 1, 0, 0, 0);
 				ex->_z = -1;
 				ex->_param = picAniInfo.copyId;
 				ex->_excFlags |= 2;
diff --git a/engines/ngi/sound.cpp b/engines/ngi/sound.cpp
index a7294b09659..8a9c9a13fec 100644
--- a/engines/ngi/sound.cpp
+++ b/engines/ngi/sound.cpp
@@ -218,21 +218,21 @@ void Sound::setPanAndVolumeByStaticAni() {
 
 	int a, b;
 
-	if (ani->_x >= g_ngi->_sceneRect.left) {
+	if (ani->pivotX() >= g_ngi->_sceneRect.left) {
 		int par, pan;
 
-		if (ani->_x <= g_ngi->_sceneRect.right) {
+		if (ani->pivotX() <= g_ngi->_sceneRect.right) {
 			int dx;
 
-			if (ani->_y <= g_ngi->_sceneRect.bottom) {
-				if (ani->_y >= g_ngi->_sceneRect.top) {
+			if (ani->pivotY() <= g_ngi->_sceneRect.bottom) {
+				if (ani->pivotY() >= g_ngi->_sceneRect.top) {
 					attenuate(g_ngi->_sfxVolume, 0);
 
 					return;
 				}
-				dx = g_ngi->_sceneRect.top - ani->_y;
+				dx = g_ngi->_sceneRect.top - ani->pivotY();
 			} else {
-				dx = ani->_y - g_ngi->_sceneRect.bottom;
+				dx = ani->pivotY() - g_ngi->_sceneRect.bottom;
 			}
 
 			par = 0;
@@ -246,7 +246,7 @@ void Sound::setPanAndVolumeByStaticAni() {
 			a = g_ngi->_sfxVolume - (-3500);
 			b = 800 - dx;
 		} else {
-			int dx = ani->_x - g_ngi->_sceneRect.right;
+			int dx = ani->pivotX() - g_ngi->_sceneRect.right;
 
 			if (dx > 800) {
 				attenuate(-3500, 0);
@@ -266,7 +266,7 @@ void Sound::setPanAndVolumeByStaticAni() {
 		return;
 	}
 
-	int dx = g_ngi->_sceneRect.left - ani->_x;
+	int dx = g_ngi->_sceneRect.left - ani->pivotX();
 	if (dx <= 800) {
 		int32 s = (800 - dx) * (g_ngi->_sfxVolume - (-3500));
 		int32 p = -3500 + s / 800;
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index 1b4d1f6324c..dd5bf9a645a 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -233,6 +233,12 @@ public:
 	~AniObject() override;
 	AniObject(AniObject *src);
 
+	/** the Windows view of the position (the pivot), docs/float-model-plan.md */
+	int pivotX() const { return _x; }
+	int pivotY() const { return _y; }
+	void setPivotX(int x) { _x = x; }
+	void setPivotY(int y) { _y = y; }
+
 	bool load(MfcArchive &file) override;
 
 	void setPos(int x, int y) override;
@@ -355,6 +361,10 @@ public:
 
 	bool getPixelAtPos(int x, int y, uint32 *pixel, bool hitOnly = false);
 	bool hit(int x, int y);
+
+private:
+	using GameObject::_x;
+	using GameObject::_y;
 };
 
 } // End of namespace NGI


Commit: 12fd0f8c5d7bc95f8d47de552254bc29b81f3aeb
    https://github.com/scummvm/scummvm/commit/12fd0f8c5d7bc95f8d47de552254bc29b81f3aeb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Motion controllers have a scene, the ladder runs its queue in it

Changed paths:
    engines/ngi/fullpipe/mobile/sc01controller.cpp
    engines/ngi/fullpipe/mobile/sc04controller.cpp
    engines/ngi/motion.cpp
    engines/ngi/motion.h


diff --git a/engines/ngi/fullpipe/mobile/sc01controller.cpp b/engines/ngi/fullpipe/mobile/sc01controller.cpp
index f3acecfc3a2..68f17a9389e 100644
--- a/engines/ngi/fullpipe/mobile/sc01controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc01controller.cpp
@@ -57,6 +57,7 @@ void Sc01Controller::cleanXml() {
 // CSc01Controller::CreateLadder (162510): no caller; the original does not delete the ladder either
 void Sc01Controller::createLadder() {
 	_ladder = new MctlLadder();
+	_ladder->_scene = _scene;
 	_ladder->_x = 543;
 	_ladder->_y = 442;
 	_ladder->_z = 10;
diff --git a/engines/ngi/fullpipe/mobile/sc04controller.cpp b/engines/ngi/fullpipe/mobile/sc04controller.cpp
index b5d8d9deffc..c23fa8cc399 100644
--- a/engines/ngi/fullpipe/mobile/sc04controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc04controller.cpp
@@ -945,6 +945,7 @@ void Sc04Controller::doStandLadder(MessageQueue *queue) {
 	heroOnLadder() = true;
 
 	_ladder = new MctlLadder();
+	_ladder->_scene = _scene;
 	_ladder->_x = 1089;
 	_ladder->_y = 406;
 	_ladder->_z = 12;
diff --git a/engines/ngi/motion.cpp b/engines/ngi/motion.cpp
index 597b146a95f..75e3fe95ccf 100644
--- a/engines/ngi/motion.cpp
+++ b/engines/ngi/motion.cpp
@@ -520,8 +520,9 @@ MessageQueue *MctlLadder::startMove(AniObject *subj, int xpos, int ypos, int fuz
 
 	if (g_ngi->_gameVersion >= 201509) {
 		// CMctlLadder::StartMove (1ACC56): CScene::RunQueue(scene, queue, 2, 1), never interrupted
+		// the Windows scene code makes ladders without a scene (D02)
 		if (mq)
-			g_ngi->getCurrentScene()->runQueueObject(mq, subj, 2);
+			(_scene ? _scene : g_ngi->getCurrentScene())->runQueueObject(mq, subj, 2);
 		return mq;
 	}
 
diff --git a/engines/ngi/motion.h b/engines/ngi/motion.h
index 027b9140e14..e33f4f84de6 100644
--- a/engines/ngi/motion.h
+++ b/engines/ngi/motion.h
@@ -39,6 +39,7 @@ bool doSomeAnimation2(int objId, int objKey);
 class MotionController : public CObject {
 public:
 	int _field_4;
+	Scene *_scene = nullptr; // CMotionController +4, set by the Android scene controllers
 	bool _isEnabled;
 
 public:


Commit: d462585b27bc0359e86f4bf3b7a49d2377cc429f
    https://github.com/scummvm/scummvm/commit/d462585b27bc0359e86f4bf3b7a49d2377cc429f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Interaction finders read the scene render list on 201509

Changed paths:
    engines/ngi/interaction.cpp


diff --git a/engines/ngi/interaction.cpp b/engines/ngi/interaction.cpp
index c5438ea37a1..be308cb7397 100644
--- a/engines/ngi/interaction.cpp
+++ b/engines/ngi/interaction.cpp
@@ -1031,12 +1031,10 @@ bool InteractionController::tryStartInteract(Scene *scene, Interact *interact) {
 	return true;
 }
 
-// CInteractionController::FindImportantInteraction (107330): highest importance in the scene
-Interact *InteractionController::findImportantInteraction(Scene *scene) {
-	if (!findSceneInteractions(scene->_sceneId))
-		return nullptr;
-	Interact *result = nullptr;
-	float importance = 0.0f;
+// the CScene +176 list in 201509, the objects of the scene by kind before
+static Common::Array<GameObject *> sceneObjects(Scene *scene) {
+	if (g_ngi->_gameVersion >= 201509)
+		return scene->_renderables;
 	Common::Array<GameObject *> objects;
 	for (PictureObject *picture : scene->_pictureObjects)
 		objects.push_back(picture);
@@ -1044,6 +1042,16 @@ Interact *InteractionController::findImportantInteraction(Scene *scene) {
 		objects.push_back(picture);
 	for (AniObject *ani : scene->_renderableAnis)
 		objects.push_back(ani);
+	return objects;
+}
+
+// CInteractionController::FindImportantInteraction (107330): highest importance in the scene
+Interact *InteractionController::findImportantInteraction(Scene *scene) {
+	if (!findSceneInteractions(scene->_sceneId))
+		return nullptr;
+	Interact *result = nullptr;
+	float importance = 0.0f;
+	Common::Array<GameObject *> objects = sceneObjects(scene);
 	for (GameObject *object : objects) {
 		// shown and hit when on the screen (IsOnScreen, vtable slot 32) and not blocked (flag 4 of +8)
 		if (!(object->_flags & 4) || !object->isOnScreen(scene) || (object->_objectFlags & 4))
@@ -1074,13 +1082,7 @@ void InteractionController::getAllImportantInteractions(Scene *scene, Common::Ar
 	result.clear();
 	if (!findSceneInteractions(scene->_sceneId))
 		return;
-	Common::Array<GameObject *> objects;
-	for (PictureObject *picture : scene->_pictureObjects)
-		objects.push_back(picture);
-	for (PictureObject *picture : scene->_roamingPictures)
-		objects.push_back(picture);
-	for (AniObject *ani : scene->_renderableAnis)
-		objects.push_back(ani);
+	Common::Array<GameObject *> objects = sceneObjects(scene);
 	for (GameObject *object : objects) {
 		if (!(object->_flags & 4) || !object->isOnScreen(scene) || (object->_objectFlags & 4))
 			continue;


Commit: 13c6a45fb86206476e9cb5e59dc4f7c06e9ec102
    https://github.com/scummvm/scummvm/commit/13c6a45fb86206476e9cb5e59dc4f7c06e9ec102
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Port the flag bytes of CSettings

Changed paths:
  A engines/ngi/fullpipe/mobile/settings.h
    engines/ngi/fullpipe/mobile/sc04controller.cpp
    engines/ngi/ngi.cpp
    engines/ngi/ngi.h


diff --git a/engines/ngi/fullpipe/mobile/sc04controller.cpp b/engines/ngi/fullpipe/mobile/sc04controller.cpp
index c23fa8cc399..1beab6c913f 100644
--- a/engines/ngi/fullpipe/mobile/sc04controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc04controller.cpp
@@ -100,7 +100,7 @@ void eraseAt(Common::Array<T> &array, uint index) {
 }
 
 // the values of sc_4_settings.xml (CSc04Controller::ReadSettingsXml)
-struct Settings {
+struct Sc04Settings {
 	float kozawDelayK;
 	float kozawStartDelay;
 	float clockDelayK;
@@ -108,7 +108,7 @@ struct Settings {
 
 class Sc04SettingsParser : public Common::XMLParser {
 public:
-	Settings *_settings = nullptr;
+	Sc04Settings *_settings = nullptr;
 
 private:
 	CUSTOM_XML_PARSER(Sc04SettingsParser) {
@@ -204,7 +204,7 @@ void Sc04Controller::checkTutorial() {
 
 // CSc04Controller::ReadSettingsXml (167ECC): the frame delay factors of the kozawkas and the clock
 void Sc04Controller::readSettingsXml() {
-	Settings settings;
+	Sc04Settings settings;
 	settings.kozawDelayK = _kozawDelayK;
 	settings.kozawStartDelay = _kozawStartDelay;
 	settings.clockDelayK = _clockDelayK;
diff --git a/engines/ngi/fullpipe/mobile/settings.h b/engines/ngi/fullpipe/mobile/settings.h
new file mode 100644
index 00000000000..3f7c97e80f5
--- /dev/null
+++ b/engines/ngi/fullpipe/mobile/settings.h
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_SETTINGS_H
+#define NGI_FULLPIPE_SETTINGS_H
+
+namespace NGI {
+
+// CSettings (19EB48), CGame +112: flag bytes only, no settings file and no purchases
+class Settings {
+public:
+	Settings() : _sendNotif(true), _reviewState(false), _isFull(true), _isCompleted(false), _debugPurchase(false) {}
+
+	// CSettings::GetReviewState (19DEA4)
+	bool getReviewState() const {
+		return _reviewState;
+	}
+
+	// CSettings::GetIsFull (19DEAA)
+	bool getIsFull() const {
+		return _isFull;
+	}
+
+	// CSettings::GetIsCompleted (19DEB0)
+	bool getIsCompleted() const {
+		return _isCompleted;
+	}
+
+	// CSettings::IsDebugPurchase (19DEB6)
+	bool isDebugPurchase() const {
+		return _debugPurchase;
+	}
+
+	// CSettings::SetReviewState (19DEBC)
+	void setReviewState(bool state) {
+		_reviewState = state;
+	}
+
+	// CSettings::SetIsCompleted (19DEF8)
+	void setIsCompleted(bool completed) {
+		_isCompleted = completed;
+	}
+
+	// CSettings::SetDebugPurchase (19DEFE)
+	void setDebugPurchase(bool debug) {
+		_debugPurchase = debug;
+	}
+
+	// CSettings::SetIsFull (19DF04)
+	void setIsFull(bool full) {
+		setDebugPurchase(false);
+		_isFull = full;
+	}
+
+	// CSettings::SetSendNotif (19DF16), PP_cancelAllNotifications is not ported
+	void setSendNotif(bool send) {
+		_sendNotif = send;
+	}
+
+private:
+	bool _sendNotif; // +36
+	bool _reviewState; // +37
+	bool _isFull; // +38
+	bool _isCompleted; // +39
+	bool _debugPurchase; // +40
+};
+
+} // End of namespace NGI
+
+#endif
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 97cb2c63978..07fafac0285 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -45,6 +45,7 @@
 #include "ngi/fullpipe/mobile/notebook.h"
 #include "ngi/fullpipe/mobile/taskmanager.h"
 #include "ngi/fullpipe/mobile/exitmanager.h"
+#include "ngi/fullpipe/mobile/settings.h"
 #include "ngi/preloadmanager.h"
 #include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/mobile/objhelper.h"
@@ -206,6 +207,12 @@ NGIEngine::~NGIEngine() {
 	g_vars = nullptr;
 }
 
+Settings &NGIEngine::settings() {
+	if (!_settings)
+		_settings.reset(new Settings());
+	return *_settings;
+}
+
 void NGIEngine::restartGame() {
 	_floaters->deleteAllFlies();
 	if (_tremble)
diff --git a/engines/ngi/ngi.h b/engines/ngi/ngi.h
index 4be864d22a7..d5fce9e423f 100644
--- a/engines/ngi/ngi.h
+++ b/engines/ngi/ngi.h
@@ -105,6 +105,7 @@ class ObjHelperHint;
 class ExitManager;
 class Tremble;
 class Map;
+class Settings;
 class ArcadeInterface;
 class MessageQueueBuilder;
 class BitmapFont;
@@ -338,6 +339,9 @@ public:
 	Common::ScopedPtr<AchievementsManager> _achievementsManager;
 	/** CNotebookController, owned by its scene (SC_NOTEBOOK) */
 	Notebook *_notebook = nullptr;
+	/** CGame +112, made when first asked for (Android) */
+	Common::ScopedPtr<Settings> _settings;
+	Settings &settings();
 	Common::ScopedPtr<AniHandler> _aniHandler;
 
 	Common::Array<Common::Point> _arcadeKeys;


Commit: 5f8a5b6b68e37ecb9cc4fe7a8755a8cac8c688df
    https://github.com/scummvm/scummvm/commit/5f8a5b6b68e37ecb9cc4fe7a8755a8cac8c688df
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: NoActionLogger::onUpdate reads CSettings::GetIsFull

Changed paths:
    engines/ngi/fullpipe/mobile/noactionlogger.cpp


diff --git a/engines/ngi/fullpipe/mobile/noactionlogger.cpp b/engines/ngi/fullpipe/mobile/noactionlogger.cpp
index 22678554115..5104daf6817 100644
--- a/engines/ngi/fullpipe/mobile/noactionlogger.cpp
+++ b/engines/ngi/fullpipe/mobile/noactionlogger.cpp
@@ -23,6 +23,7 @@
 #include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/mobile/notebook.h"
 #include "ngi/fullpipe/mobile/noactionlogger.h"
+#include "ngi/fullpipe/mobile/settings.h"
 #include "ngi/fullpipe/mobile/taskmanager.h"
 #include "ngi/fullpipe/mobile/tutorialmanager.h"
 
@@ -48,10 +49,7 @@ void NoActionLogger::onUpdate(uint32 elapsed) {
 	if (_time > 59999) {
 		if (g_ngi->_taskManager->getBonuses() > 0) {
 			if (g_ngi->_tutorialManager->isTutorialCompleted()) {
-				// CSettings::GetIsFull (CGame +112) is not ported: the game counts as the full version
-				warnOnce("CNoActionLogger::OnUpdate: CSettings::GetIsFull is not ported (the game is the full version)");
-				const bool isFull = true;
-				if (!isFull) {
+				if (!g_ngi->settings().getIsFull()) {
 					if (g_ngi->_notebook->checkAutoFoil())
 						showHintOffer();
 				}


Commit: 725e13754adae181a86574d64e592b2168dd44fe
    https://github.com/scummvm/scummvm/commit/725e13754adae181a86574d64e592b2168dd44fe
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Port CMoveToInfo and the MOVETO command

Changed paths:
  A engines/ngi/movetoinfo.cpp
  A engines/ngi/movetoinfo.h
    engines/ngi/gfx.cpp
    engines/ngi/gfx.h
    engines/ngi/messages.cpp
    engines/ngi/messages.h
    engines/ngi/module.mk
    engines/ngi/scene.cpp
    engines/ngi/statics.cpp
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index 4a84fd93271..407ca2df381 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -24,6 +24,7 @@
 #include "ngi/objects.h"
 #include "ngi/gfx.h"
 #include "ngi/modal.h"
+#include "ngi/movetoinfo.h"
 #include "ngi/statics.h"
 #include "ngi/scene.h"
 #include "ngi/sceneobjects.h"
@@ -297,9 +298,39 @@ GameObject::GameObject(GameObject *src) {
 }
 
 GameObject::~GameObject() {
+	stopMoveTo();
 	delete _hitregion;
 }
 
+// CVisibleObject::MoveTo (127BC0)
+void GameObject::moveTo(MoveToInfo *info) {
+	if (info->verifyItems(this)) {
+		_moveTo.push_back(info);
+		_objectFlags |= 6;
+	} else {
+		delete info;
+	}
+}
+
+// CVisibleObject::Update (127AFE)
+void GameObject::updateMoveTo(uint elapsed) {
+	if (!(_objectFlags & 4))
+		return;
+	if (_moveTo.empty()) {
+		_objectFlags &= ~4;
+	} else if (!_moveTo.front()->update(elapsed, this)) {
+		delete _moveTo.front();
+		_moveTo.remove_at(0);
+	}
+}
+
+// CVisibleObject::StopMoveTo (126D0E)
+void GameObject::stopMoveTo() {
+	for (uint i = 0; i < _moveTo.size(); i++)
+		delete _moveTo[i];
+	_moveTo.clear();
+}
+
 // Top left and size of the texture of a picture or the current animation phase, as in
 // PictureObject::render and AniObject::render; false when there is nothing to draw
 static bool textureQuad(const GameObject *object, Common::Point &topLeft, Dims &size, Common::Point &anchor) {
diff --git a/engines/ngi/gfx.h b/engines/ngi/gfx.h
index 8773953adef..404ee05f115 100644
--- a/engines/ngi/gfx.h
+++ b/engines/ngi/gfx.h
@@ -177,6 +177,7 @@ class BigPicture : public Texture {
 };
 
 class HitregionObject;
+class MoveToInfo;
 
 class GameObject : public CObject {
   public:
@@ -201,6 +202,7 @@ class GameObject : public CObject {
 	int _hitAlpha = 128; // XML hitAlpha: the alpha above which a pixel counts as hit
 	int _filter = 0; // XML filter (0 nearest, 2 linear), no meaning for the software renderer
 	HitregionObject *_hitregion = nullptr; // +108 of CVisibleObject, the XML HITREGION child
+	Common::Array<MoveToInfo *> _moveTo; // +68 of CVisibleObject, the running MOVETO commands
 
   public:
 	GameObject();
@@ -222,6 +224,10 @@ class GameObject : public CObject {
 	void setTopLeft(Common::Point topLeft);
 	/** CVisibleObject::SetPos (11F648): the virtual SetPos (slot 20), the z stays */
 	virtual void setPosition(Common::Point pos);
+	/** CVisibleObject::MoveTo (127BC0) owns the info, Update (127AFE) runs it, StopMoveTo (126D0E) */
+	void moveTo(MoveToInfo *info);
+	void updateMoveTo(uint elapsed);
+	void stopMoveTo();
 	/** CVisibleObject::GetSize: the size of the drawn part of the texture, scale not applied */
 	Common::Point getSize() const;
 	/** CVisibleObject::GetCenter / SetCenter: the center of the texture window */
diff --git a/engines/ngi/messages.cpp b/engines/ngi/messages.cpp
index 100dbd14aa8..8dd4f5eaaa6 100644
--- a/engines/ngi/messages.cpp
+++ b/engines/ngi/messages.cpp
@@ -26,6 +26,7 @@
 #include "ngi/objects.h"
 #include "ngi/messages.h"
 #include "ngi/modal.h"
+#include "ngi/movetoinfo.h"
 #include "ngi/scene.h"
 #include "ngi/scenecontroller.h"
 #include "ngi/statics.h"
@@ -101,6 +102,7 @@ struct exDesc {
 	{ kCmdPause, "PAUSE" },
 	{ kCmdSetScene, "SET_SCENE" },
 	{ kCmdSetLogic, "SET_LOGIC" },
+	{ kCmdMoveTo, "MOVETO" },
 	{ kCmdNone, "" }
 };
 
@@ -716,6 +718,7 @@ void MessageQueue::nextCommand() {
 			case kCmdStartSliding:
 			case kCmdUser:
 			case kCmdPause:
+			case kCmdMoveTo:
 			case kCmdQueue:
 			case kCmdSound:
 				_state = 2;
@@ -752,6 +755,10 @@ void MessageQueue::execute(Command *cmd) {
 		executeCmdPause(cmd);
 		return;
 	}
+	if (cmd->_cmd == kCmdMoveTo) {
+		executeCmdMoveTo(cmd);
+		return;
+	}
 	MessageQueue *outer = s_executingQueue;
 	s_executingQueue = this;
 	cmd->dispatch();
@@ -763,6 +770,57 @@ void MessageQueue::executeCmdPause(Command *cmd) {
 	cmd->setParamFloat("timer", cmd->getParamFloat("delay", 0.0f));
 }
 
+// The object of a MOVETO command: "obj" (a name) else "objId", with the copy "copy"
+static GameObject *moveToObject(Scene *queueScene, const Command *cmd) {
+	Scene *scene = queueScene ? queueScene : g_ngi->getCurrentScene();
+	if (!scene)
+		return nullptr;
+	uint32 id = 0;
+	g_ngi->_gameProject->_objectIds.findId(cmd->_args.getValOrDefault("obj"), id);
+	const int copy = cmd->getParamInt("copy", 0);
+	GameObject *object = scene->findVisibleObject(id, copy);
+	if (!object)
+		object = scene->findVisibleObject(cmd->getParamInt("objId", 0), copy);
+	return object;
+}
+
+// CCommand::GetParamVector2: the parameters name + X and name + Y
+static float vectorParam(const Command *cmd, const char *name, const char *axis) {
+	return cmd->getParamFloat((Common::String(name) + axis).c_str(), 0.0f);
+}
+
+// CMessageQueue::ExecuteCmdMoveTo (10E84C): the original crashes on a missing object
+void MessageQueue::executeCmdMoveTo(Command *cmd) {
+	GameObject *object = moveToObject(_scene, cmd);
+	if (!object) {
+		warning("Can't find VisibleObject for CMD_MOVETO");
+		return;
+	}
+	MoveToInfo *info = new MoveToInfo(cmd->getParamInt("step", 21), vectorParam(cmd, "center", "X"), vectorParam(cmd, "center", "Y"));
+	const float time = cmd->getParamFloat("time", 0.0f);
+	static const char *const kItems[][4] = {
+		{ "crtX", "endX", "velX", "accX" },
+		{ "crtY", "endY", "velY", "accY" },
+		{ "crtZ", "endZ", "velZ", "accZ" },
+		{ "crtRo", "endRo", "velRo", "accRo" },
+		{ "crtPhi", "endPhi", "velPhi", "accPhi" },
+		{ "sclX", "sclEndX", "sclVelX", "sclAccX" },
+		{ "sclY", "sclEndY", "sclVelY", "sclAccY" },
+		{ "rot", "rotEnd", "rotVel", "rotAcc" }
+	};
+	for (uint i = 0; i < ARRAYSIZE(kItems); i++)
+		info->addItem(kItems[i][0], time, 0.0f, cmd->getParamFloat(kItems[i][1], 0.0f), cmd->getParamFloat(kItems[i][2], 0.0f),
+			cmd->getParamFloat(kItems[i][3], 0.0f));
+	object->moveTo(info);
+}
+
+// CMessageQueue::UpdateCmdMoveTo (10FAF0): waits while the object is moving
+void MessageQueue::updateCmdMoveTo(Command *cmd) {
+	GameObject *object = moveToObject(_scene, cmd);
+	if (!object || !(object->_objectFlags & 4))
+		nextCommand();
+}
+
 // The scene of the command: the parameter "scene", else the scene of the queue
 static Scene *commandScene(Scene *queueScene, const Command *cmd) {
 	Scene *scene = queueScene ? queueScene : g_ngi->getCurrentScene();
@@ -813,11 +871,14 @@ void MessageQueue::update(uint32 elapsed) {
 	case kCmdPause:
 		updateCmdPause(cmd, elapsed);
 		break;
+	case kCmdMoveTo:
+		updateCmdMoveTo(cmd);
+		break;
 	case kCmdQueue:
 		updateCmdQueue(cmd);
 		break;
 	default:
-		// TALK, MOVIE, MOVE_TO and FADE have no command kind here: the loader does not make them
+		// TALK, MOVIE and FADE have no command kind here: the loader does not make them
 		break;
 	}
 }
diff --git a/engines/ngi/messages.h b/engines/ngi/messages.h
index 8a94f0970e3..854a313b291 100644
--- a/engines/ngi/messages.h
+++ b/engines/ngi/messages.h
@@ -74,7 +74,8 @@ enum CommandKind {
 	// Only produced by the XML loader, not present in the Windows engine
 	kCmdPause = 64,               // Android PAUSE
 	kCmdSetScene = 65,            // Android SETSC
-	kCmdSetLogic = 66
+	kCmdSetLogic = 66,
+	kCmdMoveTo = 67               // Android MOVETO
 };
 
 /** Messages of kCmdMessage (_messageNum) that the engine handles itself, not the scene MSG_* ids */
@@ -272,12 +273,14 @@ class MessageQueue : public CObject {
 	void updateCmdQueue(Command *cmd);
 	/** CMessageQueue::UpdateCmdPause (10FCF8): the timer counts down by the elapsed ms */
 	void updateCmdPause(Command *cmd, uint32 elapsed);
+	void updateCmdMoveTo(Command *cmd);
 	/** CMessageQueue::UpdateCmdSnd (10F984): the sound is not played any more */
 	void updateCmdSnd(Command *cmd);
 	/** CMessageQueue::UpdateUserCmd (10FA14): the controller says that the command is done */
 	void updateUserCmd(Command *cmd, uint32 elapsed);
 	/** CMessageQueue::ExecuteCmdPause (10F574): the timer starts at the delay */
 	void executeCmdPause(Command *cmd);
+	void executeCmdMoveTo(Command *cmd);
 	/** CMessageQueue::ExecuteCmdQueue (10E390): CScene::RunQueue(scene, id, state, setHero) */
 	static void executeCmdQueue(Command *cmd, Scene *queueScene);
 	void pause();
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 23515f7a817..468eb0aba2e 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -20,6 +20,7 @@ MODULE_OBJS = \
 	metaengine.o \
 	modal.o \
 	motion.o \
+	movetoinfo.o \
 	ngi.o \
 	ngiarchive.o \
 	physics.o \
diff --git a/engines/ngi/movetoinfo.cpp b/engines/ngi/movetoinfo.cpp
new file mode 100644
index 00000000000..ab82cce83e4
--- /dev/null
+++ b/engines/ngi/movetoinfo.cpp
@@ -0,0 +1,272 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#include "ngi/ngi.h"
+#include "ngi/objects.h"
+#include "ngi/gfx.h"
+#include "ngi/movetoinfo.h"
+
+namespace NGI {
+
+namespace {
+
+// Vector2Length (125F00)
+float vectorLength(float x1, float y1, float x2, float y2) {
+	return sqrtf((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
+}
+
+// Vector2Dot (126032): the cosine of the angle
+float vectorDot(float x1, float y1, float x2, float y2) {
+	return (x1 * x2 + y1 * y2) / sqrtf((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2));
+}
+
+const double kPi = 3.14159265358979;
+
+} // End of anonymous namespace
+
+MoveToInfo::MoveToInfo(uint step, float centerX, float centerY) :
+		_time(0), _step(step), _centerX(centerX), _centerY(centerY) {
+}
+
+MoveToInfo::Item *MoveToInfo::findItem(const char *name) {
+	ItemMap::iterator it = _items.find(name);
+	return it == _items.end() ? nullptr : &it->_value;
+}
+
+// CMoveToInfo::AddItem (10E760): an item that is there already stays
+void MoveToInfo::addItem(const Common::String &name, float time, float start, float end, float velocity, float acceleration) {
+	if (_items.contains(name))
+		return;
+	Item item;
+	item.time = time;
+	item.start = start;
+	item.end = end;
+	item.velocity = velocity;
+	item.acceleration = acceleration;
+	_items.setVal(name, item);
+}
+
+// CMoveToInfo::ProcessItem (11249A): the time runs out, the velocity grows, the way of the step
+float MoveToInfo::processItem(Item &item, float step) {
+	item.time -= step;
+	item.velocity = step * item.acceleration + item.velocity;
+	return item.velocity * step;
+}
+
+// CMoveToInfo::MoveCartesian (1124C2)
+bool MoveToInfo::moveCartesian(float step, Item *x, Item *y, Item *z, GameObject *object) {
+	const Common::Point position = object->getPosition();
+	float newX = position.x;
+	float newY = position.y;
+	float newZ = object->_z;
+	bool finished = false;
+	if (x) {
+		newX += processItem(*x, step);
+		finished = x->time <= 0.0f;
+	}
+	if (y) {
+		newY += processItem(*y, step);
+		if (y->time <= 0.0f)
+			finished = true;
+	}
+	if (z) {
+		newZ += processItem(*z, step);
+		if (z->time <= 0.0f)
+			finished = true;
+	}
+	// CVisibleObject::SetPos (slot 20) with x, y, z; the positions are int here (D23)
+	object->setPosition(Common::Point(static_cast<int>(newX), static_cast<int>(newY)));
+	if (z)
+		object->_z = static_cast<int>(newZ);
+	return !finished;
+}
+
+// CMoveToInfo::MovePolar (112588)
+bool MoveToInfo::movePolar(float step, Item *radius, Item *angle, GameObject *object) {
+	const Common::Point position = object->getPosition();
+	const float x = position.x;
+	const float y = position.y;
+	float length = vectorLength(x, y, _centerX, _centerY);
+	float phi = static_cast<float>(acosf(vectorDot(1.0f, 0.0f, _centerX - x, _centerY - y)) * 180.0 / kPi);
+	if (_centerY < y)
+		phi = (180.0f - phi) + 180.0f;
+	bool finished = false;
+	if (radius) {
+		length += processItem(*radius, step);
+		finished = radius->time <= 0.0f;
+	}
+	if (angle) {
+		phi += processItem(*angle, step);
+		if (angle->time <= 0.0f)
+			finished = true;
+	}
+	const double theta = phi * kPi / 180.0;
+	const double cosine = cos(theta);
+	const double sine = sin(theta);
+	const float newY = _centerY - static_cast<float>(length * sine);
+	const float newX = _centerX - static_cast<float>(length * cosine);
+	object->setPosition(Common::Point(static_cast<int>(newX), static_cast<int>(newY)));
+	return !finished;
+}
+
+// CMoveToInfo::Scale (112718)
+bool MoveToInfo::scale(float step, Item *scaleX, Item *scaleY, GameObject *object) {
+	if (!scaleX && !scaleY)
+		return false;
+	float newX = object->_scaleX;
+	float newY = object->_scaleY;
+	bool finished = false;
+	if (scaleX) {
+		newX += processItem(*scaleX, step);
+		finished = scaleX->time <= 0.0f;
+	}
+	if (scaleY) {
+		newY += processItem(*scaleY, step);
+		if (scaleY->time <= 0.0f)
+			finished = true;
+	}
+	object->_scaleX = newX;
+	object->_scaleY = newY;
+	return !finished;
+}
+
+// CMoveToInfo::Rotate (112790): degrees, the object keeps radians
+bool MoveToInfo::rotate(float step, Item *rotation, GameObject *object) {
+	if (!rotation)
+		return false;
+	object->_rotation += (processItem(*rotation, step) * 3.1415927f) / 180.0f;
+	return rotation->time > 0.0f;
+}
+
+// CMoveToInfo::CalcTime (1127DC)
+float MoveToInfo::calcTime(float acceleration, float velocity, float start, float end) {
+	const float discriminant = ((velocity + velocity) * velocity) - ((acceleration * 4.0f) * (start - end));
+	if (discriminant < 0.0f)
+		return 0.0f;
+	float time = ((sqrtf(discriminant) - velocity) * 0.5f) / acceleration;
+	if (time < 0.0f) {
+		time = ((-velocity - sqrtf(discriminant)) * 0.5f) / acceleration;
+		if (time < 0.0f)
+			time = 0.0f;
+	}
+	return time;
+}
+
+// CMoveToInfo::CalculateParams (112882): false when the item has nothing to do
+bool MoveToInfo::calculateParams(Item &item) {
+	if (item.acceleration == 0.0f && item.velocity == 0.0f && item.end == 0.0f)
+		return false;
+	if (item.time == 0.0f) {
+		if (item.acceleration == 0.0f) {
+			if (item.velocity != 0.0f)
+				item.time = (item.end - item.start) / item.velocity;
+		} else {
+			item.time = calcTime(item.acceleration, item.velocity, item.start, item.end);
+		}
+	}
+	if (item.time == 0.0f)
+		return false;
+	if (item.velocity == 0.0f && item.end != 0.0f)
+		item.velocity = ((item.end - item.start) / item.time) - (item.time * item.acceleration);
+	return true;
+}
+
+// CMoveToInfo::SetStartParam (112BD4)
+void MoveToInfo::setStartParam(const char *name, float value) {
+	Item *item = findItem(name);
+	if (item)
+		item->start = value;
+}
+
+// CMoveToInfo::SetStartParams (112BF0)
+void MoveToInfo::setStartParams(GameObject *object) {
+	const Common::Point position = object->getPosition();
+	setStartParam("crtX", position.x);
+	setStartParam("crtY", position.y);
+	setStartParam("crtZ", object->_z);
+
+	// the original reads the x twice (GetX, slot 24, both times)
+	const float x = position.x;
+	const float y = position.x;
+	float length;
+	float phi;
+	if (_centerX == 0.0f && _centerY == 0.0f) {
+		_centerX = x;
+		_centerY = y;
+		length = 0.0f;
+		phi = 0.0f;
+	} else {
+		length = vectorLength(x, y, _centerX, _centerY);
+		phi = static_cast<float>(acosf(vectorDot(1.0f, 0.0f, _centerX - x, _centerY - y)) * 180.0 / kPi);
+	}
+	setStartParam("crtRo", length);
+	setStartParam("crtPhi", phi);
+	setStartParam("sclX", object->_scaleX);
+	setStartParam("sclY", object->_scaleY);
+	setStartParam("rot", object->_rotation);
+}
+
+// CMoveToInfo::VerifyItems (112DE0): the items without a way are dropped
+bool MoveToInfo::verifyItems(GameObject *object) {
+	setStartParams(object);
+	for (bool dropped = true; dropped;) {
+		dropped = false;
+		for (ItemMap::iterator it = _items.begin(); it != _items.end(); ++it) {
+			if (!calculateParams(it->_value)) {
+				_items.erase(it);
+				dropped = true;
+				break;
+			}
+		}
+	}
+	return !_items.empty();
+}
+
+// CMoveToInfo::Update (11298C): false when an item has run out
+bool MoveToInfo::update(uint elapsed, GameObject *object) {
+	_time += elapsed;
+	const float step = static_cast<float>(_step) / 1000.0f;
+	bool finished = false;
+	while (_time >= _step) {
+		Item *x = findItem("crtX");
+		Item *y = findItem("crtY");
+		Item *z = findItem("crtZ");
+		if ((x || y || z) && !moveCartesian(step, x, y, z, object))
+			finished = true;
+		Item *radius = findItem("crtRo");
+		Item *angle = findItem("crtPhi");
+		if ((radius || angle) && !movePolar(step, radius, angle, object))
+			finished = true;
+		Item *scaleX = findItem("sclX");
+		Item *scaleY = findItem("sclY");
+		if ((scaleX || scaleY) && !scale(step, scaleX, scaleY, object))
+			finished = true;
+		Item *rotation = findItem("rot");
+		if (rotation && !rotate(step, rotation, object))
+			finished = true;
+		_time -= _step;
+	}
+	return !finished;
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/movetoinfo.h b/engines/ngi/movetoinfo.h
new file mode 100644
index 00000000000..70005bcc495
--- /dev/null
+++ b/engines/ngi/movetoinfo.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_MOVETOINFO_H
+#define NGI_MOVETOINFO_H
+
+#include "common/hashmap.h"
+#include "common/str.h"
+
+namespace NGI {
+
+class GameObject;
+
+/** CMoveToInfo (11246C): one MOVETO of an object, an item per animated value */
+class MoveToInfo {
+public:
+	// SMoveToInfoItem
+	struct Item {
+		float time;
+		float start;
+		float end;
+		float velocity;
+		float acceleration;
+	};
+
+	// the original also keeps the vector "offset" (+8), nothing reads it
+	MoveToInfo(uint step, float centerX, float centerY);
+
+	void addItem(const Common::String &name, float time, float start, float end, float velocity, float acceleration);
+	bool verifyItems(GameObject *object);
+	bool update(uint elapsed, GameObject *object);
+
+private:
+	static float processItem(Item &item, float step);
+	bool moveCartesian(float step, Item *x, Item *y, Item *z, GameObject *object);
+	bool movePolar(float step, Item *radius, Item *angle, GameObject *object);
+	bool scale(float step, Item *scaleX, Item *scaleY, GameObject *object);
+	bool rotate(float step, Item *rotation, GameObject *object);
+	static float calcTime(float acceleration, float velocity, float start, float end);
+	static bool calculateParams(Item &item);
+	void setStartParam(const char *name, float value);
+	void setStartParams(GameObject *object);
+	Item *findItem(const char *name);
+
+	typedef Common::HashMap<Common::String, Item> ItemMap;
+
+	uint _time; // +0
+	uint _step; // +4
+	float _centerX; // +16
+	float _centerY; // +20
+	ItemMap _items; // +24
+};
+
+} // End of namespace NGI
+
+#endif
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index f87cae33433..b7155117dfc 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -1667,6 +1667,15 @@ bool Scene::update(int counterdiff) {
 			for (uint i = 0; i < _interactionQueues.size(); i++)
 				_interactionQueues[i]->update(counterdiff);
 			processMessages();
+			// the pictures that move (CVisibleObject::Update); the animations do it in AniObject::update
+			for (uint i = 0; i < _pictureObjects.size(); i++) {
+				if (_pictureObjects[i]->_objectFlags & 2)
+					_pictureObjects[i]->updateMoveTo(counterdiff);
+			}
+			for (uint i = 0; i < _roamingPictures.size(); i++) {
+				if (_roamingPictures[i]->_objectFlags & 2)
+					_roamingPictures[i]->updateMoveTo(counterdiff);
+			}
 			for (uint i = 0; i < _renderableAnis.size(); i++)
 				changed |= _renderableAnis[i]->update(counterdiff);
 			if (_controller)
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 580dbb28eb5..7ab5c7342b5 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -886,6 +886,8 @@ Common::Point AniObject::getSomeXY() const {
 
 // CAniObject::Update (F2D7C): afterwards the object lets go of a stopped queue
 bool AniObject::update(int counterdiff) {
+	if (g_ngi->_gameVersion >= 201509)
+		updateMoveTo(counterdiff);
 	const bool changed = updateAnimation(counterdiff);
 	if (g_ngi->_gameVersion >= 201509 && _queue && _queue->_state == 0)
 		setQueue(nullptr);
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index 58c0064adf7..37a57e32d9f 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1516,6 +1516,8 @@ private:
 			uint32 id;
 			if (_project._objectIds.findId(cmd->_messageName, id))
 				cmd->_messageNum = id;
+		} else if (kind == "MOVETO" || kind == "13") {
+			cmd->_cmd = kCmdMoveTo;
 		} else if (kind == "PAUSE" || kind == "22") {
 			cmd->_cmd = kCmdPause;
 			cmd->_messageNum = MAX(0, atoi(node->values.getValOrDefault("delay").c_str()));


Commit: af8d24237fdd13405ecc71b64d98da67d7d1f182
    https://github.com/scummvm/scummvm/commit/af8d24237fdd13405ecc71b64d98da67d7d1f182
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Port CFPController::OnSceneInit and the cursor Load/Unload

Changed paths:
    engines/ngi/fullpipe/mobile/fpcontroller.cpp
    engines/ngi/fullpipe/mobile/fpcontroller.h
    engines/ngi/input.cpp
    engines/ngi/input.h
    engines/ngi/preloadmanager.cpp


diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
index de4459522fe..efcf6cee45f 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -185,8 +185,26 @@ FPController &sceneController(Scene &scene) {
 
 // CFPController::CFPController; margins and offsets (+36 ... +48) are set by each OnShow
 FPController::FPController(int sceneId) : ISceneController(sceneId) {
+}
+
+// CFPController::OnSceneInit (14F9C8)
+void FPController::onSceneInit() {
+	// +12 (the hero) is hero(), CopyCommonQeueus is the lazy copy in Scene::findMessageQueue (D35)
 	fillCursorData();
 	initBorders();
+	if (_scene->_sceneId != SC_INV) {
+		const Common::Array<GameObject *> objects = _scene->_renderables;
+		for (GameObject *object : objects)
+			object->_hitAlpha = 0;
+	}
+	Scene *common = g_ngi->findScene(SC_COMMON);
+	_react = common ? common->findAniObjectById(ANI_REACT, 0) : nullptr;
+	if (!_react)
+		return;
+	// the original adds it to SC_COMMON once more under a second key; here it is in the list already
+	if (_scene != common)
+		_scene->addAni(_react, true);
+	_react->pushToPreload(_scene);
 }
 
 AniObject *FPController::hero() const {
@@ -1264,15 +1282,9 @@ bool FPController::isNeedReact(float x, float y) {
 	return getCursorTypeTop(x, y) != 0;
 }
 
-// CFPController::OnMouseLKeyUpTop; ANI_REACT is added at first use (original: OnSceneInit)
+// CFPController::OnMouseLKeyUpTop
 bool FPController::onMouseLKeyUpTop(uint32 id, float x, float y) {
 	if (g_ngi->_exitManager->getState() != 2 && !_dragged && isNeedReact(x, y)) {
-		if (!_react) {
-			if (Scene *common = g_ngi->findScene(SC_COMMON))
-				_react = common->findAniObjectById(ANI_REACT, 0);
-			if (_react)
-				_scene->addAni(_react, true);
-		}
 		if (_react) {
 			if (_react->_movement)
 				_react->stopMovementToPrev(true);
diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.h b/engines/ngi/fullpipe/mobile/fpcontroller.h
index 338b9222a2d..97375ef9c33 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.h
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.h
@@ -75,6 +75,8 @@ public:
 	virtual void cleanXml() {}
 	/** CFPController::GetCursorType (14EAC0) */
 	int getCursorType(float x, float y) override;
+	/** CFPController::OnSceneInit (14F9C8) */
+	void onSceneInit() override;
 	/** CFPController::FillCursorData (14F64C): the cursor type of the objects of the scene (+96) */
 	void fillCursorData();
 	/** CScene init: OnSceneInit once before the first OnShow */
diff --git a/engines/ngi/input.cpp b/engines/ngi/input.cpp
index ff81b44d951..8ab4275adaa 100644
--- a/engines/ngi/input.cpp
+++ b/engines/ngi/input.cpp
@@ -131,6 +131,30 @@ void CursorController::initPointers() {
 	}
 }
 
+// CCursorController::Load (F55FC), CCursor::Load (F5498): loads the picture (virtual there)
+uint CursorController::load() {
+	uint size = 0;
+	for (const Pointer &pointer : _pointers) {
+		if (pointer.picture && pointer.picture->_objtype == kObjTypePictureObject)
+			size += static_cast<PictureObject *>(pointer.picture)->load();
+		else if (pointer.picture && pointer.picture->_objtype == kObjTypeStaticANIObject)
+			size += static_cast<AniObject *>(pointer.picture)->load();
+	}
+	return size;
+}
+
+// CCursorController::Unload (F55D6), CCursor::Unload (F54A8)
+uint CursorController::unload() {
+	uint size = 0;
+	for (const Pointer &pointer : _pointers) {
+		if (pointer.picture && pointer.picture->_objtype == kObjTypePictureObject)
+			size += static_cast<PictureObject *>(pointer.picture)->unload();
+		else if (pointer.picture && pointer.picture->_objtype == kObjTypeStaticANIObject)
+			size += static_cast<AniObject *>(pointer.picture)->unload();
+	}
+	return size;
+}
+
 // CGame +28 (a scene is being set: the type 7) is not modelled
 void CursorController::calcCursorType() {
 	Scene *scene = g_ngi->getCurrentScene();
diff --git a/engines/ngi/input.h b/engines/ngi/input.h
index 1141facdb72..d42c0e6b572 100644
--- a/engines/ngi/input.h
+++ b/engines/ngi/input.h
@@ -101,6 +101,9 @@ public:
 	void render();
 	/** CCursorController::Init (F556C), CCursor::Init (F5258): find the pointer pictures */
 	void initPointers();
+	/** CCursorController::Load (F55FC) / Unload (F55D6): the pictures of the pointers */
+	uint load();
+	uint unload();
 	/** CCursorController::CalcCursorType (F5802) */
 	void calcCursorType();
 	/** CCursorController::Update (F5C6C) */
diff --git a/engines/ngi/preloadmanager.cpp b/engines/ngi/preloadmanager.cpp
index bc63adc71a4..9cfcba2b47b 100644
--- a/engines/ngi/preloadmanager.cpp
+++ b/engines/ngi/preloadmanager.cpp
@@ -22,6 +22,7 @@
 #include "common/debug.h"
 
 #include "ngi/ngi.h"
+#include "ngi/input.h"
 #include "ngi/preloadmanager.h"
 #include "ngi/scene.h"
 #include "ngi/scenecontroller.h"
@@ -216,7 +217,7 @@ void PreloadManager::loadAll() {
 		if (scene->_controller)
 			scene->_controller->onResetRender();
 	}
-	warning("STUB/untested: CCursorController::Load: the cursors are pictures of the inventory scene, they are loaded with it");
+	g_ngi->_inputController->load();
 	loadInventory();
 }
 
@@ -238,7 +239,7 @@ void PreloadManager::unloadAll() {
 		if (scene->_controller)
 			scene->_controller->onLostDevice();
 	}
-	warning("STUB/untested: CCursorController::Unload: the cursors are pictures of the inventory scene, they are unloaded with it");
+	g_ngi->_inputController->unload();
 	unloadInventory();
 	unloadFonts();
 }


Commit: bb10f16385b5cfec0e3619a9a2dd691cbf853eec
    https://github.com/scummvm/scummvm/commit/bb10f16385b5cfec0e3619a9a2dd691cbf853eec
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: PreloadManager::startGame loads the cursors

Changed paths:
    engines/ngi/preloadmanager.cpp


diff --git a/engines/ngi/preloadmanager.cpp b/engines/ngi/preloadmanager.cpp
index 9cfcba2b47b..35ec98e0890 100644
--- a/engines/ngi/preloadmanager.cpp
+++ b/engines/ngi/preloadmanager.cpp
@@ -191,7 +191,7 @@ void PreloadManager::popScene() {
 
 // CPreloadManager::StartGame (11ADDC)
 void PreloadManager::startGame() {
-	warning("STUB/untested: CCursorController::Load: the cursors are pictures of the inventory scene, they are loaded with it");
+	g_ngi->_inputController->load();
 	loadInventory();
 }
 


Commit: c955d841fbabe49ac234c656005a92b18a32ae1c
    https://github.com/scummvm/scummvm/commit/c955d841fbabe49ac234c656005a92b18a32ae1c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Add GuiManager::createButton and Scene::addRoamingObject

Changed paths:
    engines/ngi/guimanager.cpp
    engines/ngi/guimanager.h
    engines/ngi/scene.cpp
    engines/ngi/scene.h


diff --git a/engines/ngi/guimanager.cpp b/engines/ngi/guimanager.cpp
index 9b86fad0700..7db0f7f3d8a 100644
--- a/engines/ngi/guimanager.cpp
+++ b/engines/ngi/guimanager.cpp
@@ -198,6 +198,7 @@ void GuiProgressBar::render(Graphics::ManagedSurface &target) const {
 class GuiButton : public GuiElement {
 public:
 	GuiButton(Scene &scene, const Common::StringMap &attrs, const ObjectIdList &ids);
+	GuiButton(Scene &scene, const GuiButtonInit &init);
 	void load(GameProject &project) override;
 	void unload() override;
 	uint loadTexture() override;
@@ -229,6 +230,21 @@ GuiButton::GuiButton(Scene &scene, const Common::StringMap &attrs, const ObjectI
 	_selectSound = resourceId(attrs, "select", ids);
 }
 
+// CGuiButton::CGuiButton(BUTTON_INIT) (101858): the position is the one of the first picture
+GuiButton::GuiButton(Scene &scene, const GuiButtonInit &init) :
+		GuiElement(scene) {
+	_pictureId = init._texture;
+	_pictureIds[kDisabled] = init._disabled;
+	_pictureIds[kPressed] = init._pressed;
+	_pictureIds[kSelected] = init._selected;
+	_useOffsets = true;
+	_pressSound = init._pressSound;
+	_inactiveSound = init._inactiveSound;
+	_selectSound = init._selectSound;
+	_hasX = false;
+	_hasY = false;
+}
+
 void GuiButton::load(GameProject &project) {
 	GuiElement::load(project);
 	Scene *source = guiSourceScene(project, _sourceScene);
@@ -436,6 +452,18 @@ bool GuiButton::onMouseLKeyUp(Common::Point pos) {
 	return handled;
 }
 
+GuiElement *GuiManager::createButton(const GuiButtonInit &init) {
+	GuiButton *button = new GuiButton(_scene, init);
+	button->load(*g_ngi->_gameProject);
+	return button;
+}
+
+// CGuiElement::RemoveThis (104218)
+void GuiElement::removeThis() {
+	_scene._guiManager->removeElement(this);
+	delete this;
+}
+
 GuiManager::~GuiManager() {
 	for (GuiElement *element : _renderables)
 		delete element;
diff --git a/engines/ngi/guimanager.h b/engines/ngi/guimanager.h
index 1122639f861..adc3c8d50ee 100644
--- a/engines/ngi/guimanager.h
+++ b/engines/ngi/guimanager.h
@@ -37,6 +37,17 @@ class GameProject;
 class ObjectIdList;
 class PictureObject;
 
+/** BUTTON_INIT of CGuiButton::CGuiButton: the pictures and sounds of a button made by code */
+struct GuiButtonInit {
+	int _texture = 0;
+	int _selected = 0; // tex_selected
+	int _pressed = 0; // tex_pressed
+	int _disabled = 0; // tex_disable
+	int _selectSound = 0;
+	int _pressSound = 0;
+	int _inactiveSound = 0;
+};
+
 class GuiElement {
 public:
 	GuiElement(Scene &scene, const Common::StringMap &attrs, const ObjectIdList &ids);
@@ -68,6 +79,8 @@ public:
 	void show() { _visible = true; }
 	void hide() { _visible = _selected = false; }
 	void setPos(Common::Point pos) { _pos = pos; }
+	/** CGuiElement::RemoveThis: leaves the GUI manager of its scene and is deleted */
+	void removeThis();
 
 	Common::String _id;
 	Common::Point _pos, _size;
@@ -139,6 +152,8 @@ public:
 	explicit GuiManager(Scene &scene) : _scene(scene) {}
 	~GuiManager();
 	void createElement(const Common::String &type, const Common::StringMap &attrs, const ObjectIdList &ids);
+	/** CGuiButton::CGuiButton(BUTTON_INIT): the caller sets the id and adds it */
+	GuiElement *createButton(const GuiButtonInit &init);
 	// Takes ownership until removeElement() or destruction.
 	void addGuiElement(GuiElement *element);
 	void removeElement(GuiElement *element);
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index b7155117dfc..25d1862b619 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -1096,7 +1096,7 @@ void Scene::render(bool clear) {
 		g_ngi->_backgroundSurface.clear(0);
 	if (g_ngi->_gameVersion >= 201509) {
 		static bool warned = false;
-		if (!warned && _renderables.size() != _pictureObjects.size() + _aniObjects.size() + _roamingPictures.size() + _roamingAnis.size()) {
+		if (!warned && _renderables.size() < _pictureObjects.size() + _aniObjects.size() + _roamingPictures.size() + _roamingAnis.size()) {
 			warned = true;
 			warning("STUB/untested: CScene +176: the render list does not hold every object of the scene %d (%u of %u + %u + %u + %u)", _sceneId, _renderables.size(), _pictureObjects.size(),
 				_aniObjects.size(), _roamingPictures.size(), _roamingAnis.size());
@@ -1298,6 +1298,28 @@ uint Scene::unloadRoamings(bool all) {
 	return size;
 }
 
+// CScene::AddRoamingObject (123DF0): the roaming pictures load with the scene here, so only the
+// new one loads (the original calls CPreloadManager::LoadRoamings)
+void Scene::addRoamingObject(PictureObject *picture, bool load) {
+	if (findVisibleObject(picture->_id, picture->_copyId))
+		return;
+	debugC(4, kDebugLoading, "AddRoamingObject, id = %s", g_ngi->gameIdToStr(picture->_id).c_str());
+	_roamingPictures.push_back(picture);
+	if (load)
+		picture->load();
+	repopulateRenderables();
+}
+
+// CScene::RemoveRoamingObject (121E8A): the render list is not rebuilt
+void Scene::removeRoamingObject(int id) {
+	for (uint i = 0; i < _roamingPictures.size(); i++) {
+		if (_roamingPictures[i]->_id == id && !_roamingPictures[i]->_copyId) {
+			_roamingPictures.remove_at(i);
+			return;
+		}
+	}
+}
+
 // CScene::LoadMovement (121FA0) and UnloadMovement (121FB6)
 uint Scene::loadMovement(int aniId, int movementId) {
 	AniObject *ani = findAniObjectById(aniId, 0);
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index d7982f4cee9..c0c3edd2430 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -76,6 +76,9 @@ class Scene : public Background {
 	uint unloadAnis();
 	uint loadRoamings(bool all);
 	uint unloadRoamings(bool all);
+	/** CScene::AddRoamingObject / RemoveRoamingObject: a picture of another scene (CCatalogManager) */
+	void addRoamingObject(PictureObject *picture, bool load);
+	void removeRoamingObject(int id);
 	uint loadMovement(int aniId, int movementId);
 	uint unloadMovement(int aniId, int movementId);
 	uint loadAdditional();


Commit: c86d727158f725caaf16b499cc756fff28e8f8ad
    https://github.com/scummvm/scummvm/commit/c86d727158f725caaf16b499cc756fff28e8f8ad
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Port CCatalogManager and CCatalogItem

Changed paths:
  A engines/ngi/fullpipe/mobile/catalog.cpp
  A engines/ngi/fullpipe/mobile/catalog.h
    engines/ngi/fullpipe/constants.h
    engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
    engines/ngi/module.mk
    engines/ngi/ngi.cpp
    engines/ngi/ngi.h
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/fullpipe/constants.h b/engines/ngi/fullpipe/constants.h
index 3b482db0cfd..113924c9c25 100644
--- a/engines/ngi/fullpipe/constants.h
+++ b/engines/ngi/fullpipe/constants.h
@@ -46,6 +46,13 @@ namespace NGI {
 #define ANI_SC_TUTORIAL_ARROW 11025
 #define MV_SC_TUTORIAL_ARROW 11027
 #define ANI_MARK_CATALOG 23285
+#define PIC_CATALOG_UNLOCK_1 23286
+#define PIC_CATALOG_EMPTY_AVATAR 23405
+#define ST_MARK_CATALOG 23486
+#define QU_MARK_CATALOG 23488
+#define ST_MARK_CATALOG_BACK 23506
+#define SND_CMN_078 28080
+#define SND_CMN_081 23264
 #define SND_CMN_082 23540
 #define ANI_REACT 23132
 #define ST_REACT 23133
@@ -278,6 +285,7 @@ namespace NGI {
 #define SC_HELP 10002 // Android
 #define SC_LIFT 10003 // Android
 #define SC_NOTEBOOK 10005 // Android
+#define SC_CATALOG 10008 // Android
 #define SC_CHAPTER 10006 // Android
 #define SC_TUTORIAL 11000 // Android
 #define SC_COMMON 321
diff --git a/engines/ngi/fullpipe/mobile/catalog.cpp b/engines/ngi/fullpipe/mobile/catalog.cpp
new file mode 100644
index 00000000000..a5a317ba452
--- /dev/null
+++ b/engines/ngi/fullpipe/mobile/catalog.cpp
@@ -0,0 +1,380 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/ptr.h"
+#include "common/serializer.h"
+
+#include "ngi/ngi.h"
+#include "ngi/font.h"
+#include "ngi/gameloader.h"
+#include "ngi/gfx.h"
+#include "ngi/guimanager.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/xmlnode.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/mobile/catalog.h"
+
+namespace NGI {
+
+namespace {
+
+// CIDList::FindId: 0 for an unknown name
+int findId(const char *name) {
+	uint32 id = 0;
+	if (name[0])
+		g_ngi->_gameProject->_objectIds.findId(name, id);
+	return id;
+}
+
+// CDebugger::IsCheater: the debug class is not ported
+bool isCheater() {
+	return false;
+}
+
+} // End of anonymous namespace
+
+// CCatalogItem::Init (1595D4)
+void CatalogItem::init(GuiElement *button, bool unlocked, int picture, int unlockPicture, const Common::String &id, int infoPicture,
+		const Common::String &title, const Common::String &info) {
+	_picture = picture;
+	_unlocked = unlocked;
+	_button = button;
+	_unlockPicture = unlockPicture;
+	_id = id;
+	_infoPicture = infoPicture;
+	_title = title;
+	_info = info;
+}
+
+// CCatalogManager::CCatalogManager (159A70)
+CatalogManager::CatalogManager() {
+	_titleFont = g_ngi->getFont("task_dlg_29.fnt");
+	_infoFont = g_ngi->getFont("catalog_dlg_21.fnt");
+}
+
+CatalogManager::~CatalogManager() {
+	for (uint i = 0; i < _items.size(); i++)
+		delete _items[i];
+}
+
+// CCatalogManager::Init (15FFD4)
+void CatalogManager::init(const char *path) {
+	_scene = g_ngi->findScene(SC_NOTEBOOK);
+	_current = nullptr;
+	Common::ScopedPtr<XmlNode> document(loadXmlDocument(Common::Path(path)));
+	if (!document || !_scene || !_scene->_guiManager) {
+		warning("Could not read %s", path);
+		return;
+	}
+	const XmlNode &root = document->first();
+	for (uint i = 0; i < root.childCount(); i++) {
+		const XmlNode &node = root[i];
+		if (node.name() != "ITEM")
+			continue;
+		const Common::String id = node.attrStr("id", "");
+		const bool unlocked = node.attrBool("isUnlock", false);
+		if (CatalogItem *item = findElement(id)) {
+			if (unlocked)
+				item->unlock();
+			continue;
+		}
+		const int picture = findId(node.attrStr("pic", "PIC_CATALOG_AVATAR_0"));
+		const int unlockPicture = findId(node.attrStr("pic2", "PIC_CATALOG_UNLOCK_1"));
+		const int infoPicture = findId(node.attrStr("pic_info", "PIC_CATALOG_AVATAR_0"));
+		const Common::String title = g_ngi->getText(node.attrStr("text_title", "\xC7\xE0\xE3\xEE\xEB\xEE\xE2\xEE\xEA"));
+		const Common::String info = g_ngi->getText(node.attrStr("text_info", "\xD2\xE5\xEA\xF1\xF2"));
+
+		GuiButtonInit buttonInit;
+		buttonInit._texture = unlockPicture;
+		buttonInit._disabled = picture;
+		buttonInit._pressSound = SND_CMN_078;
+		buttonInit._inactiveSound = SND_CMN_081;
+		GuiElement *button = _scene->_guiManager->createButton(buttonInit);
+		button->_id = id;
+		_scene->_guiManager->addGuiElement(button);
+
+		CatalogItem *item = new CatalogItem;
+		item->init(button, unlocked, picture, unlockPicture, id, infoPicture, title, info);
+		_items.push_back(item);
+		button->unloadTexture();
+	}
+}
+
+// CCatalogManager::CleanXml (1603A0)
+void CatalogManager::cleanXml() {
+	clear();
+	init("data/catalog.xml");
+}
+
+// CCatalogManager::Clear (159748)
+void CatalogManager::clear() {
+	for (uint i = 0; i < _items.size(); i++) {
+		_items[i]->_button->removeThis();
+		delete _items[i];
+	}
+	_items.clear();
+	_current = nullptr;
+}
+
+// CCatalogManager::SetXmlData (15A834)
+void CatalogManager::setXmlData(const XmlNode &node) {
+	for (uint i = 0; i < node.childCount(); i++) {
+		if (node[i].name() != "ITEM" || node[i].attrInt("isUnlock", 0) != 1)
+			continue;
+		if (CatalogItem *item = findElement(node[i].attrStr("id", "")))
+			item->unlock();
+	}
+}
+
+// CCatalogManager::GetXmlData (159640): the id and the state of every item
+void CatalogManager::syncGame(Common::Serializer &s) {
+	uint32 count = _items.size();
+	s.syncAsUint32LE(count);
+	for (uint32 i = 0; i < count; i++) {
+		Common::String id;
+		bool unlocked = false;
+		if (s.isSaving()) {
+			id = _items[i]->_id;
+			unlocked = _items[i]->_unlocked;
+		}
+		s.syncString(id);
+		s.syncAsByte(unlocked);
+		if (s.isLoading() && unlocked) {
+			if (CatalogItem *item = findElement(id))
+				item->unlock();
+		}
+	}
+}
+
+// CCatalogManager::FindElement (15A7EA)
+CatalogItem *CatalogManager::findElement(const Common::String &id) const {
+	for (uint i = 0; i < _items.size(); i++) {
+		if (_items[i]->_id == id)
+			return _items[i];
+	}
+	return nullptr;
+}
+
+// CCatalogManager::UnlockItem (15A8E8)
+void CatalogManager::unlockItem(const Common::String &id) {
+	CatalogItem *item = findElement(id);
+	if (item && !item->_unlocked)
+		item->unlock();
+}
+
+// CCatalogManager::IsUnlockItem (15A922)
+bool CatalogManager::isUnlockItem(const Common::String &id) const {
+	const CatalogItem *item = findElement(id);
+	return item && item->_unlocked;
+}
+
+GuiElement *CatalogManager::element(const char *id) const {
+	return _scene->_guiManager->getElement(id);
+}
+
+uint CatalogManager::indexOf(const CatalogItem *item) const {
+	uint index = 0;
+	while (index < _items.size() && _items[index] != item)
+		index++;
+	return index;
+}
+
+// CCatalogManager::AddPicture (1597C8)
+void CatalogManager::addPicture(int id) {
+	Scene *catalog = g_ngi->findScene(SC_CATALOG);
+	PictureObject *picture = catalog ? catalog->findPictureObjectById(id, 0) : nullptr;
+	if (!picture)
+		return;
+	_scene->addRoamingObject(picture, true);
+	picture->setCenter(Common::Point(255, 304));
+	picture->_flags |= 4;
+}
+
+// CCatalogManager::RemovePicture (159810)
+void CatalogManager::removePicture(int id) {
+	Scene *catalog = g_ngi->findScene(SC_CATALOG);
+	PictureObject *picture = catalog ? catalog->findPictureObjectById(id, 0) : nullptr;
+	if (!picture)
+		return;
+	picture->_flags &= ~4;
+	picture->unload();
+	_scene->removeRoamingObject(id);
+}
+
+// CCatalogManager::SetRenderMessage (159840)
+void CatalogManager::setRenderMessage(bool show) {
+	removePicture(PIC_CATALOG_EMPTY_AVATAR);
+	_renderMessage = show;
+}
+
+// CCatalogManager::ShowPage (15C770)
+void CatalogManager::showPage(const Common::String &id) {
+	_pageShown = true;
+	_current = findElement(id);
+	if (!_current)
+		return;
+	addPicture(_current->_infoPicture);
+	element("BTN_TASK_PREV")->setPos(Common::Point(480, 490));
+	element("BTN_TASK_NEXT")->setPos(Common::Point(590, 490));
+	if (_current == _items.front())
+		element("BTN_TASK_PREV")->hideAndDeactivate();
+	else
+		element("BTN_TASK_PREV")->showAndActivate();
+	if (_current == _items.back())
+		element("BTN_TASK_NEXT")->hideAndDeactivate();
+	else
+		element("BTN_TASK_NEXT")->showAndActivate();
+	element("BTN_MENU_BAY_BACK")->showAndActivate();
+	_scene->findAniObjectById(ANI_MARK_CATALOG, 0)->setStatic(ST_MARK_CATALOG_BACK, false);
+	setRenderMessage(false);
+}
+
+// CCatalogManager::ShowLastUnlockHero (15C908)
+void CatalogManager::showLastUnlockHero() {
+	for (uint i = _items.size(); i > 0; i--) {
+		if (_items[i - 1]->_unlocked) {
+			showPage(Common::String(_items[i - 1]->_id));
+			return;
+		}
+	}
+}
+
+// CCatalogManager::HidePage (15C944)
+void CatalogManager::hidePage() {
+	if (_current) {
+		removePicture(_current->_infoPicture);
+		_current = nullptr;
+		element("BTN_TASK_PREV")->hideAndDeactivate();
+		element("BTN_TASK_NEXT")->hideAndDeactivate();
+		element("BTN_MENU_BAY_BACK")->hideAndDeactivate();
+	}
+	if (_scene) {
+		element("BTN_TASK_PREV")->setPos(Common::Point(160, 490));
+		element("BTN_TASK_NEXT")->setPos(Common::Point(270, 490));
+	}
+	_pageShown = false;
+	setRenderMessage(false);
+}
+
+// CCatalogManager::Hide (15CA5C)
+void CatalogManager::hide() {
+	hidePage();
+	for (uint i = 0; i < _items.size(); i++)
+		_items[i]->_button->hideAndDeactivate();
+}
+
+// CCatalogManager::NextPage (15E300)
+void CatalogManager::nextPage() {
+	const uint index = indexOf(_current);
+	if (index == _items.size() || index + 1 == _items.size() || !_items[index + 1]->_unlocked) {
+		setRenderMessage(true);
+		addPicture(PIC_CATALOG_EMPTY_AVATAR);
+		if (_current)
+			removePicture(_current->_infoPicture);
+		_current = nullptr;
+		element("BTN_TASK_NEXT")->hideAndDeactivate();
+		return;
+	}
+	removePicture(_current->_infoPicture);
+	showPage(Common::String(_items[index + 1]->_id));
+	if (_current == _items.back())
+		element("BTN_TASK_NEXT")->hideAndDeactivate();
+}
+
+// CCatalogManager::PrevPage (15E3D8)
+void CatalogManager::prevPage() {
+	if (_current)
+		removePicture(_current->_infoPicture);
+	const uint index = indexOf(_current);
+	if (index == 0 || !_items[index - 1]->_unlocked)
+		showLastUnlockHero();
+	else
+		showPage(Common::String(_items[index - 1]->_id));
+	setRenderMessage(false);
+}
+
+// CCatalogManager::SortItem (15F328)
+void CatalogManager::sortItem() {
+	Common::Array<CatalogItem *> locked;
+	Common::Array<CatalogItem *> sorted;
+	for (uint i = 0; i < _items.size(); i++) {
+		if (_items[i]->_unlocked)
+			sorted.push_back(_items[i]);
+		else
+			locked.push_back(_items[i]);
+	}
+	for (uint i = 0; i < locked.size(); i++)
+		sorted.push_back(locked[i]);
+	_items = sorted;
+}
+
+// CCatalogManager::Show (15F3C8); the analytics events of the original are not ported
+void CatalogManager::show() {
+	if (isCheater()) {
+		for (uint i = 0; i < _items.size(); i++)
+			_items[i]->unlock();
+	}
+	hidePage();
+	sortItem();
+	int y = 55;
+	for (uint j = 0; j < _items.size(); j++) {
+		int left = 124;
+		if (j == 28) {
+			y = 55;
+			left = 450;
+		} else if (j > 28) {
+			left = 450;
+		}
+		const int column = j & 3;
+		const int x = left + 42 * column + 25 * column;
+		if (column == 0)
+			y += 63;
+		GuiElement *button = _items[j]->_button;
+		button->setPos(Common::Point(x, y));
+		if (_items[j]->_unlocked)
+			button->activate();
+		button->show();
+	}
+}
+
+// CCatalogManager::OnRenderCatalogInfo (15A108)
+void CatalogManager::onRenderCatalogInfo() const {
+	Graphics::ManagedSurface &target = g_ngi->_backgroundSurface;
+	if (_current) {
+		const Common::String lang = g_ngi->getResourceLocale();
+		const BitmapFont *titleFont = _titleFont;
+		const BitmapFont *infoFont = _infoFont;
+		if (_current->_id == "ANI_VISUNCHIK" && (lang == "en" || lang == "de"))
+			infoFont = g_ngi->getFont("task_dlg_17.fnt");
+		if ((_current->_id == "ANI_WOMAN_28" || _current->_id == "ANI_BATUTA") && lang == "de")
+			titleFont = g_ngi->getFont("task_dlg_25.fnt");
+		const int titleShift = _current->_title.size() <= 16 ? 20 : 0;
+		if (titleFont)
+			titleFont->print(target, _current->_title, 450.0f, (float)(titleShift + 118), 250.0f, 50.0f, BitmapFont::kAlignCenter, BitmapFont::kVerticalTop);
+		if (infoFont)
+			infoFont->print(target, _current->_info, 450.0f, 170.0f, 250.0f, 350.0f, BitmapFont::kAlignCenter, BitmapFont::kVerticalCenter);
+	} else if (_renderMessage && _infoFont) {
+		_infoFont->print(target, g_ngi->getText("STR_CATALOG_MORE"), 450.0f, 170.0f, 250.0f, 350.0f, BitmapFont::kAlignCenter, BitmapFont::kVerticalCenter);
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/mobile/catalog.h b/engines/ngi/fullpipe/mobile/catalog.h
new file mode 100644
index 00000000000..4eb7909f0a2
--- /dev/null
+++ b/engines/ngi/fullpipe/mobile/catalog.h
@@ -0,0 +1,130 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_CATALOG_H
+#define NGI_FULLPIPE_CATALOG_H
+
+#include "common/array.h"
+#include "common/str.h"
+
+namespace Common {
+class Serializer;
+}
+
+namespace NGI {
+
+class BitmapFont;
+class GuiElement;
+class Scene;
+class XmlNode;
+
+/** CCatalogItem (0x20 bytes): a character of the catalog and its button in the notebook */
+class CatalogItem {
+public:
+	/** CCatalogItem::Init */
+	void init(GuiElement *button, bool unlocked, int picture, int unlockPicture, const Common::String &id, int infoPicture,
+		const Common::String &title, const Common::String &info);
+	/** CCatalogItem::Unlock */
+	void unlock() { _unlocked = true; }
+
+	GuiElement *_button = nullptr; // +0
+	bool _unlocked = false; // +4
+	int _picture = 0; // +8: pic, the picture of a locked character
+	int _unlockPicture = 0; // +12: pic2, the picture of an unlocked one
+	Common::String _id; // +16
+	int _infoPicture = 0; // +20: pic_info, the big picture of the character (scene SC_CATALOG)
+	Common::String _title; // +24
+	Common::String _info; // +28
+};
+
+/** CCatalogManager (NGIEngine::_catalogManager): the characters of catalog.xml (notebook) */
+class CatalogManager {
+public:
+	/** CCatalogManager::CCatalogManager */
+	CatalogManager();
+	/** CCatalogManager::~CCatalogManager: the items go, their buttons belong to the scene */
+	~CatalogManager();
+
+	/** CCatalogManager::Init: reads the file, one button for every character */
+	void init(const char *path);
+	/** CCatalogManager::CleanXml: all characters locked again */
+	void cleanXml();
+	/** CCatalogManager::Clear */
+	void clear();
+	/** CCatalogManager::SetXmlData: "isUnlock" of every ITEM */
+	void setXmlData(const XmlNode &node);
+	/** CCatalogManager::GetXmlData: the original writes catalog.sav, here the savegame holds it */
+	void syncGame(Common::Serializer &s);
+	/** CCatalogManager::GetSavePath: the file of the original, the engine saves with syncGame */
+	Common::String getSavePath() const { return "catalog.sav"; }
+
+	/** CCatalogManager::FindElement */
+	CatalogItem *findElement(const Common::String &id) const;
+	/** CCatalogManager::UnlockItem */
+	void unlockItem(const Common::String &id);
+	/** CCatalogManager::IsUnlockItem */
+	bool isUnlockItem(const Common::String &id) const;
+
+	/** CCatalogManager::Show: the unlocked characters first, in the grid of the two pages */
+	void show();
+	/** CCatalogManager::Hide: the page and the buttons */
+	void hide();
+	/** CCatalogManager::ShowPage: the big picture and text of a character */
+	void showPage(const Common::String &id);
+	/** CCatalogManager::HidePage */
+	void hidePage();
+	/** CCatalogManager::NextPage, PrevPage, ShowLastUnlockHero */
+	void nextPage();
+	void prevPage();
+	void showLastUnlockHero();
+	/** CCatalogManager::OnRenderCatalogInfo: title and text of the page that is shown */
+	void onRenderCatalogInfo() const;
+
+	/** +25: a page of a character is shown */
+	bool isPageShown() const { return _pageShown; }
+	/** +26: opened by the user command CATALOG, the back button leaves the catalog then */
+	bool isOpenedByCommand() const { return _openedByCommand; }
+	void setOpenedByCommand(bool opened) { _openedByCommand = opened; }
+
+	/** CCatalogManager::SortItem: the unlocked characters first, the order is kept */
+	void sortItem();
+
+private:
+	// CCatalogManager::AddPicture / RemovePicture / SetRenderMessage
+	void addPicture(int id);
+	void removePicture(int id);
+	void setRenderMessage(bool show);
+	GuiElement *element(const char *id) const;
+	uint indexOf(const CatalogItem *item) const;
+
+	Common::Array<CatalogItem *> _items; // +8
+	CatalogItem *_current = nullptr; // +20: the character whose page is shown
+	bool _renderMessage = false; // +24: "progress through the game to meet new characters" instead of a page
+	bool _pageShown = false; // +25
+	bool _openedByCommand = false; // +26
+	Scene *_scene = nullptr; // +28: the notebook (SC_NOTEBOOK)
+	const BitmapFont *_titleFont = nullptr; // +32: task_dlg_29.fnt
+	const BitmapFont *_infoFont = nullptr; // +36: catalog_dlg_21.fnt
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_CATALOG_H
diff --git a/engines/ngi/fullpipe/mobile/mainmenucontroller.cpp b/engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
index fcdfacd63d8..ebcdd6128b7 100644
--- a/engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/mainmenucontroller.cpp
@@ -28,6 +28,7 @@
 #include "ngi/scene.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/mobile/arcadeinterface.h"
+#include "ngi/fullpipe/mobile/catalog.h"
 #include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/mobile/achievements.h"
 #include "ngi/fullpipe/constants.h"
@@ -156,7 +157,8 @@ void MainMenuController::restartGame() {
 		g_ngi->_achievementsManager->cleanXml();
 	if (g_ngi->_chapterManager)
 		g_ngi->_chapterManager->cleanXml();
-	warnOnce("CCatalogManager::CleanXml: the catalog is not ported");
+	if (g_ngi->_catalogManager)
+		g_ngi->_catalogManager->cleanXml();
 	if (g_ngi->_map)
 		g_ngi->_map->cleanXml();
 	warnOnce("CHelp::CleanXml and CHintManager::CleanXml: not hooked here (ported separately)");
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index 468eb0aba2e..ad6ee80fdc1 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -87,6 +87,7 @@ MODULE_OBJS = \
 	fullpipe/lift.o \
 	fullpipe/mobile/achievements.o \
 	fullpipe/mobile/arcadeinterface.o \
+	fullpipe/mobile/catalog.o \
 	fullpipe/mobile/chaptercontroller.o \
 	fullpipe/mobile/chaptermanager.o \
 	fullpipe/mobile/controllerhelpers.o \
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 07fafac0285..2fc060c8e27 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -40,6 +40,7 @@
 #include "ngi/fullpipe/mobile/arcadeinterface.h"
 #include "ngi/fullpipe/mobile/fpcontroller.h"
 #include "ngi/fullpipe/mobile/map.h"
+#include "ngi/fullpipe/mobile/catalog.h"
 #include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/mobile/statemanager.h"
 #include "ngi/fullpipe/mobile/notebook.h"
diff --git a/engines/ngi/ngi.h b/engines/ngi/ngi.h
index d5fce9e423f..ead5482ac80 100644
--- a/engines/ngi/ngi.h
+++ b/engines/ngi/ngi.h
@@ -110,6 +110,7 @@ class ArcadeInterface;
 class MessageQueueBuilder;
 class BitmapFont;
 class TextContainer;
+class CatalogManager;
 class ChapterManager;
 class StateManager;
 class Notebook;
@@ -337,6 +338,8 @@ public:
 	Common::ScopedPtr<StateManager> _stateManager;
 	/** CSingleton<CAchievementsManager>: the achievements and their banners (achievements.xml) */
 	Common::ScopedPtr<AchievementsManager> _achievementsManager;
+	/** CSingleton<CCatalogManager>: the characters of catalog.xml (Android) */
+	Common::ScopedPtr<CatalogManager> _catalogManager;
 	/** CNotebookController, owned by its scene (SC_NOTEBOOK) */
 	Notebook *_notebook = nullptr;
 	/** CGame +112, made when first asked for (Android) */
diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index 37a57e32d9f..b1f02244d93 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -48,6 +48,7 @@
 #include "ngi/xmlnode.h"
 #include "ngi/scene.h"
 #include "ngi/statics.h"
+#include "ngi/fullpipe/mobile/catalog.h"
 #include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/fullpipe/mobile/exitmanager.h"
 #include "ngi/fullpipe/mobile/notebook.h"
@@ -1978,6 +1979,8 @@ Common::Error GameLoader::loadXML(const Common::Path &projectPath, const SceneTa
 		g_ngi->_taskManager->onShow();
 		g_ngi->_tutorialManager.reset(new TutorialManager);
 		g_ngi->_tutorialManager->init("data/tutorials.xml");
+		g_ngi->_catalogManager.reset(new CatalogManager);
+		g_ngi->_catalogManager->init("data/catalog.xml");
 		// CAchievementsManager::Init (after CCatalogManager::Init): achievements.xml
 		g_ngi->_achievementsManager.reset(new AchievementsManager);
 		g_ngi->_achievementsManager->init("data/achievements.xml");
@@ -1995,7 +1998,7 @@ Common::Error GameLoader::loadXML(const Common::Path &projectPath, const SceneTa
 		g_ngi->_help.reset(new Help);
 		g_ngi->_help->init("data/help.xml");
 		g_ngi->_noActionLogger.reset(new NoActionLogger);
-		warning("STUB: the task state is not saved yet (TaskManager::syncGame is not hooked into the savegames)");
+		warning("STUB: the task and catalog state are not saved yet (their syncGame is not hooked into the savegames)");
 	}
 	width = parser.width();
 	height = parser.height();


Commit: 3cce36897471c6dbcb00f45d39bd608ecdb0b933
    https://github.com/scummvm/scummvm/commit/3cce36897471c6dbcb00f45d39bd608ecdb0b933
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Wire the catalog into the notebook and the unlock calls

Changed paths:
    engines/ngi/fullpipe/floaters.cpp
    engines/ngi/fullpipe/mobile/controllerhelpers.cpp
    engines/ngi/fullpipe/mobile/fpcontroller.cpp
    engines/ngi/fullpipe/mobile/notebook.cpp
    engines/ngi/fullpipe/mobile/notebook.h
    engines/ngi/fullpipe/mobile/sc04controller.cpp
    engines/ngi/fullpipe/mobile/sc06controller.cpp
    engines/ngi/fullpipe/mobile/sc09controller.cpp


diff --git a/engines/ngi/fullpipe/floaters.cpp b/engines/ngi/fullpipe/floaters.cpp
index 641d1a74612..94910c7b08e 100644
--- a/engines/ngi/fullpipe/floaters.cpp
+++ b/engines/ngi/fullpipe/floaters.cpp
@@ -28,6 +28,7 @@
 #include "ngi/scene.h"
 #include "ngi/fullpipe/constants.h"
 #include "ngi/fullpipe/objectnames.h"
+#include "ngi/fullpipe/mobile/catalog.h"
 
 namespace NGI {
 
@@ -111,6 +112,9 @@ void FlyPack::addFly(Scene *sc, int x, int y, int priority, int flags) {
 	arr2.targetX = x;
 	arr2.x = x;
 	arr2.flags = flags;
+
+	if (android)
+		g_ngi->_catalogManager->unlockItem("ANI_FLY");
 }
 
 void FlyPack::onUpdate(uint32 elapsed) {
diff --git a/engines/ngi/fullpipe/mobile/controllerhelpers.cpp b/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
index 747565b44f7..194af6209e0 100644
--- a/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
+++ b/engines/ngi/fullpipe/mobile/controllerhelpers.cpp
@@ -28,6 +28,7 @@
 #include "ngi/scene.h"
 #include "ngi/sound.h"
 #include "ngi/statics.h"
+#include "ngi/fullpipe/mobile/catalog.h"
 #include "ngi/fullpipe/mobile/controllerhelpers.h"
 #include "ngi/fullpipe/mobile/fpcontroller.h"
 
@@ -158,8 +159,9 @@ void setSaving(bool) {
 	warnOnce("CBaseSettings::SetSaving (the saves are not blocked while the arcade runs)");
 }
 
-void unlockCatalogItem(const char *) {
-	warnOnce("CCatalogManager::UnlockItem: the catalog is not ported");
+// CCatalogManager::UnlockItem
+void unlockCatalogItem(const char *item) {
+	g_ngi->_catalogManager->unlockItem(item);
 }
 
 void enableSound(int, bool) {
diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
index efcf6cee45f..7c2eae1b340 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -36,6 +36,8 @@
 #include "ngi/statics.h"
 #include "ngi/scene.h"
 #include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/catalog.h"
+#include "ngi/fullpipe/mobile/notebook.h"
 #include "ngi/fullpipe/scenes.h"
 #include "ngi/fullpipe/mobile/taskmanager.h"
 #include "ngi/fullpipe/mobile/fpcontroller.h"
@@ -147,8 +149,22 @@ void FPController::executeUserCmd(Command *cmd, MessageQueue *queue) {
 		execCmdMctl(cmd, queue);
 	} else if (type == "MOUSE") {
 		execCmdMouse(cmd, queue);
-	} else if (type == "SET_CENTER" || type == "TUTORIAL_ACTIVATE" || type == "SHOW_CHAPTER_DIALOG" || type == "CATALOG" ||
-			type == "ENABLE_CHARACTER" || type == "HINT_ENABLE" || type == "SHOW_REVIEW") {
+	} else if (type == "CATALOG") {
+		const Common::String persId = cmd->_args.getValOrDefault("persId");
+		CatalogManager *catalog = g_ngi->_catalogManager.get();
+		CatalogItem *item = catalog->findElement(persId);
+		if (item && g_ngi->_notebook->_page != Notebook::kPageCatalog) {
+			g_ngi->_notebook->updateBuyPage(Notebook::kPageCatalog);
+			item->unlock();
+			catalog->setOpenedByCommand(true);
+			catalog->sortItem();
+			catalog->showPage(persId);
+		}
+	} else if (type == "ENABLE_CHARACTER") {
+		if (CatalogItem *item = g_ngi->_catalogManager->findElement(cmd->_args.getValOrDefault("persId")))
+			item->unlock();
+	} else if (type == "SET_CENTER" || type == "TUTORIAL_ACTIVATE" || type == "SHOW_CHAPTER_DIALOG" ||
+			type == "HINT_ENABLE" || type == "SHOW_REVIEW") {
 		// handled by CFPController::ExecuteUserCmd, waiting for their subsystems
 		static Common::HashMap<Common::String, bool> reported;
 		if (!reported.contains(type)) {
diff --git a/engines/ngi/fullpipe/mobile/notebook.cpp b/engines/ngi/fullpipe/mobile/notebook.cpp
index c93a9ca1184..1dc03913a96 100644
--- a/engines/ngi/fullpipe/mobile/notebook.cpp
+++ b/engines/ngi/fullpipe/mobile/notebook.cpp
@@ -28,6 +28,10 @@
 #include "ngi/objects.h"
 #include "ngi/anihandler.h"
 #include "ngi/fullpipe/mobile/achievements.h"
+#include "ngi/fullpipe/mobile/catalog.h"
+#include "ngi/behavior.h"
+#include "ngi/input.h"
+#include "ngi/gfx.h"
 #include "ngi/statics.h"
 #include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/guimanager.h"
@@ -177,6 +181,8 @@ Notebook::Notebook(int sceneId) : ISceneController(sceneId) {
 
 Notebook::~Notebook() {
 	clearHints();
+	if (g_ngi->_catalogManager)
+		g_ngi->_catalogManager->clear();
 	if (g_ngi->_notebook == this)
 		g_ngi->_notebook = nullptr;
 }
@@ -200,6 +206,16 @@ void Notebook::setElementVisible(const char *id, bool visible) {
 	}
 }
 
+GuiElement *Notebook::guiElement(const char *id) const {
+	return _scene->_guiManager->getElement(id);
+}
+
+// FindAniObject(ANI_MARK_CATALOG)->SetStatic
+void Notebook::setCatalogMark(int staticId) {
+	if (AniObject *mark = _scene->findAniObjectById(ANI_MARK_CATALOG, 0))
+		mark->setStatic(staticId, false);
+}
+
 // TEXT_BONUS and TEXT_BONUS_COUNT of the notebook scene; the count is the bonuses left
 void Notebook::setBonusesVisible(bool visible) {
 	setElementVisible("TEXT_BONUS", visible);
@@ -441,30 +457,72 @@ void Notebook::updateBookMarks() {
 	showGiveButtonHint(isTimerShowing());
 
 	const Task *task = currentTask();
-	if (!_tasks.empty() && _page == kPageTask && _current != -1) {
+	if (!_tasks.empty() && _page != kPageBuy && _page != kPageCatalog && _current != -1) {
+		g_ngi->_catalogManager->hide();
 		const bool showBonuses = g_ngi->_taskManager->getBonuses() > 0 && task && task->_state <= Task::kStateSeen && g_ngi->_tutorialManager->isTutorialCompleted();
 		setBonusesVisible(showBonuses);
-		setElementVisible("BTN_TASK_PREV", true);
-		setElementVisible("BTN_TASK_NEXT", true);
+		guiElement("BTN_TASK_PREV")->activate();
+		guiElement("BTN_TASK_PREV")->show();
+		guiElement("BTN_TASK_NEXT")->activate();
+		guiElement("BTN_TASK_NEXT")->show();
 	} else {
 		setElementVisible("GIVE_HINT", false);
 		setBonusesVisible(false);
-		const bool paged = _page == kPageCatalog; // CCatalogManager is not ported
-		setElementVisible("BTN_TASK_PREV", paged);
-		setElementVisible("BTN_TASK_NEXT", paged);
+		if (!g_ngi->_catalogManager->isPageShown()) {
+			guiElement("BTN_TASK_PREV")->deactivate();
+			guiElement("BTN_TASK_PREV")->hide();
+			guiElement("BTN_TASK_NEXT")->deactivate();
+			guiElement("BTN_TASK_NEXT")->hide();
+		}
 	}
+	// the arrows only belong to the pages of the catalog (CCatalogManager::ShowPage)
+	guiElement("BTN_TASK_PREV")->deactivate();
+	guiElement("BTN_TASK_PREV")->hide();
+	guiElement("BTN_TASK_NEXT")->deactivate();
+	guiElement("BTN_TASK_NEXT")->hide();
 }
 
+// CNotebookController::UpdateBuyPage (15D308)
 void Notebook::updateBuyPage(int page) {
-	if (page == kPageBuy || page == kPageCatalog) {
-		warnOnce(page == kPageBuy ? "CNotebookController::ActivateGuiMenuBuy: the hint shop is not ported" :
-			"CCatalogManager: the catalog is not ported");
+	if (page == kPageBuy) {
+		warnOnce("CNotebookController::ActivateGuiMenuBuy: the hint shop is not ported");
 		return;
 	}
+	if (page == kPageCatalog)
+		g_ngi->_catalogManager->setOpenedByCommand(false);
 	_page = page;
+	activateGuiMenuBuy(page == kPageBuy);
 	updateBookMarks();
 }
 
+// CNotebookController::ActivateGuiMenuBuy (15BD70)
+void Notebook::activateGuiMenuBuy(bool buy) {
+	static const char *const buttons[] = { "BTN_MENU_BAY_BACK", "BTN_MENU_BAY_1", "BTN_MENU_BAY_2", "BTN_MENU_BAY_3" };
+	for (const char *button : buttons) {
+		if (buy) {
+			guiElement(button)->activate();
+			guiElement(button)->show();
+		} else {
+			guiElement(button)->deactivate();
+			guiElement(button)->hide();
+		}
+	}
+	const int upgrade = g_ngi->_taskManager->getUpgrade();
+	if (upgrade == 1) {
+		guiElement("BTN_MENU_BAY_1")->deactivate();
+		guiElement("BTN_MENU_BAY_1")->hide();
+		guiElement("BTN_MENU_BAY_2")->setPos(Common::Point(460, 190));
+		guiElement("BTN_MENU_BAY_3")->setPos(Common::Point(460, 295));
+	}
+	if (upgrade == 2) {
+		guiElement("BTN_MENU_BAY_1")->deactivate();
+		guiElement("BTN_MENU_BAY_1")->hide();
+		guiElement("BTN_MENU_BAY_2")->deactivate();
+		guiElement("BTN_MENU_BAY_2")->hide();
+		guiElement("BTN_MENU_BAY_3")->setPos(Common::Point(460, 190));
+	}
+}
+
 void Notebook::onShow() {
 	// the texts and the fonts (CFontController::GetFont, CTextContainer)
 	_russian = g_ngi->getResourceLocale() == Common::String("ru");
@@ -571,6 +629,10 @@ bool Notebook::isBookMarksHit(Common::Point pos) const {
 }
 
 void Notebook::onHide() {
+	// (the original scrolls the inventory back in here, CInventoryController::ScrollIn)
+	g_ngi->_catalogManager->hide();
+	updateBuyPage(kPageTask);
+	setCatalogMark(ST_MARK_CATALOG);
 	// the notebook button of the inventory is released: PIC_INV_TASK shows, PIC_INV_TASK_PRESSED hides
 	if (g_ngi->_inventoryScene && g_ngi->_inventoryScene->_guiManager) {
 		if (GuiElement *task = g_ngi->_inventoryScene->_guiManager->getElement("PIC_INV_TASK"))
@@ -578,10 +640,8 @@ void Notebook::onHide() {
 		if (GuiElement *pressed = g_ngi->_inventoryScene->_guiManager->getElement("PIC_INV_TASK_PRESSED"))
 			pressed->hide();
 	}
-	// (the original scrolls the inventory back in, hides the catalog and resets the buy page)
 	_autoFoil = false;
 	_autoFoilHint = -1;
-	_page = kPageTask;
 }
 
 void Notebook::onUpdate(uint32 elapsed) {
@@ -690,6 +750,13 @@ bool Notebook::onMouseMove(uint32 id, float x, float y) {
 
 bool Notebook::onMouseLKeyUp(uint32 id, float x, float y) {
 	const Common::Point pos(x, y);
+	const GameObject *hit = g_ngi->_inputController->getHitObject();
+	if (hit && hit->_id == ANI_MARK_CATALOG && !hit->_copyId) {
+		play(kSndBookmark);
+		onGuiEvent("BTN_MARK_CATALOG", "unpress");
+		_scene->_behaviorController->enableMoves(_scene->findAniObjectById(ANI_MARK_CATALOG, 0), QU_MARK_CATALOG, false);
+		return true;
+	}
 	// A click outside of the book closes it
 	bool onBook = false;
 	if (_scene) {
@@ -699,7 +766,9 @@ bool Notebook::onMouseLKeyUp(uint32 id, float x, float y) {
 	for (uint i = 0; i < _bookmarks.size(); i++)
 		onBook |= _bookmarks[i].contains(pos);
 	if (!onBook) {
+		g_ngi->_catalogManager->hide();
 		updateBuyPage(kPageTask);
+		setCatalogMark(ST_MARK_CATALOG);
 		g_ngi->popScene(); // CGame::PopScene
 		return true;
 	}
@@ -707,13 +776,18 @@ bool Notebook::onMouseLKeyUp(uint32 id, float x, float y) {
 	for (uint i = 0; i < _bookmarks.size(); i++) {
 		if (!_bookmarks[i].contains(pos))
 			continue;
+		g_ngi->_catalogManager->hide();
 		updateBuyPage(kPageTask);
+		setCatalogMark(ST_MARK_CATALOG);
+		// (the analytics event 1st_run_press_note_2 is not ported)
 		play(kSndBookmark);
 		if ((int)i != _current) {
 			_current = i;
+			g_ngi->_catalogManager->hide();
+			updateBuyPage(kPageTask);
+			setCatalogMark(ST_MARK_CATALOG);
 			updateHints();
 			showGiveButtonHint(isTimerShowing());
-			updateBookMarks();
 		}
 		_pressed = false;
 		return true;
@@ -757,35 +831,69 @@ void Notebook::onKeyUp(uint32 key) {
 	}
 }
 
-// CNotebookController::OnGuiEvent: the buttons of the notebook
+// CNotebookController::OnGuiEvent (15F61C): the buttons of the notebook
 void Notebook::onGuiEvent(const Common::String &id, const Common::String &event) {
 	if (event != "unpress")
 		return;
 
+	CatalogManager *catalog = g_ngi->_catalogManager.get();
 	if (id == "GIVE_HINT") {
+		// (the analytics events 1st_run_press_want_more and press_want_more are not ported)
 		updateBuyPage(kPageBuy);
-	} else if (id == "BTN_TASK_PREV" || id == "BTN_TASK_NEXT") {
+		setCatalogMark(ST_MARK_CATALOG);
+	} else if (id == "BTN_TASK_PREV") {
 		if (_page == kPageCatalog) {
-			warnOnce("CCatalogManager::PrevPage/NextPage: the catalog is not ported");
+			catalog->prevPage();
 			return;
 		}
-		if (_tasks.empty())
+		if (--_current < 0)
+			_current = _tasks.size() - 1;
+		updateBookMarks();
+		updateHints();
+	} else if (id == "BTN_TASK_NEXT") {
+		if (_page == kPageCatalog) {
+			catalog->nextPage();
 			return;
-		if (id == "BTN_TASK_PREV") {
-			if (--_current < 0)
-				_current = _tasks.size() - 1;
-		} else if (++_current >= (int)_tasks.size()) {
-			_current = 0;
 		}
+		if (++_current >= (int)_tasks.size())
+			_current = 0;
 		updateBookMarks();
 		updateHints();
-	} else if (id == "BTN_MENU_BAY_BACK" || id == "BTN_MENU_BAY_1" || id == "BTN_MENU_BAY_2" || id == "BTN_MENU_BAY_3") {
+	} else if (id == "BTN_MENU_BAY_BACK") {
+		if (_page == kPageCatalog) {
+			catalog->hidePage();
+			guiElement("BTN_TASK_PREV")->hideAndDeactivate();
+			guiElement("BTN_TASK_NEXT")->hideAndDeactivate();
+		}
+		if (!catalog->isOpenedByCommand() && _page != kPageBuy) {
+			updateBuyPage(kPageCatalog);
+			catalog->show();
+			setCatalogMark(ST_MARK_CATALOG_BACK);
+		} else {
+			updateBuyPage(kPageTask);
+			setCatalogMark(ST_MARK_CATALOG);
+		}
+	} else if (id == "BTN_MENU_BAY_1" || id == "BTN_MENU_BAY_2" || id == "BTN_MENU_BAY_3") {
 		warnOnce("CNotebookController::OnBuyButtonPressed: purchases of hints are not ported");
 	} else if (id == "BTN_MARK_CATALOG") {
-		updateBuyPage(kPageCatalog);
+		catalog->hidePage();
+		if (_page == kPageCatalog) {
+			catalog->hide();
+			updateBuyPage(kPageTask);
+			setCatalogMark(ST_MARK_CATALOG);
+		} else if (_page <= kPageBuy) {
+			updateBuyPage(kPageCatalog);
+			catalog->show();
+			setCatalogMark(ST_MARK_CATALOG_BACK);
+		}
 	} else if (id == "BTN_SC_NOTEBOOK_CLOSE") {
+		catalog->hide();
 		updateBuyPage(kPageTask);
+		setCatalogMark(ST_MARK_CATALOG);
 		g_ngi->popScene(); // CGame::PopScene
+	} else if (catalog->isUnlockItem(id)) {
+		catalog->hide();
+		catalog->showPage(id);
 	}
 }
 
@@ -950,7 +1058,7 @@ void Notebook::onRender(Common::Point) {
 		warnOnce("CNotebookController::OnRenderMenuBuy is not ported");
 		break;
 	case kPageCatalog:
-		warnOnce("CCatalogManager::OnRenderCatalogInfo is not ported");
+		g_ngi->_catalogManager->onRenderCatalogInfo();
 		break;
 	case kPageTask:
 		renderTaskPage();
diff --git a/engines/ngi/fullpipe/mobile/notebook.h b/engines/ngi/fullpipe/mobile/notebook.h
index 4a202109480..4e5ecc41b1e 100644
--- a/engines/ngi/fullpipe/mobile/notebook.h
+++ b/engines/ngi/fullpipe/mobile/notebook.h
@@ -32,6 +32,7 @@
 
 namespace NGI {
 
+class GuiElement;
 class Task;
 
 // CFoil: a cover over a hint, scratched off with the pointer; a grid of 18 pixel pieces,
@@ -154,6 +155,9 @@ private:
 
 	void removeFoil(uint32 elapsed);
 	void setElementVisible(const char *id, bool visible);
+	GuiElement *guiElement(const char *id) const;
+	void setCatalogMark(int staticId);
+	void activateGuiMenuBuy(bool buy);
 	void setBonusesVisible(bool visible);
 	void updateBonusCount();
 	void setBonusVisible(bool visible);
diff --git a/engines/ngi/fullpipe/mobile/sc04controller.cpp b/engines/ngi/fullpipe/mobile/sc04controller.cpp
index 1beab6c913f..9e21b924b06 100644
--- a/engines/ngi/fullpipe/mobile/sc04controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc04controller.cpp
@@ -549,7 +549,7 @@ void Sc04Controller::tryBall() {
 		_ballWalksRight = !_ballWalksRight;
 		slowDownBall();
 		_ballTimer = 0;
-		// CCatalogManager::UnlockItem(ANI_BIGBALL): the catalog is not ported
+		unlockCatalogItem("ANI_BIGBALL");
 	}
 }
 
@@ -574,7 +574,7 @@ void Sc04Controller::doStartArcade() {
 	_kozawInBottle = false;
 	_hintPending = true;
 	_ladderActed = false;
-	// CCatalogManager::UnlockItem(ANI_KOZAWKA): the catalog is not ported
+	unlockCatalogItem("ANI_KOZAWKA");
 }
 
 // CSc04Controller::AfterLadder (165840): ladder gone, walking and clicks are back
diff --git a/engines/ngi/fullpipe/mobile/sc06controller.cpp b/engines/ngi/fullpipe/mobile/sc06controller.cpp
index 2d1393e7da5..29986d20328 100644
--- a/engines/ngi/fullpipe/mobile/sc06controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc06controller.cpp
@@ -836,7 +836,7 @@ void Sc06Controller::onShow() {
 	_scene->findAniObjectById(ANI_MAMASHA, 0)->setPosition(Common::Point(660, 378));
 	_scene->_behaviorController->getAniQueue(ANI_MAMASHA, QU_MOM_LOOKEMPTY)->setEnabled(true);
 	_scene->_behaviorController->getAniQueue(ANI_MAMASHA, QU_MOM_OPENEYE)->setEnabled(true);
-	warnOnce("CCatalogManager::UnlockItem ANI_MAMASHA (the catalog is not ported)");
+	unlockCatalogItem("ANI_MAMASHA");
 }
 
 // CSc06Controller::OnHide (16D74C)
diff --git a/engines/ngi/fullpipe/mobile/sc09controller.cpp b/engines/ngi/fullpipe/mobile/sc09controller.cpp
index 0188bb5eec0..b0d666eecd7 100644
--- a/engines/ngi/fullpipe/mobile/sc09controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc09controller.cpp
@@ -258,7 +258,7 @@ void Sc09Controller::doStartTiotia() {
 	if (command)
 		command->setParamFloat("x", (float)(sceneX + (float)g_ngi->gameWidth()) + 30.0f);
 	_scene->runQueueObject(copy, nullptr, 3);
-	warnOnce("CCatalogManager::UnlockItem for ANI_TIOTIA is not ported");
+	unlockCatalogItem("ANI_TIOTIA");
 }
 
 // CSc09Controller::DoUpdatePath (171298)


Commit: f0747e5a126eb9766e5c87e4aa29c6bd84a55f04
    https://github.com/scummvm/scummvm/commit/f0747e5a126eb9766e5c87e4aa29c6bd84a55f04
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Keep the wait attribute of SHOW, HIDE and USER commands

Changed paths:
    engines/ngi/xmlproject.cpp


diff --git a/engines/ngi/xmlproject.cpp b/engines/ngi/xmlproject.cpp
index b1f02244d93..d3c692d143b 100644
--- a/engines/ngi/xmlproject.cpp
+++ b/engines/ngi/xmlproject.cpp
@@ -1442,7 +1442,6 @@ private:
 		const char *idProperty = nullptr;
 		if (kind == "SHOW" || kind == "1") {
 			cmd->_cmd = kCmdShow;
-			cmd->_wait = 0;
 			if (!readId(node->values.getValOrDefault("ani"), cmd->_parentId))
 				return parserError("Unknown animation in SHOW");
 			cmd->_messageNum = -1;
@@ -1485,9 +1484,6 @@ private:
 		} else if (kind == "USER" || kind == "12" || kind == "SET_ACTIVE_INTERACTION") {
 			cmd->_cmd = kCmdUser;
 			cmd->_messageName = node->values.getValOrDefault("type", kind);
-			// only SET_SCROLL waits (CFPController::UpdateCmdScroll); GO_MCTL (UpdateCmdMctl) is not ported
-			if (cmd->_messageName != "SET_SCROLL")
-				cmd->_wait = 0;
 		} else if (kind == "START_MOVEMENT" || kind == "3") {
 			cmd->_cmd = kCmdStartMovement;
 			cmd->_mirror = boolProperty(*node, "mirror");
@@ -1497,7 +1493,6 @@ private:
 			idProperty = "mov";
 		} else if (kind == "HIDE" || kind == "2") {
 			cmd->_cmd = kCmdHide;
-			cmd->_wait = 0;
 			if (!readId(node->values.getValOrDefault("vis"), cmd->_parentId))
 				return parserError("Unknown object in HIDE");
 		} else if (kind == "QUEUE" || kind == "24") {


Commit: 857392b1e255460e23d450bbca87f0eb4e98818f
    https://github.com/scummvm/scummvm/commit/857392b1e255460e23d450bbca87f0eb4e98818f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:50+01:00

Commit Message:
NGI: Port CFPController::CopyCommonQeueus

Changed paths:
    engines/ngi/fullpipe/mobile/fpcontroller.cpp
    engines/ngi/fullpipe/mobile/fpcontroller.h
    engines/ngi/scene.cpp
    engines/ngi/scene.h


diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
index 7c2eae1b340..2fe88af58c9 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -205,9 +205,10 @@ FPController::FPController(int sceneId) : ISceneController(sceneId) {
 
 // CFPController::OnSceneInit (14F9C8)
 void FPController::onSceneInit() {
-	// +12 (the hero) is hero(), CopyCommonQeueus is the lazy copy in Scene::findMessageQueue (D35)
+	// +12 (the hero) is hero()
 	fillCursorData();
 	initBorders();
+	copyCommonQueues();
 	if (_scene->_sceneId != SC_INV) {
 		const Common::Array<GameObject *> objects = _scene->_renderables;
 		for (GameObject *object : objects)
@@ -223,6 +224,22 @@ void FPController::onSceneInit() {
 	_react->pushToPreload(_scene);
 }
 
+// CFPController::CopyCommonQeueus (14F584): CheckId is a no-op, the copy has the id of its source
+void FPController::copyCommonQueues() {
+	if (_scene->_sceneId == SC_COMMON)
+		return;
+	Scene *common = g_ngi->findScene(SC_COMMON);
+	if (!common)
+		return;
+	Common::Array<MessageQueue *> sources;
+	for (MessageQueue *queue = common->nextQueueByKey(true, 0); queue; queue = common->nextQueueByKey(false, queue->_sceneKey))
+		sources.push_back(queue);
+	for (MessageQueue *source : sources) {
+		MessageQueue *copy = new MessageQueue(source, 0, 0);
+		_scene->addQueue(copy, copy->_queueId);
+	}
+}
+
 AniObject *FPController::hero() const {
 	return g_ngi->_aniMan;
 }
diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.h b/engines/ngi/fullpipe/mobile/fpcontroller.h
index 97375ef9c33..352b767fdda 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.h
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.h
@@ -77,6 +77,8 @@ public:
 	int getCursorType(float x, float y) override;
 	/** CFPController::OnSceneInit (14F9C8) */
 	void onSceneInit() override;
+	/** CFPController::CopyCommonQeueus (14F584): the queues of SC_COMMON become queues of the scene */
+	void copyCommonQueues();
 	/** CFPController::FillCursorData (14F64C): the cursor type of the objects of the scene (+96) */
 	void fillCursorData();
 	/** CScene init: OnSceneInit once before the first OnShow */
diff --git a/engines/ngi/scene.cpp b/engines/ngi/scene.cpp
index 25d1862b619..b06315b543e 100644
--- a/engines/ngi/scene.cpp
+++ b/engines/ngi/scene.cpp
@@ -697,16 +697,10 @@ MessageQueue *Scene::findMessageQueue(int messageId) {
 				return _madeQueues[i];
 	}
 
-	MessageQueue *shared = _commonQueueScene ? _commonQueueScene->findMessageQueue(messageId) : nullptr;
-	if (shared && g_ngi->_gameVersion >= 201509) {
-		// as in the original (CScene::FindMessageQueue): the common queue becomes one of this scene
-		MessageQueue *own = new MessageQueue(shared, 0, 0);
-		own->_scene = this;
-		own->_sceneKey = messageId;
-		_messageQueues.push_back(own);
-		return own;
-	}
-	return shared;
+	// from >= 201509 CFPController::OnSceneInit has copied the queues of SC_COMMON into the scene
+	if (g_ngi->_gameVersion >= 201509)
+		return nullptr;
+	return _commonQueueScene ? _commonQueueScene->findMessageQueue(messageId) : nullptr;
 }
 
 // CScene::RunQueue (1225A4)
@@ -746,6 +740,22 @@ void Scene::addQueue(MessageQueue *queue) {
 	_madeQueues.push_back(queue);
 }
 
+// CScene::AddQueue (122934)
+void Scene::addQueue(MessageQueue *queue, uint key) {
+	queue->_scene = this;
+	queue->_sceneKey = key;
+	// the map takes a key once (_M_insert_unique), a queue that is not taken is never found or polled
+	bool taken = false;
+	for (const MessageQueue *other : _messageQueues)
+		taken = taken || other->_sceneKey == key;
+	for (const MessageQueue *other : _madeQueues)
+		taken = taken || other->_sceneKey == key;
+	if (taken)
+		_unmappedQueues.push_back(queue);
+	else
+		_madeQueues.push_back(queue);
+}
+
 MessageQueue *Scene::nextQueueByKey(bool first, uint key) const {
 	MessageQueue *next = nullptr;
 	for (uint i = 0; i < _messageQueues.size(); i++) {
diff --git a/engines/ngi/scene.h b/engines/ngi/scene.h
index c0c3edd2430..5c1ba2cdf63 100644
--- a/engines/ngi/scene.h
+++ b/engines/ngi/scene.h
@@ -140,7 +140,7 @@ class Scene : public Background {
 	void (*_guiEventHandler)(Scene &, const Common::String &, const Common::String &) = nullptr;
 	void onGuiEvent(const Common::String &id, const Common::String &event);
 	// CScene +212: the XML queues, owned. From >= 201509 they run in place and Update polls them;
-	// the queues of the common scene (_commonQueueScene) are copied in at first use (findMessageQueue)
+	// the queues of SC_COMMON are copied in by CFPController::OnSceneInit (shared before 201509)
 	Common::Array<MessageQueue *> _messageQueues;
 	Scene *_commonQueueScene = nullptr;
 	/** Queues made by the code (CScene::AddQueue), owned, polled like _messageQueues (>= 201509) */
@@ -206,6 +206,8 @@ class Scene : public Background {
 	bool runQueue(int queueId, int interruptState = 4, bool setHero = false);
 	/** CScene::AddQueue (12285A): the scene owns the queue from now on and Update polls it */
 	void addQueue(MessageQueue *queue);
+	/** CScene::AddQueue (122934): with the key of the queue (CFPController::CopyCommonQeueus) */
+	void addQueue(MessageQueue *queue, uint key);
 	/** CScene::DeleteObjAfter (122B78), RemoveObjectSafe (11FF24): delete at the end of the update */
 	void deleteObjAfter(MessageQueue *queue);
 	void removeObjectSafe();


Commit: e03877ba4233f73ef3a75a00bd498db96dc27ea6
    https://github.com/scummvm/scummvm/commit/e03877ba4233f73ef3a75a00bd498db96dc27ea6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:51+01:00

Commit Message:
NGI: Port CScIntoController and enter the intro scenes through it

Changed paths:
  A engines/ngi/fullpipe/mobile/introcontroller.cpp
  A engines/ngi/fullpipe/mobile/introcontroller.h
    engines/ngi/fullpipe/mobile/scenecontrollers.cpp
    engines/ngi/fullpipe/sceneIntro.cpp
    engines/ngi/fullpipe/scenes.cpp
    engines/ngi/fullpipe/scenes.h
    engines/ngi/module.mk
    engines/ngi/ngi.cpp


diff --git a/engines/ngi/fullpipe/mobile/introcontroller.cpp b/engines/ngi/fullpipe/mobile/introcontroller.cpp
new file mode 100644
index 00000000000..2d22897a6af
--- /dev/null
+++ b/engines/ngi/fullpipe/mobile/introcontroller.cpp
@@ -0,0 +1,252 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ngi/ngi.h"
+#include "ngi/behavior.h"
+#include "ngi/fader.h"
+#include "ngi/gameloader.h"
+#include "ngi/guimanager.h"
+#include "ngi/messages.h"
+#include "ngi/scene.h"
+#include "ngi/statics.h"
+#include "ngi/fullpipe/constants.h"
+#include "ngi/fullpipe/mobile/chaptermanager.h"
+#include "ngi/fullpipe/mobile/controllerhelpers.h"
+#include "ngi/fullpipe/mobile/introcontroller.h"
+
+namespace NGI {
+
+namespace {
+
+// the bits of +232
+const uint32 kStateTapToEnd = 1;
+const uint32 kStateWaitSound = 4;
+const uint32 kStateStart = 8;
+const uint32 kStateRunning = 0x10;
+const uint32 kStateEnd = 0x20;
+const uint32 kStateTapToEnd2 = 0x40;
+
+GuiElement *skipButton(int sceneId, const char *id) {
+	Scene *scene = g_ngi->findScene(sceneId);
+	return scene && scene->_guiManager ? scene->_guiManager->getElement(id) : nullptr;
+}
+
+} // End of anonymous namespace
+
+// CScIntoController::CScIntoController (198BB4)
+ScIntroController::ScIntroController(int sceneId) : FPController(sceneId) {
+}
+
+// CScIntoController::OnShow (19921C)
+void ScIntroController::onShow() {
+	if (_stage != 2 && _scene->_sceneId == SC_INTRO1)
+		warnOnce("CScene::CleanXml (121770) of SC_INTRO1 is not ported (the state of the scene is not restored)");
+
+	Scene *first = g_ngi->findScene(SC_INTRO1);
+	_man = first->findAniObjectById(ANI_IN1MAN, 0);
+	_titlePicture = first->findPictureObjectById(PIC_IN1_GAMETITLE, 0);
+	if (_state == 0 && _scene->_sceneId == SC_INTRO1) {
+		_titlePicture->_flags &= ~4;
+		_state = kStateStart;
+		_restart = false;
+		g_ngi->_fader.startFade(1025, 0, 0);
+		// CFlurryEventManager::StartLocalTime: the analytics are not ported
+	}
+	_needSleep = true;
+	_needGetup = false;
+
+	// the skip buttons at the right edge of the screen (CRender +8, +24, +36)
+	GuiElement *button = skipButton(SC_INTRO1, "BTN_SC_INTRO_SKIP_1");
+	const int x = g_ngi->_wideOfs + g_ngi->gameWidth() - button->_size.x;
+	const int y = button->_pos.y;
+	button->setPos(Common::Point(x, y));
+	skipButton(SC_INTRO2, "BTN_SC_INTRO_SKIP_2")->setPos(Common::Point(x, y));
+}
+
+// CScIntoController::OnUpdate (19938C)
+void ScIntroController::onUpdate(uint32 elapsed) {
+	Fader &fader = g_ngi->_fader;
+	fader.onUpdate(elapsed);
+	if (fader.getState() != Fader::kIdle) {
+		if (fader.getState() == Fader::kWait && (_state & kStateWaitSound) && _playSound) {
+			g_ngi->playSound(SND_INTR_019, 0); // CSoundManager::Play(0x1464)
+			_playSound = false;
+		}
+		return;
+	}
+
+	if (_state & kStateTapToEnd2) {
+		doEndIntro();
+	} else if (_state & kStateTapToEnd) {
+		fader.startFade(1025, 4150, 1025);
+		if (_field216)
+			_field216->_flags &= ~4;
+		if (_titlePicture)
+			_titlePicture->_flags |= 4;
+		_state = (_state & ~5u) | kStateWaitSound;
+		_playSound = true;
+	} else if (_state & kStateWaitSound) {
+		fader.startFade(1025, 0, 0);
+		if (_titlePicture)
+			_titlePicture->_flags &= ~4;
+		_state = (_state & ~0xCu) | kStateStart;
+		// CFlurryEventManager::StartLocalTime: the analytics are not ported
+	} else if (_state & kStateEnd) {
+		doEndIntro();
+	} else if (_state & kStateStart) {
+		skipButton(_scene->_sceneId, "BTN_SC_INTRO_SKIP_1")->showAndActivate();
+		_scene->runQueue(QU_INTR_STARTINTRO, 2);
+		_state = (_state & ~0x18u) | kStateRunning;
+		g_ngi->findScene(SC_INTRO2)->message("MSG_SETFLIC_WAIT", "", nullptr);
+		if (_scene->_sceneId == SC_INTRO1)
+			_stage = 1;
+	} else if (_state & kStateRunning) {
+		if (_needSleep) {
+			if (!_man->_movement && _man->getStaticsId() == ST_IN1MAN_SLEEP)
+				_man->startMovement(MV_IN1MAN_SLEEP, 0, -1);
+		} else if (_needGetup && !_man->_movement && _man->getStaticsId() == ST_IN1MAN_SLEEP) {
+			_needGetup = false;
+			_scene->runQueue(QU_INTR_GETUPMAN, 4);
+		}
+	}
+}
+
+// CScIntoController::OnRender (198D98)
+void ScIntroController::onRender(Common::Point scroll) {
+	g_ngi->_fader.onRender();
+}
+
+// CScIntoController::OnMessage (19971C)
+void ScIntroController::onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) {
+	if (message == "MSG_INTR_SWITCHTO2") {
+		doSwitchTo2();
+	} else if (message == "MSG_INTR_SWITCHTO1") {
+		doSwitchTo1();
+	} else if (message == "MSG_INTR_ENDINTRO") {
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_1", true);
+		_state = (_state & ~0x30u) | kStateEnd;
+	} else if (message == "MSG_INTR_GETUPMAN") {
+		_needSleep = false;
+		_needGetup = true;
+	} else if (message == "MSG_ENABLE_BHV_SOUND") {
+		_scene->_behaviorController->enableAllMusic();
+	} else if (message == "MSG_RESTART_GAME") {
+		_restart = true;
+		_state = 0;
+	} else if (message == "MSG_SET_STAGE_2") {
+		_stage = 2;
+	} else if (message == "MSG_SETFLIC_WAIT") {
+		_state = kStateRunning;
+	} else if (message == "MSG_DO_END_INTRO") {
+		_state = 0;
+		_stage = 0;
+	} else {
+		FPController::onMessage(message, param, queue);
+	}
+}
+
+// CScIntoController::OnGuiEvent (1995EC)
+void ScIntroController::onGuiEvent(const Common::String &id, const Common::String &event) {
+	if ((id == "BTN_SC_INTRO_SKIP_1" || id == "BTN_SC_INTRO_SKIP_2") && event == "unpress") {
+		tryEndIntro();
+		skipButton(SC_INTRO1, "BTN_SC_INTRO_SKIP_1")->hideAndDeactivate();
+		skipButton(SC_INTRO2, "BTN_SC_INTRO_SKIP_2")->hideAndDeactivate();
+	}
+}
+
+// CScIntoController::OnKeyUp (198EE4)
+void ScIntroController::onKeyUp(uint32 key) {
+	if ((key & 0xFFFFFF7F) == 4)
+		tryEndIntro();
+}
+
+// CScIntoController::OnMouseLKeyUpTop (198EF4)
+bool ScIntroController::onMouseLKeyUpTop(uint32 id, float x, float y) {
+	if (_state == kStateTapToEnd || _state == kStateWaitSound || _state == kStateTapToEnd2) {
+		tryEndIntro();
+		return true;
+	}
+	return false;
+}
+
+// CScIntoController::DoSwitchTo2 (1996A0)
+void ScIntroController::doSwitchTo2() {
+	g_ngi->_gameLoader->preloadScene(SC_INTRO2, 0); // CGame::SetScene
+	Scene *second = g_ngi->findScene(SC_INTRO2);
+	second->runQueue(QU_IN2_DO, 4);
+	skipButton(SC_INTRO2, "BTN_SC_INTRO_SKIP_2")->showAndActivate();
+}
+
+// CScIntoController::DoSwitchTo1 (198D1C)
+void ScIntroController::doSwitchTo1() {
+	g_ngi->_gameLoader->preloadScene(SC_INTRO1, 0);
+	Scene *first = g_ngi->findScene(SC_INTRO1);
+	first->message("MSG_SET_STAGE_2", "", nullptr);
+	first->runQueue(QU_INTR_FINISH, 4);
+}
+
+// CScIntoController::TryEndIntro (198DAC)
+void ScIntroController::tryEndIntro() {
+	Fader &fader = g_ngi->_fader;
+	if (_state & kStateTapToEnd) {
+		fader.startFade(1025, 4150, 1025);
+		if (_field216)
+			_field216->_flags &= ~4;
+		if (_titlePicture)
+			_titlePicture->_flags |= 4;
+		_state = (_state & ~5u) | kStateWaitSound;
+		_playSound = true;
+	} else if (_state & kStateWaitSound) {
+		fader.startFade(1025, 0, 0);
+		if (_titlePicture)
+			_titlePicture->_flags &= ~4;
+		_state = (_state & ~0xCu) | kStateStart;
+		// CFlurryEventManager::StartLocalTime: the analytics are not ported
+	} else if (_state & kStateEnd) {
+		doEndIntro();
+	} else if (_state & (kStateStart | kStateRunning)) {
+		_state &= ~(kStateStart | kStateRunning);
+		_state |= kStateEnd;
+		g_ngi->_chapterManager->showChapterDialog("CHAPTER_1", true);
+		// CFlurryEventManager::Event("1st_run_press_video"): the analytics are not ported
+	}
+}
+
+// CScIntoController::DoEndIntro (198C48)
+void ScIntroController::doEndIntro() {
+	_state = 0;
+	_stage = 0;
+	if (g_ngi->_sceneStack.size() == 1) {
+		Scene *first = g_ngi->findScene(SC_INTRO1);
+		if (_scene->_sceneId == SC_INTRO2) {
+			g_ngi->_gameLoader->preloadScene(SC_INTRO1, 0);
+			first->message("MSG_DO_END_INTRO", "", nullptr);
+		}
+		MessageQueue *queue = first->findMessageQueue(QU_INTR_STARTINTRO);
+		if (queue && queue->_curIndex != -1)
+			queue->stop(false);
+		g_ngi->_gameLoader->preloadScene(SC_1, TrubaLeft);
+	} else {
+		g_ngi->popScene();
+	}
+}
+
+} // End of namespace NGI
diff --git a/engines/ngi/fullpipe/mobile/introcontroller.h b/engines/ngi/fullpipe/mobile/introcontroller.h
new file mode 100644
index 00000000000..bd68b39533b
--- /dev/null
+++ b/engines/ngi/fullpipe/mobile/introcontroller.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NGI_FULLPIPE_INTROCONTROLLER_H
+#define NGI_FULLPIPE_INTROCONTROLLER_H
+
+#include "ngi/fullpipe/mobile/fpcontroller.h"
+
+namespace NGI {
+
+class AniObject;
+class PictureObject;
+
+/** CScIntoController (0xF4 bytes): one for each of the two intro scenes, SC_INTRO1 and SC_INTRO2 */
+class ScIntroController : public FPController {
+public:
+	/** CScIntoController::CScIntoController (198BB4) */
+	explicit ScIntroController(int sceneId);
+
+	void onShow() override;
+	void onUpdate(uint32 elapsed) override;
+	void onRender(Common::Point scroll) override;
+	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
+	void onGuiEvent(const Common::String &id, const Common::String &event) override;
+	void onKeyUp(uint32 key) override;
+	bool onMouseLKeyUpTop(uint32 id, float x, float y) override;
+	// CScIntoController::OnMouseLKeyDown, LKeyUp, RKeyDown, RKeyUp (198A2E..198A3A): nothing
+	bool onMouseLKeyDown(uint32 id, float x, float y) override { return false; }
+	bool onMouseLKeyUp(uint32 id, float x, float y) override { return false; }
+	bool onMouseRKeyDown(uint32 id, float x, float y) override { return false; }
+	bool onMouseRKeyUp(uint32 id, float x, float y) override { return false; }
+	bool isInventoryEnabled() override { return false; }
+	bool isInventoryRendered() override { return false; }
+	int getCursorType(float x, float y) override { return 6; }
+
+private:
+	/** DoEndIntro (198C48), DoSwitchTo1 (198D1C), DoSwitchTo2 (1996A0), TryEndIntro (198DAC) */
+	void doEndIntro();
+	void doSwitchTo1();
+	void doSwitchTo2();
+	void tryEndIntro();
+
+	PictureObject *_field216 = nullptr; // +216 (+220 is unused): never set, the paths that hide it are not reached
+	PictureObject *_titlePicture = nullptr; // +224: PIC_IN1_GAMETITLE of SC_INTRO1
+	AniObject *_man = nullptr; // +228: ANI_IN1MAN of SC_INTRO1
+	uint32 _state = 0; // +232: the step of the intro (bits)
+	uint32 _stage = 0; // +236: 1 the first part runs, 2 the second part was shown
+	bool _needSleep = true; // +240
+	bool _needGetup = false; // +241
+	bool _restart = false; // +242: set by MSG_RESTART_GAME, never read
+	bool _playSound = false; // +243
+};
+
+} // End of namespace NGI
+
+#endif // NGI_FULLPIPE_INTROCONTROLLER_H
diff --git a/engines/ngi/fullpipe/mobile/scenecontrollers.cpp b/engines/ngi/fullpipe/mobile/scenecontrollers.cpp
index b4584f62b40..4666646486f 100644
--- a/engines/ngi/fullpipe/mobile/scenecontrollers.cpp
+++ b/engines/ngi/fullpipe/mobile/scenecontrollers.cpp
@@ -63,6 +63,7 @@
 #include "ngi/fullpipe/mobile/chaptercontroller.h"
 #include "ngi/fullpipe/mobile/help.h"
 #include "ngi/fullpipe/mobile/notebook.h"
+#include "ngi/fullpipe/mobile/introcontroller.h"
 #include "ngi/fullpipe/mobile/inventorycontroller.h"
 #include "ngi/fullpipe/mobile/liftcontroller.h"
 #include "ngi/fullpipe/mobile/mainmenucontroller.h"
@@ -205,6 +206,10 @@ void createSceneController(int sceneId) {
 	case SC_TUTORIAL:
 		new TutorialController(sceneId);
 		break;
+	case SC_INTRO1:
+	case SC_INTRO2:
+		new ScIntroController(sceneId);
+		break;
 	case SC_MAINMENU:
 		new MainMenuController(sceneId);
 		break;
diff --git a/engines/ngi/fullpipe/sceneIntro.cpp b/engines/ngi/fullpipe/sceneIntro.cpp
index b11d34f6b2d..e107e2f22a7 100644
--- a/engines/ngi/fullpipe/sceneIntro.cpp
+++ b/engines/ngi/fullpipe/sceneIntro.cpp
@@ -23,7 +23,6 @@
 
 #include "ngi/fullpipe/constants.h"
 #include "ngi/behavior.h"
-#include "ngi/fullpipe/mobile/chaptermanager.h"
 #include "ngi/gameloader.h"
 #include "ngi/motion.h"
 #include "ngi/fullpipe/scenes.h"
@@ -32,44 +31,11 @@
 
 namespace NGI {
 
-static GuiElement *skipButton(Scene &scene) {
-	return scene._guiManager ? scene._guiManager->getElement(scene._sceneId == SC_INTRO1 ? "BTN_SC_INTRO_SKIP_1" : "BTN_SC_INTRO_SKIP_2") : nullptr;
-}
-
-static void sceneIntro_onGuiEvent(Scene &scene, const Common::String &id, const Common::String &event) {
-	if (!g_vars->sceneIntro_playing || event != "unpress" || (id != "BTN_SC_INTRO_SKIP_1" && id != "BTN_SC_INTRO_SKIP_2"))
-		return;
-	debugC(2, kDebugEvents, "Skipping Android intro from scene %d", scene._sceneId);
-	for (int sceneId : {SC_INTRO1, SC_INTRO2}) {
-		if (GuiElement *button = skipButton(*g_ngi->findScene(sceneId)))
-			button->hideAndDeactivate();
-	}
-	clearGlobalMessageQueueList1();
-	for (int sceneId : {SC_INTRO1, SC_INTRO2})
-		g_ngi->findScene(sceneId)->stopAllQueues();
-	if (scene._soundList)
-		scene.stopAllSounds();
-	g_ngi->stopAllSounds(Sound::kSpeech);
-	sceneIntro_end();
-}
-
-void sceneIntro_initGui(Scene &first, Scene &second, int width) {
-	first._guiEventHandler = second._guiEventHandler = sceneIntro_onGuiEvent;
-	GuiElement *button = skipButton(first);
-	if (!button)
-		return;
-	Common::Point pos(width - button->_size.x, button->_pos.y);
-	button->setPos(pos);
-	if (GuiElement *other = skipButton(second))
-		other->setPos(pos);
-}
-
 void sceneIntro_initMan(Scene &scene) {
 	g_vars->sceneIntro_aniin1man = scene.findAniObjectById(ANI_IN1MAN, -1);
 	g_vars->sceneIntro_needSleep = true;
 	g_vars->sceneIntro_needGetup = false;
 	g_vars->sceneIntro_playing = true;
-	g_ngi->_fader.startFade(1025, 0, 0);
 }
 
 static bool sceneIntro_updateMan() {
@@ -86,28 +52,6 @@ static bool sceneIntro_updateMan() {
 	return false;
 }
 
-bool sceneIntro_updateAndroid(uint32 elapsed, byte &brightness) {
-	if (!g_vars->sceneIntro_playing)
-		return false;
-
-	// D08: CScIntoController::OnUpdate / OnRender run the fader; brightness = opposite of its alpha
-	Fader &fader = g_ngi->_fader;
-	if (fader.getState() != Fader::kIdle) {
-		fader.onUpdate(elapsed);
-		const byte level = fader.getState() == Fader::kIdle ? 255 : CLIP<int>((int)(255.0f * (1.0f - fader.getAlpha())), 0, 255);
-		const bool changed = brightness != level;
-		brightness = level;
-		if (fader.getState() == Fader::kIdle) {
-			if (GuiElement *button = skipButton(*g_ngi->_currentScene))
-				button->showAndActivate();
-			runQueue(QU_INTR_STARTINTRO, 0);
-		}
-		return changed;
-	}
-
-	return sceneIntro_updateMan();
-}
-
 int sceneIntro_updateCursor() {
 	g_ngi->_cursorId = 0;
 
@@ -134,17 +78,9 @@ void sceneHandlerIntro_part1() {
 void sceneHandlerIntro_part2() {
 	g_ngi->_currentScene = g_ngi->findScene(SC_INTRO2);
 	runQueue(QU_IN2_DO, 0);
-	if (g_ngi->isAndroidFullPipe()) {
-		if (GuiElement *button = skipButton(*g_ngi->_currentScene))
-			button->showAndActivate();
-	}
 }
 
 void sceneIntro_end() {
-	if (g_vars->sceneIntro_playing && g_ngi->isAndroidFullPipe()) {
-		g_ngi->_gameLoader->preloadScene(SC_1, TrubaLeft);
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_1", true);
-	}
 	g_vars->sceneIntro_playing = false;
 }
 
@@ -152,15 +88,6 @@ int sceneHandlerIntro(Command *ex) {
 	if (ex->_cmd != kCmdMessage)
 		return 0;
 
-	if (g_ngi->isAndroidFullPipe() && !ex->_messageName.empty()) {
-		debugC(3, kDebugEvents, "Android intro message %s", ex->_messageName.c_str());
-		if (ex->_messageName == "MSG_ENABLE_BHV_SOUND") {
-			if (g_ngi->_currentScene->_behaviorController)
-				g_ngi->_currentScene->_behaviorController->enableAllMusic();
-			return 0;
-		}
-	}
-
 	switch (ex->_messageNum) {
 	case MSG_INTR_ENDINTRO:
 		sceneIntro_end();
diff --git a/engines/ngi/fullpipe/scenes.cpp b/engines/ngi/fullpipe/scenes.cpp
index 6c5f49cf3fd..2ced1731e63 100644
--- a/engines/ngi/fullpipe/scenes.cpp
+++ b/engines/ngi/fullpipe/scenes.cpp
@@ -562,11 +562,11 @@ void NGIEngine::updateSceneLogic(uint32 elapsed) {
 		_arcadeInterface->update(elapsed);
 
 	// the controller is updated by Scene::update; it is made here at the first use of the scene
-	if (_currentScene && _currentScene->_sceneId != SC_INTRO1)
+	if (_currentScene)
 		sceneController(*_currentScene);
 
 	const MessageHandler *handler = getMessageHandlerById(2);
-	if (!handler || !_currentScene || _currentScene->_sceneId == SC_INTRO1)
+	if (!handler || !_currentScene)
 		return;
 
 	Command update(0, kCmdMessage, kMsgUpdate, 0, 0, 0, 1, 0, 0, 0);
@@ -593,9 +593,6 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 	if (usesXMLProject()) {
 		_inventoryScene = nullptr;
 		Scene *common = findScene(SC_COMMON);
-		Scene *intro2 = scene->_sceneId == SC_INTRO1 ? findScene(SC_INTRO2) : nullptr;
-		if (scene->_sceneId == SC_INTRO1 && (!common || !intro2))
-			return false;
 		scene->_commonQueueScene = common == scene ? nullptr : common;
 		scene->_roamingPictures.clear();
 		scene->_roamingAnis.clear();
@@ -672,8 +669,6 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 		_currSoundListCount = 0;
 		if (scene->_soundList)
 			_currSoundList1[_currSoundListCount++] = scene->_soundList.get();
-		if (intro2 && intro2->_soundList)
-			_currSoundList1[_currSoundListCount++] = intro2->_soundList.get();
 		if (scene->_commonQueueScene && common->_soundList)
 			_currSoundList1[_currSoundListCount++] = common->_soundList.get();
 
@@ -689,9 +684,6 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 					_waitScreen->onShow();
 				}
 				_preloadManager->setScene(scene->_sceneId);
-				// the second intro scene is shown by the first one's handler (sceneHandlerIntro_part2)
-				if (intro2)
-					_preloadManager->loadScene(SC_INTRO2);
 				if (_waitScreen)
 					_preloadManager->unloadScene(1);
 			}
@@ -707,10 +699,8 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 		scene->_shown = true; // CScene::OnShow
 		if (scene->_behaviorController)
 			scene->_behaviorController->attachAnimations(*scene);
-		if (scene->_sceneId != SC_INTRO1) {
-			controller.initScene();
-			controller.onShow();
-		}
+		controller.initScene();
+		controller.onShow();
 		// CScene::OnShow: the behaviors after the controller, with the sound lists of the scene
 		if (scene->_behaviorController)
 			scene->_behaviorController->onShow(*scene);
@@ -718,18 +708,12 @@ bool NGIEngine::doSetScene(const Entrance &entrance) {
 			scene->_motionController->attachObject(_aniMan);
 			scene->_motionController->activate();
 		}
-		if (intro2) {
-			sceneIntro_initGui(*scene, *intro2, gameWidth());
-			sceneIntro_initMan(*scene);
-			addMessageHandler(sceneHandlerIntro, 2);
-		} else {
-			if (isAndroidFullPipe())
-				sceneController_initInventory();
-			_floaters->deleteAllFlies();
-			// Every scene controller of the original ends its OnShow with CTaskManager::VisitScene
-			if (_taskManager)
-				_taskManager->visitScene(scene->_sceneId);
-		}
+		if (isAndroidFullPipe())
+			sceneController_initInventory();
+		_floaters->deleteAllFlies();
+		// the OnShow of every controller but the intro's ends with CTaskManager::VisitScene
+		if (_taskManager && scene->_sceneId != SC_INTRO1 && scene->_sceneId != SC_INTRO2)
+			_taskManager->visitScene(scene->_sceneId);
 		return true;
 	}
 
diff --git a/engines/ngi/fullpipe/scenes.h b/engines/ngi/fullpipe/scenes.h
index 609a1fc8e63..35c11b86f7a 100644
--- a/engines/ngi/fullpipe/scenes.h
+++ b/engines/ngi/fullpipe/scenes.h
@@ -43,9 +43,7 @@ class Chapter;
 int sceneIntro_updateCursor();
 void sceneIntro_initScene(Scene *sc);
 void sceneIntro_initMan(Scene &scene);
-bool sceneIntro_updateAndroid(uint32 elapsed, byte &brightness);
 void sceneIntro_end();
-void sceneIntro_initGui(Scene &first, Scene &second, int width);
 int sceneHandlerIntro(Command *cmd);
 
 int sceneIntroDemo_updateCursor();
diff --git a/engines/ngi/module.mk b/engines/ngi/module.mk
index ad6ee80fdc1..aef3d210625 100644
--- a/engines/ngi/module.mk
+++ b/engines/ngi/module.mk
@@ -97,6 +97,7 @@ MODULE_OBJS = \
 	fullpipe/mobile/help.o \
 	fullpipe/mobile/highlight.o \
 	fullpipe/mobile/hintmanager.o \
+	fullpipe/mobile/introcontroller.o \
 	fullpipe/mobile/inventorycontroller.o \
 	fullpipe/mobile/liftcontroller.o \
 	fullpipe/mobile/mainmenucontroller.o \
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 2fc060c8e27..71f7e7807d6 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -383,7 +383,7 @@ bool NGIEngine::handleGuiEvent(const Common::Event &event) {
 bool NGIEngine::handleSceneEvent(const Common::Event &event, GuiManager *manager) {
 	{
 		// CFPController::OnMouseLKeyDown/Up: the touch scrolls the scene or sends the hero to its end
-		const bool sceneTouch = usesXMLProject() && _currentScene->_sceneId != SC_INTRO1;
+		const bool sceneTouch = usesXMLProject();
 		const bool onGui = manager && manager->hit(event.mouse);
 		FPController &controller = sceneController(*_currentScene);
 		const float sceneX = event.mouse.x + _currentScene->_x;
@@ -507,13 +507,9 @@ Common::Error NGIEngine::run() {
 			return result;
 	}
 
-	const bool intro = start && startSceneId == SC_INTRO1;
-	byte brightness = intro ? 0 : 255;
+	byte brightness = 255;
 	if (usesXMLProject()) {
-		if (brightness)
-			_currentScene->render();
-		else
-			_backgroundSurface.clear(0);
+		_currentScene->render();
 		_system->copyRectToScreen(_backgroundSurface.getPixels(), _backgroundSurface.pitch, 0, 0, _backgroundSurface.w, height);
 		_system->updateScreen();
 		debugC(1, kDebugDrawing, "Presented first Full Pipe frame for %s", start->_tag.c_str());
@@ -840,8 +836,6 @@ Common::Error NGIEngine::updateScreen(uint32 elapsed, byte &brightness, bool red
 	if (!_modalObject && (timedUpdates || _flgGameIsRunning)) {
 		redraw |= _gameLoader->updateContent(elapsed);
 		if (!hadDialog) {
-			if (usesXMLProject() && scene == _currentScene && scene->_sceneId == SC_INTRO1)
-				redraw |= sceneIntro_updateAndroid(elapsed, brightness);
 			if (timedUpdates)
 				processMessages();
 			if (usesXMLProject() && !_gameLoader->_preloadSceneId)
@@ -887,7 +881,8 @@ Common::Error NGIEngine::updateScreen(uint32 elapsed, byte &brightness, bool red
 			drawAlphaRectangle(0, 0, _backgroundSurface.w, _backgroundSurface.h, brightness);
 	} else if (_currentScene && (timedUpdates ? redraw : renderScene)) {
 		_currentScene->render();
-		if (_inventoryScene) {
+		// CGame::Render: the scene says whether the inventory is drawn (not in the intro)
+		if (usesXMLProject() ? isInventoryRendered() : _inventoryScene != nullptr) {
 			if (usesXMLProject())
 				_inventory->render();
 			else


Commit: a7c5e83f8b74a9765fe14f549bcb3a53cdf913da
    https://github.com/scummvm/scummvm/commit/a7c5e83f8b74a9765fe14f549bcb3a53cdf913da
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:51+01:00

Commit Message:
NGI: Store the position of objects and scenes as float

Changed paths:
    engines/ngi/debugger/testmode.cpp
    engines/ngi/fullpipe/mobile/fpcontroller.cpp
    engines/ngi/fullpipe/mobile/sc08controller.cpp
    engines/ngi/fullpipe/mobile/sc11controller.cpp
    engines/ngi/gfx.cpp
    engines/ngi/gfx.h
    engines/ngi/statics.cpp
    engines/ngi/statics.h


diff --git a/engines/ngi/debugger/testmode.cpp b/engines/ngi/debugger/testmode.cpp
index 1e6ca7372f5..ee9595d30e4 100644
--- a/engines/ngi/debugger/testmode.cpp
+++ b/engines/ngi/debugger/testmode.cpp
@@ -330,8 +330,8 @@ void testmode_update(uint32 elapsed) {
 			if (eater) {
 				const Common::String eaterState = eater->_movement ? Common::String::format("movement %d %s", eater->_movement->_id, name(eater->_movement->_id).c_str()) :
 					eater->_statics ? Common::String::format("statics %d %s", eater->_statics->_staticsId, name(eater->_statics->_staticsId).c_str()) : Common::String("none");
-				const Common::String line = Common::String::format("%s flags %02x z %d center %d,%d", eaterState.c_str(), eater->_flags, eater->_z, eater->getCenter().x, eater->getCenter().y);
-				const uint eaterHash = Common::hashit(Common::String::format("%s %02x %d", eaterState.c_str(), eater->_flags, eater->_z).c_str());
+				const Common::String line = Common::String::format("%s flags %02x z %g center %d,%d", eaterState.c_str(), eater->_flags, eater->_z, eater->getCenter().x, eater->getCenter().y);
+				const uint eaterHash = Common::hashit(Common::String::format("%s %02x %g", eaterState.c_str(), eater->_flags, eater->_z).c_str());
 				if (eaterHash != g_lastEaterState) {
 					g_lastEaterState = eaterHash;
 					debugC(1, kDebugInfo, "INFO f %d t %u EGGEATER %s", g_frame, g_system->getMillis(), line.c_str());
@@ -351,7 +351,7 @@ void testmode_update(uint32 elapsed) {
 			ani->_statics ? Common::String::format("statics %s", name(ani->_statics->_staticsId).c_str()) : Common::String("none");
 		const Common::Point topLeft = ani->getPosition();
 		const int frame = ani->_movement ? ani->_movement->_curFrame : -1;
-		const Common::String state = Common::String::format("%s flags %02x z %d at %d,%d topleft %d,%d frame %d", line.c_str(), ani->_flags, ani->_z, ani->pivotX(), ani->pivotY(),
+		const Common::String state = Common::String::format("%s flags %02x z %g at %d,%d topleft %d,%d frame %d", line.c_str(), ani->_flags, ani->_z, ani->pivotX(), ani->pivotY(),
 			topLeft.x, topLeft.y, frame);
 		// watchpos=1: also a line for every frame and position change
 		const uint hash = watchPositions() ? Common::hashit(state.c_str()) : Common::hashit(Common::String::format("%s %02x", line.c_str(), ani->_flags).c_str());
diff --git a/engines/ngi/fullpipe/mobile/fpcontroller.cpp b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
index 2fe88af58c9..557beffbccf 100644
--- a/engines/ngi/fullpipe/mobile/fpcontroller.cpp
+++ b/engines/ngi/fullpipe/mobile/fpcontroller.cpp
@@ -640,7 +640,7 @@ void FPController::onUpdate(uint32 elapsed) {
 	if (_react && (_react->_flags & 4) && !_react->_movement)
 		_react->_flags &= ~4;
 	if (_scene->_x != oldX || _scene->_y != oldY) {
-		debugC(2, kDebugSceneLogic, "camera %d -> %d (target %g, follow %d)", oldX, _scene->_x, _targetX, _follow != nullptr);
+		debugC(2, kDebugSceneLogic, "camera %d -> %g (target %g, follow %d)", oldX, _scene->_x, _targetX, _follow != nullptr);
 		g_ngi->_sceneRect.moveTo(_scene->_x, _scene->_y);
 	}
 }
diff --git a/engines/ngi/fullpipe/mobile/sc08controller.cpp b/engines/ngi/fullpipe/mobile/sc08controller.cpp
index af82eb694e8..a61264a25c9 100644
--- a/engines/ngi/fullpipe/mobile/sc08controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc08controller.cpp
@@ -587,12 +587,12 @@ void Sc08Controller::updateScroll() {
 		}
 		const int renderHeight = g_ngi->_backgroundSurface.h; // CRender +40
 		if ((float)_follow->getCenter().y < (float)_scene->_y + 300.0f) {
-			_scene->_y = (int)((float)_follow->getCenter().y - 300.0f);
+			_scene->_y = (float)_follow->getCenter().y - 300.0f;
 			if ((float)_scene->_y < 0.0f)
 				_scene->_y = 0;
 		}
 		if ((float)_follow->getCenter().y > ((float)renderHeight + (float)_scene->_y) - 350.0f)
-			_scene->_y = (int)(((float)_follow->getCenter().y + 350.0f) - (float)renderHeight);
+			_scene->_y = ((float)_follow->getCenter().y + 350.0f) - (float)renderHeight;
 	}
 	limitScroll();
 	testScroll();
diff --git a/engines/ngi/fullpipe/mobile/sc11controller.cpp b/engines/ngi/fullpipe/mobile/sc11controller.cpp
index 7512ae724c8..190f000ed10 100644
--- a/engines/ngi/fullpipe/mobile/sc11controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc11controller.cpp
@@ -1112,7 +1112,7 @@ void Sc11Controller::updateScroll() {
 		if (_scrollToTube) {
 			const int right = width + (int)sceneX;
 			if (_heroCenterX > (float)(right - 300)) {
-				_scene->_x = (int)((float)((_heroCenterX - (float)right) + 300.0f) + (float)_scene->_x);
+				_scene->_x = (float)((_heroCenterX - (float)right) + 300.0f) + _scene->_x;
 			}
 			limitScroll();
 		} else if (!_arcadeRunning) {
diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index 407ca2df381..8fa0a2b38d4 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -501,7 +501,7 @@ RenderParams GameObject::getRenderParams(bool mirror) const {
 }
 
 Common::String GameObject::toXML() {
-	return Common::String::format("id=\"%s\" name=\"%s\" x=%d y=%d priority=%d f8=%d",
+	return Common::String::format("id=\"%s\" name=\"%s\" x=%g y=%g priority=%g f8=%d",
 		g_ngi->gameIdToStr(_id).c_str(), transCyrillic(_title), _x, _y, _z, _objectFlags);
 }
 
diff --git a/engines/ngi/gfx.h b/engines/ngi/gfx.h
index 404ee05f115..406188c6e56 100644
--- a/engines/ngi/gfx.h
+++ b/engines/ngi/gfx.h
@@ -186,9 +186,9 @@ class GameObject : public CObject {
 	int16 _flags;
 	int16 _id;
 	Common::String _title;
-	int _x;
-	int _y;
-	int _z;
+	float _x;
+	float _y;
+	float _z;
 	int _field_20;
 
 	// Android CVisibleObject drawing state (CTexture::Render parameters), see RenderParams
@@ -290,8 +290,8 @@ public:
 	Common::Array<PictureObject *> _pictureObjects;
 
 	Common::String _bgname;
-	int _x;
-	int _y;
+	float _x;
+	float _y;
 	int16 _messageQueueId;
 	Palette _palette;
 	/** list items are owned */
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index 7ab5c7342b5..dd6e52fd59b 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -717,7 +717,7 @@ void AniObject::render(Common::Point scroll) {
 	if ((_flags & 4) == 0)
 		return;
 
-	debugC(6, kDebugDrawing, "AniObject::render() (%s) [%d] [%d, %d]", transCyrillic(_title), _id, _x, _y);
+	debugC(6, kDebugDrawing, "AniObject::render() (%s) [%d] [%g, %g]", transCyrillic(_title), _id, _x, _y);
 
 	if (_shadowsOn && g_ngi->_currentScene && g_ngi->_currentScene->_shadows
 		&& (getFullSize().x != 1 || getFullSize().y != 1)) {
@@ -777,7 +777,7 @@ void AniObject::render(Common::Point scroll) {
 }
 
 void AniObject::draw2() {
-	debugC(6, kDebugDrawing, "StatciANIObject::draw2(): id: (%s) %d [%d, %d]", transCyrillic(_title), _id, _x, _y);
+	debugC(6, kDebugDrawing, "StatciANIObject::draw2(): id: (%s) %d [%g, %g]", transCyrillic(_title), _id, _x, _y);
 
 	if ((_flags & 4) && (_flags & 0x10)) {
 		if (_movement) {
@@ -897,7 +897,7 @@ bool AniObject::update(int counterdiff) {
 bool AniObject::updateAnimation(int counterdiff) {
 	int mqid;
 
-	debugC(6, kDebugAnimation, "AniObject::update() (%s) [%d] [%d, %d] fl: %x", transCyrillic(_title), _id, _x, _y, _flags);
+	debugC(6, kDebugAnimation, "AniObject::update() (%s) [%d] [%g, %g] fl: %x", transCyrillic(_title), _id, _x, _y, _flags);
 
 	if ((_flags & 2) && g_ngi->_gameVersion < 201509) {
 		_messageNum--;
@@ -1264,7 +1264,7 @@ void AniObject::stopMovementAndroid(bool keepSounds) {
 	_flags = (_flags & ~8) | (endMirror ? 8 : 0);
 	setTopLeft(topLeft);
 
-	debugC(1, kDebugAnimation, "movement stop: t %u ani %d copy %d movement %d pos %d,%d topleft %d,%d flags %x statics %d", g_system->getMillis(), _id, _copyId, oid, _x, _y, topLeft.x, topLeft.y,
+	debugC(1, kDebugAnimation, "movement stop: t %u ani %d copy %d movement %d pos %g,%g topleft %d,%d flags %x statics %d", g_system->getMillis(), _id, _copyId, oid, _x, _y, topLeft.x, topLeft.y,
 		_flags, _statics->_staticsId);
 
 	if (keepSounds)
@@ -1883,7 +1883,7 @@ bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseId
 	if (_flags & 0x80)
 		return false;
 
-	debugC(4, kDebugAnimation, "AniObject::startMovement(%d, %d, %d) (%s [%d]) [%d, %d]", movementId, messageQueueId, dynPhaseIdx, transCyrillic(_title), _id, _x, _y);
+	debugC(4, kDebugAnimation, "AniObject::startMovement(%d, %d, %d) (%s [%d]) [%g, %g]", movementId, messageQueueId, dynPhaseIdx, transCyrillic(_title), _id, _x, _y);
 
 	const bool timedMovement = g_ngi->_gameVersion >= 201509;
 	// the Android StartMovement ignores the queue of the object
@@ -2017,7 +2017,7 @@ bool AniObject::startMovement(int movementId, int messageQueueId, int dynPhaseId
 
 	_stepArray.clear();
 
-	debugC(1, kDebugAnimation, "movement start: t %u ani %d copy %d movement %d pos %d,%d topleft %d,%d flags %x mirror %d frame %d", g_system->getMillis(), _id, _copyId, movementId, _x, _y,
+	debugC(1, kDebugAnimation, "movement start: t %u ani %d copy %d movement %d pos %g,%g topleft %d,%d flags %x mirror %d frame %d", g_system->getMillis(), _id, _copyId, movementId, _x, _y,
 		getPosition().x, getPosition().y, _flags, mirror, _movement->_curFrame);
 
 	Command *newex = new Command(_id, kCmdMessage, kMsgAniMovementStarted, 0, 0, movementId, 1, 0, 0, 0);
diff --git a/engines/ngi/statics.h b/engines/ngi/statics.h
index dd5bf9a645a..9095351d17a 100644
--- a/engines/ngi/statics.h
+++ b/engines/ngi/statics.h
@@ -234,8 +234,8 @@ public:
 	AniObject(AniObject *src);
 
 	/** the Windows view of the position (the pivot), docs/float-model-plan.md */
-	int pivotX() const { return _x; }
-	int pivotY() const { return _y; }
+	int pivotX() const { return static_cast<int>(_x); }
+	int pivotY() const { return static_cast<int>(_y); }
 	void setPivotX(int x) { _x = x; }
 	void setPivotY(int y) { _y = y; }
 


Commit: 9aa5cce7003fe77a5dc43bb0f4715ed30ad9fc82
    https://github.com/scummvm/scummvm/commit/9aa5cce7003fe77a5dc43bb0f4715ed30ad9fc82
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:51+01:00

Commit Message:
NGI: Switch scene 31 to its controller

Changed paths:
    engines/ngi/fullpipe/mobile/sc31controller.h


diff --git a/engines/ngi/fullpipe/mobile/sc31controller.h b/engines/ngi/fullpipe/mobile/sc31controller.h
index 00e76fde52f..66ac70bc672 100644
--- a/engines/ngi/fullpipe/mobile/sc31controller.h
+++ b/engines/ngi/fullpipe/mobile/sc31controller.h
@@ -32,6 +32,7 @@ public:
 	explicit Sc31Controller(int sceneId);
 	~Sc31Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	void onUpdate(uint32 elapsed) override;


Commit: 87c59329875353020df63fc85c9d189c84705a69
    https://github.com/scummvm/scummvm/commit/87c59329875353020df63fc85c9d189c84705a69
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:51+01:00

Commit Message:
NGI: Switch scene 35 to its controller

Changed paths:
    engines/ngi/fullpipe/mobile/sc35controller.cpp
    engines/ngi/fullpipe/mobile/sc35controller.h


diff --git a/engines/ngi/fullpipe/mobile/sc35controller.cpp b/engines/ngi/fullpipe/mobile/sc35controller.cpp
index 316d7816d70..d4c0a446408 100644
--- a/engines/ngi/fullpipe/mobile/sc35controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc35controller.cpp
@@ -268,8 +268,7 @@ void Sc35Controller::onMessage(const Common::String &message, const Common::Stri
 		stopFlow();
 	} else if (message == "MSG_SC35_MOVEFIREFIGHTER") {
 		AniObject *firefighter = _scene->findAniObjectById(ANI_FIREFIGHTER, 0);
-		firefighter->setPosition(Common::Point(998, 411));
-		firefighter->_z = 30;
+		firefighter->setOldAniPos(998, 411, 30);
 	} else if (message == "MSG_DISABLE_HELP_9_1") {
 		g_ngi->_help->disableHelpWithId(PIC_HELP_9_01);
 	} else if (message == "MSG_SC35_TASK_ACT_COIN") {
@@ -293,7 +292,8 @@ void Sc35Controller::onMessage(const Common::String &message, const Common::Stri
 
 // CSc35Controller::UpdateScroll (1947C0)
 void Sc35Controller::updateScroll() {
-	FPController::updateScroll();
+	if (_follow)
+		FPController::updateScroll();
 }
 
 } // End of namespace NGI
diff --git a/engines/ngi/fullpipe/mobile/sc35controller.h b/engines/ngi/fullpipe/mobile/sc35controller.h
index 97d25a350e3..cb6981392ef 100644
--- a/engines/ngi/fullpipe/mobile/sc35controller.h
+++ b/engines/ngi/fullpipe/mobile/sc35controller.h
@@ -35,6 +35,7 @@ public:
 	explicit Sc35Controller(int sceneId);
 	~Sc35Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	void onHide() override;
 	int getCursorType(float x, float y) override;


Commit: 4c9896dd8c7010ffae4fee5501bd08dd0ecc02af
    https://github.com/scummvm/scummvm/commit/4c9896dd8c7010ffae4fee5501bd08dd0ecc02af
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:51+01:00

Commit Message:
NGI: Switch scene 36 to its controller

Changed paths:
    engines/ngi/fullpipe/mobile/sc36controller.cpp
    engines/ngi/fullpipe/mobile/sc36controller.h


diff --git a/engines/ngi/fullpipe/mobile/sc36controller.cpp b/engines/ngi/fullpipe/mobile/sc36controller.cpp
index a9e0cc59f70..d539f85c600 100644
--- a/engines/ngi/fullpipe/mobile/sc36controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc36controller.cpp
@@ -60,6 +60,7 @@ int Sc36Controller::getCursorType(float x, float y) {
 		return FPController::getCursorType(x, y);
 	if (g_ngi->_inputController->isObjectHit(ANI_ROTOHRUST) && _rotohrust->_statics->_staticsId == ST_RHT_OPEN)
 		return 3;
+	g_ngi->_inputController->isObjectHit(PIC_SC36_MASK); // result unused, as in the original
 	return FPController::getCursorType(x, y);
 }
 
diff --git a/engines/ngi/fullpipe/mobile/sc36controller.h b/engines/ngi/fullpipe/mobile/sc36controller.h
index 996ee756fe8..69521383d20 100644
--- a/engines/ngi/fullpipe/mobile/sc36controller.h
+++ b/engines/ngi/fullpipe/mobile/sc36controller.h
@@ -32,6 +32,7 @@ public:
 	explicit Sc36Controller(int sceneId);
 	~Sc36Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	void onUpdate(uint32 elapsed) override;


Commit: 130dde848ddb64589d1ef2e1e4f8a0ab3a3ebf80
    https://github.com/scummvm/scummvm/commit/130dde848ddb64589d1ef2e1e4f8a0ab3a3ebf80
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:51+01:00

Commit Message:
NGI: Switch scene 37 to its controller

Changed paths:
    engines/ngi/fullpipe/mobile/sc37controller.h


diff --git a/engines/ngi/fullpipe/mobile/sc37controller.h b/engines/ngi/fullpipe/mobile/sc37controller.h
index 9711836defa..8565fdec464 100644
--- a/engines/ngi/fullpipe/mobile/sc37controller.h
+++ b/engines/ngi/fullpipe/mobile/sc37controller.h
@@ -44,6 +44,7 @@ public:
 	explicit Sc37Controller(int sceneId);
 	~Sc37Controller() override;
 
+	bool controllerRunsSceneLogic() const override { return true; }
 	void onShow() override;
 	int getCursorType(float x, float y) override;
 	void onUpdate(uint32 elapsed) override;


Commit: 7fa8dc522900d0d0a17ecfc8d2eef14b807c2e3f
    https://github.com/scummvm/scummvm/commit/7fa8dc522900d0d0a17ecfc8d2eef14b807c2e3f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-12-03T21:57:51+01:00

Commit Message:
NGI: Order the statements of CScNNController::OnShow as the original

Changed paths:
    engines/ngi/fullpipe/mobile/sc04controller.cpp
    engines/ngi/fullpipe/mobile/sc04controller.h
    engines/ngi/fullpipe/mobile/sc05controller.cpp
    engines/ngi/fullpipe/mobile/sc06controller.cpp
    engines/ngi/fullpipe/mobile/sc07controller.cpp
    engines/ngi/fullpipe/mobile/sc09controller.cpp
    engines/ngi/fullpipe/mobile/sc10controller.cpp
    engines/ngi/fullpipe/mobile/sc12controller.cpp
    engines/ngi/fullpipe/mobile/sc13controller.cpp
    engines/ngi/fullpipe/mobile/sc15controller.cpp
    engines/ngi/fullpipe/mobile/sc16controller.cpp
    engines/ngi/fullpipe/mobile/sc17controller.cpp
    engines/ngi/fullpipe/mobile/sc18controller.cpp
    engines/ngi/fullpipe/mobile/sc19controller.cpp
    engines/ngi/fullpipe/mobile/sc20controller.cpp
    engines/ngi/fullpipe/mobile/sc21controller.cpp
    engines/ngi/fullpipe/mobile/sc22controller.cpp
    engines/ngi/fullpipe/mobile/sc23controller.cpp
    engines/ngi/fullpipe/mobile/sc24controller.cpp
    engines/ngi/fullpipe/mobile/sc25controller.cpp
    engines/ngi/fullpipe/mobile/sc26controller.cpp
    engines/ngi/fullpipe/mobile/sc27controller.cpp
    engines/ngi/fullpipe/mobile/sc28controller.cpp
    engines/ngi/fullpipe/mobile/sc29controller.cpp
    engines/ngi/fullpipe/mobile/sc30controller.cpp
    engines/ngi/fullpipe/mobile/sc31controller.cpp
    engines/ngi/fullpipe/mobile/sc32controller.cpp
    engines/ngi/fullpipe/mobile/sc33controller.cpp
    engines/ngi/fullpipe/mobile/sc34controller.cpp
    engines/ngi/fullpipe/mobile/sc35controller.cpp
    engines/ngi/fullpipe/mobile/sc36controller.cpp
    engines/ngi/fullpipe/mobile/sc37controller.cpp


diff --git a/engines/ngi/fullpipe/mobile/sc04controller.cpp b/engines/ngi/fullpipe/mobile/sc04controller.cpp
index 9e21b924b06..b6a1c4d4387 100644
--- a/engines/ngi/fullpipe/mobile/sc04controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc04controller.cpp
@@ -1217,14 +1217,18 @@ void Sc04Controller::putKozawToBottle(AniObject *kozaw, PictureObject *bottle) {
 	}
 }
 
-// CSc04Controller::OnShow (167FE4) behind the margins: objects found, jar, kozawkas and mamasha
-// set by the jar state, arcade sounds stop, ladder exit looks south
+// CSc04Controller::OnShow (167FE4) up to the margins
 void Sc04Controller::onShowScene() {
 	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_kozawDelayK = 1.0f;
 	_kozawStartDelay = 0.0f;
 	_clockDelayK = 1.0f;
 	readSettingsXml();
+}
+
+// CSc04Controller::OnShow (167FE4) behind the margins: objects found, jar, kozawkas and mamasha
+// set by the jar state, arcade sounds stop, ladder exit looks south
+void Sc04Controller::onShowSceneState() {
 	heroOnLadder() = false;
 	_bottle = _scene->findPictureObjectById(PIC_SC4_BOTTLE, 0);
 	_hand = _scene->findAniObjectById(ANI_HAND, 0);
@@ -1783,12 +1787,14 @@ void Sc04Controller::onMessage(const Common::String &message, const Common::Stri
 // CSc04Controller::OnShow: after CFPController::OnShow the camera margins and offsets
 void Sc04Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic())
+		onShowScene();
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (controllerRunsSceneLogic())
-		onShowScene();
+		onShowSceneState();
 }
 
 // CSc04Controller::OnRender: CFPController::OnRender, then the arcade interface over the scene
diff --git a/engines/ngi/fullpipe/mobile/sc04controller.h b/engines/ngi/fullpipe/mobile/sc04controller.h
index 908f62a3763..ba8083d0c93 100644
--- a/engines/ngi/fullpipe/mobile/sc04controller.h
+++ b/engines/ngi/fullpipe/mobile/sc04controller.h
@@ -60,8 +60,9 @@ public:
 	void onUpdate(uint32 elapsed) override;
 	void onMessage(const Common::String &message, const Common::String &param, MessageQueue *queue) override;
 
-	/** CSc04Controller::OnShow behind the margins (called when controllerRunsSceneLogic()) */
+	/** CSc04Controller::OnShow before / behind the margins (when controllerRunsSceneLogic()) */
 	void onShowScene();
+	void onShowSceneState();
 	/** CSc04Controller::SkipArcade on the members (scene04.cpp skipArcade works on g_vars) */
 	void skipArcadeController();
 	/** CSc04Controller::OnMouseLKeyUp on the members (scene04.cpp onMouseLKeyUp works on g_vars) */
diff --git a/engines/ngi/fullpipe/mobile/sc05controller.cpp b/engines/ngi/fullpipe/mobile/sc05controller.cpp
index 98c30331670..64a4b40ec45 100644
--- a/engines/ngi/fullpipe/mobile/sc05controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc05controller.cpp
@@ -142,16 +142,18 @@ void Sc05Controller::doOtmFeedback() {
 // CSc05Controller::OnShow (16A29C)
 void Sc05Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("FIND_GLASS_SC5");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("FIND_GLASS_SC5");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_handle = _scene->findAniObjectById(ANI_HANDLE, 0);
 	_wacko = _scene->findAniObjectById(ANI_OTMOROZ, 0);
 	_hatch = _scene->findAniObjectById(ANI_BIGLUK, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc06controller.cpp b/engines/ngi/fullpipe/mobile/sc06controller.cpp
index 29986d20328..6106f34c0aa 100644
--- a/engines/ngi/fullpipe/mobile/sc06controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc06controller.cpp
@@ -764,29 +764,31 @@ void Sc06Controller::readSettingsXml() {
 // CSc06Controller::OnShow (16D2B4): camera margins; the rest is scene logic
 void Sc06Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(2);
+		g_ngi->_chapterManager->setActiveChapter(2);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_2", true);
+			g_ngi->_taskManager->activateTask("GET_DEVICE_SC6");
+		}
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		_arrow = _scene->findAniObjectById(ANI_SC6_ARROW, 0);
+		_arrow->_objectFlags |= 8;
+		_numDrops = 15;
+		_numDropsToWin = 5;
+		_momJumpN1 = -3;
+		_momJumpN2 = 4;
+		_momJumpDelay = 2.0f;
+		readSettingsXml();
+		_holdingBall = false;
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(2);
-	g_ngi->_chapterManager->setActiveChapter(2);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_2", true);
-		g_ngi->_taskManager->activateTask("GET_DEVICE_SC6");
-	}
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	_arrow = _scene->findAniObjectById(ANI_SC6_ARROW, 0);
-	_arrow->_objectFlags |= 8;
-	_numDrops = 15;
-	_numDropsToWin = 5;
-	_momJumpN1 = -3;
-	_momJumpN2 = 4;
-	_momJumpDelay = 2.0f;
-	readSettingsXml();
-	_holdingBall = false;
 	_aimAngle = 205.0f;
 	_aimScale = 0.7f;
 	_powerArrow->_rotation = 3.5779249668f;
diff --git a/engines/ngi/fullpipe/mobile/sc07controller.cpp b/engines/ngi/fullpipe/mobile/sc07controller.cpp
index 106747df1db..c223cfc0429 100644
--- a/engines/ngi/fullpipe/mobile/sc07controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc07controller.cpp
@@ -88,16 +88,18 @@ void Sc07Controller::doCloseLuke() {
 // CSc07Controller::OnShow (16E458)
 void Sc07Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("GET_HANDLE_SC7");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("GET_HANDLE_SC7");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_hatchQueue = nullptr;
 	_luke = _scene->findAniObjectById(ANI_LUKE, 0);
 	_box = _scene->findAniObjectById(ANI_SC7_BOX, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc09controller.cpp b/engines/ngi/fullpipe/mobile/sc09controller.cpp
index b0d666eecd7..c2746d273ac 100644
--- a/engines/ngi/fullpipe/mobile/sc09controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc09controller.cpp
@@ -584,27 +584,29 @@ void Sc09Controller::readSettingsXml() {
 // CSc09Controller::OnShow (172604): only the camera margins are active
 void Sc09Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(3);
+		g_ngi->_chapterManager->setActiveChapter(3);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_3", true);
+			g_ngi->_taskManager->activateTask("FEED_GLOTATEL_SC9");
+		}
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		if (_scene->_currentEntranceId == 0 && !(_spitter->_flags & 4)) {
+			const float x = (float)_spitter->getCenter().x - 10.0f;
+			const float y = (float)_spitter->getCenter().y + 145.0f;
+			hero()->setCenter(Common::Point((int)x, (int)y));
+			hero()->setStatic(ST_MAN_UP);
+		}
+		_spitter->_flags |= 4;
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(3);
-	g_ngi->_chapterManager->setActiveChapter(3);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_3", true);
-		g_ngi->_taskManager->activateTask("FEED_GLOTATEL_SC9");
-	}
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	if (_scene->_currentEntranceId == 0 && !(_spitter->_flags & 4)) {
-		const float x = (float)_spitter->getCenter().x - 10.0f;
-		const float y = (float)_spitter->getCenter().y + 145.0f;
-		hero()->setCenter(Common::Point((int)x, (int)y));
-		hero()->setStatic(ST_MAN_UP);
-	}
-	_spitter->_flags |= 4;
 	_eatingBall = nullptr;
 	_numSwallowed = 0;
 	_gulperPresent = true;
diff --git a/engines/ngi/fullpipe/mobile/sc10controller.cpp b/engines/ngi/fullpipe/mobile/sc10controller.cpp
index 9fc567c97cd..6445664fec0 100644
--- a/engines/ngi/fullpipe/mobile/sc10controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc10controller.cpp
@@ -108,14 +108,16 @@ void Sc10Controller::onSceneInit() {
 // CSc10Controller::OnShow (173D20)
 void Sc10Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_gum = _scene->findAniObjectById(ANI_GUM, 0);
 	_pack = _scene->findAniObjectById(ANI_PACHKA, 0);
 	_pack2 = _scene->findAniObjectById(ANI_PACHKA2, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc12controller.cpp b/engines/ngi/fullpipe/mobile/sc12controller.cpp
index 58d3bd0fd78..c558e32f34d 100644
--- a/engines/ngi/fullpipe/mobile/sc12controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc12controller.cpp
@@ -54,16 +54,18 @@ void Sc12Controller::startFly() {
 // CSc12Controller::OnShow (17757C)
 void Sc12Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("GET_BOOT_SC12");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("GET_BOOT_SC12");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_flyPack->init(g_ngi->getGameLoaderGameVar()->getSubVarByName("SC_12"));
 	_flyPending = g_ngi->getStateId(sO_Fly_12) != 0;
 	if (_flyPending)
diff --git a/engines/ngi/fullpipe/mobile/sc13controller.cpp b/engines/ngi/fullpipe/mobile/sc13controller.cpp
index ef5598d16fb..f20167625c8 100644
--- a/engines/ngi/fullpipe/mobile/sc13controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc13controller.cpp
@@ -213,23 +213,25 @@ void Sc13Controller::doStartWhirlgig() {
 // CSc13Controller::OnShow (177FD0)
 void Sc13Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(4);
+		g_ngi->_chapterManager->setActiveChapter(4);
+		AniObject *handleL = _scene->findAniObjectById(ANI_HANDLE_L, 0);
+		if (handleL && handleL->_hitregion)
+			handleL->_hitregion->_top = -27;
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+			g_ngi->_taskManager->activateTask("OPEN_BRIDGE_SC13");
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_4", true);
+		}
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(4);
-	g_ngi->_chapterManager->setActiveChapter(4);
-	AniObject *handleL = _scene->findAniObjectById(ANI_HANDLE_L, 0);
-	if (handleL && handleL->_hitregion)
-		handleL->_hitregion->_top = -27;
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
-		g_ngi->_taskManager->activateTask("OPEN_BRIDGE_SC13");
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_4", true);
-	}
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_whirligig = _scene->findAniObjectById(ANI_WHIRLGIG_13, 0);
 	_guard = _scene->findAniObjectById(ANI_STOROZH, 0);
 	_handleR = _scene->findAniObjectById(ANI_HANDLE_R, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc15controller.cpp b/engines/ngi/fullpipe/mobile/sc15controller.cpp
index 892bdc3bed3..757b139b1dc 100644
--- a/engines/ngi/fullpipe/mobile/sc15controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc15controller.cpp
@@ -50,17 +50,19 @@ Sc15Controller::~Sc15Controller() {
 // CSc15Controller::OnShow (17AFA4)
 void Sc15Controller::onShow() {
 	FPController::onShow();
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_chapterManager->setActiveChapter(5);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_5", true);
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginX = 300;
+	_offsetY = 300;
 	_marginY = 200;
 	_offsetX = 400;
-	_offsetY = 300;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_chapterManager->setActiveChapter(5);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_5", true);
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_chantTimer = 0;
 	g_ngi->_exitManager->setExitState(PIC_SC15_LTRUBA, 0);
 	AniObject *grandma = _scene->findAniObjectById(ANI_GRANDMA_ASS, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc16controller.cpp b/engines/ngi/fullpipe/mobile/sc16controller.cpp
index 6d8ca3506a2..f003e6b9ac3 100644
--- a/engines/ngi/fullpipe/mobile/sc16controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc16controller.cpp
@@ -274,14 +274,16 @@ void Sc16Controller::onSceneInit() {
 // CSc16Controller::OnShow (17C4BC)
 void Sc16Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_children.clear();
 	_boy = nullptr;
 	_girl = nullptr;
diff --git a/engines/ngi/fullpipe/mobile/sc17controller.cpp b/engines/ngi/fullpipe/mobile/sc17controller.cpp
index 863fe9d1fe6..b0660ddbaa2 100644
--- a/engines/ngi/fullpipe/mobile/sc17controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc17controller.cpp
@@ -145,20 +145,22 @@ void Sc17Controller::doFillBottle() {
 // CSc17Controller::OnShow (17D094): camera margins; the rest is scene logic
 void Sc17Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("FIND_EXIT_HAND_SC17");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+
+		AniObject *tumba = _scene->findAniObjectById(ANI_SC17_TUMBA, 0);
+		tumba->setStatic(ST_SC17_TUMBA_STATE1, false);
+		tumba->setOldAniPos(470, 419, 40);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("FIND_EXIT_HAND_SC17");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-
-	AniObject *tumba = _scene->findAniObjectById(ANI_SC17_TUMBA, 0);
-	tumba->setStatic(ST_SC17_TUMBA_STATE1, false);
-	tumba->setOldAniPos(470, 419, 40);
 
 	_sugarShown = false;
 	_heroX = 0;
diff --git a/engines/ngi/fullpipe/mobile/sc18controller.cpp b/engines/ngi/fullpipe/mobile/sc18controller.cpp
index c07b0dc4415..902789d8e10 100644
--- a/engines/ngi/fullpipe/mobile/sc18controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc18controller.cpp
@@ -606,64 +606,62 @@ void Sc18Controller::initSwitch1819() {
 // CSc18Controller::OnShow (17F1C0)
 void Sc18Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
-	_marginY = 200;
-	_offsetX = 400;
-	_offsetY = 300;
-	if (!controllerRunsSceneLogic())
-		return;
-
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	if (_scene->_sceneId == SC_18) {
-		AniObject *board = _scene->findAniObjectById(ANI_SC18_BOARD, 0);
-		board->setStatic(ST_SC18_BOARD_STATE1, false);
-		setPos(board, 920.0f, 410.0f, 50);
-		if (_scene->_currentEntranceId != 0 && _scene->_currentEntranceId != TrubaUp) {
-			if (_scene->_currentEntranceId != ENT_SC18_UPRIGHT) {
-				g_ngi->_exitManager->setExitAngle(PIC_SC18_LADDER2, 0.0f);
-				g_ngi->_exitManager->setExitAngle(PIC_SC18_LADDER3, 0.0f);
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		if (_scene->_sceneId == SC_18) {
+			AniObject *board = _scene->findAniObjectById(ANI_SC18_BOARD, 0);
+			board->setStatic(ST_SC18_BOARD_STATE1, false);
+			setPos(board, 920.0f, 410.0f, 50);
+			if (_scene->_currentEntranceId != 0 && _scene->_currentEntranceId != TrubaUp) {
+				if (_scene->_currentEntranceId != ENT_SC18_UPRIGHT) {
+					g_ngi->_exitManager->setExitAngle(PIC_SC18_LADDER2, 0.0f);
+					g_ngi->_exitManager->setExitAngle(PIC_SC18_LADDER3, 0.0f);
+				}
 			}
 		}
-	}
-	_wheelRuns = true;
-	_wheel = nullptr;
-	_angle = 0.0f;
-	_centerX = 0.0f;
-	_centerY = 0.0f;
-	_manRides = 3;
-	_boy = nullptr;
-	_girl = nullptr;
-	_domino = nullptr;
-	_boyCell = 0;
-	_targetCell = 0;
-	_manCell = -1;
-	_manJumpCell = -1;
-	_boyX = 0.0f;
-	_boyY = 0.0f;
-	_girlX = 0.0f;
-	_girlY = 0.0f;
-	_wheelActive = false;
-	_riderKind = -1;
-	_boyRides = 0;
-	_girlRides = 0;
-	_boyWaiting = true;
-	_manReady = false;
-	_manOnWheel = false;
-	_flag303 = false;
-	_manJumpAngle = 13;
-	_flag308 = false;
-	_girlWaiting = true;
-	_lastAngle = 0.0f;
-	if (_scene->_currentEntranceId != 0) {
-		if (_scene->_currentEntranceId == TrubaUp)
-			setLadderVes("INT_103", "INT_108", "MSG_TOLADDER");
-		else
-			setLadderVes("INT_103", "INT_108", "MSG_FROMLADDER");
+		_wheelRuns = true;
+		_wheel = nullptr;
+		_angle = 0.0f;
+		_centerX = 0.0f;
+		_centerY = 0.0f;
+		_manRides = 3;
+		_boy = nullptr;
+		_girl = nullptr;
+		_domino = nullptr;
+		_boyCell = 0;
+		_targetCell = 0;
+		_manCell = -1;
+		_manJumpCell = -1;
+		_boyX = 0.0f;
+		_boyY = 0.0f;
+		_girlX = 0.0f;
+		_girlY = 0.0f;
+		_wheelActive = false;
+		_riderKind = -1;
+		_boyRides = 0;
+		_girlRides = 0;
+		_boyWaiting = true;
+		_manReady = false;
+		_manOnWheel = false;
+		_flag303 = false;
+		_manJumpAngle = 13;
+		_flag308 = false;
+		_girlWaiting = true;
+		_lastAngle = 0.0f;
+		if (_scene->_currentEntranceId != 0) {
+			if (_scene->_currentEntranceId == TrubaUp)
+				setLadderVes("INT_103", "INT_108", "MSG_TOLADDER");
+			else
+				setLadderVes("INT_103", "INT_108", "MSG_FROMLADDER");
+		}
 	}
 	_marginY = 200;
 	_marginX = 300;
 	_offsetY = 300;
 	_offsetX = 400;
+	if (!controllerRunsSceneLogic())
+		return;
+
 	_boyX = 290.0f;
 	_boyY = -363.0f;
 	_girlX = 283.0f;
diff --git a/engines/ngi/fullpipe/mobile/sc19controller.cpp b/engines/ngi/fullpipe/mobile/sc19controller.cpp
index bd498731aa0..ec52456d44b 100644
--- a/engines/ngi/fullpipe/mobile/sc19controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc19controller.cpp
@@ -42,15 +42,16 @@ Sc19Controller::~Sc19Controller() {
 void Sc19Controller::onShow() {
 	_keepCells = false;
 	Sc18Controller::onShow();
+	if (controllerRunsSceneLogic())
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_follow = nullptr;
-	_marginX = 300;
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	AniObject *cordie = _scene->findAniObjectById(ANI_CORDIE, 0);
 	cordie->stopMovement(false);
 	if (g_ngi->getState(sO_Sugar) == sO_Present) {
diff --git a/engines/ngi/fullpipe/mobile/sc20controller.cpp b/engines/ngi/fullpipe/mobile/sc20controller.cpp
index 06f40c22d2f..b58b71b96d4 100644
--- a/engines/ngi/fullpipe/mobile/sc20controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc20controller.cpp
@@ -98,14 +98,16 @@ void Sc20Controller::updateLockable() {
 // CSc20Controller::OnShow (1807C0)
 void Sc20Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_grandma = _scene->findAniObjectById(ANI_GRANDMA_20, 0);
 	_stool = _scene->findAniObjectById(ANI_STOOL_20, 0);
 	_grandma->_flags |= 4;
diff --git a/engines/ngi/fullpipe/mobile/sc21controller.cpp b/engines/ngi/fullpipe/mobile/sc21controller.cpp
index 407e0ea70b6..a1eb895a48e 100644
--- a/engines/ngi/fullpipe/mobile/sc21controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc21controller.cpp
@@ -64,30 +64,28 @@ int Sc21Controller::trySwitchUp() {
 // CSc21Controller::OnShow (180E40)
 void Sc21Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(5);
+		g_ngi->_chapterManager->setActiveChapter(6);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_6", true);
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		AniObject *hammer = _scene->findAniObjectById(ANI_HAMMER38, 0);
+		bool hammerShown = false;
+		if (isState(sO_Bridge, sO_Convoluted))
+			hammerShown = g_ngi->_inventory->getItemByName("ANI_INV_HAMMER")->_counter == 0;
+		if (hammerShown)
+			hammer->_flags |= 4;
+		else
+			hammer->_flags &= ~4;
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(5);
-	g_ngi->_chapterManager->setActiveChapter(6);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_6", true);
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	AniObject *hammer = _scene->findAniObjectById(ANI_HAMMER38, 0);
-	bool hammerShown = false;
-	if (isState(sO_Bridge, sO_Convoluted))
-		hammerShown = g_ngi->_inventory->getItemByName("ANI_INV_HAMMER")->_counter == 0;
-	if (hammerShown)
-		hammer->_flags |= 4;
-	else
-		hammer->_flags &= ~4;
-	_marginY = 200;
-	_marginX = 300;
-	_offsetY = 300;
-	_offsetX = 400;
 	_giraffe = _scene->findAniObjectById(ANI_GIRAFFE_BOTTOM, 0);
 	PictureObject *pipe = _scene->findPictureObjectById(PIC_SC21_DTRUBA, 0);
 	if (!isState(sO_LowerPipe_21, sO_IsOpened)) {
diff --git a/engines/ngi/fullpipe/mobile/sc22controller.cpp b/engines/ngi/fullpipe/mobile/sc22controller.cpp
index 7262a25f729..9e04dbb3511 100644
--- a/engines/ngi/fullpipe/mobile/sc22controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc22controller.cpp
@@ -246,19 +246,21 @@ void Sc22Controller::onClickHandle(bool fromQueue) {
 // CSc22Controller::OnShow (181FD0)
 void Sc22Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		HitregionObject *region = _scene->findAniObjectById(ANI_HANDLE_L, 0)->_hitregion;
+		if (region)
+			region->_bottom = 30.0f;
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("REPAIR_DEVICE_SC22");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	HitregionObject *region = _scene->findAniObjectById(ANI_HANDLE_L, 0)->_hitregion;
-	if (region)
-		region->_bottom = 30.0f;
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("REPAIR_DEVICE_SC22");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_sack = _scene->findAniObjectById(ANI_MESHOK, 0);
 	_giraffe = _scene->findAniObjectById(ANI_GIRAFFE_MIDDLE, 0);
 	_stool = _scene->findAniObjectById(ANI_TABURETTE, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc23controller.cpp b/engines/ngi/fullpipe/mobile/sc23controller.cpp
index dce46b16cdb..6a4b230d866 100644
--- a/engines/ngi/fullpipe/mobile/sc23controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc23controller.cpp
@@ -361,14 +361,16 @@ bool Sc23Controller::onStoolMouseDown(float x, float y) {
 // CSc23Controller::OnShow (183690)
 void Sc23Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	if (_scene->_currentEntranceId != 0)
 		g_ngi->_exitManager->setExitAngle(PIC_SC23_LADDERU, 0.0f);
 	_wheels.clear();
diff --git a/engines/ngi/fullpipe/mobile/sc24controller.cpp b/engines/ngi/fullpipe/mobile/sc24controller.cpp
index 7dd14f7f8fb..bd095a8e625 100644
--- a/engines/ngi/fullpipe/mobile/sc24controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc24controller.cpp
@@ -51,20 +51,22 @@ Sc24Controller::~Sc24Controller() {
 // CSc24Controller::OnShow (184800)
 void Sc24Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(7);
+		g_ngi->_chapterManager->setActiveChapter(7);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+			g_ngi->_taskManager->activateTask("FULL_RELEASE_POOL_SC24");
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_7", true);
+		}
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(7);
-	g_ngi->_chapterManager->setActiveChapter(7);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
-		g_ngi->_taskManager->activateTask("FULL_RELEASE_POOL_SC24");
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_7", true);
-	}
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_water = _scene->findAniObjectById(ANI_WATER24, 0);
 	_jet = _scene->findAniObjectById(ANI_JET24, 0);
 	_drop = _scene->findAniObjectById(ANI_DROP_24, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc25controller.cpp b/engines/ngi/fullpipe/mobile/sc25controller.cpp
index 8390b652f4f..9fbf3f2ee64 100644
--- a/engines/ngi/fullpipe/mobile/sc25controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc25controller.cpp
@@ -410,14 +410,16 @@ void Sc25Controller::doStartBeardeds() {
 // CSc25Controller::OnShow (185F08)
 void Sc25Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_water = _scene->findAniObjectById(ANI_WATER25, 0);
 	_board = _scene->findAniObjectById(ANI_BOARD25, 0);
 	_board->_flags &= ~4;
diff --git a/engines/ngi/fullpipe/mobile/sc26controller.cpp b/engines/ngi/fullpipe/mobile/sc26controller.cpp
index 26c248686c0..e71ca3555b4 100644
--- a/engines/ngi/fullpipe/mobile/sc26controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc26controller.cpp
@@ -229,19 +229,21 @@ bool Sc26Controller::onClickVent(AniObject *vent) {
 // CSc26Controller::OnShow (187E10)
 void Sc26Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		_chi = _scene->findAniObjectById(ANI_CHHI, 0);
+		_drop = _scene->findAniObjectById(ANI_DROP_26, 0);
+		_sockPicture = _scene->findPictureObjectById(PIC_SC26_SOCK, 0);
+		_sock = _scene->findAniObjectById(ANI_SOCK_26, 0);
+		_vent = _scene->findAniObjectById(ANI_VENT, 0);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	_chi = _scene->findAniObjectById(ANI_CHHI, 0);
-	_drop = _scene->findAniObjectById(ANI_DROP_26, 0);
-	_sockPicture = _scene->findPictureObjectById(PIC_SC26_SOCK, 0);
-	_sock = _scene->findAniObjectById(ANI_SOCK_26, 0);
-	_vent = _scene->findAniObjectById(ANI_VENT, 0);
 	setAniState();
 	if (isState(sO_Valve1_26, sO_Opened))
 		g_ngi->playSound(SND_26_018, 1);
diff --git a/engines/ngi/fullpipe/mobile/sc27controller.cpp b/engines/ngi/fullpipe/mobile/sc27controller.cpp
index 72635e721d8..a5016088f3e 100644
--- a/engines/ngi/fullpipe/mobile/sc27controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc27controller.cpp
@@ -755,17 +755,19 @@ void Sc27Controller::readSettingsXml() {
 // CSc27Controller::OnShow (18A810): after CFPController::OnShow only the camera margins and offsets
 void Sc27Controller::onShow() {
 	FPController::onShow();
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->deactivateTask("GET_TO_CURLING_SC25");
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("GET_VENTIL_SC27");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginX = 300;
 	_marginY = 200;
-	_offsetX = 400;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->deactivateTask("GET_TO_CURLING_SC25");
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("GET_VENTIL_SC27");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 
 	_shootParamMult = 2.5f;
 	_shootParamAdd = 8.0f;
diff --git a/engines/ngi/fullpipe/mobile/sc28controller.cpp b/engines/ngi/fullpipe/mobile/sc28controller.cpp
index e4c15d1ec5e..d2a4e6cc7a5 100644
--- a/engines/ngi/fullpipe/mobile/sc28controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc28controller.cpp
@@ -283,23 +283,25 @@ void Sc28Controller::onSceneInit() {
 // CSc28Controller::OnShow (18C1A0)
 void Sc28Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(8);
+		g_ngi->_chapterManager->setActiveChapter(8);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+			g_ngi->_taskManager->activateTask("GET_POT_SC28");
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_8", true);
+		}
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		_potion = _scene->findAniObjectById(ANI_INV_POT, 0);
+		_potionInteraction = getGameLoaderInteractionController()->findInteractionByName("INT_151_1");
+		_potionInteraction->_activity = 0.0f;
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(8);
-	g_ngi->_chapterManager->setActiveChapter(8);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
-		g_ngi->_taskManager->activateTask("GET_POT_SC28");
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_8", true);
-	}
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	_potion = _scene->findAniObjectById(ANI_INV_POT, 0);
-	_potionInteraction = getGameLoaderInteractionController()->findInteractionByName("INT_151_1");
-	_potionInteraction->_activity = 0.0f;
 	_flyPending = true;
 	_vtorpersLeft = true;
 	_pictureToHide = nullptr;
diff --git a/engines/ngi/fullpipe/mobile/sc29controller.cpp b/engines/ngi/fullpipe/mobile/sc29controller.cpp
index 75a01a1034b..e5d4ae96897 100644
--- a/engines/ngi/fullpipe/mobile/sc29controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc29controller.cpp
@@ -681,16 +681,18 @@ void Sc29Controller::readSettingsXml() {
 // CSc29Controller::OnShow (18EDDC)
 void Sc29Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("FIND_EXIT_PORTER_SC29");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("FIND_EXIT_PORTER_SC29");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_manSpeed = 0.024f;
 	_shootDelayMin = 2075.0f;
 	_shootDelayMax = 6225.0f;
diff --git a/engines/ngi/fullpipe/mobile/sc30controller.cpp b/engines/ngi/fullpipe/mobile/sc30controller.cpp
index 2826482e57b..6316f8703a8 100644
--- a/engines/ngi/fullpipe/mobile/sc30controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc30controller.cpp
@@ -75,16 +75,18 @@ void Sc30Controller::onLeaveScene() {
 // CSc30Controller::OnShow (18F93C)
 void Sc30Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("USE_POTS_SC30");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("USE_POTS_SC30");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_leg = _scene->findAniObjectById(ANI_LEG, 0);
 	if (isState(sO_Leg, sO_ShowsHeel)) {
 		_leg->setStatic(ST_LEG_UP, false);
diff --git a/engines/ngi/fullpipe/mobile/sc31controller.cpp b/engines/ngi/fullpipe/mobile/sc31controller.cpp
index b1a173a9620..7c6875118b1 100644
--- a/engines/ngi/fullpipe/mobile/sc31controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc31controller.cpp
@@ -52,18 +52,20 @@ void Sc31Controller::doTestCactus(MessageQueue *queue) {
 // CSc31Controller::OnShow (18FEE4)
 void Sc31Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(8);
+		g_ngi->_chapterManager->setActiveChapter(9);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_9", true);
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(8);
-	g_ngi->_chapterManager->setActiveChapter(9);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_9", true);
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_chantTimer = 0;
 	_cactus = _scene->findAniObjectById(ANI_CACTUS_31, 0);
 	if (!isState(sO_Cactus, sO_HasGrown)) {
diff --git a/engines/ngi/fullpipe/mobile/sc32controller.cpp b/engines/ngi/fullpipe/mobile/sc32controller.cpp
index adf45650d2b..0e937c6e230 100644
--- a/engines/ngi/fullpipe/mobile/sc32controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc32controller.cpp
@@ -220,17 +220,19 @@ void Sc32Controller::onSceneInit() {
 // CSc32Controller::OnShow (190F78)
 void Sc32Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		if (_scene->_currentEntranceId != 0)
+			g_ngi->_exitManager->setExitAngle(PIC_SC32_LADDER, 0.0f);
+		g_ngi->_help->setChapter(9);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	if (_scene->_currentEntranceId != 0)
-		g_ngi->_exitManager->setExitAngle(PIC_SC32_LADDER, 0.0f);
-	g_ngi->_help->setChapter(9);
 	if (_sitting || _cactusStarted) {
 		hero()->setStatic(ST_MAN_RIGHT, true);
 		hero()->setCenter(Common::Point(645, 466));
diff --git a/engines/ngi/fullpipe/mobile/sc33controller.cpp b/engines/ngi/fullpipe/mobile/sc33controller.cpp
index edd1b074e29..ebe8b09935c 100644
--- a/engines/ngi/fullpipe/mobile/sc33controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc33controller.cpp
@@ -152,26 +152,28 @@ void Sc33Controller::doTestMug(MessageQueue *queue) {
 // CSc33Controller::OnShow (191C94)
 void Sc33Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(9);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("GET_MUG_FULL_SC33");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		HitregionObject *region = _scene->findAniObjectById(ANI_HANDLE_L, 0)->_hitregion;
+		if (region) {
+			region->_top = -47.0f;
+			region->_bottom = 0.0f;
+		}
+		AniObject *tumba = _scene->findAniObjectById(ANI_SC33_TUMBA, 0);
+		tumba->setStatic(ST_SC33_TUMBA_STATE1, false);
+		tumba->setPosition(Common::Point(289, 427));
+		tumba->_z = 40;
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(9);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("GET_MUG_FULL_SC33");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	HitregionObject *region = _scene->findAniObjectById(ANI_HANDLE_L, 0)->_hitregion;
-	if (region) {
-		region->_top = -47.0f;
-		region->_bottom = 0.0f;
-	}
-	AniObject *tumba = _scene->findAniObjectById(ANI_SC33_TUMBA, 0);
-	tumba->setStatic(ST_SC33_TUMBA_STATE1, false);
-	tumba->setPosition(Common::Point(289, 427));
-	tumba->_z = 40;
 	_mug = _scene->findAniObjectById(ANI_MUG_33, 0);
 	_jettie = _scene->findAniObjectById(ANI_JETTIE_FLOW, 0);
 	_kubikX = -1;
diff --git a/engines/ngi/fullpipe/mobile/sc34controller.cpp b/engines/ngi/fullpipe/mobile/sc34controller.cpp
index 4e9f932af4d..96e3beef36c 100644
--- a/engines/ngi/fullpipe/mobile/sc34controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc34controller.cpp
@@ -250,20 +250,22 @@ bool Sc34Controller::onBoardMouseDown(float x, float y) {
 // CSc34Controller::OnShow (193180)
 void Sc34Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(10);
+		g_ngi->_chapterManager->setActiveChapter(10);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+			g_ngi->_taskManager->activateTask("USE_VENT_SC34");
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_10", true);
+		}
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(10);
-	g_ngi->_chapterManager->setActiveChapter(10);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
-		g_ngi->_taskManager->activateTask("USE_VENT_SC34");
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_10", true);
-	}
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_cactus = _scene->findAniObjectById(ANI_CACTUS_34, 0);
 	_vent = _scene->findAniObjectById(ANI_VENT_34, 0);
 	_hatch = _scene->findAniObjectById(ANI_LUK_34, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc35controller.cpp b/engines/ngi/fullpipe/mobile/sc35controller.cpp
index d4c0a446408..c940f6c7a2d 100644
--- a/engines/ngi/fullpipe/mobile/sc35controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc35controller.cpp
@@ -134,26 +134,28 @@ void Sc35Controller::stopFlow() {
 // CSc35Controller::OnShow (193FB0)
 void Sc35Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_help->setChapter(11);
+		g_ngi->_chapterManager->setActiveChapter(11);
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
+			g_ngi->_taskManager->activateTask("GET_PIPE_SC35");
+			g_ngi->_taskManager->activateTask("GET_COIN_SC35");
+			g_ngi->_chapterManager->showChapterDialog("CHAPTER_11", true);
+		}
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+		AniObject *hammer = _scene->findAniObjectById(ANI_HAMMER38, 0);
+		if (g_ngi->_inventory->getItemByName("ANI_INV_HAMMER")->_counter != 0)
+			hammer->_flags &= ~4;
+		else
+			hammer->_flags |= 4;
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_help->setChapter(11);
-	g_ngi->_chapterManager->setActiveChapter(11);
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId)) {
-		g_ngi->_taskManager->activateTask("GET_PIPE_SC35");
-		g_ngi->_taskManager->activateTask("GET_COIN_SC35");
-		g_ngi->_chapterManager->showChapterDialog("CHAPTER_11", true);
-	}
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
-	AniObject *hammer = _scene->findAniObjectById(ANI_HAMMER38, 0);
-	if (g_ngi->_inventory->getItemByName("ANI_INV_HAMMER")->_counter != 0)
-		hammer->_flags &= ~4;
-	else
-		hammer->_flags |= 4;
 	_flagStarts = false;
 	_flagStops = false;
 	_hose = _scene->findAniObjectById(ANI_HOSE, 0);
diff --git a/engines/ngi/fullpipe/mobile/sc36controller.cpp b/engines/ngi/fullpipe/mobile/sc36controller.cpp
index d539f85c600..a1d511efe74 100644
--- a/engines/ngi/fullpipe/mobile/sc36controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc36controller.cpp
@@ -40,16 +40,18 @@ Sc36Controller::~Sc36Controller() {
 // CSc36Controller::OnShow (194834)
 void Sc36Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
+			g_ngi->_taskManager->activateTask("USE_ROTOHRUST_SC36");
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	if (!g_ngi->_taskManager->isSceneVisited(_scene->_sceneId))
-		g_ngi->_taskManager->activateTask("USE_ROTOHRUST_SC36");
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	_rotohrust = _scene->findAniObjectById(ANI_ROTOHRUST, 0);
 	_scissors = _scene->findAniObjectById(ANI_SCISSORS_36, 0);
 }
diff --git a/engines/ngi/fullpipe/mobile/sc37controller.cpp b/engines/ngi/fullpipe/mobile/sc37controller.cpp
index d0480f566a2..c9ed1f8c57c 100644
--- a/engines/ngi/fullpipe/mobile/sc37controller.cpp
+++ b/engines/ngi/fullpipe/mobile/sc37controller.cpp
@@ -111,14 +111,16 @@ void Sc37Controller::testGuards() {
 // CSc37Controller::OnShow (194DEC)
 void Sc37Controller::onShow() {
 	FPController::onShow();
-	_marginX = 300;
+	if (controllerRunsSceneLogic()) {
+		g_ngi->_taskManager->visitScene(_scene->_sceneId);
+	}
 	_marginY = 200;
-	_offsetX = 400;
+	_marginX = 300;
 	_offsetY = 300;
+	_offsetX = 400;
 	if (!controllerRunsSceneLogic())
 		return;
 
-	g_ngi->_taskManager->visitScene(_scene->_sceneId);
 	for (int i = 0; i <= 12; i++) {
 		_scene->findAniObjectById(ANI_RING, i)->setStatic(ST_RNG_OPEN, false);
 		_scene->findAniObjectById(ANI_RING, i)->setCenter(Common::Point(299 - 20 * i, 444));




More information about the Scummvm-git-logs mailing list