/* 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 .
*
*/
#ifndef TWP_H
#define TWP_H
#include "common/random.h"
#include "common/ptr.h"
#include "engines/engine.h"
#include "twp/actorswitcher.h"
#include "twp/squirrel/squirrel.h"
#define SCREEN_MARGIN 100.f
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
#define VERBDEFAULT "verbDefault"
template >
using unique_ptr = Common::ScopedPtr;
namespace Graphics {
class Screen;
}
struct ADGameDescription;
namespace Twp {
struct ActorSlot;
class AudioSystem;
class Callback;
class Camera;
class Cutscene;
class Dialog;
class FadeShader;
class GGPackSet;
class Hud;
class TwpImGui;
class InputState;
struct Light;
class Lighting;
class LightingNode;
class Motor;
class NoOverrideNode;
class Object;
class PathNode;
class ResManager;
class Room;
class SaveGameManager;
struct Scaling;
class Scene;
struct ShaderParams;
class Task;
class TextDb;
class ThreadBase;
struct TwpGameDescription;
struct Verb;
struct VerbId;
class Vm;
class WalkboxNode;
enum class FadeEffect;
enum class RoomEffect;
enum class UseFlag;
class TwpEngine : public Engine {
private:
const TwpGameDescription *_gameDescription;
Common::RandomSource _randomSource;
protected:
// Engine APIs
Common::Error run() override;
public:
TwpEngine(OSystem *syst, const TwpGameDescription *gameDesc);
~TwpEngine() override;
uint32 getFeatures() const;
/**
* Returns the game Id
*/
Common::String getGameId() const;
/**
* Gets the random source
*/
Common::RandomSource &getRandomSource() { return _randomSource; }
HSQUIRRELVM getVm();
inline Gfx &getGfx() { return _gfx; }
inline TextDb &getTextDb() { return *_textDb; }
bool hasFeature(EngineFeature f) const override {
return (f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime) ||
(f == kSupportsReturnToLauncher) ||
(f == kSupportsChangingOptionsDuringRuntime);
}
void updateSettingVars();
bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
return !_cutscene;
}
bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
Common::Error loadGameState(int slot) override;
Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
bool canSaveAutosaveCurrently() override { return false; }
void capture(Graphics::Surface &surface, int width, int height);
Math::Vector2d winToScreen(const Math::Vector2d &pos) const;
Math::Vector2d screenToWin(const Math::Vector2d &pos) const;
Math::Vector2d roomToScreen(const Math::Vector2d &pos) const;
Math::Vector2d screenToRoom(const Math::Vector2d &pos) const;
void setActor(Common::SharedPtr