diff options
author | David Eriksson | 2003-11-06 21:06:01 +0000 |
---|---|---|
committer | David Eriksson | 2003-11-06 21:06:01 +0000 |
commit | 3769398474b8cd537b800b720c962e7190366b5e (patch) | |
tree | cf19842845b95bd1a4b75cecfa6594d1522ff2c1 /queen | |
parent | bd23b7dce0d715bcbf238274378241cf4ad08274 (diff) | |
download | scummvm-rg350-3769398474b8cd537b800b720c962e7190366b5e.tar.gz scummvm-rg350-3769398474b8cd537b800b720c962e7190366b5e.tar.bz2 scummvm-rg350-3769398474b8cd537b800b720c962e7190366b5e.zip |
- Improved talking
- Lots of small fixes
svn-id: r11165
Diffstat (limited to 'queen')
-rw-r--r-- | queen/command.cpp | 10 | ||||
-rw-r--r-- | queen/logic.cpp | 9 | ||||
-rw-r--r-- | queen/logic.h | 2 | ||||
-rw-r--r-- | queen/queen.cpp | 2 | ||||
-rw-r--r-- | queen/talk.cpp | 84 | ||||
-rw-r--r-- | queen/talk.h | 11 |
6 files changed, 88 insertions, 30 deletions
diff --git a/queen/command.cpp b/queen/command.cpp index d608ef1383..4934b0d643 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -1518,10 +1518,12 @@ void Command::lookCurrentRoom() { int16 i = 0; if (_curCmd.noun > _logic->currentRoomObjMax()) { uint16 obj = _logic->currentRoomArea(_curCmd.noun - _logic->currentRoomObjMax())->object; - aObjName = _logic->objectData(obj)->name; - if (aObjName > 0) { - i = aObjName; - _curCmd.noun = obj - k; + if (obj) { + aObjName = _logic->objectData(obj)->name; + if (aObjName > 0) { + i = aObjName; + _curCmd.noun = obj - k; + } } } else { diff --git a/queen/logic.cpp b/queen/logic.cpp index 6f29d367a8..809898358e 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -393,7 +393,11 @@ void Logic::initialise() { ObjectData* Logic::objectData(int index) { - return &_objectData[index]; + index = abs(index); + if (index <= _numObjects) + return &_objectData[index]; + else + error("[Logic::objectData] Invalid object data index: %i", index); } uint16 Logic::roomData(int room) { @@ -412,6 +416,7 @@ Area *Logic::currentRoomArea(int num) { if (num == 0 || num > _areaMax[_currentRoom]) { error("Logic::currentRoomArea() - Bad area number = %d (max = %d), currentRoom = %d", num, _areaMax[_currentRoom], _currentRoom); } + return &_area[_currentRoom][num]; } @@ -1568,7 +1573,7 @@ ObjectData *Logic::joeSetupInRoom(bool autoPosition, uint16 scale) { uint16 oldx; uint16 oldy; WalkOffData *pwo = NULL; - ObjectData *pod = &_objectData[_entryObj]; + ObjectData *pod = objectData(_entryObj); if (pod == NULL) { error("Logic::joeSetupInRoom() - No object data for obj %d", _entryObj); } diff --git a/queen/logic.h b/queen/logic.h index 923fa8bb73..40bf8d38c1 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -363,7 +363,7 @@ protected: ZoneSlot _zones[2][MAX_ZONES_NUMBER]; //! Actor position in room is _walkOffData[_entryObj] - uint16 _entryObj; + int16 _entryObj; //! Object description (Look At) char **_objDescription; //OBJECT_DESCRstr diff --git a/queen/queen.cpp b/queen/queen.cpp index e2babe5c49..e447ee6c4e 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -131,6 +131,7 @@ void QueenEngine::roomChanged() { // XXX fadeout(0,223); } else if (_logic->currentRoom() == FOTAQ_LOGO && _logic->gameState(VAR_INTRO_PLAYED) == 0) { +#if 0 bool pcGamesDemo = _resource->isDemo() && !_resource->exists("pclogo.cut"); if (pcGamesDemo) { @@ -159,6 +160,7 @@ void QueenEngine::roomChanged() { _logic->playCutaway("cred.cut"); } +#endif _logic->currentRoom(ROOM_HOTEL_LOBBY); _logic->entryObj(584); diff --git a/queen/talk.cpp b/queen/talk.cpp index 59034212de..029bc7a727 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -299,8 +299,46 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { } // TALK_PROC_EXIT: + + cutawayFilename[0] = '\0'; + + for (i = 0; i < 2; i++) { + if (_gameState[i] > 0) { + if (_logic->gameState(_gameState[i]) == _testValue[i]) { + if (_itemNumber[i] > 0) + _logic->inventoryInsertItem(_itemNumber[i]); + else + _logic->inventoryDeleteItem(abs(_itemNumber[i])); + } + } + } - // XXX: missing some code here! + _logic->zoneSetupPanel(); + + uint8 *ptr = _cutawayPtr; + + int16 cutawayGameState = (int16)READ_BE_UINT16(ptr); ptr += 2; + int16 cutawayTestValue = (int16)READ_BE_UINT16(ptr); ptr += 2; + + if (_logic->gameState(cutawayGameState) == cutawayTestValue) { + getString(ptr, cutawayFilename, 20); + + //CR 2 - 7/3/95, If we're executing a cutaway scene, then make sure + // Joe can talk, so set TALKQUIT to 0 just in case we exit on the + // line that set's the cutaway game states. + _input->talkQuitReset(); + } + + if (_input->talkQuit()) { + talkSelected()->hasTalkedTo = 1; + } + else { + // TODO: missing some code here! + } + + _logic->joeFace(); + + // TODO: missing some code here! if (cutawayFilename[0] == '\0') { BobSlot *pbs = _graphics->bob(person.actor->bobNum); @@ -357,6 +395,8 @@ void Talk::findDialogueString(byte *ptr, int16 id, char *str) { } void Talk::load(const char *filename) { + int i; + byte *ptr = _fileData = _resource->loadFile(filename, 20); if (!_fileData) { error("Failed to load resource data file '%s'", filename); @@ -379,23 +419,23 @@ void Talk::load(const char *filename) { else canQuit = true; - _uniqueKey = (int16)READ_BE_UINT16(ptr); ptr += 2; - _talkKey = (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 jMax =*/ (int16)READ_BE_UINT16(ptr); ptr += 2; - _pMax = (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 gameState1 =*/ (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 testValue1 =*/ (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 itemToInsert1 =*/ (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 gameState2 =*/ (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 testValue2 =*/ (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 itemToInsert2 =*/ (int16)READ_BE_UINT16(ptr); ptr += 2; + _uniqueKey = (int16)READ_BE_UINT16(ptr); ptr += 2; + _talkKey = (int16)READ_BE_UINT16(ptr); ptr += 2; + _jMax = (int16)READ_BE_UINT16(ptr); ptr += 2; + _pMax = (int16)READ_BE_UINT16(ptr); ptr += 2; + + for (i = 0; i < 2; i++) { + _gameState [i] = (int16)READ_BE_UINT16(ptr); ptr += 2; + _testValue [i] = (int16)READ_BE_UINT16(ptr); ptr += 2; + _itemNumber[i] = (int16)READ_BE_UINT16(ptr); ptr += 2; + } //debug(0, "uniqueKey = %i", _uniqueKey); //debug(0, "talkKey = %i", _talkKey); - _person1Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2; - /*byte *cutawayPtr = _fileData + READ_BE_UINT16(ptr);*/ ptr += 2; - _person2Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2; + _person1Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2; + _cutawayPtr = _fileData + READ_BE_UINT16(ptr); ptr += 2; + _person2Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2; if (ptr != (_fileData + 28)) error("ptr != (_fileData + 28))"); @@ -409,7 +449,7 @@ void Talk::load(const char *filename) { ptr = dataPtr; - for (int i = 1; i <= _levelMax; i++) + for (i = 1; i <= _levelMax; i++) for (int j = 0; j <= 5; j++) { ptr += 2; _dialogueTree[i][j].head = (int16)READ_BE_UINT16(ptr); ptr += 2; @@ -1190,11 +1230,11 @@ int16 Talk::selectSentence() { // Set zones for UP/DOWN text arrows when not English version - _logic->zoneClearAll(ZONE_SCREEN); + _logic->zoneClearAll(ZONE_PANEL); if (_logic->language() != ENGLISH) { - _logic->zoneSet(ZONE_SCREEN, ARROW_ZONE_UP, MAX_TEXT_WIDTH + 1, 0, 319, 24); - _logic->zoneSet(ZONE_SCREEN, ARROW_ZONE_DOWN, MAX_TEXT_WIDTH + 1, 25, 319, 49); + _logic->zoneSet(ZONE_PANEL, ARROW_ZONE_UP, MAX_TEXT_WIDTH + 1, 0, 319, 24); + _logic->zoneSet(ZONE_PANEL, ARROW_ZONE_DOWN, MAX_TEXT_WIDTH + 1, 25, 319, 49); } _graphics->textClear(151,199); @@ -1214,7 +1254,7 @@ int16 Talk::selectSentence() { if (yOffset < 5) { _logic->zoneSet( - ZONE_SCREEN, + ZONE_PANEL, i, 0, yOffset * LINE_HEIGHT - PUSHUP, @@ -1260,7 +1300,7 @@ int16 Talk::selectSentence() { _logic->update(); - zone = _logic->zoneIn(ZONE_SCREEN, _input->mousePosX(), _input->mousePosY()); + zone = _logic->zoneIn(ZONE_PANEL, _input->mousePosX(), _input->mousePosY()); if (5 == zone || 6 == zone) { // XXX Arrow zones @@ -1275,12 +1315,12 @@ int16 Talk::selectSentence() { oldZone, zone); if (zone > 0) { - for (y = _logic->zoneBox(ZONE_SCREEN, zone).y1; y < _logic->zoneBox(ZONE_SCREEN, zone).y2; y += 10) + for (y = _logic->zoneBox(ZONE_PANEL, zone).y1; y < _logic->zoneBox(ZONE_PANEL, zone).y2; y += 10) _graphics->textColor(y, INK_JOE); } if (oldZone > 0) { - for (y = _logic->zoneBox(ZONE_SCREEN, oldZone).y1; y < _logic->zoneBox(ZONE_SCREEN, oldZone).y2; y += 10) + for (y = _logic->zoneBox(ZONE_PANEL, oldZone).y1; y < _logic->zoneBox(ZONE_PANEL, oldZone).y2; y += 10) _graphics->textColor(y, INK_TALK_NORMAL); } diff --git a/queen/talk.h b/queen/talk.h index a5ec14a11b..320db2ad16 100644 --- a/queen/talk.h +++ b/queen/talk.h @@ -69,7 +69,6 @@ class Talk { MAX_TEXT_WIDTH = (320-18), PUSHUP = 4, TALK_SELECTED_COUNT = 86, - ZONE_SCREEN = 1, ARROW_BOB_UP = 62, ARROW_BOB_DOWN = 63, ARROW_ZONE_UP = 5, @@ -131,12 +130,22 @@ class Talk { //! Used to select voice files int16 _talkKey; + int16 _jMax; + //! Used by findDialogueString int16 _pMax; + // Update game state efter dialogue + int16 _gameState[2]; + int16 _testValue[2]; + int16 _itemNumber[2]; + //! String data byte *_person1Ptr; + //! Cutaway data + byte *_cutawayPtr; + //! Data used if we have talked to the person before byte *_person2Ptr; |