On 12 Dec 2006, at 12:18, Alban Bedel wrote:
On Sat, 9 Dec 2006 23:43:20 +0000
Stuart J Urquhart <[EMAIL PROTECTED]> wrote:
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"?
Yep many function have poor names, those come from scummvm. What about
roomPrint() ? Even more explicit imho.
Not bad, though my only gripe is that it wouldn't be very consistent
with the "stampObject" function.
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();
Acctualy the dott scripts always do that. Somehow i suspect their
compiler
probably had some abstraction around that.
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");
With ScummVM that's definitly true. However i don't remember off-hands
how the original VM react to that.
Strange... I guess it could be something to do with the internals of
SCUMM, though to be sure i'd have to run some of my code in the
original VM and see what happens.
Sadly, even if i did that, i wouldn't necessarily be able to
determine what, if anything goes wrong.
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?
Send a patch to give these functions better names :)
I was thinking of doing that, but i was wondering if anyone else had
any better suggestions of names or explanations for the true
functionality :)
I'll do a bit more digging and see what i can come up with.
-SJU
_______________________________________________
ScummC-general mailing list
[email protected]
https://mail.gna.org/listinfo/scummc-general