Difference between revisions of "Animation string"

From WTFwiki
Jump to navigation Jump to search
(Start list of known non-tags appearing in AF and BK files)
(→‎Tags: More information on 'b' flags)
Line 72: Line 72:
 
| al ||
 
| al ||
 
|-
 
|-
| b1 ||
+
|colspan=2| <hr>
 
|-
 
|-
| b2 ||
+
| '''b<...>''' || The b codes control the rendering method used for the sprite. A variable '''b''' is set to a ''visibility level'', and is linearly interpolated throughout the frame from the '''bs''' value to the '''bf''' value.
|-
+
<pre>
| ba<n> ||
+
<math>
 +
b = bs + (bf - bs) * tick / ticksThisFrame
 +
</math>
 +
</pre>
 +
The '''bf''' value is set by the tags ''bb'', ''bf'', ''bj'', ''bl'', ''bm''. These tags all also set some ''bflags'' which control the rendering effect.
 
|-
 
|-
| bb<n> || ''Screen shake with magnitude n''
+
| b1 || bflags |= 0x2000
 
|-
 
|-
| bc<n> ||
+
| b2 || bflags |= 0x4000
 
|-
 
|-
| bd ||
+
| bb<n> || bflags |= 0x0010, bf := n ''Screen shake with magnitude n''
 
|-
 
|-
| be || ''Something related to victory/scrap/destruction animations?''
+
| be || bflags |= 0x0800 ''Something related to victory/scrap/destruction animations?''
 
|-
 
|-
| bf<n> || ''Blend finish with opacity n < 256''
+
| bf<n> || bflags |= 0x0001, bf := n ''Blend finish with opacity n < 256''
 
|-
 
|-
| bg ||
+
| bh || bflags |= 0x0040
 
|-
 
|-
| bh ||
+
| bl<n> || bflags |= 0x0008, bf := n
 
|-
 
|-
| bi<n> ||
+
| bm<n> || bflags |= 0x0100, bf := n
 
|-
 
|-
| bj<n> ||
+
| bj<n> || bflags |= 0x0400, bf := n
 
|-
 
|-
| bk<n> || crashes if not in arena?
+
| bs<n> || ''Blend start with opacity n < 256 (the sprite is drawn at this opacity at the start of the frame and gradually transitioned to whatever is set as the blend finish value)''
 
|-
 
|-
| bl<n> ||
+
| bu || bflags |= 0x8000
 
|-
 
|-
| bm<n> ||
+
| bw || bflags |= 0x0080
 
|-
 
|-
| bn ||
+
| bx || bflags |= 0x0002
 
|-
 
|-
| bo<n> ||
+
|colspan=2| <hr>
 
|-
 
|-
 
| '''bp<...>''' || The bp codes control scene lighting. A variable '''bp''' is set to a ''light level'', and is linearly interpolated throughout the frame from the '''bpb''' value to the '''bpp''' value. The '''bpd''' tag specifies a reference color (r,g,b) by palette index.
 
| '''bp<...>''' || The bp codes control scene lighting. A variable '''bp''' is set to a ''light level'', and is linearly interpolated throughout the frame from the '''bpb''' value to the '''bpp''' value. The '''bpd''' tag specifies a reference color (r,g,b) by palette index.
Line 130: Line 134:
 
| bps<n> || bps := n
 
| bps<n> || bps := n
 
|-
 
|-
| br || ''Draw additively''
+
|colspan=2| <hr>
 +
|-
 +
| ba<n> ||
 +
|-
 +
| bc<n> ||
 +
|-
 +
| bd ||
 +
|-
 +
| bg ||
 +
|-
 +
| bi<n> ||
 
|-
 
|-
| bs<n> || ''Blend start with opacity n < 256 (the sprite is drawn at this opacity at the start of the frame and gradually transitioned to whatever is set as the blend finish value)''
+
| bk<n> || crashes if not in arena?
 
|-
 
|-
| bt ||
+
| bn ||
 
|-
 
|-
| bu ||
+
| bo<n> ||
 
|-
 
|-
| bw ||
+
| br || ''Draw additively''
 
|-
 
|-
| bx ||
+
| bt ||
 
|-
 
|-
 
| by ||
 
| by ||

Revision as of 20:09, 22 November 2009

Basic format

Animation strings are of the form:

<frame descriptor 1>-<frame descriptor 2>-...-<frame descriptor n>

Frame descriptors are a sequence of lowercase tags followed by an uppercase frame letter and an integer frame duration:

zzA1

For instance:

x-5A3-x-3B2-x-2C1-x-1D1

divides up as:

Tags Frame Duration
x-5 A 3
x-3 B 2
x-2 C 1
x-1 D 1

Tags

There are a lot of available tags. Not all of them are understood. Some of them take numeric parameters, which are indicated in angle brackets below. Such parameters must match the regular expression:

 -?+\?[0-9]*

An omitted parameter is treated as 0.

Here's a complete list of all tags. Descriptions in italics may be unreliable.

Tag Notes
aa
ab
ac
ad
ae
af
ag
ai
am
ao
as
at
aw
ax
ar
al

b<...> The b codes control the rendering method used for the sprite. A variable b is set to a visibility level, and is linearly interpolated throughout the frame from the bs value to the bf value.
<math>
b = bs + (bf - bs) * tick / ticksThisFrame
</math>

The bf value is set by the tags bb, bf, bj, bl, bm. These tags all also set some bflags which control the rendering effect.

b1 = 0x2000
b2 = 0x4000
bb<n> = 0x0010, bf := n Screen shake with magnitude n
be = 0x0800 Something related to victory/scrap/destruction animations?
bf<n> = 0x0001, bf := n Blend finish with opacity n < 256
bh = 0x0040
bl<n> = 0x0008, bf := n
bm<n> = 0x0100, bf := n
bj<n> = 0x0400, bf := n
bs<n> Blend start with opacity n < 256 (the sprite is drawn at this opacity at the start of the frame and gradually transitioned to whatever is set as the blend finish value)
bu = 0x8000
bw = 0x0080
bx = 0x0002

bp<...> The bp codes control scene lighting. A variable bp is set to a light level, and is linearly interpolated throughout the frame from the bpb value to the bpp value. The bpd tag specifies a reference color (r,g,b) by palette index.
<math>
bp = bpb + (bpp - bpb) * tick / ticksThisFrame
r_i' = max(63, r_i + bp * r / 64)
g_i' = max(63, g_i + bp * g / 64)
b_i' = max(63, b_i + bp * b / 64)
</math>
bpb<n> bpb := n (starting light level)
bpd<n> bpd := n specifies a color (palette index)
bpf if (some global flag) then bps48bpn48 (full light) else bps1bpn47 (transition to full light)
bpn<n> bpn := n
bpo bpo := 1
bpp<n> bpb := n, bpp := n
bps<n> bps := n

ba<n>
bc<n>
bd
bg
bi<n>
bk<n> crashes if not in arena?
bn
bo<n>
br Draw additively
bt
by
bz
cf
cg
cl
cp Apply the damage for the current animation to opponent
cw
cx<n>
cy<n>
d<n> d1 is the animation string for the third to last frame in all the scrap metal damage bits that fall off of a HAR
e
f toggle flag Flip sprite verticially
g
h
i
jf2
jf
jg
jh
jj
jl
jm
jn<n>
jp
jz combination of all other j flags except jn
k<n>
l<n>
ma<n> if n == 1000 then n := random(360)
mc
md<n> Destroy animation n
mg<n>
mi<n>
mm<n> mm := n
mn<n>
mo something involving HARs, applied to object mm
mp<n>
mrx<n> mx := random(320 - 2*mm) + n
mry<n> my := random(200 - 2*mm) + n
ms my := -4 * (f1C - 188)
mu<n> similar to mo, n < 1024, applied to object mm
mx<n> mx := n
my<n> my := n
m<n> Create instance of animation n
n
ox<n> ox := n
oy<n> oy := n
p[...] all p tags have special cleanup code
pa
pb<n> n < 512
pc<n> n < 512
pd<n> n < 256
pe make pa, pb, pc, pd operate on the other HAR
ph disable pa, pb, pc, pd
pp<n>
ps update a color palette
ptd<n>
ptp<n>
ptr<n>
q
r toggle a global Flip sprite horizontally
s<n> Play sound n
sa
sb<n> same as se<n> plus setting one other value to n
sc<n> sc0 is different from other sc tags
sd
se<n> similar to sl<n+1> (the latter also clears the high byte of the value)
sf<n> Sound frequency n
sl<n> Sound loudness n
smf<n>
smo<n>
sp<n> Sound panning n?
sw<n> sw<n> sets an internal counter to max(current value, n). This counter is decreased at a rate of either 2 or 4 units per game tick, down to 0. If the counter gets to 100 or above, the game pauses for a little while.
t
ua
ub motion blur
uc
ud
ue
uf
ug
uh
uj
ul
un
ur
us
uz
v
vsx also does v.
vsy actually vsK where K is anything other than x. also does v.
w
x<...> /x-?\+?=?-?\+?[0-9]*/ is accepted but in practice it'll be one of...
x-<n> Move x by n left?
x+<n> Move x by n right?
x=<n> Interpolate to x=<m> on next frame?
x<n> Set x to n?
y<...> /y-?\+?=?-?\+?[0-9]*/ is accepted but in practice it'll be one of...
y-<n> Move y by n left?
y+<n> Move y by n right?
y=<n> Interpolate to y=<m> on next frame?
y<n> Set y to n?
zg
zh
zj
zl
zm
zp
zz Combination of all other z flags. Player is invincible for this frame

Error handling

A handful of animation strings used by the AF and BK files provided with OMF2097 are ill-formed. The behaviour in the case of ill-formed strings in the OMF engine is inconsistent, but at least the following non-tags must be accepted and ignored by any correct parser:

Tag Used by Notes
zc Pyros' Shadow Super Thrust
x+4zcubs21l50zp
Probably a typo for zp. It looks like someone added 'zp's at the end of all the tags later when it was found to be not working properly (probably because of this zc). The tags for the frames before and after both contain zp.