One of the ways I’ve tried to make the D4 instructions cleaner is by reducing code duplication. First, I cut down the size of cb_objectcall
by reusing functionality in the generic call
. Then, I noticed that several variable-related instructions take a variable type argument, but none of the instructions handled every variable type correctly. After identifying the IDs for every type I could, I combined all this duplicated variable lookup code into a single helper function.
I also implemented Lingo errors, allowing for easier detection of illegal cases, which often indicate a mistake on our part.
Then, I began implementing better support of chunk expressions. Chunk expressions are references to substrings, such as word 2 to 4 of "the quick brown fox"
. You can use them to grab text:
set x to word 2 to 4 of "the quick brown fox"`
or you can use them manipulate the text:
put " foo" after word 2 of x
Previously, we only supported the former, and I’m in the process of implementing support for the latter.
Since summer’s almost over, I’d like to thank the ScummVM developers, especially sev, rvanlaar, and moralrecordings, as well as Google for its Summer of Code program. I’ve learned a lot and had a good deal of fun over the past three months.
I won’t be working on ScummVM full-time anymore, but this definitely won’t be the last you hear from me. We still have plenty of work to do on Director, and I plan to keep contributing in my spare time.
See you soon!
Leave a Reply