[Scummvm-cvs-logs] CVS: scummvm/sky compact.cpp,1.11,1.12 disk.cpp,1.28,1.29 logic.cpp,1.93,1.94 screen.cpp,1.28,1.29 sound.cpp,1.13,1.14 sound.h,1.7,1.8 struc.h,1.10,1.11 text.cpp,1.31,1.32 text.h,1.19,1.20

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Jun 8 19:34:04 CEST 2003


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

Modified Files:
	compact.cpp disk.cpp logic.cpp screen.cpp sound.cpp sound.h 
	struc.h text.cpp text.h 
Log Message:
some talk-related bugs fixed

Index: compact.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- compact.cpp	31 May 2003 16:25:15 -0000	1.11
+++ compact.cpp	9 Jun 2003 02:33:26 -0000	1.12
@@ -20,6 +20,12 @@
  */
 
 #include "stdafx.h"
+#ifdef _MSC_VER
+// disable warning "truncation of constant value". Some signed
+// fields of the structs are saved as unsigned in the .h files
+#pragma warning(disable : 4309) 
+#endif
+
 #include "sky/compact.h"
 
 #include "sky/compacts/0compact.h"
@@ -36,6 +42,10 @@
 #include "sky/compacts/linc_gen.h"
 #include "sky/compacts/lincmenu.h"
 #include "sky/compacts/z_compac.h"
+
+#ifdef _MSC_VER
+#pragma warning(default : 4309) 
+#endif
 
 #define COMPACT_SIZE (sizeof(compactOffsets)/sizeof(uint32))
 #define EXTCOMPACT_SIZE (sizeof(extCompactOffsets)/sizeof(uint32))

Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- disk.cpp	5 Jun 2003 19:45:27 -0000	1.28
+++ disk.cpp	9 Jun 2003 02:33:26 -0000	1.29
@@ -351,7 +351,7 @@
 		if (_loadedFilesList[cnt] == fileNum) return ;
 		cnt++;
 	}
-	_loadedFilesList[cnt] = fileNum;
+	_loadedFilesList[cnt] = fileNum & 0x7FFFU;
 	_loadedFilesList[cnt + 1] = 0;
 	SkyState::_itemList[fileNum & 2047] = (void**)loadFile(fileNum, NULL);
 }

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- logic.cpp	6 Jun 2003 20:54:50 -0000	1.93
+++ logic.cpp	9 Jun 2003 02:33:27 -0000	1.94
@@ -1594,22 +1594,27 @@
 		uint16 width = ((dataFileHeader *)data)->s_width;
 		width >>= 1;
 
-		for (uint16 i = height; i > 0; i--) {
-			for (uint16 j = width; j > 0; j--) {
+		data += sizeof(dataFileHeader);
+
+        width--;
+		for (uint16 i = 0; i < height; i++) {
+			for (uint16 j = 0; j < width; j++) {
 				if (!*data) // only change 0's
 					*data = 1;
-				*data += 2;
+				data += 2;
 			}
 			data++;
 		}
 
-		_compact->getToFlag = (uint16)(textNum & 0xffff);
-		_compact->downFlag = (uint16)(*p++ & 0xffff); // get animation number
+		Compact *textCompact = SkyState::fetchCompact(lowText.compactNum);
 
-		_compact->status |= ST_MOUSE; // mouse detects
+		textCompact->getToFlag = (uint16)textNum;
+		textCompact->downFlag = (uint16)*p++; // get animation number
 
-		_compact->xcood = TOP_LEFT_X; // set coordinates
-		_compact->ycood = ycood;
+		textCompact->status |= ST_MOUSE; // mouse detects
+
+		textCompact->xcood = TOP_LEFT_X; // set coordinates
+		textCompact->ycood = ycood;
 		ycood += 12;
 	}
 
@@ -1623,7 +1628,13 @@
 }
 
 bool SkyLogic::fnHighlight(uint32 itemNo, uint32 pen, uint32 c) {
-	error("Stub: fnHighlight");
+	pen -= 11;
+	pen ^= 1;
+	pen += 241;
+	Compact *textCompact = SkyState::fetchCompact(itemNo);
+	uint8 *sprData = (uint8*)SkyState::fetchItem(textCompact->flag);
+	_skyText->changeTextSpriteColour(sprData, (uint8)pen);
+	return true;
 }
 
 bool SkyLogic::fnTextKill(uint32 a, uint32 b, uint32 c) {
@@ -2224,7 +2235,7 @@
 }
 
 bool SkyLogic::fnStopFx(uint32 a, uint32 b, uint32 c) {
-	warning("Stub: fnStopFx");
+	_skySound->fnStopFx();
 	return true;
 }
 
@@ -2253,12 +2264,12 @@
 }
 
 bool SkyLogic::fnPauseFx(uint32 a, uint32 b, uint32 c) {
-	warning("Stub: fnPauseFx");
+	_skySound->fnPauseFx();
 	return true;
 }
 
 bool SkyLogic::fnUnPauseFx(uint32 a, uint32 b, uint32 c) {
-	warning("Stub: fnUnPauseFx");
+	_skySound->fnUnPauseFx();
 	return true;
 }
 
@@ -2278,9 +2289,12 @@
 	else 	//then it must be a value
 		animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]);
 	
-	target->offset = *animPtr++;
-	target->getToFlag = *animPtr++;
-	target->grafixProg = animPtr;
+	if (animPtr) {
+		target->offset = *animPtr++;
+		target->getToFlag = *animPtr++;
+		target->grafixProg = animPtr;
+	} else
+		target->grafixProg = 0;
 
 	if (SkyState::isCDVersion())
 		_skySound->fnStartSpeech((uint16)textNum);
@@ -2295,7 +2309,8 @@
 	//create the x coordinate for the speech text
 	//we need the talkers sprite information
 
-	_compact->screen = target->screen;	//put our screen in
+	//_compact->screen = target->screen;	
+	textCompact->screen = target->screen;	//put our screen in
 
 	if (_scriptVariables[SCREEN] == target->screen) { // Only use coordinates if we are on the current screen 
 		//talking on-screen
@@ -2326,7 +2341,7 @@
 	} else {
 		//talking off-screen
 		target->extCompact->spTextId = 0; 	//don't kill any text 'cos none was made
-		_compact->status = 0;	//don't display text
+		textCompact->status = 0;	//don't display text
 		//_logicTalkButtonRelease = 1; 
 	}
 	// In CD version, we're doing the timing by checking when the VOC has stopped playing.

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/screen.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- screen.cpp	6 Jun 2003 17:59:22 -0000	1.28
+++ screen.cpp	9 Jun 2003 02:33:27 -0000	1.29
@@ -560,7 +560,6 @@
 					uint8 *toBeDrawn = (uint8*)SkyState::fetchItem(spriteData->frame >> 6);
 					if (!toBeDrawn) {
 						printf("Spritedata %d not loaded!\n",spriteData->frame >> 6);
-						getchar();
 						spriteData->status = 0;
 					} else {
 						drawSprite(toBeDrawn, spriteData);
@@ -570,7 +569,7 @@
 					}
 				}
 			}
-			if (drawList[0] == 0xFFFF)
+			while (drawList[0] == 0xFFFF)
 				drawList = (uint16*)SkyState::fetchCompact(drawList[1]);
 		}
 	}
@@ -641,7 +640,7 @@
 	}
 	
 	for (uint8 cnty = 0; cnty < _sprHeight; cnty++) {
-		for (uint8 cntx = 0; cntx < _sprWidth; cntx++)
+		for (uint16 cntx = 0; cntx < _sprWidth; cntx++)
 			if (spriteData[cntx + _maskX1]) screenPtr[cntx] = spriteData[cntx + _maskX1];
 		spriteData += _sprWidth + _maskX2 + _maskX1;
 		screenPtr += GAME_SCREEN_WIDTH;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sound.cpp	2 Jun 2003 03:30:41 -0000	1.13
+++ sound.cpp	9 Jun 2003 02:33:27 -0000	1.14
@@ -1014,6 +1014,7 @@
 	_bgSoundHandle = 0;
 	_ingameSound = 0;
 	_ingameSpeech = 0;
+	_sfxPaused = false;
 }
 
 SkySound::~SkySound(void) {
@@ -1093,8 +1094,14 @@
 	_mixer->playRaw(&_ingameSound, _soundData + dataOfs, dataSize, sampleRate, flags);
 }
 
+void SkySound::fnPauseFx(void) {
+
+	if (_ingameSound) _mixer->stop(_ingameSound - 1);
+	_sfxPaused = true;
+}
+
 bool SkySound::fnStartFx(uint32 sound) {
-	if (sound < 256 || sound > MAX_FX_NUMBER)
+	if (sound < 256 || sound > MAX_FX_NUMBER || _sfxPaused)
 		return true;
 
 	uint8 screen = (uint8)(SkyLogic::_scriptVariables[SCREEN] & 0xff);
@@ -1116,7 +1123,7 @@
 
 	// get fx volume
 
-	uint8 volume = 0x7f; // start with max vol
+	uint8 volume = 0x40; // start with max vol
 
 	if (!SkyState::isCDVersion()) {
 		// as long as we can't set the volume for sfx without changing the speech volume,

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sound.h	2 Jun 2003 03:30:41 -0000	1.7
+++ sound.h	9 Jun 2003 02:33:27 -0000	1.8
@@ -52,6 +52,9 @@
 	bool fnStartFx(uint32 sound);
 	void fnStartSpeech(uint16 textNum);
 	bool speechFinished(void) { return _ingameSpeech == 0; };
+	void fnPauseFx(void);
+	void fnUnPauseFx(void) { _sfxPaused = false; };
+	void fnStopFx(void) { if (_ingameSound) _mixer->stop(_ingameSound - 1); };
 
 private:
 	SkyDisk *_skyDisk;
@@ -59,6 +62,7 @@
 	uint16 _sfxBaseOfs;
 	uint8 *_soundData;
 	uint8 *_sampleRates, *_sfxInfo;
+	bool _sfxPaused;
 
 	static uint16 _speechConvertTable[8];
 };

Index: struc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/struc.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- struc.h	29 Apr 2003 22:33:13 -0000	1.10
+++ struc.h	9 Jun 2003 02:33:27 -0000	1.11
@@ -43,8 +43,8 @@
 	uint16 s_sp_size;
 	uint16 s_tot_size;
 	uint16 s_n_sprites;
-	uint16 s_offset_x;
-	uint16 s_offset_y;
+	int16 s_offset_x;
+	int16 s_offset_y;
 	uint16 s_compressed_size;
 };
 
@@ -134,8 +134,8 @@
 	uint16 mouseOff;
 	uint16 mouseClick; // dword script
 
-	uint16 mouseRelX;
-	uint16 mouseRelY;
+	int16 mouseRelX;
+	int16 mouseRelY;
 	uint16 mouseSizeX;
 	uint16 mouseSizeY;
 

Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- text.cpp	6 Jun 2003 13:44:49 -0000	1.31
+++ text.cpp	9 Jun 2003 02:33:27 -0000	1.32
@@ -408,7 +408,14 @@
 	ret.compactNum = (uint16)compactNum;
 
 	return ret;
+}
+
+void SkyText::changeTextSpriteColour(uint8 *sprData, uint8 newCol) {
 
+	dataFileHeader *header = (dataFileHeader*)sprData;
+	sprData += sizeof(dataFileHeader);
+	for (uint16 cnt = 0; cnt < header->s_sp_size; cnt++)
+		if (sprData[cnt] < 241) sprData[cnt] = newCol;
 }
 
 static const HuffTree huffTree_00267[] = {

Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- text.h	5 Jun 2003 18:54:26 -0000	1.19
+++ text.h	9 Jun 2003 02:33:27 -0000	1.20
@@ -44,6 +44,7 @@
 	void fnTextModule(uint32 textInfoId, uint32 textNo);
 	void fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY);
 	void logicCursor(Compact *textCompact, uint16 mouseX, uint16 mouseY);
+	void changeTextSpriteColour(uint8 *sprData, uint8 newCol);
 
 protected:
 	bool getTBit();





More information about the Scummvm-git-logs mailing list