enigma-dev/enigma-dev — pull request #685 by sorlok (2014-04-07 01:43:43+00:00)
Title: Functionality for "image_single"

As I'm sure you know, image_single is still supported in GM:S (even though they don't document it). A previous commit attempted to add this to Enigma via a macro, but in fact the semantics of image_single are more complicated than that. This patch adds in image_single; it was tested with GM 5 and GM:S.

There are only two things I am not 100% sure about.

First, this seems to return early if the current animation is "not done". I also had it return early if image_single was non-negative (i.e., active).
```
//events.res
animationend: 7
Name: Animation End
Mode: Special
Case: 7
Sub Check: {if (image_index + image_speed < sprite_get_number(sprite_index)) return 0; if (image_single >= 0) return 0; }
```

Second, this seems to check if image_index is not zero (with a modulus check thrown in). I did not add any check for image_single here.
```
//CompilerSource/compiler/event_reader/events.res
animationend: 7
Name: Animation End
Mode: Special
Case: 7
Sub Check: !(int(image_index) % image_count)
```

Image_single will only affect things if it's set to >=0, so existing behavior should be safe (that's why I filed the pull request). However, I'd like to understand what those two events.res examples are doing, if anyone could fill me in.