Author |
Message |
Quast65
|
Posted: 04 Feb 2013, 16:14 |
|
Player |
 |
 |
Joined: 06 Mar 2012, 21:55 Posts: 480 Location: The Netherlands
|
Hi all, I'm trying to make a multitile object (in this case 3x1) with 4 views, but I have a problem with the negative X-offset in act2var40 for two of the views. When making a 2x1, I found out that -1 is F0 (I hope I am correct I just stumbled on that by accident), but I can't seem to figure out what the value for -2 should be. When using this code: Code: 3050 * 35 00 0F 09 01 40 08 "IOQA" 09 17 D0 0A 18 D0 0B 0F 0C 13 0E D4 77 09 00 0F 00 00 20 00 10 0C 0C 17 04 3051 * 4 01 0F 0C 01 3052 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 10 8800 09 100 64 -31 -69 3053 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 90 8800 09 100 64 -31 -69 3054 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 170 8800 09 100 64 -31 -69 3055 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 250 8800 09 100 64 -31 -69 3056 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 330 8800 09 100 64 -31 -69 3057 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 410 8800 09 100 64 -31 -69 3058 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 490 8800 09 100 64 -31 -69 3059 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 570 8800 09 100 64 -31 -69 3060 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 650 8800 09 100 64 -31 -69 3061 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 730 8800 09 100 64 -31 -69 3062 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 810 8800 09 100 64 -31 -69 3063 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 890 8800 09 100 64 -31 -69 3064 * 17 02 0F 00 00 8D 0F 00 00 00 80 00 80 00 00 10 10 08 3065 * 17 02 0F 01 00 8D 0F 00 00 01 80 00 80 00 00 10 10 08 3066 * 17 02 0F 02 00 8D 0F 00 00 02 80 00 80 00 00 10 10 08 3067 * 17 02 0F 03 00 8D 0F 00 00 03 80 00 80 00 00 10 10 08 3068 * 17 02 0F 04 00 8D 0F 00 00 04 80 00 80 00 00 10 10 08 3069 * 17 02 0F 05 00 8D 0F 00 00 05 80 00 80 00 00 10 10 08 3070 * 17 02 0F 06 00 8D 0F 00 00 06 80 00 80 00 00 10 10 08 3071 * 17 02 0F 07 00 8D 0F 00 00 07 80 00 80 00 00 10 10 08 3072 * 17 02 0F 08 00 8D 0F 00 00 08 80 00 80 00 00 10 10 08 3073 * 17 02 0F 09 00 8D 0F 00 00 09 80 00 80 00 00 10 10 08 3074 * 17 02 0F 0A 00 8D 0F 00 00 0A 80 00 80 00 00 10 10 08 3075 * 17 02 0F 0B 00 8D 0F 00 00 0B 80 00 80 00 00 10 10 08 3076 * 4 01 0F 04 01 3077 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 970 8800 09 71 104 -51 -25 3078 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 1090 8800 09 71 104 -51 -25 3079 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 1210 8800 09 71 104 -51 -25 3080 c:/grfmaken/grfcodecwin/dock/isrobjects00.pcx 1330 8800 09 71 104 -51 -25 3081 * 17 02 0F 0C 00 00 80 00 80 00 00 00 00 00 00 00 00 00 3082 * 17 02 0F 0D 00 01 80 00 80 00 00 00 00 00 00 00 00 00 3083 * 17 02 0F 0E 00 02 80 00 80 00 00 00 00 00 00 00 00 00 3084 * 17 02 0F 0F 00 03 80 00 80 00 00 00 00 00 00 00 00 00 3085 * 18 02 0F 10 81 40 10 FF 02 01 00 01 01 02 00 02 02 00 00 3086 * 18 02 0F 11 81 40 10 FF 02 04 00 01 F0 05 00 02 F0 03 00 3087 * 18 02 0F 12 81 40 10 FF 02 07 00 01 01 08 00 02 02 06 00 3088 * 18 02 0F 13 81 40 10 FF 02 0A 00 01 F0 0B 00 02 F0 09 00 3089 * 22 02 0F 14 81 48 00 03 03 11 00 01 01 12 00 02 02 13 00 03 03 10 00 3090 * 22 02 0F 15 81 48 00 03 03 0D 00 01 01 0E 00 02 02 0F 00 03 03 0C 00 3091 * 10 03 0F 01 40 01 FF 15 00 14 00 I get this in game: Attachment:
Problem01.png [ 15.35 KiB | Viewed 7835 times ]
So, I think the problem is with line 3086 and 3088, the X-offset value for the third tile: 3086 * 18 02 0F 11 81 40 10 FF 02 04 00 01 F0 05 00 02 F0 03 00 3088 * 18 02 0F 13 81 40 10 FF 02 0A 00 01 F0 0B 00 02 F0 09 00 Do any of you have an idea what it's value should be? And for future stuff, what should the values be for 4x1, 5x1 etc etc? I hope you can help!
|
|
Top |
|
 |
mb
|
Posted: 04 Feb 2013, 18:33 |
|
Joined: 02 Mar 2012, 12:10 Posts: 75
|
It´s not "F0" (-1, that is) but "F" (it´s a nibble). And -2 would be "E":
2´s complement:
0 -> 0 1 -> +1 ... 7 -> +7
8 -> -8 9 -> -7 ... E -> -2 F -> -1
HTH regards Michael
|
|
Top |
|
 |
Quast65
|
Posted: 04 Feb 2013, 18:45 |
|
Player |
 |
 |
Joined: 06 Mar 2012, 21:55 Posts: 480 Location: The Netherlands
|
If I understand it correctly, according to the GRFspecs it is a byte: Format: 00yxYYXX
x=the x offset from the northernmost tile XX=same, but stored in a byte instead of a nibble y=the y offset from the northernmost tile YY=same, but stored in a byte instead of a nibble
So what should it be in Byte-form?
|
|
Top |
|
 |
wallyweb
|
Posted: 04 Feb 2013, 20:03 |
|
Master Mentor |
 |
Joined: 27 Feb 2012, 22:45 Posts: 1880 Location: Canada
|
First of all, for assembling an object consisting of more than one sprite, there are no negatives. We start with the North tile at co-ordinates 0,0 For a 3x3 cube we have: 02 01 00 12 11 10 22 21 20 The first nibble in the co-ordinate is y and the second nibble is x. Your 1x3 object would be 02, 01, 00 Your 3x1 object would be 20, 10, 00 In the varAction2 to assemble the object, the default is always the North tile 00: Code: 3086 * 18 02 0F 11 81 40 10 FF 02 04 00 10 10 05 00 20 20 03 00
3088 * 18 02 0F 13 81 40 10 FF 02 0A 00 10 10 0B 00 20 20 09 00
An image to help you visualize the coordinates:
Attachments: |

ObjectCoordinates.png [ 6.48 KiB | Viewed 7824 times ]
|
_________________ Visit SimuSchool - Tutorials, Questions and AnswersTTDPatch Nightlies Downloads are backThrive
|
|
Top |
|
 |
Quast65
|
Posted: 04 Feb 2013, 21:51 |
|
Player |
 |
 |
Joined: 06 Mar 2012, 21:55 Posts: 480 Location: The Netherlands
|
That is a very usefull picture! Worked like a charm! Cheers! 
|
|
Top |
|
 |
wallyweb
|
Posted: 04 Feb 2013, 22:32 |
|
Master Mentor |
 |
Joined: 27 Feb 2012, 22:45 Posts: 1880 Location: Canada
|
Quast65 wrote: That is a very usefull picture! Worked like a charm! Cheers!  © wallyweb - Lic. GPLv whatever is current. Enjoy. 
_________________ Visit SimuSchool - Tutorials, Questions and AnswersTTDPatch Nightlies Downloads are backThrive
|
|
Top |
|
 |
mb
|
Posted: 04 Feb 2013, 23:21 |
|
Joined: 02 Mar 2012, 12:10 Posts: 75
|
For objects, the offset is from the current tile, i.e. for "Get object type at offset (60)", "Get random bits at offset (61)", "Land info of nearby tiles (62)", "Animation counter of nearby tile (63)", and "Count of object, distance of closest instance (64)", you´ll need signed offsets, using 2's complement.
regards Michael
|
|
Top |
|
 |
wallyweb
|
Posted: 04 Feb 2013, 23:52 |
|
Master Mentor |
 |
Joined: 27 Feb 2012, 22:45 Posts: 1880 Location: Canada
|
mb wrote: For objects, the offset is from the current tile Yes ... thank you for making that clear. It is definitely not the same as using coordinates for assembling multi tile objects. Hmm ... Silly waiter brought me a spoon for my roast beef. 
_________________ Visit SimuSchool - Tutorials, Questions and AnswersTTDPatch Nightlies Downloads are backThrive
|
|
Top |
|
 |
OzTrans
|
Posted: 04 Feb 2013, 23:54 |
|
Player |
 |
Joined: 12 Mar 2012, 02:39 Posts: 469
|
Quast65 wrote: I found out that -1 is F0 (I hope I am correct I just stumbled on that by accident), but I can't seem to figure out what the value for -2 should be.... -1 == 0xFF; -2 == 0xFE, -3 == 0xFD and so on ... If you need half-byte negative numbers, they are F, E, D respectively. I'll have a look at the rest later on ...
|
|
Top |
|
 |