28.03.2011, 15:53
There is a perfectly running and easy to use actors tool, but it still seems to be a mystery how that actors.static works. So (Beeing a little bit bored at the moment) i started to try to read it.
"integer" (i,v) means an 4-byte digit, and float (f) also a 4 byte digit. Because Java uses Big Endian, you may to have change the digits to Little Endian, depending on the rig and language you use.Changing an 4 byte digit works like this:
digit = ((digit&$FF)24)&$FF)
Reading this directly from the memory as a float should give a proper float, even if you read it as an int from the file.
Part I: Bridges
read integer: actors files first value, unknown purpose, seems to be always -65535, may be a check digit?
read integer: Number_of_bridges
for x = 1 to Number_of_bridges
read integer: i1, part of bridges position
read integer: i2, part of bridges position
read integer: i3, part of bridges position
read integer: i4, part of bridges position
read integer: i5, type of bridge (32: Railway, 64: Country, 128: Heighway, afaik)
read float: f1, part of bridges position
v1 = i3 - i1
v2 = i4 - i2
v3 = 0
v4 = 0
if v2 = 0
v4 = 0
if v1 > 0
v3 = 1
else
v3 = -1
endif
else
if v1 = 0
v3 = 0
if v2 > 0
v4 = 1
else
v4 = - 1
endif
else
if v1 > 0
v3 = 1
else
v3 = -1
endif
if v2 > 0
v4 = 1
else
v4 = - 1
endif
endif
endif
f2 = i1
f3 = i2
f4 = f2 + 0.5 + v3 * f1
f5 = f3 + 0.5 + v4 * f1
f6 = i3 + 0.5 + v3 * f1
f7 = i4 + 0.5 + v4 * f1
f8 = f4 * 200
f9 = (-1 - f5) * 200
f10 = f6 * 200
f11 = (-1 - f7) * 200
f12 = mapsize y (pixel y-firction of map_t or map_h * 200 as used in the mapsize.txt)
(And the result is
i5: Type of bridge, as above
ABS(f8): first x position of bridge
f12 - abs(f9): first y position of bridge
ABS(f10): second x position of bridge
f12 - ABS(f11): second y position of bridge
next bridge
That's it with the bridges. Sometimes there are some uneven values in a actors tool outwing.txt, i think they don't matter. Other entrances in the outwing.txt created bei the tool seem to be just explanation reports as they are constants or given by the bridges type, although yet i didn't try to rewrite an actors.static.
I made some tests with good results, but can't guarantee yet, of course (Especially the if v2 = 0 .... part, which is tricky)
Part II may be the runway points, if i get it.
"integer" (i,v) means an 4-byte digit, and float (f) also a 4 byte digit. Because Java uses Big Endian, you may to have change the digits to Little Endian, depending on the rig and language you use.Changing an 4 byte digit works like this:
digit = ((digit&$FF)24)&$FF)
Reading this directly from the memory as a float should give a proper float, even if you read it as an int from the file.
Part I: Bridges
read integer: actors files first value, unknown purpose, seems to be always -65535, may be a check digit?
read integer: Number_of_bridges
for x = 1 to Number_of_bridges
read integer: i1, part of bridges position
read integer: i2, part of bridges position
read integer: i3, part of bridges position
read integer: i4, part of bridges position
read integer: i5, type of bridge (32: Railway, 64: Country, 128: Heighway, afaik)
read float: f1, part of bridges position
v1 = i3 - i1
v2 = i4 - i2
v3 = 0
v4 = 0
if v2 = 0
v4 = 0
if v1 > 0
v3 = 1
else
v3 = -1
endif
else
if v1 = 0
v3 = 0
if v2 > 0
v4 = 1
else
v4 = - 1
endif
else
if v1 > 0
v3 = 1
else
v3 = -1
endif
if v2 > 0
v4 = 1
else
v4 = - 1
endif
endif
endif
f2 = i1
f3 = i2
f4 = f2 + 0.5 + v3 * f1
f5 = f3 + 0.5 + v4 * f1
f6 = i3 + 0.5 + v3 * f1
f7 = i4 + 0.5 + v4 * f1
f8 = f4 * 200
f9 = (-1 - f5) * 200
f10 = f6 * 200
f11 = (-1 - f7) * 200
f12 = mapsize y (pixel y-firction of map_t or map_h * 200 as used in the mapsize.txt)
(And the result is
i5: Type of bridge, as above
ABS(f8): first x position of bridge
f12 - abs(f9): first y position of bridge
ABS(f10): second x position of bridge
f12 - ABS(f11): second y position of bridge
next bridge
That's it with the bridges. Sometimes there are some uneven values in a actors tool outwing.txt, i think they don't matter. Other entrances in the outwing.txt created bei the tool seem to be just explanation reports as they are constants or given by the bridges type, although yet i didn't try to rewrite an actors.static.
I made some tests with good results, but can't guarantee yet, of course (Especially the if v2 = 0 .... part, which is tricky)
Part II may be the runway points, if i get it.