changeset 7:2a7b9d62c0c4

Fix details, and details and documentation for a few instructions
author Thibaut Girka <thib@sitedethib.com>
date Tue, 23 Aug 2011 11:58:03 +0200
parents 578e67aa3c03
children c5b074b0abbd
files 06/anm.xml 06/ecl.xhtml 06/ecl.xml 06/std.xhtml
diffstat 4 files changed, 59 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/06/anm.xml
+++ b/06/anm.xml
@@ -30,8 +30,9 @@
 
 	<op>
 		<num>3</num>
+		<name>set_alpha</name>
 		<params>
-			<param type="S"></param>
+			<param type="S">alpha (0 to 255)</param>
 		</params>
 	</op>
 
@@ -44,9 +45,11 @@
 
 	<op>
 		<num>5</num>
+		<name>jump</name>
 		<params>
-			<param type="S"></param>
+			<param type="S">relative offset of the instruction to jump to</param>
 		</params>
+		<desc>Jump to the given instruction and reset the frame counter to the instruction's frame.</desc>
 	</op>
 
 	<op>
@@ -68,10 +71,11 @@
 
 	<op>
 		<num>10</num>
+		<name>set_3d_rotation_speed</name>
 		<params>
-			<param type="f"></param>
-			<param type="S"></param>
-			<param type="f"></param>
+			<param type="f">-x</param>
+			<param type="f">y</param>
+			<param type="f">-z</param>
 		</params>
 	</op>
 
@@ -101,7 +105,8 @@
 
 	<op>
 		<num>15</num>
-		<desc>A kind of return</desc>
+		<name>keep_still</name>
+		<desc>When this instruction is called, the sprite is a still image: the script stops without the sprite disappearing.</desc>
 	</op>
 
 	<op>
@@ -189,16 +194,20 @@
 
 	<op>
 		<num>27</num>
+		<name>shift_texture_x</name>
 		<params>
-			<param type="f"></param>
+			<param type="f">dx</param>
 		</params>
+		<desc>Add dx to the x coordinates of the texture, causing the texture to "move".</desc>
 	</op>
 
 	<op>
 		<num>28</num>
+		<name>shift_texture_y</name>
 		<params>
-			<param type="f"></param>
+			<param type="f">dy</param>
 		</params>
+		<desc>Add dy to the y coordinates of the texture, causing the texture to "move".</desc>
 	</op>
 
 	<op>
--- a/06/ecl.xhtml
+++ b/06/ecl.xhtml
@@ -29,7 +29,7 @@ typedef struct {
     uint16_t <a href="ecl.xml">opcode</a>;
     uint16_t size; // Never less than 0xc.
     uint16_t rank_mask; // the first byte is always 0xff, and the second the mask of the ranks to which the instruction applies, 1 for easy, 8 for lunatic.
-    uint16_t param_mask; // If the last param is a stack, the number of bits at 0 indicates the number of items in the stack.
+    uint16_t param_mask; // Unused in EoSD, always 255. It is used in other Touhou games to indicate whether an argument is an "address" or not, though.
     unsigned char params[size-0xc];
 } thecl06_sub_t;
 </pre>
@@ -92,7 +92,7 @@ typedef struct {
 </pre>
 
 		<h3 id="type">Type</h3>
-		<p>Used in the game are: 0, 2, 4, 6 for the enemies (0x1c-long), 0xa for the 0x10-long instruction, and 8, 9 and 0xc for the 8-long one.</p>
+		<p>Used in the game are: 0, 2, 4, 6 for the enemies (0x1c-long), 0xa for the 0x10-long instruction, and 8, 9 and 0xc for the 8-long one. Type might be quite a misnomer since those are pretty much flags.</p>
 		<style type="text/css">
 			li.used {
 				font-weight: bold;
@@ -104,9 +104,9 @@ typedef struct {
 			<li class="used">mirrored enemy</li>
 			<li>mirrored enemy</li>
 			<li class="used">normal enemy</li>
-			<li>normal enemy</li>
+			<li>normal enemy (random placement)</li>
 			<li class="used">mirrored enemy</li>
-			<li>mirrored enemy</li>
+			<li>mirrored enemy (random placement)</li>
 			<li class="used">starts the msg (which?)</li>
 			<li class="used">nothing?</li>
 			<li class="used">crash!?</li>
--- a/06/ecl.xml
+++ b/06/ecl.xml
@@ -8,13 +8,9 @@
 	<text>
 		<div xmlns="http://www.w3.org/1999/xhtml">
 			<h2>Lvalues and Rvalues / direct vs memory indirect addressing</h2>
-			<p>In EoSD, most 32-bits arguments passed to instructions may be actual values or variable/register indexes.<br/>
-			[TODO: verify] values inferior to -10000 are variable/register indexes, whereas values superior to this are actual values.<br/>
-			Values passed through variable/register indexes are Lvalues, other values are not. Some instructions require some of their operands to be Lvalues.<br/>
-			Another way to look at it would be C++-style references. <code>ins_20</code> would then be <code>ins_20(int32 &amp;value, float a, float b);</code></p>
-
-			<p>Note: variables seems to be somehow superposed to the enemy's state structure, with <code>-10015 = x</code> and <code>-10016 = y</code>.</p>
-
+			<p>In EoSD, most 32-bits arguments passed to instructions may be actual values or variable indexes.<br/>
+			Values comprised between -10025 and -10001 are variable indexes, whereas other values are actual values.
+			Values passed through variable/register indexes are Lvalues, other values are not. Some instructions require some of their operands to be Lvalues.</p>
 
 			<h2>Accessing values</h2>
 			<p>[TODO: verify] How the game accesses values passed as argument is as follows:<br/>
@@ -29,6 +25,7 @@ else
 			<p>Only variables in the range [-10001, -10025] without -10014, -10020 and -10023 are used in the game.</p>
 
 			<h3>Local variables</h3>
+			<p>Local variables may be read or written by the script, they are local to a subroutine, and put on a stack when a subroutine is called. They are not used by the game engine itself.</p>
 			<table>
 				<tr><th>Number</th><th>Type</th></tr>
 				<tr><td>-10001</td><td>int</td></tr>
@@ -46,6 +43,7 @@ else
 			</table>
 
 			<h3>Special variables</h3>
+			<p>Special variables are game or enemy-scoped variables and most of them cannot be overriden by the script.</p>
 			<table>
 				<tr><th>Number</th><th>Type</th>	<th>Name</th>		<th>RW/RO</th>	<th>Notes</th></tr>
 				<tr><td>-10013</td><td>int</td>		<td>rank</td>		<td>ro</td>	<td></td></tr>
@@ -232,8 +230,8 @@ else
 		<name>add</name>
 		<params>
 			<param type="S" name="variable" unit="var_id" var="must"/>
-			<param type="f" name="a"/>
-			<param type="f" name="b"/>
+			<param type="f" var="can" name="a"/>
+			<param type="f" var="can" name="b"/>
 		</params>
 		<desc>variable = a + b; Warning: a and b will be dereferenced as integers (not converted) if variable is an integer!</desc>
 	</op>
@@ -243,8 +241,8 @@ else
 		<name></name>
 		<params>
 			<param type="S" name="variable" unit="var_id" var="must"/>
-			<param type="f" name="a"/>
-			<param type="f" name="b"/>
+			<param type="f" var="can" name="a"/>
+			<param type="f" var="can" name="b"/>
 		</params>
 		<desc>variable = a - b; Warning: a and b will be dereferenced as integers (not converted) if variable is an integer!</desc>
 	</op>
@@ -286,8 +284,8 @@ else
 		<num>27</num>
 		<name>compare_ints</name>
 		<params>
-			<param type="S" name="a"/>
-			<param type="S" name="b"/>
+			<param type="S" var="can" name="a"/>
+			<param type="S" var="can" name="b"/>
 		</params>
 		<desc>Compare a and b, store the result (-1 if a &lt; b, 0 if a == b, 1 if a > b) in the "comparison register".</desc>
 	</op>
@@ -400,7 +398,7 @@ else
 			<param type="f" name="y"/>
 			<param type="f" name="y" values="0">Ignored</param>
 		</params>
-		<desc>Move the enemy to a new position, using interpolation.</desc>
+		<desc>Move the enemy to a new position, used for interpolation.</desc>
 	</op>
 
 	<op>
@@ -462,7 +460,7 @@ else
 
 	<op>
 		<num>51</num>
-		<name>set_speed_forward_player</name>
+		<name>set_speed_towards_player</name>
 		<params>
 			<param type="S" value="0">Ignored</param>
 			<param type="f" name="speed" unit="pixels/frame"/>
@@ -502,7 +500,7 @@ else
 			<param type="f" name="y" unit="pixels"/>
 			<param type="f" name="z" unit="pixels" values="0.0f">Ignored</param>
 		</params>
-		<desc>Move the enemy to the new position in this amount of frames.</desc>
+		<desc>Move the enemy to the new position in this amount of frames. TODO: find the exact interpolation method</desc>
 	</op>
 
 	<op>
@@ -750,17 +748,17 @@ else
 		<params>
 			<param type="s"/>
 			<param type="s"/>
-			<param type="f"/>
-			<param type="S"/>
-			<param type="f"/>
-			<param type="f"/>
-			<param type="f"/>
-			<param type="f"/>
-			<param type="S"/>
-			<param type="S"/>
-			<param type="S"/>
-			<param type="S"/>
-			<param type="S"/>
+			<param type="f" name="angle" unit="radian">clockwise, from the +x axis</param>
+			<param type="S" name="speed" unit="pixels/frame">speed of the laser along its axis</param>
+			<param type="f" name="start_offset" unit="pixels">offset along the laser axis, relative to the enemy. If negative, it is considered as 0.</param>
+			<param type="f" name="end_offset" unit="pixels">offset along the laser axis, relative to the enemy. Can be negative. In case end_offset &lt; start_offset, the laser will be in the oposite direction.</param>
+			<param type="f" name="length" unit="pixels">TODO: Not really a length, something really odd. The laser starts at max(start_offset, end_offset - length) and ends at end_offset.</param>
+			<param type="f" name="width" unit="pixels"/>
+			<param type="S" name="start_duration" unit="frames"/>
+			<param type="S" name="duration" unit="frames"/>
+			<param type="S" name="stop_duration" unit="frames"/>
+			<param type="S" name="grazing_dealy" unit="frames">how long to wait before allowing grazing</param>
+			<param type="S" name="grazing_extra_duration" unit="frames">how long to allow grazing after the laser started to disappear</param>
 			<param type="S" values="0"/>
 		</params>
 		<desc></desc>
@@ -768,21 +766,21 @@ else
 
 	<op>
 		<num>86</num>
-		<name></name>
+		<name>laser_towards_player</name>
 		<params>
 			<param type="s"/>
 			<param type="s"/>
-			<param type="f"/>
-			<param type="f"/>
-			<param type="S"/>
-			<param type="f"/>
-			<param type="f"/>
-			<param type="f"/>
-			<param type="S"/>
-			<param type="S"/>
-			<param type="S"/>
-			<param type="S"/>
-			<param type="S"/>
+			<param type="f" name="angle" unit="radian">clockwise, from the enemy->player axis</param>
+			<param type="S" name="speed" unit="pixels/frame">speed of the laser along its axis</param>
+			<param type="f" name="start_offset" unit="pixels">offset along the laser axis, relative to the enemy. If negative, it is considered as 0.</param>
+			<param type="f" name="end_offset" unit="pixels">offset along the laser axis, relative to the enemy. Can be negative. In case end_offset &lt; start_offset, the laser will be in the oposite direction.</param>
+			<param type="f" name="length" unit="pixels">TODO: Not really a length, something really odd. The laser starts at max(start_offset, end_offset - length) and ends at end_offset.</param>
+			<param type="f" name="width" unit="pixels"/>
+			<param type="S" name="start_duration" unit="frames"/>
+			<param type="S" name="duration" unit="frames"/>
+			<param type="S" name="stop_duration" unit="frames"/>
+			<param type="S" name="grazing_dealy" unit="frames">how long to wait before allowing grazing</param>
+			<param type="S" name="grazing_extra_duration" unit="frames">how long to allow grazing after the laser started to disappear</param>
 			<param type="S" values="0"/>
 		</params>
 		<desc></desc>
--- a/06/std.xhtml
+++ b/06/std.xhtml
@@ -113,7 +113,7 @@ typedef struct { // type == 0
 
 
 typedef struct { // type == 2
-    uint32_t unknown_x; //TODO
+    float center_dx; // x delta between the camera position and its view center
     float center_dy; // y delta between the camera position and its view center
     float dz; // z coordinate of the camera, divided by -835.979370
 } thstd_viewpos2_instr_t;