diff options
author | David Eriksson | 2003-10-12 19:16:48 +0000 |
---|---|---|
committer | David Eriksson | 2003-10-12 19:16:48 +0000 |
commit | ba281b251af3f9db2305517a20541fab182440c3 (patch) | |
tree | 3b794e29794c3ec561acf36922d3fe71e8ad7fdc /queen/talk.h | |
parent | 2e60628c1f80fc6ebbc1ec0a5f75ad637bef4bdc (diff) | |
download | scummvm-rg350-ba281b251af3f9db2305517a20541fab182440c3.tar.gz scummvm-rg350-ba281b251af3f9db2305517a20541fab182440c3.tar.bz2 scummvm-rg350-ba281b251af3f9db2305517a20541fab182440c3.zip |
- Integrate with Joost's and Gregory's latest implementations.
- Implement more...
svn-id: r10771
Diffstat (limited to 'queen/talk.h')
-rw-r--r-- | queen/talk.h | 251 |
1 files changed, 137 insertions, 114 deletions
diff --git a/queen/talk.h b/queen/talk.h index 0c669fd9f8..7ec2f9c7c0 100644 --- a/queen/talk.h +++ b/queen/talk.h @@ -31,128 +31,151 @@ class Logic; class Resource; class Talk { - public: - - //! Public interface to run a talk from a file - static void run( - const char *filename, - char *cutawayFilename, - Graphics *graphics, - Logic *logic, - Resource *resource); - - //! Public interface to speak a sentence -#if 0 - static void run( - const char *sentence, - const char *person, - int noun, - Logic *logic, - Resource *resource); -#endif - - //! Read a string from ptr and return new ptr - static byte *getString(byte *ptr, char *str, int maxLength, int align = 2); - - private: - //! Collection of constants used by Talk - enum { - MAX_STRING_LENGTH = 255, - MAX_STRING_SIZE = (MAX_STRING_LENGTH + 1), - MAX_TEXT_WIDTH = (320-18), - PUSHUP = 4, - TALK_SELECTED_COUNT = 86, - SENTENCE_BOB_1 = 62, - SENTENCE_BOB_2 = 63 - }; - - //! TODO Move this to struct.h later! - struct TalkSelected { - int16 hasTalkedTo; - int16 values[4]; - }; - - struct DialogueNode { - int16 head; - int16 dialogueNodeValue1; - int16 gameStateIndex; - int16 gameStateValue; - }; - - Graphics *_graphics; - Logic *_logic; - Resource *_resource; - - //! Raw .dog file data (without 20 byte header) - byte *_fileData; - - //! Number of dialogue levels - int16 _levelMax; - - //! Unique key for this dialogue - int16 _uniqueKey; - - //! Used to select voice files - int16 _talkKey; - - //! Used by findDialogueString - int16 _pMax; - - //! String data - byte *_person1Ptr; - - //! Data used if we have talked to the person before - byte *_person2Ptr; - - //! Data used if we haven't talked to the person before - byte *_joePtr; - - //! Set to true to quit talking - bool _quit; - - //! IDs for sentences - DialogueNode _dialogueTree[18][6]; - - //! TODO Move this to the Logic class later! - TalkSelected _talkSelected[TALK_SELECTED_COUNT]; - - //! Greeting from person Joe has talked to before - char _person2String[MAX_STRING_SIZE]; - - int _oldSelectedSentenceIndex; - int _oldSelectedSentenceValue; - - char _talkString[5][MAX_STRING_SIZE]; - char _joeVoiceFilePrefix[5][MAX_STRING_SIZE]; - - Talk(Graphics *graphics, Logic *logic, Resource *resource); - ~Talk(); - - //! Perform talk in file and return a cutaway filename - void talk(const char *filename, char *cutawayFilename); + public: + + //! Public interface to run a talk from a file + static void talk( + const char *filename, + char *cutawayFilename, + Graphics *graphics, + Logic *logic, + Resource *resource); + + //! Public interface to speak a sentence + static bool speak( + const char *sentence, + const char *person, + const char *voiceFilePrefix, + Graphics *graphics, + Logic *logic, + Resource *resource); + + //! Read a string from ptr and return new ptr + static byte *getString(byte *ptr, char *str, int maxLength, int align = 2); + + private: + //! Collection of constants used by Talk + enum { + MAX_STRING_LENGTH = 255, + MAX_STRING_SIZE = (MAX_STRING_LENGTH + 1), + MAX_TEXT_WIDTH = (320-18), + PUSHUP = 4, + TALK_SELECTED_COUNT = 86, + SENTENCE_BOB_1 = 62, + SENTENCE_BOB_2 = 63 + }; + + //! Special commands for speech + enum { + SPEAK_DEFAULT = 0, + SPEAK_FACE_LEFT = -1, + SPEAK_FACE_RIGHT = -2, + SPEAK_FACE_FRONT = -3, + SPEAK_FACE_BACK = -4, + SPEAK_AMAL_ON = -7, + SPEAK_PAUSE = -8, + SPEAK_NONE = -9 + }; + + //! TODO Move this to struct.h later! + struct TalkSelected { + int16 hasTalkedTo; + int16 values[4]; + }; + + struct DialogueNode { + int16 head; + int16 dialogueNodeValue1; + int16 gameStateIndex; + int16 gameStateValue; + }; + + Graphics *_graphics; + Logic *_logic; + Resource *_resource; + + //! Raw .dog file data (without 20 byte header) + byte *_fileData; + + //! Number of dialogue levels + int16 _levelMax; + + //! Unique key for this dialogue + int16 _uniqueKey; + + //! Used to select voice files + int16 _talkKey; + + //! Used by findDialogueString + int16 _pMax; + + //! String data + byte *_person1Ptr; + + //! Data used if we have talked to the person before + byte *_person2Ptr; + + //! Data used if we haven't talked to the person before + byte *_joePtr; + + //! Set to true to quit talking + bool _quit; + + //! IDs for sentences + DialogueNode _dialogueTree[18][6]; + + //! TODO Move this to the Logic class later! + TalkSelected _talkSelected[TALK_SELECTED_COUNT]; + + //! Greeting from person Joe has talked to before + char _person2String[MAX_STRING_SIZE]; + + int _oldSelectedSentenceIndex; + int _oldSelectedSentenceValue; + + char _talkString[5][MAX_STRING_SIZE]; + char _joeVoiceFilePrefix[5][MAX_STRING_SIZE]; + + Talk(Graphics *graphics, Logic *logic, Resource *resource); + ~Talk(); + + //! Perform talk in file and return a cutaway filename + void talk(const char *filename, char *cutawayFilename); + + //! Load talk data from .dog file + void load(const char *filename); + + //! First things spoken + void initialTalk(); - //! Load talk data from .dog file - void load(const char *filename); + //! Find a string in the dialogue tree + void findDialogueString(byte *ptr, int16 id, char *str); - //! First things spoken - void initialTalk(); + //! Get TalkSelected struct for this talk + TalkSelected *talkSelected(); - //! Find a string in the dialogue tree - void findDialogueString(byte *ptr, int16 id, char *str); + //! The sentence will not be displayed again + void disableSentence(int oldLevel, int selectedSentence); - //! Speak sentence - bool speak(const char *sentence, const char *person, const char *voiceFilePrefix); + //! Select what to say + int16 selectSentence(); - //! Get TalkSelected struct for this talk - TalkSelected *talkSelected(); + //! Speak sentence + bool speak(const char *sentence, const char *person, const char *voiceFilePrefix); - //! The sentence will not be displayed again - void disableSentence(int oldLevel, int selectedSentence); + //! Convert command in sentence to command code + int getSpeakCommand(const char *sentence, unsigned &index); - //! Select what to say - int16 selectSentence(); + //! Speak a part of a sentence + void speakSegment( + const char *segment, + int length, + const char *person, + int command, + const char *voiceFilePrefix, + int index); - static int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]); + static int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]); }; |