[Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.6,1.7 font.cpp,1.8,1.9 isomap.cpp,1.6,1.7 script.cpp,1.7,1.8 sndres.cpp,1.14,1.15 sprite.cpp,1.8,1.9 sthread.cpp,1.8,1.9

Max Horn fingolfin at users.sourceforge.net
Sun Jun 27 14:31:06 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11787/saga

Modified Files:
	animation.cpp font.cpp isomap.cpp script.cpp sndres.cpp 
	sprite.cpp sthread.cpp 
Log Message:
Cleanup for MemoryReadStream; made it match the File-class interface

Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- animation.cpp	5 May 2004 13:05:30 -0000	1.6
+++ animation.cpp	27 Jun 2004 21:30:32 -0000	1.7
@@ -583,7 +583,7 @@
 	*nextf_p = NULL;
 
 	for (; cont_flag; decoded_data = 1) {
-		in_ch_offset = readS->tell();
+		in_ch_offset = readS->pos();
 		in_ch = readS->readByte();
 		switch (in_ch) {
 		case 0x0F: // 15: Frame header
@@ -595,7 +595,7 @@
 				int param5;
 				int param6;
 
-				if (thisf_len - readS->tell() < 13) {
+				if (thisf_len - readS->pos() < 13) {
 					warning("0x%02X: Input buffer underrun", in_ch);
 					return R_FAILURE;
 				}
@@ -625,7 +625,7 @@
 			break;
 		case 0x10: // Long Unencoded Run
 			runcount = readS->readSint16BE();
-			if (thisf_len - readS->tell() < runcount) {
+			if (thisf_len - readS->pos() < runcount) {
 				warning("0x%02X: Input buffer underrun", in_ch);
 				return R_FAILURE;
 			}
@@ -646,7 +646,7 @@
 			continue;
 			break;
 		case 0x1F: // 31: Unusued?
-			if (thisf_len - readS->tell() < 3) {
+			if (thisf_len - readS->pos() < 3) {
 				warning("0x%02X: Input buffer underrun", in_ch);
 				return R_FAILURE;
 			}
@@ -657,7 +657,7 @@
 			continue;
 			break;
 		case 0x20: // Long compressed run
-			if (thisf_len - readS->tell() <= 3) {
+			if (thisf_len - readS->pos() <= 3) {
 				warning("0x%02X: Input buffer underrun", in_ch);
 				return R_FAILURE;
 			}
@@ -674,7 +674,7 @@
 			break;
 
 		case 0x2F: // End of row
-			if (thisf_len - readS->tell() <= 4) {
+			if (thisf_len - readS->pos() <= 4) {
 				return R_FAILURE;
 			}
 
@@ -686,7 +686,7 @@
 			continue;
 			break;
 		case 0x30: // Reposition command
-			if (thisf_len - readS->tell() < 2) {
+			if (thisf_len - readS->pos() < 2) {
 				return R_FAILURE;
 			}
 
@@ -704,9 +704,9 @@
 
 		case 0x3F:	// 68: Frame end marker
 			debug(1, "0x3F: Frame end marker");
-			if (decoded_data && (thisf_len - readS->tell() > 0)) {
-				*nextf_p = thisf_p + readS->tell();
-				*nextf_len = thisf_len - readS->tell();
+			if (decoded_data && (thisf_len - readS->pos() > 0)) {
+				*nextf_p = thisf_p + readS->pos();
+				*nextf_len = thisf_len - readS->pos();
 			} else {
 				*nextf_p = NULL;
 				*nextf_len = 0;
@@ -736,7 +736,7 @@
 			break;
 		case 0x80: // Run of compressed data
 			runcount = param_ch + 1;
-			if ((outbuf_remain < runcount) || (thisf_len - readS->tell() <= 1)) {
+			if ((outbuf_remain < runcount) || (thisf_len - readS->pos() <= 1)) {
 				return R_FAILURE;
 			}
 
@@ -751,7 +751,7 @@
 			break;
 		case 0x40: // Uncompressed run
 			runcount = param_ch + 1;
-			if ((outbuf_remain < runcount) || (thisf_len - readS->tell() < runcount)) {
+			if ((outbuf_remain < runcount) || (thisf_len - readS->pos() < runcount)) {
 				return R_FAILURE;
 			}
 
@@ -887,7 +887,7 @@
 		} while (mark_byte != 63);
 	}
 
-	*frame_offset_p = readS->tell();
+	*frame_offset_p = readS->pos();
 	return R_SUCCESS;
 }
 

Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- font.cpp	5 May 2004 13:05:30 -0000	1.8
+++ font.cpp	27 Jun 2004 21:30:32 -0000	1.9
@@ -168,7 +168,7 @@
 		normal_font->fce[c].tracking = readS->readByte();
 	}
 
-	if (readS->tell() != R_FONT_DESCSIZE) {
+	if (readS->pos() != R_FONT_DESCSIZE) {
 		warning("Invalid font resource size.");
 		return R_FAILURE;
 	}

Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- isomap.cpp	4 May 2004 03:33:03 -0000	1.6
+++ isomap.cpp	27 Jun 2004 21:30:32 -0000	1.7
@@ -57,7 +57,7 @@
 
 	IsoModule.tile_ct = first_entry.tile_offset / SAGA_ISOTILE_ENTRY_LEN;
 
-	readS->rewind();
+	readS->seek(0);
 
 	tile_tbl = (R_ISOTILE_ENTRY *)malloc(IsoModule.tile_ct * sizeof *tile_tbl);
 	if (tile_tbl == NULL) {

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- script.cpp	5 May 2004 13:05:44 -0000	1.7
+++ script.cpp	27 Jun 2004 21:30:32 -0000	1.8
@@ -104,12 +104,12 @@
 	// Convert LUT resource to logical LUT
 	MemoryReadStream *readS = new MemoryReadStream(rsc_ptr, rsc_len);
 	for (i = 0; i < ScriptModule.script_lut_max; i++) {
-		prevTell = readS->tell();
+		prevTell = readS->pos();
 		ScriptModule.script_lut[i].script_rn = readS->readUint16LE();
 		ScriptModule.script_lut[i].diag_list_rn = readS->readUint16LE();
 		ScriptModule.script_lut[i].voice_lut_rn = readS->readUint16LE();
 		// Skip the unused portion of the structure
-		for (j = readS->tell(); j < prevTell + ScriptModule.script_lut_entrylen; j++)
+		for (j = readS->pos(); j < prevTell + ScriptModule.script_lut_entrylen; j++)
 			readS->readByte();
 	}
 
@@ -365,7 +365,7 @@
 
 	// Read in the entrypoint table
 
-	while (readS->tell() < ep_tbl_offset)
+	while (readS->pos() < ep_tbl_offset)
 		readS->readByte();
 
 	for (i = 0; i < n_entrypoints; i++) {
@@ -439,7 +439,7 @@
 	}
 
 	// Read in tables from dialogue list resource
-	readS->rewind();
+	readS->seek(0);
 	for (i = 0; i < n_dialogue; i++) {
 		offset = readS->readUint16LE();
 		if (offset > dialogue_len) {

Index: sndres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- sndres.cpp	17 May 2004 16:11:04 -0000	1.14
+++ sndres.cpp	27 Jun 2004 21:30:33 -0000	1.15
@@ -157,16 +157,16 @@
 	voc_hb.voc_version = readS->readUint16LE();
 	voc_hb.voc_fileid = readS->readUint16LE();
 
-	if ((int32)(snd_res_len - readS->tell()) < (int32)(voc_hb.db_offset + R_VOC_GENBLOCK_LEN)) {
+	if ((int32)(snd_res_len - readS->pos()) < (int32)(voc_hb.db_offset + R_VOC_GENBLOCK_LEN)) {
 		return R_FAILURE;
 	}
 
-	while (readS->tell() < voc_hb.db_offset)
+	while (readS->pos() < voc_hb.db_offset)
 		readS->readByte();
 
 	for (;;) {
 		/* Read generic block header */
-		if (snd_res_len - readS->tell() < R_VOC_GENBLOCK_LEN) {
+		if (snd_res_len - readS->pos() < R_VOC_GENBLOCK_LEN) {
 			return R_FAILURE;
 		}
 
@@ -197,8 +197,8 @@
 			snd_buf_i->res_data = snd_res;
 			snd_buf_i->res_len = snd_res_len;
 
-			snd_buf_i->s_buf = snd_res + readS->tell();
-			snd_buf_i->s_buf_len = snd_res_len - readS->tell() - 1;	/* -1 for end block */
+			snd_buf_i->s_buf = snd_res + readS->pos();
+			snd_buf_i->s_buf_len = snd_res_len - readS->pos() - 1;	/* -1 for end block */
 
 			snd_buf_i->s_signed = 0;
 			return R_SUCCESS;

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sprite.cpp	5 May 2004 13:05:44 -0000	1.8
+++ sprite.cpp	27 Jun 2004 21:30:33 -0000	1.9
@@ -216,7 +216,7 @@
 	s_width = readS->readByte();
 	s_height = readS->readByte();
 
-	sprite_data_p = sprite_p + readS->tell();
+	sprite_data_p = sprite_p + readS->pos();
 
 	spr_x += x_align;
 	spr_y += y_align;
@@ -326,7 +326,7 @@
 	s_width = readS->readByte();
 	s_height = readS->readByte();
 
-	sprite_data_p = sprite_p + readS->tell();
+	sprite_data_p = sprite_p + readS->pos();
 
 	// Create actor Z occlusion LUT
 	SCENE_GetZInfo(&zinfo);

Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sthread.cpp	13 May 2004 01:41:23 -0000	1.8
+++ sthread.cpp	27 Jun 2004 21:30:33 -0000	1.9
@@ -325,7 +325,7 @@
 				temp = readS->readByte();
 				temp2 = readS->readByte();
 				param1 = (SDataWord_T)readS->readUint16LE();
-				data = readS->tell();
+				data = readS->pos();
 				//SSTACK_Push(thread->stack, (SDataWord_T)temp);
 				SSTACK_Push(thread->stack, data);
 				thread->i_offset = (unsigned long)param1;
@@ -775,7 +775,7 @@
 
 		// Set instruction offset only if a previous instruction didn't branch
 		if (saved_offset == thread->i_offset) {
-			thread->i_offset = readS->tell();
+			thread->i_offset = readS->pos();
 		}
 		if (unhandled) {
 			CON_Print(S_ERROR_PREFIX "%X: Unhandled opcode.\n", thread->i_offset);





More information about the Scummvm-git-logs mailing list