changeset 3:bd0f1253691d

Add documentation of ECL format.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 06 Aug 2011 13:42:40 +0200
parents 0a7e6e3d5327
children 617e7760fd9f
files 06/ecl.xhtml 06/ecl.xml 06/std.xhtml index.xhtml
diffstat 4 files changed, 119 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/06/ecl.xhtml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet type="text/css" href="../style.css"?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+	<head>
+		<title>ECL format</title>
+	</head>
+	<body>
+		<h1>ECL format</h1>
+
+		<h2>Header</h2>
+<pre>
+typedef struct {
+    uint32_t sub_count;
+    uint32_t main_offset;
+    uint32_t padding[2]; // Always 0.
+    uint32_t subs_offsets[sub_count];
+} thecl06_header_t;
+</pre>
+
+
+		<h2>Sub</h2>
+		<p>Starting at 0x10.<br/>They describe the appearance and comportment of a certain type of enemy</p>
+		<p>Ends with frame_num = 0xffffffff and opcode = 0xffff, for a size of 0xc (the minimum) and default masks.</p>
+		<p>Parameters are dependants of the opcode.</p>
+<pre>
+typedef struct {
+    uint32_t frame_num;
+    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 bytes at 0 indicates the number of items in the stack.
+    unsigned char params[size-0xc];
+} thecl06_sub_t;
+</pre>
+
+
+		<h2>Main</h2>
+		<p>Each instruction contains its size (which is always greater than 8, or else the game crashs). The only values encountered in the game are 0x1c, 0x10 and 8, but values of 0x38 work (skip the next instruction).<br/>
+		The frame_num must greater than or equal to the previous, or the instruction will be skipped.<br/>
+		The parsing ends when frame_num is 0xffff.</p>
+<pre>
+typedef struct {
+    uint16_t frame_num;
+    uint16_t unused1;
+    uint16_t unused2;
+    uint16_t size;
+    uint8_t arguments[size-8];
+} thecl_main_instr_t;
+</pre>
+
+		<p>Most present instruction, that pops an enemy.</p>
+<pre>
+typedef struct {
+    uint16_t time;
+    uint16_t sub; // Sub function to use.
+    uint16_t <a href="#type">type</a>;
+    uint16_t size; // Really the size of the instruction. NOT ignored by the game.
+    float x;
+    float y;
+    float z; // Unused, always 0.
+    int16_t resistance; // From 0 to 0x7fff; greater is equal to 0.
+    uint16_t unknown1;
+    uint16_t unknown2;
+    uint16_t unknown3;
+} thecl_enemy_t;
+</pre>
+
+		<p>Unknown, used only at the end of each stage.</p>
+<pre>
+typedef struct {
+    uint16_t time;
+    uint16_t sub; // always 0.
+    uint16_t <a href="#type">type</a>; // always 0xa.
+    uint16_t size;
+    float unused1; // always 0.
+    float unused2; // always 0.
+} thecl_other1_t;
+</pre>
+
+		<p>Unknown, used only at the end of each stage. Always in group of 1, 2 or 3, with a sequence of (9), (8, 9) or (0xc, 8, 9).</p>
+<pre>
+typedef struct {
+    uint16_t time;
+    uint16_t sub; // always 0.
+    uint16_t <a href="#type">type</a>;
+    uint16_t size;
+} thecl_other2_t;
+</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>
+		<style type="text/css">
+			li.used {
+				font-weight: bold;
+			}
+		</style>
+		<ol start="0">
+			<li class="used">normal enemy</li>
+			<li>normal enemy</li>
+			<li class="used">mirrored enemy</li>
+			<li>mirrored enemy</li>
+			<li class="used">normal enemy</li>
+			<li>normal enemy</li>
+			<li class="used">mirrored enemy</li>
+			<li>mirrored enemy</li>
+			<li class="used">starts the msg (which?)</li>
+			<li class="used">nothing?</li>
+			<li class="used">crash!?</li>
+			<li>nothing?</li>
+			<li class="used">nothing?</li>
+			etc.
+		</ol>
+	</body>
+</html>
--- a/06/ecl.xml
+++ b/06/ecl.xml
@@ -380,12 +380,12 @@
 
 	<op>
 		<num>49</num>
-		<name></name>
+		<name>set_random_?</name>
 		<params>
 			<param type="f" values="0.7853982f">The new angle?.</param>
 			<param type="f" values="2.3561945f">Some deplacement?.</param>
 		</params>
-		<desc>Used only five times, in <stage>2</stage>.</desc>
+		<desc>Used only five times, in <stage>2</stage>. Seems to involve some randomness.</desc>
 	</op>
 
 	<op>
--- a/06/std.xhtml
+++ b/06/std.xhtml
@@ -25,6 +25,7 @@ typedef struct {
     char song2_path[128];
     char song3_path[128]; // ? A single blank if unused
     char song4_path[128]; // ? A single blank if unused
+    uint32_t offsets[nb_objects]; // offsets of the start of each object of section 1
 } thstd_header_t;
 </pre>
 
@@ -60,13 +61,6 @@ struct object {
 };
 </pre>
 
-		<p>The following description is symbolic.</p>
-<pre>
-struct section1 {
-    uint32_t offsets[]; // header.nb_objects offsets towards objects
-};*/
-</pre>
-
 
 		<h2>Second section</h2>
 		<p>This section is responsible for placing objects from section 1 in the space.</p>
--- a/index.xhtml
+++ b/index.xhtml
@@ -11,6 +11,7 @@
 		<ul>
 			<li><a href="06/pbg3.xhtml">PBG3</a> (dat archives)</li>
 			<li><a href="06/std.xhtml">STD</a> (stages)</li>
+			<li><a href="06/ecl.xhtml">ECL</a> (enemies and patterns)</li>
 		</ul>
 		<h3>Opcodes</h3>
 		<ul>