On Sat, 9 Dec 2006 23:43:20 +0000
Stuart J Urquhart <[EMAIL PROTECTED]> wrote:

> 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.

Nice idea :)

> 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.
 
> 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.

> 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.

If you know nothing else can change the state inbetween then that's
allright (at least with scummvm).

> 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".

That's right.

> 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 :)

        Albeu

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

Reply via email to