SCASM Animations
Bullet Holes
Modified Animation

Template     Original SCA Code     Edited SCA Code

Bullet holes are a modified animation in that they only appear under certain conditions. There are 8 variables used to monitor bullet strikes: bullets0, bullets1, bullets2, bullets3, bullets4, bullets5, bullets6, and bullets7.

The commands Zbias( 1 ) and Zbias( 0 ) set a 1 pixel bias to the small bullet polygon before it's drawn and reset the bias to 0 pixels just after it's drawn to prevent flickering of the bullet hole texture on the model surface.

VAR - hex offset to the variable bullets0 ... bullets7.
MASK - hex mask used in the test of bullets0 ... bullets7.

; Part: PARTNAME
:PARTLABEL
IfVarAnd( :NOHIT_PARTLABEL  VAR  MASK )
SetMaterial(  m  t  )
Jump( :DrawPARTNAME )

:NOHIT_PARTLABEL
Return

:DrawPARTNAME
Transform_Mat(
     0.000000 0.000000 0.000000
     1.000000 0.000000 0.000000
     0.000000 1.000000 0.000000
     0.000000 0.000000 1.000000
     )
Zbias( 1 )
DrawTriList( index  ... vertex indices ...  )
TransformEnd
Zbias( 0 )
Return

Original SCA Code     Template     Edited SCA Code

This is the original object source code for a bullet hole polygon on the bottom left elevator surface generated by FSDS Pro v2.33 from fxpaint.fsc.

; Part: bh10E_BLElevator.0002
:Part000038
Transform_Mat(
    -855.195679 -7.802880 -81.774178
    1.000000 0.000000 0.000000
    0.000000 1.000000 0.000000
    0.000000 0.000000 1.000000
    )
SetMaterial( 0 2 )
DrawTriList( 440
    0 1 2
    0 2 3
    )
TransformEnd
Return

Edited SCA Code     Template     Original SCA Code

This is the edited object source code that produces a bullet hole polygon on the bottom left elevator surface in fxpaint.mdl only if the damage box enclosing the elevator is hit.

; Part: bh10E_BLElevator.0002
:Part000038
;Check bullets7 for hit
IfVarAnd( :NoHit_Part000038 0x10E 0x0002 )
SetMaterial( 0 2 )
Jump( :Draw_Part000038 )

:NoHit_Part000038
Return

:Draw_Part000038
Transform_Mat(
    -855.195679 -7.802880 -81.774178
    1.000000 0.000000 0.000000
    0.000000 1.000000 0.000000
    0.000000 0.000000 1.000000
    )
Zbias( 1 )
DrawTriList( 440
    0 1 2
    0 2 3
    )
TransformEnd
Zbias( 0 )
Return