diff options
| author | Travis Howell | 2005-10-12 00:35:54 +0000 | 
|---|---|---|
| committer | Travis Howell | 2005-10-12 00:35:54 +0000 | 
| commit | 5eb4192f83811fe0e416a8b3c6b0cdc2ae131c55 (patch) | |
| tree | 8aba74bd253f189fc203d8969aa72de49a97a1a0 | |
| parent | e6ae6d3520517126de41359c0bcc59fa0de5807d (diff) | |
| download | scummvm-rg350-5eb4192f83811fe0e416a8b3c6b0cdc2ae131c55.tar.gz scummvm-rg350-5eb4192f83811fe0e416a8b3c6b0cdc2ae131c55.tar.bz2 scummvm-rg350-5eb4192f83811fe0e416a8b3c6b0cdc2ae131c55.zip  | |
Fix regression, cuased by typo.
Add wrapper as suggested.
svn-id: r19028
| -rw-r--r-- | simon/debug.cpp | 35 | ||||
| -rw-r--r-- | simon/res.cpp | 8 | ||||
| -rw-r--r-- | simon/simon.cpp | 42 | ||||
| -rw-r--r-- | simon/simon.h | 2 | ||||
| -rw-r--r-- | simon/vga.cpp | 31 | 
5 files changed, 40 insertions, 78 deletions
diff --git a/simon/debug.cpp b/simon/debug.cpp index 28bcd0a429..72ba0b7c6e 100644 --- a/simon/debug.cpp +++ b/simon/debug.cpp @@ -198,6 +198,7 @@ void SimonEngine::dump_video_script(const byte *src, bool one_opcode_only) {  			strn++;  		fprintf(_dumpFile, "%.2d: %s ", opcode, strn + 1); +		int end = (_game == GAME_FEEBLEFILES) ? 9999 : 999;  		for (; *str != '|'; str++) {  			switch (*str) {  			case 'x': @@ -207,42 +208,22 @@ void SimonEngine::dump_video_script(const byte *src, bool one_opcode_only) {  				fprintf(_dumpFile, "%d ", *src++);  				break;  			case 'd': -				if (_game == GAME_FEEBLEFILES) { -					fprintf(_dumpFile, "%d ", READ_LE_UINT16(src)); -				} else { -					fprintf(_dumpFile, "%d ", READ_BE_UINT16(src)); -				} +				fprintf(_dumpFile, "%d ", readUint16Wrapper(src));  				src += 2;  				break;  			case 'v': -				if (_game == GAME_FEEBLEFILES) { -					fprintf(_dumpFile, "[%d] ", READ_LE_UINT16(src)); -				} else { -					fprintf(_dumpFile, "[%d] ", READ_BE_UINT16(src)); -				} +				fprintf(_dumpFile, "[%d] ", readUint16Wrapper(src));  				src += 2;  				break;  			case 'i': -				if (_game == GAME_FEEBLEFILES) { -					fprintf(_dumpFile, "%d ", (int16)READ_LE_UINT16(src)); -				} else { -					fprintf(_dumpFile, "%d ", (int16)READ_BE_UINT16(src)); -				} +				fprintf(_dumpFile, "%d ", (int16)readUint16Wrapper(src));  				src += 2;  				break;  			case 'q': -				if (_game == GAME_FEEBLEFILES) { -					while (READ_LE_UINT16(src) != 9999) { -						fprintf(_dumpFile, "(%d,%d) ", READ_LE_UINT16(src), -										READ_LE_UINT16(src + 2)); -						src += 4; -					} -				} else { -					while (READ_BE_UINT16(src) != 999) { -						fprintf(_dumpFile, "(%d,%d) ", READ_BE_UINT16(src), -										READ_BE_UINT16(src + 2)); -						src += 4; -					} +				while (readUint16Wrapper(src) != end) { +					fprintf(_dumpFile, "(%d,%d) ", readUint16Wrapper(src), +									readUint16Wrapper(src + 2)); +					src += 4;  				}  				src++;  				break; diff --git a/simon/res.cpp b/simon/res.cpp index 69827c1b5a..f305698494 100644 --- a/simon/res.cpp +++ b/simon/res.cpp @@ -27,6 +27,7 @@  namespace Simon { +// Script opcodes to load into memory  static const char *const opcode_arg_table_simon1win[256] = {  	" ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ",  	"BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ", @@ -112,6 +113,13 @@ static const char *const opcode_arg_table_feeblefiles[256] = {  	" ", " ", "BT ", " ", "B ", " ", "BBBB ", " ", " ", "BBBB ", "B ", "B ", "B ", "B "  }; +uint16 SimonEngine::readUint16Wrapper(const void *src) { +	if (_game == GAME_FEEBLEFILES) +		return READ_LE_UINT16(src); +	else +		return READ_BE_UINT16(src); +} +  void SimonEngine::loadGamePcFile(const char *filename) {  	Common::File in;  	int num_inited_objects; diff --git a/simon/simon.cpp b/simon/simon.cpp index 52b76683bb..de8eada59c 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -75,7 +75,7 @@ static const SimonGameSettings simon_settings[] = {  	{"simon2mac", "Simon the Sorcerer 2 Talkie (Amiga or Mac)", GAME_SIMON2WIN, 0},  	{"simon1cd32", "Simon the Sorcerer 1 Talkie (Amiga CD32)", GAME_SIMON1CD32, "gameamiga"},  	{"simon1demo", "Simon the Sorcerer 1 (DOS Demo)", GAME_SIMON1DEMO, "GDEMO"}, -	{"feeble", "The Feeble Files", GAME_FEEBLEFILES, "GAME22"}, +//	{"feeble", "The Feeble Files", GAME_FEEBLEFILES, "GAME22"},  	{NULL, NULL, 0, NULL}  }; @@ -2825,17 +2825,10 @@ void SimonEngine::timer_vga_sprites() {  		_windowNum = vsp->windowNum;  		_vgaCurSpriteId = vsp->id; -		if (_game == GAME_FEEBLEFILES) { -			params[0] = READ_LE_UINT16(&vsp->image); -			params[1] = READ_LE_UINT16(&vsp->palette); -			params[2] = READ_LE_UINT16(&vsp->x); -			params[3] = READ_LE_UINT16(&vsp->y); -		} else { -			params[0] = READ_BE_UINT16(&vsp->image); -			params[1] = READ_BE_UINT16(&vsp->palette); -			params[2] = READ_BE_UINT16(&vsp->x); -			params[3] = READ_BE_UINT16(&vsp->y); -		} +		params[0] = readUint16Wrapper(&vsp->image); +		params[1] = readUint16Wrapper(&vsp->palette); +		params[2] = readUint16Wrapper(&vsp->x); +		params[3] = readUint16Wrapper(&vsp->y);  		if (_game & GF_SIMON2) {  			*(byte *)(¶ms[4]) = (byte)vsp->flags; @@ -2913,19 +2906,11 @@ void SimonEngine::timer_vga_sprites_2() {  		if (vsp->image)  			fprintf(_dumpFile, "id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n",  							vsp->id, vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags); -		if (_game == GAME_FEEBLEFILES) { -			params[0] = READ_LE_UINT16(&vsp->image); -			params[1] = READ_LE_UINT16(&vsp->palette); -			params[2] = READ_LE_UINT16(&vsp->x); -			params[3] = READ_LE_UINT16(&vsp->y); -			params[4] = READ_LE_UINT16(&vsp->flags); -		} else { -			params[0] = READ_BE_UINT16(&vsp->image); -			params[1] = READ_BE_UINT16(&vsp->palette); -			params[2] = READ_BE_UINT16(&vsp->x); -			params[3] = READ_BE_UINT16(&vsp->y); -			params[4] = READ_BE_UINT16(&vsp->flags); -		} +		params[0] = readUint16Wrapper(&vsp->image); +		params[1] = readUint16Wrapper(&vsp->palette); +		params[2] = readUint16Wrapper(&vsp->x); +		params[3] = readUint16Wrapper(&vsp->y); +		params[4] = readUint16Wrapper(&vsp->flags);  		_vcPtr = (const byte *)params;  		vc10_draw(); @@ -3128,14 +3113,15 @@ void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) {  		x += _scrollX * 8;  	} +	int end = (_game == GAME_FEEBLEFILES) ? 9999 : 999;  	prev_i = 21 - _variableArray[12];  	for (i = 20; i != 0; --i) {  		p = (const uint16 *)_pathFindArray[20 - i];  		if (!p)  			continue; -		for (j = 0; READ_BE_UINT16(&p[0]) != 999; j++, p += 2) {	// 0xE703 = byteswapped 999 -			x_diff = abs((int)(READ_BE_UINT16(&p[0]) - x)); -			y_diff = abs((int)(READ_BE_UINT16(&p[1]) - 12 - y)); +		for (j = 0; readUint16Wrapper(&p[0]) != end; j++, p += 2) {	// 0xE703 = byteswapped 999 +			x_diff = abs((int)(readUint16Wrapper(&p[0]) - x)); +			y_diff = abs((int)(readUint16Wrapper(&p[1]) - 12 - y));  			if (x_diff < y_diff) {  				x_diff >>= 2; diff --git a/simon/simon.h b/simon/simon.h index 5ab2111a5a..d5e77de02b 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -380,6 +380,8 @@ public:  	virtual ~SimonEngine();  protected: +	uint16 readUint16Wrapper(const void *src); +  	int allocGamePcVars(Common::File *in);  	void loginPlayerHelper(Item *item, int a, int b);  	void loginPlayer(); diff --git a/simon/vga.cpp b/simon/vga.cpp index 7421f04ee7..0feba6bed1 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -158,11 +158,7 @@ int SimonEngine::vc_read_var_or_word() {  uint SimonEngine::vc_read_next_word() {  	uint a; -	if (_game == GAME_FEEBLEFILES) { -		a = READ_LE_UINT16(_vcPtr); -	} else { - 		a = READ_BE_UINT16(_vcPtr); -	} +	a = readUint16Wrapper(_vcPtr);  	_vcPtr += 2;  	return a;  } @@ -300,7 +296,7 @@ void SimonEngine::vc2_call() {  	if (_game == GAME_FEEBLEFILES) {  		_vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);  	} else { -		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs); +		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);  	}  	//dump_vga_script(_vcPtr, res, num); @@ -703,7 +699,6 @@ void SimonEngine::vc10_draw() {  	if (_dumpImages)  		dump_single_bitmap(_vgaCurFileId, state.image, state.depack_src, width * 16, height,  											 state.palette); -  	// TODO::Add support for image scaling  	if (_game == GAME_FEEBLEFILES)  		return; @@ -1158,13 +1153,9 @@ void SimonEngine::vc17_setPathfinderItem() {  	uint a = vc_read_next_word();  	_pathFindArray[a - 1] = (const uint16 *)_vcPtr; -	if (_game == GAME_FEEBLEFILES) { -		while (READ_LE_UINT16(_vcPtr) != 9999) -			_vcPtr += 4; -	} else { -		while (READ_BE_UINT16(_vcPtr) != 999) -			_vcPtr += 4; -	} +	int end = (_game == GAME_FEEBLEFILES) ? 9999 : 999; +	while (readUint16Wrapper(_vcPtr) != end) +		_vcPtr += 4;  	_vcPtr += 2;  } @@ -1545,15 +1536,9 @@ void SimonEngine::vc48_setPathFinder() {  	vp = &_variableArray[20];  	do { -		if (_game == GAME_FEEBLEFILES) { -			y2 = READ_LE_UINT16(p); -			p += step; -			y1 = READ_LE_UINT16(p) - y2; -		} else { -			y2 = READ_BE_UINT16(p); -			p += step; -			y1 = READ_BE_UINT16(p) - y2; -		} +		y2 = readUint16Wrapper(p); +		p += step; +		y1 = readUint16Wrapper(p) - y2;  		vp[0] = y1 >> 1;  		vp[1] = y1 - (y1 >> 1);  | 
