NANCY: Includes cleanup

Cleaned up the engine's #includes. Also moved the NancyEngine::GameState enum to commontypes.h and renamed it to NancyState.
This commit is contained in:
fracturehill 2021-03-26 01:17:07 +02:00
parent 686ad3c817
commit ff078328bc
73 changed files with 234 additions and 425 deletions

View File

@ -20,20 +20,16 @@
*
*/
#include "engines/nancy/commontypes.h"
#include "engines/nancy/action/actionmanager.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/input.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/ui/viewport.h"
#include "engines/nancy/sound.h"
#include "common/memstream.h"
#include "common/events.h"
#include "common/str.h"
#include "common/serializer.h"
namespace Nancy {

View File

@ -25,13 +25,9 @@
#include "engines/nancy/action/actionrecord.h"
#include "common/str.h"
#include "common/stream.h"
#include "common/array.h"
#include "common/func.h"
namespace Common {
class Serializer;
class SeekableReadStream;
}
namespace Nancy {

View File

@ -20,7 +20,7 @@
*
*/
#include "engines/nancy/action/actionmanager.h"
#include "engines/nancy/action/actionrecord.h"
namespace Nancy {
namespace Action {

View File

@ -23,18 +23,19 @@
#ifndef NANCY_ACTION_ACTIONRECORD_H
#define NANCY_ACTION_ACTIONRECORD_H
#include "engines/nancy/input.h"
#include "common/str.h"
#include "engines/nancy/time.h"
#include "engines/nancy/cursor.h"
#include "common/str.h"
#include "common/stream.h"
#include "common/rect.h"
namespace Common {
class SeekableReadStream;
}
namespace Nancy {
class NancyEngine;
struct NancyInput;
namespace Action {

View File

@ -36,8 +36,6 @@
#include "engines/nancy/state/scene.h"
#include "engines/nancy/nancy.h"
namespace Nancy {
namespace Action {

View File

@ -22,12 +22,14 @@
#include "engines/nancy/action/leverpuzzle.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/util.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/input.h"
namespace Nancy {
namespace Action {

View File

@ -28,11 +28,6 @@
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
#include "graphics/managed_surface.h"
namespace Nancy {
namespace Action {

View File

@ -22,18 +22,16 @@
#include "engines/nancy/action/orderingpuzzle.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/util.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/ui/viewport.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/input.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/sound.h"
#include "graphics/surface.h"
namespace Nancy {
namespace Action {

View File

@ -28,12 +28,6 @@
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
#include "common/rect.h"
#include "graphics/managed_surface.h"
namespace Nancy {
namespace Action {

View File

@ -22,14 +22,14 @@
#include "engines/nancy/action/passwordpuzzle.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/util.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/state/scene.h"
#include "graphics/font.h"
#include "engines/nancy/input.h"
namespace Nancy {
namespace Action {

View File

@ -27,10 +27,6 @@
#include "engines/nancy/renderobject.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/time.h"
#include "common/str.h"
#include "common/rect.h"
namespace Nancy {
namespace Action {

View File

@ -22,18 +22,16 @@
#include "engines/nancy/action/primaryvideo.h"
#include "engines/nancy/action/responses.cpp"
#include "engines/nancy/action/actionmanager.h"
#include "common/random.h"
#include "engines/nancy/action/responses.cpp"
#include "engines/nancy/nancy.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/util.h"
#include "common/file.h"
#include "common/random.h"
namespace Nancy {
namespace Action {

View File

@ -29,9 +29,6 @@
#include "engines/nancy/video.h"
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
namespace Nancy {
class NancyEngine;

View File

@ -20,12 +20,13 @@
*
*/
#include "engines/nancy/action/recordtypes.h"
#include "engines/nancy/action/actionrecord.h"
#include "engines/nancy/action/actionmanager.h"
#include "engines/nancy/action/responses.cpp"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/sound.h"
@ -33,10 +34,6 @@
#include "engines/nancy/resource.h"
#include "engines/nancy/util.h"
#include "engines/nancy/action/responses.cpp"
#include "common/str.h"
namespace Nancy {
namespace Action {
@ -126,7 +123,7 @@ void MapCall::readData(Common::SeekableReadStream &stream) {
void MapCall::execute() {
_execType = kRepeating;
NancySceneState.requestStateChange(NancyEngine::kMap);
NancySceneState.requestStateChange(NancyState::kMap);
finishExecution();
}
@ -295,7 +292,7 @@ void LoseGame::readData(Common::SeekableReadStream &stream) {
void LoseGame::execute() {
g_nancy->_sound->stopAndUnloadSpecificSounds();
g_nancy->setState(NancyEngine::kMainMenu);
g_nancy->setState(NancyState::kMainMenu);
NancySceneState.resetStateToInit();
_isDone = true;
}
@ -314,7 +311,7 @@ void WinGame::readData(Common::SeekableReadStream &stream) {
void WinGame::execute() {
g_nancy->_sound->stopAndUnloadSpecificSounds();
g_nancy->setState(NancyEngine::kCredits, NancyEngine::kMainMenu);
g_nancy->setState(NancyState::kCredits, NancyState::kMainMenu);
// TODO replace with destroy()?
NancySceneState.resetStateToInit();

View File

@ -24,15 +24,10 @@
#define NANCY_ACTION_RECORDTYPES_H
#include "engines/nancy/action/actionrecord.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/renderobject.h"
#include "engines/nancy/commontypes.h"
#include "common/stream.h"
#include "common/array.h"
#include "common/str.h"
namespace Nancy {
class NancyEngine;

View File

@ -20,8 +20,7 @@
*
*/
#include "engines/nancy/action/recordtypes.h"
#include "common/array.h"
#include "engines/nancy/commontypes.h"
namespace Nancy {
namespace Action {

View File

@ -22,14 +22,16 @@
#include "engines/nancy/action/rotatinglockpuzzle.h"
#include "common/random.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/util.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/state/scene.h"
#include "common/random.h"
#include "engines/nancy/input.h"
namespace Nancy {
namespace Action {

View File

@ -27,11 +27,6 @@
#include "engines/nancy/renderobject.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/time.h"
#include "common/str.h"
#include "common/array.h"
#include "common/rect.h"
namespace Nancy {
namespace Action {

View File

@ -22,10 +22,12 @@
#include "engines/nancy/action/secondarymovie.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/util.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/sound.h"
namespace Nancy {
namespace Action {

View File

@ -29,9 +29,6 @@
#include "engines/nancy/video.h"
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
namespace Nancy {
namespace Action {

View File

@ -24,8 +24,6 @@
#include "engines/nancy/state/scene.h"
#include "engines/nancy/ui/viewport.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/util.h"
#include "engines/nancy/sound.h"
@ -34,9 +32,6 @@
#include "engines/nancy/graphics.h"
#include "engines/nancy/sound.h"
#include "common/system.h"
#include "common/events.h"
namespace Nancy {
namespace Action {

View File

@ -29,9 +29,6 @@
#include "engines/nancy/video.h"
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
namespace Nancy {
namespace Action {

View File

@ -22,14 +22,14 @@
#include "engines/nancy/action/sliderpuzzle.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/util.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/state/scene.h"
#include "common/serializer.h"
#include "engines/nancy/input.h"
namespace Nancy {
namespace Action {

View File

@ -28,12 +28,6 @@
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
#include "common/rect.h"
#include "graphics/managed_surface.h"
namespace Common {
class Serializer;
}

View File

@ -22,15 +22,15 @@
#include "engines/nancy/action/staticbitmapanim.h"
#include "engines/nancy/sound.h"
#include "common/rational.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/util.h"
#include "engines/nancy/resource.h"
#include "common/rational.h"
namespace Nancy {
namespace Action {

View File

@ -28,9 +28,6 @@
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
namespace Nancy {
namespace Action {

View File

@ -22,16 +22,18 @@
#include "engines/nancy/action/telephone.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/ui/textbox.h"
#include "engines/nancy/util.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/input.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/ui/textbox.h"
namespace Nancy {
namespace Action {

View File

@ -28,12 +28,6 @@
#include "engines/nancy/commontypes.h"
#include "common/str.h"
#include "common/array.h"
#include "common/rect.h"
#include "graphics/managed_surface.h"
namespace Nancy {
namespace Action {

View File

@ -22,18 +22,16 @@
#include "engines/nancy/cheat.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/iff.h"
#include "engines/nancy/state/scene.h"
#include "common/winexe.h"
#include "common/stream.h"
#include "common/translation.h"
#include "common/ustr.h"
#include "common/stream.h"
#include "gui/widgets/tab.h"
#include "gui/widgets/edittext.h"
#include "engines/nancy/iff.h"
#include "engines/nancy/state/scene.h"
namespace Nancy {
CheatDialog::CheatDialog() : GUI::Dialog(20, 20, 600, 440) {

View File

@ -23,17 +23,14 @@
#ifndef NANCY_CHEAT_H
#define NANCY_CHEAT_H
#include "engines/nancy/commontypes.h"
#include "gui/dialog.h"
#include "gui/widget.h"
#include "common/str.h"
#include "common/array.h"
namespace GUI {
class TabWidget;
class EditTextWidget;
class CheckboxWidget;
}
namespace Nancy {

View File

@ -22,12 +22,11 @@
#include "engines/nancy/commontypes.h"
#include "engines/nancy/util.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/state/scene.h"
#include "common/stream.h"
#include "engines/nancy/util.h"
#include "engines/nancy/state/scene.h"
namespace Nancy {
void SceneChangeDescription::readData(Common::SeekableReadStream &stream) {

View File

@ -23,7 +23,6 @@
#ifndef NANCY_COMMONYPES_H
#define NANCY_COMMONYPES_H
#include "common/scummsys.h"
#include "common/rect.h"
#include "common/str.h"
@ -38,6 +37,30 @@ class NancyEngine;
enum NancyFlag : byte { kFalse = 1, kTrue = 2 };
enum MovementDirection : byte { kUp = 1, kDown = 2, kLeft = 4, kRight = 8, kMoveFast = 16 };
// Separate namespace to remove possible clashes
namespace NancyState {
enum NancyState {
kBoot,
kPartnerLogo,
kLogo,
kCredits,
kMap,
kMainMenu,
kLoadSave,
kSetup,
// unknown/invalid
kHelp,
kScene,
// CD change
kCheat,
kQuit,
// regain focus
kNone,
kPause, // only used when the GMM is on screen
kReloadSave
};
}
// Describes a scene transition
struct SceneChangeDescription {
uint16 sceneID = 0;

View File

@ -21,6 +21,12 @@
*/
#include "engines/nancy/console.h"
#include "common/system.h"
#include "common/events.h"
#include "audio/audiostream.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/video.h"
@ -30,13 +36,6 @@
#include "engines/nancy/input.h"
#include "engines/nancy/graphics.h"
#include "common/system.h"
#include "common/events.h"
#include "graphics/surface.h"
#include "audio/audiostream.h"
namespace Nancy {
NancyConsole::NancyConsole() : GUI::Debugger() {

View File

@ -22,14 +22,13 @@
#include "engines/nancy/cursor.h"
#include "graphics/cursorman.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/util.h"
#include "common/stream.h"
#include "common/str.h"
namespace Nancy {
void CursorManager::init() {

View File

@ -23,7 +23,8 @@
#ifndef NANCY_CURSOR_H
#define NANCY_CURSOR_H
#include "graphics/cursorman.h"
#include "common/array.h"
#include "graphics/managed_surface.h"
namespace Nancy {

View File

@ -22,15 +22,6 @@
#include "engines/nancy/detection.h"
#include "common/system.h"
#include "common/savefile.h"
#include "common/textconsole.h"
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
#include "engines/advancedDetector.h"
const char *const directoryGlobs[] = {
"game",
"datafiles",

View File

@ -22,14 +22,14 @@
#ifndef NANCY_FONT_H
#define NANCY_FONT_H
#include "graphics/font.h"
#include "common/array.h"
#include "graphics/font.h"
#include "graphics/surface.h"
#include "common/stream.h"
#include "common/array.h"
#include "common/rect.h"
#include "common/str.h"
namespace Common {
class SeekableReadStream;
}
namespace Nancy {

View File

@ -22,21 +22,14 @@
#include "engines/nancy/graphics.h"
#include "engines/nancy/renderobject.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/ui/viewport.h"
#include "common/file.h"
#include "common/system.h"
#include "image/bmp.h"
#include "engines/util.h"
#include "engines/nancy/renderobject.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/nancy.h"
namespace Nancy {
GraphicsManager::GraphicsManager() :

View File

@ -23,16 +23,16 @@
#ifndef NANCY_GRAPHICS_H
#define NANCY_GRAPHICS_H
#include "engines/nancy/renderobject.h"
#include "engines/nancy/font.h"
#include "common/array.h"
#include "graphics/screen.h"
#include "engines/nancy/font.h"
namespace Nancy {
class NancyEngine;
class RenderObject;
// Graphics class that handles multilayered surface rendering with minimal redraw
class GraphicsManager {

View File

@ -20,14 +20,13 @@
*
*/
#include "engines/nancy/nancy.h"
#include "engines/nancy/iff.h"
#include "engines/nancy/resource.h"
#include "common/memstream.h"
#include "common/iff_container.h"
#include "common/debug.h"
#include "common/endian.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
namespace Nancy {

View File

@ -25,6 +25,7 @@
#include "engines/nancy/nancy.h"
#include "common/translation.h"
#include "common/events.h"
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymap.h"

View File

@ -23,20 +23,17 @@
#ifndef NANCY_INPUT_H
#define NANCY_INPUT_H
#include "engines/nancy/commontypes.h"
#include "common/rect.h"
#include "common/array.h"
#include "common/events.h"
#include "common/keyboard.h"
namespace Common {
class Keymap;
typedef class Array<Keymap *> KeymapArray;
}
namespace Nancy {
class NancyEngine;
namespace State {
class State;
}

View File

@ -20,19 +20,11 @@
*
*/
#include "engines/advancedDetector.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/input.h"
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
#include "graphics/thumbnail.h"
#include "base/plugins.h"
#include "engines/advancedDetector.h"
class NancyMetaEngine : public AdvancedMetaEngine {
public:
const char *getName() const override {

View File

@ -20,17 +20,23 @@
*
*/
#include "engines/nancy/nancy.h"
#include "common/system.h"
#include "common/random.h"
#include "common/debug-channels.h"
#include "common/config-manager.h"
#include "common/memstream.h"
#include "common/installshield_cab.h"
#include "common/savefile.h"
#include "common/serializer.h"
#include "engines/nancy/state/logo.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/state/help.h"
#include "engines/nancy/state/map.h"
#include "engines/nancy/state/credits.h"
#include "engines/nancy/action/sliderpuzzle.h"
#include "engines/nancy/action/primaryvideo.h"
#include "engines/nancy/action/secondarymovie.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/iff.h"
#include "engines/nancy/sound.h"
@ -39,26 +45,9 @@
#include "engines/nancy/graphics.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/cheat.h"
#include "engines/nancy/console.h"
#include "common/system.h"
#include "common/random.h"
#include "common/error.h"
#include "common/events.h"
#include "common/debug-channels.h"
#include "common/config-manager.h"
#include "common/textconsole.h"
#include "common/memstream.h"
#include "common/installshield_cab.h"
#include "common/str.h"
#include "common/savefile.h"
#include "common/serializer.h"
#include "graphics/surface.h"
#include "audio/mixer.h"
#include "audio/audiostream.h"
#include "engines/util.h"
#include "engines/nancy/action/primaryvideo.h"
namespace Nancy {
@ -164,14 +153,14 @@ Common::Platform NancyEngine::getPlatform() const {
return _gameDescription->desc.platform;
}
void NancyEngine::setState(GameState state, GameState overridePrevious) {
void NancyEngine::setState(NancyState::NancyState state, NancyState::NancyState overridePrevious) {
// Handle special cases first
switch (state) {
case kBoot:
case NancyState::kBoot:
bootGameEngine();
setState(kLogo);
setState(NancyState::kLogo);
return;
case kMainMenu:
case NancyState::kMainMenu:
if (_gameFlow.currentState) {
if (_gameFlow.currentState->onStateExit()) {
_gameFlow.currentState = nullptr;
@ -190,7 +179,7 @@ void NancyEngine::setState(GameState state, GameState overridePrevious) {
}
return;
case kCheat:
case NancyState::kCheat:
if (_cheatTypeIsEventFlag) {
EventFlagDialog *dialog = new EventFlagDialog();
runDialog(*dialog);
@ -219,7 +208,7 @@ void NancyEngine::setState(GameState state, GameState overridePrevious) {
_gameFlow.currentState->onStateEnter();
}
if (overridePrevious != kNone) {
if (overridePrevious != NancyState::kNone) {
_gameFlow.previousState = getStateObject(state);
}
}
@ -241,19 +230,19 @@ void NancyEngine::setMouseEnabled(bool enabled) {
}
void NancyEngine::callCheatMenu(bool eventFlags) {
setState(kCheat), _cheatTypeIsEventFlag = eventFlags;
setState(NancyState::kCheat), _cheatTypeIsEventFlag = eventFlags;
}
Common::Error NancyEngine::run() {
// Boot the engine
setState(kBoot);
setState(NancyState::kBoot);
// Check if we need to load a save state from the launcher
if (ConfMan.hasKey("save_slot")) {
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot >= 0 && saveSlot <= getMetaEngine().getMaximumSaveSlot()) {
// Set to Scene but do not do the loading yet
setState(kScene);
setState(NancyState::kScene);
}
}
@ -360,17 +349,17 @@ void NancyEngine::bootGameEngine() {
_cursorManager->init();
}
State::State *NancyEngine::getStateObject(GameState state) const {
State::State *NancyEngine::getStateObject(NancyState::NancyState state) const {
switch (state) {
case kLogo:
case NancyState::kLogo:
return &State::Logo::instance();
case kCredits:
case NancyState::kCredits:
return &State::Credits::instance();
case kMap:
case NancyState::kMap:
return &State::Map::instance();
case kHelp:
case NancyState::kHelp:
return &State::Help::instance();
case kScene:
case NancyState::kScene:
return &State::Scene::instance();
default:
return nullptr;

View File

@ -23,14 +23,15 @@
#ifndef NANCY_H
#define NANCY_H
#include "nancy/console.h"
#include "nancy/detection.h"
#include "nancy/time.h"
#include "engines/engine.h"
#include "common/file.h"
#include "common/str.h"
#include "engines/engine.h"
#include "nancy/detection.h"
#include "nancy/time.h"
#include "nancy/commontypes.h"
namespace Common {
class RandomSource;
class Serializer;
@ -69,6 +70,7 @@ class SoundManager;
class GraphicsManager;
class CursorManager;
class CheatDialog;
class NancyConsole;
namespace State {
class State;
@ -83,27 +85,6 @@ class NancyEngine : public Engine {
public:
friend class NancyConsole;
enum GameState {
kBoot,
kPartnerLogo,
kLogo,
kCredits,
kMap,
kMainMenu,
kLoadSave,
kSetup,
// unknown/invalid
kHelp,
kScene,
// CD change
kCheat,
kQuit,
// regain focus
kNone,
kPause, // only used when the GMM is on screen
kReloadSave
};
NancyEngine(OSystem *syst, const NancyGameDescription *gd);
~NancyEngine();
@ -124,7 +105,7 @@ public:
GameType getGameType() const;
Common::Platform getPlatform() const;
void setState(GameState state, GameState overridePrevious = kNone);
void setState(NancyState::NancyState state, NancyState::NancyState overridePrevious = NancyState::kNone);
State::State *getState() { return _gameFlow.currentState; }
void setPreviousState();
@ -164,7 +145,7 @@ private:
void bootGameEngine();
State::State *getStateObject(GameState state) const;
State::State *getStateObject(NancyState::NancyState state) const;
bool addBootChunk(const Common::String &name, Common::SeekableReadStream *stream);
void clearBootChunks();

View File

@ -22,13 +22,12 @@
#include "engines/nancy/renderobject.h"
#include "common/stream.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/input.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/ui/viewport.h"
#include "common/stream.h"
namespace Nancy {

View File

@ -23,16 +23,14 @@
#ifndef NANCY_RENDEROBJECT_H
#define NANCY_RENDEROBJECT_H
#include "engines/nancy/commontypes.h"
#include "common/rect.h"
#include "common/keyboard.h"
#include "graphics/managed_surface.h"
namespace Nancy {
class NancyEngine;
class GraphicsManager;
// Loosely equivalent to the original engine's ZRenderStructs.
// A subclass of this will be automatically updated and drawn from the graphics manager,

View File

@ -21,20 +21,15 @@
*/
#include "engines/nancy/resource.h"
#include "common/memstream.h"
#include "image/bmp.h"
#include "engines/nancy/decompress.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/nancy.h"
#include "common/file.h"
#include "common/textconsole.h"
#include "common/debug.h"
#include "common/stream.h"
#include "common/memstream.h"
#include "graphics/surface.h"
#include "image/bmp.h"
namespace Nancy {
static void readCifInfo20(Common::File &f, ResourceManager::CifInfo &info, uint32 *dataOffset = nullptr) {

View File

@ -21,18 +21,16 @@
*/
#include "engines/nancy/sound.h"
#include "engines/nancy/nancy.h"
#include "common/system.h"
#include "common/debug.h"
#include "common/textconsole.h"
#include "common/stream.h"
#include "common/substream.h"
#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
#include "audio/decoders/vorbis.h"
#include "engines/nancy/nancy.h"
namespace Nancy {
enum SoundType {

View File

@ -23,9 +23,6 @@
#ifndef NANCY_SOUND_H
#define NANCY_SOUND_H
#include "engines/nancy/commontypes.h"
#include "common/types.h"
#include "common/str.h"
#include "audio/mixer.h"
@ -41,6 +38,7 @@ class SeekableAudioStream;
namespace Nancy {
class NancyEngine;
struct SoundDescription;
class SoundManager {
public:

View File

@ -30,8 +30,6 @@
#include "engines/nancy/input.h"
#include "engines/nancy/cursor.h"
#include "common/stream.h"
namespace Common {
DECLARE_SINGLETON(Nancy::State::Credits);
}
@ -92,7 +90,7 @@ void Credits::run() {
if (input.input & NancyInput::kLeftMouseButtonDown) {
_state = kInit;
g_nancy->_sound->stopSound(_sound);
g_nancy->setState(NancyEngine::kMainMenu);
g_nancy->setState(NancyState::kMainMenu);
g_nancy->_cursorManager->showCursor(true);
_fullTextSurface.free();
}

View File

@ -23,6 +23,8 @@
#ifndef NANCY_STATE_CREDITS_H
#define NANCY_STATE_CREDITS_H
#include "common/singleton.h"
#include "engines/nancy/state/state.h"
#include "engines/nancy/ui/fullscreenimage.h"
@ -30,15 +32,8 @@
#include "engines/nancy/time.h"
#include "engines/nancy/commontypes.h"
#include "common/rect.h"
#include "common/singleton.h"
#include "graphics/managed_surface.h"
namespace Nancy {
class NancyEngine;
namespace State {
class Credits : public State, public Common::Singleton<Credits> {

View File

@ -23,14 +23,11 @@
#include "engines/nancy/state/help.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/input.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/util.h"
#include "common/stream.h"
namespace Common {
DECLARE_SINGLETON(Nancy::State::Help);
}

View File

@ -23,19 +23,16 @@
#ifndef NANCY_STATE_HELP_H
#define NANCY_STATE_HELP_H
#include "common/singleton.h"
#include "engines/nancy/state/state.h"
#include "engines/nancy/ui/fullscreenimage.h"
#include "engines/nancy/commontypes.h"
#include "common/rect.h"
#include "common/singleton.h"
namespace Nancy {
class NancyEngine;
namespace State {
class Help : public State, public Common::Singleton<Help> {

View File

@ -23,20 +23,9 @@
#include "engines/nancy/state/logo.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/input.h"
#include "common/error.h"
#include "common/system.h"
#include "common/events.h"
#include "common/str.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
#include "graphics/surface.h"
namespace Common {
DECLARE_SINGLETON(Nancy::State::Logo);
}
@ -81,12 +70,12 @@ void Logo::startSound() {
g_nancy->_sound->loadSound(_msnd);
g_nancy->_sound->playSound(_msnd);
_startTicks = g_system->getMillis();
_startTicks = g_nancy->getTotalPlayTime();
_state = kRun;
}
void Logo::run() {
if (g_system->getMillis() - _startTicks >= 7000 || (g_nancy->_input->getInput().input & NancyInput::kLeftMouseButtonDown)) {
if (g_nancy->getTotalPlayTime() - _startTicks >= 7000 || (g_nancy->_input->getInput().input & NancyInput::kLeftMouseButtonDown)) {
_state = kStop;
}
}
@ -98,7 +87,7 @@ void Logo::stop() {
g_nancy->_sound->stopSound(_msnd);
g_nancy->setState(NancyEngine::kScene);
g_nancy->setState(NancyState::kScene);
}
} // End of namespace State

View File

@ -23,20 +23,16 @@
#ifndef NANCY_STATE_LOGO_H
#define NANCY_STATE_LOGO_H
#include "common/singleton.h"
#include "engines/nancy/state/state.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/ui/fullscreenimage.h"
#include "common/singleton.h"
namespace Graphics {
struct Surface;
}
namespace Nancy {
class NancyEngine;
namespace State {
class Logo : public State, public Common::Singleton<Logo> {

View File

@ -24,7 +24,6 @@
#include "engines/nancy/state/scene.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/input.h"
#include "engines/nancy/nancy.h"
@ -32,9 +31,6 @@
#include "engines/nancy/cursor.h"
#include "engines/nancy/graphics.h"
#include "common/stream.h"
#include "common/str.h"
namespace Common {
DECLARE_SINGLETON(Nancy::State::Map);
}
@ -42,6 +38,14 @@ DECLARE_SINGLETON(Nancy::State::Map);
namespace Nancy {
namespace State {
Map::Map() : _state(kInit),
_mapID(0),
_mapButtonClicked(false),
_pickedLocationID(-1),
_viewport(),
_label(NancySceneState.getFrame(), this),
_button(NancySceneState.getFrame(), this) {}
void Map::process() {
switch (_state) {
case kInit:
@ -134,7 +138,7 @@ void Map::run() {
_button.handleInput(input);
if (_mapButtonClicked) {
g_nancy->setState(NancyEngine::kScene);
g_nancy->setState(NancyState::kScene);
return;
}
@ -147,7 +151,7 @@ void Map::run() {
if (input.input & NancyInput::kLeftMouseButtonUp) {
_pickedLocationID = i;
g_nancy->setState(NancyEngine::kScene);
g_nancy->setState(NancyState::kScene);
}
return;
@ -162,7 +166,7 @@ bool Map::onStateExit() {
sound.read(*chunk, SoundDescription::kMenu);
g_nancy->_sound->stopSound(sound);
g_nancy->setState(NancyEngine::kScene);
g_nancy->setState(NancyState::kScene);
if (_pickedLocationID != -1) {
auto &loc = _locations[_pickedLocationID];

View File

@ -23,23 +23,16 @@
#ifndef NANCY_STATE_MAP_H
#define NANCY_STATE_MAP_H
#include "common/array.h"
#include "common/singleton.h"
#include "engines/nancy/state/state.h"
#include "engines/nancy/ui/viewport.h"
#include "engines/nancy/ui/button.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/video.h"
#include "engines/nancy/renderobject.h"
#include "common/str.h"
#include "common/array.h"
#include "common/rect.h"
#include "common/singleton.h"
#include "graphics/surface.h"
namespace Nancy {
class NancyEngine;
@ -51,13 +44,7 @@ class Map : public State, public Common::Singleton<Map> {
friend class MapButton;
public:
enum State { kInit, kRun };
Map() : _state(kInit),
_mapID(0),
_mapButtonClicked(false),
_pickedLocationID(-1),
_viewport(),
_label(NancySceneState.getFrame(), this),
_button(NancySceneState.getFrame(), this) {}
Map();
// State API
virtual void process() override;

View File

@ -22,27 +22,17 @@
#include "engines/nancy/state/scene.h"
#include "common/serializer.h"
#include "common/config-manager.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/iff.h"
#include "engines/nancy/input.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/time.h"
#include "engines/nancy/util.h"
#include "engines/nancy/action/actionmanager.h"
#include "engines/nancy/action/sliderpuzzle.h"
#include "common/memstream.h"
#include "common/rect.h"
#include "common/func.h"
#include "common/serializer.h"
#include "common/config-manager.h"
#include "graphics/surface.h"
namespace Common {
DECLARE_SINGLETON(Nancy::State::Scene);
}
@ -138,7 +128,7 @@ bool Scene::onStateExit() {
_timers.pushedPlayTime = g_nancy->getTotalPlayTime();
_actionManager.onPause(true);
pauseSceneSpecificSounds();
_gameStateRequested = NancyEngine::kNone;
_gameStateRequested = NancyState::kNone;
return false;
}
@ -202,6 +192,10 @@ void Scene::removeItemFromInventory(uint16 id, bool pickUp) {
_inventoryBox.removeItem(id);
}
void Scene::setHeldItem(int16 id) {
_flags.heldItem = id; g_nancy->_cursorManager->setCursorItemID(id);
}
void Scene::setEventFlag(int16 label, NancyFlag flag) {
if (label > -1) {
_flags.eventFlags[label] = flag;
@ -509,7 +503,7 @@ void Scene::run() {
_isComingFromMenu = false;
if (_gameStateRequested != NancyEngine::kNone) {
if (_gameStateRequested != NancyState::kNone) {
g_nancy->setState(_gameStateRequested);
return;
@ -560,7 +554,7 @@ void Scene::run() {
g_nancy->_cursorManager->setCursorType(CursorManager::kHotspotArrow);
if (input.input & NancyInput::kLeftMouseButtonUp) {
requestStateChange(NancyEngine::kMap);
requestStateChange(NancyState::kMap);
}
}
}

View File

@ -23,8 +23,13 @@
#ifndef NANCY_STATE_SCENE_H
#define NANCY_STATE_SCENE_H
#include "common/singleton.h"
#include "engines/nancy/state/state.h"
#include "engines/nancy/time.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/action/actionmanager.h"
#include "engines/nancy/ui/fullscreenimage.h"
@ -33,20 +38,6 @@
#include "engines/nancy/ui/inventorybox.h"
#include "engines/nancy/ui/button.h"
#include "engines/nancy/time.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/sound.h"
#include "common/scummsys.h"
#include "common/array.h"
#include "common/str.h"
#include "common/singleton.h"
namespace Graphics {
struct Surface;
}
namespace Common {
class SeekableReadStream;
class Serializer;
@ -55,6 +46,9 @@ class Serializer;
namespace Nancy {
class NancyEngine;
class NancyConsole;
class CheatDialog;
struct SceneChangeDescription;
namespace Action {
class SliderPuzzle;
@ -110,7 +104,7 @@ public:
Scene() :
_state (kInit),
_lastHint(-1),
_gameStateRequested(NancyEngine::kNone),
_gameStateRequested(NancyState::kNone),
_frame(),
_viewport(),
_textbox(_frame),
@ -136,7 +130,7 @@ public:
void addItemToInventory(uint16 id);
void removeItemFromInventory(uint16 id, bool pickUp = true);
int16 getHeldItem() const { return _flags.heldItem; }
void setHeldItem(int16 id) { _flags.heldItem = id; g_nancy->_cursorManager->setCursorItemID(id); }
void setHeldItem(int16 id);
NancyFlag hasItem(int16 id) const { return _flags.items[id]; }
void setEventFlag(int16 label, NancyFlag flag = kTrue);
@ -154,7 +148,7 @@ public:
byte getHintsRemaining() const { return _hintsRemaining[_difficulty]; }
void useHint(int hintID, int hintWeight);
void requestStateChange(NancyEngine::GameState state) { _gameStateRequested = state; }
void requestStateChange(NancyState::NancyState state) { _gameStateRequested = state; }
void resetStateToInit() { _state = kInit; }
void resetAndStartTimer() { _timers.timerIsActive = true; _timers.timerTime = 0; }
@ -251,7 +245,7 @@ private:
uint16 _difficulty;
Common::Array<uint16> _hintsRemaining;
int16 _lastHint;
NancyEngine::GameState _gameStateRequested;
NancyState::NancyState _gameStateRequested;
Common::Rect _mapHotspot;
Common::Array<uint16> _mapAccessSceneIDs;

View File

@ -23,8 +23,6 @@
#ifndef NANCY_STATE_STATE_H
#define NANCY_STATE_STATE_H
#include "common/types.h"
namespace Nancy {
namespace State {

View File

@ -22,14 +22,14 @@
#include "engines/nancy/ui/button.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/input.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/util.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/state/scene.h"
#include "common/stream.h"
#include "engines/nancy/sound.h"
namespace Nancy {
namespace UI {
@ -59,7 +59,7 @@ void MenuButton::init() {
}
void MenuButton::onClick() {
NancySceneState.requestStateChange(NancyEngine::kMainMenu);
NancySceneState.requestStateChange(NancyState::kMainMenu);
g_nancy->_sound->playSound(0x18);
setVisible(true);
}
@ -79,7 +79,7 @@ void HelpButton::init() {
}
void HelpButton::onClick() {
NancySceneState.requestStateChange(NancyEngine::kHelp);
NancySceneState.requestStateChange(NancyState::kHelp);
g_nancy->_sound->playSound(0x18);
setVisible(true);
}

View File

@ -24,7 +24,6 @@
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/graphics.h"
namespace Nancy {
namespace UI {

View File

@ -22,16 +22,16 @@
#include "engines/nancy/ui/inventorybox.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/resource.h"
#include "engines/nancy/util.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/sound.h"
#include "engines/nancy/input.h"
#include "common/events.h"
namespace Nancy {
namespace UI {

View File

@ -23,14 +23,12 @@
#ifndef NANCY_UI_INVENTORYBOX_H
#define NANCY_UI_INVENTORYBOX_H
#include "engines/nancy/renderobject.h"
#include "engines/nancy/ui/scrollbar.h"
#include "engines/nancy/time.h"
#include "common/array.h"
#include "common/str.h"
#include "common/rect.h"
#include "engines/nancy/time.h"
#include "engines/nancy/ui/scrollbar.h"
namespace Nancy {

View File

@ -22,15 +22,12 @@
#include "engines/nancy/ui/scrollbar.h"
#include "common/stream.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/commontypes.h"
#include "engines/nancy/input.h"
#include "engines/nancy/cursor.h"
#include "common/stream.h"
#include "common/random.h"
#include "common/events.h"
namespace Nancy {
namespace UI {

View File

@ -25,8 +25,6 @@
#include "engines/nancy/renderobject.h"
#include "common/rect.h"
namespace Nancy {
struct NancyInput;

View File

@ -22,19 +22,16 @@
#include "engines/nancy/ui/textbox.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/resource.h"
#include "common/util.h"
#include "engines/nancy/state/scene.h"
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/util.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/input.h"
#include "common/error.h"
#include "common/util.h"
#include "common/events.h"
#include "common/util.h"
namespace Nancy {
namespace UI {

View File

@ -23,14 +23,10 @@
#ifndef NANCY_UI_TEXTBOX_H
#define NANCY_UI_TEXTBOX_H
#include "engines/nancy/renderobject.h"
#include "engines/nancy/ui/scrollbar.h"
#include "common/str.h"
#include "common/array.h"
#include "graphics/managed_surface.h"
#include "engines/nancy/ui/scrollbar.h"
namespace Nancy {

View File

@ -28,8 +28,7 @@
#include "engines/nancy/graphics.h"
#include "engines/nancy/cursor.h"
#include "engines/nancy/util.h"
#include "graphics/transparent_surface.h"
#include "engines/nancy/input.h"
namespace Nancy {
namespace UI {

View File

@ -28,8 +28,9 @@
#include "engines/nancy/video.h"
#include "engines/nancy/time.h"
#include "common/str.h"
#include "common/rect.h"
namespace Common {
class String;
}
namespace Nancy {

View File

@ -21,20 +21,13 @@
*/
#include "engines/nancy/video.h"
#include "engines/nancy/decompress.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/nancy.h"
#include "common/endian.h"
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "common/debug.h"
#include "common/memstream.h"
#include "common/substream.h"
#include "graphics/surface.h"
#include "engines/nancy/decompress.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/nancy.h"
namespace Nancy {

View File

@ -23,9 +23,7 @@
#ifndef NANCY_VIDEO_H
#define NANCY_VIDEO_H
#include "graphics/pixelformat.h"
#include "video/video_decoder.h"
#include "common/rational.h"
namespace Common {
class ReadStream;