Hey again,

I have recently been playing about with printing strings in SCUMM. Specifically, i wanted to print the names of locations the mouse moves over (slightly offset from the mouse position), much like what happens in the monkey island map view.

I wasn't quite sure where to begin, so i started off using the "cursorPrint" function, which worked. However, the strings seemed to be getting directly printed onto the room graphic, which of course not quite what i wanted. After a bit of debugging, i found out that the function i should have been using is "print", which according to scummvm prints onto the text surface, and thus will be cleared properly.

I was a bit disappointed that the "cursorPrint" function had a very misleading name. Perhaps a better one would be "stampPrint", since it pretty much has the effect same effect as "stampObject"?

Another thing which i noticed was the "printBegin" & "printEnd" functions (sub-ops 0xFE & 0xFF in scummvm). "printBegin" loads the default settings to use to print the string, and "printEnd" saves them. Looking at the wiki docs, it says "Start / End a print context", which would lead me to believe that there is some complex context system regarding printing strings in SCUMM, perhaps involving some batching system. So i might be tempted to do this every time i wanted to print a string:

printBegin();
print("Something");
printEnd();

Which would essentially be a waste of a function call, as "printEnd" will just save the defaults that were loaded by "printBegin" (a pretty redundant operation). So i could reduce that to:

printBegin(); // i.e. load default values
print("Something");

Which would have an additional effect of sounding odd, i am "beginning" a new print context, but i am never "ending" it. But still, it is more valid than the above example. Last but not least, i could of course only call "print", assuming i didn't care about ensuring the settings were in a sane state.

I guess my main gripe about "printBegin" and "printEnd" functions is that they aren't named very well. They don't give a good indication on what operation they will really perform, which is merely just saving and restoring settings for each category of print operation. If they were named something different, lets say "printRestoreState" and "printSaveState", one could easily associate "State" with the settings of the string that can be set (via "printAt", "printMumble", etc), and the corresponding operation being "Restore" or "Save".

I think that's all i have to say on printing strings. My solution seems to be working nicely for the moment - anyone else have any ideas or suggestions regarding string printing?

Regards

-SJU

_______________________________________________
ScummC-general mailing list
[email protected]
https://mail.gna.org/listinfo/scummc-general

Reply via email to