[Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.7,1.8 cutaway.cpp,1.48,1.49 cutaway.h,1.23,1.24 display.h,1.16,1.17 graphics.cpp,1.40,1.41 graphics.h,1.34,1.35 logic.cpp,1.75,1.76 logic.h,1.55,1.56 queen.cpp,1.31,1.32 talk.cpp,1.28,1.29 talk.h,1.16,1.17 verb.h,1.3,1.4

David Eriksson twogood at users.sourceforge.net
Thu Nov 6 00:45:08 CET 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv26231/queen

Modified Files:
	command.cpp cutaway.cpp cutaway.h display.h graphics.cpp 
	graphics.h logic.cpp logic.h queen.cpp talk.cpp talk.h verb.h 
Log Message:
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.


Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- command.cpp	5 Nov 2003 10:09:54 -0000	1.7
+++ command.cpp	6 Nov 2003 08:44:33 -0000	1.8
@@ -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::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;
 }
 

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- cutaway.cpp	3 Nov 2003 03:42:20 -0000	1.48
+++ cutaway.cpp	6 Nov 2003 08:44:33 -0000	1.49
@@ -33,25 +33,14 @@
 /*
    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 @@
 	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 @@
 
 	_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 @@
 	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::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 @@
 
 	//debug(0, "[Cutaway::getCutawayAnim] header=%i", header);
 
-
 	anim.currentFrame = 0;
 	anim.originalFrame = 0;
 
@@ -701,7 +702,8 @@
 		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::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 @@
 #endif 
 	} // for()
 
-	goToFinalRoom();
+	stop();
 
 	_input->cutawayQuitReset();
 
@@ -1165,14 +1172,71 @@
 
 	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 @@
 		/* XXX playsong(_lastSong) */ ;
 }
 
-void Cutaway::goToFinalRoom() {
+void Cutaway::stop() {
 	// Lines 1901-2032 in cutaway.c
 	byte *ptr = _gameStatePtr;
 
@@ -1201,14 +1265,17 @@
 
 	// 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 @@
 
 	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;
 
-			// XXX int bob = _logic->findBob(objectIndex);
+			int bobIndex = _logic->findBob(objectIndex);
+			ObjectData *object = _logic->objectData(objectIndex);
 
-			if (from > 0) {
-				// XXX
+			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 (_logic->currentRoom() == room)
+					_logic->roomRefreshObject(objectIndex);
 			}
 
-			ObjectData *objectData = _logic->objectData(objectIndex);
+			if (_logic->currentRoom() == object->room) {
+				BobSlot *pbs = _graphics->bob(bobIndex);
 
-			if (objectData->room == room) {
-				// XXX
+				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 (objectFrame == 1000) {
+						_graphics->bobClear(bobIndex);
+					}
+					else if (objectFrame) {
+						_graphics->bankUnpack(abs(frame), objectFrame, bank);
+						pbs->frameNum = objectFrame;
+						if (frame < 0)
+							pbs->xflip = true;
+							
+					}
+				}
 			}
 		} // for()
 		

Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cutaway.h	31 Oct 2003 13:47:27 -0000	1.23
+++ cutaway.h	6 Nov 2003 08:44:33 -0000	1.24
@@ -259,8 +259,8 @@
 		//! 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();

Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- display.h	1 Nov 2003 21:20:36 -0000	1.16
+++ display.h	6 Nov 2003 08:44:33 -0000	1.17
@@ -99,6 +99,7 @@
 	void horizontalScroll(int16 scroll);
 	int16 horizontalScroll() const { return _horizontalScroll; }
 
+	void fullscreen(bool fs) { _fullscreen = fs; }
 	bool fullscreen() const { return _fullscreen; }
 
 	void handleTimer();

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- graphics.cpp	2 Nov 2003 20:56:33 -0000	1.40
+++ graphics.cpp	6 Nov 2003 08:44:33 -0000	1.41
@@ -565,6 +565,13 @@
 }
 
 
+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)

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- graphics.h	1 Nov 2003 20:45:45 -0000	1.34
+++ graphics.h	6 Nov 2003 08:44:33 -0000	1.35
@@ -134,6 +134,7 @@
 	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 @@
 	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

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- logic.cpp	4 Nov 2003 19:51:31 -0000	1.75
+++ logic.cpp	6 Nov 2003 08:44:33 -0000	1.76
@@ -1804,6 +1804,16 @@
 }
 
 
+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];

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- logic.h	4 Nov 2003 13:51:36 -0000	1.55
+++ logic.h	6 Nov 2003 08:44:33 -0000	1.56
@@ -185,6 +185,7 @@
 	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 @@
 
 	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;

Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- queen.cpp	4 Nov 2003 19:51:31 -0000	1.31
+++ queen.cpp	6 Nov 2003 08:44:33 -0000	1.32
@@ -196,7 +196,7 @@
 			_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 @@
 				_logic->checkPlayer();
 			}
 		}
-		break; // XXX don't loop yet
 	}
 }
 

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- talk.cpp	30 Oct 2003 10:56:38 -0000	1.28
+++ talk.cpp	6 Nov 2003 08:44:33 -0000	1.29
@@ -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 @@
 	// XXX }
 	// XXX panelflag=0;
 
+	_wasFullscren = _logic->display()->fullscreen();
+	_logic->display()->fullscreen(true);
 
-	
 	load(filename);
 
 	Person person;
@@ -295,6 +297,26 @@
 			}
 		}
 	}
+
+// 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 @@
 				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 @@
 	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 @@
 
 	// 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 @@
 		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 @@
 		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 @@
 				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) */;
+				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);
+				}
 
-					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++;
+				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 @@
 		// 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 @@
 
 				_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 @@
 
 				}
 
-				// 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 @@
 
 	// 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 @@
 
 	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);

Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- talk.h	29 Oct 2003 21:04:12 -0000	1.16
+++ talk.h	6 Nov 2003 08:44:33 -0000	1.17
@@ -63,13 +63,17 @@
   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
@@ -112,6 +116,8 @@
 	Logic     *_logic;
 	Resource  *_resource;
 	Sound     *_sound;
+
+	bool _wasFullscren;
 
 	//! Raw .dog file data (without 20 byte header)
 	byte *_fileData;

Index: verb.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/verb.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- verb.h	30 Oct 2003 18:19:03 -0000	1.3
+++ verb.h	6 Nov 2003 08:44:33 -0000	1.4
@@ -111,6 +111,10 @@
 			_verb <= VERB_DIGIT_LAST;
 	}
 
+  int digit() const {
+    return (int)_verb - VERB_DIGIT_1 + 1;
+  }
+
 	bool isSkipText() const {
 		return _verb == VERB_SKIP_TEXT;
 	}





More information about the Scummvm-git-logs mailing list