diff options
-rw-r--r-- | queen/cutaway.cpp | 12 | ||||
-rw-r--r-- | queen/cutaway.h | 7 | ||||
-rw-r--r-- | queen/defs.h | 5 | ||||
-rw-r--r-- | queen/logic.cpp | 9 | ||||
-rw-r--r-- | queen/logic.h | 11 | ||||
-rw-r--r-- | queen/talk.cpp | 47 | ||||
-rw-r--r-- | queen/talk.h | 7 | ||||
-rw-r--r-- | queen/xref.txt | 8 |
8 files changed, 82 insertions, 24 deletions
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index 67b0bd6c64..febcbc1073 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -58,9 +58,8 @@ void Cutaway::run( char *nextFilename, Graphics *graphics, Logic *logic, - Resource *resource, - Walk *walk) { - Cutaway *cutaway = new Cutaway(filename, graphics,logic, resource, walk); + Resource *resource) { + Cutaway *cutaway = new Cutaway(filename, graphics, logic, resource); cutaway->run(nextFilename); delete cutaway; } @@ -69,9 +68,8 @@ Cutaway::Cutaway( const char *filename, Graphics *graphics, Logic *logic, - Resource *resource, - Walk *walk) -: _graphics(graphics), _logic(logic), _resource(resource), _walk(walk), + Resource *resource) +: _graphics(graphics), _logic(logic), _resource(resource), _walk(logic->walk()), _quit(false), _personFaceCount(0), _lastSong(0), _songBeforeComic(0) { memset(&_bankNames, 0, sizeof(_bankNames)); load(filename); @@ -1050,7 +1048,7 @@ void Cutaway::talk(char *nextFilename) { warning("Cutaway::talk() used but not fully implemented"); nextFilename[0] = '\0'; - Talk::talk(_talkFile, nextFilename, _graphics, _logic, _resource); + Talk::talk(_talkFile, 0 /* XXX */, nextFilename, _graphics, _logic, _resource); } } diff --git a/queen/cutaway.h b/queen/cutaway.h index 8a4f81ee2e..e4faf5a5ae 100644 --- a/queen/cutaway.h +++ b/queen/cutaway.h @@ -39,8 +39,8 @@ class Cutaway { char *nextFilename, Graphics *graphics, Logic *logic, - Resource *resource, - Walk *walk); + Resource *resource); + private: //! Collection of constants used by QueenCutaway enum { @@ -205,8 +205,7 @@ class Cutaway { const char *filename, Graphics *graphics, Logic *logic, - Resource *resource, - Walk *walk); + Resource *resource); ~Cutaway(); //! Run this cutaway object diff --git a/queen/defs.h b/queen/defs.h index bedff877f5..35867b94fe 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -105,6 +105,11 @@ enum StateDirection { STATE_DIR_FRONT = 3 }; +enum StateTalk { + STATE_TALK_TALK, + STATE_TALK_MUTE +}; + } // End of namespace Queen diff --git a/queen/logic.cpp b/queen/logic.cpp index 5fd938c870..ac29bdcd77 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -28,7 +28,7 @@ namespace Queen { Logic::Logic(Resource *resource, Graphics *graphics) - : _resource(resource), _graphics(graphics) { + : _resource(resource), _graphics(graphics), _talkSpeed(DEFAULT_TALK_SPEED) { _jas = _resource->loadFile("QUEEN.JAS", 20); _joe.x = _joe.y = 0; _walk = new Walk(this, _graphics); @@ -573,8 +573,8 @@ void Logic::joeY(uint16 y) { _joe.y = y; } -void Logic::joeWalk(uint16 walk) { - _joe.walk = walk; +void Logic::joeWalk(uint16 walking) { + _joe.walk = walking; } void Logic::joeScale(uint16 scale) { @@ -1375,6 +1375,9 @@ StateDirection Logic::findStateDirection(uint16 state) { return sd; } +StateTalk Logic::findStateTalk(uint16 state) { + return (state & (1 << 9)) ? STATE_TALK_TALK : STATE_TALK_MUTE; +} void Logic::joeSetup() { int i; diff --git a/queen/logic.h b/queen/logic.h index 36fe5eb133..f7cae8b61c 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -84,7 +84,7 @@ public: void joeFacing(uint16 dir); void joeX(uint16 x); void joeY(uint16 y); - void joeWalk(uint16 walk); + void joeWalk(uint16 walking); void joeScale(uint16 scale); void joePrevFacing(uint16 dir); @@ -126,6 +126,11 @@ public: void animErase(uint16 bobNum); StateDirection findStateDirection(uint16 state); // == FIND_STATE(state, "DIR"); + StateTalk findStateTalk (uint16 state); // == FIND_STATE(state, "TALK"); + + Walk *walk() { return _walk; } + + int talkSpeed() { return _talkSpeed; } //! SETUP_JOE(), loads the various bobs needed to animate Joe void joeSetup(); @@ -136,7 +141,6 @@ public: //! FACE_JOE() uint16 joeFace(); - protected: bool _textToggle; bool _speechToggle; @@ -198,6 +202,7 @@ protected: char **_aFile; //A_FILEstr enum { + DEFAULT_TALK_SPEED = 7, GAME_STATE_COUNT = 211 }; @@ -223,6 +228,8 @@ protected: Graphics *_graphics; Walk *_walk; + int _talkSpeed; // TALKSPD + void initialise(); }; diff --git a/queen/talk.cpp b/queen/talk.cpp index 625b410910..1e99e46820 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -34,12 +34,13 @@ namespace Queen { void Talk::talk( const char *filename, + int personInRoom, char *cutawayFilename, Graphics *graphics, Logic *logic, Resource *resource) { Talk *talk = new Talk(graphics, logic, resource); - talk->talk(filename, cutawayFilename); + talk->talk(filename, personInRoom, cutawayFilename); delete talk; } @@ -72,7 +73,7 @@ Talk::~Talk() { -void Talk::talk(const char *filename, char *cutawayFilename) { +void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { _oldSelectedSentenceIndex = 0; _oldSelectedSentenceValue = 0; @@ -81,6 +82,16 @@ void Talk::talk(const char *filename, char *cutawayFilename) { cutawayFilename[0] = '\0'; // XXX S=SUBJECT[1]; + + int roomStart = _logic->roomData(_logic->currentRoom()); + ObjectData *data = _logic->objectData(roomStart + personInRoom); + + if (data->name <= 0) // disabled! + return; + + if (data->entryObj > 0) + return; + // XXX R=ROOM_DATA[ROOM]; // XXX if(OBJECT_DATA[NOUN2+R][0]<=0) return; // XXX if(OBJECT_DATA[NOUN2+R][4]>0) return; @@ -99,6 +110,9 @@ void Talk::talk(const char *filename, char *cutawayFilename) { load(filename); + //Person person; + //_logic->personSetData( + char personName[MAX_STRING_SIZE]; // XXX SET_PERSON_DATA(N,NAMEstr,0); int bobNum = 1; // XXX P_BNUM; @@ -566,6 +580,18 @@ exit: return personWalking; } +int Talk::countSpaces(const char *segment) { + int tmp = 0; + + while (*segment++) + tmp++; + + if (tmp < 10) + tmp = 10; + + return (tmp * 2) / _logic->talkSpeed(); +} + void Talk::speakSegment( const char *segment, int length, @@ -583,6 +609,23 @@ void Talk::speakSegment( debug(0, "Playing voice file '%s'", voiceFileName); + if (SPEAK_PAUSE == command) { + for (int i = 0; i < 10; i++) { + if (_quit) + break; + _graphics->update(); + } + return; + } + + //int spaces = countSpaces(segment); + + if (scumm_stricmp(person, "JOE")) { + } + else { + + } + } diff --git a/queen/talk.h b/queen/talk.h index 7ec2f9c7c0..a1fae9290d 100644 --- a/queen/talk.h +++ b/queen/talk.h @@ -36,7 +36,8 @@ class Talk { //! Public interface to run a talk from a file static void talk( const char *filename, - char *cutawayFilename, + int personInRoom, + char *cutawayFilename, Graphics *graphics, Logic *logic, Resource *resource); @@ -140,7 +141,7 @@ class Talk { ~Talk(); //! Perform talk in file and return a cutaway filename - void talk(const char *filename, char *cutawayFilename); + void talk(const char *filename, int personInRoom, char *cutawayFilename); //! Load talk data from .dog file void load(const char *filename); @@ -175,6 +176,8 @@ class Talk { const char *voiceFilePrefix, int index); + int countSpaces(const char *segment); + static int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]); diff --git a/queen/xref.txt b/queen/xref.txt index e7b5050e92..c3f7b97f2c 100644 --- a/queen/xref.txt +++ b/queen/xref.txt @@ -294,10 +294,10 @@ TALK ==== MAKE_SPEAK_BOB MOVE_SPEAK -SPEAK Talk::? -SPEAK_SUB -talk Talk::run -TALK_PROC +SPEAK Talk::speak +SPEAK_SUB Talk::speakSegment +talk Talk::talk +TALK_PROC Talk::talk - A1,A12 TALK_SELECTED |