Deciphering the actors.static/Part III: Buildings
#1

After a little break i continue with the buildings. Reading the buildings starts after reading the bridges and runway points, whereas "string" here means a fixed string with the length given by the byte just before the string. Each string - the building types - except the last one is 0-terminated, which may be used here as a line feed. Dont forgett to change the integers from Big Endian to Small Endian if necesseary as explained in part I. "f" again is a float, wheras the actors tool seems to use doubles, wich doesn't seem necessary.

j1 = ReadInteger(file) ; Number of different building types the map uses + 1 (Starting with zero)
j2 = 0
Dim buildingsArray.s(j1)
ReadCharacter(file) ; unknown byte, seems to be "0";
While j2 < j1
stringLen = ReadCharacter(file) ; length of the buildings type string
building$ = ""
For x = 1 To stringLen
building$ = building$ + Chr(ReadCharacter(file))
Next
If j2 < j1-1 ; every building type string except the last one has a terminating "0"
ReadCharacter(file)
EndIf
buildingsArray(j2) = Mid(building$,34); the actors tool only uses a part of the string
j2 = j2 + 1
Wend

And the result is:
buildingsArray(0..j1-1), that contains and numbers the building types

buildings = 0
j3 = ReadInteger(file)
For x = 1 To j3
i1 = ReadInteger(file)
i2 = i1 & $ffff
i3 = i1 >> 16 & $ffff
j4 = ReadInteger(file)
j5 = 0
While j5 < j4
i4 = ReadInteger(file)
i5 = ReadInteger(file)
i6 = i4 & $ffff
i7 = i4 >> 16
i8 = i5 & $ffff
i9 = i5 >> 16 & $ffff
xpos.f = i2*200 + i8*200/32000
ypos.f = i3 * 200 + i9*200/32000
orientation.f = -(i7*360/32000)
buildings + 1
j5 = j5 + 1
Wend
Next

And the result is:
Buildings: Total number of buildings
i6: Type of each building as numbered and stored in the buildingsArray
xpos, ypos, orientation: X-position, Y-position and orientation of the building; the actors tool uses always two decimals here. The " 1 " added by the actors tool in the outBuildings.txt as a sign of "undistroyed building" is just a constant. I never tried to rewrite a static.actors till now, so i don't know, if this is needed or changeble.

Thats is it with the buildings. Next part will be the taxi ways, if i get it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)