Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.FluidSurfaceInfo


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
#exec Texture Import File=Textures\S_FluidSurf.pcx Name=S_FluidSurf Mips=Off MASKED=1

class FluidSurfaceInfo extends Info
    showcategories(Movement,Collision,Lighting,LightColor,Karma,Force)
    native
    noexport
    placeable;

var () enum EFluidGridType
{
    FGT_Square,
    FGT_Hexagonal
} FluidGridType;

var () float                        FluidGridSpacing; // distance between grid points
var () int                          FluidXSize; // num vertices in X direction
var () int                          FluidYSize; // num vertices in Y direction

var () float                        FluidHeightScale; // vertical scale factor

var () float                        FluidSpeed; // wave speed
var () float                        FluidTimeScale;
var () float                        FluidDamping; // between 0 and 1

var () float                        FluidNoiseFrequency;
var () range                        FluidNoiseStrength;

var () bool                         TestRipple;
var () float                        TestRippleSpeed;
var () float                        TestRippleStrength;
var () float                        TestRippleRadius;

var () float                        UTiles;
var () float                        UOffset;
var () float                        VTiles;
var () float                        VOffset;
var () float                        AlphaCurveScale;
var () float                        AlphaHeightScale;
var () byte                         AlphaMax;

var () float                        ShootStrength; // How hard to ripple water when shot
var () float                        ShootRadius; // How large a radius is affected when water is shot

// How much to ripple the water when interacting with actors
var () float                        RippleVelocityFactor;
var () float                        TouchStrength;

// Class of effect spawned when water surface it shot or touched by an actor
var () class<Actor>                 ShootEffect;
var () bool                         OrientShootEffect;

var () class<Actor>                 TouchEffect;
var () bool                         OrientTouchEffect;

// Bitmap indicating which water verts are 'clamped' ie. dont move
var const array<int>                ClampBitmap;

// Terrain used for auto-clamping water verts if below terrain level.
var () edfindable TerrainInfo       ClampTerrain;

var () bool                         bShowBoundingBox;
var () bool                         bUseNoRenderZ;
var () float                        NoRenderZ;

// Amount of time to simulate during postload before water is first displayed
var () float                        WarmUpTime;

// Rate at which fluid sim will be updated
var () float                        UpdateRate;

var () color                        FluidColor;

// Sim storage
var transient const array<float>    Verts0;
var transient const array<float>    Verts1;
var transient const array<byte>     VertAlpha;

var transient const int             LatestVerts;

var transient const box             FluidBoundingBox;   // Current world-space AABB
var transient const vector          FluidOrigin;        // Current bottom-left corner

var transient const float           TimeRollover;
//var transient const float			AverageTimeStep;
//var transient const int  			StepCount;
var transient const float           TestRippleAng;

var transient const FluidSurfacePrimitive Primitive;
var transient const array<FluidSurfaceOscillator>   Oscillators;
var transient const bool            bHasWarmedUp;

// Functions

// Ripple water at a particlar location.
// Ignores 'z' componenet of position.
native final function Pling(vector Position, float Strength, optional float Radius);

// Default behaviour when shot is to apply an impulse and kick the KActor.
simulated function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, 
                        Vector momentum, class<DamageType> damageType)
{
    //Log("FS TakeDam:"$hitlocation@damageType);
    if (damageType.default.FluidSurfaceShootStrengthMod ~= 0)
        return;

    // Vibrate water at hit location.
    Pling(hitLocation, ShootStrength * damageType.default.FluidSurfaceShootStrengthMod, ShootRadius);

    // If present, spawn splashy hit effect.
    if( (ShootEffect != None) && EffectIsRelevant(HitLocation,false) )
    {
        if(OrientShootEffect)
            spawn(ShootEffect, self, , hitLocation, rotator(momentum));
        else
            spawn(ShootEffect, self, , hitLocation);
    }
}

simulated function Touch(Actor Other)
{
    local vector touchLocation;

    Super.Touch(Other);

    if( (Other == None) || !Other.bDisturbFluidSurface )
        return;

    touchLocation = Other.Location;

    // Now projectiles affect water by Touch instead of TakeDamage, use ShootStrength here.
    Pling(touchLocation, ShootStrength * Other.FluidSurfaceShootStrengthMod, Other.CollisionRadius);

    // JTODO: Fix for non-horizontal fluid
    touchLocation.Z = Location.Z;
    if( (TouchEffect != None) && EffectIsRelevant(touchLocation,false) )
    {
        if(OrientTouchEffect)
            spawn(TouchEffect, self, , touchLocation, rotator(Other.Velocity));
        else
            spawn(TouchEffect, self, , touchLocation);
    }
}

defaultproperties
{
     FluidGridType=FGT_Hexagonal
     FluidGridSpacing=24.000000
     FluidXSize=48
     FluidYSize=48
     FluidHeightScale=1.000000
     FluidSpeed=170.000000
     FluidTimeScale=1.000000
     FluidDamping=0.500000
     FluidNoiseFrequency=60.000000
     FluidNoiseStrength=(Min=-70.000000,Max=70.000000)
     TestRippleSpeed=3000.000000
     TestRippleStrength=-20.000000
     TestRippleRadius=48.000000
     UTiles=1.000000
     VTiles=1.000000
     AlphaHeightScale=10.000000
     AlphaMax=128
     ShootStrength=-50.000000
     RippleVelocityFactor=-0.050000
     TouchStrength=-50.000000
     WarmUpTime=2.000000
     UpdateRate=50.000000
     DrawType=DT_FluidSurface
     bHidden=False
     bNoDelete=True
     Texture=Texture'Engine.S_FluidSurf'
     bUnlit=True
     bCollideActors=True
     bEdShouldSnap=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 23/10/2006 20:25:16.000 - Creation time: Wed 7/2/2007 19:16:39.312 - Created with UnCodeX