advanced buildings to Gsl objects

gius

Charter Member
hi,
i'm trying to convert the advanced buildings to GSL objects, but they don't appear in MB although i get no error messages from tha scasm compilation. I've built a an api using wondrian macro extractor, thee api works in FSSC, the MB object no. here is the text of the api i'm using:
should i modify some lines, and in what way?

View attachment 26046
 
I wonder if it will work
For GSL, objects must be in library form with a name for a dp and a GUID
heres a template
Code:
Header( 1  N94:21:19.18 S94:21:19.18 W000:00:00.00 W000:00:00.00 )
LatRange(  S94:21:19.18  N94:21:19.18 )
Set( BUF 4096 )
Set( LABELS 9000 )
Set( PATCHES 9000 )
Set( LINBUF 8192 )
Set( MAXPTLST 3000 )

ObjID( 00000000 00000000 00000000 00000000 ) ;this 32 byte hex number must be unique
LibObj( 
    PWR   0
    SIZE  0
    SCALE 0.001        ;0.001 for aircraft.mdl original, 0.5 for scenery.bgl original
    TYPE  0
    NAME   "uniqe_name"    )

;All the drawing code goes here
IfVarAnd( :NEXT 0024 0040 )
Jump( :MAIN )
:NEXT
Jump32( :_regular_object )
:MAIN
Include( model_D_0.sca )  ;the damage object 
:_regular_object
Include( model_0.sca )  ;the normal object

EndObj
I have often wondered weather Advanced Building code will work from a library,
 
Hi Simonu (and anyone else who can help),

I am doing the same with Cees Donker's RAF buildings but I'm unable to make them destroyable. I've tried Rhumbaflappy's templates for damaged objects to no avail.

Here's an example of one of the library objects. What must I add to the text to make it destroyable? I have made DP files for these objects by the way.

Thanks,
Kevin

ObjID( 0CD1D004 4352FA73 2B77FAA3 23F35C50 )
LibObj(
PWR 0
SIZE 30
SCALE 0.250
TYPE 0
NAME "CD_Hut_Duxford" )
IfVarAnd( :L00548A 0024 0040 )
:L00548A
Call( :L0054A6 )
TransformCall( :L005590 0 12 0
0 0000 0 0000 0 0000 )
Return
:L0054A6
Points( 0
-12 0 -36 ; 0
12 0 -36 ; 1
12 0 36 ; 2
-12 0 36 ; 3
-12 12 -36 ; 4
12 12 -36 ; 5
12 12 36 ; 6
-12 12 36 ; 7
)
LoadBitmap( 0 6 EF 0 0 0
cdduxhut.bmp )
TexPoly( m 0 0 -32767 36
0 12 68 ; 0
4 12 118 ; 1
5 90 118 ; 2
1 90 68 ; 3
)
TexPoly( m 0 0 32767 36
2 110 67 ; 0
6 110 117 ; 1
7 188 117 ; 2
3 188 67 ; 3
)
TexPoly( m -32767 0 0 12
3 3 191 ; 0
7 3 247 ; 1
4 160 247 ; 2
0 160 191 ; 3
)
TexPoly( m 32767 0 0 12
1 3 191 ; 0
5 3 247 ; 1
6 160 247 ; 2
2 160 191 ; 3
)
Return
:L005590
Points( 8
-12 0 -36 ; 8
12 0 -36 ; 9
12 0 36 ; 10
-12 0 36 ; 11
0 6 -36 ; 12
0 6 36 ; 13
)
LoadBitmap( 0 6 EF 0 0 0
cdduxhut.bmp )
TexPoly( m 0 0 -32767 36
8 12 120 ; 0
12 51 149 ; 1
9 90 120 ; 2
)
TexPoly( m 0 0 32767 36
10 12 120 ; 0
13 51 149 ; 1
11 90 120 ; 2
)
RGBSColor( EF 96 84 80 )
Poly( m -14654 29308 0 5
11 13 12 8
)
Poly( m 14654 29308 0 5
9 12 13 10
)
Poly( m 0 -32767 0 0
9 10 11 8
)
Return
EndObj
 
kdriver

the key is this

IfVarAnd( :Normal 0024 0040 ) ;the label in this line points to the normal state
Jump( :Damaged ) ;the next line points to the damaged state

it makes the switch that chooses which path to take through the rest of the code
In scasm anything that starts with : is an address label.
Think about addresses, Every house needs a unique address but many parcels and letters will have that address on them. What happens when two houses have the same address?
SCASM decompliers assign hex offsets like :L00548A and :L0054A6
But friendly labels like :Normal and :Damaged are equally valid.

On this premis I can see an error in your your code
Code:
ObjID( 0CD1D004 4352FA73 2B77FAA3 23F35C50 )
LibObj( 
 PWR   0
 SIZE  30
 SCALE 0.250
 TYPE  0
 NAME   "CD_Hut_Duxford" )
 IfVarAnd( :L00548A 0024 0040 )    ;this label is just the 
:L00548A                                   ;next line any way! so the switch is broken
 Call( :L0054A6 )                          ;this calls the start of the first part
 TransformCall( :L005590 0 12 0      ;this calls the second part
    0 0000   0 0000   0 0000 )
 Return
:L0054A6
 Points( 0
    -12    0   -36 ;   0
     12    0   -36 ;   1
     12    0    36 ;   2
    -12    0    36 ;   3
    -12   12   -36 ;   4
     12   12   -36 ;   5
     12   12    36 ;   6
    -12   12    36 ;   7
 )
 LoadBitmap( 0 6 EF 0 0 0
  cdduxhut.bmp )
 TexPoly( m 0 0 -32767 36
      0   12    68 ; 0
      4   12   118 ; 1
      5   90   118 ; 2
      1   90    68 ; 3
 )
 TexPoly( m 0 0 32767 36
      2  110    67 ; 0
      6  110   117 ; 1
      7  188   117 ; 2
      3  188    67 ; 3
 )
 TexPoly( m -32767 0 0 12
      3    3   191 ; 0
      7    3   247 ; 1
      4  160   247 ; 2
      0  160   191 ; 3
 )
 TexPoly( m 32767 0 0 12
      1    3   191 ; 0
      5    3   247 ; 1
      6  160   247 ; 2
      2  160   191 ; 3
 )
 Return
:L005590
 Points( 8
    -12    0   -36 ;   8
     12    0   -36 ;   9
     12    0    36 ;  10
    -12    0    36 ;  11
      0    6   -36 ;  12
      0    6    36 ;  13
 )
 LoadBitmap( 0 6 EF 0 0 0
  cdduxhut.bmp )
 TexPoly( m 0 0 -32767 36
      8   12   120 ; 0
     12   51   149 ; 1
      9   90   120 ; 2
 )
 TexPoly( m 0 0 32767 36
     10   12   120 ; 0
     13   51   149 ; 1
     11   90   120 ; 2
 )
 RGBSColor(  EF 96 84 80 )
 Poly( m -14654 29308 0 5
  11 13 12 8 
 )
 Poly( m 14654 29308 0 5
  9 12 13 10 
 )
 Poly( m 0 -32767 0 0
  9 10 11 8 
 )
 Return
EndObj
I can see two parts , they are called one after the other, the switch is broken!
This is an easy mistake to make and fix, If you fix it yourself you will not make it again.
Or maybe we should have a competition, a prize for the first member to post the fix.


Damage can be shown in a number of ways
the damaged state could be a separate model included as part of the same object as in the code above.
If you have a number of objects that are similar and could share a damage model you could create a separate object, make it first in the library and call it by its GUID
Code:
CallLibObj( 0 id0 id1 id2 id3 )
Damage can sometimes be shown very nicely with a simple texture flip.
Code:
; Part: PARTNAME
:PARTLABEL
IfVarAnd( :DAMAGE_PARTLABEL 90 MASK )
SetMaterial( 0 t )
Jump( :DrawPARTNAME )

:DAMAGE_PARTLABEL
SetMaterial( 0 t )
:DrawPARTNAME



 
I wonder if this would work for making an advanced object into a library?

AB_Test.sca:
Code:
Header( 1  90.0 -90.0 179.999999999 -179.999999999 )
LatRange(  -90.0  90.0 )
Set( BUF 4096 )
Set( LABELS 9000 )
Set( PATCHES 9000 )
Set( LINBUF 8192 )
Set( MAXPTLST 3000 )

ObjID( AE357E18 442B600A 33AF3BA7 709D2E0F )

LibObj( 
    PWR   0
    SIZE  0
    SCALE 1.0
    TYPE  0
    NAME   "AB_Test"    )

IfVarAnd(  :skipToRegularObject_0001 0024 0040  )
    Jump(  :_damaged_object_0001  )
    :skipToRegularObject_0001
    Jump32(  :_regular_object_0001  )

    :_damaged_object_0001 
    Include( ab_d.sca )  ;damage object 
    Return

    :_regular_object_0001
    Include( ab.sca )  ;normal object
    Return
    
EndObj
...then ab_d.sca:
Code:
    TextureList( 0 
        6 80 128 128 255 0 32.524925 "INF_Damage_grd_bamboo_lg.bmp"
        6 80 128 128 255 0 15.918038 "INF_Damage_misc.bmp"
    )
    MaterialList( 0 
        0.501961 0.501961 0.501961 1.000000 0.501961 0.501961 0.501961 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 
    )
    VertexList( 0 
        -48128.003906 0.000000 9216.000977 0.000000 1.000000 0.000000 0.023438 1.011719 
        -46592.003906 0.000000 -16896.001953 0.000000 1.000000 0.000000 0.960938 1.015625 
        19456.001953 0.000000 -22528.001953 0.000000 1.000000 0.000000 0.960938 1.976563 
        21504.001953 0.000000 10752.000977 0.000000 1.000000 0.000000 0.015625 1.980469 
        -36352.003906 0.000000 -512.000061 -1.000000 0.000000 0.000000 0.718750 1.015625 
        -36352.003906 0.000000 -512.000061 0.000000 0.832050 0.554700 0.544860 1.050354 
        -36352.003906 0.000000 -7680.000488 -1.000000 0.000000 0.000000 0.721354 1.619792 
        -36352.003906 0.000000 -7680.000488 0.000000 0.000000 -1.000000 0.721354 1.619792 
        -36352.003906 1536.000122 -7680.000488 -1.000000 0.000000 0.000000 0.583333 1.622396 
        -36352.003906 1536.000122 -7680.000488 0.000000 0.000000 -1.000000 0.583333 1.622396 
        -36352.003906 1536.000122 -7680.000488 0.000000 0.492699 -0.870200 0.564709 1.050354 
        -36352.003906 1536.000122 -7680.000488 0.000000 0.857493 -0.514496 0.564709 1.050354 
        -36352.003906 3072.000244 -5120.000488 -1.000000 0.000000 0.000000 0.546875 1.471354 
        -36352.003906 3072.000244 -5120.000488 0.000000 0.832050 0.554700 0.544860 1.547668 
        -36352.003906 3072.000244 -5120.000488 0.000000 0.857493 -0.514496 0.564709 1.547668 
        -35840.003906 0.000000 -512.000061 0.000000 0.832050 0.554700 0.564709 1.050354 
        -35840.003906 0.000000 -512.000061 1.000000 0.000000 0.000000 0.718750 1.015625 
        -35840.003906 0.000000 -7680.000488 0.000000 0.000000 -1.000000 0.721354 1.552083 
        -35840.003906 0.000000 -7680.000488 1.000000 0.000000 0.000000 0.721354 1.619792 
        -35840.003906 1536.000122 -7680.000488 0.000000 0.000000 -1.000000 0.580729 1.549479 
        -35840.003906 1536.000122 -7680.000488 0.000000 0.492699 -0.870200 0.544860 1.050354 
        -35840.003906 1536.000122 -7680.000488 1.000000 0.000000 0.000000 0.583333 1.622396 
        -35840.003906 3072.000244 -5120.000488 0.000000 0.832050 0.554700 0.564709 1.547668 
        -35840.003906 3072.000244 -5120.000488 0.000000 0.857493 -0.514496 0.544860 1.547668 
        -35840.003906 3072.000244 -5120.000488 1.000000 0.000000 0.000000 0.546875 1.471354 
        -6135.808594 0.000000 -12293.121094 -0.999999 0.000000 -0.001204 0.950521 1.963542 
        -6135.808594 0.000000 -12293.121094 -0.002274 0.000000 0.999997 0.956250 1.218750 
        -6135.808594 0.000000 -12805.121094 -0.999999 0.000000 -0.001204 0.953125 1.937500 
        -6135.808594 0.000000 -12805.121094 0.002274 0.000000 -0.999997 0.956250 1.218750 
        -6135.808594 5632.000488 -12293.121094 -0.999999 0.000000 -0.001204 0.570313 1.963542 
        -6135.808594 5632.000488 -12293.121094 -0.002274 0.000000 0.999997 0.745313 1.218750 
        -6135.808594 5632.000488 -12293.121094 0.000000 1.000000 0.000000 0.726563 1.369792 
        -6135.808594 5632.000488 -12805.121094 -0.999999 0.000000 -0.001204 0.570313 1.934896 
        -6135.808594 5632.000488 -12805.121094 0.002274 0.000000 -0.999997 0.745313 1.218750 
        -6135.808594 5632.000488 -12805.121094 0.000000 1.000000 0.000000 0.695313 1.372396 
        -1527.808105 0.000000 -12282.880859 -0.002140 0.000000 0.999998 0.956250 1.417188 
        -1527.808105 0.000000 -12794.880859 0.002274 0.000000 -0.999997 0.956250 1.417188 
        -1527.808105 5632.000488 -12282.880859 -0.002274 0.000000 0.999997 0.745313 1.417188 
        -1527.808105 5632.000488 -12282.880859 0.000000 1.000000 0.000000 0.726563 1.208333 
        -1527.808105 5632.000488 -12282.880859 0.000000 1.000000 0.000000 0.726563 1.369792 
        -1527.808105 5632.000488 -12794.880859 0.002140 0.000000 -0.999998 0.745313 1.417188 
        -1527.808105 5632.000488 -12794.880859 0.000000 1.000000 0.000000 0.692708 1.210938 
        -1527.808105 5632.000488 -12794.880859 0.000000 1.000000 0.000000 0.695313 1.372396 
        2030.592163 0.000000 -2554.880127 -0.999999 0.000000 -0.001204 0.570313 1.934896 
        2030.592163 0.000000 -2554.880127 -0.001204 0.000000 0.999999 0.956250 1.015625 
        2030.592163 0.000000 -3066.880127 -0.999999 0.000000 -0.001204 0.570313 1.963542 
        2030.592163 0.000000 -3066.880127 0.001204 0.000000 -0.999999 0.956250 1.015625 
        2030.592163 5632.000488 -2554.880127 -0.999999 0.000000 -0.001204 0.953125 1.937500 
        2030.592163 5632.000488 -2554.880127 -0.001204 0.000000 0.999999 0.745313 1.015625 
        2030.592163 5632.000488 -2554.880127 0.000000 1.000000 0.000000 0.692708 1.210938 
        2030.592163 5632.000488 -3066.880127 -0.999999 0.000000 -0.001204 0.950521 1.963542 
        2030.592163 5632.000488 -3066.880127 0.001204 0.000000 -0.999999 0.745313 1.015625 
        2030.592163 5632.000488 -3066.880127 0.000000 1.000000 0.000000 0.726563 1.208333 
        3080.192139 0.000000 -12273.665039 -0.001204 0.000000 0.999999 0.956250 1.218750 
        3080.192139 0.000000 -12785.665039 0.001204 0.000000 -0.999999 0.956250 1.218750 
        3080.192139 5632.000488 -12273.665039 -0.001204 0.000000 0.999999 0.745313 1.218750 
        3080.192139 5632.000488 -12273.665039 0.000000 1.000000 0.000000 0.726563 1.208333 
        3080.192139 5632.000488 -12785.665039 0.002140 0.000000 -0.999998 0.745313 1.218750 
        3080.192139 5632.000488 -12785.665039 0.000000 1.000000 0.000000 0.692708 1.210938 
        4078.592285 5120.000488 -3064.832275 -0.999996 0.000000 -0.002742 0.523438 1.934896 
        4078.592285 5120.000488 -3064.832275 0.000000 -1.000000 0.000000 0.520833 1.966146 
        4078.592285 5632.000488 -3064.832275 -0.999996 0.000000 -0.002742 0.520833 1.966146 
        4078.592285 5632.000488 -3064.832275 0.000000 1.000000 0.000000 0.523438 1.934896 
        4104.192383 5120.000488 -12280.833008 -0.999996 0.000000 -0.002742 0.968750 1.934896 
        4104.192383 5120.000488 -12280.833008 0.000000 -1.000000 0.000000 0.968750 1.966146 
        4104.192383 5632.000488 -12280.833008 -0.999996 0.000000 -0.002742 0.968750 1.966146 
        4104.192383 5632.000488 -12280.833008 0.000000 1.000000 0.000000 0.968750 1.934896 
        4590.592285 5120.000488 -3063.808105 0.000000 -1.000000 0.000000 0.523438 1.934896 
        4590.592285 5120.000488 -3063.808105 0.999996 0.000000 0.002742 0.520833 1.966146 
        4590.592285 5632.000488 -3063.808105 0.000000 1.000000 0.000000 0.520833 1.966146 
        4590.592285 5632.000488 -3063.808105 0.999996 0.000000 0.002742 0.523438 1.934896 
        4616.192383 5120.000488 -12279.808594 0.000000 -1.000000 0.000000 0.968750 1.934896 
        4616.192383 5120.000488 -12279.808594 0.999996 0.000000 0.002742 0.968750 1.966146 
        4616.192383 5632.000488 -12279.808594 0.000000 1.000000 0.000000 0.968750 1.966146 
        4616.192383 5632.000488 -12279.808594 0.999996 0.000000 0.002742 0.968750 1.934896 
        6638.592285 0.000000 -2549.760254 -0.001204 0.000000 0.999999 0.953125 1.126953 
        6638.592285 0.000000 -2549.760254 0.999999 0.000000 0.001205 0.953125 1.142578 
        6638.592285 0.000000 -3061.760254 0.001204 0.000000 -0.999999 0.954687 1.128125 
        6638.592285 0.000000 -3061.760254 0.999999 0.000000 0.001205 0.953125 1.126953 
        6638.592285 5632.000488 -2549.760254 -0.001204 0.000000 0.999999 0.745313 1.128125 
        6638.592285 5632.000488 -2549.760254 0.000000 1.000000 0.000000 0.695313 1.372396 
        6638.592285 5632.000488 -2549.760254 0.999999 0.000000 0.001205 0.744141 1.144531 
        6638.592285 5632.000488 -3061.760254 0.001204 0.000000 -0.999999 0.745313 1.128125 
        6638.592285 5632.000488 -3061.760254 0.000000 1.000000 0.000000 0.726563 1.369792 
        6638.592285 5632.000488 -3061.760254 0.999999 0.000000 0.001205 0.746094 1.126953 
        7176.192383 0.000000 -12268.544922 -0.001204 0.000000 0.999999 0.956250 1.128125 
        7176.192383 0.000000 -12268.544922 0.999999 0.000000 0.001198 0.953125 1.142578 
        7176.192383 0.000000 -12780.544922 0.001204 0.000000 -0.999999 0.956250 1.128125 
        7176.192383 0.000000 -12780.544922 0.999999 0.000000 0.001198 0.953125 1.126953 
        7176.192383 5632.000488 -12268.544922 -0.001204 0.000000 0.999999 0.745313 1.128125 
        7176.192383 5632.000488 -12268.544922 0.000000 1.000000 0.000000 0.726563 1.369792 
        7176.192383 5632.000488 -12268.544922 0.999999 0.000000 0.001198 0.744141 1.144531 
        7176.192383 5632.000488 -12780.544922 0.001204 0.000000 -0.999999 0.745313 1.128125 
        7176.192383 5632.000488 -12780.544922 0.000000 1.000000 0.000000 0.695313 1.372396 
        7176.192383 5632.000488 -12780.544922 0.999999 0.000000 0.001198 0.746094 1.126953 
    )
    SetMaterial( 0 0 )
    DrawTriList( 0 
        0 1 3
        1 2 3
    )
    SetMaterial( 0 1 )
    DrawTriList( 4 
        27 37 30
        27 30 37
        2 0 4
        2 4 0
        82 90 87
        82 87 90
        84 90 82
        84 82 90
        83 53 88
        83 88 53
        50 53 83
        50 83 53
        23 25 28
        23 28 25
        21 25 23
        21 23 25
        29 32 24
        29 24 32
        36 32 29
        36 29 32
        89 52 86
        89 86 52
        54 52 89
        54 89 52
        85 49 81
        85 81 49
        51 49 85
        51 85 49
        31 51 33
        31 33 51
        49 51 31
        49 31 51
        35 54 38
        35 38 54
        52 54 35
        52 35 54
        36 50 32
        36 32 50
        53 50 36
        53 36 50
        79 45 76
        79 76 45
        48 45 79
        48 79 45
        74 77 72
        74 72 77
        34 37 27
        34 27 37
        4 0 8
        4 8 0
        42 47 73
        42 73 47
        46 39 43
        46 43 39
        41 39 46
        41 46 39
        26 31 33
        26 33 31
        22 31 26
        22 26 31
        19 7 10
        19 10 7
        16 6 19
        16 19 6
        18 1 11
        18 11 1
        9 1 18
        9 18 1
        63 60 67
        63 67 60
        56 60 63
        56 63 60
        40 75 44
        40 44 75
        71 75 40
        71 40 75
        17 12 14
        17 14 12
        20 12 17
        20 17 12
        55 61 59
        55 59 61
        57 61 55
        57 55 61
        58 69 62
        58 62 69
        65 69 58
        65 58 69
        66 68 70
        66 70 68
        64 68 66
        64 66 68
        13 5 15
        13 15 5
        3 5 13
        3 13 5
        80 77 74
        80 74 77
        73 47 78
        73 78 47
    )
The damage code was ripped from the inf.bgl and it contains 2 textures for the damage illusion.
...then ab.sca for the advanced building:
Code:
AdvBldg(  Normal 32 120
                Level1 18 5 512 1280
                Level2  15 20 1024 512 3072
                Level3   18 5 12 1280
                Roof   8 256 256
                )

It compiles, but could someone else check the object as a GSL in CFS2? in a dos window 'scasm AB_Test.sca' All three sca files need to be in the same folder as scasm ( or add a path so windows can find scasm ).

Dick
 
Thanks Simonu,

The content of a SCA file is a totally foreign language to me.

Cees originally supplied the APIs, half of which, including the above example, were converted by Sander de Cocq and the other half by me. I converted them by taking each API and compiling it with SCASM into a BGL, then decompiling it to a SCA file so I could modify the start of the text into library format. The end result of my efforts were the same as Sander's. All the library objects show up fine in the sim. A number of them had to have their scale adjusted. Aircraft and bullets can fly through all the buildings as if they are invisible.

I can sort of see what you are getting at, but unfortunately I don't have the knowledge to manipulate SCA files much further than I already have.
 
Thanks for getting back to the subject Dick, since you have done the hard bit I will try it out. I have to know if it will work

kdriver,
can you see what I did?
Code:
ObjID( 0CD1D004 4352FA73 2B77FAA3 23F35C50 )
LibObj( 
 PWR   0
 SIZE  30
 SCALE 0.250
 TYPE  0
 NAME   "CD_Hut_Duxford" )
 IfVarAnd( :L00548A 0024 0040 )

Call( :L0054A6 )

 :L00548A                                   
                           
TransformCall( :L005590 0 12 0      
    0 0000   0 0000   0 0000 )
 Return
:L0054A6
 Points( 0
    -12    0   -36 ;   0
     12    0   -36 ;   1
     12    0    36 ;   2
    -12    0    36 ;   3
    -12   12   -36 ;   4
     12   12   -36 ;   5
     12   12    36 ;   6
    -12   12    36 ;   7
 )
 LoadBitmap( 0 6 EF 0 0 0
  cdduxhut.bmp )
 TexPoly( m 0 0 -32767 36
      0   12    68 ; 0
      4   12   118 ; 1
      5   90   118 ; 2
      1   90    68 ; 3
 )
 TexPoly( m 0 0 32767 36
      2  110    67 ; 0
      6  110   117 ; 1
      7  188   117 ; 2
      3  188    67 ; 3
 )
 TexPoly( m -32767 0 0 12
      3    3   191 ; 0
      7    3   247 ; 1
      4  160   247 ; 2
      0  160   191 ; 3
 )
 TexPoly( m 32767 0 0 12
      1    3   191 ; 0
      5    3   247 ; 1
      6  160   247 ; 2
      2  160   191 ; 3
 )
 Return
:L005590
 Points( 8
    -12    0   -36 ;   8
     12    0   -36 ;   9
     12    0    36 ;  10
    -12    0    36 ;  11
      0    6   -36 ;  12
      0    6    36 ;  13
 )
 LoadBitmap( 0 6 EF 0 0 0
  cdduxhut.bmp )
 TexPoly( m 0 0 -32767 36
      8   12   120 ; 0
     12   51   149 ; 1
      9   90   120 ; 2
 )
 TexPoly( m 0 0 32767 36
     10   12   120 ; 0
     13   51   149 ; 1
     11   90   120 ; 2
 )
 RGBSColor(  EF 96 84 80 )
 Poly( m -14654 29308 0 5
  11 13 12 8 
 )
 Poly( m 14654 29308 0 5
  9 12 13 10 
 )
 Poly( m 0 -32767 0 0
  9 10 11 8 
 )
 Return

EndObj
 
It works! there is an issue with view range. The building will only show at short range. Maybe an adjustment in scale and size will get it show from further out.
 
Aircraft and bullets can fly through all the buildings as if they are invisible.
I should also have mentioned the dp. Damage profile should contain at least one system that is linked to a hitbox and set to break, use an existing building dp as a template but make sure there is a hit box that matches the building size reasonably well.
 
It works! there is an issue with view range. The building will only show at short range. Maybe an adjustment in scale and size will get it show from further out.

The 'PWR' may be needed to show an advanced building at range ( 100 would be 100 km ). Also, SIZE as 61 would be good for containing a building of 120 meters.

Also, I'm not sure that advanced building code is right... I'll see if I can check that.

Does the destroyed model show ( the textures are in the C:\Program Files\Microsoft Games\Combat Flight Simulator 2\SCENEDB\inf\texture folder, so if the BGL is in the C:\Program Files\Microsoft Games\Combat Flight Simulator 2\SCENEDB\inf\scenery older, they might show ).

I like the idea a making a library of damage models. It might also work to have a library of Advanced Buildings with damage models called from other libraries... Ha!

If we can only fix the view distance problem.

Also, in FS2002, we were able to use zero-height advanced buildings as hardened surfaces because the roofs were solid. We could place them at elevation to add helo-ports to gmaxed buildings.

Dick
 
I inadvertantly gave the test object a rather touph dp when I eventually got it. the damage model did show but it is way out of scale, it would work as a separate object in the library if the scale is reset.
I tried changing power ( I have not grasped what it does but the buildings dont show at all at 100
set it back to zero
next I tried setting Size=50 that fixed it :)
Calling objects from the same library works fine I did it with some trucks I'm still working on, the driver and passengers and their corpses are all objects in the same library as the trucks.

I think Advanced Building code is what is used for FS2K2 autogen, ACS dropped it in favour of the new object librarys for FS9. I wonder how the frame rate hit of librays of advanced buildings will compare with gmax and EOD built objects?

Heres a link to the scasm docs advanced buildings and other interesting stuff.
 
The PWR setting is supposed to be the maximum range at which the object will display... but it might not even be active for CFS2.

SIZE is the view radius of the object... it should be set to the object size or a bit higher. We could use 0 in FS2004, but that might not be right in CFS2.

TYPE should be 0 ( 2 for dynamic objects ).

The SCALE scales the object. 1.0 means 1 to 1. FS2002 objects from gmax are usually 0.5. I think FS9 changed to 1.0. CFS1 objects and some CFS2 are 0.002 and 0.001, I think.

The scale of the damage model I used should have been SCALE 0.001! I don't see a way to scale the objects and their damage model separately, unless the damage models are in a library already scaled, and we then call them. It all sounds like it's going to get a bit complicated if we have double scaling.

Dick
 
a guide to Advanced Buildings

Here's a really good PDF guide to 'generic' buildings. It's for FS9 and FSX, but the information is generally good for FS2002 and CFS2:

Generic Buildings for FS9 and FSX by Helmuth (Helli) Hauck

It explains the texture number assignments, and the placement/stretching/tiling of the textures rather well.

Dick
 
Thanks Simon and Dick for the information - I'll get there eventually.

Hopefully we will soon be able to blow up all 93 of Cees Donker's objects.

Wishing you a Merry Christmas and a Happy New Year.

Kevin
 
Damageable Advanced Building for GSL

Here's a workable template for an advanced building library object with GSL destruction code:

Code:
;EuroApts_01        destroyable advanced buildings

Header( 1  90.0 -90.0 179.999999999 -179.999999999 )
LatRange(  -90.0  90.0 )
Set( BUF 4096 )
Set( LABELS 9000 )
Set( PATCHES 9000 )
Set( LINBUF 8192 )
Set( MAXPTLST 3000 )


ObjID( AE3A7E18 442B600A 33AF3BA7 709D2E0F )   ;start GUID of Library sequence

;###########################################################################
    LibObj( 
        PWR   100
        SIZE  16   ;needs to be big enough to hold the object and damage area
        SCALE 1.0   ;most scales for CFS2 and FS2002 are one modeling unit = 0.5 meters
        TYPE  0
        NAME   "5x30_3_peak_01"    )
;----------------------------------------------------------------------------------------  damage test code        
        ;object code
            IfVarAnd(  :skipToRegularObject_0001   0024  0040  )
                Jump(  :d_5x30  )
                :skipToRegularObject_0001
                Jump32(  :5x30_3_peak_01  )
;----------------------------------------------------------------------------------------  damaged object        
            :d_5x30 
                TextureList( 0
                    1 FF 255 255 255 0 10.0
                    INF_DAMAGE_GRD_CONC_LG.BMP ; texture 0
                )
                MaterialList( 0
                    1.000 1.000 1.000 1.000 ; diffuse color
                    1.000 1.000 1.000 1.000 ; ambient color
                    0.000 0.000 0.000 1.000 ; specular color
                    0.000 0.000 0.000 1.000 ; emissive color
                    0.000 ; specular power
                    )
                VertexList( 0
                    -3.0 -16.0 0.000 0.000 0.000 -1.000 0.000 0.000 ; vertex 0
                    -3.0 16.0 0.000 0.000 0.000 -1.000 0.000 1.000 ; vertex 1
                    3.0 -16.0 0.000 0.000 0.000 -1.000 1.000 0.000 ; vertex 2
                    3.0 16.0 0.000 0.000 0.000 -1.000 1.000 1.000 ; vertex 3
                )
                Transform_Mat(
                    0.000 0.000 0.000
                    1.000 0.000 0.000
                    0.000 0.000 1.000
                    0.000 -1.000 0.000
                )
                    SetMaterial( 0 0 )
                    DrawTriList( 0
                        2    3    0 ;   0
                        1    0    3 ;   1
                    )
                TransformEnd
            Return
;---------------------------------------------------------------------------------------- normal object                
            :5x30_3_peak_01       ;normal object
                AdvBldg(  Normal  5  30   ;dimensions
                    ; in tiling, 256 = full texture mapping 512 = tile twice
                    LEVEL1        19        4        256    256                    ;texure, height, XTexTiling, ZTexTiling
                    LEVEL2        19        4        256    256    256            ;texure, height, XTexTiling, YTexTiling(height), ZTexTiling
                    LEVEL3        19        4        8        8                    ;texure, height, XTexTiling, ZTexTiling
                    ROOF            5                    256    256 )                ;texture, XTexTiling, ZTexTiling
                )
                Return 
;----------------------------------------------------------------------------------------    ending the object                    
    EndObj
;###########################################################################               
       
; add another object here... the guid willbe incrmented automatically if you like
; or add a ObjID(  ) line to specify an exact guid, then add another object.

The apartment building is 5 meters wide by 30 meters deep by 12 meters high... the tiling of the textures would need adjusting... I think I already fixed the gable ends.

I think there may actually be a problem with using advanced buildings vs. simple FP objects ( gmaxed objects ). The FS2002 Floating Point routines were supposed to be CPU time savers, and using a proper texture sheet, you might be able to use one drawcall for the non-destroyed object. On the other hand, the 'generic' buildings have been around through FS2000 thru FSX...

There is better texture control with gmax-type FP objects. I think FSDS might be even easier to design these simple buildings, then gmax.

Dick
 
Back
Top