# HG changeset patch # User Emmanuel Gil Peyrot # Date 1314037851 -7200 # Node ID b3644dff344c9e060a87eadfc0dbd50e9a5f5d81 # Parent 617e7760fd9f38797ab0a88c93a16331505a26fc Way too much changes. :/ diff --git a/06/ecl.xhtml b/06/ecl.xhtml --- a/06/ecl.xhtml +++ b/06/ecl.xhtml @@ -29,7 +29,7 @@ typedef struct { uint16_t opcode; 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. + 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. unsigned char params[size-0xc]; } thecl06_sub_t; @@ -60,9 +60,12 @@ typedef struct { float y; float z; // Unused, always 0. int16_t resistance; // From 0 to 0x7fff; greater is equal to 0. + int16_t object_dropped; // Between -2 and 2. + // 0000 to 00ff: power + // ff00 to ffff: random + // other: nothing uint16_t unknown1; - uint16_t unknown2; - uint16_t unknown3; + uint16_t unknown2; // 0 for normal enemies; 1 for mid-boss; 3 or 4 for boss. } thecl_enemy_t; diff --git a/06/ecl.xml b/06/ecl.xml --- a/06/ecl.xml +++ b/06/ecl.xml @@ -3,91 +3,153 @@ - ECL opcodes + ECL Sub format + + +
+

Lvalues and Rvalues / direct vs memory indirect addressing

+

In EoSD, most 32-bits arguments passed to instructions may be actual values or variable/register indexes.
+ [TODO: verify] values inferior to -10000 are variable/register indexes, whereas values superior to this 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.
+ Another way to look at it would be C++-style references. ins_20 would then be ins_20(int32 &value, float a, float b);

+ +

Note: variables seems to be somehow superposed to the enemy's state structure, with -10015 = x and -10016 = y.

+ + +

Accessing values

+

[TODO: verify] How the game accesses values passed as argument is as follows:
+ TYPE is the type of the argument (float, int32, ...):

+ +
if ((TYPE) argument < -10000)
+    return *(TYPE*) &variables[(int)(-10000-(TYPE) argument)];
+else
+    return (TYPE) argument;
+ +

Variables

+

Only variables in the range [-10001, -10025] without -10014, -10020 and -10023 are used in the game.

+ +

Local variables

+ + + + + + + + + + + + + + +
NumberType
-10001int
-10002int
-10003int
-10004int
-10005float
-10006float
-10007float
-10008float
-10009int
-10010int
-10011int
-10012int
+ +

Special variables

+ + + + + + + + + + + + + + + +
NumberType Name RW/RO Notes
-10013int rank ro
-10014int difficulty ro Unused.
-10015float x rw
-10016float y rw
-10017float z rw
-10018float player_x ro
-10019float player_y ro
-10020float ro Unused.
-10021float enemy_player_angle ro
-10022int last_frame rw
-10023float enemy_player_distanceroUnused.
-10024int life rw
-10025int player ro 0 = ReimuA, 1 = ReimuB, 2 = MarisaA, 3 = MarisaB
+ +

Opcodes

+
+
0 - return - Returns from the current function. + noop + Do nothing. 1 - return + delete - + Unknown - Always at the end of the function. Often after a very long amount of time, like 10000 frames. + Delete the sprite and perhaps free the memory used. 2 - + relative_jump - - + + Starting from the start of the current opcode. - + Unconditionally jump to relative_offset with new frame counter. Used as a while. 3 - + relative_jump_ex - - - + + + - + If the counter is non-null, jump to relative_offset with new frame counter, and decrease counter counter_id by 1. Used as a for. 4 - + set_int - - + + - + Assign a value to the variable. Sometimes, value can be another variable. 5 - + set_float - - + + - + Like 4, but with a float as value. 6 - + set_random_int - - + + - + Assign an integer in the [0, value) range to the variable. 8 - + set_random_float - - + + - + Like 6, but with a float as value. 9 - - - + + + @@ -96,7 +158,7 @@ 10 - + Used only one time, in 2. @@ -105,9 +167,9 @@ 13 - - - + + + @@ -116,9 +178,9 @@ 14 - - - + + + @@ -127,9 +189,9 @@ 15 - - - + + + @@ -138,9 +200,9 @@ 16 - - - + + + @@ -149,9 +211,9 @@ 17 - - - + + + @@ -160,40 +222,40 @@ 18 - + 20 - + add - - - + + + - + variable = a + b; Warning: a and b will be dereferenced as integers (not converted) if variable is an integer! 21 - - - + + + - + variable = a - b; Warning: a and b will be dereferenced as integers (not converted) if variable is an integer! 23 - - - + + + @@ -202,11 +264,11 @@ 25 - - - - - + + + + + @@ -215,27 +277,27 @@ 26 - + 27 - + compare_ints - - + + - + Compare a and b, store the result (-1 if a < b, 0 if a == b, 1 if a > b) in the "comparison register". 28 - - + + @@ -244,8 +306,8 @@ 29 - - + + @@ -254,28 +316,28 @@ 30 - - + + 31 - + relative_jump_if_equal - - + + Starting from the start of the current opcode. - + Jump if the "comparison register" equals to 0, that is, if the compared values are equal. 32 - - + + Used only one time in 4 @@ -284,8 +346,8 @@ 33 - - + + @@ -294,21 +356,21 @@ 34 - - + + 35 - + call - - - + + + - + Call given sub with -10001 = param1, -10005 = param2 @@ -319,43 +381,43 @@ 39 - + call_if_equal - - - - - + + + + + - + Call given sub with -10001 = param1, -10005 = param2 if a == b 43 - + set_position - - - + + + Ignored - + Move the enemy to a new position, using interpolation. 45 set_angle_speed - Angle in radians, 0.0f is left, PI/2 is down. - Speed in pixels per frame. + 0.0f is left, PI/2 is down. + Set the angular trajectory and speed of the enemy. 46 - set_angle + set_rotation_speed - The new angle, in radians. + Change the angular trajectory of the enemy. It continues to turn until this function is called again. @@ -364,7 +426,7 @@ 47 set_speed - The new speed. + Change the speed of the enemy. @@ -373,7 +435,7 @@ 48 set_acceleration - New step. + Change the speed of the enemy step by step, at each frame. @@ -382,8 +444,8 @@ 49 set_random_? - The new angle?. - Some deplacement?. + The new angle? + Some deplacement? Used only five times, in 2. Seems to involve some randomness. @@ -392,29 +454,29 @@ 50 - - + + 51 - + set_speed_forward_player - - + Ignored + - Used only one time in 2 + Sets the speed of the enemy, and change its direction to where the player is at that frame. Used only one time in 2. 52 - - - + + + @@ -423,155 +485,155 @@ 56 - - - - + + + + Used only two times in 7 57 - + move_to - - - - + + + + Ignored - + Move the enemy to the new position in this amount of frames. 59 - + move_to2 - - - - + + + + - + Move the enemy to the new position in this amount of frames. TODO: how it is different from move_to? 61 - + stop_in - + - + keep a straight trajectory with decelerating speed to stop in duration frames. 63 - + 65 - + set_screen_box - - - - + + + + - + Disallow an enemy to quit the defined rectangle. If it goes outside it is destroyed. By default this rectangle is the displayed screen. 66 - - + clear_screen_box + Remove the limit set in 65. 67 set_bullet_attributes - Bullet sprite. - Launch sprite. - Number of bullets per salvo. - Number of salvos. - Speed. - Speed2?. - Launch angle. - Angle between two bullets of a same salvo. - (>= 64, freezed). + + + + + + + + + >= 64, freezed - Modify the attributes of the next enemy attack + Modify the attributes of the next enemy attack. Directs it to the player. 68 - - - - - - - - - + + + + + + + + + - Supposedly the same as 67. + The same as 67, except the shot is directed to the right of the enemy. 69 - - - - - - - - - + + + + + + + + + - + No visible difference from 67. 70 - - - - - - - - - + + + + + + + + + - + No visible difference from 68. 71 - - - - - - - - - + + + + + + + + + @@ -580,15 +642,15 @@ 74 - - - - - - - - - + + + + + + + + + Used only one time, in 3. @@ -597,24 +659,24 @@ 75 - - - - - - - - - + + + + + + + + + - + Seems like 68, but with some differences in speed. 76 - + @@ -623,30 +685,30 @@ 77 bullet_interval - In frames. + - Time between two salvos. + Time between two shots. 78 - - Seems related to attacks, but removing them doesn't change anything... + delay_attack + If present, delays the first attack of the amount of frames defined by 77. If not, the enemy shoots instantly after setting the bullets attributes. 79 - - Seems related to attacks, but removing them doesn't change anything... + no_delay_attack + 81 bullet_launch_offset - x offset. - y offset. - + + + Ignored Change the offset of the launch of bullets. @@ -655,14 +717,14 @@ 82 - - - - - - - - + + + + + + + + @@ -670,36 +732,36 @@ 83 - + No-op? Doesn't seem to change anything. 84 - + 85 - + laser - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -708,51 +770,51 @@ 86 - - - - - - - - - - - - - - + + + + + + + + + + + + + + 87 - + set_upcoming_id - + - + Sets upcoming laser to a given id, in order to manipulate it later. 88 - + alter_laser_angle - - + + - + Adds delta to the laser's angle. 90 - - - - + + + + Used only one time, in 7. @@ -761,7 +823,7 @@ 92 - + @@ -770,9 +832,9 @@ 93 set_spellcard - - The number of the spellcard, as it will be counted in the captured spellcards. - The name of the spellcard, in SHIFT_JIS. + + As in the captured spellcards screen, minus 1. + In SHIFT_JIS @@ -787,13 +849,13 @@ 95 - - - - - - - + + + + + + + @@ -806,32 +868,32 @@ 97 - set_enemy_sprite + set_enemy_anim - Sprite number. + Set a sprite (taken from current anm) for the enemy. 98 - + set_boss_anims - - - - - + + + + + Perhaps two int16_t instead. - + Give a set of animations for a boss deplacements. 99 - - + + @@ -840,158 +902,158 @@ 100 set_death_anim - In fact, any 256n+[0-2] works and is the same; other values make the program crash. + In fact, any 256n+[0-2] works and is the same; other values make the program crash. When the enemy is destroyed, the animation used. 101 - + set_boss_mode - + Unknown meaning, seems to be 0 for mid-boss and -1 for real boss. - + Activates the boss mode, with her life bar and lives number displayed on the top. Doesn't do anything before calling 126. 102 - - - - - + + + + + - + Create the "squares" running around Rumia ??? 103 - set_enemy + set_enemy_hitbox - Size of the enemy hitbox. - - + + + Ignored - The two last parameters are unknown + 104 - + - + noop? 105 - + set_vulnerable - + - + if x & 1, the enemy can take damage, else it cannot. 106 - + play_sound - + - + Play a sound. 107 - + set_death_flags - + - + Control what to do when life falls to zero. 0 = normal, 1 = don't clean the sprite, 2 = don't die, 4 (unused) = don't die and don't drop bonus. These are flags that can be combined. 108 - + call_when_killed - + - + Specify the subroutine to call when the enemy is killed. 109 - - + + 111 - + set_life - + - + equivalent to 4(-10024, life) 112 - + 113 - + set_boss_lower_life_limit - + - + When enemy's life gets lower or equal to the limit, the callback set by 114 is called. 114 - + set_boss_callback - + - + Specify the sub to call when the enemy's life gets below a certain amount set by a 113. 115 - + set_timeout - + - + Sets the timeout of the current boss attack. 116 - + - + Doesn't seem to do anything. Tried to remove it, use 0, 1, 127, 1023, 1024, 4096 as an argument, nothing... ??? 117 - + @@ -1000,28 +1062,28 @@ 118 - - - - + + + + - + TODO: "explosion" (dying boss) 119 - + drop_bonus - + - + Drop a certain number of bonus at the frame it is called. If the power is not max, drop power items, else drop point items. 120 - + @@ -1030,8 +1092,8 @@ 121 - - + + @@ -1040,7 +1102,7 @@ 122 - + @@ -1049,7 +1111,7 @@ 123 - + @@ -1058,7 +1120,7 @@ 124 - + @@ -1071,18 +1133,18 @@ 126 - + set_boss_lives - + Can even be negative. :D - + Sets the remaining lives of a boss. Should be called at the start of each round. 127 - + @@ -1091,7 +1153,7 @@ 128 - + @@ -1100,8 +1162,8 @@ 129 - - + + @@ -1110,7 +1172,7 @@ 130 - + @@ -1119,12 +1181,12 @@ 131 - - - - - - + + + + + + @@ -1133,7 +1195,7 @@ 132 - + @@ -1154,7 +1216,7 @@ 135 - + diff --git a/10/ecl.xml b/10/ecl.xml --- a/10/ecl.xml +++ b/10/ecl.xml @@ -12,13 +12,13 @@ 1 return - A return instruction. + A return instruction. 10 return - A return instruction. + A return instruction. @@ -35,7 +35,7 @@
  • That the data is of integer type, but is used as a float type. (0x6669)
  • That the data is of integer type. (0x6969)
  • -

    In the current syntax this is represented by prefixing the data with either (int) or (float).

    +

    In the current syntax this is represented by prefixing the data with either (int) or (float).

    The parameters seem to end up on the stack of the called subroutine.

    @@ -258,7 +258,6 @@ 79 -

    Takes no parameters.

    diff --git a/html.xsl b/html.xsl --- a/html.xsl +++ b/html.xsl @@ -1,36 +1,37 @@ - type="text/css" href="../style.css" <x:value-of select="o:title"/>

    - + + + + +
    - -
    -
    - -

    +

    - - + - -

    + @@ -41,16 +42,18 @@ -

    +
    - + + + + -
    TypeDescriptionNameUnitVariableNotes ValuesRange
    @@ -59,14 +62,20 @@ - - + + + + + + + + + + + + + - - - - - to @@ -98,16 +107,14 @@
    - -

    + + + + - - - - - - + +

    @@ -123,10 +130,20 @@ - stage + stage - instruction + + + + + instruction + + + + + +