I6 Template Layer

Inform 7 6M62ContentsIntroductionFunction IndexRules Index

Figures.i6t

Figures contents

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".

21Array ResourceUsageFlags -> 22    ({-value:NUMBER_CREATED(blorb_figure)}+{-value:NUMBER_CREATED(blorb_sound)}+5);

Figures.

27[ DisplayFigure resource_ID one_time; 28    if ((one_time) && (ResourceUsageFlags->resource_ID)) return; 29    ResourceUsageFlags->resource_ID = true; 30    print "^"; VM_Picture(resource_ID); print "^"; 31];

Sound Effects.

36[ PlaySound resource_ID one_time; 37    if (resource_ID == 0) return; ! The "silence" non-sound effect 38    if ((one_time) && (ResourceUsageFlags->resource_ID)) return; 39    ResourceUsageFlags->resource_ID = true; 40    VM_SoundEffect(resource_ID); 41];