The International Simutrans Forum

Community => Simutrans Help Center => Topic started by: Fabio on January 22, 2009, 10:13:31 AM

Title: OFFSET
Post by: Fabio on January 22, 2009, 10:13:31 AM
I can't find any documentation on the use of y-offset (and x-offset) and i don't remember their usage in dat files. can anybody help me? thanks
Title: Re: OFFSET
Post by: Zeno on January 22, 2009, 10:23:59 AM
Usage (AFAIK) is like EmptyImage[SW]=PNG_NAME.ROW.COL,OFFSET_X,OFFSET_Y

Example:
EmptyImage[SW]=Airbus_A380.0.0,-48,-48

Edit: Btw I'm not sure of x and y order  :-\
Title: Re: OFFSET
Post by: VS on January 22, 2009, 10:31:51 AM
IIRC: First y, then x. Same with row/column - first y order (row), then column (x).

btw... http://graphics.simutrans.com/displayimage.php?pos=-165
Title: Re: OFFSET
Post by: IgorEliezer on January 22, 2009, 01:22:08 PM
Quote from: VS on January 22, 2009, 10:31:51 AM
IIRC: First y, then x. Same with row/column - first y order (row), then column (x).

It's a slight commentary:

It's a bit odd you have (y,x) instead of (x,y) "to be exact math-wise". ;) ... unless we are considering we are working strictly in computation approach, not with trigonometry.
Title: Re: OFFSET
Post by: VS on January 22, 2009, 01:34:15 PM
Odd, but true.
Title: Re: OFFSET
Post by: Fabio on January 22, 2009, 05:45:57 PM
WELL, for sure y offset is less troublesome, so it can be used more... this could be a reason...

thank you very much, guys!






EDIT:
Do offsets work also for ways and bridges? i tried, but it looks like it doesn't work...

Title: Re: OFFSET
Post by: VS on January 22, 2009, 07:50:30 PM
Did you use negative offsets?
Title: Re: OFFSET
Post by: Fabio on January 22, 2009, 08:58:40 PM
yep, i'm making the bridges 32 pixel higher, so that i can use also full width and some tile-high pillar ends. is it possible?
Title: Re: OFFSET
Post by: Frank on January 22, 2009, 09:15:16 PM
Quote from: VS on January 22, 2009, 07:50:30 PM
Did you use negative offsets?
Title: Re: OFFSET
Post by: prissi on January 22, 2009, 09:18:09 PM
Indded y is first, since often you need only y-offset. Also in an intermediate version, no x but only y-offset was possible.

There are some constarins to offsets: -128<=Offset<127 Also I am not sure what will happen if Offset+w<0 or Offset+w>255.
Title: Re: OFFSET
Post by: DirrrtyDirk on January 22, 2009, 09:38:15 PM
@Frank:

From memory I'd say you switched x and -x ... but I'm not sure, and I have no time to check right now.
Title: Re: OFFSET
Post by: VS on January 22, 2009, 10:11:21 PM
If I am not mistaken, Zeno reported success when aligning with both offsets negative... but I may indeed be wrong!
Title: Re: OFFSET
Post by: Zeno on January 22, 2009, 10:31:17 PM
Quote from: DirrrtyDirk on January 22, 2009, 09:38:15 PM
@Frank:
From memory I'd say you switched x and -x ... but I'm not sure, and I have no time to check right now.
I also think it's switched.

All my A380 planes were coded with -y,-x (I think -48 both). Maybe you should check any of them to see if it's really centered as expected. But fairly, I don't remember :P

Edit:
Err... I suppose you use makeobj49. I remember it didn't work with previous versions, did it?
Title: Re: OFFSET
Post by: Fabio on January 23, 2009, 09:29:10 AM
well, i do use makeobj49...
Title: Re: OFFSET
Post by: Zeno on January 24, 2009, 07:12:06 PM
Oooops... I'm doing a remake of my A380 planes... and it seems to be something strange behaviour with offsets... let's see:
1) I take a 128-4-tile template VS recommended to use as background.
2) I resize to 176 px, which is the size of the A380 pngs.
3) I center the planes on the 176-sized tiles.
4) DAT code is like this EmptyImage[SW]=newA380.0.0,-48,-48 for all views.
5) I get this:
Alignment image (http://www.simutrans-germany.com/files/upload/aligned.jpg).
Results image (http://www.simutrans-germany.com/files/upload/not_aligned.jpg).
What is happening to West-East alignment?


Edit: Now I know: y alignment seems not to be working in makeobj49. I get same result when I put 0px on y offset!
It's working ok. Try redownload makeobj. I was using a wrong (49 beta) version :o Redownloaded and corrected!
Title: Re: OFFSET
Post by: VS on January 24, 2009, 07:53:05 PM
Offsets are not the same for x and y.

dx = (a-b)/2
dy = (a-b)*3/4

And actual alignment may be still different...
Title: Re: OFFSET
Post by: Zeno on January 24, 2009, 08:08:12 PM
With x=(128-176)/2=-24 and y=(128-176)*3/4=-36 I get a misalignment in N-S directions :(
Title: Re: OFFSET
Post by: VS on January 24, 2009, 08:09:48 PM
These are "straight" ?
Title: Re: OFFSET
Post by: Zeno on January 24, 2009, 08:11:32 PM
Quote from: VS on January 24, 2009, 08:09:48 PM
These are "straight" ?
Ups... I've messed up the models, sorry :(
I'm deleting all variants but one to make the tests, give me a minute.


Edit: Not in N-S but in E-W direction. I have a small displacement and appears below the runway line.
Title: Re: OFFSET
Post by: VS on January 24, 2009, 09:01:01 PM
Arrrrrrgh! I was wrong, totally wrong. Offsets are x,y. Sorry. Or so I think now. I tested with a big rectangle and it appears to work with swapped offsets.

I apologize again to everyone who believed my instructions and couldn't get offsets to work.