Jump to content
Sign in to follow this  
larshgf

LWMPoly2 - LWMPoly3

Recommended Posts

HiTrying to figure out the BGL-files, that is to decompile these files to sourcefiles - like LMWiever does it.Its a problem when one has to interpret between LWMPoly2 and LWMPoly3. I dont think there is a clearcut way to do this in?There structures are given like this....struct LWMPoly2{ UINT8 bPointCount:6; // Up to 62 points UINT8 bReserved:1; // Must be 0 UINT8 bAttrib:1; // Polygon fill attribute, 0 = water, 1 = land SINT16 iHeight; // Whole elevation value in meters UINT8 iFraction; // Fractional elevation value in 1/128 meters}; (8-16-8)struct LWMPoly2Ex{ UINT8 bPointCount:6; // Must be 63 UINT8 bReserved:1; // Must be 0 UINT8 bAttrib:1; // Polygon fill attribute, 0 = water, 1 = land SINT16 iHeight; UINT8 iFraction; UINT8 bExPointCount; // Number of polygon points = 63 + bExPointCount}; (8-16-8-8)struct LWMPoly3 { UINT8 bPointCount:6; // up to 62 points a0cccccc UINT8 bReserved:1 // Must be 0 UINT8 bAttribb:1 // Polygen fill attribute, 0 = water, 1 = land UINT16 HeightStart // Whole elevation value in meters UINT8 FractionStart // Fractional elevation values in 1/128 meters UINT16 HeightEnd // Whole elevation value in meters UINT8 FractionEnd // Fractional elevation values in 1/128 meters} (8-16-8-16-8)struct LWMPoly3Ex{ UINT8 bPointCount:6 ; // Must be 63 UINT8 bReserved:1 ; // Must be 0 UINT8 bAttrib:1 ; // Polygon fill attribute, 0 = water, 1 = land UINT16 HeightStart ; // Whole elevation value in meters UINT8 FractionStart ; // Fractional elevation value in 1/128 meters UINT16 HeightEnd ; // Whole elevation value in meters UINT8 FractionEnd ; // Fractional elevation value in 1/128 meters UINT8 ExPointCount ; // Number of polygon points = 63 + bExPointCount} (8-16-8-16-8-8)Can somebody tell me if there is some kind of combinations that usually occur. What about LWMPoly2(Ex) allway followed by LWMPoint? Or LWMPoly3(ex) allways followed by LWMPoint3? Is it possible to clearify this subject a little bit? Or does my program have to take care of every possibility when it is running throung the BGL-file "looking forward" - so to speak - to see where the next LWMPoly is?Kind RegardsLars DK

Share this post


Link to post
Share on other sites
Guest MatthiasS

If I understand your question correctly the procedure is as follows:You need to look the the struct version in the LWMFileHeader.If it is a FS2002 file and the version is 0x201 you need to use the 2 versions, if it is 0x300 which is used in FS9 you need to use the 3 versions. Depending on the size in the initial field you use the regular or the ex version of the structure.I hope this helps,MatthiasLWMFileHeader{ UINT32 ulHeaderSize; // Size of this header (20 bytes) UINT32 ulVersion; // Version (100h is CFS2, 201h is FS2002, 300h is FS9) SINT32 lIndexHeaderOffset; // Relative offset to index SINT32 lDataOffset; // Relative offset to data SINT32 lTotalSize; // Size of all data plus headers};

Share this post


Link to post
Share on other sites

Thanks Matthias!That solved my problem. I was too "deeply" involved in the code and I forgot about the version numbers.Lars :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...