aliens

Author Topic: MCD Edit by volutar  (Read 124349 times)

volutar

  • Guest
MCD Edit by volutar
« on: April 21, 2014, 08:23:27 pm »
Old MCDedit is failing to work on win64. Running it with dosbox-win311 is a kind of perversion.
So I tried to make a replacement tool.

https://www.ufopaedia.org/index.php?title=MCDEdit

Features are the same as in original mcdview.
Everything is pretty much the same or better.

Game type /palette (for tftd) are changed at right top corner.
Checker is "checkered" invisible background just to detect holes instead of blacks.
Yellow labbeled MCDs are animated.
Animation frames/LOFT images/SCANG are clickable (and you can change it visually from selector).
Numbers are editable, and totally discarded if you won't push "Save MCD+PCK+TAB" (from File menu). But make sure you have a backup of those.

"Edit" menu works on 100% only for non vanilla tilesets (it doesn't allow for insert/delete/clear of MCD info for vanilla). Non-vanilla tilesets are fully editable: you can either delete or insert extra MCDs (folder+name defines if it's vanilla or not, so you can just make a renamed copy of mcd+pck+tab - and it will be fully editable).

Paths for gamedata IS configurable (set in MCDEdit.txt).
In TFTD (even in steam version) there are 112 LOFTs instead of 114, in this package game data is "vanillified", and uneccesary files are removed.

Recommended image editor which works with indexed images on pixel level - mtPaint. Nice palette selection, pixel-precise editing (drawing cursor also can be moved with cursor keys), tile grid (for our needs - 32x40).

P.S. Post is updatable, new versions will be in the same place.

P.P.S. pck clipboard copy/paste - failed to implement. Because it doesn't have any point, windows clipboard is uncapable of handling paletted bmp properly.

history:
2014.04.22 21:05 - added pck export as PNG (particular image, or whole sheet) - by RMB context menu. PNG is saved using current selected palette.
2014.04.22 22:04 - added "orphan" pck color tagging (they are red-yellow). Lots of them can be found in tftd.
2014.04.27 02:00 - added insert of blank pck, and delete of "orphan" pck (when trying to delete used - it will tell you which MCDs are using it). MCD+PCK integrity is kept (pck references in MCDs are updated). Also added import of PNG (particular single tile, not whole sheet). Preferred PNG format - with untouched vanilla palette. PNGs with screwed palette also imported (as RGBA images), but most probably it could cause color ambiguity.
2014.04.29 03:10 - rearranged loft (vertical feels more natural), added palette helper with ambiguous colors, 3d loft/animation image is now "rotatable" with mouse button - rotate 3d loft by steps of 45 degrees (after releasing button - it returns back to 0), also can change angle with trackbar (it will be kept).
2014.04.30 04:00 - fixed working folder change issue (relative paths were changed after getting into other folder in file selector).
2014.05.01 01:55 - added hint box with description; names and hints are in config file; now can open custom mcds (by clicking checkbox or through File menu); when custom mcd is opened - you can choose any palette and gametype(affects on minimap images and lofts). version up to 1.11
« Last Edit: July 29, 2014, 06:44:18 am by Warboy1982 »

Offline Ran

  • Colonel
  • ****
  • Posts: 196
    • View Profile
Re: MCD Edit by volutar
« Reply #1 on: April 22, 2014, 12:05:27 am »
Thank you very much!
Having to deal with Win3.11 really was a pain...

volutar

  • Guest
Re: MCD Edit by volutar
« Reply #2 on: April 22, 2014, 06:15:27 pm »
Added pck export as PNG (particular image, or whole sheet) - by RMB context menu. PNG is saved using current selected palette. Color 0 is transparent (as it should).
I didn't find how to make photoshop use color index values instead of RGB. So I don't really know if it even capable of that, it some other picture editor will be needed. Most of TFTD color palettes shares RGB values between different colorgroup, and editing in RGB mode could cause unwanted visual bugs.

Example of exported tftd GRUNGE4 pck sheet. Notice white "templates" - they are in the game, but aren't used for MCDs.
Also 5th row dark blue tiles are actually black (for terrain palette), but getting blue colors when they are in the shades (blacks are actually light, and blue is shadow). Yes, this kind of mess is often happening in tftd. And it's just a beginning.
« Last Edit: April 22, 2014, 06:21:36 pm by volutar »

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: MCD Edit by volutar
« Reply #3 on: April 22, 2014, 06:19:08 pm »
First of all, thanks for this invaluable tool! I've been using it since yesterday and my world got a little better. :)

I didn't find how to make photoshop use color index values instead of RGB. So I don't really know if it even capable of that

I'm not a Photoshop master, but for sure it works with indexed palettes as well as RGB. Unless you mean something else?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: MCD Edit by volutar
« Reply #4 on: April 22, 2014, 06:34:50 pm »
Yes you can use Photoshop with palettes (Indexed Color mode), and they will be saved into the PNG (if it's 8-bit), though you usually have to switch modes yourself:

volutar

  • Guest
Re: MCD Edit by volutar
« Reply #5 on: April 22, 2014, 06:38:39 pm »
I'm not a Photoshop master, but for sure it works with indexed palettes as well as RGB. Unless you mean something else?
I mean - using palette on the screen by choosing colors from "color table". Swatches don't have anything with palette.
How can have this palette (Images->Mode->Color Table) on the screen and use it as INDEX color picker, as genuine palette swatch? There's no way to use it with color picker. I didn't find one.

RGB color [8,36,99] has indexes: 31,63,69,95,111,127,143,175,191,207,223,239 - TWELVE different indexes and same RGB value (in D2 palette).
When you're trying to use color picker tool for any of them - it will simply open RGB color selector, and throw away actual index, which 100% will be messed (it will always pick first color index with that rgb value).

Yes you can use Photoshop with palettes (Indexed Color mode), and they will be saved into the PNG (if it's 8-bit), though you usually have to switch modes yourself:
Switching into RGB is suicide - color indexes must be preserved. You have to consider insane level of RGB ambiguity in tftd palettes.
« Last Edit: April 22, 2014, 06:47:45 pm by volutar »

volutar

  • Guest
Re: MCD Edit by volutar
« Reply #6 on: April 22, 2014, 11:36:25 pm »
I found how to load color table into swatches- just save *.act color table, and then "replace swatches" and change file type from *.aco to  *.act. But it still WILL NOT ALLOW you to draw pixel with index 63 or 79 or 95 - it doesn't keep index info, and will fall into first index 31 just because it's the first index with that RGB color. But indexes are really matter in XCom.

By the way I found a bug in Photoshop. In color picker mode, when Color table is opened - Info window shows colors from wrong coordinates (with offset of x=-4 and y=-4), though when you're clicking - it takes right value. Still, quite a bad behaviour from that expensive product - lack of index preservation and wrong values in Info window.

Offline kkmic

  • Commander
  • *****
  • Posts: 582
  • Undefined
    • View Profile
Re: MCD Edit by volutar
« Reply #7 on: April 25, 2014, 10:01:48 am »
Any chance it will run on all patforms OXC officially supports? Windows, Linux, MacOS, etc?

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: MCD Edit by volutar
« Reply #8 on: April 25, 2014, 04:26:43 pm »
Will an "Open MCD" function be implemented? This program works great, but it's a pain having to copy it out of its UFO folder every time, it would be best if I could open a file and edit directly

volutar

  • Guest
Re: MCD Edit by volutar
« Reply #9 on: April 25, 2014, 04:50:31 pm »
Any chance it will run on all patforms OXC officially supports? Windows, Linux, MacOS, etc?
Linux/MacOS,etc? Not from me. It's written in Delphi7. So, wine, perhaps?
It's a tool, it doesn't need to be run on 100% of user's PCs. It just need to be run on 0.1% of users, called "modders".

Quote
Will an "Open MCD" function be implemented? This program works great, but it's a pain having to copy it out of its UFO folder every time, it would be best if I could open a file and edit directly
Not now, because mcds of tftd and mcds of xcom1 are slightly different, and can't be opened just like that.
MCD is not just some standalone file, it's part of game infrastructure, including referred palettes, loftemps and scangs.
So unless I find out how to tie them properly into game type, it won't be possible. Making mess by allowing everything is not my way.

P.S. There's mtPaint - tool, preserving palettes, having palette color selection, working both with gifs and pngs, and can load+apply palette from another gif/png to current. It also can use tile grid (32x40 in our case). So it's exactly what is needed.
And next update (I hope) will be about importing of pngs into pcks (replacing or inserting) and deleting particular images from pcks (preserving mcd integrity). Spritesheet import also might be be implemented soon. Though it will be tricky for 24bit images due to palette ambiguity, and different palettes used for import.
« Last Edit: April 25, 2014, 06:36:24 pm by volutar »

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: MCD Edit by volutar
« Reply #10 on: April 25, 2014, 04:55:11 pm »
So unless I find out how to tie them properly into game type, it won't be possible. Making mess by allowing everything is not my way.

I would be perfectly fine having two separate tools. :)

volutar

  • Guest
Re: MCD Edit by volutar
« Reply #11 on: April 25, 2014, 05:16:35 pm »
I would be perfectly fine having two separate tools. :)
I won't be making two tools for each game type, and support both of them. They are practically the same by 95% or more. Copypasting changes, catching bug for one but not catching on another - save me from that. Game paths will follow at some point, as opening of mcd from "custom" folder, just later. It's not that essential.

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: MCD Edit by volutar
« Reply #12 on: April 25, 2014, 05:28:43 pm »
Fair enough.

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: MCD Edit by volutar
« Reply #13 on: April 26, 2014, 10:35:56 pm »
What about the ability to set the base directories, then? I know you said in the first post that you won't, but I honestly see no reason not to

volutar

  • Guest
Re: MCD Edit by volutar
« Reply #14 on: April 26, 2014, 11:17:02 pm »
Added PCK import capabilities (from PNG files) - description/history is updated.

Tarvis, can you describe your work sequence? Why does it worry you so much?

I can put a config with tftd=path and ufo=path parameters, but I definately don't want to mess with palette/scang/loft folders and locations.