
DSYS 2.6 (Demo System)
----------------------

The idea with this system is that it should be simple to make the
final exe-file without the need to compile it.
The system also handles all data files so that the effect don't need to
worry about those. In fact, the effect code is forbidden to load files
directly from disk or the PFS file. The reasons are many...

While working on a demo, syncing stuff etc. you don't need to build
the filesystems files at all. You just start DSYS with parameter -DISK
and all files will be loaded by the demosystem directly from disk.

When making the final demo, you must split up the demo (if it's big)
and make a separate script and filesystem for each part.

See: PFS.TXT  for more info on creating the filesystems.

Start DSYS with -? for options.



DSYS works like this
--------------------

Here is some simple pseudo code that describes how the filesystems
and scripts are handled. Note! This is not valid if you start with -DISK.

Note! Starting with DSYS 2.8 the below pseudocode has been optimized
      so that all filesystems are located before starting the demo.
      From the user point of view the below code still apply though.


N = 0
LOOP
    Locate filesystem N in the exe-file.
    IF NOT found
        Locate filesystem N in datafile with extension .PFS
        IF NOT found
            Locate filesystem N in the file DEMO.N
            IF NOT found
                IF N = 0
                    ERROR Can't find filesystem 0
                    EXIT
                IF N != 0
                    BREAK LOOP          ; No more filesystems. Demo is done.
    OPEN filesystem N
    LOAD script N
    IF script N NOT found
        ERROR Can't locate script N
    EXECUTE script N                    ; Run part N of demo      
    IF user exit
        BREAK LOOP                      ; User exit, stop demo
    CLOSE filesystem N
    N = N + 1
LOOP NEXT

IF user exit in demo
    Locate filesystem 0 in the exe-file.    
    IF NOT found
        Locate filesystem 0 in datafile with extension .PFS
        IF NOT found
            Locate filesystem 0 in the file DEMO.000
            IF NOT found
                ERROR
                EXIT
    OPEN filesystem 0
    LOAD exit script
    IF exit script found 
        DISABLE keyboard handler        ; Don't allow user exit here :-)
        EXECUTE exit script
    CLOSE filesystem 0




Rules
-----

The scripts must be called:

    script/script0.scr
    script/script1.scr
    script/script2.scr
    ...
    script/exit.scr

script/exit.scr will only be executed if it exist and if the user
quits the demo by pressing ESC.

Each of these scripts must be present in a filesystem starting with
number 0, 1, 2, ...  script/exit.scr must be in filesystem 0. 


Filesystems can be:
    - appended to the exe file.
    - appended to one big file with the same name as the exe-file but
      with the extension .PFS
    - in files called demo.000, demo.001, demo.002, etc. One filesystem
      per file.


If you start DSYS with -DISK you don't need the filesystems.


Note! Note! Note!
-----------------

Starting from DSYS 2.6 the -DISK option is not available if you don't
set the environment variable DOOMSDAY=MEMBERS ONLY. This was made so
people can't start fiddling with the system in a released production.
Set this is your AUTOEXEC.BAT file:

  set DOOMSDAY=MEMBERS ONLY


