diff options
author | David Eriksson | 2003-11-06 08:44:33 +0000 |
---|---|---|
committer | David Eriksson | 2003-11-06 08:44:33 +0000 |
commit | c524a58197f28d6ff54398a052ef391dac905148 (patch) | |
tree | 8f4b9c1f692c57129b3307cb22d72ac9b7fa1d6f | |
parent | d1ebb50c5b93906d69fe1359ac73b5cc0523df66 (diff) | |
download | scummvm-rg350-c524a58197f28d6ff54398a052ef391dac905148.tar.gz scummvm-rg350-c524a58197f28d6ff54398a052ef391dac905148.tar.bz2 scummvm-rg350-c524a58197f28d6ff54398a052ef391dac905148.zip |
The more I implement, the more I need to implement.
- More cutaway code
- More dialogue code
Hint: Let the last intro cutaway finish if you don't want Joe to get stuck.
svn-id: r11160
-rw-r--r-- | queen/command.cpp | 33 | ||||
-rw-r--r-- | queen/cutaway.cpp | 206 | ||||
-rw-r--r-- | queen/cutaway.h | 4 | ||||
-rw-r--r-- | queen/display.h | 1 | ||||
-rw-r--r-- | queen/graphics.cpp | 7 | ||||
-rw-r--r-- | queen/graphics.h | 2 | ||||
-rw-r--r-- | queen/logic.cpp | 10 | ||||
-rw-r--r-- | queen/logic.h | 2 | ||||
-rw-r--r-- | queen/queen.cpp | 3 | ||||
-rw-r--r-- | queen/talk.cpp | 153 | ||||
-rw-r--r-- | queen/talk.h | 10 | ||||
-rw-r--r-- | queen/verb.h | 4 |
12 files changed, 322 insertions, 113 deletions
diff --git a/queen/command.cpp b/queen/command.cpp index cd3a6c278e..6a0c754304 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -25,6 +25,7 @@ #include "queen/input.h" #include "queen/graphics.h" #include "queen/logic.h" +#include "queen/talk.h" #include "queen/walk.h" namespace Queen { @@ -856,19 +857,27 @@ bool Command::executeIfCutaway(const char *description) { bool Command::executeIfDialog(const char *description) { - warning("Command::executeIfDialog(%s) unimplemented", description); + if (strlen(description) > 4 && + scumm_stricmp(description + strlen(description) - 4, ".dog") == 0) { + char cutaway[20]; - if (strlen(description) > 4 && - scumm_stricmp(description + strlen(description) - 4, ".dog") == 0) { - /* XXX - talk(Kstr); - strcpy(Kstr,Paramstr); - while(Kstr[0]) { - CUTAWAY(Kstr); - strcpy(Kstr,Paramstr); - }*/ - return true; - } + _logic->dialogue(description, _curCmd.noun, cutaway); + + while (cutaway[0] != '\0') { + char currentCutaway[20]; + strcpy(currentCutaway, cutaway); + _logic->playCutaway(currentCutaway, cutaway); + } + + /* XXX + talk(Kstr); + strcpy(Kstr,Paramstr); + while(Kstr[0]) { + CUTAWAY(Kstr); + strcpy(Kstr,Paramstr); + }*/ + return true; + } return false; } diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index f72551ac6b..8ff216f539 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -33,25 +33,14 @@ namespace Queen { /* TODO soon - - Implement CUTAWAY_SCALE - - Implement SCENE_START and SCENE_END - - Finish Cutaway::handleAnimation - - Finish Cutaway::actionSpecialMove - - Support the remaining cutaway object types: - OBJECT_TYPE_TEXT_SPEAK - OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK - OBJECT_TYPE_TEXT_DISPLAY - - - Find out why one digit is missing in the voice file names - TODO later - - Finish Cutaway::goToFinalRoom + - Finish Cutaway::stop - Show credits @@ -122,12 +111,12 @@ void Cutaway::load(const char *filename) { else _input->canQuit(true); - int flags1 = READ_BE_UINT16(ptr); + int16 flags1 = (int16)READ_BE_UINT16(ptr); ptr += 2; - debug(0, "flags1 = %i", (int16)flags1); + debug(0, "flags1 = %i", flags1); if (flags1 < 0) { - /* ENTRY_OBJ = 0 */ + _logic->entryObj(0); _finalRoom = -flags1; } else @@ -135,6 +124,9 @@ void Cutaway::load(const char *filename) { _anotherCutaway = (flags1 == 1); + debug(0, "[Cutaway::load] _finalRoom = %i", _finalRoom); + debug(0, "[Cutaway::load] _anotherCutaway = %i", _anotherCutaway); + /* Pointers to other places in the cutaway data */ @@ -165,6 +157,7 @@ void Cutaway::load(const char *filename) { if (entryString[0] == '*' && entryString[1] == 'F' && entryString[3] == '\0') { + warning("[Cutaway::load] CUTJOEF not handled"); switch (entryString[2]) { case 'L': /* CUTJOEF = LEFT; */ @@ -291,10 +284,19 @@ void Cutaway::dumpCutawayObject(int index, CutawayObject &object) } void Cutaway::actionSpecialMove(int index) { + + if (index <= 0) + return; + debug(0, "Special move: %i", index); switch (index) { + // cdint.cut - put camera on Joe + case 16: + _graphics->cameraBob(0); + break; + // cred.cut - scale title case 34: { @@ -689,7 +691,6 @@ byte *Cutaway::getCutawayAnim(byte *ptr, int header, CutawayAnim &anim) { //debug(0, "[Cutaway::getCutawayAnim] header=%i", header); - anim.currentFrame = 0; anim.originalFrame = 0; @@ -701,7 +702,8 @@ byte *Cutaway::getCutawayAnim(byte *ptr, int header, CutawayAnim &anim) { anim.originalFrame = 29 + FRAMES_JOE_XTRA; // 21/9/94, Make sure that bobs are clipped on 150 screens - // XXX if(FULLSCREEN) bobs[0].y2=199; + if (_logic->display()->fullscreen()) + _graphics->bob(0)->box.y2 = 199; } else { //warning("Stuff not yet implemented in Cutaway::getCutawayAnim()"); @@ -1055,17 +1057,22 @@ void Cutaway::handlePersonRecord( } void Cutaway::run(char *nextFilename) { + int i; nextFilename[0] = '\0'; byte *ptr = _objectData; + int initialJoeX = _logic->joeX(); + int initialJoeY = _logic->joeY(); + _input->cutawayRunning(true); _initialRoom = _temporaryRoom = _logic->currentRoom(); - // XXX if(COMPANEL==0 || COMPANEL==2) SCENE_START(0); + // XXX if (_comPanel == 0 || _comPanel == 2) + // XXX SCENE_START(0); - for (int i = 0; i < _cutawayObjectCount; i++) { + for (i = 0; i < _cutawayObjectCount; i++) { CutawayObject object; ptr = getCutawayObject(ptr, object); //dumpCutawayObject(i, object); @@ -1155,7 +1162,7 @@ void Cutaway::run(char *nextFilename) { #endif } // for() - goToFinalRoom(); + stop(); _input->cutawayQuitReset(); @@ -1165,14 +1172,71 @@ void Cutaway::run(char *nextFilename) { talk(nextFilename); - // XXX if(COMPANEL==0 || (COMPANEL==2 && ANOTHER_CUT==0)) { - // XXX SCENE_END(1); - // XXX COMPANEL=0; - // XXX } + if (_comPanel == 0 || (_comPanel == 2 && !_anotherCutaway)) { + // XXX SCENE_END(1); + _comPanel = 0; + } if (nextFilename[0] == '\0' && !_anotherCutaway) { // Lines 2138-2182 in cutaway.c - warning("Clean-up stuff needed but not yet implemented"); + if (_finalRoom) { + _logic->newRoom(0); + _logic->entryObj(0); + } + else { + /// No need to stay in current room, so return to previous room + // if one exists. Reset Joe's X,Y coords to those when first entered + + restorePersonData(); + + if (_logic->entryObj() > 0) + _initialRoom = _logic->objectData(_logic->entryObj())->room; + else { + // We're not returning to new room, so return to old Joe X,Y coords + _logic->joeX(initialJoeX); + _logic->joeX(initialJoeY); + } + + if (_logic->currentRoom() != _initialRoom) { + _logic->currentRoom(_initialRoom); + // XXX should call SETUP_ROOM here but that would introduce a circual dependency... + // if (_logic->currentRoom() == _logic->newRoom()) + // _logic->newRoom(0); + // XXX so I try to set newRoom to the room instead + _logic->newRoom(_initialRoom); + } + } + + // XXX CUTJOEF=0; + _comPanel = 0; + _logic->display()->fullscreen(false); + + // XXX some string animations + int k = 0; + for (i = _logic->roomData(_logic->currentRoom()); + i <= _logic->roomData(_logic->currentRoom() + 1); i++) { + + ObjectData *object = _logic->objectData(i); + + if (object->image == -3 || object->image == -4) { + k++; + // XXX if (object->name > 0 && _logic->newAnim( + } + } + + // function CUTAWAY_SPECIAL(), lines 885-896 in cutaway.c + if (_logic->currentRoom() == 1 && _logic->gameState(3) == 0) { + // XXX hard-coded room and inventory items + _logic->inventoryDeleteItem(54, false); + _logic->inventoryDeleteItem(56, false); + _logic->inventoryDeleteItem(58, false); + _logic->inventoryDeleteItem(59, false); + _logic->inventoryDeleteItem(60, false); + _logic->inventoryDeleteItem(61, false); + _logic->gameState(3, 1); + _logic->inventoryRefresh(); + } + } BobSlot *joeBob = _graphics->bob(0); @@ -1190,7 +1254,7 @@ void Cutaway::run(char *nextFilename) { /* XXX playsong(_lastSong) */ ; } -void Cutaway::goToFinalRoom() { +void Cutaway::stop() { // Lines 1901-2032 in cutaway.c byte *ptr = _gameStatePtr; @@ -1201,14 +1265,17 @@ void Cutaway::goToFinalRoom() { // Get the final room and Joe's final position - uint16 joeRoom = READ_BE_UINT16(ptr); ptr += 2; - uint16 joeX = READ_BE_UINT16(ptr); ptr += 2; - uint16 joeY = READ_BE_UINT16(ptr); ptr += 2; + int16 joeRoom = READ_BE_UINT16(ptr); ptr += 2; + int16 joeX = READ_BE_UINT16(ptr); ptr += 2; + int16 joeY = READ_BE_UINT16(ptr); ptr += 2; if ((!_input->cutawayQuit() || (!_anotherCutaway && joeRoom == _finalRoom)) && joeRoom != _temporaryRoom && joeRoom != 0) { + debug(0, "[Cutaway::stop] Changing room to %i and moving Joe to (%i, %i)", + joeRoom, joeX, joeY); + _logic->joeX(joeX); _logic->joeY(joeX); _logic->currentRoom(joeRoom); @@ -1218,35 +1285,88 @@ void Cutaway::goToFinalRoom() { if (_input->cutawayQuit()) { // Lines 1927-2032 in cutaway.c + int i; // Stop the credits from running // XXX CFlag = 0; - // Stop all moving bobs - warning("Not stopping moving bobs yet"); + _graphics->bobStopAll(); - // XXX Loop person faces + for (i = 1; i <= _personFaceCount; i++) { + int index = _personFace[i].index; + if (index > 0) { + _logic->objectData(_personFace[i].index)->image = _personFace[i].image; + + _graphics->bob(_logic->findBob(index))->xflip = + (_personFace[i].image != -4); + } + } int quitObjectCount = (int16)READ_BE_UINT16(ptr); ptr += 2; - for (int i = 0; i < quitObjectCount; i++) { + for (i = 0; i < quitObjectCount; i++) { int16 objectIndex = (int16)READ_BE_UINT16(ptr); ptr += 2; - int16 from = (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 x = (int16)READ_BE_UINT16(ptr);*/ ptr += 2; - /*int16 y = (int16)READ_BE_UINT16(ptr);*/ ptr += 2; + int16 fromIndex = (int16)READ_BE_UINT16(ptr); ptr += 2; + int16 x = (int16)READ_BE_UINT16(ptr); ptr += 2; + int16 y = (int16)READ_BE_UINT16(ptr); ptr += 2; int16 room = (int16)READ_BE_UINT16(ptr); ptr += 2; - /*int16 frame = (int16)READ_BE_UINT16(ptr);*/ ptr += 2; + int16 frame = (int16)READ_BE_UINT16(ptr); ptr += 2; + int16 bank = (int16)READ_BE_UINT16(ptr); ptr += 2; + + int bobIndex = _logic->findBob(objectIndex); + ObjectData *object = _logic->objectData(objectIndex); - // XXX int bob = _logic->findBob(objectIndex); + if (fromIndex > 0) { + if (fromIndex == objectIndex) { + // Enable object + object->name = abs(object->name); + } + else { + _logic->objectCopy(fromIndex, objectIndex); + + ObjectData *from = _logic->objectData(fromIndex); + if (object->image && !from->image && bobIndex && _logic->currentRoom() == object->room) + _graphics->bobClear(bobIndex); + } - if (from > 0) { - // XXX + if (_logic->currentRoom() == room) + _logic->roomRefreshObject(objectIndex); } - ObjectData *objectData = _logic->objectData(objectIndex); + if (_logic->currentRoom() == object->room) { + BobSlot *pbs = _graphics->bob(bobIndex); + + if (x || y) { + pbs->x = x; + pbs->y = y; + if (InRange(object->image, -4, -3)) + pbs->scale = _logic->findScale(x, y); + } + + if (frame) { + if (0 == bank) + bank = 15; + else if (bank != 13) { + // XXX if(bank != oldBank) { + _graphics->bankLoad(_bankNames[bank-1], 8); + // XXX oldBank = bank; + // XXX } + bank = 8; + } + + int objectFrame = _logic->findFrame(objectIndex); - if (objectData->room == room) { - // XXX + if (objectFrame == 1000) { + _graphics->bobClear(bobIndex); + } + else if (objectFrame) { + _graphics->bankUnpack(abs(frame), objectFrame, bank); + pbs->frameNum = objectFrame; + if (frame < 0) + pbs->xflip = true; + + } + } } } // for() diff --git a/queen/cutaway.h b/queen/cutaway.h index bf6985e3b5..1ae60a4ae2 100644 --- a/queen/cutaway.h +++ b/queen/cutaway.h @@ -259,8 +259,8 @@ class Cutaway { //! Restore QueenLogic::_objectData from _personData void restorePersonData(); - //! Go to the final room - void goToFinalRoom(); + //! Stop the cutaway + void stop(); //! Update game state after cutaway void updateGameState(); diff --git a/queen/display.h b/queen/display.h index 3b1e51548b..2179d990ef 100644 --- a/queen/display.h +++ b/queen/display.h @@ -99,6 +99,7 @@ public: void horizontalScroll(int16 scroll); int16 horizontalScroll() const { return _horizontalScroll; } + void fullscreen(bool fs) { _fullscreen = fs; } bool fullscreen() const { return _fullscreen; } void handleTimer(); diff --git a/queen/graphics.cpp b/queen/graphics.cpp index 2340c3d91c..cd991c8016 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -565,6 +565,13 @@ void Graphics::bobClearAll() { } +void Graphics::bobStopAll() { + for(int32 i = 0; i < ARRAYSIZE(_bobs); ++i) { + _bobs[i].moving = false; + } +} + + BobSlot *Graphics::bob(int index) { if (index < MAX_BOBS_NUMBER) diff --git a/queen/graphics.h b/queen/graphics.h index e57880e35e..d6b36418e2 100644 --- a/queen/graphics.h +++ b/queen/graphics.h @@ -134,6 +134,7 @@ public: void bobSortAll(); // sortbobs() void bobDrawAll(); // drawbobs() void bobClearAll(); // clearallbobs() + void bobStopAll(); BobSlot *bob(int index); void bobCustomParallax(uint16 roomNum); // CHECK_PARALLAX() @@ -150,6 +151,7 @@ public: void textClear(uint16 y1, uint16 y2); // blanktexts() uint16 textWidth(const char *text) const; // textlen() int textCenterX(const char *text) const; // MIDDLE() + void textColor(uint16 y, uint8 color) { _texts[y].color = color; } void frameErase(uint32 fslot); void frameEraseAll(bool joe); // freeframes, freeallframes diff --git a/queen/logic.cpp b/queen/logic.cpp index a208f0411c..7447335c96 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1804,6 +1804,16 @@ void Logic::joeUseUnderwear() { } +void Logic::dialogue(const char *dlgFile, int personInRoom, char *cutaway) { + + char cutawayFile[20]; + if (cutaway == NULL) { + cutaway = cutawayFile; + } + Talk::talk(dlgFile, personInRoom, cutaway, _graphics, _input, this, _resource, _sound); +} + + void Logic::playCutaway(const char *cutFile, char *next) { char nextFile[20]; diff --git a/queen/logic.h b/queen/logic.h index 80ee67a3b2..543e649041 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -185,6 +185,7 @@ public: void zoneClearAll(uint16 screen); void zoneSetup(); void zoneSetupPanel(); + Box &zoneBox(uint16 screen, uint16 index) { return _zones[screen][index].box; } void roomErase(); void roomSetupFurniture(); // SETUP_FURNITURE() @@ -229,6 +230,7 @@ public: void joeSpeak(uint16 descNum, bool objectType = false); + void dialogue(const char *dlgFile, int personInRoom, char *cutaway); void playCutaway(const char *cutFile, char *next = NULL); const char *objectOrItemName(int16 obj) const; diff --git a/queen/queen.cpp b/queen/queen.cpp index dad766607a..e2babe5c49 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -196,7 +196,7 @@ void QueenEngine::go() { _logic->oldRoom(_logic->currentRoom()); _logic->currentRoom(_logic->newRoom()); roomChanged(); - // XXX _logic->fullScreen(false); + _display->fullscreen(false); if (_logic->currentRoom() == _logic->newRoom()) { _logic->newRoom(0); } @@ -214,7 +214,6 @@ void QueenEngine::go() { _logic->checkPlayer(); } } - break; // XXX don't loop yet } } diff --git a/queen/talk.cpp b/queen/talk.cpp index c2d771c93c..59034212de 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "queen/talk.h" +#include "queen/display.h" #include "queen/graphics.h" #include "queen/logic.h" #include "queen/sound.h" @@ -116,8 +117,9 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { // XXX } // XXX panelflag=0; + _wasFullscren = _logic->display()->fullscreen(); + _logic->display()->fullscreen(true); - load(filename); Person person; @@ -295,6 +297,26 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { } } } + +// TALK_PROC_EXIT: + + // XXX: missing some code here! + + if (cutawayFilename[0] == '\0') { + BobSlot *pbs = _graphics->bob(person.actor->bobNum); + + pbs->x = person.actor->x; + pbs->y = person.actor->y; + + _logic->display()->fullscreen(_wasFullscren); + + // XXX if (P_ANIMstr[0] != '\0') + // Better kick start the persons anim sequence + // XXX stringanim(BNUM,NEW_ANIM[BNUM]); + } + + _talkHead = false; + _logic->joeWalk(0); } void Talk::disableSentence(int oldLevel, int selectedSentence) { @@ -801,8 +823,7 @@ void Talk::defaultAnimation( if (_input->talkQuit()) break; - // XXX CHECK_PLAYER(); - _logic->update(); // XXX call it ourselves as CHECK_PLAYER is not called + _logic->checkPlayer(); if (_logic->joeWalk() == 2) // Selected a command, so exit @@ -1138,6 +1159,8 @@ int16 Talk::selectSentence() { int startOption = 1; int optionLines = 0; char optionText[5][MAX_STRING_SIZE]; + int talkZone[5]; + int i; // Change NORMAL_INK -> TALK_NORMAL_INK @@ -1145,20 +1168,20 @@ int16 Talk::selectSentence() { // These bobs are up and down arrows - BobSlot *bob1 = _graphics->bob(SENTENCE_BOB_1); - BobSlot *bob2 = _graphics->bob(SENTENCE_BOB_2); + BobSlot *arrowBobUp = _graphics->bob(ARROW_BOB_UP); + BobSlot *arrowBobDown = _graphics->bob(ARROW_BOB_DOWN); - bob1->x = 303 + 8 + scrollX; - bob1->y = 150 + 1; - bob1->frameNum = 3; - bob1->box.y2 = 199; - bob1->active = false; + arrowBobUp->x = 303 + 8 + scrollX; + arrowBobUp->y = 150 + 1; + arrowBobUp->frameNum = 3; + arrowBobUp->box.y2 = 199; + arrowBobUp->active = false; - bob2->x = 303 + scrollX; - bob2->y = 175; - bob2->frameNum = 4; - bob2->box.y2 = 199; - bob2->active = false; + arrowBobDown->x = 303 + scrollX; + arrowBobDown->y = 175; + arrowBobDown->frameNum = 4; + arrowBobDown->box.y2 = 199; + arrowBobDown->active = false; bool rezone = true; @@ -1166,11 +1189,12 @@ int16 Talk::selectSentence() { rezone = false; // Set zones for UP/DOWN text arrows when not English version - // XXX ClearZones(1); + + _logic->zoneClearAll(ZONE_SCREEN); if (_logic->language() != ENGLISH) { - // XXX SetZone(1,5,MAXTEXTLEN+1, 0,319,24); - // XXX SetZone(1,6,MAXTEXTLEN+1,25,319,49); + _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); } _graphics->textClear(151,199); @@ -1178,8 +1202,9 @@ int16 Talk::selectSentence() { int sentenceCount = 0; int yOffset = 1; - for (int i = startOption; i <= 4; i++) { - // XXX TALK_ZONE[I] = 0; + for (i = startOption; i <= 4; i++) { + talkZone[i] = 0; + if (_talkString[i][0] != '\0') { sentenceCount++; @@ -1187,27 +1212,29 @@ int16 Talk::selectSentence() { strcpy(temp, _talkString[i]); optionLines = splitOption(removeStar(temp), optionText); - if (yOffset < 5) - /* XXX SetZone( - 1, - I, - 0, - (yofs * 10) - PUSHUP, - (VersionStr[1] =='E') ? 319 : MAX_TEXT_WIDTH, - 10 * optionLines + (yOffset * 10) - PUSHUP) */; - - for (int j = 0; j < optionLines; j++) { - if (yOffset < 5) { - debug(0, "Draw text '%s'", optionText[j]); - _graphics->textSet( - (j == 0) ? 0 : 24, - 150 - PUSHUP + yOffset * 10, - optionText[j]); - } - yOffset++; + if (yOffset < 5) { + _logic->zoneSet( + ZONE_SCREEN, + i, + 0, + yOffset * LINE_HEIGHT - PUSHUP, + (_logic->language() == ENGLISH) ? 319 : MAX_TEXT_WIDTH, + (yOffset + optionLines) * LINE_HEIGHT - PUSHUP); + } + + int j; + for (j = 0; j < optionLines; j++) { + if (yOffset < 5) { + debug(0, "Draw text '%s'", optionText[j]); + _graphics->textSet( + (j == 0) ? 0 : 24, + 150 - PUSHUP + yOffset * LINE_HEIGHT, + optionText[j]); } + yOffset++; + } - // XXX TALK_ZONE[i] = sentenceCount; + talkZone[i] = sentenceCount; } } @@ -1216,8 +1243,8 @@ int16 Talk::selectSentence() { // Up and down dialogue arrows if (_logic->language() != ENGLISH) { - bob1->active = (startOption > 1); - bob2->active = (yOffset > 4); + arrowBobUp->active = (startOption > 1); + arrowBobDown->active = (yOffset > 4); } _input->clearKeyVerb(); @@ -1233,24 +1260,28 @@ int16 Talk::selectSentence() { _logic->update(); - // XXX zone = zone(1, mouseX, mouseY); + zone = _logic->zoneIn(ZONE_SCREEN, _input->mousePosX(), _input->mousePosY()); if (5 == zone || 6 == zone) { // XXX Arrow zones + debug(0, "Arrow zones"); } else { if (oldZone != zone) { // Changed zone, change text colors + int y; - if (zone > 0) { + debug(0, "Changed zone. oldZone = %i, zone = %i", + oldZone, zone); - // XXX for (int i = zones[1][zone].y1; i < zones[1][zone].y2; i += 10) - // XXX texts[i + 150].col = INK_JOE; + if (zone > 0) { + for (y = _logic->zoneBox(ZONE_SCREEN, zone).y1; y < _logic->zoneBox(ZONE_SCREEN, zone).y2; y += 10) + _graphics->textColor(y, INK_JOE); } if (oldZone > 0) { - // XXX for (int i = zones[1][oldZone].y1; i < zones[1][oldZone].y2; i += 10) - // XXX texts[i + 150].col = INK_TALK_NORMAL; + for (y = _logic->zoneBox(ZONE_SCREEN, oldZone).y1; y < _logic->zoneBox(ZONE_SCREEN, oldZone).y2; y += 10) + _graphics->textColor(y, INK_TALK_NORMAL); } oldZone = zone; @@ -1258,8 +1289,26 @@ int16 Talk::selectSentence() { } - // XXX make the loop exit as we can't get any input yet - selectedSentence = 1; + int mouseButton = _input->mouseButton(); + _input->clearMouseButton(); + + if (_input->keyVerb().isDigit()) { + for (i = 1; i <= 4; i++) + { + if (talkZone[i] == _input->keyVerb().digit()) + { + selectedSentence = i; + break; + } + } + + _input->clearKeyVerb(); + } + else if (mouseButton) { + selectedSentence = zone; + break; + } + } // while() } } @@ -1267,7 +1316,7 @@ int16 Talk::selectSentence() { // XXX Begin debug stuff // debug(0, "----- Select a sentence of these -----"); - for (int i = 1; i <= 4; i++) { + for (i = 1; i <= 4; i++) { if (_talkString[i][0] != '\0') { // XXX debug(0, "%i: %s", i, _talkString[i]); if (!selectedSentence) @@ -1279,8 +1328,8 @@ int16 Talk::selectSentence() { debug(0, "Selected sentence %i", selectedSentence); - bob1->active = false; - bob2->active = false; + arrowBobUp->active = false; + arrowBobDown->active = false; if (selectedSentence > 0) { _graphics->textClear(0,198); diff --git a/queen/talk.h b/queen/talk.h index aee5f38016..a5ec14a11b 100644 --- a/queen/talk.h +++ b/queen/talk.h @@ -63,13 +63,17 @@ class Talk { private: //! Collection of constants used by Talk enum { + LINE_HEIGHT = 10, 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 + ZONE_SCREEN = 1, + ARROW_BOB_UP = 62, + ARROW_BOB_DOWN = 63, + ARROW_ZONE_UP = 5, + ARROW_ZONE_DOWN = 6 }; //! Special commands for speech @@ -113,6 +117,8 @@ class Talk { Resource *_resource; Sound *_sound; + bool _wasFullscren; + //! Raw .dog file data (without 20 byte header) byte *_fileData; diff --git a/queen/verb.h b/queen/verb.h index 05a94eaa0f..fc66e3d173 100644 --- a/queen/verb.h +++ b/queen/verb.h @@ -111,6 +111,10 @@ public: _verb <= VERB_DIGIT_LAST; } + int digit() const { + return (int)_verb - VERB_DIGIT_1 + 1; + } + bool isSkipText() const { return _verb == VERB_SKIP_TEXT; } |