OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Bloax on January 02, 2016, 10:01:17 am

Title: [DONE] [Suggestion] Display soldier armor in the craft equipment screen
Post by: Bloax on January 02, 2016, 10:01:17 am
(https://dl.dropboxusercontent.com/u/63152810/n/xcom/xcom_armor_display.png) mockup images are useful (tm)
It might be useful for making people not forget to equip armor on their soldiers, which I imagine happens at times for the more forgetful players.
Mostly a feature for the mods with larger assortments of armor though, I guess.

(https://dl.dropboxusercontent.com/u/63152810/n/xcom/Craft_Unarmored.gif)(https://dl.dropboxusercontent.com/u/63152810/n/xcom/Craft_PersonalArmor.gif)(https://dl.dropboxusercontent.com/u/63152810/n/xcom/Craft_PowerArmor.gif)(https://dl.dropboxusercontent.com/u/63152810/n/xcom/Craft_FlyingSuit.gif)
These will probably need to have the proper palette applied to them, since I don't have anything but the tactical palette easily available.
Title: Re: Display soldier armor in the craft equipment screen
Post by: Solarius Scorch on January 03, 2016, 05:56:06 pm
A very nice feature, but it would making armours even harder. :P
Title: Re: Display soldier armor in the craft equipment screen
Post by: Bloax on January 03, 2016, 06:14:39 pm
The default fallback should just be the current situation.

And I'm pretty sure that as the difficulty of making armors goes, a vague 11x19 representation of the armor would be the least of your concerns.
Especially since Tasteful Recolors (tm) would do an alright job at such a low resolution.
Title: Re: Display soldier armor in the craft equipment screen
Post by: XOps on January 03, 2016, 06:51:41 pm
Yes please. :) I could very much use this. Also, it could come in handy if/when we start seeing some different soldier types.
Title: Re: Display soldier armor in the craft equipment screen
Post by: Meridian on January 24, 2016, 10:27:14 am
Should they be "sorted" like on the example screenshot or should they be displayed in actual order in craft?
Title: Re: Display soldier armor in the craft equipment screen
Post by: Dioxine on January 24, 2016, 12:25:40 pm
By craft's crew deployment order, definitely!
Title: Re: Display soldier armor in the craft equipment screen
Post by: mrxian on January 24, 2016, 12:49:41 pm
A very nice feature, but it would making armours even harder. :P
If you can make all the other sprites required for making armot, this tiny figurine shouldn't really be an issue.
Title: Re: Display soldier armor in the craft equipment screen
Post by: Solarius Scorch on January 24, 2016, 03:29:17 pm
If you can make all the other sprites required for making armot, this tiny figurine shouldn't really be an issue.

Agreed, hence the ':P'. making armours is such a pain though :)
Title: Re: Display soldier armor in the craft equipment screen
Post by: Bloax on January 24, 2016, 08:43:31 pm
Should they be "sorted" like on the example screenshot or should they be displayed in actual order in craft?
The actual order of the crew. It's "conveniently" sorted like that for clarity's sake.

Agreed, hence the ':P'. making armours is such a pain though :)
That depends on how stupendously detailed you're trying to make them. :^D
Title: Re: Display soldier armor in the craft equipment screen
Post by: Meridian on February 02, 2016, 11:02:42 pm
Done.

How it works:
1. if you add sprite sheet called "CustomArmorPreviews" you will override vanilla behaviour (use basescape palette!); otherwise business as usual
2. the sprites are 12x20 pixels (but only 10x18 pixels are used, topleft)
3. you can specify the index from the spritesheet to use by new armor attribute called "customArmorPreviewIndex", default is 0
4. preview shows soldiers in the order of deployment, maximum 22 though... sorry no more space on the screen

Sample screenshot and sample mod for experimentation is attached.
Download will be available soon in my main thread for OXCE+.

Ruleset example:

Code: [Select]
extraSprites:
  - type: CustomArmorPreviews
    width: 48
    height: 20
    subX: 12
    subY: 20
    files:
      0: Resources/UI/custom-armor-previews.png
armors:
  - type: STR_PIR_NONE_UC
    customArmorPreviewIndex: 0
  - type: STR_BASIC_ARMOR_UC
    customArmorPreviewIndex: 1
  - type: STR_TAC_VEST_UC
    customArmorPreviewIndex: 2
  - type: STR_PERSONAL_ARMOR_UC
    customArmorPreviewIndex: 3

PS: @Dioxine, your custom graphics seems to be misaligned (doesn't start at [0,0])... that's why also the screenshot has alignment issue with crew vs equipment
Title: Re: Display soldier armor in the craft equipment screen
Post by: Bloax on February 03, 2016, 12:46:24 am
Cool, not sure what's up with the lack of black outlines though. :o
Title: Re: Display soldier armor in the craft equipment screen
Post by: Meridian on February 03, 2016, 10:35:40 am
Cool, not sure what's up with the lack of black outlines though. :o

Black is the color with index = 0 in basescape palette (and probably all other palettes as well), which is at the same time the transparent color in xcom.

So either:
1. the outlines should be in different color... i.e. very dark grey
2. or background should be in another color (i.e. bright green) and set to transparent

BUT, according to standard, I think only option 1 is the proper and recommended solution.
(https://openxcom.org/forum/index.php/topic,4221.0.html)

Anyway, I am a total graphics noob, I just did the first thing that worked... and I leave the graphics to artists... my part (support for this feature) is done.
Title: Re: Display soldier armor in the craft equipment screen
Post by: R1dO on February 03, 2016, 02:26:20 pm
Black is the color with index = 0 in basescape palette (and probably all other palettes as well), which is at the same time the transparent color in xcom.

So either:
1. the outlines should be in different color... i.e. very dark grey
2. or background should be in another color (i.e. bright green) and set to transparent

BUT, according to standard, I think only option 1 is the proper and recommended solution.
(https://openxcom.org/forum/index.php/topic,4221.0.html)

If the engine works as supposed there should be no reason not to use a black color, as long as it's index != 0. For instance index 15 looks like a good candidate.
Point 2 is like a smart thing to do .. it makes it more clear which pixels are supposed to be transparent. Or even mark index 0 as the transparent pixel, although this gives troubles with 'advanced' editors doing fancy stuff.

Anyhow, just tried it on your attached file, based on the dolls from the first post (please keep in mind i am no pixel artist myself).
Does this work for you?
Title: Re: Display soldier armor in the craft equipment screen
Post by: Solarius Scorch on February 03, 2016, 02:29:28 pm
I think using non-black colours is safest after all. Sure, there are other ways, but it's not a problem to do and the artwork doesn't suffer.
Title: Re: Display soldier armor in the craft equipment screen
Post by: Meridian on February 03, 2016, 02:43:07 pm
Anyhow, just tried it on your attached file, based on the dolls from the first post (please keep in mind i am no pixel artist myself).
Does this work for you?

It does work.
The question is if it will still work with the newest nightly?

SupSuper said (see link above):

Graphics:
- Use 8-bit PNG (recommended: Photoshop, Aseprite).
- Use vanilla palettes.
- Don't optimize palettes.
- Transparent color must always be palette index 0 (first color).

So, if we cannot change the palette AND transparent must always be the first color... then it must always be black, which is transparent... or am I wrong?
Title: Re: Display soldier armor in the craft equipment screen
Post by: R1dO on February 03, 2016, 03:17:37 pm
Since i used the same approach as i did fixing the "large living quarters" (ask Solarius) i am pretty sure this will work on the new nightlies.

My understanding of "Use vanilla palettes" is more like: use it in your graphical editor so you know how the game will display it. The game will use the value of the index (0-255) and pick appropriate color from palette (that's why those pictures become "artistic' when u use them in a part of the game that uses a different palette).
This believe is by the palettes supsuper posted himself (have to search the forum for that) which defined index 0 as an alpha pixel (not black)).

Besides, if your current build does not show pink but transparency, i think the lodepng comit has already been included.
Title: Re: Display soldier armor in the craft equipment screen
Post by: g5-freemen on February 25, 2016, 11:03:30 am
Maybe possible to do something like that?
Title: Re: Display soldier armor in the craft equipment screen
Post by: Meridian on February 28, 2016, 05:42:41 pm
Maybe possible to do something like that?

Why would you want the same information twice?
Title: Re: [DONE] [Suggestion] Display soldier armor in the craft equipment screen
Post by: Meridian on July 21, 2018, 07:04:04 pm
In the next OXCE+ version, it will be possible to mod an already modded CustomArmorPreview.
For example, you will be able to create a PirateZ-submod, which will change the armor icons to ones you like better.

This feature is only possible if I make the sprite size fixed... which would normally not be a problem at all... but for some unexplainable reason, modders decided to completely ignore the sprite size I told them to use.

So instead of 10x18, the sprites must now be 12x20.
Please note that:
- still only the top 18 vertical pixels are rendered
- horizontally the icons are rendered each 10 pixels (NOT 12 pixels!), so good modders will use only the leftmost 10 pixels of each sprite
- bad modders can use all 12 pixels to create weird overlap effects if they so must

Attached is an updated version of the "vanilla" mod... since OXCE+ 2018-07-21, you will need this version instead of the old one.