ILLUSIONS: Pause actors when entering menu

This commit is contained in:
Eric Fry 2018-06-16 14:41:37 +10:00 committed by Eugene Sandulenko
parent ced1ff2356
commit 0303b83ead
6 changed files with 62 additions and 4 deletions

View File

@ -1305,7 +1305,7 @@ bool Controls::getOverlappedObject(Control *control, Common::Point pt, Control *
foundControl = testControl;
foundPriority = testPriority;
}
}
}
}
}
@ -1504,4 +1504,49 @@ void Controls::destroyControlInternal(Control *control) {
delete control;
}
void Controls::disappearActors() {
for (ItemsIterator it = _controls.begin(); it != _controls.end(); ++it) {
Control *control = *it;
if (control->_flags & 4 && control->_pauseCtr == 0) {
control->disappearActor();
}
}
Control *control = _vm->_dict->getObjectControl(0x40148);
if (control) {
control->disappearActor();
}
}
void Controls::appearActors() {
for (ItemsIterator it = _controls.begin(); it != _controls.end(); ++it) {
Control *control = *it;
if (control->_flags & 4 && control->_pauseCtr == 0) {
control->appearActor();
}
}
Control *control = _vm->_dict->getObjectControl(0x40148);
if (control) {
control->appearActor();
}
}
void Controls::pauseActors(uint32 objectId) {
for (ItemsIterator it = _controls.begin(); it != _controls.end(); ++it) {
Control *control = *it;
if (control->_actor && control->_objectId != objectId) {
control->_actor->pause();
}
}
}
void Controls::unpauseActors(uint32 objectId) {
for (ItemsIterator it = _controls.begin(); it != _controls.end(); ++it) {
Control *control = *it;
if (control->_actor && control->_objectId != objectId) {
control->_actor->unpause();
}
}
}
} // End of namespace Illusions

View File

@ -276,6 +276,10 @@ public:
bool findNamedPoint(uint32 namedPointId, Common::Point &pt);
void actorControlRoutine(Control *control, uint32 deltaTime);
void dialogItemControlRoutine(Control *control, uint32 deltaTime);
void disappearActors();
void appearActors();
void pauseActors(uint32 objectId);
void unpauseActors(uint32 objectId);
public:
typedef Common::List<Control*> Items;
typedef Items::iterator ItemsIterator;

View File

@ -942,13 +942,13 @@ void IllusionsEngine_Duckman::pause(uint32 callerThreadId) {
_threads->pauseThreads(callerThreadId);
_camera->pause();
pauseFader();
// TODO largeObj_pauseControlActor(Illusions::CURSOR_OBJECT_ID);
_controls->pauseActors(Illusions::CURSOR_OBJECT_ID);
}
}
void IllusionsEngine_Duckman::unpause(uint32 callerThreadId) {
if (--_pauseCtr == 0) {
// TODO largeObj_unpauseControlActor(Illusions::CURSOR_OBJECT_ID);
_controls->unpauseActors(Illusions::CURSOR_OBJECT_ID);
unpauseFader();
_camera->unpause();
_threads->unpauseThreads(callerThreadId);

View File

@ -107,7 +107,7 @@ BaseMenu *DuckmanMenuSystem::createLoadGameMenu() {
}
BaseMenu *DuckmanMenuSystem::createOptionsMenu() {
BaseMenu *menu = new BaseMenu(this, 0x00120003, 12, 17, 11, 27, 1);
BaseMenu *menu = new BaseMenu(this, 0x00120003, 12, 17, 11, 27, 6);
menu->addText(" GAME OPTIONS @@@@");
menu->addText("--------------------------------------");
MenuActionUpdateSlider *action = new MenuActionUpdateSlider(this, menu);
@ -130,6 +130,9 @@ BaseMenu *DuckmanMenuSystem::createOptionsMenu() {
action->setMenuItem(menuItem);
menu->addMenuItem(menuItem);
menu->addMenuItem(new MenuItem("Restore Defaults", new MenuActionLeaveMenu(this)));
menu->addMenuItem(new MenuItem("Back", new MenuActionLeaveMenu(this)));
return menu;
}

View File

@ -350,11 +350,15 @@ void ScriptOpcodes_Duckman::opEnterDebugger(ScriptThread *scriptThread, OpCall &
// Used for debugging purposes in the original engine
// This is not supported and only reachable by code not implemented here!
//error("ScriptOpcodes_Duckman::opEnterDebugger() Debugger function called");
_vm->_controls->disappearActors();
// TODO more logic needed here
}
void ScriptOpcodes_Duckman::opLeaveDebugger(ScriptThread *scriptThread, OpCall &opCall) {
// See opEnterDebugger
//error("ScriptOpcodes_Duckman::opLeaveDebugger() Debugger function called");
_vm->_controls->appearActors();
// TODO more logic needed here
}
void ScriptOpcodes_Duckman::opDumpCurrentSceneFiles(ScriptThread *scriptThread, OpCall &opCall) {

View File

@ -474,6 +474,7 @@ void BaseMenuSystem::update(Control *cursorControl) {
setMouseCursorToMenuItem(_hoveredMenuItemIndex);
_hoveredMenuItemIndex2 = _hoveredMenuItemIndex;
updateActorHoverBackground();
playSoundEffect(0xC);
} else if (_vm->_input->pollEvent(kEventDown)) {
// TODO handleDownKey();
if (_hoveredMenuItemIndex == _activeMenu->getMenuItemsCount()) {
@ -484,6 +485,7 @@ void BaseMenuSystem::update(Control *cursorControl) {
setMouseCursorToMenuItem(_hoveredMenuItemIndex);
_hoveredMenuItemIndex2 = _hoveredMenuItemIndex;
updateActorHoverBackground();
playSoundEffect(0xC);
}
updateTimeOut(resetTimeOut);