Skip to content

Commit

Permalink
Dialogue sections during scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Jan 3, 2024
1 parent 8be7415 commit 60bc5b0
Show file tree
Hide file tree
Showing 30 changed files with 303 additions and 67 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Inform 7

[Version](notes/versioning.md): 10.2.0-beta+6X29 'Krypton' (2 January 2024)
[Version](notes/versioning.md): 10.2.0-beta+6X30 'Krypton' (3 January 2024)

## About Inform

Expand Down
4 changes: 2 additions & 2 deletions build.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Prerelease: beta
Build Date: 2 January 2024
Build Number: 6X29
Build Date: 3 January 2024
Build Number: 6X30
2 changes: 1 addition & 1 deletion docs/if-module/3-scn.html
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure scenes_rcd_data is private to this section.</li></ul>
<ul class="endnotetexts"><li>The structure scenes_rcd_data is accessed in 6/db and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP29" class="paragraph-anchor"></a><b>&#167;29. </b>The reason we store a whole specification, rather than a scene constant,
here is that we sometimes want rules which happen during "a recurring scene",
or some other description of scenes in general. But the following function
Expand Down
31 changes: 30 additions & 1 deletion docs/if-module/6-db.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="6-db.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">See if we are expecting a dialogue beat</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_beat</span><span class="plain-syntax"> *</span><span class="identifier-syntax">db</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_beat</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Node::set_beat_defined_here</span><span class="plain-syntax">(</span><span class="identifier-syntax">PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">db</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">DW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Annotations::read_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">dialogue_during_text_w1_ANNOT</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Annotations::read_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">dialogue_during_text_w2_ANNOT</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::new</span><span class="plain-syntax">(</span><span class="identifier-syntax">w1</span><span class="plain-syntax">, </span><span class="identifier-syntax">w2</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w1</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">))) </span><span class="identifier-syntax">DW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">W</span><span class="plain-syntax">;</span>

<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="6-db.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">Initialise the beat</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax"> </span><span class="identifier-syntax">previous_dialogue_beat</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_dialogue_beat</span><span class="plain-syntax">;</span>
Expand Down Expand Up @@ -149,11 +155,13 @@ <h1><a href="../index.html">
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_beat</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">beat_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">scene_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cue_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">heading</span><span class="plain-syntax"> *</span><span class="identifier-syntax">under_heading</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">as_instance</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">scene_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">scene</span><span class="plain-syntax"> *</span><span class="identifier-syntax">as_scene</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">during_scene_W</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">scene</span><span class="plain-syntax"> *</span><span class="identifier-syntax">during_scene</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">required</span><span class="plain-syntax">; </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">instance</span></span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">starting_beat</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">requiring_nothing</span><span class="plain-syntax">;</span>
Expand All @@ -179,6 +187,8 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">under_heading</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dialogue_section_being_scanned</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_instance</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_scene</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">during_scene</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">during_scene_W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">DW</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">required</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">instance</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">starting_beat</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">requiring_nothing</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
Expand Down Expand Up @@ -391,6 +401,25 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_scene</span><span class="plain-syntax"> = </span><a href="3-scn.html#SP13" class="function-link"><span class="function-syntax">Scenes::from_named_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Instances::latest</span><span class="plain-syntax">());</span>
<span class="plain-syntax"> </span><a href="3-scn.html#SP15" class="function-link"><span class="function-syntax">Scenes::set_beat</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_scene</span><span class="plain-syntax">, </span><span class="identifier-syntax">db</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">db</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">during_scene_W</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">during_scene_W</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">scene</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;instance&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="3-scn.html#SP13" class="function-link"><span class="function-syntax">Scenes::from_named_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(...));</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax"> </span><span class="string-syntax">"%1 would like to make a beat which, judging by its heading, "</span>
<span class="plain-syntax"> </span><span class="string-syntax">"should be restricted to the scene '%2'. But there is no such scene."</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">during_scene</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Processing beats after pass 1. </b>It's now a little later, and the following is called to look at each beat and
Expand Down
Loading

0 comments on commit 60bc5b0

Please sign in to comment.