OpenXcom Forum

Modding => OXCE Support => OpenXcom Extended => OXCE Support Y-scripts => Topic started by: Alex_D on February 24, 2022, 03:08:22 pm

Title: [Solved] death frames and flying units frame issue
Post by: Alex_D on February 24, 2022, 03:08:22 pm
I've prepared a sprite-sheet for a flying unit (drawing routine 0) with both male and female torsos, and with 8 death frames, like so:
Code: [Select]
armors:
  - type: STR_CAT_3_YELLOW_ARMOR_UC
    movementType: 1
    deathFrames: 8

The game appears to render the legs and torsos in a strange way.
Kato has also confirmed the problem.
@developers, I can PM the sprite-sheet if required.
Title: Re: [possible bug] death frames and flying units frame issue
Post by: Yankes on February 24, 2022, 04:08:39 pm
Could you show screen shot of it?
Title: Re: [possible bug] death frames and flying units frame issue
Post by: Alex_D on February 24, 2022, 04:33:05 pm
Could you show screen shot of it?

Here's a game screenshot, and another cutout of the WIP of the sprite sheet. The remaining 5 death frames are blank.

Title: Re: [possible bug] death frames and flying units frame issue
Post by: Alex_D on February 24, 2022, 07:24:07 pm
Upon further testing and chats, it seems that until the code is fixed, the only way for a flying unit to have more than three death frames (and up to 11 frames) is not to have an alternate female torso and shift back the flying legs to their frame slot as if the death frames were originally the default three.

Edit: add example
Title: Re: [bug] death frames and flying units frame issue
Post by: Alex_D on March 20, 2022, 10:00:49 pm
Any plans on looking at this bug?
Title: Re: [bug] death frames and flying units frame issue
Post by: Yankes on March 21, 2022, 01:32:13 am
Right now no, as there is workaround available, with y-scripts you can shit index of body parts and have space for death frames.
Title: Re: [bug] death frames and flying units frame issue
Post by: Alex_D on March 23, 2022, 07:10:25 pm
My expertise of scripts isn't that good. Do you have some examples at hand that could be used to by-pass this problem?
Title: Re: [bug] death frames and flying units frame issue
Post by: Yankes on March 23, 2022, 10:01:42 pm
Yes, I can prepare some examples, question is it will be used globally or only for one armor?
Title: Re: [bug] death frames and flying units frame issue
Post by: Alex_D on March 24, 2022, 01:44:34 pm
Yes, I can prepare some examples, question is it will be used globally or only for one armor?

I'd prefer globally. However, if the code is small, I assume it can be incorporated on a case-by-case basis, as I doubt this feature is to become the majority anytime soon.
At the moment the issue was for one, maybe two armors for one future mod in Piratez, we used a workaround in the meantime. But I'm thinking about the future of any other mod.

So whichever is easier.
Title: Re: [bug] death frames and flying units frame issue
Post by: Yankes on March 24, 2022, 02:41:01 pm
ok, I will prepare some examples today. As I check code recently, current version of OXCE do not have enough data exposed to make script like this, I will update engine too to make this script possible or at least more reliable and simple.
Title: Re: [bug] death frames and flying units frame issue
Post by: Yankes on March 25, 2022, 12:35:54 am
Code: [Select]
extended:
  scripts:
    selectUnitSprite:
      - offset: -2
        code: |
          var int drawingRoutine;
          var int deathFrames;
         
          if or
            eq blit_part blit_torso
            eq blit_part blit_legs
          ;
            var ptr RuleArmor armor;
            unit.getRuleArmor armor;
            armor.getDrawingRoutine drawingRoutine;
            armor.getDeathFrames deathFrames;
            if and
              eq drawingRoutine 0
              gt sprite_index 264  #bigger than first death frame
              gt deathFrames 3
            ;
              sub deathFrames 3;
              add sprite_index deathFrames;
            end;
          end;
          return sprite_index;
Global script, check for `drawingRoutine: 0`  and for e.g. `deathFrames: 5`.

Script shift all frames after death frame by additional death frames.