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

U2.VoiceList


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
//=============================================================================
// VoiceList.uc
// $Author: Mbaldwin $
// $Date: 10/18/02 6:00p $
// $Revision: 3 $
//=============================================================================

class VoiceList extends Actor
	placeable;

//-----------------------------------------------------------------------------

#exec Texture Import File=Textures\VoiceList.pcx GROUP=Icons Name=VoiceList Mips=Off Masked=1

//-----------------------------------------------------------------------------

struct VerifyInfoT
{
	var() SoundSlotInterf.ESoundTableSlot Group;	// sound category
	var() int MinSounds;							// lower sound limit
	var() int MaxSounds;							// upper sound limit
};

//-----------------------------------------------------------------------------

var() array<string>		 Packages;		// list of voice package names
var int					 Next;			// index of next package to hand out.

// debug
var() array<VerifyInfoT> VerifyInfo;	// info the verify validity of assets
var() bool bVerify;						// verify there are enough sounds in each group

//-----------------------------------------------------------------------------

static function string GetVoicePackage( U2Pawn U2P )
{
	local VoiceList VL;
	local Actor A;

	// no voice list params, no package
	if( U2P.VoiceListTag == '' && U2P.VoiceListClass == None )
		return "";

	if( U2P.VoiceListTag != '' )			// search by tag
	{
		foreach U2P.AllActors( class'VoiceList', VL, U2P.VoiceListTag )
			break;

		if( VL == None )
			Warn( "VoiceList -- unable to find list with tag: '" $ U2P.VoiceListTag );
	}

	if( VL == None && U2P.VoiceListClass != None )	// search by voice list class
	{
		foreach U2P.AllActors( U2P.VoiceListClass, A )	// won't compile if VL is used directly (as above)
		{
			VL = VoiceList(A);
			if( VL != None )
				break;
		}
	}

	// spawn one if there are no pre-existing voice lists
	if( VL == None )
		VL = U2P.Spawn( U2P.VoiceListClass );

	return VL.GetNextPackage();
}

//-----------------------------------------------------------------------------

function string GetNextPackage()
{
	local string Result;

	if( Next < Packages.Length )
	{
		Result = Packages[Next];
		Next = (Next + 1) % Packages.Length;
	}
	else
		Warn( "VoiceList -- Error trying to access voice package #" @ Next @ "of" @ Self );

	return Result;
}


//-----------------------------------------------------------------------------

event PreBeginPlay()
{
	Super.PreBeginPlay();
	if( bVerify )
	{
		DM("Verifying Voice Packages for" @ Class.Name);
		if( VerifyPackages() )
			DM("All voice packages in" @ Class.Name @ "have PASSED");
		else
			DM("One or more packages in" @ Class.Name @ "have FAILED");
	}
}

//-----------------------------------------------------------------------------

function bool VerifyPackages()
{
	local int i;
	local bool success;

	success = true;

	for( i=0; i < Packages.Length; i++ )
	{
		DM("Verifying Voice package '" $ Packages[i] $ "'");
		if( !VerifySinglePackage( Packages[i] ) )
		{
			success = false;
			DM("     Package FAILED");
		}
		else DM("     Package PASSED");
	}

	return success;
}

//-----------------------------------------------------------------------------

function bool VerifySinglePackage( string PackageName )
{
	local int i, Count;
	local SoundTable ST;
	local bool Success;

	ST = class'SoundTable'.static.GetInstance( Self, PackageName );
	if( ST != None )
	{
		Success = true;
		for( i=0; i < VerifyInfo.Length; i++ )
		{
			Count = ST.GetNumSounds( VerifyInfo[i].Group );
			if( Count < VerifyInfo[i].MinSounds )
			{
				Success = false;
				DM("Voice package '" $ PackageName $ "' has too few sounds in group '" $ EnumStr(enum'ESoundTableSlot', VerifyInfo[i].Group) $ "' (" $ Count $ "/" $ VerifyInfo[i].MinSounds $ ")");
			}
		}
	}
	return Success;
}

//-----------------------------------------------------------------------------

defaultproperties
{
	bHidden=true
	Texture=Texture'U2.Icons.VoiceList'
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:43.749 - Created with UnCodeX