Land info for nearby tiles - how?

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
User avatar
Darkwalker
Engineer
Engineer
Posts: 22
Joined: 20 Mar 2006 13:44
Location: Maly Beranov, Czech rep.
Contact:

Land info for nearby tiles - how?

Post by Darkwalker »

Please, can anyone explain it to me? I've read Documentation many times, but unsuccessfully :(
I need one sprite, which identifies nearby tile, whether it is a road or not, and according to this info decides which type of building to use, but I'm totally helpless. (VarAction 2, variable 62) Maybe because I cannot work with Dword information.

Can anyone help me please?

Thanks a lot.
Last edited by Darkwalker on 27 Nov 2006 15:15, edited 1 time in total.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

Well, firstly you should check out Land info of nearby tiles (60):
The parameter of this variable is an offset from the position of the current tile. The low nibble contains the signed X offset (that is 0h=0, 1h=+1 ... 7h=+7, 8h=-8, 9h=-7 ... Fh=-1), the high nibble contains the Y offset. Therefore the parameter 00h accesses the current tile itself. The returned doubleword is in the format rczzbbss, where the meaning of the letters is:

c contains the landscape class of the tile.
Now, the landscape class for a road object is "2", so the task would look like:

Code: Select all

// check land info of tile (e.g. x=0; y= +1 -> "10")
-1 * 15	02 07 02 81 62 10 18 0F 01
		00 00 02 02        // contains road object
		01 00              // does not
I.e., sprite "02" above would reference sprite "00" if the assigned tile contains a road object, and sprite "01" if not.

HTH
regards
Michael
Image
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Google [Bot] and 19 guests