Author Topic: Errors in template game file open flags  (Read 2656 times)

0 Members and 1 Guest are viewing this topic.

Offline troflip

Errors in template game file open flags
« on: June 24, 2015, 02:11:03 PM »
I was noticing that in the SCI0 template game header, we have this:

Code: [Select]
// 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.



Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Cloudee1

Re: Errors in template game file open flags
« Reply #1 on: June 24, 2015, 02:18:30 PM »
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.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: Errors in template game file open flags
« Reply #2 on: June 24, 2015, 02:33:45 PM »
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).





« Last Edit: June 24, 2015, 02:44:15 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline OmerMor

Re: Errors in template game file open flags
« Reply #3 on: June 24, 2015, 03:02:33 PM »
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.

Offline troflip

Re: Errors in template game file open flags
« Reply #4 on: June 24, 2015, 03:47:27 PM »
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.
Check out my website: http://icefallgames.com
Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.073 seconds with 23 queries.