[Scummvm-cvs-logs] SF.net SVN: scummvm:[54038] scummvm/trunk/engines/m4

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Nov 2 10:50:14 CET 2010


Revision: 54038
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54038&view=rev
Author:   fingolfin
Date:     2010-11-02 09:50:14 +0000 (Tue, 02 Nov 2010)

Log Message:
-----------
M4: Remove redundant fflush calls

Modified Paths:
--------------
    scummvm/trunk/engines/m4/globals.cpp
    scummvm/trunk/engines/m4/graphics.cpp
    scummvm/trunk/engines/m4/m4.cpp
    scummvm/trunk/engines/m4/script.cpp
    scummvm/trunk/engines/m4/woodscript.cpp
    scummvm/trunk/engines/m4/ws_machine.cpp
    scummvm/trunk/engines/m4/ws_sequence.cpp

Modified: scummvm/trunk/engines/m4/globals.cpp
===================================================================
--- scummvm/trunk/engines/m4/globals.cpp	2010-11-02 09:49:47 UTC (rev 54037)
+++ scummvm/trunk/engines/m4/globals.cpp	2010-11-02 09:50:14 UTC (rev 54038)
@@ -89,7 +89,7 @@
 
 	int room = (triggerNum >> 16) & 0xFFF;
 
-	debug(kDebugScript, "room = %d; currentRoom = %d\n", room, currentRoom); fflush(stdout);
+	debug(kDebugScript, "room = %d; currentRoom = %d\n", room, currentRoom);
 
 	if (room != currentRoom) {
 		debug(kDebugScript, "Kernel::handleTrigger() Trigger from another room\n");
@@ -124,7 +124,6 @@
 
 	case KT_DAEMON:
 		debug(kDebugScript, "KT_DAEMON\n");
-		fflush(stdout);
 		triggerMode = KT_DAEMON;
 		daemonTriggerAvailable = false;
 		roomDaemon();

Modified: scummvm/trunk/engines/m4/graphics.cpp
===================================================================
--- scummvm/trunk/engines/m4/graphics.cpp	2010-11-02 09:49:47 UTC (rev 54037)
+++ scummvm/trunk/engines/m4/graphics.cpp	2010-11-02 09:50:14 UTC (rev 54038)
@@ -214,7 +214,7 @@
 
 	/*
 	debug(kDebugGraphics, "M4Surface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n",
-		info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight); fflush(stdout);
+		info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight);
 	*/
 
 	int clipX = 0, clipY = 0;
@@ -233,7 +233,7 @@
 		scaledHeight = y + scaledHeight;
 	}
 
-	//debug(kDebugGraphics, "M4Surface::drawSprite() width = %d; height = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.height, scaledWidth, scaledHeight); fflush(stdout);
+	//debug(kDebugGraphics, "M4Surface::drawSprite() width = %d; height = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.height, scaledWidth, scaledHeight);
 
 	// Check if sprite is inside the screen. If it's not, there's no need to draw it
 	if (scaledWidth + x <= 0 || scaledHeight + y <= 0)	// check left and top (in case x,y are negative)

Modified: scummvm/trunk/engines/m4/m4.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4.cpp	2010-11-02 09:49:47 UTC (rev 54037)
+++ scummvm/trunk/engines/m4/m4.cpp	2010-11-02 09:50:14 UTC (rev 54038)
@@ -346,7 +346,6 @@
 		_vm->_kernel->trigger = i;
 		_script->runFunction(func);
 		debug(kDebugCore, "=================================\n");
-		fflush(stdout);
 	}
 #endif
 

Modified: scummvm/trunk/engines/m4/script.cpp
===================================================================
--- scummvm/trunk/engines/m4/script.cpp	2010-11-02 09:49:47 UTC (rev 54037)
+++ scummvm/trunk/engines/m4/script.cpp	2010-11-02 09:50:14 UTC (rev 54038)
@@ -354,7 +354,6 @@
 	while (!done) {
 		byte opcode = _runningFunction->readByte();
 		done = !execOpcode(opcode);
-		fflush(stdout);
 	}
 
 	_localStackPtr = oldLocalStackPtr;
@@ -588,7 +587,6 @@
 	if (index == 0xFFFFFFFF)
 		return;
 	debug(kDebugScript, "ScriptInterpreter::callFunction() index = %d [%s]\n", index, _scriptFunctionNames[index].c_str());
-	fflush(stdout);
 	ScriptFunction *subFunction = loadFunction(index);
 	if (!subFunction) {
 		// This *should* never happen since the linker checks this
@@ -1027,7 +1025,6 @@
 	int result = _vm->_player->said(words[0], words[1], words[2]);
 
 	debug(kDebugScript, "   -> '%d'\n", result);
-	fflush(stdout);
 
 	RETURN(result);
 	return 3;
@@ -1043,7 +1040,6 @@
 
 	int result = _vm->_player->saidAny(words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]);
 	debug(kDebugScript, "   -> '%d'\n", result);
-	fflush(stdout);
 
 	RETURN(result);
 	return 10;
@@ -1123,7 +1119,6 @@
 
 	debug(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; frameRate = %d; loopCount = %d; scale = %d; x = %d; y = %d: firstFrame = %d; lastFrame = %d\n",
 		name, layer, flags, trigger, frameRate, loopCount, scale, x, y, firstFrame, lastFrame);
-		fflush(stdout);
 
 	// TODO: Return the machine to the script
 	_vm->_ws->playSeries(name, layer, flags, trigger, frameRate, loopCount, scale, x, y, firstFrame, lastFrame);
@@ -1144,7 +1139,6 @@
 
 	debug(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; duration = %d; frameIndex = %d; scale = %d; x = %d; y = %d\n",
 		name, layer, flags, trigger, duration, frameIndex, scale, x, y);
-		fflush(stdout);
 
 	// TODO: Return the machine to the script
 	_vm->_ws->showSeries(name, layer, flags, trigger, duration, frameIndex, scale, x, y);
@@ -1158,7 +1152,6 @@
 	// skip arg 3: palette ptr
 
 	debug(kDebugScript, "name = %s; hash = %d\n", name, hash);
-	fflush(stdout);
 
 	int result = _vm->_ws->loadSeries(name, hash, NULL);
 
@@ -1258,7 +1251,6 @@
 		*/
 	}
 	debug(kDebugScript, "   -> '%d'\n", result);
-	fflush(stdout);
 
 	RETURN(result);
 	return 1;
@@ -1279,7 +1271,6 @@
 	int slot = INTEGER(5);
 
 	debug(kDebugScript, "%s; %d; %d; %d; %d; %d\n", name, trigger, room, flag, volume, slot);
-	fflush(stdout);
 	//g_system->delayMillis(5000);
 
 	KernelTriggerType oldTriggerMode = _vm->_kernel->triggerMode;

Modified: scummvm/trunk/engines/m4/woodscript.cpp
===================================================================
--- scummvm/trunk/engines/m4/woodscript.cpp	2010-11-02 09:49:47 UTC (rev 54037)
+++ scummvm/trunk/engines/m4/woodscript.cpp	2010-11-02 09:50:14 UTC (rev 54038)
@@ -200,7 +200,7 @@
 Machine *WoodScript::createMachine(int32 machineHash, Sequence *parentSeq,
 	int32 dataHash, int32 dataRowIndex, int callbackHandler, const char *machineName) {
 
-	//debug(kDebugScript, "WoodScript::createMachine(%d)\n", machineHash); fflush(stdout);
+	//debug(kDebugScript, "WoodScript::createMachine(%d)\n", machineHash);
 
 	Machine *machine = new Machine(this, machineHash, parentSeq, dataHash, dataRowIndex, callbackHandler, machineName, _machineId);
 	_machineId++;

Modified: scummvm/trunk/engines/m4/ws_machine.cpp
===================================================================
--- scummvm/trunk/engines/m4/ws_machine.cpp	2010-11-02 09:49:47 UTC (rev 54037)
+++ scummvm/trunk/engines/m4/ws_machine.cpp	2010-11-02 09:50:14 UTC (rev 54038)
@@ -147,7 +147,7 @@
 
 int32 Machine::execInstruction() {
 
-	//debug(kDebugScript, "Machine::execInstruction()\n"); fflush(stdout);
+	//debug(kDebugScript, "Machine::execInstruction()\n");
 
 	bool done = false;
 	Instruction instruction;
@@ -160,12 +160,16 @@
 		if (machineConditionalsTable[instruction.instr - 64] != 0)
 			(this->*machineConditionalsTable[instruction.instr - 64])(instruction);
 		/* The next line is to yield on unimplemented opcodes */
-		else { fflush(stdout); g_system->delayMillis(5000); }
+		else {
+			g_system->delayMillis(5000);
+		}
 	} else if (instruction.instr > 0) {
 		if (machineCommandsTable[instruction.instr] != 0)
 			done = !(this->*machineCommandsTable[instruction.instr])(instruction);
 		/* The next line is to yield on unimplemented opcodes */
-		else { fflush(stdout); g_system->delayMillis(5000); }
+		else {
+			g_system->delayMillis(5000);
+		}
 		if (done) {
 			if (_id == machID) {
 				//TODO: Cancel all requests
@@ -199,7 +203,7 @@
 
 	int32 instruction = -1;
 
-	//debug(kDebugScript, "---------------------------------------\n"); fflush(stdout);
+	//debug(kDebugScript, "---------------------------------------\n");
 
 	while (instruction && instruction != 4 && _id == oldId && _recursionLevel == oldRecursionLevel &&
 		_code->pos() >= (uint32)startOffset && _code->pos() < (uint32)endOffset) {
@@ -208,7 +212,7 @@
 		//g_system->delayMillis(500);
 	}
 
-	//debug(kDebugScript, "---------------------------------------\n"); fflush(stdout);
+	//debug(kDebugScript, "---------------------------------------\n");
 
 	if (instruction == 3) {
 		execInstruction();
@@ -236,7 +240,7 @@
 }
 
 bool Machine::m1_terminate(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_terminate()\n"); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_terminate()\n");
 
 	_currentState = -1;
 	_recursionLevel = 0;
@@ -244,7 +248,7 @@
 }
 
 bool Machine::m1_startSequence(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_startSequence() sequence hash = %d\n", (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_startSequence() sequence hash = %d\n", (uint32)instruction.argv[0] >> 16);
 
 	int32 sequenceHash = instruction.argv[0] >> 16;
 	if (_sequence == NULL) {
@@ -260,14 +264,14 @@
 }
 
 bool Machine::m1_pauseSequence(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_pauseSequence()\n"); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_pauseSequence()\n");
 
 	_sequence->pause();
 	return true;
 }
 
 bool Machine::m1_resumeSequence(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_resumeSequence()\n"); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_resumeSequence()\n");
 
 	_sequence->resume();
 	return true;
@@ -352,7 +356,7 @@
 }
 
 bool Machine::m1_clearVars(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_clearVars()\n"); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_clearVars()\n");
 
 	_sequence->clearVars();
 	return true;
@@ -360,7 +364,7 @@
 
 
 void Machine::m1_onEndSequence(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
 
 	int32 count = instruction.argv[0] >> 16;
 	_sequence->issueEndOfSequenceRequest(_code->pos(), count);
@@ -368,7 +372,7 @@
 }
 
 void Machine::m1_onMessage(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
 
 	// TODO: Add message to list
 
@@ -378,42 +382,42 @@
 }
 
 void Machine::m1_switchLt(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_switchLt() %d < %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_switchLt() %d < %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
 
 	if (instruction.argv[1] >= instruction.argv[2])
 		_code->jumpRelative(instruction.argv[0] >> 16);
 }
 
 void Machine::m1_switchLe(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_switchLe() %d <= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_switchLe() %d <= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
 
 	if (instruction.argv[1] > instruction.argv[2])
 		_code->jumpRelative(instruction.argv[0] >> 16);
 }
 
 void Machine::m1_switchEq(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_switchEq() %d == %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_switchEq() %d == %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
 
 	if (instruction.argv[1] != instruction.argv[2])
 		_code->jumpRelative(instruction.argv[0] >> 16);
 }
 
 void Machine::m1_switchNe(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_switchNe() %d != %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_switchNe() %d != %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
 
 	if (instruction.argv[1] == instruction.argv[2])
 		_code->jumpRelative(instruction.argv[0] >> 16);
 }
 
 void Machine::m1_switchGe(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_switchGe() %d >= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_switchGe() %d >= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
 
 	if (instruction.argv[1] < instruction.argv[2])
 		_code->jumpRelative(instruction.argv[0] >> 16);
 }
 
 void Machine::m1_switchGt(Instruction &instruction) {
-	//debug(kDebugScript, "Machine::m1_switchGt() %d > %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16); fflush(stdout);
+	//debug(kDebugScript, "Machine::m1_switchGt() %d > %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
 
 	if (instruction.argv[1] <= instruction.argv[2])
 		_code->jumpRelative(instruction.argv[0] >> 16);

Modified: scummvm/trunk/engines/m4/ws_sequence.cpp
===================================================================
--- scummvm/trunk/engines/m4/ws_sequence.cpp	2010-11-02 09:49:47 UTC (rev 54037)
+++ scummvm/trunk/engines/m4/ws_sequence.cpp	2010-11-02 09:50:14 UTC (rev 54038)
@@ -201,7 +201,7 @@
 
 void Sequence::issueEndOfSequenceRequest(int32 codeOffset, int32 count) {
 
-	//debug(kDebugScript, "Sequence::issueEndOfSequenceRequest(%04X, %04X)\n", codeOffset, count); fflush(stdout);
+	//debug(kDebugScript, "Sequence::issueEndOfSequenceRequest(%04X, %04X)\n", codeOffset, count);
 	//g_system->delayMillis(5000);
 
 	_endOfSequenceRequest.codeOffset = codeOffset;
@@ -228,7 +228,9 @@
 		_code->loadInstruction(instruction);
 		if (sequenceCommandsTable[instruction.instr] != 0)
 			done = !(this->*sequenceCommandsTable[instruction.instr])(instruction);
-		else { fflush(stdout); /*g_system->delayMillis(1000);*/ }
+		else {
+			//g_system->delayMillis(1000);
+		}
 	}
 
 	return _terminated;
@@ -515,12 +517,12 @@
 
 	_startTime = _ws->getGlobal(kGlobTime);
 
-	//debug(kDebugScript, "deltaTime = %ld\n", deltaTime >> 16); fflush(stdout);
+	//debug(kDebugScript, "deltaTime = %ld\n", deltaTime >> 16);
 	//g_system->delayMillis(5000);
 
 	if (deltaTime >= 0) {
 		_switchTime = _ws->getGlobal(kGlobTime) + (deltaTime >> 16);
-		//debug(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld\n", _ws->getGlobal(kGlobTime)); fflush(stdout);
+		//debug(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld\n", _ws->getGlobal(kGlobTime));
 		//g_system->delayMillis(5000);
 	} else {
 		_switchTime = -1;
@@ -727,7 +729,6 @@
 	_vars[kSeqVarSpriteFrameRate] = _streamSpriteAsset->getFrameRate() << 16;
 
 	//debug(kDebugScript, "Sequence::streamOpen() frames = %d; max = %d x %d\n", _streamSpriteAsset->getCount(), _streamSpriteAsset->getMaxFrameWidth(), _streamSpriteAsset->getMaxFrameHeight());
-	//fflush(stdout);
 
 	_curFrame = new M4Sprite(_vm, _streamSpriteAsset->getMaxFrameWidth(), _streamSpriteAsset->getMaxFrameHeight());
 	streamNextFrame();


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