Descumm misdecompilation fix
|Reported by:||SF/madm00se||Owned by:||fingolfin|
This patch does a few things all-in-one. I can split it
up if anybody wants me to.
Most importantly, it fixes the misdecompilation of the
case from sam&max script 52 mentioned in the comment at
the top of descumm.cpp (The "while" and "else"
detection code interference.)
Other than that it:
* Makes us output "arrayXXX[...]" instead of
"array-XXX[...]" because that's what we do with all
other types of variables and it's easier to compile.
* Makes us output "else if" in places we didn't before.
* Makes us output "var++" and "var--" instead of "var
+= 1" and "var += -1", since SCUMM doesn't support
values other than +/- 1.
* Makes us output "unless (condition)" instead of "if
(!(condition))" and "until (condition)" instead of
"while (!(condition))" because it's prettier.
* And finally (and most controversially), makes us
output the "break" keyword where needed (with it's
usual c meaning for breaking out of loops) and turns
the current "break()" into "breakHere()" to avoid
conflicts with the keyword. It's already called
breakHere() in v8, which is why I chose it, but maybe
we should change it to "yield()" or something to make
the keyword and the function more distinct?
I've got testcases if anybody wants to them.
Ticket imported from: #1037397. Ticket imported from: patches/461.