[Scummvm-cvs-logs] CVS: scummvm/sky text.cpp,NONE,1.1 disk.cpp,1.15,1.16 module.mk,1.4,1.5 sky.cpp,1.10,1.11 sky.h,1.10,1.11

Joost Peters joostp at users.sourceforge.net
Sat Apr 5 10:02:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv18415/sky

Modified Files:
	disk.cpp module.mk sky.cpp sky.h 
Added Files:
	text.cpp 
Log Message:
Added text decoders + various other bits of code

--- NEW FILE: text.cpp ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummvm/sky/text.cpp,v 1.1 2003/04/05 18:01:29 joostp Exp $
 *
[...1886 lines suppressed...]

label_122:
	return '|';


	return '!'; //should never be reached
}

bool SkyState::getTBit(uint8 *inputValue, uint8 *shiftBits, byte *&inputStream) {
	
	if (*shiftBits) {
		(*shiftBits)--;
	} else {
		*inputValue = *inputStream++;
		*shiftBits = 7;
	} 
	
	return (bool)(((*inputValue) >> (*shiftBits)) & 1);
}


Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- disk.cpp	24 Mar 2003 10:55:57 -0000	1.15
+++ disk.cpp	5 Apr 2003 18:01:29 -0000	1.16
@@ -52,15 +52,7 @@
 	
 	debug(1, "Entries in dinner table: %d", dinnerTableEntries);
 
-	if (dinnerTableEntries < 400)
-		_isDemo = true;
-	else
-		_isDemo = false;
-	
-	if (dinnerTableEntries > 1600) 
-		_isCDVersion = true;
-	else
-		_isCDVersion = false;
+	determineGameVersion(dinnerTableEntries);
 		
 	dinnerTableArea = (uint8 *)malloc(dinnerTableEntries * 8);
 	entriesRead = dnrHandle->read(dinnerTableArea, 8 * dinnerTableEntries) / 8;
@@ -201,6 +193,55 @@
 
 	// if file not found return NULL
 	return (uint8 *)NULL;
+}
+
+void SkyState::determineGameVersion(uint32 dnrEntries) {
+
+	//determine game version based on number of entries in dinner table
+	
+	switch (dnrEntries) {
+
+	case 247:	
+		//floppy demo (v0.0267)
+		_isDemo = true;
+		_isCDVersion = false;
+		_gameVersion = 267;
+		break;
+		
+	case 1404:
+		//floppy (v0.0288)
+		_isDemo = false;
+		_isCDVersion = false;
+		_gameVersion = 288;
+		break;
+	
+	case 1445:
+		//floppy (v0.0331)
+		_isDemo = false;
+		_isCDVersion = false;
+		_gameVersion = 331;
+		break;
+	
+	case 1711:
+		//cd demo (v0.0365)
+		_isDemo = true;
+		_isCDVersion = true;
+		_gameVersion = 365;
+		break;
+		
+	case 5099:
+		//cd (v0.0368)
+		_isDemo = false;
+		_isCDVersion = true;
+		_gameVersion = 368;
+		break;
+	
+	default:
+		//unknown version
+		warning("Unknown game version!");
+		break;
+	}
+	
 }
 
 void SkyState::dumpFile(uint16 fileNr) {

Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/module.mk,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- module.mk	11 Mar 2003 18:32:56 -0000	1.4
+++ module.mk	5 Apr 2003 18:01:29 -0000	1.5
@@ -5,6 +5,7 @@
 	sky/disk.o \
 	sky/screen.o \
 	sky/timer.o \
+	sky/text.o \
 	sky/intro.o \
 	sky/cd_intro.o \
 	sky/rnc_deco.o \

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- sky.cpp	12 Mar 2003 16:54:29 -0000	1.10
+++ sky.cpp	5 Apr 2003 18:01:29 -0000	1.11
@@ -83,7 +83,7 @@
 		_dump_file = stdout;
 
 	initialise();
-	if (!_isDemo)
+	if (!_isDemo || _isCDVersion)
 		intro();
 	
 	while (1) {
@@ -100,10 +100,39 @@
 	_sound = new SkySound(_mixer);
 
 	initialiseDisk();
+	setupVersionSpecifics(_gameVersion);	//_gameVersion is initialised in initialiseDisk();
 	initialiseScreen();
 	initVirgin();
 	//initMouse();
+	initItemList();
+	//initScript();
 	initialiseGrids();
+	//initialiseRouter();
+	initialiseText();
+}
+
+void SkyState::initItemList() {
+	
+	//See List.asm for (cryptic) item # descriptions
+
+	for (int i = 0; i < 300; i++)
+		_itemList[i] = (void*)NULL;
+
+	//init the non-null items
+	/*
+	_itemList[119] = (void*)data_0; // Compacts - Section 0
+	_itemList[120] = (void*)data_1; // Compacts - Section 1
+	
+	if (_isDemo) {
+		_itemList[121] = _itemList[122] = _itemList[123] = _itemList[124] = _itemList[125] = (void*)data_0;
+	} else {
+		_itemList[121] = (void*)data_2; // Compacts - Section 2
+		_itemList[122] = (void*)data_3; // Compacts - Section 3
+		_itemList[123] = (void*)data_4; // Compacts - Section 4
+		_itemList[124] = (void*)data_5; // Compacts - Section 5
+		_itemList[125] = (void*)data_6; // Compacts - Section 6
+	}
+	*/
 }
 
 void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp

Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- sky.h	24 Mar 2003 10:55:58 -0000	1.10
+++ sky.h	5 Apr 2003 18:01:29 -0000	1.11
@@ -33,6 +33,7 @@
 	void errorString(const char *buf_input, char *buf_output);
 protected:
 	byte _game;
+	uint32 _gameVersion;
 	bool _isCDVersion;
 	bool _isDemo;
 	byte _key_pressed;
@@ -40,6 +41,30 @@
 	uint32 _tseqFrames;
 	byte *_tseqData;
 	uint32 _tseqCounter;
+
+	void *_itemList[300];
+	uint8 _textBuffer[1024];
+	uint32	_dtLineWidth;	//width of line in pixels
+	uint32	_dtLines;	//no of lines to do
+	uint32	_dtLineSize;	//size of one line in bytes
+	uint8	*_dtData;	//address of textdata
+	uint32	_dtLetters;	//no of chars in message
+	uint8	*_dtText;	//pointer to text
+	uint32	_dtCharSpacing;	//character seperation adjustment
+	uint32	_dtWidth;	//width of chars in last line (for editing (?))
+	uint32	_dtCentre;	//set for centre text
+	uint8	*_mouseTextData;	//space for the mouse text
+
+	struct charSet {
+		uint8 *addr;
+		uint32 charHeight;
+		uint32 thirdVal;
+	} _mainCharacterSet, _linkCharacterSet, _controlCharacterSet;	
+	
+	uint32	_curCharSet;
+	uint32	_characterSet;
+	uint32	_charHeight;
+	uint8	*_preAfterTableArea;
 	
 	uint16 _debugMode;
 	uint16 _debugLevel;
@@ -86,11 +111,22 @@
 	void go();
 	void convertPalette(uint8 *inpal, uint8* outpal);
 
+	void determineGameVersion(uint32 dnrEntries);
+	void setupVersionSpecifics(uint32 version);
 	void initialise();
 	void initTimer();
 	void initialiseDisk();
 	void initialiseScreen();
 	void initialiseGrids();
+	void initItemList();
+	void initialiseText();
+	void fnSetFont(uint32 fontNr);
+	void getText(uint32 textNr);
+	char (SkyState::*getTextChar)(uint8 *, uint8 *, uint8 *&);
+	char getTextChar_v00267(uint8 *inputValue, uint8 *shiftBits, uint8 *&inputStream);
+	char getTextChar_v00288(uint8 *inputValue, uint8 *shiftBits, uint8 *&inputStream);
+	char getTextChar_v00368(uint8 *inputValue, uint8 *shiftBits, uint8 *&inputStream);
+	bool getTBit(uint8 *inputValue, uint8 *shiftBits, byte *&inputStream);
 	void setPalette(uint8 *pal);
 	void fnFadeDown(uint8 action);
 	void palette_fadedown_helper(uint32 *pal, uint num);





More information about the Scummvm-git-logs mailing list