[Scummvm-cvs-logs] SF.net SVN: scummvm: [22320] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed May 3 19:25:01 CEST 2006


Revision: 22320
Author:   kirben
Date:     2006-05-03 19:23:52 -0700 (Wed, 03 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22320&view=rev

Log Message:
-----------
Cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/simon/debug.cpp
    scummvm/trunk/engines/simon/draw.cpp
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/oracle.cpp
    scummvm/trunk/engines/simon/res.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/string.cpp
    scummvm/trunk/engines/simon/subroutine.cpp
    scummvm/trunk/engines/simon/vga.cpp
Modified: scummvm/trunk/engines/simon/debug.cpp
===================================================================
--- scummvm/trunk/engines/simon/debug.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/debug.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -185,7 +185,7 @@
 			opcode = *src++;
 		}
 
-		if (opcode >= NUM_VIDEO_OP_CODES) {
+		if (opcode >= _numVideoOpcodes) {
 			error("Invalid opcode %x\n", opcode);
 			return;
 		}

Modified: scummvm/trunk/engines/simon/draw.cpp
===================================================================
--- scummvm/trunk/engines/simon/draw.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/draw.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -422,8 +422,6 @@
 }
 
 void SimonEngine::dx_update_screen_and_palette() {
-	_numScreenUpdates++;
-
 	if (_paletteColorCount == 0 && _paletteFlag == 1) {
 		_paletteFlag = 0;
 		if (memcmp(_palette, _paletteBackup, 1024) != 0) {
@@ -486,8 +484,7 @@
 			dst++;
  		}
  		_system->setPalette(_videoBuf1, 0, _videoNumPalColors);
-		if (_fade)
-			_system->updateScreen();
+		_system->updateScreen();
  		delay(5);
  	}
 	_paletteColorCount = 0;

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/items.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -1630,8 +1630,7 @@
 		paletteFadeOut((uint32 *)_videoBuf1 + 32 + 16 + 144 + 16, 48);
 
 		_system->setPalette(_videoBuf1, 0, 256);
-		if (_fade)
-			_system->updateScreen();
+		_system->updateScreen();
 		delay(5);
 	} while (--i);
 

Modified: scummvm/trunk/engines/simon/oracle.cpp
===================================================================
--- scummvm/trunk/engines/simon/oracle.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/oracle.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -380,14 +380,14 @@
 		windowBackSpace(_windowArray[3]);
 
 		if (_keyPressed == 27) {
-			writeVariable(55, _keyPressed);
+			_variableArray[55] = _keyPressed;
 			break;
 		}
 		if (_keyPressed == 10 || _keyPressed == 13) {
 			if (!saveGame(readVariable(55), name))
-				writeVariable(55, 0xFFFF);
+				_variableArray[55] = 0xFFFF;
 			else
-				writeVariable(55, 0);
+				_variableArray[55] = 0;
 			break;
 		}
 		if (_keyPressed == 8 && len != 0) {

Modified: scummvm/trunk/engines/simon/res.cpp
===================================================================
--- scummvm/trunk/engines/simon/res.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/res.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -487,16 +487,6 @@
 			_gameOffsetsPtr[r] = FROM_LE_32(_gameOffsetsPtr[r]);
 #endif
 	}
-
-	if (getGameType() == GType_FF)
-		loadIconData();
-	else
-		loadIconFile();
-
-	vc34_setMouseOff();
-
-	runSubroutine101();
-	permitInput();
 }
 
 void SimonEngine::readGameFile(void *dst, uint32 offs, uint32 size) {

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -106,7 +106,7 @@
 	_codePtr = 0;
 
 	_localStringtable = 0;
-	_stringIdLocalMin = 1;
+	_stringIdLocalMin = 0;
 	_stringIdLocalMax = 0;
 
 	_tablesHeapPtr = 0;
@@ -142,29 +142,28 @@
 	_inCallBack = 0;
 	_cepeFlag = 0;
 	_copyPartialMode = 0;
-	_speed = 1;
 	_fastMode = 0;
 	_useBackGround = 0;
 
 	_debugMode = 0;
-	_pause = 0;
-	_startMainScript = 0;
-	_continousMainScript = 0;
-	_startVgaScript = 0;
-	_continousVgaScript = 0;
-	_drawImagesDebug = 0;
-	_dumpImages = 0;
-	_speech = true;
-	_subtitles = true;
-	_fade = true;
+	_startMainScript = false;
+	_continousMainScript = false;
+	_startVgaScript = false;
+	_continousVgaScript = false;
+	_drawImagesDebug = false;
+	_dumpImages = false;
 
+	_pause = false;
+	_speech = false;
+	_subtitles = false;
+
 	_animatePointer = 0;
 	_mouseCursor = 0;
 	_mouseAnim = 0;
 	_mouseAnimMax = 0;
 	_oldMouseCursor = 0;
-	_currentMouseCursor = 255;
-	_currentMouseAnim = 255;
+	_currentMouseCursor = 0;
+	_currentMouseAnim = 0;
 	_oldMouseAnimMax = 0;
 
 	_vgaVar9 = 0;
@@ -243,7 +242,7 @@
 
 	_paletteColorCount = 0;
 
-	_noOverWrite = 0xFFFF;
+	_noOverWrite = 0;
 	_rejectCount = 0;
 	_rejectBlock = false;
 
@@ -253,8 +252,8 @@
 	_paletteFlag = 0;
 
 	_soundFileId = 0;
-	_lastMusicPlayed = -1;
-	_nextMusicToPlay = -1;
+	_lastMusicPlayed = 0;
+	_nextMusicToPlay = 0;
 
 	_showPreposition = 0;
 	_showMessageFlag = 0;
@@ -277,7 +276,7 @@
 	_timer5 = 0;
 	_timer4 = 0;
 
-	_frameRate = 1;
+	_frameRate = 0;
 
 	_zoneNumber = 0;
 	_vgaWaitFor = 0;
@@ -343,7 +342,6 @@
 
 	memset(_lettersToPrintBuf, 0, sizeof(_lettersToPrintBuf));
 
-	_numScreenUpdates = 0;
 	_vgaTickCounter = 0;
 
 	_moviePlay = 0;
@@ -383,10 +381,16 @@
 		"\x5\x5\x4\x6\x5\x3\x4\x5\x6\x3\x5\x5\x4\x6\x5\x3\x4\x6\x5\x6\x6\x6\x5\x5\x5\x6\x5\x6\x6\x6\x6\x6", 32);
 
 
-	// Add default file directories for Acorn version
+	// Add default file directories for Acorn version of
+	// Simon the Sorcerer 1
 	File::addDefaultDirectory(_gameDataPath + "execute/");
 	File::addDefaultDirectory(_gameDataPath + "EXECUTE/");
 
+	// Add default file directories for Amiga/Macintosh
+	// verisons of Simon the Sorcerer 2
+	File::addDefaultDirectory(_gameDataPath + "voices/");
+	File::addDefaultDirectory(_gameDataPath + "VOICES/");
+
 	// Add default file directories for Amiga & Macintosh
 	// versions of The Feeble Files
 	File::addDefaultDirectory(_gameDataPath + "gfx/");
@@ -400,7 +404,6 @@
 }
 
 int SimonEngine::init() {
-
 	// Detect game
 	if (!initGame()) {
 		GUIErrorMessage("No valid games were found in the specified directory.");
@@ -417,6 +420,14 @@
 		_screenHeight = 200;
 	}
 
+	_system->beginGFXTransaction();
+		initCommonGFX(getGameType() == GType_FF);
+		_system->initSize(_screenWidth, _screenHeight);
+	_system->endGFXTransaction();
+
+	// FIXME Use auto dirty rects cleanup code to reduce CPU usage
+	g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
+
 	// Setup mixer
 	if (!_mixer->isReady())
 		warning("Sound initialization failed. "
@@ -424,15 +435,10 @@
 	set_volume(ConfMan.getInt("sfx_volume"));
 	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
 
-	_system->beginGFXTransaction();
-		initCommonGFX(getGameType() == GType_FF);
-		_system->initSize(_screenWidth, _screenHeight);
-	_system->endGFXTransaction();
-
 	// Setup midi driver
 	MidiDriver *driver = 0;
-	if (getPlatform() == Common::kPlatformAmiga) {
-		driver = MidiDriver::createMidi(MD_NULL);	// Create fake MIDI driver for Simon1Amiga and Simon2CD32 for now
+	if (getGameType() == GType_FF || getGameId() == GID_SIMON1CD32) {
+		driver = MidiDriver::createMidi(MD_NULL);
 		_native_mt32 = false;
 	} else {
 		int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_MIDI);
@@ -451,118 +457,128 @@
 		warning ("MIDI Player init failed: \"%s\"", midi.getErrorName (ret));
 	midi.set_volume(ConfMan.getInt("music_volume"));
 
-	_debugMode = (gDebugLevel >= 0);
-	_language = Common::parseLanguage(ConfMan.get("language"));
-
 	if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
 		midi.pause(_musicPaused ^= 1);
 
-	if (getFeatures() & GF_TALKIE) {
-		_speech = !ConfMan.getBool("speech_mute");
-		_subtitles = ConfMan.getBool("subtitles");
+	_currentMouseCursor = 255;
+	_currentMouseAnim = 255;
 
-		if (getGameType() == GType_SIMON1) {
-			// English and German versions don't have full subtitles
-			 if (_language == Common::EN_ANY || _language == Common::DE_DEU)
-				_subtitles = false;
-			// Other versions require speech to be enabled
-			else
-				_speech = true;
-		}
+	_dumpFile = stdout;
 
-		// Default to speech only, if both speech and subtitles disabled
-		if (!_speech && !_subtitles)
-			_speech = true;
-	} else {
-		_speech = false;
-		_subtitles = true;
-	}
+	_frameRate = 1;
 
-	if (ConfMan.hasKey("fade") && ConfMan.getBool("fade") == 0)
-		_fade = 0;
+	_lastMusicPlayed = -1;
+	_nextMusicToPlay = -1;
 
-	if (ConfMan.hasKey("slow_down") && ConfMan.getInt("slow_down") >= 1)
-		_speed = ConfMan.getInt("slow_down");
+	_noOverWrite = 0xFFFF;
 
-	// FIXME Use auto dirty rects cleanup code to reduce CPU usage
-	g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
+	_stringIdLocalMin = 1;
 
+	_variableArrayPtr = _variableArray;
+
 	if (getGameType() == GType_FF) {
-		NUM_VIDEO_OP_CODES = 85;
+		gss = PTR(feeblefiles_settings);
+		_numTextBoxes = 40;
+		_numVideoOpcodes = 85;
 #ifndef PALMOS_68K
-		VGA_MEM_SIZE = 7500000;
+		_vgaMemSize = 7500000;
 #else
-		VGA_MEM_SIZE = gVars->memory[kMemSimon2Games];
+		_vgaMemSize = gVars->memory[kMemSimon2Games];
 #endif
-		TABLES_MEM_SIZE = 200000;
-		VGA_DELAY_BASE = 5;
+		_tableMemSize = 200000;
+		_vgaBaseDelay = 5;
 	} else if (getGameType() == GType_SIMON2) {
-		TABLE_INDEX_BASE = 1580 / 4;
-		TEXT_INDEX_BASE = 1500 / 4;
-		NUM_VIDEO_OP_CODES = 75;
+		gss = PTR(simon2_settings);
+		_tableIndexBase = 1580 / 4;
+		_textIndexBase = 1500 / 4;
+		_numTextBoxes = 20;
+		_numVideoOpcodes = 75;
 #ifndef PALMOS_68K
-		VGA_MEM_SIZE = 2000000;
+		_vgaMemSize = 2000000;
 #else
-		VGA_MEM_SIZE = gVars->memory[kMemSimon2Games];
+		_vgaMemSize = gVars->memory[kMemSimon2Games];
 #endif
-		TABLES_MEM_SIZE = 100000;
+		_tableMemSize = 100000;
 		// Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
 		if ((getGameType() == GType_SIMON2) && _native_mt32)
-			MUSIC_INDEX_BASE = (1128 + 612) / 4;
+			_musicIndexBase = (1128 + 612) / 4;
 		else
-			MUSIC_INDEX_BASE = 1128 / 4;
-		SOUND_INDEX_BASE = 1660 / 4;
-		VGA_DELAY_BASE = 1;
+			_musicIndexBase = 1128 / 4;
+		_soundIndexBase = 1660 / 4;
+		_vgaBaseDelay = 1;
 	} else {
-		TABLE_INDEX_BASE = 1576 / 4;
-		TEXT_INDEX_BASE = 1460 / 4;
-		NUM_VIDEO_OP_CODES = 64;
+		gss = PTR(simon1_settings);
+		_tableIndexBase = 1576 / 4;
+		_textIndexBase = 1460 / 4;
+		_numTextBoxes = 20;
+		_numVideoOpcodes = 64;
 #ifndef PALMOS_68K
-		VGA_MEM_SIZE = 1000000;
+		_vgaMemSize = 1000000;
 #else
-		VGA_MEM_SIZE = gVars->memory[kMemSimon1Games];
+		_vgaMemSize = gVars->memory[kMemSimon1Games];
 #endif
-		TABLES_MEM_SIZE = 50000;
-		MUSIC_INDEX_BASE = 1316 / 4;
-		SOUND_INDEX_BASE = 0;
-		VGA_DELAY_BASE = 1;
+		_tableMemSize = 50000;
+		_musicIndexBase = 1316 / 4;
+		_soundIndexBase = 0;
+		_vgaBaseDelay = 1;
 	}
 
-	if (getGameType() == GType_FF) {
-		gss = PTR(feeblefiles_settings);
-	} else if (getGameType() == GType_SIMON2) {
-		if (getFeatures() & GF_TALKIE) {
-			// Add default file directories
-			File::addDefaultDirectory(_gameDataPath + "voices/");
-			File::addDefaultDirectory(_gameDataPath + "VOICES/");
-		}
-		gss = PTR(simon2_settings);
-	} else if (getGameType() == GType_SIMON1) {
-		gss = PTR(simon1_settings);
+	// allocate buffers
+	_backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+	_frontBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+	_backBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+	if (getGameType() == GType_FF)
+		_scaleBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+
+	allocItemHeap();
+	allocTablesHeap();
+
+	setZoneBuffers();
+
+	_debugger = new Debugger(this);
+	_moviePlay = new MoviePlayer(this, _mixer);
+	_sound = new Sound(this, gss, _mixer);
+
+	if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
+		if (getGameId() == GID_SIMON1DOS)
+			midi._enable_sfx ^= 1;
+		else
+			_sound->effectsPause(_effectsPaused ^= 1);
 	}
 
-	if ((getGameType() == GType_SIMON1) && (getFeatures() & GF_TALKIE)) {
-		// Add default file directories
-		switch (_language) {
-		case Common::HB_ISR:
-			File::addDefaultDirectory(_gameDataPath + "hebrew/");
-			File::addDefaultDirectory(_gameDataPath + "HEBREW/");
-			break;
-		case  Common::ES_ESP:
-			File::addDefaultDirectory(_gameDataPath + "spanish/");
-			File::addDefaultDirectory(_gameDataPath + "SPANISH/");
-			break;
-		case  Common::IT_ITA:
-			File::addDefaultDirectory(_gameDataPath + "italian/");
-			File::addDefaultDirectory(_gameDataPath + "ITALIAN/");
-			break;
-		case  Common::FR_FRA:
-			File::addDefaultDirectory(_gameDataPath + "french/");
-			File::addDefaultDirectory(_gameDataPath + "FRENCH/");
-			break;
+	_language = Common::parseLanguage(ConfMan.get("language"));
+
+	if (getFeatures() & GF_TALKIE) {
+		_speech = !ConfMan.getBool("speech_mute");
+		_subtitles = ConfMan.getBool("subtitles");
+
+		if (getGameType() == GType_SIMON1) {
+			// English and German versions don't have full subtitles
+			 if (_language == Common::EN_ANY || _language == Common::DE_DEU)
+				_subtitles = false;
+			// Other versions require speech to be enabled
+			else
+				_speech = true;
 		}
+
+		// Default to speech only, if both speech and subtitles disabled
+		if (!_speech && !_subtitles)
+			_speech = true;
+	} else {
+		_speech = false;
+		_subtitles = true;
 	}
 
+	_debugMode = (gDebugLevel >= 0);
+	if (gDebugLevel == 2)
+		_continousMainScript = true;
+	if (gDebugLevel == 3)
+		_continousVgaScript = true;
+	if (gDebugLevel == 4)
+		_startMainScript = true;
+	if (gDebugLevel == 5)
+		_startVgaScript = true;
+
 	return 0;
 }
 
@@ -717,9 +733,9 @@
 }
 
 void SimonEngine::allocTablesHeap() {
-	_tablesHeapSize = TABLES_MEM_SIZE;
+	_tablesHeapSize = _tableMemSize;
 	_tablesHeapCurPos = 0;
-	_tablesHeapPtr = (byte *)calloc(TABLES_MEM_SIZE, 1);
+	_tablesHeapPtr = (byte *)calloc(_tableMemSize, 1);
 }
 
 void SimonEngine::setItemState(Item *item, int value) {
@@ -1279,13 +1295,13 @@
 void SimonEngine::setZoneBuffers() {
 	byte *alloced;
 
-	alloced = (byte *)malloc(VGA_MEM_SIZE);
+	alloced = (byte *)malloc(_vgaMemSize);
 
 	_vgaBufFreeStart = alloced;
 	_vgaBufStart = alloced;
 	_vgaFileBufOrg = alloced;
 	_vgaFileBufOrg2 = alloced;
-	_vgaBufEnd = alloced + VGA_MEM_SIZE;
+	_vgaBufEnd = alloced + _vgaMemSize;
 }
 
 byte *SimonEngine::allocBlock(uint32 size) {
@@ -1785,7 +1801,7 @@
 				if (_startVgaScript)
 					dump_vga_script(pp + READ_LE_UINT16(&((AnimationHeader_Feeble*)p)->scriptOffs), zoneNum, vgaSpriteId);
 
-				addVgaEvent(VGA_DELAY_BASE, pp + READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->scriptOffs), vgaSpriteId, zoneNum);
+				addVgaEvent(_vgaBaseDelay, pp + READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->scriptOffs), vgaSpriteId, zoneNum);
 				break;
 			}
 			p += sizeof(AnimationHeader_Feeble);
@@ -1794,7 +1810,7 @@
 				if (_startVgaScript)
 					dump_vga_script(pp + READ_BE_UINT16(&((AnimationHeader_Simon*)p)->scriptOffs), zoneNum, vgaSpriteId);
 
-				addVgaEvent(VGA_DELAY_BASE, pp + READ_BE_UINT16(&((AnimationHeader_Simon *) p)->scriptOffs), vgaSpriteId, zoneNum);
+				addVgaEvent(_vgaBaseDelay, pp + READ_BE_UINT16(&((AnimationHeader_Simon *) p)->scriptOffs), vgaSpriteId, zoneNum);
 				break;
 			}
 			p += sizeof(AnimationHeader_Simon);
@@ -1862,62 +1878,22 @@
 }
 
 int SimonEngine::go() {
-	if (!_dumpFile)
-		_dumpFile = stdout;
 
-	// allocate buffers
-	_backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
-	_frontBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
-	_backBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
-	if (getGameType() == GType_FF)
-		_scaleBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
-
-	allocItemHeap();
-	allocTablesHeap();
-
-	setZoneBuffers();
-
-	_debugger = new Debugger(this);
-	_moviePlay = new MoviePlayer(this, _mixer);
-	_sound = new Sound(this, gss, _mixer);
-
-	if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
-		if (getGameId() == GID_SIMON1DOS)
-			midi._enable_sfx ^= 1;
-		else
-			_sound->effectsPause(_effectsPaused ^= 1);
-	}
-
 	loadGamePcFile();
 
 	addTimeEvent(0, 1);
 	openGameFile();
 
-	_lastMusicPlayed = -1;
-	_frameRate = 1;
-
 	if (getGameType() == GType_FF)
-		_numTextBoxes = 40;
+		loadIconData();
 	else
-		_numTextBoxes = 20;
+		loadIconFile();
 
-	_variableArrayPtr = _variableArray;
+	vc34_setMouseOff();
 
-	_startMainScript = false;
-	_continousMainScript = false;
-	_startVgaScript = false;
-	_continousVgaScript = false;
-	_drawImagesDebug = false;
+	runSubroutine101();
+	permitInput();
 
-	if (gDebugLevel == 2)
-		_continousMainScript = true;
-	if (gDebugLevel == 3)
-		_continousVgaScript = true;
-	if (gDebugLevel == 4)
-		_startMainScript = true;
-	if (gDebugLevel == 5)
-		_startVgaScript = true;
-
 	while (1) {
 		hitarea_stuff();
 		handleVerbClicked(_verbHitArea);
@@ -1956,9 +1932,9 @@
 	if (_fastMode)
 	 	vga_period = 10;
 	else if (getGameType() == GType_SIMON2)
-		vga_period = 45 * _speed;
+		vga_period = 45;
 	else
-		vga_period = 50 * _speed;
+		vga_period = 50;
 
 	_rnd.getRandomNumber(2);
 
@@ -2047,12 +2023,11 @@
 		if (amount == 0)
 			break;
 
-		{
-			this_delay = _fastMode ? 1 : 20 * _speed;
-			if (this_delay > amount)
-				this_delay = amount;
-			_system->delayMillis(this_delay);
-		}
+		this_delay = _fastMode ? 1 : 20;
+		if (this_delay > amount)
+			this_delay = amount;
+		_system->delayMillis(this_delay);
+
 		cur = _system->getMillis();
 	} while (cur < start + amount);
 }
@@ -2060,28 +2035,31 @@
 void SimonEngine::loadMusic(uint music) {
 	char buf[4];
 
-	if (getPlatform() == Common::kPlatformAmiga) {
-		if (getFeatures() & GF_CRUNCHED) {
-			// TODO Add support for decruncher
-			debug(5,"loadMusic - Decrunch %dtune attempt", music);
-		}
-		// TODO Add Protracker support for simon1amiga/cd32
-		debug(5,"playMusic - Load %dtune attempt", music);
-	} else if (getGameType() == GType_SIMON2) {        // Simon 2 music
+	if (getGameType() == GType_SIMON2) {        // Simon 2 music
 		midi.stop();
-		_gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
+		_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
 		_gameFile->read(buf, 4);
 		if (!memcmp(buf, "FORM", 4)) {
-			_gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
+			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
 			midi.loadXMIDI (_gameFile);
 		} else {
-			_gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
+			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
 			midi.loadMultipleSMF (_gameFile);
 		}
 
 		_lastMusicPlayed = music;
 		_nextMusicToPlay = -1;
 	} else if (getGameType() == GType_SIMON1) {        // Simon 1 music
+		if (getPlatform() == Common::kPlatformAmiga) {
+			if (getFeatures() & GF_CRUNCHED) {
+				// TODO Add support for decruncher
+				debug(5,"loadMusic - Decrunch %dtune attempt", music);
+			}
+			// TODO Add Protracker support for simon1amiga/cd32
+			debug(5,"playMusic - Load %dtune attempt", music);
+			return;
+		}
+
 		midi.stop();
 		midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
 
@@ -2094,13 +2072,13 @@
 			if (music == 35)
 				midi.setLoop (false);
 
-			_gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music], SEEK_SET);
+			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
 			_gameFile->read(buf, 4);
 			if (!memcmp(buf, "GMF\x1", 4)) {
-				_gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music], SEEK_SET);
+				_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
 				midi.loadSMF (_gameFile, music);
 			} else {
-				_gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music], SEEK_SET);
+				_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
 				midi.loadMultipleSMF (_gameFile);
 			}
 

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/simon.h	2006-05-04 02:23:52 UTC (rev 22320)
@@ -179,14 +179,14 @@
 
 	uint32 *_gameOffsetsPtr;
 
-	uint VGA_DELAY_BASE;
-	uint TABLE_INDEX_BASE;
-	uint TEXT_INDEX_BASE;
-	uint NUM_VIDEO_OP_CODES;
-	uint VGA_MEM_SIZE;
-	uint TABLES_MEM_SIZE;
-	uint MUSIC_INDEX_BASE;
-	uint SOUND_INDEX_BASE;
+	uint _vgaBaseDelay;
+	uint _tableIndexBase;
+	uint _textIndexBase;
+	uint _numVideoOpcodes;
+	uint _vgaMemSize;
+	uint _tableMemSize;
+	uint _musicIndexBase;
+	uint _soundIndexBase;
 	const GameSpecificSettings *gss;
 
 	byte _keyPressed;
@@ -253,7 +253,6 @@
 	bool _inCallBack;
 	bool _cepeFlag;
 	byte _copyPartialMode;
-	uint _speed;
 	bool _fastMode;
 	bool _useBackGround;
 
@@ -268,7 +267,6 @@
 	bool _dumpImages;
 	bool _speech;
 	bool _subtitles;
-	bool _fade;
 	bool _vgaVar9;
 	int16 _chanceModifier;
 	bool _restoreWindow6;
@@ -446,7 +444,6 @@
 	MidiPlayer midi;
 	bool _native_mt32;
 
-	int _numScreenUpdates;
 	int _vgaTickCounter;
 
 	MoviePlayer *_moviePlay;

Modified: scummvm/trunk/engines/simon/string.cpp
===================================================================
--- scummvm/trunk/engines/simon/string.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/string.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -112,7 +112,7 @@
 	uint32 offs;
 	uint32 size;
 
-	res = atoi(filename + 4) + TEXT_INDEX_BASE - 1;
+	res = atoi(filename + 4) + _textIndexBase - 1;
 	offs = _gameOffsetsPtr[res];
 	size = _gameOffsetsPtr[res + 1] - offs;
 

Modified: scummvm/trunk/engines/simon/subroutine.cpp
===================================================================
--- scummvm/trunk/engines/simon/subroutine.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/subroutine.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -91,7 +91,7 @@
 	uint res;
 	uint32 offs;
 
-	res = atoi(filename + 6) + TABLE_INDEX_BASE - 1;
+	res = atoi(filename + 6) + _tableIndexBase - 1;
 	offs = _gameOffsetsPtr[res];
 
 	_gameFile->seek(offs, SEEK_SET);
@@ -138,7 +138,7 @@
 				if (getGameType() == GType_FF) {
 					// TODO
 				} else if (getGameType() == GType_SIMON2) {
-					_sound->loadSfxTable(_gameFile, _gameOffsetsPtr[atoi(filename + 6) - 1 + SOUND_INDEX_BASE]);
+					_sound->loadSfxTable(_gameFile, _gameOffsetsPtr[atoi(filename + 6) - 1 + _soundIndexBase]);
 				} else if (getPlatform() == Common::kPlatformWindows) {
 					memcpy(filename, "SFXXXX", 6);
 					_sound->readSfxFile(filename);

Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp	2006-05-03 21:53:38 UTC (rev 22319)
+++ scummvm/trunk/engines/simon/vga.cpp	2006-05-04 02:23:52 UTC (rev 22320)
@@ -143,7 +143,7 @@
 			opcode = *_vcPtr++;
 		}
 
-		if (opcode >= NUM_VIDEO_OP_CODES)
+		if (opcode >= _numVideoOpcodes)
 			error("Invalid VGA opcode '%d' encountered", opcode);
 
 		if (opcode == 0)
@@ -455,9 +455,9 @@
 	}
 
 	if (getGameType() == GType_FF) {
-		addVgaEvent(VGA_DELAY_BASE, _curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->scriptOffs), vgaSpriteId, res);
+		addVgaEvent(_vgaBaseDelay, _curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->scriptOffs), vgaSpriteId, res);
 	} else {
-		addVgaEvent(VGA_DELAY_BASE, _curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_Simon *) p)->scriptOffs), vgaSpriteId, res);
+		addVgaEvent(_vgaBaseDelay, _curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_Simon *) p)->scriptOffs), vgaSpriteId, res);
 	}
 
 	_curVgaFile1 = old_file_1;
@@ -1487,7 +1487,7 @@
 	if ((getGameType() == GType_SIMON1) && vsp->id == 128)
 		num = 0;
 	else
-		num += VGA_DELAY_BASE;
+		num += _vgaBaseDelay;
 
 	addVgaEvent(num, _vcPtr, _vgaCurSpriteId, _vgaCurZoneNum);
 	_vcPtr = (byte *)&_vc_get_out_of_code;
@@ -1510,7 +1510,7 @@
 	uint16 id = vcReadNextWord();
 	while (vfs->ident != 0) {
 		if (vfs->ident == id) {
-			addVgaEvent(VGA_DELAY_BASE, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
+			addVgaEvent(_vgaBaseDelay, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
 			vfs_tmp = vfs;
 			do {
 				memcpy(vfs_tmp, vfs_tmp + 1, sizeof(VgaSleepStruct));
@@ -2087,7 +2087,7 @@
 void SimonEngine::vc56_delay() {
 	uint16 num = vcReadVarOrWord() * _frameRate;
 
-	addVgaEvent(num + VGA_DELAY_BASE, _vcPtr, _vgaCurSpriteId, _vgaCurZoneNum);
+	addVgaEvent(num + _vgaBaseDelay, _vcPtr, _vgaCurSpriteId, _vgaCurZoneNum);
 	_vcPtr = (byte *)&_vc_get_out_of_code;
 }
 
@@ -2217,8 +2217,7 @@
 		for (i = NUM_PALETTE_FADEOUT; i != 0; --i) {
 			paletteFadeOut((uint32 *)_videoBuf1, _videoNumPalColors);
 			_system->setPalette(_videoBuf1, 0, _videoNumPalColors);
-			if (_fade)
-				_system->updateScreen();
+			_system->updateScreen();
 			delay(5);
 		}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list