Author Topic: [DONE] Support for surface weapon vapor trail  (Read 928 times)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8628
    • View Profile
[DONE] Support for surface weapon vapor trail
« on: May 14, 2020, 08:14:53 pm »
Since OXCE v6.5, having surface weapon vapor trail is possible also for non-hybrid mods, i.e. just normal xcom1-based mods.

Steps are also much easier than for hybrid mods.

Sample mod attached.



EDIT: backlink for the Hybrid-mods version of this: https://openxcom.org/forum/index.php/topic,7390.msg116775.html#msg116775
« Last Edit: February 01, 2023, 10:28:50 pm by Meridian »

Offline efrenespartano

  • Commander
  • *****
  • Posts: 748
  • I know a lot about the law and other lawyerings.
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #1 on: May 23, 2020, 07:36:38 pm »
Wonderful! I expected to have this feature a long time ago.

Question: I notice the vaporColors are limited to four colors: white, cyan, orange and green. Could be possible the add more colors (like red or purple)?

Also: how does
Code: [Select]
colors works?

Code: [Select]
transparencyLUTs:
  - colors:
      - [  8,  8, 12, 2 ] # "white"

Those numbers are indexes on the Battlescape palette?
« Last Edit: May 23, 2020, 07:40:53 pm by efrenespartano »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8628
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #2 on: May 23, 2020, 07:48:59 pm »
Question: I notice the vaporColors are limited to four colors: white, cyan, orange and green. I tried your test mod and I found that the cyan, the white and the green were basically the same. Could be possible the add more colors (like red or purple)?

They are not the same, but they can sometimes appear the same based on what is in the background.

For example green and cyan on green background will look almost the same.
But the same cyan and green on light grey background will look different.
Try it.

OpenXcom palette is very limited and simulating transparency just isn't possible in all background/foreground color combinations.


Also: how does
Code: [Select]
colors works?

Code: [Select]
transparencyLUTs:
  - colors:
      - [  8,  8, 12, 2 ] # "white"

Those numbers are indexes on the Battlescape palette?

I don't know how it works... I was trying to read it for a long time, but it's too cryptic without someone telling you what it is.

As far as I can tell, the numbers correspond to [(R)ed, (G)reen, (B)lue, Step], where R G B are not real RGB (0-255), also not xcom RGB (0-63) and also not OpenXcom colors/indices.
I also don't know what values they can have, probably between 0 and 15, but that's just a wild guess. "Step", no idea.

Probably the only guy who can answer this is Warboy.
If you find out, do let us know!

Offline Yankes

  • Commander
  • *****
  • Posts: 3209
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #3 on: May 23, 2020, 07:58:23 pm »
If I recall correctly this is "desired" color you want have, after that game iterate for each palette and try find best matches for desired color.
Logic is somthing like:
Get some color for palette, mix in your desired color in RGB, now for this new color in RGB find best match in same palette.
This will give transition from original color to final one in same palette and it represent transparent vapor cloud.

Offline efrenespartano

  • Commander
  • *****
  • Posts: 748
  • I know a lot about the law and other lawyerings.
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #4 on: May 24, 2020, 09:33:11 am »
They are not the same, but they can sometimes appear the same based on what is in the background.

For example green and cyan on green background will look almost the same.
But the same cyan and green on light grey background will look different.
Try it.

OpenXcom palette is very limited and simulating transparency just isn't possible in all background/foreground color combinations.

Hahaha I noticed it after I tried on the Polar terrain. My bad, that's why I deleted that specific part of my question hahaha.  ;D
The change is more noticeable if the
Code: [Select]
vaporDensitySurface is set above 20.

Quote
I don't know how it works... I was trying to read it for a long time, but it's too cryptic without someone telling you what it is.

As far as I can tell, the numbers correspond to [(R)ed, (G)reen, (B)lue, Step], where R G B are not real RGB (0-255), also not xcom RGB (0-63) and also not OpenXcom colors/indices.
I also don't know what values they can have, probably between 0 and 15, but that's just a wild guess. "Step", no idea.

Probably the only guy who can answer this is Warboy.
If you find out, do let us know!

If I recall correctly this is "desired" color you want have, after that game iterate for each palette and try find best matches for desired color.
Logic is somthing like:
Get some color for palette, mix in your desired color in RGB, now for this new color in RGB find best match in same palette.
This will give transition from original color to final one in same palette and it represent transparent vapor cloud.


Oh, dang. I think I could do some random tries to see if I could get a new color, then. Thanks for the quick reply, folks.  :D

Offline Ethereal

  • Commander
  • *****
  • Posts: 628
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #5 on: April 15, 2021, 03:26:58 pm »
Vapor works only underwater.
Fake underwater... as the name says... is not underwater.

For surface (including fake underwater) missions, you can use surface vapor.

Poporobuy. "Vapor...Surface" does not work with setting depth on the terrain. And without the set depth, "drawBubbles", underwater animation of explosions, missions and  race "_UNDERWATER" do not work.

In my modification, the rocket launchers have "vaporColorSurface:" and "vaporDensitySurface:", but this only works on land. And if we set the usual "vaporColor: vaporDensity:" we get -

Code: [Select]
[15-04-2021_15-25-20] [FATAL] A fatal error has occurred: Segmentation fault.
[15-04-2021_15-25-20] [FATAL] 0x5b6d50 OpenXcom::CrossPlatform::stackTrace(void*)
[15-04-2021_15-25-20] [FATAL] 0x5b7bc0 OpenXcom::CrossPlatform::crashDump(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[15-04-2021_15-25-20] [FATAL] 0x41c7f0 signalLogger(int)
[15-04-2021_15-25-20] [FATAL] 0x9ba390 OpenXcom::UfopaediaStartState::think()
[15-04-2021_15-25-20] [FATAL] 0x774e72fc _C_specific_handler
[15-04-2021_15-25-20] [FATAL] 0x774fbee0 _chkstk
[15-04-2021_15-25-20] [FATAL] 0x774cff00 RtlInitializeResource
[15-04-2021_15-25-20] [FATAL] 0x774fb5f0 KiUserExceptionDispatcher
[15-04-2021_15-25-20] [FATAL] 0x55f0f0 OpenXcom::Map::drawTerrain(OpenXcom::Surface*)
[15-04-2021_15-25-20] [FATAL] 0x68ed50 OpenXcom::Surface::blit(SDL_Surface*)
[15-04-2021_15-25-20] [FATAL] 0x68d290 OpenXcom::State::blit()
[15-04-2021_15-25-20] [FATAL] 0x5cef20 OpenXcom::Game::run()
[15-04-2021_15-25-20] [FATAL] 0x41c950 SDL_main
[15-04-2021_15-25-20] [FATAL] 0x9bbec0 console_main
[15-04-2021_15-25-20] [FATAL] 0x9bbfe0 WinMain
[15-04-2021_15-25-20] [FATAL] ??
[15-04-2021_15-25-20] [FATAL] ??
[15-04-2021_15-25-20] [FATAL] 0x77385550 BaseThreadInitThunk
[15-04-2021_15-25-20] [FATAL] 0x774e3840 RtlUserThreadStart
[15-04-2021_15-25-23] [FATAL] OpenXcom has crashed: Segmentation fault.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8628
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #6 on: April 15, 2021, 04:53:50 pm »
If you're using depth on fake underwater terrain it counts as normal underwater again, and normal vapor should work too.

Upload a save where it doesn't work pls.
« Last Edit: April 15, 2021, 04:57:17 pm by Meridian »

Offline Ethereal

  • Commander
  • *****
  • Posts: 628
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #7 on: April 15, 2021, 05:20:38 pm »
Saves is not necessary. You can simply test it in "Battle" mode. In this mode, everything works the same as in a regular game. I checked. Very convenient, by the way.

Although, here's the save, if that's more convenient for you.
« Last Edit: April 15, 2021, 05:42:17 pm by Ethereal »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8628
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #8 on: April 15, 2021, 06:42:12 pm »
You are missing PAL_BATTLESCAPE_3 (for sea depth = 3).

Just add this to your custom palettes and it will work.

Code: [Select]
  - type: PAL_BATTLESCAPE_3L83
    target: PAL_BATTLESCAPE_3
    file: Resources/PALS/battlescape_seadepth2.jasc

And of course also this for STR_HWP_ROCKETS

Code: [Select]
    vaporColor: 9
    vaporDensity: 40

Offline Ethereal

  • Commander
  • *****
  • Posts: 628
    • View Profile
Re: Support for surface weapon vapor trail
« Reply #9 on: April 15, 2021, 07:28:43 pm »
You are missing PAL_BATTLESCAPE_3 (for sea depth = 3).

Just add this to your custom palettes and it will work.

And of course also this for STR_HWP_ROCKETS

Thank you very much. I would never have guessed. Everything works fine.