On Sat, 22 Sep 2007 13:44:50 +0100
James Urquhart <[EMAIL PROTECTED]> wrote:
> Hi again,
>
> I was looking at the SCVM code and noticed that it seems to use a
> sub-op table for certain opcodes (e.g. arrayOps, verbOps). This is
> different to SCUMMVM, which instead uses a switch in the opcode to
> determine the intended sub-op.
>
> Looking at the sub-op table, it seems like a good idea. All of the
> sub-op's appear unique, and it pretty much cuts out using the switch
> statement.
That was the thought behind this, as the sub-ops are (mostly) unique
one can spare many ugly switch.
> However there is the potential that someone could call an invalid
> sub-op like <roomOps><set actor costume>, which would actually work
> in SCVM, but fail in SCUMMVM and perhaps the LEC interpreters as well
> (although i have not attempted this so i don't know for sure).
That's correct, but I don't think it is a real problem.
> Which leads me to my question. Is there any reason (apart from what i
> have already mentioned) why the sub-op table is used in SCVM?
It allow handeling the sub-ops just like the normal ops, thus avoiding
some code duplication and allowing things like printing the name of the
executed ops without special cases. I think it will also make things
easier to print disassembly.
Albeu
_______________________________________________
ScummC-general mailing list
[email protected]
https://mail.gna.org/listinfo/scummc-general