1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-09 02:24:21 +03:00
inform7/retrospective/6M62/Internal/I6T/Figures.i6t
2019-04-16 08:15:15 +01:00

42 lines
1.4 KiB
Plaintext

B/figst: Figures Template.
@Purpose: To display figures and play sound effects.
@-------------------------------------------------------------------------------
@p Resource Usage.
We record whether pictures or sounds have been used before by storing
single byte flags in the following array. (The extra 5 values allow for the
fact that it can be legal to use low undeclared sound effect resource
numbers in the Z-machine for short beeps, though this is deprecated in I7.)
Pictures and sounds are identified within blorb archives by resource ID
numbers which count upwards from 1 in order of creation, but can mix
pictures and sounds freely. (For instance, 1 might be a picture, 2 and 3
sound effects, then 4 a picture again, etc.) ID number 1 is in fact always
a picture: it means the cover art, and is the I6 representation of the
value "figure of cover".
@c
Array ResourceUsageFlags ->
({-value:NUMBER_CREATED(blorb_figure)}+{-value:NUMBER_CREATED(blorb_sound)}+5);
@p Figures.
@c
[ DisplayFigure resource_ID one_time;
if ((one_time) && (ResourceUsageFlags->resource_ID)) return;
ResourceUsageFlags->resource_ID = true;
print "^"; VM_Picture(resource_ID); print "^";
];
@p Sound Effects.
@c
[ PlaySound resource_ID one_time;
if (resource_ID == 0) return; ! The "silence" non-sound effect
if ((one_time) && (ResourceUsageFlags->resource_ID)) return;
ResourceUsageFlags->resource_ID = true;
VM_SoundEffect(resource_ID);
];