ScummVM API documentation
Touche::ToucheEngine Class Reference
Inheritance diagram for Touche::ToucheEngine:
Engine

Public Types

enum  {
  NUM_FLAGS = 2000, NUM_KEYCHARS = 32, NUM_SPRITES = 7, NUM_SEQUENCES = 7,
  NUM_CONVERSATION_CHOICES = 40, NUM_TALK_ENTRIES = 16, NUM_ANIMATION_ENTRIES = 4, NUM_INVENTORY_ITEMS = 100,
  NUM_DIRTY_RECTS = 30, NUM_DIRECTIONS = 135
}
 
typedef void(ToucheEngine::* OpcodeProc) ()
 
- Public Types inherited from Engine
enum  EngineFeature {
  kSupportsSubtitleOptions, kSupportsReturnToLauncher, kSupportsLoadingDuringRuntime, kSupportsSavingDuringRuntime,
  kSupportsChangingOptionsDuringRuntime, kSupportsArbitraryResolutions, kSupportsHelp, kSupportsQuitDialogOverride
}
 

Public Member Functions

 ToucheEngine (OSystem *system, Common::Language language)
 
Common::Error run () override
 
bool hasFeature (EngineFeature f) const override
 
void syncSoundSettings () override
 
void startMusic (int num)
 
void stopMusic ()
 
- Public Member Functions inherited from Engine
MetaEnginegetMetaEngine () const
 
void setMetaEngine (MetaEngine *metaEngine)
 
PauseToken pauseEngine ()
 
bool isPaused () const
 
void openMainMenuDialog ()
 
uint32 getTotalPlayTime () const
 
void setTotalPlayTime (uint32 time=0)
 
Common::TimerManagergetTimerManager ()
 
Common::EventManagergetEventManager ()
 
Common::SaveFileManagergetSaveFileManager ()
 
bool existExtractedCDAudioFiles (uint track=1)
 
bool isDataAndCDAudioReadFromSameCD ()
 
void warnMissingExtractedCDAudio ()
 
void handleAutoSave ()
 
void saveAutosaveIfEnabled ()
 
virtual bool canSaveAutosaveCurrently ()
 
virtual int getAutosaveSlot () 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::DebuggergetDebugger () final
 
void setDebugger (GUI::Debugger *debugger)
 
GUI::DebuggergetOrCreateDebugger ()
 
bool enhancementEnabled (int32 cls)
 
virtual void applyGameSettings ()
 
virtual void flipMute ()
 
virtual Common::Error loadGameStream (Common::SeekableReadStream *stream)
 
void setGameToLoadSlot (int slot)
 
virtual Common::Error saveGameStream (Common::WriteStream *stream, bool isAutosave=false)
 
bool saveGameDialog ()
 
bool loadGameDialog ()
 

Protected Member Functions

void restart ()
 
void readConfigurationSettings ()
 
void writeConfigurationSettings ()
 
void mainLoop ()
 
void processEvents (bool handleKeyEvents=true)
 
void runCycle ()
 
int16 getRandomNumber (int max)
 
void changePaletteRange ()
 
void playSoundInRange ()
 
void resetSortedKeyCharsTable ()
 
void setupEpisode (int num)
 
void setupNewEpisode ()
 
void drawKeyChar (KeyChar *key)
 
void sortKeyChars ()
 
void runKeyCharScript (KeyChar *key)
 
void runCurrentKeyCharScript (int mode)
 
void executeScriptOpcode (int16 param)
 
void initKeyChars (int keyChar)
 
void setKeyCharTextColor (int keyChar, uint16 color)
 
void waitForKeyCharPosition (int keyChar)
 
void setKeyCharBox (int keyChar, int value)
 
void setKeyCharFrame (int keyChar, int16 type, int16 value1, int16 value2)
 
void setKeyCharFacingDirection (int keyChar, int16 dir)
 
void initKeyCharScript (int keyChar, int16 spriteNum, int16 seqDataIndex, int16 seqDataOffs)
 
uint16 findProgramKeyCharScriptOffset (int keyChar) const
 
bool scrollRoom (int keyChar)
 
void drawIcon (int x, int y, int num)
 
void centerScreenToKeyChar (int keyChar)
 
void waitForKeyCharsSet ()
 
void redrawRoom ()
 
void fadePalette (int firstColor, int colorCount, int scale, int scaleInc, int fadingStepsCount)
 
void fadePaletteFromFlags ()
 
void moveKeyChar (uint8 *dst, int dstPitch, KeyChar *key)
 
void changeKeyCharFrame (KeyChar *key, int keyChar)
 
void setKeyCharRandomFrame (KeyChar *key)
 
void setKeyCharMoney ()
 
const char * getString (int num) const
 
int getStringWidth (int num) const
 
void drawString (uint16 color, int x, int y, int16 num, StringType strType=kStringTypeDefault)
 
void drawGameString (uint16 color, int x1, int y, const char *str)
 
int restartKeyCharScriptOnAction (int action, int obj1, int obj2)
 
void buildSpriteScalingTable (int z1, int z2)
 
void drawSpriteOnBackdrop (int num, int x, int y)
 
void updateTalkFrames (int keyChar)
 
void setKeyCharTalkingFrame (int keyChar)
 
void lockUnlockHitBox (int num, int lock)
 
void drawHitBoxes ()
 
void showCursor (bool show)
 
void setCursor (int num)
 
void setDefaultCursor (int num)
 
void handleLeftMouseButtonClickOnInventory ()
 
void handleRightMouseButtonClickOnInventory ()
 
void handleMouseInput (int flag)
 
void handleMouseClickOnRoom (int flag)
 
void handleMouseClickOnInventory (int flag)
 
void scrollScreenToPos (int num)
 
void clearRoomArea ()
 
void startNewMusic ()
 
void startNewSound ()
 
void updateSpeech ()
 
int handleActionMenuUnderCursor (const int16 *actions, int offs, int y, int str)
 
void redrawBackground ()
 
void addRoomArea (int num, int flag)
 
void updateRoomAreas (int num, int flags)
 
void setRoomAreaState (int num, uint16 state)
 
void findAndRedrawRoomRegion (int num)
 
void updateRoomRegions ()
 
void redrawRoomRegion (int num, bool markForRedraw)
 
void initInventoryObjectsTable ()
 
void initInventoryLists ()
 
void setupInventoryAreas ()
 
void drawInventory (int index, int flag)
 
void drawAmountOfMoneyInInventory ()
 
void packInventoryItems (int index)
 
void appendItemToInventoryList (int index)
 
void addItemToInventory (int inventory, int16 item)
 
void removeItemFromInventory (int inventory, int16 item)
 
void resetTalkingVars ()
 
int updateKeyCharTalk (int pauseFlag)
 
const char * formatTalkText (int *y, int *h, const char *text)
 
void addToTalkTable (int talkingKeyChar, int num, int otherKeyChar)
 
void removeFromTalkTable (int keyChar)
 
void addConversationChoice (int16 num)
 
void removeConversationChoice (int16 num)
 
void runConversationScript (uint16 offset)
 
void findConversationByNum (int16 num)
 
void clearConversationChoices ()
 
void scrollDownConversationChoice ()
 
void scrollUpConversationChoice ()
 
void drawCharacterConversation ()
 
void drawConversationString (int num, uint16 color)
 
void clearConversationArea ()
 
void setupConversationScript (int num)
 
void handleConversation ()
 
void buildWalkPointsList (int keyChar)
 
int findWalkDataNum (int pointNum1, int pointNum2)
 
void changeWalkPath (int num1, int num2, int16 val)
 
void adjustKeyCharPosToWalkBox (KeyChar *key, int moveType)
 
void lockWalkPath (int num1, int num2)
 
void unlockWalkPath (int num1, int num2)
 
void resetPointsData (int num)
 
bool sortPointsData (int num1, int num2)
 
void updateKeyCharWalkPath (KeyChar *key, int16 dx, int16 dy, int16 dz)
 
void markWalkPoints (int keyChar)
 
void buildWalkPath (int dstPosX, int dstPosY, int keyChar)
 
void addToAnimationTable (int num, int posNum, int keyChar, int delayCounter)
 
void copyAnimationImage (int dstX, int dstY, int w, int h, const uint8 *src, int srcX, int srcY, int fillColor)
 
void drawAnimationImage (AnimationEntry *anim)
 
void processAnimationTable ()
 
void clearAnimationTable ()
 
void addToDirtyRect (const Common::Rect &r)
 
void clearDirtyRects ()
 
void setPalette (int firstColor, int colorCount, int redScale, int greenScale, int blueScale)
 
void updateScreenArea (int x, int y, int w, int h)
 
void updateEntireScreen ()
 
void updateDirtyScreenAreas ()
 
void updatePalette ()
 
void saveGameStateData (Common::WriteStream *stream)
 
void loadGameStateData (Common::ReadStream *stream)
 
Common::Error saveGameState (int num, const Common::String &description, bool isAutosave=false) override
 
Common::Error loadGameState (int num) override
 
bool canLoadGameStateCurrently (Common::U32String *msg=nullptr) override
 
bool canSaveGameStateCurrently (Common::U32String *msg=nullptr) override
 
Common::String getSaveStateName (int slot) const override
 
void setupOpcodes ()
 
void op_nop ()
 
void op_jnz ()
 
void op_jz ()
 
void op_jmp ()
 
void op_true ()
 
void op_false ()
 
void op_push ()
 
void op_not ()
 
void op_add ()
 
void op_sub ()
 
void op_mul ()
 
void op_div ()
 
void op_mod ()
 
void op_and ()
 
void op_or ()
 
void op_neg ()
 
void op_testGreater ()
 
void op_testEquals ()
 
void op_testLower ()
 
void op_fetchScriptWord ()
 
void op_testGreaterOrEquals ()
 
void op_testLowerOrEquals ()
 
void op_testNotEquals ()
 
void op_endConversation ()
 
void op_stopScript ()
 
void op_getFlag ()
 
void op_setFlag ()
 
void op_fetchScriptByte ()
 
void op_getKeyCharWalkBox ()
 
void op_startSound ()
 
void op_moveKeyCharToPos ()
 
void op_loadRoom ()
 
void op_updateRoom ()
 
void op_startTalk ()
 
void op_loadSprite ()
 
void op_loadSequence ()
 
void op_setKeyCharBox ()
 
void op_initKeyCharScript ()
 
void op_setKeyCharFrame ()
 
void op_setKeyCharDirection ()
 
void op_clearConversationChoices ()
 
void op_addConversationChoice ()
 
void op_removeConversationChoice ()
 
void op_getInventoryItem ()
 
void op_setInventoryItem ()
 
void op_startEpisode ()
 
void op_setConversationNum ()
 
void op_enableInput ()
 
void op_disableInput ()
 
void op_faceKeyChar ()
 
void op_getKeyCharCurrentAnim ()
 
void op_getCurrentKeyChar ()
 
void op_isKeyCharActive ()
 
void op_setPalette ()
 
void op_changeWalkPath ()
 
void op_lockWalkPath ()
 
void op_initializeKeyChar ()
 
void op_setupWaitingKeyChars ()
 
void op_updateRoomAreas ()
 
void op_unlockWalkPath ()
 
void op_addItemToInventoryAndRedraw ()
 
void op_giveItemTo ()
 
void op_setHitBoxText ()
 
void op_fadePalette ()
 
void op_getInventoryItemFlags ()
 
void op_drawInventory ()
 
void op_stopKeyCharScript ()
 
void op_restartKeyCharScript ()
 
void op_getKeyCharCurrentWalkBox ()
 
void op_getKeyCharPointsDataNum ()
 
void op_setupFollowingKeyChar ()
 
void op_startAnimation ()
 
void op_setKeyCharTextColor ()
 
void op_startMusic ()
 
void op_sleep ()
 
void op_setKeyCharDelay ()
 
void op_lockHitBox ()
 
void op_removeItemFromInventory ()
 
void op_unlockHitBox ()
 
void op_addRoomArea ()
 
void op_setKeyCharFlags ()
 
void op_unsetKeyCharFlags ()
 
void op_loadSpeechSegment ()
 
void op_drawSpriteOnBackdrop ()
 
void op_startPaletteFadeIn ()
 
void op_startPaletteFadeOut ()
 
void op_setRoomAreaState ()
 
void res_openDataFile ()
 
void res_closeDataFile ()
 
void res_allocateTables ()
 
void res_deallocateTables ()
 
uint32 res_getDataOffset (ResourceType type, int num, uint32 *size=NULL)
 
void res_loadSpriteImage (int num, uint8 *dst)
 
void res_loadProgram (int num)
 
void res_decodeProgramData ()
 
void res_loadRoom (int num)
 
void res_loadSprite (int num, int index)
 
void res_loadSequence (int num, int index)
 
void res_decodeScanLineImageRLE (uint8 *dst, int lineWidth)
 
void res_loadBackdrop ()
 
void res_loadImage (int num, uint8 *dst)
 
void res_loadImageHelper (uint8 *imgData, int imgWidth, int imgHeight)
 
void res_loadSound (int flag, int num)
 
void res_stopSound ()
 
void res_loadMusic (int num)
 
void res_loadSpeech (int num)
 
void res_loadSpeechSegment (int num)
 
void res_stopSpeech ()
 
void drawButton (Button *button)
 
void redrawMenu (MenuData *menu)
 
void handleMenuAction (MenuData *menu, int actionId)
 
void handleOptions (int forceDisplay)
 
void drawActionsPanel (int dstX, int dstY, int deltaX, int deltaY)
 
void drawConversationPanelBorder (int dstY, int srcX, int srcY)
 
void drawConversationPanel ()
 
void printStatusString (const char *str)
 
void clearStatusString ()
 
int displayQuitDialog ()
 
void displayTextMode (int str)
 
Common::Point getMousePos () const
 
void initMusic ()
 
int getMusicVolume ()
 
void setMusicVolume (int volume)
 
void adjustMusicVolume (int diff)
 
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
void defaultSyncSoundSettings ()
 
virtual void pauseEngineIntern (bool pause)
 

Protected Attributes

MidiPlayer_midiPlayer
 
int _musicVolume
 
Audio::SoundHandle _musicHandle
 
Common::Language _language
 
Common::RandomSource _rnd
 
bool _inp_leftMouseButtonPressed
 
bool _inp_rightMouseButtonPressed
 
int _disabledInputCounter
 
bool _hideInventoryTexts
 
GameState _gameState
 
bool _displayQuitDialog
 
int _saveLoadCurrentPage
 
int _saveLoadCurrentSlot
 
int _newMusicNum
 
int _currentMusicNum
 
int _newSoundNum
 
int _newSoundDelay
 
int _newSoundPriority
 
int _playSoundCounter
 
bool _speechPlaying
 
Audio::SoundHandle _sfxHandle
 
Audio::SoundHandle _speechHandle
 
int16 _inventoryList1 [101]
 
int16 _inventoryList2 [101]
 
int16 _inventoryList3 [7]
 
InventoryState _inventoryStateTable [3]
 
int16 _inventoryItemsInfoTable [NUM_INVENTORY_ITEMS]
 
int16 * _inventoryVar1
 
int16 * _inventoryVar2
 
int _currentCursorObject
 
Common::Rect _inventoryAreasTable [13]
 
int _talkTextMode
 
int _talkListEnd
 
int _talkListCurrent
 
bool _talkTextRectDefined
 
bool _talkTextDisplayed
 
bool _talkTextInitialized
 
bool _skipTalkText
 
int _talkTextSpeed
 
int _keyCharTalkCounter
 
int _talkTableLastTalkingKeyChar
 
int _talkTableLastOtherKeyChar
 
int _talkTableLastStringNum
 
int _objectDescriptionNum
 
TalkEntry _talkTable [NUM_TALK_ENTRIES]
 
bool _conversationChoicesUpdated
 
int _conversationReplyNum
 
bool _conversationEnded
 
int _conversationNum
 
int _scrollConversationChoiceOffset
 
int _currentConversation
 
bool _disableConversationScript
 
bool _conversationAreaCleared
 
ConversationChoice _conversationChoicesTable [NUM_CONVERSATION_CHOICES]
 
int16 _flagsTable [NUM_FLAGS]
 
KeyChar _keyCharsTable [NUM_KEYCHARS]
 
KeyChar_sortedKeyCharsTable [NUM_KEYCHARS]
 
int _currentKeyCharNum
 
int _newEpisodeNum
 
int _currentEpisodeNum
 
int _currentAmountOfMoney
 
int _giveItemToKeyCharNum
 
int _giveItemToObjectNum
 
int _giveItemToCounter
 
int _currentRoomNum
 
int _waitingSetKeyCharNum1
 
int _waitingSetKeyCharNum2
 
int _waitingSetKeyCharNum3
 
uint8 _updatedRoomAreasTable [200]
 
Common::Rect _moveKeyCharRect
 
Common::Point _screenOffset
 
int _currentObjectNum
 
int _processRandomPaletteCounter
 
int16 _spriteScalingIndex [1000]
 
int16 _spriteScalingTable [1000]
 
bool _fastWalkMode
 
bool _fastMode
 
AnimationEntry _animationTable [NUM_ANIMATION_ENTRIES]
 
Script _script
 
const OpcodeProc * _opcodesTable
 
int _numOpcodes
 
Common::File _fData
 
Common::File _fSpeech [2]
 
int _compressedSpeechData
 
uint8 * _textData
 
uint8 * _backdropBuffer
 
uint8 * _menuKitData
 
uint8 * _convKitData
 
uint8 * _sequenceDataTable [NUM_SEQUENCES]
 
uint8 * _programData
 
uint32 _programDataSize
 
uint8 * _mouseData
 
uint8 * _iconData
 
SpriteData _spritesTable [NUM_SPRITES]
 
SequenceEntry _sequenceEntryTable [NUM_SEQUENCES]
 
int _currentBitmapWidth
 
int _currentBitmapHeight
 
int _currentImageWidth
 
int _currentImageHeight
 
int _roomWidth
 
uint8 * _programTextDataPtr
 
Common::Array< Common::Rect_programRectsTable
 
Common::Array< ProgramPointData_programPointsTable
 
Common::Array< ProgramWalkData_programWalkTable
 
Common::Array< ProgramAreaData_programAreaTable
 
Common::Array< ProgramBackgroundData_programBackgroundTable
 
Common::Array< ProgramHitBoxData_programHitBoxTable
 
Common::Array< ProgramActionScriptOffsetData_programActionScriptOffsetTable
 
Common::Array< ProgramKeyCharScriptOffsetData_programKeyCharScriptOffsetTable
 
Common::Array< ProgramConversationData_programConversationTable
 
Common::Rect _cursorObjectRect
 
Common::Rect _talkTextRect
 
Common::Rect _talkTextRect2
 
Common::Rect _screenRect
 
Common::Rect _roomAreaRect
 
bool _roomNeedRedraw
 
int _fullRedrawCounter
 
int _menuRedrawCounter
 
uint8 * _offscreenBuffer
 
uint8 _paletteBuffer [256 *3]
 
Common::Rect _dirtyRectsTable [NUM_DIRTY_RECTS]
 
int _dirtyRectsTableCount
 
- Protected Attributes inherited from Engine
Common::TimerManager_timer
 
Common::EventManager_eventMan
 
Common::SaveFileManager_saveFileMan
 
GUI::Dialog_mainMenuDialog
 
const Common::String _targetName
 
int32 _activeEnhancements = kEnhGameBreakingBugFixes
 

Static Protected Attributes

static const uint8 _directionsTable [NUM_DIRECTIONS]
 

Additional Inherited Members

- Static Public Member Functions inherited from Engine
static void quitGame ()
 
static bool shouldQuit ()
 
static bool warnUserAboutUnsupportedGame (Common::String msg=Common::String())
 
static void errorUnsupportedGame (Common::String extraMsg)
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

Member Function Documentation

◆ run()

Common::Error Touche::ToucheEngine::run ( )
overridevirtual

Initialize the engine and start its main loop.

Returns
kNoError on success, otherwise an error code.

Implements Engine.

◆ hasFeature()

bool Touche::ToucheEngine::hasFeature ( EngineFeature  f) const
overridevirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

◆ syncSoundSettings()

void Touche::ToucheEngine::syncSoundSettings ( )
overridevirtual

Notify the engine that the sound settings in the config manager might have changed and that it should adjust any internal volume (and other) values accordingly.

The default implementation sets the volume levels of all mixer sound types according to the config entries of the active domain. When overwriting, call the default implementation first, then adjust the volumes further (if required).

Note
When setting volume levels, respect the "mute" config entry.
The volume for the plain sound type is reset to the maximum volume. If the engine can associate its own value for this type, it needs to overwrite this member and set it accordingly.

Reimplemented from Engine.

◆ saveGameState()

Common::Error Touche::ToucheEngine::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 
)
overrideprotectedvirtual

Save a game state.

Parameters
slotThe slot into which the save state should be stored.
descDescription for the save state, entered by the user.
isAutosaveExpected to be true if an autosave is being created.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.

◆ loadGameState()

Common::Error Touche::ToucheEngine::loadGameState ( int  slot)
overrideprotectedvirtual

Load a game state.

Parameters
slotThe slot from which a save state should be loaded.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.

◆ canLoadGameStateCurrently()

bool Touche::ToucheEngine::canLoadGameStateCurrently ( Common::U32String msg = nullptr)
overrideprotectedvirtual

Indicate whether a game state can be loaded.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ canSaveGameStateCurrently()

bool Touche::ToucheEngine::canSaveGameStateCurrently ( Common::U32String msg = nullptr)
overrideprotectedvirtual

Indicate whether a game state can be saved.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ getSaveStateName()

Common::String Touche::ToucheEngine::getSaveStateName ( int  slot) const
inlineoverrideprotectedvirtual

Generate the savegame filename.

Reimplemented from Engine.


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