## XIDMaps
Class CreditsParade

source: C:\XIII\XIDMaps\Classes\CreditsParade.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Info
             |
             +--XIDMaps.CreditsParade

Direct Known Subclasses:None

class CreditsParade
extends Engine.Info

Variables
`Sound` | `BeginMusic`
`Sound` | `BeginSound`
`Canvas` | `Canvas`
`Sound` | `EndMusic`
`Sound` | `EndSound`
`XIIIBaseHud` | `HUD`
`Array` | `Lines`
`float` | `YStart`
`M16Pick` | `pi`

Function Summary
`void` | `DisplayCredits(Canvas MyCanvas)`
`void` | `Init(Canvas MyCanvas, XIIIBaseHud MyHUD)`
    // 0 -  Default text ( BigFont - Blanc )
    // 1 - Titre ( LargeFont - Jaune )
`void` | `SelectFont(int code)`
`void` | `Start()`

Source Code

    00001	class CreditsParade extends Info
    00002		hidecategories(Advanced,Collision,Display,LightColor,Lighting,MOvement,Object,RollOff,Sound)
    00003		placeable;
    00004
    00005	VAR()			Array<string>	Lines;
    00006	VAR()			Sound			BeginSound;
    00007	VAR()			Sound			BeginMusic;
    00008	VAR()			Sound			EndSound;
    00009	VAR()			Sound			EndMusic;
    00010
    00011	VAR				Array<float>	LineHeights, LineWidths;
    00012	VAR				Array<int>		LineCodes;
    00013	VAR				bool			bSentEndMessage;
    00014	VAR				CreditsManager	CM;
    00015	VAR TRANSIENT	XIIIBaseHUD		HUD;
    00016	VAR TRANSIENT	Canvas			Canvas;
    00017	VAR TRANSIENT	float			YStart;
    00018	VAR TRANSIENT	M16Pick			pi;
    00019	//VAR TRANSIENT	float			LargeFontHeight, BigFontHeight, MedFontHeight, SmallFontHeight;
    00020	//VAR TRANSIENT	float			MyYL, Highest;
    00021
    00022	// 0 -  Default text ( BigFont - Blanc )
    00023	// 1 - Titre ( LargeFont - Jaune )
    00024
    00025	FUNCTION Init(Canvas MyCanvas, XIIIBaseHUD MyHUD)
    00026	{
    00027		LOCAL int i, code;
    00028		LOCAL float f, DefaultHeight;
    00029		Canvas=MyCanvas;
    00030		HUD=MyHUD;
    00031
    00032		LineHeights.Insert( 0, Lines.Length );
    00033		LineWidths.Insert( 0, Lines.Length );
    00034		LineCodes.Insert( 0, Lines.Length );
    00035
    00036		Canvas.Font = HUD.BigFont;
    00037		Canvas.TextSize("W", f, DefaultHeight);
    00038
    00039		for (i=0; i<Lines.Length; i++)
    00040		{
    00041			//log ( "ASC( Lines["@i@"] ) ="@ASC( Lines[i] ) );
    00042			if ( Lines[i]!="" )
    00043			{
    00044				if ( ASC( Lines[i] )==35 )
    00045				{
    00046					code = ASC( Mid(Lines[i], 1,1) )-48;
    00047					Lines[i] = Mid( Lines[i], 2);
    00048					SelectFont( code );
    00049					LineCodes[i] = code;
    00050				}
    00051				else
    00052				{
    00053					Canvas.Font = HUD.BigFont;
    00054				}
    00055				if ( InStr(caps(Lines[i]),"UTEZ")!=-1 )
    00056				{
    00057					SelectFont(5);
    00058					LineCodes[i]=5;
    00059				}
    00060				Canvas.TextSize( Lines[i], LineWidths[i], LineHeights[i]);
    00061			}
    00062			else
    00063			{
    00064				LineHeights[i] = DefaultHeight;
    00065			}
    00066
    00067		}
    00068		YStart = Canvas.ClipY ;
    00069		GotoState('');
    00070	}
    00071
    00072	FUNCTION Start()
    00073	{
    00074		SetTimer( 0.03, true );
    00075		if ( BeginSound!=none )
    00076			CM.PlaySound( BeginSound );
    00077		if ( BeginMusic!=none )
    00078			CM.PlayMusic( BeginMusic );
    00079	}
    00080
    00081	EVENT Timer( )
    00082	{
    00083		YStart-=1.5;
    00084	}
    00085
    00086	FUNCTION SelectFont( int code )
    00087	{
    00088		switch ( code )
    00089		{
    00090	//	case 9: // 1 - Title ( Huge Yellow )
    00091	//		Canvas.Font = HUD.BigFont;
    00092	//		break;
    00093		case 3: // 1 - Title ( Huge Yellow )
    00094			Canvas.Font = HUD.MedFont;
    00095			break;
    00096		case 1: // 1 - Title ( Huge Yellow )
    00097			Canvas.Font = HUD.LargeFont;
    00098			break;
    00099		case 0: // 0 - Normal ( Big White )
    00100		default:
    00101			Canvas.Font = HUD.BigFont;
    00102		}
    00103	}
    00104
    00105	FUNCTION DisplayCredits(Canvas MyCanvas)
    00106	{
    00107		LOCAL float X, X0, Y, W, H, a;
    00108		LOCAL int i, j;
    00109		LOCAL string C;
    00110		LOCAL VECTOR v;
    00111
    00112
    00113		Y = YStart;
    00114		for ( i=0;i<Lines.Length && Y<Canvas.ClipY;i++)
    00115		{
    00116			if ( Y> -LineHeights[i] )
    00117			{
    00118				X = Canvas.ClipX*0.67-0.5*LineWidths[i];
    00119				SelectFont( LineCodes[i] );
    00120				a=clamp( 255*(2-(abs(Y-(Canvas.ClipY*0.5))/Canvas.ClipY*4))  ,0,255);
    00121				switch ( LineCodes[i] )
    00122				{
    00123				case 7: // Water
    00124					Canvas.Style = ERenderStyle.STY_Alpha;
    00125					Canvas.SetDrawColor(224,224,255,64);
    00126					Canvas.SetPos( X+1.5*cos(10*Level.TimeSeconds), Y+9 );
    00127					Canvas.DrawText( Lines[i], false);
    00128					Canvas.SetDrawColor(224,224,255,96);
    00129					Canvas.SetPos( X+1.0*cos(10*Level.TimeSeconds+1.5), Y+6 );
    00130					Canvas.DrawText( Lines[i], false);
    00131					Canvas.SetDrawColor(224,224,255,128);
    00132					Canvas.SetPos( X+0.5*cos(10*Level.TimeSeconds+3.0), Y+3 );
    00133					Canvas.DrawText( Lines[i], false);
    00134					Canvas.Style = ERenderStyle.STY_Normal;
    00135					Canvas.SetDrawColor(255,255,255);
    00136					Canvas.SetPos( X, Y );
    00137					Canvas.DrawText( Lines[i], false);
    00138					break;
    00139
    00140				case 8:
    00141					Canvas.Style = ERenderStyle.STY_Alpha;
    00142					Canvas.SetDrawColor(255,255,255,128);
    00143					Canvas.SetPos( X+3*cos(3*Level.TimeSeconds), Y+2*sin(5*Level.TimeSeconds) );
    00144	//				Canvas.DrawColor.A = 128;
    00145					Canvas.DrawText( Lines[i], false);
    00146					Canvas.SetDrawColor(255,255,255,128);
    00147					Canvas.SetPos( X-2.5*cos(1+Level.TimeSeconds), Y-1.5*sin(7-7*Level.TimeSeconds) );
    00148					Canvas.DrawText( Lines[i], false);
    00149					Canvas.Style = ERenderStyle.STY_Normal;
    00150					Canvas.SetDrawColor(255,255,255);
    00151					Canvas.SetPos( X, Y );
    00152					Canvas.DrawText( Lines[i], false);
    00153					break;
    00154
    00155				case 9: // Fire
    00156					Canvas.Style = ERenderStyle.STY_Alpha;
    00157					Canvas.SetDrawColor(255,64,0,0.45*a);
    00158					Canvas.SetPos( X+1.5*cos(10*Level.TimeSeconds), Y-6 );
    00159					Canvas.DrawText( Lines[i], false);
    00160					Canvas.SetDrawColor(255,192,0,0.5*a);
    00161					Canvas.SetPos( X+1.0*cos(10*Level.TimeSeconds+1.5), Y-4 );
    00162					Canvas.DrawText( Lines[i], false);
    00163					Canvas.SetDrawColor(255,255,0,0.63*a);
    00164					Canvas.SetPos( X+0.5*cos(10*Level.TimeSeconds+3.0), Y-2 );
    00165					Canvas.DrawText( Lines[i], false);
    00166					Canvas.Style = ERenderStyle.STY_Normal;
    00167					Canvas.SetDrawColor(255,255,255,a);
    00168					Canvas.SetPos( X, Y );
    00169					Canvas.DrawText( Lines[i], false);
    00170					break;
    00171				case 0: // Outline noir
    00172					Canvas.Style = ERenderStyle.STY_Normal;
    00173					Canvas.SetDrawColor(0,0,0,a);
    00174					Canvas.SetPos( X+1, Y );
    00175					Canvas.DrawText( Lines[i], false);
    00176					Canvas.SetPos( X-1, Y );
    00177					Canvas.DrawText( Lines[i], false);
    00178					Canvas.SetPos( X, Y+1 );
    00179					Canvas.DrawText( Lines[i], false);
    00180					Canvas.SetPos( X, Y-1 );
    00181					Canvas.DrawText( Lines[i], false);
    00182					Canvas.SetDrawColor(255,255,255,a);
    00183					Canvas.SetPos( X, Y );
    00184					Canvas.DrawText( Lines[i], false);
    00185					break;
    00186				case 10 :
    00187					v = X*vect(1,0,0)+Y*vect(0,1,0)+vect(0,0,1);
    00188	//				Log ( HUD.XIIIPlayerOwner.MyInteraction.WorldToScreen( v ) );
    00189					v = -HUD.XIIIPlayerOwner.MyInteraction.ScreenToWorld( v );
    00190					v-=Location;
    00191					v*=40;
    00192					Log ( v );
    00193					v = Location + v.Y*vector(Rotation)+vect( 0,0,-1 )*v.Z;
    00194					if ( pi==none )
    00195					{
    00196						pi = Spawn( class'M16Pick',,,v);
    00197						if ( pi!=none)
    00198						{
    00199							pi.SetDrawScale(0.0004);
    00200							pi.SetCollision( false, false, false );
    00201							pi.bCollideWorld=false;
    00202						}
    00203
    00204					}
    00205					else
    00206						pi.SetLocation( v );
    00207					break;
    00208				case 6: // Shadow rouge
    00209					Canvas.Style = ERenderStyle.STY_Normal;
    00210					Canvas.SetDrawColor(255,0,0);
    00211					Canvas.SetPos( X+2, Y+2 );
    00212					Canvas.DrawText( Lines[i], false);
    00213					Canvas.SetDrawColor(255,255,255);
    00214					Canvas.SetPos( X, Y );
    00215					Canvas.DrawText( Lines[i], false);
    00216					break;
    00217
    00218				case 11: // Pong
    00219					X+=0.5*(Canvas.ClipX*0.4-LineWidths[i])*sin(Level.TimeSeconds);
    00220					Canvas.Style = ERenderStyle.STY_Normal;
    00221					Canvas.SetDrawColor(255,255,255);
    00222					Canvas.SetPos( X, Y );
    00223					Canvas.DrawText( Lines[i], false);
    00224					break;
    00225				case 5: // Sinus
    00226					X0 = X;
    00227					Canvas.Style = ERenderStyle.STY_Normal;
    00228					Canvas.SetDrawColor(255,255,255,a);
    00229					for ( j=0; j<len(Lines[i]); j++ )
    00230					{
    00231						C = Mid(Lines[i],j,1);
    00232						Canvas.TextSize( C, W, H );
    00233						Canvas.SetPos( X, Y+2*sin(X-X0+7*Level.TimeSeconds) );
    00234						Canvas.DrawText( C, false);
    00235						X+=W;
    00236					}
    00237	//				X+=0.5*(Canvas.ClipX*0.5-LineWidths[i])*sin(Level.TimeSeconds);
    00238					break;
    00239				case 1: // 1 - Title ( Huge Yellow )
    00240					Canvas.Style = ERenderStyle.STY_Normal;
    00241					Canvas.SetDrawColor(64,40,16,a);
    00242					Canvas.SetPos( X+1, Y );
    00243					Canvas.DrawText( Lines[i], false);
    00244					Canvas.SetPos( X-1, Y );
    00245
Canvas.DrawText( Lines[i], false); 00246 Canvas.SetPos( X, Y+1 ); 00247 Canvas.DrawText( Lines[i], false); 00248 Canvas.SetPos( X, Y-1 ); 00249 Canvas.DrawText( Lines[i], false); 00250 Canvas.SetDrawColor(255,160,64, a); 00251 Canvas.SetPos( X, Y ); 00252 Canvas.DrawText( Lines[i], false); 00253 break; 00254 case 2: // 1 - SubTitle ( Big Blue ) 00255 Canvas.Style = ERenderStyle.STY_Normal; 00256 Canvas.SetDrawColor(24,16,64,a); 00257 Canvas.SetPos( X+1, Y ); 00258 Canvas.DrawText( Lines[i], false); 00259 Canvas.SetPos( X-1, Y ); 00260 Canvas.DrawText( Lines[i], false); 00261 Canvas.SetPos( X, Y+1 ); 00262 Canvas.DrawText( Lines[i], false); 00263 Canvas.SetPos( X, Y-1 ); 00264 Canvas.DrawText( Lines[i], false); 00265 // Canvas.SetDrawColor(112,112,240,a); 00266 Canvas.SetDrawColor(152,152,216,a); 00267 Canvas.SetPos( X, Y ); 00268 Canvas.DrawText( Lines[i], false); 00269 break; 00270 case 3: // 3 - Medium Font white 00271 case 0: // 0 - Normal ( Big White ) 00272 default: 00273 Canvas.Style = ERenderStyle.STY_Normal; 00274 Canvas.SetDrawColor(255,255,255, a); 00275 Canvas.SetPos( X, Y ); 00276 Canvas.DrawText( Lines[i], false); 00277 } 00278 } 00279 Y += LineHeights[i]; 00280 } 00281 if ( !bSentEndMessage && i==Lines.Length && Y<0.80*Canvas.ClipY ) 00282 { 00283 bSentEndMessage =true; 00284 CM.ShowNextParade(); 00285 } 00286 if ( i==Lines.Length && Y<0 ) 00287 { 00288 CM.StopParade( ); 00289 if ( EndSound!=none ) 00290 CM.PlaySound( EndSound ); 00291 if ( EndMusic!=none ) 00292 CM.PlayMusic( EndMusic ); 00293 Destroy(); 00294 } 00295 } 00296 00297 00298 00299 defaultproperties 00300 { 00301 Texture=Texture'Engine.Proj_Icon' 00302 bDirectional=True 00303 }

End Source Code