[RESOLVED] Global anim starts from non-first part

Found a bug in R'n'D? Report it here!

Moderators: Flumminator, Zomis

Post Reply
User avatar
Eizzoux
Posts: 571
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

[RESOLVED] Global anim starts from non-first part

Post by Eizzoux »

For some reason very rarely I had such issue, when the global anim which I pretty much scripted to go through a certain linear path by putting several parts of the same copypasted sprite from '.part_1' to '.part_7' with different starting positions and different step-by-step movement, and after the anim goes through all that movement, it should stop on '.part_8' which is just empty sprite on the [0,0] of the screen. For some reason the anim just wouldn't appear. I tried instead making '.part_8' the same as others (making it visible) but putting it on whatever spot '.part_7' ends up before switching to '.part_8', and, for some reason, the anim just starts on '.part_8', skipping all other 7 parts which it was intended to go through.
what_the_heck_lol.zip
(1.64 MiB) Downloaded 260 times
𒈟
User avatar
Holger
Site Admin
Posts: 4081
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Global anim starts from non-first part

Post by Holger »

Oh well... after some testing around with your test level set (nice main screen, by the way ;-) ), I know what's going in here.

And yes, the observed behaviour in this case is indeed unexpected, and to be honest, it looks like buggy behaviour in most use cases. :(

The thing is that the ".draw_order" attribute is in fact used to sort both animations ("anim_1" .. "anim_x") and animation parts ("anim_x.part_1" .. "anim_x.part_y") before processing them. This is used to draw animations just in the determined order, drawing animations with a higher number over those with a lower number.

So far, so good. BUT: This also means that animation parts of the same animation, but with different ".draw_order", are also processed in that order. Yes, this is as close to being a program bug as can be, as this is simply not expected in most cases. The only sane reason to do things that way is when you have an animation with several parts that are all displayed at the same time (using ".anim_mode: all" for the main animation), but that should use a certain draw order. In this case, the "part number" does not matter, as all parts are displayed in this case. But the sad truth is that animation parts are sorted by "draw order" before being sorted by their part number. (But in this case, using the part number to determine the draw order would just work as fine.)

In your example level set, just add a line "global.anim_1.part_8.TITLE_2.draw_order: 4", and everything works as expected. (That is, all parts had a "draw order", but not "part_8", so it got sorted to an unexpected position!)

I think I really should change this! :?
User avatar
Holger
Site Admin
Posts: 4081
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Global anim starts from non-first part

Post by Holger »

I think I really should change this! :?
Just did that, and pushed everything out as a new game version 4.3.8.0! See the release notes for some more details. (Especially most of the quirks and issues with global animations that we discussed the last few days should be fixed now.)
Post Reply