예제 #1
0
int AGOSEngine::runScript() {
	bool flag;

	if (shouldQuit())
		return 1;

	do {
		if (DebugMan.isDebugChannelEnabled(kDebugOpcode))
			dumpOpcode(_codePtr);

		if (getGameType() == GType_ELVIRA1) {
			_opcode = getVarOrWord();
			if (_opcode == 10000)
				return 0;
		} else {
			_opcode = getByte();
			if (_opcode == 0xFF)
				return 0;
		}

		if (_runScriptReturn1)
			return 1;

		/* Invert condition? */
		flag = false;
		if (getGameType() == GType_ELVIRA1) {
			if (_opcode == 203) {
				flag = true;
				_opcode = getVarOrWord();
				if (_opcode == 10000)
					return 0;
			}
		} else {
			if (_opcode == 0) {
				flag = true;
				_opcode = getByte();
				if (_opcode == 0xFF)
					return 0;
			}
		}

		setScriptCondition(true);
		setScriptReturn(0);

		if (_opcode > _numOpcodes)
			error("Invalid opcode '%d' encountered", _opcode);

		executeOpcode(_opcode);
	} while (getScriptCondition() != flag && !getScriptReturn() && !shouldQuit());

	return (shouldQuit()) ? 1 : getScriptReturn();
}
예제 #2
0
파일: dump.c 프로젝트: fperrad/c-wmlscript
void dumpInterp(Interp_t* i)
{
   Element_t* e;

   fprintf(WmlsStdout, "-------------------------------\n");
#ifdef DUMP_OPCODE
   dumpOpcode(i);
#endif
   for (e = i->base; e <= i->OperandPtr; e++)
   {
      dumpElement(e);
   }
}
예제 #3
0
void AGOSEngine::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
	const byte *p;

	printf("; ****\n");

	p = (byte *)sl + SUBROUTINE_LINE_SMALL_SIZE;
	if (sub->id == 0) {
		printf("; verb=%d, noun1=%d, noun2=%d\n", sl->verb, sl->noun1, sl->noun2);
		p = (byte *)sl + SUBROUTINE_LINE_BIG_SIZE;
	}

	for (;;) {
		p = dumpOpcode(p);
		if (p == NULL)
			break;
	}
}