aliens

Author Topic: Help with ExtraSprites and the tank.  (Read 6472 times)

Offline Phezzan

  • Sergeant
  • **
  • Posts: 37
  • Twilight
    • View Profile
Help with ExtraSprites and the tank.
« on: June 24, 2013, 07:15:37 pm »
I've been pulling my hair out for hours trying to figure out
why my tank's main body is transparent under the turret.

It's almost as if "_part 3" isn't being drawn, but the width changes based on the turret rotation (width of the turret)

Background - I extracted TANKS.PCK and recolored the default tank using colormap shenanigans. (There's probably a much better way, but it worked)
I had to replace all the index 254 color values with 0.
I dumped these files into Resources/TANK_2 and added an 'extraSprites' chunk for them similar to the Combat Armor (awesome mod btw).
Then I tell my new 'Advanced Laser Tank' to use that.

The left and right parts and the turret show up fine, but all the pixels 'below' the turret are not rendered.
If I remove the turret (in the debugger set it to -1) the body shows up fine.

Thanks for reading.

Phez
« Last Edit: June 24, 2013, 07:30:55 pm by Phezzan »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Help with ExtraSprites and the tank.
« Reply #1 on: June 24, 2013, 07:19:17 pm »
mind uploading?
easier for me to debug that way.

Offline Phezzan

  • Sergeant
  • **
  • Posts: 37
  • Twilight
    • View Profile
Re: Help with ExtraSprites and the tank.
« Reply #2 on: June 24, 2013, 07:32:49 pm »
Sure, I added a .7z to the original post, and thanks for taking a look.

I was totally wrong about the width changing with the turret - it changes with body facing only.

It does draw the body properly if I set the turret to -1.  Set it back to 2 to see the problem again.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Help with ExtraSprites and the tank.
« Reply #3 on: June 24, 2013, 07:48:29 pm »
it's the palette.

here's what i see:

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Help with ExtraSprites and the tank.
« Reply #4 on: June 24, 2013, 08:10:32 pm »
here's the fixed version
« Last Edit: June 24, 2013, 08:21:58 pm by Warboy1982 »

Offline Phezzan

  • Sergeant
  • **
  • Posts: 37
  • Twilight
    • View Profile
Re: Help with ExtraSprites and the tank.
« Reply #5 on: June 24, 2013, 09:53:42 pm »
Thanks for that.

I see the images have a reduced palette now... I guess I need to know what I did wrong.
If there's a sprite tutorial somewhere I might've missed it?
I found this explanation about extraSprites - learned a few things, but I'm still missing something with regard to palettes.
https://openxcom.org/forum/index.php/topic,430.15.html

I assume the palette within the images doesn't matter - only the pixel color indexes.
What did you use to fix this, and was it a batch operation?

I've been using GIMP, manually - but with hotkeys - the process is this:
Open (image extracted by pckview)
Modify image
Set RGB color
Set Indexed color -> a palette image from this forum
Paint background with index 0, double check index with eyedropper.
Export to GIF
repeat

Thanks again.
PS: to the extent that I might have any creative control over anything I post, I renounce it.
« Last Edit: June 24, 2013, 10:19:53 pm by Phezzan »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Help with ExtraSprites and the tank.
« Reply #6 on: June 25, 2013, 10:53:42 am »
you'd be better off using a colour that doesn't exist within the standard palette for index 0 (bright green, or pink for example) rather than black. GIMP may be giving you false results with the eyedropper tool. i use "transparent" myself.

as for the way the colours are treated within the sprite, yes, only the indexes matter.
yes, i used a batch operation:

open file,
convert to RGB, (optional step, this step was unnecessary for yours)
convert to 256 colour and import palette from file, (i have these saved separately as .act files, readable by photoshop)
select colour range from pixel 0x0,
delete selection, (my .act files contain "transparent" as colour index 0)
save file,
close file.

granted this isn't a foolproof method, but it takes 99% of the work out of it for me.


Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Help with ExtraSprites and the tank.
« Reply #7 on: June 25, 2013, 01:43:35 pm »
you should also be aware that The GIMP, as cool as it is, does not handle paletted images very well.

I already found and reported a bug (no sure if it's fixed now) which causes the palette to be truncated to the point that it only contains colors up to the highest-index-color used in the image. that is, if you try to create an image with a 256 color palette, but only use colors 0-46 and 100-105, the resulting image after saving will have a palette that only contains colors 0-105. all remaining colors are simply dropped.
bummer.
so if you want to add something later, you have to re-load the palette from somewhere else.