Author Topic: Editing textures.dat  (Read 8094 times)

Offline liberation

  • Captain
  • ***
  • Posts: 75
    • View Profile
Editing textures.dat
« on: November 14, 2012, 03:13:17 pm »
Hi looking for some advise on editing the textures.dat file so I can make new textures for the globe, I'm hoping to make a new planet for a project of mine. I've used bbtools for various bits but haven't seen any tools for extracting stuff from .dat files.

Offline moriarty

  • Commander
  • *****
  • Posts: 1427
    • View Profile
    • Luke's OX mod site
Re: Editing textures.dat
« Reply #1 on: November 14, 2012, 03:35:02 pm »
pckview should be able to extract from the .dat file, you need to provide the image size (but you can find that information here: https://www.ufopaedia.org/index.php?title=TEXTURE.DAT)

you can find pckview and some informtaion about how to use it here: https://openxcommods.weebly.com/pckview.html

did you see the nice editor that volutar built? https://openxcom.org/forum/index.php/topic,543.0.html


what kind of globe do you want to make? an alternative earth, or something completely different? because as of now, we don't have an easy tool for changing city/country border locations (or names, for that matter) :P

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2124
    • View Profile
Re: Editing textures.dat
« Reply #2 on: November 14, 2012, 04:50:07 pm »
Hi looking for some advise on editing the textures.dat file so I can make new textures for the globe, I'm hoping to make a new planet for a project of mine. I've used bbtools for various bits but haven't seen any tools for extracting stuff from .dat files.
DATs are just raw image files, you should be able to edit them with any X-Com tools that can open "SCR" files or even any graphic editor that supports raw files.

Offline liberation

  • Captain
  • ***
  • Posts: 75
    • View Profile
Re: Editing textures.dat
« Reply #3 on: November 14, 2012, 09:10:11 pm »
Thanks for the replys

I cant get pckview to run, and the older version i had did run but wont load anything  >:( So i tried gimp and that wouldnt load the .dat file either...

Im using volutar's world program to place my polygons, but again for some reason the latest version wont run, much in the same way that pckview dosent ie a console window comes up then closes and thats it! Must be missing something on my computer.

Im a bit pressed for time tonight but will discuss soon what im up to.

Offline Bomb Bloke

  • Sergeant
  • **
  • Posts: 19
    • View Profile
    • StrategyCore
Re: Editing textures.dat
« Reply #4 on: November 17, 2012, 03:37:37 am »
The "convmisc" tool in my kit deals with them (along with the other less uniform image files in the game).

ConvMisc /toGIF texture

ConvMisc /toGame texture


Run it without parameters to see what else it does. Results are read/written directly from/to the folder where the images are usually stored, you don't need to copy the graphics into the bb_tact folder like you do with PCKs and whatnot.

PCKView doesn't work under anything later then XP. I'm not aware of any workarounds for this.

This page is worth a read if you're not already aware of the reasoning behind the sprite ordering.
« Last Edit: November 17, 2012, 03:39:32 am by Bomb Bloke »

Offline liberation

  • Captain
  • ***
  • Posts: 75
    • View Profile
Re: Editing textures.dat
« Reply #5 on: November 19, 2012, 08:38:34 pm »
Thanks, ive got all i need now to start making my new planet.

However one last question, how do you change the ocean colour? After looking through the code that draws it i couldnt find anyway of changing the colour, is it internal like the bullets, plasma shots or is loaded from a file?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2124
    • View Profile
Re: Editing textures.dat
« Reply #6 on: November 19, 2012, 09:23:42 pm »
Thanks, ive got all i need now to start making my new planet.

However one last question, how do you change the ocean colour? After looking through the code that draws it i couldnt find anyway of changing the colour, is it internal like the bullets, plasma shots or is loaded from a file?
It's internal, you'd have to poke around the globe rendering code (gawd help you :P).

Offline Yankes

  • Commander
  • *****
  • Posts: 2128
    • View Profile
Re: Editing textures.dat
« Reply #7 on: November 20, 2012, 12:48:41 am »
You mean day/night cycle? Now is is done by special function that compare normal (static table) of every pixel in globe with sun direction.
If you are interested in that, you should ask me because Im response of this mess :D

And if you are interested you can add more than one sun :D

Offline Bomb Bloke

  • Sergeant
  • **
  • Posts: 19
    • View Profile
    • StrategyCore
Re: Editing textures.dat
« Reply #8 on: November 21, 2012, 01:47:37 am »
Just throwing it out there, but another way to alter the ocean is to simply put textures over it. This is what I did in my ComboMod so that USOs could be shot down anywhere on the globe. The downside, of course, is that you might not want crashsites to appear anywhere on the globe...

Offline liberation

  • Captain
  • ***
  • Posts: 75
    • View Profile
Re: Editing textures.dat
« Reply #9 on: November 21, 2012, 08:56:20 pm »
Bomb Bloke, how did you texture the globe? that would work very well for what i have planned, since Mars has no areas where one could not land and also would help speed up the building process. Hopefully ill be able to just use the polygons for detail.

Yankes, im indeed intrested in the day/night cycle as Mars's days are 38 mins less that earths days time wise and i would like to change that as well.

Offline Yankes

  • Commander
  • *****
  • Posts: 2128
    • View Profile
Re: Editing textures.dat
« Reply #10 on: November 22, 2012, 01:38:16 am »
If you want speed up day cycle you should look at `Globe::getSunDirection`, this function compute current sun direction.
changing `rot = curTime * 2*M_PI` line will do it.

Offline Bomb Bloke

  • Sergeant
  • **
  • Posts: 19
    • View Profile
    • StrategyCore
Re: Editing textures.dat
« Reply #11 on: November 23, 2012, 07:16:38 am »
The amount of polygons the original games load is hardcoded, but TFTD loads more then UFO. I converted the UFO textures to TFTD's palette and hauled the map across. I wrote a program to distribute the remaining polys UFO doesn't use in an even grid across the surface of the world to cover the ocean.

I didn't bother trying to line them up with the "ground" polys - those simply sit on top of the "ocean" polys. I suppose you might run into a potential problem with this method in that OpenXcom would need to check which poly missions are going to be performed in, in reverse order to that in which it renders them, for this to work.

Later kyrub found the value in the TFTD EXE that controlled how many polys were loaded, so I was able to crank it way up and make the ocean polys smaller (and hence more numerous, making the globe look a bit smoother).

Anyway, techno-mumbo-jumbo aside, for Mars you'd probably be best off starting with the whole-world-covering-poly-grid first then cutting holes in that to add in the terrain features such as the ice caps or whatever. Easiest way would be to grab the first 648 polys (12,960 bytes) from my combined world map and use them as a starting base, and I'd assume Volutar's editor and my texture converter can help you sort out the rest.

Offline liberation

  • Captain
  • ***
  • Posts: 75
    • View Profile
Re: Editing textures.dat
« Reply #12 on: November 23, 2012, 09:55:48 am »
Thank you Yankes, that info was very useful and when the time is right i can alter openxcom's source with these changes along with a host of others (not alot of point atm since openxcom is still being updated daily).

Bomb Bloke, thanks for the grid world. at the start of the year i created something simiular but with bigger grids and only using a hex editor, lol. but with the smaller grids i have a good starting point and can get on with creating Mars.

And cheers for the info SupSuper, again this is something i will do at the end.

Thanks for the help guys  :)