Author Topic: Alternative explosion sprite  (Read 4292 times)

Offline Ran

  • Colonel
  • ****
  • Posts: 191
    • View Profile
Alternative explosion sprite
« on: May 17, 2014, 08:26:04 pm »
How are explosion sprites implemented in the ruleset (are they at all)?

I wanted to implement the already existing alternative explosion sprite
https://openxcom.org/forum/index.php?topic=1257.0
but it won't work. The game always displays the original explosion. :(

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2336
  • Developer
    • View Profile
Re: Alternative explosion sprite
« Reply #1 on: May 17, 2014, 08:46:29 pm »
you'd have to replace the frames in https://www.ufopaedia.org/index.php?title=X1.PCK

Offline Ran

  • Colonel
  • ****
  • Posts: 191
    • View Profile
Re: Alternative explosion sprite
« Reply #2 on: May 17, 2014, 09:33:06 pm »
Yes, I know that, but how? :-[
Can this be done in the ruleset section of extra files or only by replacing the original?
I can't even open pck files let alone modify them

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2336
  • Developer
    • View Profile
Re: Alternative explosion sprite
« Reply #3 on: May 17, 2014, 11:55:33 pm »
same way we do all the extraSprites, just replace frames 0-7 of X1.PCK with your own images. something like the following:

Code: [Select]
extraSprites:
  - type: X1.PCK
    files:
      0: Resources/Explosion/Explode.png
    width: 512
    height: 128
    subX: 128
    subY: 64
« Last Edit: May 17, 2014, 11:58:25 pm by Warboy1982 »

Offline Ran

  • Colonel
  • ****
  • Posts: 191
    • View Profile
Re: Alternative explosion sprite
« Reply #4 on: May 18, 2014, 10:23:51 pm »
But doesn't that replace all explosions?
I want to make different explosion sprites for some weapons but I can't define explosionAnimation in the weapons section.
And hitAnimation uses SMOKE.pck so it's no help either. :(

EDIT: Actually it's really strange - I defined the new explosion as 1 and a blue version as 0.
What I get is a mixture of yellow explosions with a bit of blue for every weapon.

The same happened with the recolored hit sprites when I tried to create a gun which can take all possible color-forms as ammo.
The bullets work perfectly but the hitsprites are a firework of overlays, all sprites being displayed in the order of filenames, the last one on top.
« Last Edit: May 18, 2014, 11:08:58 pm by Ran »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5276
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Alternative explosion sprite
« Reply #5 on: May 20, 2014, 07:13:50 am »
Sounds like you've mismatched sprite numbers. Any sprite form Smoke.pck has 10 frames, not 1, so you need to take that into account when indexing. The first free number is 56, so you should index your first new hit sprite 56, the next 66 etc. Same probably holds true for the explosions, but I haven't tried to modify them myself yet. Try to change the 2nd explosion index from 1 to 8.
« Last Edit: May 20, 2014, 07:16:53 am by Dioxine »

Offline Ran

  • Colonel
  • ****
  • Posts: 191
    • View Profile
Re: Alternative explosion sprite
« Reply #6 on: May 22, 2014, 01:55:21 am »
Ah, that makes sense!
Will try that tomorrow.

I wish those things were documented somewhere. The Ufopaedia ruleset resource is a great introduction but such details are beyond me.
When working on rulesets I sometimes feel like a monkey hammering on a typewriter until Shakespeare's collected works are produced.
There's always a chance it will work out, but it usually takes a looong time... :-\


Offline Ran

  • Colonel
  • ****
  • Posts: 191
    • View Profile
Re: Alternative explosion sprite
« Reply #7 on: June 18, 2014, 12:16:36 am »
Ok, the hit sprites work now, and weird explosions are also fixed if you space apart the file numbers by 8.
Still you can only replace the original explosion sprite, not create different ones for different weapons.

So my request to all you coding wizards out there - could we pleease have custom explosion sprites? :-[
I mean, the option to define something like:

Code: [Select]
items:
  - type: STR_GRENADE_1
    explosionAnimation: 2
  - type: STR_GRENADE_2
    explosionAnimation: 10
extraSprites:
 - type: X1.PCK   
    width: 512
    height: 128
    subX: 128
    subY: 64
    files:
      2: Resources/Explosions/Explosion1.png
      10: Resources/Explosions/Explosion2.png


Offline clownagent

  • Colonel
  • ****
  • Posts: 381
    • View Profile
Re: Alternative explosion sprite
« Reply #8 on: July 02, 2014, 08:29:39 pm »
Custom explosion sprites for different weapons would be really great.