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

ServerDecals.DecalReplicationInfo


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
/******************************************************************************
DecalReplicationInfo

Creation date: 2010-07-15 11:08
Last change: $Id$
Copyright © 2010, Wormbo
Website: http://www.koehler-homepage.de/Wormbo/
Feel free to reuse this code. Send me a note if you found it helpful or want
to report bugs/provide improvements.
Please ask for permission first, if you intend to make money off reused code.
******************************************************************************/

class DecalReplicationInfo extends ReplicationInfo dependson(MapDecals);


//=============================================================================
// Variables
//=============================================================================

/** Replicated projectile properties. */
var struct TRepDecal {
	var Material ProjTexture;
	var vector   Location;
	var vector   Rotation; // replicated as vector for full precision
	
	var Projector.EProjectorBlending MaterialBlendingOp;
	var Projector.EProjectorBlending FrameBufferBlendingOp;
	
	var float DrawScale;
	var byte  FOV;
	var int   MaxTraceDistance;
	var bool  bProjectBSP;
	var bool  bProjectTerrain;
	var bool  bProjectStaticMesh;
	var bool  bProjectParticles;
	var bool  bProjectActor;
	var bool  bClipBSP;
	var bool  bClipStaticMesh;
	var bool  bProjectOnUnlit;
	var bool  bGradient;
	var bool  bProjectOnBackfaces;
	var bool  bProjectOnAlpha;
	var bool  bProjectOnParallelBSP;
	var name  ProjectTag;
} RepDecal;


//=============================================================================
// Replication
//=============================================================================

replication
{
	reliable if (bNetInitial && RepDecal.ProjTexture != None)
		RepDecal;
}


function SetDecal(MapDecals.TDecal Decal)
{
	RepDecal.ProjTexture = Material(DynamicLoadObject(Decal.ProjTexture, class'Material'));
	if (RepDecal.ProjTexture == None) {
		Destroy();
		return;
	}
	AddToPackageMap(Left(Decal.ProjTexture, InStr(Decal.ProjTexture, ".")));
	
	RepDecal.Location              = Decal.Location;
	RepDecal.Rotation              = VectorRotation(Decal.Rotation);
	RepDecal.MaterialBlendingOp    = Decal.MaterialBlendingOp;
	RepDecal.FrameBufferBlendingOp = Decal.FrameBufferBlendingOp;
	RepDecal.DrawScale             = Decal.DrawScale;
	RepDecal.FOV                   = Clamp(Decal.FOV, 0, 180);
	RepDecal.MaxTraceDistance      = Decal.MaxTraceDistance;
	RepDecal.bProjectBSP           = Decal.bProjectBSP;
	RepDecal.bProjectTerrain       = Decal.bProjectTerrain;
	RepDecal.bProjectStaticMesh    = Decal.bProjectStaticMesh;
	RepDecal.bProjectParticles     = Decal.bProjectParticles;
	RepDecal.bProjectActor         = Decal.bProjectActor;
	RepDecal.bClipBSP              = Decal.bClipBSP;
	RepDecal.bClipStaticMesh       = Decal.bClipStaticMesh;
	RepDecal.bProjectOnUnlit       = Decal.bProjectOnUnlit;
	RepDecal.bGradient             = Decal.bGradient;
	RepDecal.bProjectOnBackfaces   = Decal.bProjectOnBackfaces;
	RepDecal.bProjectOnAlpha       = Decal.bProjectOnAlpha;
	RepDecal.bProjectOnParallelBSP = Decal.bProjectOnParallelBSP;
	RepDecal.ProjectTag            = Decal.ProjectTag;
	
	if (Level.NetMode != NM_DedicatedServer)
		SpawnDecal();
}

simulated function PostNetReceive()
{
	if (RepDecal.ProjTexture == None)
		return;
	
	SpawnDecal();
	bNetNotify = False;
}

simulated function SpawnDecal()
{
	Spawn(class'ConfiguredDecal', Self, '', RepDecal.Location, RotationVector(RepDecal.Rotation));
}


//=============================================================================
// Utility functions
//=============================================================================

static final function rotator RotationVector(vector V)
{
	local rotator R;
	
	R.Pitch = V.X;
	R.Yaw   = V.Y;
	R.Roll  = V.Z;
	
	return R;
}

static final function vector VectorRotation(rotator R)
{
	local vector V;
	
	R = Normalize(R);
	V.X = R.Pitch;
	V.Y = R.Yaw;
	V.Z = R.Roll;
	
	return V;
}


//=============================================================================
// Default values
//=============================================================================

defaultproperties
{
	bNetNotify = True
}


Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 15.7.2010 12:08:32.000 - Creation time: Sa 23.8.2014 09:18:45.241 - Created with UnCodeX