aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-11-02 09:50:14 +0000
committerMax Horn2010-11-02 09:50:14 +0000
commit7cf7b198add96e33438128e1d55114fea813821c (patch)
treec7ec52ecb02501c6ba09a8f301b7781a3d948362
parentba3e826872d8456a3bca171bf5613f7802e9582a (diff)
downloadscummvm-rg350-7cf7b198add96e33438128e1d55114fea813821c.tar.gz
scummvm-rg350-7cf7b198add96e33438128e1d55114fea813821c.tar.bz2
scummvm-rg350-7cf7b198add96e33438128e1d55114fea813821c.zip
M4: Remove redundant fflush calls
svn-id: r54038
-rw-r--r--engines/m4/globals.cpp3
-rw-r--r--engines/m4/graphics.cpp4
-rw-r--r--engines/m4/m4.cpp1
-rw-r--r--engines/m4/script.cpp9
-rw-r--r--engines/m4/woodscript.cpp2
-rw-r--r--engines/m4/ws_machine.cpp40
-rw-r--r--engines/m4/ws_sequence.cpp11
7 files changed, 32 insertions, 38 deletions
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 40055d2af4..f8d93a224d 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -89,7 +89,7 @@ bool Kernel::handleTrigger(int32 triggerNum) {
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 @@ bool Kernel::handleTrigger(int32 triggerNum) {
case KT_DAEMON:
debug(kDebugScript, "KT_DAEMON\n");
- fflush(stdout);
triggerMode = KT_DAEMON;
daemonTriggerAvailable = false;
roomDaemon();
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index f69a887d65..a45446627c 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -214,7 +214,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c
/*
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 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c
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)
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index e5ffb7a633..7a5efbfbc1 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -346,7 +346,6 @@ Common::Error M4Engine::run() {
_vm->_kernel->trigger = i;
_script->runFunction(func);
debug(kDebugCore, "=================================\n");
- fflush(stdout);
}
#endif
diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp
index 776411df62..21532c44f1 100644
--- a/engines/m4/script.cpp
+++ b/engines/m4/script.cpp
@@ -354,7 +354,6 @@ int ScriptInterpreter::runFunction(ScriptFunction *scriptFunction) {
while (!done) {
byte opcode = _runningFunction->readByte();
done = !execOpcode(opcode);
- fflush(stdout);
}
_localStackPtr = oldLocalStackPtr;
@@ -588,7 +587,6 @@ void ScriptInterpreter::callFunction(uint32 index) {
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 ScriptInterpreter::o1_hasPlayerSaid() {
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 ScriptInterpreter::o1_hasPlayerSaidAny() {
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 @@ int ScriptInterpreter::o1_playSeries() {
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 @@ int ScriptInterpreter::o1_showSeries() {
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 @@ int ScriptInterpreter::o1_loadSeries() {
// 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 @@ int ScriptInterpreter::o1_wilburSaid() {
*/
}
debug(kDebugScript, " -> '%d'\n", result);
- fflush(stdout);
RETURN(result);
return 1;
@@ -1279,7 +1271,6 @@ int ScriptInterpreter::o1_wilburSpeech() {
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;
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
index 52e19ef540..7dc734dab6 100644
--- a/engines/m4/woodscript.cpp
+++ b/engines/m4/woodscript.cpp
@@ -200,7 +200,7 @@ void WoodScript::runTimerSequenceRequests() {
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++;
diff --git a/engines/m4/ws_machine.cpp b/engines/m4/ws_machine.cpp
index 04ec1ee50b..184d9847ab 100644
--- a/engines/m4/ws_machine.cpp
+++ b/engines/m4/ws_machine.cpp
@@ -147,7 +147,7 @@ void Machine::enterState() {
int32 Machine::execInstruction() {
- //debug(kDebugScript, "Machine::execInstruction()\n"); fflush(stdout);
+ //debug(kDebugScript, "Machine::execInstruction()\n");
bool done = false;
Instruction instruction;
@@ -160,12 +160,16 @@ int32 Machine::execInstruction() {
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 @@ void Machine::execBlock(int32 offset, int32 count) {
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 @@ void Machine::execBlock(int32 offset, int32 count) {
//g_system->delayMillis(500);
}
- //debug(kDebugScript, "---------------------------------------\n"); fflush(stdout);
+ //debug(kDebugScript, "---------------------------------------\n");
if (instruction == 3) {
execInstruction();
@@ -236,7 +240,7 @@ bool Machine::m1_jump(Instruction &instruction) {
}
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_terminate(Instruction &instruction) {
}
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_startSequence(Instruction &instruction) {
}
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_createMachineEx(Instruction &instruction) {
}
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 @@ bool Machine::m1_clearVars(Instruction &instruction) {
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_onEndSequence(Instruction &instruction) {
}
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_onMessage(Instruction &instruction) {
}
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);
diff --git a/engines/m4/ws_sequence.cpp b/engines/m4/ws_sequence.cpp
index 0f2634c91e..b45af2eebc 100644
--- a/engines/m4/ws_sequence.cpp
+++ b/engines/m4/ws_sequence.cpp
@@ -201,7 +201,7 @@ void Sequence::resume() {
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 @@ bool Sequence::runProgram() {
_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 @@ bool Sequence::s1_crunch(Instruction &instruction) {
_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 @@ bool Sequence::streamOpen() {
_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();