Part 7 - The Music
figure of titlepage is the file "and602.jpg".
sound of titlemusic is the file "black_giant.ogg".
[sound of titlemusic is the file "uhmm.ogg".]
faderflag is a number variable. [global]
[Instead of jumping:
present the title page.]
['present the title page ' clears the screen, shows title art and plays music if possible, asks for a keypress, then fades music (if it's still playing) before clearing screen and continuing game.]
To present the title page:
clear the screen;
if glulx graphics is supported:
display the figure of titlepage;
show the current quotation;
if glulx sound is supported:
set the foreground volume to 5;
play sound of titlemusic in foreground;
if glulx timekeeping is supported:
now faderflag is 1;
start a 217000 millisecond timer;
deepen the status line to 0 rows;
say "Please press SPACE to continue.";
wait for the SPACE key;
if glulx sound is supported:
if glulx timekeeping is supported and faderflag is 1:
stop the timer;
fade out the foreground sound;
now faderflag is 0;
stop the foreground sound;
clear the screen.
To present the end titles:
clear the screen;
if glulx sound is supported:
set the foreground volume to 5;
play sound of titlemusic in foreground;
if glulx timekeeping is supported:
now faderflag is 1;
start a 217000 millisecond timer;
clear the screen.
A glulx timed activity rule (this is the NEW redirect from timer rule): [overwrites what's in extension]
now the waiting flag is false;
stop the timer;
now faderflag is 0.
The NEW redirect from timer rule is listed instead of the redirect from timer rule in the glulx timed activity rules.
To fade out the foreground sound:
say run paragraph on; [necessary to prevent linebumping in Gargoyle interpreter]
let CV be 66535;
repeat with N running from 1 to 500:
if CV is less than 1500, break;
if CV is greater than 1500, now CV is CV minus 1000;
if CV is greater than 5121, now CV is CV minus 2000;
if CV is greater than 10241, now CV is CV minus 5000;
if CV is greater than 20481, now CV is CV minus 7000;
if CV is greater than 40961, now CV is CV minus 15000;
set the raw foreground volume to CV;
wait 110 milliseconds before continuing, strictly. [author of damusix recommends a delay time of around 100 ms for good fades - he says definitely never below 100ms]