PDA

View Full Version : [TEC] Menu editing: Understanding crop


Flopper
03-31-10, 08:11 AM
All I am attempting to do here is understand what the crop numbers mean.

Here's a section from menu_1024_768.ini:


[G31 I20]
Name=Zoom in
Type=1032;Button
ItemID=0x311A0001
ParentID=0x311A0000
Pos=1,-1,40,40
Materials=4
Display=0;No stretch
Mat 0=data/menu/gui/maptools.tga
Crop 0=0,0,0,0
Mat 1=data/menu/gui/maptools.tga
Crop 1=0,0,0,0
Mat 2=data/menu/gui/maptools.tga
Crop 2=0,0.160156,0,0
Mat 3=data/menu/gui/maptools.tga
Crop 3=0,0.160156,0,0
MatFlags=0x1
TexFmt=0x9
Font=1
TextFlags=0x0
StatesColors=0xB0B0B0FF, 0xFF, 0xFFFFFFFF, 0xFFFFFFFF
;ToolTipText=2242


Here is a blowup of a test version of maptools.tga:
http://www.coolpup.com/silenthunter/test/maptools.jpg

I see we are working with the nav map tools, which all come from the same image.

Okay, here are the 4 crops:
Crop 0=0,0,0,0
Crop 1=0,0,0,0
Crop 2=0,0.160156,0,0
Crop 3=0,0.160156,0,0

I'm guessing this is some kind of coordinate system, but I can't put it together. I see that we are working with the "zoom in", which is in the upper left. The 0,0,0,0 may mean start at the upper left corner of the whole image, perhaps. The 0.160156 may mean about 16% (1/6) of the way down the image, which makes sense.

But if that is true, where is the horizontal X component of these coordinates? Also, sometimes there is only one crop, crop 0. All this is driving me batty. :damn:

Any help is greatly appreciated.

Hitman
03-31-10, 08:35 AM
Yes it is a percentage as far as I have seen and serves to indicate how far from one side the selection of the image must beging. The four numbers are IIRC LEFT, RIGHT, TOP, BOTTOM or the same but in another order. The first one is for sure "left".

For example: Crop=0,0,1,1 would mean:

Start from the absolute left
Start from the absolute bottom
Cover till the absolute right
Cover till the absolute top

Meaning select the whole image.

If you wanted to select only the central part of it, for example you would put: Crop=0.25,0.75,0.25,0.75

And that would mean:

Start from 25% of the whole image the left margin
Start from 25% of the whole image the bottom margin
Cover sideways till 75% of the image, where you will put the right margin
Cover upwards till 75% of the image, where you will put the top margin

This is more or less how I understand it, probably someone else will be able to clarify it much better. These numbers seem to have served for the purpose of allowing easily higher resolutions. Any image defined in the menu.ini with Crop you can drop and image of any size and the game will pick it because it is a percentage of it. The game will then resize it to fit in the part of the screen reserved for it, but bigger images will have excellent readability when they are big.

Flopper
03-31-10, 09:04 AM
Yes it is a percentage as far as I have seen and serves to indicate how far from one side the selection of the image must beging. The four numbers are IIRC LEFT, RIGHT, TOP, BOTTOM or the same but in another order. The first one is for sure "left".

For example: Crop=0,0,1,1 would mean:

Start from the absolute left
Start from the absolute bottom
Cover till the absolute right
Cover till the absolute top

Meaning select the whole image.

If you wanted to select only the central part of it, for example you would put: Crop=0.25,0.75,0.25,0.75

And that would mean:

Start from 25% of the whole image the left margin
Start from 25% of the whole image the bottom margin
Cover sideways till 75% of the image, where you will put the right margin
Cover upwards till 75% of the image, where you will put the top margin

This is more or less how I understand it, probably someone else will be able to clarify it much better. These numbers seem to have served for the purpose of allowing easily higher resolutions. Any image defined in the menu.ini with Crop you can drop and image of any size and the game will pick it because it is a percentage of it. The game will then resize it to fit in the part of the screen reserved for it, but bigger images will have excellent readability when they are big.

Hitman, thank you so very much! :salute: I'll start looking at it from that approach. I'm immediately perplexed with the crops I mentioned, because the all end with 0,0, which I'm definitely not understanding (cover none of the image?), but this gives me something to go on.

Hitman
03-31-10, 09:48 AM
As I said, I'm not completely sure what value tweaks what, but the idea is what I explained.
One more thing: When you see more than one crop, it's because it corresponds to more than one material (Image). You will see as many Crop entries as number of materials in the line over it. This is used when something changes the image as an animation or depending from its status. For example, the buttons: They have a graphic for not pressed, and a different one for pressed. When you press the button, the graphic changes and displays the second, making that way an "animation" or sequence that appears to be moving.