Community
SCI Programming => SCI Syntax Help => Topic started by: troflip on June 24, 2015, 02:11:03 PM
-
I was noticing that in the SCI0 template game header, we have this:
// open or fail: Try to open file, abort if not possible
(define fOPENFAIL 0)
// open or create: Try to open file, create it if it doesn't exist
(define fOPENCREATE 1)
I believe these are flipped around though (looking at the ScummVM source code - which appears to use the same values for FOpen() (SCI0), and FileIO(fiOPEN ...) (SCI1.1)). "open fail" should be 1, and "open create" should be 0. I'm wary of changing them, since it would break anyone who is using them. Has anyone encountered this? I don't think file handling is something that is done very frequently... sciaudio only uses fCREATE (which is 2), it looks like.
I will make the corrections for SCI1.1 though.
-
I'm confused. Isn't file open used every time the game starts up. In the main script, it opens the version file. Also save and restore is definately a case of file opening.
-
The SCI0 template game doesn't open a version file in main.
But yeah, it's used for loading/saving the saved game list. But in those cases, no mode is specified (looks like ScummVM makes this use " openfail").
If you look at the fileio.sc in the SCI0 template, you'll see if opens the file in "opencreate" for reading stuff, and "openfail" for writing, which is definitely backwards. So that tells me they are definitely wrong. But I can't really change it at this point.
I'll just change it for SCI 1.1 and make a comment in the header file.
It won't affect any existing SCI 1.1 games you have made, since the constants weren't used anywhere in the template (just the raw numbers).
-
You can deprecate both, and introduce new constants (e.g fOPEN_CREATE instead of fOPENCREATE). This will introduce a compilation error for anyone using these, and would force them to reevaluate their usage.
-
I'm worried that will cause confusion for anyone trying to compile an existing fan-made game with the new version of SCI Companion, since those constants are used in the template game. And I think it's rare anyone tries to use these constants outside of the template boilerplate.