[Scummvm-cvs-logs] CVS: scummvm/sky compact.cpp,1.16,1.17 compact.h,1.8,1.9 control.cpp,1.53,1.54 control.h,1.23,1.24 logic.cpp,1.130,1.131 mouse.h,1.18,1.19 skydefs.h,1.24,1.25 struc.h,1.11,1.12

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Aug 3 10:18:02 CEST 2003


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

Modified Files:
	compact.cpp compact.h control.cpp control.h logic.cpp mouse.h 
	skydefs.h struc.h 
Log Message:
new compacts, new loading + saving code (not compatible to old one)

Index: compact.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- compact.cpp	31 Jul 2003 18:35:01 -0000	1.16
+++ compact.cpp	3 Aug 2003 17:17:24 -0000	1.17
@@ -47,7 +47,43 @@
 #define MK32_A5(type, item) MK32(type, item[0]), MK32(type, item[1]), \
 	MK32(type, item[2]), MK32(type, item[3]), MK32(type, item[4])
 
+namespace SkyTalkAnims {
+	extern bool animTalkTableIsPointer[];
+	extern uint16 animTalkTableVal[];
+	extern void *animTalkTablePtr[];
+};
+
 namespace SkyCompact {
+
+uint16 *getGrafixPtr(Compact *cpt) {
+	uint16 *buf;
+	switch (cpt->grafixProg.ptrType) {
+		case PTR_NULL:
+			return NULL;
+		case AUTOROUTE:
+			if (!cpt->extCompact)
+				error("::getGrafixPtr: request for AR pointer, extCompact is NULL, though.");
+			return (cpt->extCompact->animScratch + cpt->grafixProg.pos);
+		case COMPACT:
+			buf = (uint16*)SkyState::fetchCompact(cpt->grafixProg.ptrTarget);
+			if (buf == NULL)
+				error("::getGrafixPtr: request for cpt %d pointer. It's NULL.", cpt->grafixProg.ptrTarget);
+			return (buf + cpt->grafixProg.pos);
+		case COMPACTELEM:
+			buf = *(uint16 **)SkyCompact::getCompactElem(cpt, cpt->grafixProg.ptrTarget);
+			if (buf == NULL)
+				error("::getGrafixPtr: request for elem ptr %d. It's NULL.", cpt->grafixProg.ptrTarget);
+			return buf + cpt->grafixProg.pos;
+		case TALKTABLE:
+			buf = (uint16 *)SkyTalkAnims::animTalkTablePtr[cpt->grafixProg.ptrTarget];
+			if (buf == NULL)
+				warning("::getGrafixPtr: request for TT ptr %d -> NULL", cpt->grafixProg.ptrTarget);
+			return buf + cpt->grafixProg.pos;
+		default:
+			error("::getGrafixPtr: unknown grafixProg type for Compact cpt");
+	}
+	return NULL; // never reached
+}
 
 /**
  * Returns the n'th mega set specified by \a megaSet from Compact \a cpt.

Index: compact.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- compact.h	3 Jul 2003 17:17:32 -0000	1.8
+++ compact.h	3 Aug 2003 17:17:24 -0000	1.9
@@ -30,6 +30,7 @@
 	MegaSet *getMegaSet(Compact *cpt, uint16 megaSet);
 	uint16 **getTurnTable(Compact *cpt, uint16 megaSet, uint16 dir);
 	uint16 *getSub(Compact *cpt, uint16 mode);
+	uint16 *getGrafixPtr(Compact *cpt);
 	void *getCompactElem(Compact *cpt, uint32 off);
 	void patchFor288(void);
 
@@ -3232,24 +3233,25 @@
 	extern uint16 retina_scan_cdt[];
 	extern Compact forklift_cpt;
 	extern void *data_0[];
-	extern uint8 babs_auto[];
-	extern uint8 burke_auto[];
-	extern uint8 dan_auto[];
-	extern uint8 foreman_auto[];
-	extern uint8 full_ss_auto[];
-	extern uint8 gal_auto[];
-	extern uint8 jobs_auto[];
-	extern uint8 joey_auto[];
-	extern uint8 ken_auto[];
-	extern uint8 lamb_auto[];
-	extern uint8 loader_auto[];
-	extern uint8 medi_auto[];
-	extern uint8 monitor_auto[];
-	extern uint8 radman_auto[];
-	extern uint8 shades_auto[];
-	extern uint8 spu_auto[];
-	extern uint8 ss_auto[];
-	extern uint8 wit_auto[];
+	extern uint16 babs_auto[];
+	extern uint16 burke_auto[];
+	extern uint16 dan_auto[];
+	extern uint16 foreman_auto[];
+	extern uint16 full_ss_auto[];
+	extern uint16 gal_auto[];
+	extern uint16 jobs_auto[];
+	extern uint16 joey_auto[];
+	extern uint16 ken_auto[];
+	extern uint16 lamb_auto[];
+	extern uint16 loader_auto[];
+	extern uint16 medi_auto[];
+	extern uint16 monitor_auto[];
+	extern uint16 radman_auto[];
+	extern uint16 shades_auto[];
+	extern uint16 spu_auto[];
+	extern uint16 ss_auto[];
+	extern uint16 wit_auto[];
+	extern uint16 minif_auto[];
 };
 
 #endif

Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- control.cpp	2 Aug 2003 00:36:38 -0000	1.53
+++ control.cpp	3 Aug 2003 17:17:24 -0000	1.54
@@ -1128,37 +1128,13 @@
 	// anims, stands, turnTable
 }
 
-void SkyControl::stosGrafStr(uint8 **destPos, Compact *cpt) {
-	uint16 strLen = 0;
-	uint16 *src = cpt->grafixProg;
-	if ((cpt->logic == L_AR_ANIM) || (cpt->logic == L_TURNING)) {
-		if ((!src[0]) && (!src[2])) {
-			strLen = 3;
-		} else {
-			if (!src[0])
-		        strLen += 2;
-			while (src[strLen])
-				strLen += 2;
-		}
-	} else if ((cpt->logic == L_MOD_ANIMATE) || (cpt->logic == L_TALK) || 
-		(cpt->logic == L_LISTEN) || (cpt->logic == L_FRAMES)) {
-		while (src[strLen])
-			strLen += 3; // start fx, sendsync and coordinates are all 3 words each.
-	} else {
-		while (src[strLen])  // this *could* lead to problems... but I can't think
-			strLen++;        // of a way to find the end of the graphics data if
-	}                        // the compact isn't in any special graphic mode.
-	strLen++;
-	STOSW(*destPos, strLen);
-	for (uint16 cnt = 0; cnt < strLen; cnt++) {
-		STOSW(*destPos, src[cnt]);
-	}
-}
-
 void SkyControl::stosStr(uint8 **destPos, Compact *cpt, uint16 type) {
 	uint16 strLen = 0;
-	if (type & SAVE_GRAFX)
-		stosGrafStr(destPos, cpt);
+	if (type & SAVE_GRAFX) {
+		STOSW(*destPos, cpt->grafixProg.ptrType);
+		STOSW(*destPos, cpt->grafixProg.ptrTarget);
+		STOSW(*destPos, cpt->grafixProg.pos);
+	}
 
 	if (type & SAVE_TURNP) {
 		uint16 *src = cpt->extCompact->turnProg;
@@ -1169,7 +1145,7 @@
 		for (uint16 cnt = 0; cnt < strLen; cnt++) {
 			STOSW(*destPos, src[cnt]);
 		}
-	}	
+	}
 }
 
 void SkyControl::stosCompact(uint8 **destPos, Compact *cpt) {
@@ -1182,7 +1158,8 @@
 		if (cpt->extCompact->megaSet3) saveType |= SAVE_MEGA3;
 		if (cpt->extCompact->turnProg) saveType |= SAVE_TURNP;
 	}
-	if (cpt->grafixProg) saveType |= SAVE_GRAFX;
+	if (cpt->grafixProg.ptrType != PTR_NULL)
+		saveType |= SAVE_GRAFX;
 
 	STOSW(*destPos, saveType);
 
@@ -1279,6 +1256,11 @@
 	for (cnt = 0; cnt < ARRAYSIZE(_saveLoadCpts); cnt++)
 		stosCompact(&destPos, _saveLoadCpts[cnt]);
 
+	for (cnt = 0; cnt < ARRAYSIZE(_saveLoadARs); cnt++)
+		for (uint8 elemCnt = 0; elemCnt < 32; elemCnt++) {
+			STOSW(destPos, _saveLoadARs[cnt][elemCnt]);
+		}
+
 	for (cnt = 0; cnt < 3; cnt++)
 		STOSW(destPos, SkyCompact::park_table[cnt]);
 
@@ -1339,23 +1321,16 @@
 		error("Can't restore! SaveData is SAVE_MEGA3 for Compact");
 
 	if (saveType & SAVE_GRAFX) {
-		uint16 grafxLen;
-		LODSW(*srcPos, grafxLen);
-		//cpt->grafixProg = (uint16 *)malloc(grafxLen << 1);
-		/* hack: there's a theoretical possibility that the saving routine detected the
-		         end of the string incorrectly and forgot the end of the data.
-		         By adding 10 zero-words, the data should at least be correctly terminated
-				 (as all grafixProg data is 0-terminated), so if this condition really can
-				 occur, it should only lead to small graphic glitches, not to crashes.*/
-
-		cpt->grafixProg = (uint16 *)malloc((grafxLen << 1) + 20);
-		memset(cpt->grafixProg + grafxLen, 0, 20); 
-		appendMemList(cpt->grafixProg);
-		for (cnt = 0; cnt < grafxLen; cnt++) {
-			LODSW(*srcPos, cpt->grafixProg[cnt]);
-		}
-	} else
-		cpt->grafixProg = NULL;
+		uint16 tmp;
+		LODSW(*srcPos, tmp);
+		cpt->grafixProg.ptrType = (uint8)tmp;
+		LODSW(*srcPos, cpt->grafixProg.ptrTarget);
+		LODSW(*srcPos, cpt->grafixProg.pos);
+	} else {
+		cpt->grafixProg.ptrType = PTR_NULL;
+		cpt->grafixProg.ptrTarget = 0;
+		cpt->grafixProg.pos = 0;
+	}
 
 	if (saveType & SAVE_TURNP) {
 		uint16 turnLen;
@@ -1435,7 +1410,6 @@
 
 uint16 SkyControl::parseSaveData(uint8 *srcBuf) {
 
-	char loadText[] = "Savegame has an old version. Loading it can lead to errors.";
 	uint32 reloadList[60];
 	uint32 oldSection = SkyLogic::_scriptVariables[CUR_SECTION];
 	
@@ -1451,24 +1425,24 @@
 		return RESTORE_FAILED;
 	}
 
+	if (saveRev <= OLD_SAVEGAME_TYPE) {
+		warning("This savegame version is unsupported.");
+		return RESTORE_FAILED;
+	}
 	uint32 music, mouseType, palette, gameVersion;
 	
-	if (saveRev >= 3) {
-		LODSD(srcPos, gameVersion);
-		if (gameVersion != SkyState::_systemVars.gameVersion) {
-			if ((!SkyState::isCDVersion()) || (gameVersion < 365)) { // cd versions are compatible
-				printf("This savegame was created by Beneath a Steel Sky v0.0%03d\n", gameVersion);
-				printf("It cannot be loaded by this version (v0.0%3d)\n", SkyState::_systemVars.gameVersion);
-				return RESTORE_FAILED;
-			}
-		}
-		LODSW(srcPos, _skySound->_saveSounds[0]);
-		LODSW(srcPos, _skySound->_saveSounds[1]);
-		_skySound->restoreSfx();
-	} else {
-		if(!getYesNo(loadText))
+	LODSD(srcPos, gameVersion);
+	if (gameVersion != SkyState::_systemVars.gameVersion) {
+		if ((!SkyState::isCDVersion()) || (gameVersion < 365)) { // cd versions are compatible
+			printf("This savegame was created by Beneath a Steel Sky v0.0%03d\n", gameVersion);
+			printf("It cannot be loaded by this version (v0.0%3d)\n", SkyState::_systemVars.gameVersion);
 			return RESTORE_FAILED;
+		}
 	}
+	LODSW(srcPos, _skySound->_saveSounds[0]);
+	LODSW(srcPos, _skySound->_saveSounds[1]);
+	_skySound->restoreSfx();
+
 	freeMemList(); // memory from last restore isn't needed anymore
 	LODSD(srcPos, music);
 	LODSD(srcPos, _savedCharSet);
@@ -1484,6 +1458,11 @@
 	for (cnt = 0; cnt < ARRAYSIZE(_saveLoadCpts); cnt++)
 		lodsCompact(&srcPos, _saveLoadCpts[cnt]);
 
+	for (cnt = 0; cnt < ARRAYSIZE(_saveLoadARs); cnt++)
+		for (uint8 elemCnt = 0; elemCnt < 32; elemCnt++) {
+			LODSW(srcPos, _saveLoadARs[cnt][elemCnt]);
+		}
+
 	for (cnt = 0; cnt < 3; cnt++)
 		LODSW(srcPos, SkyCompact::park_table[cnt]);
 
@@ -1630,8 +1609,8 @@
 	return outBuf;
 }
 
-void SkyControl::applyDiff(uint16 *data, uint16 *diffData) {
-	for (uint16 cnt = 0; cnt < 206; cnt++) {
+void SkyControl::applyDiff(uint16 *data, uint16 *diffData, uint16 len) {
+	for (uint16 cnt = 0; cnt < len; cnt++) {
 		data += READ_LE_UINT16(diffData);
 		diffData++;
 		*data = *diffData;
@@ -1644,24 +1623,23 @@
 	if (SkyState::_systemVars.gameVersion <= 267)
 		return; // no restart for floppy demo
 
-	uint16 *resetData;
-	if (SkyState::isCDVersion())
-		resetData = lz77decode((uint16 *)_resetDataCd);
-	else {
-		resetData = lz77decode((uint16 *)_resetData288);
-		switch (SkyState::_systemVars.gameVersion) {
-			case 303:
-                applyDiff(resetData, (uint16*)_resetDiff303);
-				break;
-			case 331:
-				applyDiff(resetData, (uint16*)_resetDiff331);
-				break;
-			case 348:
-				applyDiff(resetData, (uint16*)_resetDiff348);
-				break;
-			default:
-				break;
-		}
+	uint16 *resetData = lz77decode((uint16 *)_resetData288);
+	switch (SkyState::_systemVars.gameVersion) {
+		case 303:
+			applyDiff(resetData, (uint16*)_resetDiff303, 206);
+			break;
+		case 331:
+			applyDiff(resetData, (uint16*)_resetDiff331, 206);
+			break;
+		case 348:
+			applyDiff(resetData, (uint16*)_resetDiff348, 206);
+			break;
+		case 365:
+		case 368:
+		case 372:
+			applyDiff(resetData, (uint16*)_resetDiffCd, 214);
+		default:
+			break;
 	}
 	// ok, we finally have our savedata
 

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- control.h	1 Aug 2003 00:15:05 -0000	1.23
+++ control.h	3 Aug 2003 17:17:24 -0000	1.24
@@ -112,7 +112,9 @@
 #define SAVE_GRAFX	32
 #define SAVE_TURNP	64
 
-#define SAVE_FILE_REVISION 3
+#define SAVE_FILE_REVISION 5
+// skipping revision 4, that one will be used for messy downward compatibility in 0.5.0 branch
+#define OLD_SAVEGAME_TYPE 3
 
 struct AllocedMem {
 	uint16 *mem;
@@ -210,7 +212,6 @@
 	uint16 saveGameToFile(void);
 	void stosMegaSet(uint8 **destPos, MegaSet *mega);
 	void stosCompact(uint8 **destPos, Compact *cpt);
-	void stosGrafStr(uint8 **destPos, Compact *cpt);
 	void stosStr(uint8 **destPos, Compact *cpt, uint16 type);
 	uint32 prepareSaveData(uint8 *destBuf);
 
@@ -223,13 +224,14 @@
 
 	const char *_savePath;
 	uint16 *lz77decode(uint16 *data);
-	void applyDiff(uint16 *data, uint16 *diffData);
+	void applyDiff(uint16 *data, uint16 *diffData, uint16 len);
 	static Compact *_saveLoadCpts[833]; //-----------------
-	static uint8 _resetData288[0x39F2];
+	static uint16 *_saveLoadARs[19];
+	static uint8 _resetData288[0x39B8];
 	static uint8 _resetDiff303[824];    // moved to sky/compacts/savedata.cpp
 	static uint8 _resetDiff331[824];
 	static uint8 _resetDiff348[824];
-	static uint8 _resetDataCd[0x3FDC];  //-----------------
+	static uint8 _resetDiffCd[856];  //-----------------
 
 	AllocedMem *_memListRoot;
 	void appendMemList(uint16 *pMem);

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- logic.cpp	3 Aug 2003 14:49:10 -0000	1.130
+++ logic.cpp	3 Aug 2003 17:17:24 -0000	1.131
@@ -146,8 +146,12 @@
 void SkyLogic::autoRoute() {
 	
 	_compact->downFlag = _skyAutoRoute->autoRoute(_compact);
-	if (!_compact->downFlag) // route ok
-		_compact->grafixProg = (uint16*)_compact->extCompact->animScratch;
+	if (!_compact->downFlag) { // route ok
+		_compact->grafixProg.pos = 0;
+		_compact->grafixProg.ptrTarget = 0;
+		_compact->grafixProg.ptrType = AUTOROUTE;
+		//_compact->grafixProg = (uint16*)_compact->extCompact->animScratch;
+	}
 
 	_compact->logic = L_SCRIPT; // continue the script
 
@@ -289,10 +293,12 @@
 	/// Extension of arAnim()
 	_compact->extCompact->waitingFor = 0; // clear possible zero-zero skip
 
-	uint16 *sequence = _compact->grafixProg;
+	//uint16 *sequence = _compact->grafixProg;
+	uint16 *sequence = SkyCompact::getGrafixPtr(_compact);
 	if (!*sequence) {
 		// ok, move to new anim segment
 		sequence += 2;
+		_compact->grafixProg.pos += 2;
 		if (!*sequence) { // end of route?
 			// ok, sequence has finished
 
@@ -305,7 +311,6 @@
 			return;
 		}
 
-		_compact->grafixProg = sequence;
 		_compact->extCompact->arAnimIndex = 0; // reset position
 	}
 
@@ -361,9 +366,11 @@
 void SkyLogic::anim() {
 	/// Follow an animation sequence
 
-	uint16 *grafixProg = _compact->grafixProg;
+	//uint16 *grafixProg = _compact->grafixProg;
+	uint16 *grafixProg = SkyCompact::getGrafixPtr(_compact);
 
 	while (*grafixProg) {
+		_compact->grafixProg.pos += 3; // all types are 3 words.
 		if (*grafixProg == LF_START_FX) { // do fx
 			grafixProg++;
 			uint16 sound = *grafixProg++;
@@ -382,7 +389,6 @@
 			_compact->ycood = *grafixProg++;
 
 			_compact->frame = *grafixProg++ | _compact->offset;
-			_compact->grafixProg = grafixProg;
 			return;
 		}
 	}
@@ -486,9 +492,9 @@
 					
 					SkyState::fetchCompact(_compact->extCompact->spTextId)->status = 0;
 				}
-				if (_compact->grafixProg) {
+				if (SkyCompact::getGrafixPtr(_compact)) {
 					_compact->frame = _compact->getToFlag; // set character to stand
-					_compact->grafixProg = NULL;
+					_compact->grafixProg.ptrType = PTR_NULL;
 				}
 
 				_compact->logic = L_SCRIPT;
@@ -503,16 +509,17 @@
 
 		_compact->logic = L_SCRIPT; // restart character control
 
-		if (_compact->grafixProg) {
+		if (SkyCompact::getGrafixPtr(_compact)) {
 			_compact->frame = _compact->getToFlag; // set character to stand
-			_compact->grafixProg = 0;
+			_compact->grafixProg.ptrType = PTR_NULL;
 		}
 
 		logicScript();
 		return;
 	}
 
-	uint16 *graphixProg = _compact->grafixProg; // no anim file?
+	//uint16 *graphixProg = _compact->grafixProg; // no anim file?
+	uint16 *graphixProg = SkyCompact::getGrafixPtr(_compact);
 	if (graphixProg) {
 		if ((*graphixProg) && ((_compact->extCompact->spTime != 3) || (!_skySound->speechFinished()))) {
 			// we will force the animation to finish 3 game cycles
@@ -520,11 +527,11 @@
 
 			_compact->frame = *(graphixProg + 2) + _compact->offset;
 			graphixProg += 3;
-			_compact->grafixProg = graphixProg;
+			_compact->grafixProg.pos += 3;
 		} else {
 			// we ran out of frames or finished speech, let actor stand still.
 			_compact->frame = _compact->getToFlag;
-			_compact->grafixProg = 0;
+			_compact->grafixProg.ptrType = PTR_NULL;
 		}
 	}
 
@@ -626,10 +633,11 @@
 void SkyLogic::simpleAnim() {
 	/// follow an animation sequence module whilst ignoring the coordinate data
 
-	uint16 *grafixProg = _compact->grafixProg;
+	uint16 *grafixProg = SkyCompact::getGrafixPtr(_compact);
 
 	// *grafix_prog: command
 	while (*grafixProg) {
+		_compact->grafixProg.pos += 3;
 		if (*grafixProg != SEND_SYNC) {
 			grafixProg++;
 			grafixProg++; // skip coordinates
@@ -640,8 +648,6 @@
 			else
 				_compact->frame = *grafixProg + _compact->offset;
 
-			grafixProg++;
-			_compact->grafixProg = grafixProg;
 			return;
 		}
 
@@ -1489,12 +1495,16 @@
 bool SkyLogic::fnSetToStand(uint32 a, uint32 b, uint32 c) {
 	_compact->mood = 1; // high level stood still
 
-	uint16 *standList = *(uint16 **)SkyCompact::getCompactElem(_compact, C_STAND_UP
-			+ _compact->extCompact->megaSet + _compact->extCompact->dir * 4); 
+	_compact->grafixProg.ptrType = COMPACTELEM;
+	_compact->grafixProg.pos = 0;
+	_compact->grafixProg.ptrTarget = 
+		 C_STAND_UP	+ _compact->extCompact->megaSet + _compact->extCompact->dir * 4;
 
-	_compact->offset = *standList++; // get frames offset
-	_compact->grafixProg = standList;
+	uint16 *standList = SkyCompact::getGrafixPtr(_compact);
+
+	_compact->offset = *standList; // get frames offset
 	_compact->logic = L_SIMPLE_MOD;
+	_compact->grafixProg.pos++;
 	simpleAnim();
 	return false; // drop out of script
 }
@@ -1981,32 +1991,48 @@
 }
 
 bool SkyLogic::fnRunAnimMod(uint32 animNo, uint32 b, uint32 c) {
-	uint16 *animation = (uint16 *)SkyState::fetchCompact(animNo);
-	uint16 sprite = *animation++; // get sprite set
-	_compact->offset = sprite;
-	_compact->grafixProg = animation;
+	_compact->grafixProg.ptrType = COMPACT;
+	_compact->grafixProg.ptrTarget = animNo;
+	_compact->grafixProg.pos = 0;
+	
+	//uint16 *animation = (uint16 *)SkyState::fetchCompact(animNo);
+	//uint16 sprite = *animation++; // get sprite set
+	//_compact->offset = sprite;
+	_compact->offset = *SkyCompact::getGrafixPtr(_compact);
+	//_compact->grafixProg = animation;
+	_compact->grafixProg.pos++;
 	_compact->logic = L_MOD_ANIMATE;
 	anim();
 	return false; // drop from script
 }
 
 bool SkyLogic::fnSimpleMod(uint32 animSeqNo, uint32 b, uint32 c) {
-	uint16 *animSeq = (uint16 *)SkyState::fetchCompact(animSeqNo);
 
-	_compact->offset = *animSeq++;
-	assert(*animSeq != 0);
-	_compact->grafixProg = animSeq;
+	_compact->grafixProg.ptrType = COMPACT;
+	_compact->grafixProg.ptrTarget = animSeqNo;
+	_compact->grafixProg.pos = 0;
+	//uint16 *animSeq = (uint16 *)SkyState::fetchCompact(animSeqNo);
+	//_compact->offset = *animSeq++;
+	//assert(*animSeq != 0);
+	_compact->offset = *SkyCompact::getGrafixPtr(_compact);
+	//_compact->grafixProg = animSeq;
+	_compact->grafixProg.pos++;
 	_compact->logic = L_SIMPLE_MOD;
 	simpleAnim();
 	return false;
 }
 
 bool SkyLogic::fnRunFrames(uint32 sequenceNo, uint32 b, uint32 c) {
-	uint16 *sequence = (uint16 *)SkyState::fetchCompact(sequenceNo);
+	_compact->grafixProg.ptrType = COMPACT;
+	_compact->grafixProg.ptrTarget = sequenceNo;
+	_compact->grafixProg.pos = 0;
+	//uint16 *sequence = (uint16 *)SkyState::fetchCompact(sequenceNo);
 
 	_compact->logic = L_FRAMES;
-	_compact->offset = *sequence++;
-	_compact->grafixProg = sequence;
+	//_compact->offset = *sequence++;
+	_compact->offset = *SkyCompact::getGrafixPtr(_compact);
+	_compact->grafixProg.pos++;
+	//_compact->grafixProg = sequence;
 	simpleAnim();
 	return false;
 }
@@ -2417,17 +2443,25 @@
 
 	animNum += target->extCompact->megaSet / NEXT_MEGA_SET;
 	animNum &= 0xFF;
-	if (SkyTalkAnims::animTalkTableIsPointer[animNum]) //is it a pointer? 
-		animPtr = (uint16 *)SkyTalkAnims::animTalkTablePtr[animNum];
-	else 	//then it must be a value
-		animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]);
+	if (SkyTalkAnims::animTalkTableIsPointer[animNum]) { //is it a pointer? 
+		//animPtr = (uint16 *)SkyTalkAnims::animTalkTablePtr[animNum];
+		target->grafixProg.ptrType = TALKTABLE;
+		target->grafixProg.ptrTarget = animNum;
+	} else {	//then it must be a value
+		//animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]);
+		target->grafixProg.ptrType = COMPACT;
+		target->grafixProg.ptrTarget = SkyTalkAnims::animTalkTableVal[animNum];
+	}
+	target->grafixProg.pos = 0;
+	animPtr = SkyCompact::getGrafixPtr(target);
 	
 	if (animPtr) {
 		target->offset = *animPtr++;
 		target->getToFlag = *animPtr++;
-		target->grafixProg = animPtr;
-	} else
-		target->grafixProg = 0;
+		target->grafixProg.pos += 2;
+	} else {
+		target->grafixProg.ptrType = PTR_NULL;
+	}
 
 	bool speechUsed = false;
 	// startSpeech returns false if no speech file exists for that text
@@ -2477,13 +2511,11 @@
 			yPos = TOP_LEFT_Y;
 
 		textCompact->ycood = yPos;
-		//_logicTalkButtonRelease = 1;  
 			
 	} else {
 		//talking off-screen
 		target->extCompact->spTextId = 0; 	//don't kill any text 'cos none was made
 		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.
 	// Setting spTime to 10 thus means that we're doing a pause of 10 gamecycles between

Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/mouse.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mouse.h	12 Jul 2003 02:07:37 -0000	1.18
+++ mouse.h	3 Aug 2003 17:17:24 -0000	1.19
@@ -53,7 +53,7 @@
 	uint16 giveMouseX(void) { return _mouseX; };
 	uint16 giveMouseY(void) { return _mouseY; };
 	uint16 giveCurrentMouseType(void) { return _currentCursor; };
-	bool wasClicked(void) { return _logicClick; };
+	bool wasClicked(void) { return _logicClick; _logicClick = false; };
 	void logicClick(void) { _logicClick = true; };
 
 protected:

Index: skydefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/skydefs.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- skydefs.h	12 Jul 2003 03:40:44 -0000	1.24
+++ skydefs.h	3 Aug 2003 17:17:24 -0000	1.25
@@ -26,6 +26,14 @@
 
 //This file is incomplete, several flags still missing.
 
+// grafixProg pointer types:
+#define PTR_NULL	0
+#define AUTOROUTE	1
+#define COMPACT		2
+#define COMPACTELEM	3 // needed by fnSetToStand
+#define TALKTABLE	4
+
+// language codes:
 #define SKY_ENGLISH		0
 #define SKY_GERMAN		1
 #define SKY_FRENCH		2

Index: struc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/struc.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- struc.h	9 Jun 2003 02:33:27 -0000	1.11
+++ struc.h	3 Aug 2003 17:17:24 -0000	1.12
@@ -48,6 +48,12 @@
 	uint16 s_compressed_size;
 };
 
+struct GrafixPtr { // replacement for old grafixProg pointer. More savegame compatible.
+	uint8 ptrType; // ptr to autoroute / to compact / to turntable
+	uint16 ptrTarget; // compact / turntable number
+	uint16 pos; // position
+};
+
 struct TurnTable {
 	uint16 *turnTableUp[5];
 	uint16 *turnTableDown[5];
@@ -106,7 +112,7 @@
 	uint16 arTargetX;
 	uint16 arTargetY;
 
-	void *animScratch; // data area for AR
+	uint16 *animScratch; // data area for AR
 
 	uint16 megaSet;
 	MegaSet *megaSet0;
@@ -147,7 +153,7 @@
 	uint16 flag; // a use any time flag
 
 	uint16 mood; // high level - stood or not
-	uint16 *grafixProg;
+	GrafixPtr grafixProg;
 	uint16 offset;
 
 	uint16 mode; // which mcode block





More information about the Scummvm-git-logs mailing list