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

UT2k4Assault.InfoPod


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
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
//=============================================================================
// InfoPod
//=============================================================================
// Place this actor in your level to display information on HUD.
// For example to tell the destination of a Teleporter
//=============================================================================

class InfoPod extends Keypoint
	placeable;

var()	enum EIP_AssaultTeam
{
	EIP_All,
	EIP_Attackers,
	EIP_Defenders,
} Team;

var()	enum EIP_InfoType
{
	EIPT_PlainText,
	EIPT_TextBrackets,
	EIPT_Texture,
} InfoType;

var()	enum EIP_InfoEffect
{
	EIPE_Normal,
	EIPE_Blink,
	EIPE_Pulse,
} InfoEffect;

var()	bool	bIsTriggered;	// do not replicate if not triggered
var()	bool	bDisabled;
var		bool	BACKUP_bDisabled;
var()	bool	bOverrideZoneCheck;	// Override Zone check (USE DrawDistThreshold to minimize CPU resources!!)
var()	bool	bOverrideVisibilityCheck;	// No line trace
var()	float	DrawDistThreshold;	// Don't draw beyond this distance (0 = unlimited)

var()	ERenderStyle	InfoPodDrawStyle;	// Draw style used for text or textures
var()	byte			DrawOpacity;		// Opacity

var()	Material		POD_Texture;
var()	float			TextureScale;

var()	localized	string	POD_Message;
var()				byte	FontSize;		// 0 (tiny) - 16 ( huge)


replication
{
	unreliable if ( (Role==ROLE_Authority) && bNetDirty )
		bDisabled;
}


event PostBeginPlay()
{
	super.PostBeginPlay();
	BACKUP_bDisabled = bDisabled;

	if ( !bIsTriggered )
		RemoteRole = Role_None;
}

event Trigger( Actor Other, Pawn EventInstigator )
{
	bDisabled = !bDisabled;	
	TriggerEvent( Event, Self, EventInstigator );
}

function Reset()
{
	super.Reset();
	bDisabled = BACKUP_bDisabled;
}


/* Return true if InfoPod is visible */
simulated final function bool IsInfoPodVisible( Canvas C, Pawn P, vector CamLoc, rotator CamRot )
{
	local vector		TargetLocation, TargetDir;
	local float			Dist;

	// Check if in same Zone
	if ( !bOverrideZoneCheck && P.Region.Zone != Region.Zone )
		return false;

	Dist = VSize(Location - CamLoc);

	// Check Distance Threshold
	if ( (DrawDistThresHold > 0) && ( Dist > DrawDistThresHold) )
		return false;

	// Check Min Distance
	if ( Dist < CollisionRadius )
		return false;

	// Target is located behind camera
	if ((Location - CamLoc) Dot vector(CamRot) < 0)
		return false;

	if ( !bOverrideVisibilityCheck )
	{
		// Simple Line check to see if we hit geometry
		TargetDir		= Location - CamLoc;
		TargetDir.Z		= 0;
		TargetLocation	= Location - 2.f * CollisionRadius * vector(rotator(TargetDir));

		return FastTrace( Location, CamLoc );
	}

	return true;
}

/* Render Info Pod. Visibility checking and Color is done in HUD_Assault */
simulated function Render( Canvas C, Vector IPScreenPos, PlayerController PC )
{
	C.Style = InfoPodDrawStyle;

	switch ( InfoType )
	{
		case EIPT_PlainText		: DrawInfoPod_PlainText( C, IPScreenPos, PC ); break;
		case EIPT_TextBrackets	: DrawInfoPod_TextBrackets( C, IPScreenPos, PC ); break;
		case EIPT_Texture		: DrawInfoPod_Texture( C, IPScreenPos ); break;
	}
}

/* Draw InfoPod Plain Text */
simulated function DrawInfoPod_PlainText( Canvas C, Vector IPScreenPos, PlayerController PC )
{
	local float		XL, YL;
	local string	FinalString;

	FinalString = class'HUD_Assault'.default.IP_Bracket_Open @ POD_Message @ class'HUD_Assault'.default.IP_Bracket_Close;
	C.Font = PC.myHUD.GetFontSizeIndex( C, FontSize - 8 );
	C.StrLen(FinalString, XL, YL);

	// Clipping
	if ( IPScreenPos.X + XL*0.5 > C.ClipX )
		IPScreenPos.X = C.ClipX - XL*0.5;
	if ( IPScreenPos.Y + YL*0.5 > C.ClipY )
		IPScreenPos.Y = C.ClipY - YL*0.5;

	// Drawing...
	C.SetPos(IPScreenPos.X - XL*0.5, IPScreenPos.Y - YL*0.5);
	C.DrawText(FinalString, false);
}


/* Draw InfoPod Text Brackets (Draws an additional box surrounding the InfoPod's collision cylinder) */
simulated function DrawInfoPod_TextBrackets( Canvas C, Vector IPScrO, PlayerController PC )
{
	local string Description;

	// Info Pod Description
	C.Font		= PC.myHUD.GetFontSizeIndex( C, FontSize - 8 );
	Description = class'HUD_Assault'.default.IP_Bracket_Open @ POD_Message @ class'HUD_Assault'.default.IP_Bracket_Close;

	class'HUD_Assault'.static.Draw_2DCollisionBox( C, Self, IPScrO, Description, DrawScale, false );
}


/* Draw InfoPod Texture */
simulated function DrawInfoPod_Texture( Canvas C, Vector IPScrO )
{
	local float W, H;

	if ( POD_Texture != None )
	{
		W = POD_Texture.MaterialUSize() * TextureScale * C.SizeX / 640.f;
		H = POD_Texture.MaterialVSize() * TextureScale * C.SizeY / 480.f;

		C.SetPos(IPScrO.X - W*0.5, IPScrO.Y - H*0.5);
		C.DrawTile(POD_Texture, W, H, 0.f, 0.f, POD_Texture.MaterialUSize(), POD_Texture.MaterialVSize());
	}
}

defaultproperties
{
     bIsTriggered=True
     InfoPodDrawStyle=STY_Alpha
     DrawOpacity=200
     TextureScale=1.000000
     POD_Message="-= info pod =-"
     FontSize=5
     bStatic=False
     bNoDelete=True
     bStasis=True
     bReplicateMovement=False
     bOnlyDirtyReplication=True
     RemoteRole=ROLE_DumbProxy
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:52.000 - Creation time: sk 18-3-2018 09:50:11.182 - Created with UnCodeX