[Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.9,1.10 logic.cpp,1.77,1.78 logic.h,1.58,1.59 queen.cpp,1.32,1.33 talk.cpp,1.29,1.30 talk.h,1.17,1.18

David Eriksson twogood at users.sourceforge.net
Thu Nov 6 13:07:02 CET 2003


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

Modified Files:
	command.cpp logic.cpp logic.h queen.cpp talk.cpp talk.h 
Log Message:
- Improved talking
- Lots of small fixes


Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- command.cpp	6 Nov 2003 08:53:09 -0000	1.9
+++ command.cpp	6 Nov 2003 21:06:00 -0000	1.10
@@ -1518,10 +1518,12 @@
 	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 {

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- logic.cpp	6 Nov 2003 15:47:37 -0000	1.77
+++ logic.cpp	6 Nov 2003 21:06:00 -0000	1.78
@@ -393,7 +393,11 @@
 
 
 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 @@
 	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 @@
 	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);
 	}

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- logic.h	6 Nov 2003 17:54:59 -0000	1.58
+++ logic.h	6 Nov 2003 21:06:00 -0000	1.59
@@ -363,7 +363,7 @@
 	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

Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- queen.cpp	6 Nov 2003 08:44:33 -0000	1.32
+++ queen.cpp	6 Nov 2003 21:06:01 -0000	1.33
@@ -131,6 +131,7 @@
 		// 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 @@
 			
 			_logic->playCutaway("cred.cut");
 		}
+#endif
 
 		_logic->currentRoom(ROOM_HOTEL_LOBBY);
 		_logic->entryObj(584);

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- talk.cpp	6 Nov 2003 08:44:33 -0000	1.29
+++ talk.cpp	6 Nov 2003 21:06:01 -0000	1.30
@@ -299,8 +299,46 @@
 	}
 
 // 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::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 @@
 	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 @@
 
 	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 @@
 
 		// 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 @@
 
 				if (yOffset < 5) {
 					_logic->zoneSet(
-							ZONE_SCREEN,
+							ZONE_PANEL,
 							i,
 							0,
 							yOffset * LINE_HEIGHT - PUSHUP,
@@ -1260,7 +1300,7 @@
 
 				_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 @@
 								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);
 						}
 

Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- talk.h	6 Nov 2003 08:44:33 -0000	1.17
+++ talk.h	6 Nov 2003 21:06:01 -0000	1.18
@@ -69,7 +69,6 @@
 	  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,11 +130,21 @@
 	//! 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;





More information about the Scummvm-git-logs mailing list