Complex Transformation

Table of Contents

About Transformations

Basically, Bullet transformations are a seperate language that is written from within ECL.
Bullet transformations have an instruction id, 4 integer and 4 float arguments.
These are the Instructions that define complex transformations:

    bh_set_instr(S handle_num, S part_num, S slot, S type, S a, S b, S c, S d, f r, f s, f m, f n)
    bh_set_instr_s(S handle_num, S part_num, S slot, S type, S a, S b, f r, f s)
    bh_set_instr_auto(S handle_num, S slot, S type, S a, S b, S c, S d, f r, f s, f m, f n)
    bh_set_instr_s_auto(S handle_num, S slot, S type, S a, S b, f r, f s)

the _s instructions hide 2 of the 4 instruction arguments, the auto
instruction appends to the end of the instruction queue and calculates the part_num argument by itself.

Bullet transformations can run in seperate slots independent from each other.
Here is an example showing how the arguments should be interpreted:

part_num slot 0 slot 1
0 spawn_animation wait 120
1 none Cancel bullet
 

In ECL, this would be defined like so:

// slot 0, part_num 0: Spawn animation 1
bh_set_instr_s(HANDLE, 0, 0, 2, 1, -999999, -999999f, -999999f)

// slot 1, part_num 0: Wait 120
bh_set_instr_s(HANDLE, 0, 1, 4096, 120, -999999, -999999f, -999999f)
// slot 1, part_num 1: Cancel bullet
bh_set_instr_s(HANDLE, 1, 1, 8192, -999999, -999999, -999999f, -999999f)

For unused arguments, you should put -999999.

If a direction is required, you can sometime aim to the player with [-999f].
(You cannot use [-9989f] to aim bullets to the player, because it is evaluated from the position of the entity before the bullet is spawned)

If you use the same part_num twice, the second will overwrite the first.

Bullet transformation instructions, like the ECL instruction set, have changed over the games.
Here are some Transformations that I know of:

th12 - 128

ID Short Name Description
0x00000001 step Launches the bullets a bit forward
0x00000002 launch Launches the bullets a bit forward and plays the spawn animation. a sets the animation type
0x00000004 aimacc Accelerate the bullets by r in the direction s within time a.
0x00000008 chdir Wait b, then accelerate the bullets by r and rotate them by s within time a.
0x00000010 haltrel For b times, reduce the speed of the bullets to 0 within a, rotate by r, then change speed to s.
0x00000020 haltaim For b times, reduce the speed of the bullets to 0 within a, aim to player with offset r, then change speed to s.
0x00000040 halt For b times, reduce the speed of the bullets to 0 within a, set direction to r, then change speed to s.
0x00000080   Unknown
0x00000100 reflect Reflect the bullets off walls a times. the first 4 bytes of b are used to set the walls to reflect from.
0x00000200 nocancel Make the bullets 'invincible' for time a
0x00000400 nobounds Make the bullets able to go offscreen for time a
0x00000800 chsprite Change the sprite of the bullets to a with color b
0x00001000 wait Waits a
0x00002000 cancel Cancels the bullet
0x00004000 SE Plays a sound effect
0x00008000   Unused
0x00010000   Unused
0x00020000   Unknown
0x00040000   Unknown
0x00080000 spawn Spawns a clone of the current bullet handle. a is divided into 4 integers of 2 bytes that make up (in order) the arguments for bh_set_arrange_mode, bh_set_color, and the part_num the spawned bullet will start executing. b ist the count of bullets, r is direction and s is speed
0x00100000   Unknown
0x00200000   if a is -1, the local entity variable [-9985] will become 1 if the entity is near a bullet of this handle. if a is -5 and the bullet is within the radius [-9981f] of the player the transformation jumps to part_num 14. When the player leaves the radius, the part_num jumps to 5.
0x00400000 jump Jumps to part_num a
0x00800000   Unknown
0x01000000   Unknown
0x02000000   Unknown
0x04000000   Unknown
0x08000000   Unknown
0x10000000 setadditive If a, sets the bullet to use additive blending
0x20000000 chdirspd in time a, change speed to r and direction to s.

Last Update: 2019-07-14 So 12:35

Validate