Permalink
Browse files

Dividing boundaries unknown into 4 parts

  • Loading branch information...
taw committed Apr 6, 2012
1 parent dd1892d commit 2b26c3d0c5f26b27595e43ec9cff41cb9430c265
Showing with 8 additions and 4 deletions.
  1. +5 −3 esfxml/esf_semantic_converter.rb
  2. +3 −1 esfxml/xml2esf
@@ -901,12 +901,14 @@ def convert_rec_OBSTACLE
def convert_rec_boundaries
a, b = get_rec_contents(:u, :u)
- u1 = a >> 16
- u2 = a & 0xFFFF
+ u1 = a >> 24
+ u2 = (a >> 16) & 0xFF
+ u3 = (a >> 8) & 0xFF
+ u4 = a & 0xFF
path_id = b >> 22
path_id = -1 if path_id == 1023
vertex_index = b & 0x3FFFFF # vertex_id is index to u4_ary in corresponding pathfinding-*.xml
- out!(%Q[<boundaries unknown1="%d (%04x)" unknown2="%d (%04x)" path_id="%d" vertex_index="%d"/>] % [u1,u1,u2,u2,path_id,vertex_index])
+ out!(%Q[<boundaries unknown1="%d (%02x)" unknown2="%d (%02x)" unknown3="%d (%02x)" unknown4="%d (%02x)" path_id="%d" vertex_index="%d"/>] % [u1,u1,u2,u2,u3,u3,u4,u4,path_id,vertex_index])
end
def convert_rec_OBSTACLE_BOUNDARIES
View
@@ -162,8 +162,10 @@ module XmlTagHandlers
vertex_index = attributes[:vertex_index].to_i
u1 = attributes[:unknown1].to_i
u2 = attributes[:unknown2].to_i
+ u3 = attributes[:unknown3].to_i
+ u4 = attributes[:unknown4].to_i
put_rec "boundaries" do
- @esf.put_u((u1 << 16) + u2)
+ @esf.put_u((u1 << 24) + (u2 << 16) + (u3 << 8) + u4)
@esf.put_u((path_id << 22) + vertex_index)
end
end

0 comments on commit 2b26c3d

Please sign in to comment.