1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-08 18:14:21 +03:00
inform7/docs/standard_rules/S-ft.html

70 lines
3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>S/ct</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-gb">
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>
<body>
<!--Weave of 'S/ft' generated by 7-->
<ul class="crumbs"><li><a href="../webs.html">&#9733;</a></li><li><a href="index.html">standard_rules Template Library</a></li><li><b>Figures Template</b></li></ul><p class="purpose">To display figures and play sound effects.</p>
<ul class="toc"><li><a href="#SP1">&#167;1. Resource Usage</a></li><li><a href="#SP2">&#167;2. Figures</a></li><li><a href="#SP3">&#167;3. Sound Effects</a></li></ul><hr class="tocbar">
<p class="inwebparagraph"><a id="SP1"></a><b>&#167;1. Resource Usage. </b>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.)
</p>
<p class="inwebparagraph">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".
</p>
<pre class="display">
<span class="plain">Array ResourceUsageFlags -&gt; (ICOUNT_FIGURE_NAME + ICOUNT_SOUND_NAME + 5);</span>
</pre>
<p class="inwebparagraph"></p>
<p class="inwebparagraph"><a id="SP2"></a><b>&#167;2. Figures. </b></p>
<pre class="display">
<span class="plain">[ DisplayFigure resource_ID one_time;</span>
<span class="plain">if ((one_time) &amp;&amp; (ResourceUsageFlags-&gt;resource_ID)) return;</span>
<span class="plain">ResourceUsageFlags-&gt;resource_ID = true;</span>
<span class="plain">print "^"; VM_Picture(resource_ID); print "^";</span>
<span class="plain">];</span>
</pre>
<p class="inwebparagraph"></p>
<p class="inwebparagraph"><a id="SP3"></a><b>&#167;3. Sound Effects. </b></p>
<pre class="display">
<span class="plain">[ PlaySound resource_ID one_time;</span>
<span class="plain">if (resource_ID == 0) return; ! The "silence" non-sound effect</span>
<span class="plain">if ((one_time) &amp;&amp; (ResourceUsageFlags-&gt;resource_ID)) return;</span>
<span class="plain">ResourceUsageFlags-&gt;resource_ID = true;</span>
<span class="plain">VM_SoundEffect(resource_ID);</span>
<span class="plain">];</span>
</pre>
<p class="inwebparagraph"></p>
<hr class="tocbar">
<ul class="toc"><li><a href="S-ct.html">Back to 'Chronology Template'</a></li><li><a href="S-gt.html">Continue with 'Glulx Template'</a></li></ul><hr class="tocbar">
<!--End of weave-->
</body>
</html>