protected void ExecuteOpCode(byte opCode)
{
_opCode = opCode;
if (_game.Version > 2) // V0-V2 games didn't use the didexec flag
_slots[CurrentScript].IsExecuted = true;
if (Game.Version < 6)
{
this.Trace().Write(TraceSwitches.OpCodes, "Room = {1}, Script = {0}, Offset = {4}, Name = {2} [{3:X2}]",
_slots[CurrentScript].Number,
_roomResource,
_opCodes.ContainsKey(_opCode) ? _opCodes[opCode].Method.Name : "Unknown",
_opCode,
CurrentPos - 1);
}
if (_opCodes.ContainsKey(opCode))
{
_opCodes[opCode]();
}
else
{
throw new InvalidOperationException(string.Format("Invalid opcode 0x{0:X2}.", opCode));
}
}