ScummVM API documentation
Ultima::Ultima2::Ultima2Engine Class Reference
Inheritance diagram for Ultima::Ultima2::Ultima2Engine:
Engine Ultima::Shared::Events Graphics::Views::Events Graphics::Views::UIElement

Public Member Functions

 Ultima2Engine (OSystem *syst, const Ultima::UltimaGameDescription *gameDesc)
 
uint32 getFeatures () const
 
Graphics::Font * createFont () const override
 
bool isEnhanced () const
 
Common::String getGameId () const
 
bool hasFeature (EngineFeature f) const override
 
bool canSaveGameStateCurrently (Common::U32String *msg=nullptr) override
 
bool canLoadGameStateCurrently (Common::U32String *msg=nullptr) override
 
Common::Error syncGame (Common::Serializer &s)
 
Common::Error saveGameStream (Common::WriteStream *stream, bool=false) override
 
Common::Error loadGameStream (Common::SeekableReadStream *stream) override
 
bool savegamesExist () const
 
byte randByte ()
 
void playFX (Data::SoundEffect fx)
 
Data::RenderMode getRenderMode () const
 
void setRenderMode (Data::RenderMode mode)
 
void applyGameSettings () override
 
void pauseMillis (uint32 millis)
 
- Public Member Functions inherited from Engine
virtual void showHotspots (bool show)
 
void suspendHotspots ()
 
bool isShowingHotspots () const
 
virtual HotspotKeyMode hotspotsKeyMode () const
 
HotspotKeyMode effectiveHotspotKeyMode () const
 
MetaEngine * getMetaEngine () const
 
void setMetaEngine (MetaEngine *metaEngine)
 
PauseToken pauseEngine ()
 
bool isPaused () const
 
void openMainMenuDialog ()
 
uint32 getTotalPlayTime () const
 
void setTotalPlayTime (uint32 time=0)
 
Common::TimerManager * getTimerManager ()
 
Common::EventManager * getEventManager ()
 
Common::SaveFileManager * getSaveFileManager ()
 
bool existExtractedCDAudioFiles (uint track=1)
 
bool isDataAndCDAudioReadFromSameCD ()
 
void warnMissingExtractedCDAudio ()
 
void handleAutoSave ()
 
void saveAutosaveIfEnabled ()
 
virtual bool canSaveAutosaveCurrently ()
 
virtual int getAutosaveSlot () const
 
virtual bool gameTypeHasAddOns () const
 
virtual bool dirCanBeGameAddOn (const Common::FSDirectory &dir) const
 
virtual bool dirMustBeGameAddOn (const Common::FSDirectory &dir) const
 
Common::ErrorCode updateAddOns (const MetaEngine *metaEngine) const
 
 Engine (OSystem *syst)
 
virtual ~Engine ()
 
virtual void initializePath (const Common::FSNode &gamePath)
 
virtual void errorString (const char *buf_input, char *buf_output, int buf_output_size)
 
virtual GUI::Debugger * getDebugger () final
 
void setDebugger (GUI::Debugger *debugger)
 
GUI::Debugger * getOrCreateDebugger ()
 
bool enhancementEnabled (int32 cls) const
 
virtual void syncSoundSettings ()
 
virtual void flipMute ()
 
virtual Common::String getSaveStateName (int slot) const
 
virtual Common::Error loadGameState (int slot)
 
void setGameToLoadSlot (int slot)
 
virtual Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false)
 
bool saveGameDialog ()
 
bool loadGameDialog ()
 
- Public Member Functions inherited from Ultima::Shared::Events
 Events (const Common::String &engineName)
 
- Public Member Functions inherited from Graphics::Views::Events
 Events (const Common::String &engineName, uint frameRate=20)
 
uint getFrameRate () const
 
void runGame ()
 
bool pumpEvents ()
 
int getRandomNumber (int minNumber, int maxNumber)
 
int getRandomNumber (int maxNumber)
 
void replaceView (UIElement *ui, bool replaceAllViews=false) override
 
void replaceView (const Common::String &name, bool replaceAllViews=false) override
 
void addView (UIElement *ui) override
 
void addView (const Common::String &name) override
 
void clearViews ()
 
void popView ()
 
UIElement * focusedView () const
 
UIElement * priorView () const
 
UIElement * baseView () const
 
bool isPresent (const Common::String &name) const
 
Graphics::Screen * getScreen () const
 
void drawElements () override
 
void draw () override
 
bool tick () override
 
void close () override
 
void updateScreen ()
 
virtual Graphics::Font * createFont () const
 
- Public Member Functions inherited from Graphics::Views::UIElement
 UIElement (const Common::String &name, UIElement *uiParent)
 
 UIElement (const Common::String &name)
 
bool needsRedraw () const
 
void redraw ()
 
virtual void close ()
 
virtual void replaceView (UIElement *ui, bool replaceAllViews=false)
 
virtual void replaceView (const Common::String &name, bool replaceAllViews=false)
 
virtual void addView (UIElement *ui)
 
virtual void addView (const Common::String &name)
 
void addView ()
 
void open ()
 
int getRandomNumber (int minNumber, int maxNumber)
 
int getRandomNumber (int maxNumber)
 
virtual void setBounds (const Common::Rect &r)
 
Common::Rect getBounds () const
 
const Common::String & getName () const
 
GfxSurface getSurface (bool innerBounds=false) const
 
virtual void draw ()
 
virtual bool tick ()
 
virtual UIElement * findView (const Common::String &name)
 
bool send (const MouseMoveMessage &msg)
 
bool send (const Common::String &viewName, const FocusMessage &msg)
 
bool send (const FocusMessage &msg)
 
bool send (const Common::String &viewName, const UnfocusMessage &msg)
 
bool send (const UnfocusMessage &msg)
 
bool send (const Common::String &viewName, const MouseEnterMessage &msg)
 
bool send (const MouseEnterMessage &msg)
 
bool send (const Common::String &viewName, const MouseLeaveMessage &msg)
 
bool send (const MouseLeaveMessage &msg)
 
bool send (const Common::String &viewName, const KeypressMessage &msg)
 
bool send (const KeypressMessage &msg)
 
bool send (const Common::String &viewName, const MouseDownMessage &msg)
 
bool send (const MouseDownMessage &msg)
 
bool send (const Common::String &viewName, const MouseUpMessage &msg)
 
bool send (const MouseUpMessage &msg)
 
bool send (const Common::String &viewName, const ActionMessage &msg)
 
bool send (const ActionMessage &msg)
 
bool send (const Common::String &viewName, const GameMessage &msg)
 
bool send (const GameMessage &msg)
 
bool send (const Common::String &viewName, const ValueMessage &msg)
 
bool send (const ValueMessage &msg)
 
template<class T >
bool send (const T &msg)
 
template<class T >
bool send (const Common::String &viewName, const T &msg)
 

Public Attributes

Data::Savegame _savegame
 
Data::Map _map
 
Data::MapDungeon _dungeon
 
Common::SharedPtr< Logic::Logic > _logic
 
bool _statBoostChoice = false
 
bool _mixedCaseText = false
 
bool _lessHunger = false
 
bool _intangible = false
 
- Public Attributes inherited from Engine
OSystem * _system
 
Audio::Mixer * _mixer
 

Protected Member Functions

Common::Error run () override
 
bool shouldQuit () const override
 
void returnToMainMenu () override
 
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
void defaultSyncSoundSettings ()
 
virtual void pauseEngineIntern (bool pause)
 
virtual void getHotspotPositions (Common::Array< Graphics::HotspotInfo > &hotspots)
 
virtual void drawHotspots ()
 
virtual Graphics::HotspotRenderer * createHotspotRenderer ()
 
virtual bool hideCursorForHotspots () const
 
virtual bool hotspotDirty () const
 
- Protected Member Functions inherited from Ultima::Shared::Events
bool msgAction (const Graphics::Views::ActionMessage &msg) override
 
virtual void returnToMainMenu ()
 
- Protected Member Functions inherited from Graphics::Views::Events
virtual bool shouldQuit () const =0
 
bool msgAction (const ActionMessage &e) override
 
bool msgFocus (const FocusMessage &e) override
 
bool msgUnfocus (const UnfocusMessage &e) override
 
bool msgMouseEnter (const MouseEnterMessage &e) override
 
bool msgMouseLeave (const MouseLeaveMessage &e) override
 
bool msgKeypress (const KeypressMessage &e) override
 
bool msgMouseDown (const MouseDownMessage &e) override
 
bool msgMouseUp (const MouseUpMessage &e) override
 
bool msgMouseMove (const MouseMoveMessage &e) override
 
bool msgCustom (const Message &msg) override
 
- Protected Member Functions inherited from Graphics::Views::UIElement
void delaySeconds (uint seconds)
 
void delayFrames (uint frames)
 
bool isDelayActive () const
 
void cancelDelay ()
 
virtual void timeout ()
 
virtual bool msgMouseMove (const MouseMoveMessage &msg)
 
void stopTextToSpeech ()
 
virtual bool msgFocus (const FocusMessage &e)
 
virtual bool msgUnfocus (const UnfocusMessage &e)
 
virtual bool msgMouseEnter (const MouseEnterMessage &e)
 
virtual bool msgMouseLeave (const MouseLeaveMessage &e)
 
virtual bool msgKeypress (const KeypressMessage &e)
 
virtual bool msgMouseDown (const MouseDownMessage &e)
 
virtual bool msgMouseUp (const MouseUpMessage &e)
 
virtual bool msgAction (const ActionMessage &e)
 
virtual bool msgGame (const GameMessage &e)
 
virtual bool msgValue (const ValueMessage &e)
 
virtual bool msgCustom (const Message &msg)
 

Additional Inherited Members

- Public Types inherited from Engine
enum  EngineFeature {
  kSupportsSubtitleOptions , kSupportsReturnToLauncher , kSupportsLoadingDuringRuntime , kSupportsSavingDuringRuntime ,
  kSupportsChangingOptionsDuringRuntime , kSupportsArbitraryResolutions , kSupportsHelp , kSupportsQuitDialogOverride
}
 
- Static Public Member Functions inherited from Engine
static void quitGame ()
 
static bool shouldQuit ()
 
static bool warnUserAboutUnsupportedGame (Common::String msg=Common::String())
 
static bool warnUserAboutUnsupportedAddOn (Common::String addOnName)
 
static void warnUserAboutTestingMode ()
 
static void errorAddingAddOnWithoutBaseGame (Common::String addOnName, Common::String gameId)
 
static void errorUnsupportedGame (Common::String extraMsg)
 
- Protected Attributes inherited from Engine
Common::TimerManager * _timer
 
Common::EventManager * _eventMan
 
Common::SaveFileManager * _saveFileMan
 
GUI::Dialog * _mainMenuDialog
 
const Common::String _targetName
 
int32 _activeEnhancements = kEnhGameBreakingBugFixes
 
bool _showHotspots
 
bool _hotspotForceRedraw
 
bool _hotspotPrevCursorVisible
 
bool _hotspotCursorHidden = false
 
Graphics::HotspotRenderer * _hotspotRenderer = nullptr
 
Common::Array< Graphics::HotspotInfo > _hotspotScratch
 
bool _hotspotShowText = true
 
int _hotspotMarker = 0
 
- Protected Attributes inherited from Graphics::Views::UIElement
UIElement * _parent
 
Common::Array< UIElement * > _children
 
Common::Rect _innerBounds
 
Bounds _bounds
 
bool _needsRedraw = true
 
Common::String _name
 
Common::String _previousSaid
 

Member Function Documentation

◆ run()

Common::Error Ultima::Ultima2::Ultima2Engine::run ( )
overrideprotectedvirtual

Initialize the engine and start its main loop.

Returns
kNoError on success, otherwise an error code.

Implements Engine.

◆ shouldQuit()

bool Ultima::Ultima2::Ultima2Engine::shouldQuit ( ) const
inlineoverrideprotectedvirtual

Returns true if the game should quit

Implements Graphics::Views::Events.

◆ returnToMainMenu()

void Ultima::Ultima2::Ultima2Engine::returnToMainMenu ( )
overrideprotectedvirtual

Goes back to the title screen

Reimplemented from Ultima::Shared::Events.

◆ createFont()

Graphics::Font * Ultima::Ultima2::Ultima2Engine::createFont ( ) const
overridevirtual

Returns the font the game's text is drawn with

Reimplemented from Graphics::Views::Events.

◆ isEnhanced()

bool Ultima::Ultima2::Ultima2Engine::isEnhanced ( ) const

Returns true for the version with the Ultima II Upgrade applied

◆ getGameId()

Common::String Ultima::Ultima2::Ultima2Engine::getGameId ( ) const

Returns the game Id

◆ hasFeature()

bool Ultima::Ultima2::Ultima2Engine::hasFeature ( EngineFeature  f) const
inlineoverridevirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

◆ canSaveGameStateCurrently()

bool Ultima::Ultima2::Ultima2Engine::canSaveGameStateCurrently ( Common::U32String *  msg = nullptr)
overridevirtual

Indicate whether a game state can be saved.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ canLoadGameStateCurrently()

bool Ultima::Ultima2::Ultima2Engine::canLoadGameStateCurrently ( Common::U32String *  msg = nullptr)
overridevirtual

Indicate whether a game state can be loaded.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ syncGame()

Common::Error Ultima::Ultima2::Ultima2Engine::syncGame ( Common::Serializer &  s)

Uses a serializer to allow implementing savegame loading and saving using a single method

◆ saveGameStream()

Common::Error Ultima::Ultima2::Ultima2Engine::saveGameStream ( Common::WriteStream *  stream,
bool  isAutosave = false 
)
inlineoverridevirtual

Save a game state.

Parameters
streamThe write stream to save the savegame data to.
isAutosaveExpected to be true if an autosave is being created.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.

◆ loadGameStream()

Common::Error Ultima::Ultima2::Ultima2Engine::loadGameStream ( Common::SeekableReadStream *  stream)
inlineoverridevirtual

Load a game state.

Parameters
streamThe stream to load the save state from.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.

◆ savegamesExist()

bool Ultima::Ultima2::Ultima2Engine::savegamesExist ( ) const

Returns true if any savegames exist

◆ randByte()

byte Ultima::Ultima2::Ultima2Engine::randByte ( )

Returns the next byte from the game's random number generator

◆ playFX()

void Ultima::Ultima2::Ultima2Engine::playFX ( Data::SoundEffect  fx)

Plays a short PC speaker sound effect. Ultima II has no numbered sound-effect table of its own - each original sound is its own hardcoded tone sweep, reproduced here as a short note sequence

◆ getRenderMode()

Data::RenderMode Ultima::Ultima2::Ultima2Engine::getRenderMode ( ) const
inline

Returns the currently selected renderer (CGA or one of the "Ultima II Upgrade" patch's EGA-family modes)

◆ setRenderMode()

void Ultima::Ultima2::Ultima2Engine::setRenderMode ( Data::RenderMode  mode)

Changes the active renderer, persisting the choice to ConfMan and refreshing the palette immediately. Map views pick up the new tile data themselves next time they're (re)constructed

◆ applyGameSettings()

void Ultima::Ultima2::Ultima2Engine::applyGameSettings ( )
overridevirtual

Called when the in-game options dialog may have changed settings, such as the graphics mode

Reimplemented from Engine.

◆ pauseMillis()

void Ultima::Ultima2::Ultima2Engine::pauseMillis ( uint32  millis)

Pause for a given number of milliseconds


The documentation for this class was generated from the following file: