:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::
Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Sat Dec 16, 2017 7:31 am
All times are UTC + 0
 Forum index » Featured Tools » CnC Editing Tools
TMP File Format (has damaged art)
Moderators: CnC Editing Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [18 Posts] View previous topic :: View next topic
Author Message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon May 02, 2016 6:45 am    Post subject:   TMP File Format (has damaged art) Reply with quote

Does anyone know how this works? I thought it would be only a simple boolean switch (one bit being either 0 or 1), but noticed there are some complex numbers involved.

A TMP has a main header and a header for each tile.
This is the header for each tile that i got from the XCC code IIRC
{
   __int32 x;                          // position
   __int32 y;
   __int32 unknown1[3];
   __int32 x_extra;                    // position of extra graphics
   __int32 y_extra;
   __int32 cx_extra;                   // size of extra graphics
   __int32 cy_extra;
   __int32 unknown2[4];
};

unknown2[4] seems to be the one defining HasDamagedArt

I compared what TMP Studio writes in this. It writes
2 for no damaged art
6 for damaged art

however, when i checked original TS files, i got values like
-842150449
and
-842150450
on different tiles (see isotemp.mix/ovrps01.tem)

While this is a value set separately on each tile in a TMP, TMP Studio writes it to all frames, not only the currently selected tile.
So i'm not sure if TMP Studio got the implementation correct in the first place.

e.g. on ovrps01, TMP Studio says that it has damaged art, yet there are different values set on individual tiles.


P.S. any infos about unknown1[3] would be nice too.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Mig Eater
General


Joined: 13 Nov 2003
Location: Eindhoven

PostPosted: Mon May 02, 2016 10:43 am    Post subject: Reply with quote

HasDamagedArt works on a per cell basis, so TMP Studio's implementation is incorrect. However because of the limited way the logic works there isn't much need to use it per cell. So technically TMP Studio's implementation is more efficient XD
_________________



Back to top
View user's profile Send private message Visit poster's website YouTube User URL Facebook Profile URL Twitter Channel URL
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon May 02, 2016 10:52 am    Post subject: Reply with quote

I'd assume the per tile base of the setting is to make sure some tiles auto-LAT to adjacent tiles, while others don't.

I think I'll make TMP Shop in a way so the user can decide how and what kind of values he wanna set (for experimentation with other values/settings).
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Mig Eater
General


Joined: 13 Nov 2003
Location: Eindhoven

PostPosted: Mon May 02, 2016 11:01 am    Post subject: Reply with quote

AFAIK HasDamagedArt has nothing to do with the LAT system?

Random question; I can't remember if TMP Shop has a batch pal conversion option?
_________________



Back to top
View user's profile Send private message Visit poster's website YouTube User URL Facebook Profile URL Twitter Channel URL
tomsons26lv
Scorpion Sniper


Joined: 30 Dec 2009
Location: Latvia

PostPosted: Mon May 02, 2016 11:12 am    Post subject: Reply with quote

wat
What xcc source are you looking at

struct t_tmp_image_header
{
__int32 x;
__int32 y;
__int32 extra_ofs;
__int32 z_ofs;
__int32 extra_z_ofs;
__int32 x_extra;
__int32 y_extra;
__int32 cx_extra;
__int32 cy_extra;
unsigned int has_extra_data: 1;
unsigned int has_z_data: 1;
unsigned int has_damaged_data: 1;
__int8 height;
__int8 terrain_type;
__int8 ramp_type;
unsigned __int8 radar_red_left;
unsigned __int8 radar_green_left;
unsigned __int8 radar_blue_left;
unsigned __int8 radar_red_right;
unsigned __int8 radar_green_right;
unsigned __int8 radar_blue_right;
__int8 pad[3];

https://github.com/OlafvdSpek/xcc/blob/master/xcc/misc/cc_structures.h#L368

Knowing Olaf's laziness of actually doing any research but instead copy pasting stuff other people found, that pad ain't no padding but actual data too.
_________________
Tiberian Dawn, Red Alert, Tiberian Sun ,Red Alert 2,Renegade, Command & Conquer 3,Tiberium and Tiberium Wars and Westwood related image & video archive
https://picasaweb.google.com/113361105083292812413?noredirect=1

Skype live:tomsons26
Don't forget to state who are you otherwise i'll ignore the invite

Back to top
View user's profile Send private message Visit poster's website
E1 Elite
Energy Commando


Joined: 28 May 2013

PostPosted: Mon May 02, 2016 12:00 pm    Post subject: Reply with quote

Just compared, looks like it is one more if there is extra data.

XCC, vanilla / TMP Studio

No damaged art with no extra data - CA CD CD CD / 02 00 00 00
No damaged art with extra data - CB CD CD CD / 03 00 00 00
Damaged art with no extra data - CE CD CD CD / 06 00 00 00
Damaged art with extra data - CF CD CD CD / 07 00 00 00

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon May 02, 2016 12:18 pm    Post subject: Reply with quote

@tomsons:
it's an old txt file from Olaf. It says copyright 2000. Wink

thanks for the updated header.

@E1 Elite:
wow, why did WW made that so complex o.O
Any insight why the difference between with and without extra graphic?
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon May 02, 2016 2:58 pm    Post subject: Reply with quote

hmm, there seems to be something missing.

tomsons26lv wrote:

struct t_tmp_image_header
{
__int32 x;
__int32 y;
__int32 extra_ofs;
__int32 z_ofs;
__int32 extra_z_ofs;
__int32 x_extra;
__int32 y_extra;
__int32 cx_extra;
__int32 cy_extra;
unsigned int has_extra_data: 1;
unsigned int has_z_data: 1;
unsigned int has_damaged_data: 1;
__int8 height;
__int8 terrain_type;
__int8 ramp_type;
unsigned __int8 radar_red_left;
unsigned __int8 radar_green_left;
unsigned __int8 radar_blue_left;
unsigned __int8 radar_red_right;
unsigned __int8 radar_green_right;
unsigned __int8 radar_blue_right;
__int8 pad[3];

those marked variables are only 3 (*)  byte long, but in the file between cy_extra and height are 4 byte.
So whats the 4th byte?

Is there a 4th unsigned int missing?

(*)or actually 6 byte, since isn't unsigned int in c++ a 2byte value? How can these 3 unsigned int 2 byte values work on only a 4 byte long range in the tmp?



I would expect something like this
__int32 cx_extra;
__int32 cy_extra;
__int8 has_extra_data;
__int8 has_z_data;
__int8 has_damaged_data;
__int8 unknown;
__int8 height;
__int8 terrain_type;


Quote:
unsigned int has_extra_data: 1;

What's the : 1 standing for? Is this some strange c++ range restriction setting to make unsigned int only 1 byte long, or just a default value?
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Crimsonum
Seth


Joined: 14 Jul 2005
Location: Fineland

PostPosted: Mon May 02, 2016 5:57 pm    Post subject: Reply with quote

Lin Kuei Ominae wrote:
Quote:
unsigned int has_extra_data: 1;

What's the : 1 standing for? Is this some strange c++ range restriction setting to make unsigned int only 1 byte long, or just a default value?


Looks like a boolean, i.e. "Has extra data: true". Booleans are often represented by int in C. So yes, it would be a default value.
_________________


Back to top
View user's profile Send private message Visit poster's website
E1 Elite
Energy Commando


Joined: 28 May 2013

PostPosted: Tue May 03, 2016 7:00 pm    Post subject: Reply with quote

On
unsigned int has_extra_data: 1;
unsigned int has_z_data: 1;
unsigned int has_damaged_data: 1;

Only 3 bits from the same byte(s) is used for extra data, z data and damaged art check. So,  
low nibble (least significant) can have values from 0 to F. 4 bits in it are used as - ? D Z X
where D = Has damaged art, Z = Has z data, X = Has extra data

0 0 0 0 = 0 = D0 Z0 X0
0 0 0 1 = 1 = D0 Z0 X1
0 0 1 0 = 2 = D0 Z1 X0
0 0 1 1 = 3 = D0 Z1 X1
0 1 0 0 = 4 = D1 Z0 X0
0 1 0 1 = 5 = D1 Z0 X1
0 1 1 0 = 6 = D1 Z1 X0
0 1 1 1 = 7 = D1 Z1 X1
1 0 0 0 = 8 = D0 Z0 X0
1 0 0 1 = 9 = D0 Z0 X1
1 0 1 0 = A = D0 Z1 X0
1 0 1 1 = B = D0 Z1 X1
1 1 0 0 = C = D1 Z0 X0
1 1 0 1 = D = D1 Z0 X1
1 1 1 0 = E = D1 Z1 X0
1 1 1 1 = F = D1 Z1 X1

Back to top
View user's profile Send private message
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Wed May 04, 2016 12:02 am    Post subject: Reply with quote

How certain is the "HasDamagedArt" flag? From what I see, that flag has something to do with if the tile is randomized or not...

Back to top
View user's profile Send private message
RP
Commander


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Wed May 04, 2016 7:09 am    Post subject: Reply with quote

I always thought that 'damaged art' was nothing more than hardcoded behaviour for bridge heads which used randomized tiles for damaged art.

I have never seen anything when I programmed TMP files besides the special behaviour for bridgeheads.
IIRC there's nothing in IsoMapPack5 that indicates alternative versions for tiles.
Every tile is loaded in one big list.
_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Wed May 04, 2016 7:41 am    Post subject: Reply with quote

A TileSet can contain multiple TMP files using the filename suffix a-h.
e.g. clear01.tmp, clear01a.tmp, clear01b.tmp

If i understand it correct, the random tile selection ingame doesn't work if the tmps have the value DamagedArt set.
Only when disabled, they use the random selection.

Bridges for example use
ovrps01.tmp for the normal image and
ovrps01a.tmp for the damaged version.
On these TMPs the tiles have damaged art set, so they don't randomly switch between the different TMPs.


@E1 Elite: thanks for the info. I'll try to implement it in this way, though i'm still confused about the values of the vanilla TS files.
If i understand you correct, only 1 byte should actually change.
e.g. CA CD CD CD
But on the vanilla TS files all 4 bytes constantly change the values.
See the latest version of TMP Shop and switch into "Single Frames" mode.
If you have the 4 bytes
AA BB CC DD
TMP Shop is showing
AA on "Has Extra Data"
BB on "Has Z Data"
CC on "Has Damaged Data"
DD on "unknown Data"

Following your description, only "Has Extra Data" should change, while the other 3 stay the same.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
E1 Elite
Energy Commando


Joined: 28 May 2013

PostPosted: Wed May 04, 2016 7:55 am    Post subject: Reply with quote

@RP:
If the Has Damaged Art bit is set to 1, then game will not randomize the tiles. XCC TMP Editor 1.04
that comes with XCC utilities sets it to 1 by default if edited. So, XCC TMP Editor 1.05 should be used.

This thread started because of the ramp tiles didn't ramdomize in Crimsonum's edit:
http://www.ppmforums.com/viewtopic.php?p=544088#544088

@LKO:
If the 4 bytes are say XN XX XX XX in the TMP files, we are concerned only about the nibble represented
by N. X can be anything in 0-F. Vanilla uses CD whereas TMP Studio 00 which is anyhow irrelevant.
Within the nibble also 1 bit is unused, so the 3 bit means the same when you put A or 2. It is not in 4
seperate bytes but only 3 bits within just a nibble.

Back to top
View user's profile Send private message
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Wed May 04, 2016 2:04 pm    Post subject: Reply with quote

I have not seen reference to the other flag (4th bit), has anyone seen any difference with this bit toggled?

Back to top
View user's profile Send private message
E1 Elite
Energy Commando


Joined: 28 May 2013

PostPosted: Wed May 04, 2016 3:23 pm    Post subject: Reply with quote

There is no difference whether the 4th bit is 0 or 1.

Back to top
View user's profile Send private message
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Wed May 04, 2016 4:34 pm    Post subject: Reply with quote

E1 Elite wrote:
There is no difference whether the 4th bit is 0 or 1.


I was thinking as much, as I am unable to find any reference in the games code to a 4th bit.

Back to top
View user's profile Send private message
E1 Elite
Energy Commando


Joined: 28 May 2013

PostPosted: Fri May 06, 2016 3:54 pm    Post subject: Reply with quote

Checked TS/RA2 vanilla files, could only find - C? CD CD CD pattern. If some file is different, let me know.

On earlier post:

Even though the C Struct is kept close to file format, it need not match the bytes exactly. Actual mapping
might be happening when reading from and writing to the file.

Typical int in C is 4 bytes on 32-bit OS. (minimum is 2 bytes)

A declaration like - unsigned int x: 5;  means variable x can hold 5 bits of data.

For the tool:

If the flags of extra data or z data are disabled, the related data is not shown on the UI by tools and while
saving, those related content could be removed. Game also doesn't seem to use them when these flags are
disabled, even though the related content exists. If these flags are provided as editable fields, enabling them
on a tile that doesn't have the related data, it would need more editing capability like importing images and
coordinates editing etc.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [18 Posts] View previous topic :: View next topic
 Forum index » Featured Tools » CnC Editing Tools
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise play the game below please contact the Administrator for help.


 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

Wildcard SSL Certificates
[ Time: 0.1461s ][ Queries: 12 (0.0184s) ][ Debug on ]