• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Converting API to FS9 ASM

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
6,561
Country
us-wisconsin
Hi all.

Just fooling around with some simple FS9 RIFF structuring. If you can convert SCASM to ASM, then you can turn your old API's, or preFS9 library objects , to the new RIFF structure:

Code:
; MyBldg.asm

db  'R','I','F','F'
dd  bgl_data_end - $ - 4
db  'M','D','L','9'

db  'M','D','L','H'
dd  visual_model_header_end - $ - 4
dd  visual_model_header_end - $ - 4
dd  0
dd  0
dd  28
dd  0
dd  0
dd  152
db  'F','S','8','0'
dd  2304
visual_model_header_end  label dword

db  'I','S','F','T'   
dd  ver_end - $ - 4  
db  "MakeMDL - FS90 (9.00.030612.02)",0
ver_end label word       

bounding_box_riff_start	label	word
    db  'B','B','O','X'   
    dd  bounding_box_riff_end - $ - 4
    real4  -40.0, 0.000, -40.0  
    real4  40.0, 40.0, 40.0  
bounding_box_riff_end label word       


model_outside    label    BGLCODE
model_shadow label BGLCODE
model_inside  label    BGLCODE


exterior_riff_start_0 label BGLCODE
    db  'E','X','T','E'   
    dd  exterior_riff_end_0 - $ - 4
    LOD_0L    label    BGLCODE

; ------------ Start of MyBLDG_0.asm ------------------

    bgl_riff_start_BLDG	label	BGLCODE
        db	'B','G','L',' '
        dd	bgl_riff_end_BLDG - $ - 4

            RESLIST 0, 8
	VERTEX -40, 0, -40	; 0
	VERTEX 40, 0, -40	; 1
	VERTEX 40, 0, 40	; 2
	VERTEX -40, 0, 40	; 3
	VERTEX -40, 80, -40	; 4
	VERTEX 40, 80, -40	; 5
	VERTEX 40, 80, 40	; 6
	VERTEX -40, 80, 40	; 7

            BGL_TEXTURE TEXTURE_BUILDING + TEXTURE_NIGHTMAP, 0EF00h, "br_apt1_2.bmp"
                FACET4_TMAP 0, 0, -( 1 * 32767 ),    ( 40 * 32767 ),    0, 46, 124, 4, 46, 255, 5, 155, 255, 1, 155, 124
                FACET4_TMAP 0, 0, ( 1 * 32767 ),     ( 40 * 32767 ),     2, 46, 124, 6, 46, 255, 7, 155, 255, 3, 155, 124
                FACET4_TMAP -( 1 * 32767 ), 0, 0,    ( 40 * 32767 ),    3, 46, 124, 7, 46, 255, 4, 155, 255, 0, 155, 124
                FACET4_TMAP ( 1 * 32767 ), 0, 0,     ( 40 * 32767 ),      1, 46, 124, 5, 46, 255, 6, 155, 255, 2, 155, 124
            BGL_TEXTURE TEXTURE_BUILDING, 0EF00h, "flatroof_6.bmp"
                FACET4_TMAP 0, ( 1 * 32767 ), 0,      ( 80 * 32767 ),      4, 2, 0, 7, 2, 253, 6, 254, 253, 5, 254, 0
  
        BGL_END
        BGL_RETURN

    bgl_riff_end_BLDG	label	BGLCODE

        ; ------------- Ripped from API SCASM CODE

        ;                Points( 0
        ;                  -40   0 -40 ; 0
        ;                   40   0 -40 ; 1
        ;                   40   0  40 ; 2
        ;                  -40   0  40 ; 3
        ;                  -40  80 -40 ; 4
        ;                   40  80 -40 ; 5
        ;                   40  80  40 ; 6
        ;                  -40  80  40 ; 7
        ;                )
        ;                LoadBitmap( 0 L6 EF 0 0 0 "br_apt1_2.bmp" )
        ;                TexPoly(        0      0 -32767       40    0  46 124   4  46 255   5 155 255   1 155 124 ) ;Front
        ;                TexPoly(        0      0  32767       40    2  46 124   6  46 255   7 155 255   3 155 124 ) ;Back
        ;                TexPoly(   -32767      0      0       40    3  46 124   7  46 255   4 155 255   0 155 124 ) ;Left
        ;                TexPoly(    32767      0      0       40    1  46 124   5  46 255   6 155 255   2 155 124 ) ;Right
        ;                LoadBitmap( 0 6 EF 0 0 0 "flatroof_6.bmp" )
        ;                TexPoly(        0  32767      0       80    4   2   0   7   2 253   6 254 253   5 254   0 ) ;Top
        ;                Return


; ------------ End of MyBLDG_0.asm ------------------

exterior_riff_end_0	label	BGLCODE


bgl_data_end label     BGLCODE

Have fun.

Dick
 
Hi Dick,

Very comments.

First this code is not according to the Fs2004 RIFF standard. As you would then have a VERT, MATE and TEXT section where the vertices, materials and textures are listed. It might be that putting everything BGL section works, but it is not 100% according to the format.

Second, what is the FACET4_TMAP command for in your texture list? Or is it just a translation of the TexPoly command? In that case I strongly disagree with using this command, it makes no sense to use old integer point commands with the new structure. You should then at least use the floating point commands of Fs2002.

The only thing you can achieve like this is that you have a MDL object, put for the rest the internal code is still at the Fs2000 level and certainly not according to the Fs2004 RIFF format.
 
Hi Arno.

We've both read numerous complaints that old, favorite APIs no longer work for FS2004. This is just a demonstration to show that they do work. And they are "legal" within the RIFF format, as long as they are placed in the right spot. The RIFF is basically a wrapper, much as the old BGL header was a wrapper.

The problem is they aren't floating point... but I suspect that is not as much of a problem as suspected. And they are old code, that might not be supported in the next version.... but that next version may well be delayed, and the riff format may even be gone!

Some FSDS SCASM code is floating point, and that should be able to be changed to the RIFF structures. I had been working on converting a complicated object, but the code ended up being hundreds of pages! I gave up. It would be easier to redraw these things in Gmax, as I'm sure you'll agree. And that is my advice... redraw the objects in Gmax.

FACET4_TMAP is the SCASM TexPoly command with 4 points. The BGLC_9 source zip contains the different numbers supported ( 3-9, and someone could add their own macro definitions to add more ).

I agree that the only benefit is that you get FS9 MDL foemat for the converted objects,,, but that was the point. If someone cannot bear to part with their old object code, they can still use it. But they will need to convert it to BGLC, unless SCASM gets updated to the new RIFF wrapper, or you develop the FREESC project to the point where a wrapper is easily made. Hmmm....

Dick
 
Hi Dick,

rhumbaflappy said:
We've both read numerous complaints that old, favorite APIs no longer work for FS2004. This is just a demonstration to show that they do work. And they are "legal" within the RIFF format, as long as they are placed in the right spot. The RIFF is basically a wrapper, much as the old BGL header was a wrapper.

I have never read that the old code does not work. The fact that your API macros still show does mean that the scenery engine still knows those commands.

rhumbaflappy said:
The problem is they aren't floating point... but I suspect that is not as much of a problem as suspected. And they are old code, that might not be supported in the next version.... but that next version may well be delayed, and the riff format may even be gone!

True, my reply was just to indicate to other people who are not so aware of these problems. I want to prevent that people think they are making something fully in the Fs2004 format by doing this. As that is not true.

If you want to use an old object together with new GMax scenery, wrapping it to a MDL like this might indeed be a nice temporarily solution.

What happens in the next version will indeed remain a bit of guessing for us until it is there. But it is most likely that the RIFF format has a bigger chance to work then the old integer point commands.

rhumbaflappy said:
Some FSDS SCASM code is floating point, and that should be able to be changed to the RIFF structures. I had been working on converting a complicated object, but the code ended up being hundreds of pages! I gave up. It would be easier to redraw these things in Gmax, as I'm sure you'll agree. And that is my advice... redraw the objects in Gmax.

Yes, I fully agree. Another advantage of using GMax is that MS will most likely give us a new gamepack with the next FS. This means that you can just re-export your current object.

I have started working on a tool that reads API macros and converts them to RIFF style objects. But due to lack of time I won't be able to make much progress on that soon. To convert it by hand is indeed a lot of work, as the vertices lists can get rather long.

The floating point commands are indeed used in FSDS2 and the Fs2002 GMax gamepack. API with the old code are made with the pre-Fs2002 programs.

rhumbaflappy said:
But they will need to convert it to BGLC, unless SCASM gets updated to the new RIFF wrapper, or you develop the FREESC project to the point where a wrapper is easily made. Hmmm....

As I wrote above I have started working on a conversion tool, it will read the API code and should then write a MDL object using the Fs2004 format. I have not decided yet if I am going to use BGLC or a new converter for it.

I have had contact with Manfred about a SCASM update and sent him the information about the RIFF format we have collected. But the main problem is that SCASM does not scan the source code twice as FreeSC does. Therefore it is not able to process the RIFF code, as it requires calculations with labels that are not yet defined at the point the calculation must be done. And I don't know if Manfred wants to change this. If I get some more time I will have a look at the FreeSC converter again or maybe I can make my own for the RIFF format.
 
Hi Arno.

In saying the APIs no longer work, I mean that they cannot be placed with XML coding... you've read the complaints.

Manfred is a victim of MS's policy to have many code formats for scenery and aircraft. Terrain uses both TMF and the BGLC ( for LWM and VTP ), ground scenery uses both XML and BGLC ( MakeMDL ). Aircraft aslo use BGLC and XML. His solution is a singular program... but it cannot possibly cover all these types of design. His latest extension is to try to incorporate XML ground scenery. Perhaps he is wise not to develop for scenery objects and aircraft, as gmax already does a pretty good job, and the competing object design programs ( Nova, EOD... ) are not keeping up with the changes in FS.

The problems many of us face are the restrictions of Gmax and MAKEMDL. Animation length, problems with groundpolys, Light types... And time is limited. My wife was in Quebec since Wednesday, and I got more done in these few days than I have in months. :laughing: It might not be a bad idea to stick to BGLC tweaking, and let the rest go.

Dick
 
Back
Top