STARK: Allow skipping speeches
This commit is contained in:
parent
85b7a3627e
commit
6a828323ab
6 changed files with 118 additions and 0 deletions
|
@ -45,6 +45,7 @@ MODULE_OBJS := \
|
|||
services/resourceprovider.o \
|
||||
services/services.o \
|
||||
services/stateprovider.o \
|
||||
services/userinterface.o \
|
||||
skeleton.o \
|
||||
skeleton_anim.o \
|
||||
stark.o \
|
||||
|
|
|
@ -36,6 +36,7 @@ class DialogPlayer;
|
|||
class Global;
|
||||
class ResourceProvider;
|
||||
class Scene;
|
||||
class UserInterface;
|
||||
|
||||
/**
|
||||
* Public services available as a singleton
|
||||
|
@ -49,6 +50,7 @@ public:
|
|||
resourceProvider = nullptr;
|
||||
randomSource = nullptr;
|
||||
scene = nullptr;
|
||||
userInterface = nullptr;
|
||||
}
|
||||
|
||||
ArchiveLoader *archiveLoader;
|
||||
|
@ -57,6 +59,7 @@ public:
|
|||
ResourceProvider *resourceProvider;
|
||||
Common::RandomSource *randomSource;
|
||||
Scene *scene;
|
||||
UserInterface *userInterface;
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
62
engines/stark/services/userinterface.cpp
Normal file
62
engines/stark/services/userinterface.cpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the AUTHORS
|
||||
* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/stark/services/userinterface.h"
|
||||
|
||||
#include "engines/stark/resources/level.h"
|
||||
#include "engines/stark/resources/location.h"
|
||||
#include "engines/stark/resources/speech.h"
|
||||
#include "engines/stark/services/global.h"
|
||||
#include "engines/stark/services/services.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
UserInterface::UserInterface() {
|
||||
}
|
||||
|
||||
UserInterface::~UserInterface() {
|
||||
}
|
||||
|
||||
void UserInterface::skipCurrentSpeeches() {
|
||||
Global *global = StarkServices::instance().global;
|
||||
Current *current = global->getCurrent();
|
||||
|
||||
if (!current) {
|
||||
return; // No current location, nothing to do
|
||||
}
|
||||
|
||||
// Get all speeches
|
||||
Common::Array<Speech *> speeches;
|
||||
speeches.push_back(global->getLevel()->listChildrenRecursive<Speech>());
|
||||
speeches.push_back(current->getLevel()->listChildrenRecursive<Speech>());
|
||||
speeches.push_back(current->getLocation()->listChildrenRecursive<Speech>());
|
||||
|
||||
// Stop them
|
||||
for (uint i = 0; i < speeches.size(); i++) {
|
||||
Speech *speech = speeches[i];
|
||||
if (speech->isPlaying()) {
|
||||
speech->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
44
engines/stark/services/userinterface.h
Normal file
44
engines/stark/services/userinterface.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the AUTHORS
|
||||
* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STARK_SERVICES_USER_INTERFACE_H
|
||||
#define STARK_SERVICES_USER_INTERFACE_H
|
||||
|
||||
namespace Stark {
|
||||
|
||||
/**
|
||||
* Facade object for interacting with the game world
|
||||
*/
|
||||
class UserInterface {
|
||||
public:
|
||||
UserInterface();
|
||||
~UserInterface();
|
||||
|
||||
/** Skip currently playing speeches */
|
||||
void skipCurrentSpeeches();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_SERVICES_USER_INTERFACE_H
|
|
@ -33,6 +33,7 @@
|
|||
#include "engines/stark/services/resourceprovider.h"
|
||||
#include "engines/stark/services/services.h"
|
||||
#include "engines/stark/services/stateprovider.h"
|
||||
#include "engines/stark/services/userinterface.h"
|
||||
#include "engines/stark/gfx/driver.h"
|
||||
#include "engines/stark/gfx/renderentry.h"
|
||||
|
||||
|
@ -52,6 +53,7 @@ StarkEngine::StarkEngine(OSystem *syst, const ADGameDescription *gameDesc) :
|
|||
_scene(nullptr),
|
||||
_console(nullptr),
|
||||
_global(nullptr),
|
||||
_userInterface(nullptr),
|
||||
_archiveLoader(nullptr),
|
||||
_stateProvider(nullptr),
|
||||
_resourceProvider(nullptr),
|
||||
|
@ -70,6 +72,7 @@ StarkEngine::StarkEngine(OSystem *syst, const ADGameDescription *gameDesc) :
|
|||
}
|
||||
|
||||
StarkEngine::~StarkEngine() {
|
||||
delete _userInterface;
|
||||
delete _dialogPlayer;
|
||||
delete _randomSource;
|
||||
delete _scene;
|
||||
|
@ -97,6 +100,7 @@ Common::Error StarkEngine::run() {
|
|||
_randomSource = new Common::RandomSource("stark");
|
||||
_scene = new Scene(_gfx);
|
||||
_dialogPlayer = new DialogPlayer();
|
||||
_userInterface = new UserInterface();
|
||||
|
||||
// Setup the public services
|
||||
StarkServices &services = StarkServices::instance();
|
||||
|
@ -140,6 +144,8 @@ void StarkEngine::mainLoop() {
|
|||
//handleChars(event.type, event.kbd.keycode, event.kbd.flags, event.kbd.ascii);
|
||||
}
|
||||
|
||||
} else if (e.type == Common::EVENT_LBUTTONUP) {
|
||||
_userInterface->skipCurrentSpeeches();
|
||||
}
|
||||
/*if (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_KEYUP) {
|
||||
handleControls(event.type, event.kbd.keycode, event.kbd.flags, event.kbd.ascii);
|
||||
|
|
|
@ -48,6 +48,7 @@ class Console;
|
|||
class DialogPlayer;
|
||||
class GfxDriver;
|
||||
class Global;
|
||||
class UserInterface;
|
||||
class Scene;
|
||||
class StateProvider;
|
||||
class ResourceProvider;
|
||||
|
@ -78,6 +79,7 @@ private:
|
|||
ArchiveLoader *_archiveLoader;
|
||||
DialogPlayer *_dialogPlayer;
|
||||
Global *_global;
|
||||
UserInterface *_userInterface;
|
||||
StateProvider *_stateProvider;
|
||||
ResourceProvider *_resourceProvider;
|
||||
Common::RandomSource *_randomSource;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue