## XIII
Class CWndOnTrigger

source: C:\XIII\XIII\Classes\CWndOnTrigger.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Effects
             |
             +--XIII.CWndBase
                |
                +--XIII.CWndOnTrigger

Direct Known Subclasses:None

class CWndOnTrigger
extends XIII.CWndBase

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

Variables
`float` | `AnimationDuration`
`CWndDuration,` | `CWndFOV`
`int` | `CWndSizeX`
`int` | `CWndSizeY`
`Actor` | `Cam`
`HudCartoonWindow` | `LastCWnd` message to display in overlay
`int` | `OnoPosX`
`int` | `OnoPosY`
`int` | `OnoSize`
`int` | `OnoSizeY`
`Texture` | `OnoTexture`
`array` | `OverlayMsg` message to display in overlay
`Actor` | `Tar`
`bool` | `bAnimatedInRealtime`
`bool` | `bSeeXIII`
`iA,` | `iB`
`int` | `iPhase`
`Color` | `myColor` message to display in overlay
`vScrPosX,` | `vScrPosY`
`vector` | `vTarOffset`

Function Summary
`simulated` | `Tick(float DeltaT)`
    //_____________________________________________________________________________
    // real time update of CWnd material

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class CWndOnTrigger extends CWndBase;
    00005
    00006	var bool bSeeXIII;
    00007
    00008	var int iPhase;
    00009	var float CWndDuration, CWndFOV;
    00010	var actor Cam;
    00011	var actor Tar;
    00012	var vector vTarOffset;
    00013	var int vScrPosX, vScrPosY;
    00014	var int CWndSizeX;
    00015	var int CWndSizeY;
    00016	var int iA, iB;
    00017
    00018	// SE XBOX Specific (to be used in SPCWndOnTriggerclass)
    00019	var bool bAnimatedInRealtime;
    00020	var float AnimationDuration;
    00021	// SE XBOX END
    00022
    00023	var texture OnoTexture;
    00024	var int OnoPosX;
    00025	var int OnoPosY;
    00026	var int OnoSize;
    00027	var int OnoSizeY;
    00028
    00029	var array<string> OverlayMsg;     // message to display in overlay
    00030	var HudCartoonWindow LastCWnd;
    00031
    00032	var Color myColor;
    00033
    00034	//_____________________________________________________________________________
    00035	event PostBeginPlay()
    00036	{
    00037	    if ( bDBCWnd )
    00038	      Log(self@"CWndOnTrigger PostBeginPlay RealTime="$bAnimatedInRealtime);
    00039	    Super.PostBeginPlay();
    00040	/*
    00041	    if ( bAnimatedInRealtime )
    00042	      Enable('Tick');
    00043	    else
    00044	      Disable('Tick');
    00045	*/
    00046	}
    00047
    00048	//_____________________________________________________________________________
    00049	// real time update of CWnd material
    00050	simulated function Tick(float DeltaT)
    00051	{
    00052	    if ( XIIIPawn(Tar) != none )
    00053	    { // cancel realtime computing if target has died to avoid him disappear if XIII grab him
    00054	      if ((Pawn(Tar).bIsDead || XIIIPawn(Tar).IsDead()) && !Pawn(Tar).IsAnimating())
    00055	        bAnimatedInRealtime = false;
    00056	      else if ( Pawn(Tar).bHidden )
    00057	        bAnimatedInRealtime = false;
    00058	      // Change filter color if target pawn died
    00059	      if ( Pawn(Tar).bIsDead )
    00060	        FilterColor = class'Canvas'.Static.MakeColor(255,0,0,128);
    00061	    }
    00062
    00063	    if ( !bAnimatedInRealtime )
    00064	    {
    00065	      if ( bDBCWnd )
    00066	        Log(self@"CWndOnTrigger Tick Disabling Tick");
    00067	      Disable('Tick');
    00068	      return;
    00069	    }
    00070
    00071
    00072	//    if ( bDBCWnd )
    00073	//      Log(self@"CWndOnTrigger Tick");
    00074	    HideUnwanted();
    00075	    MyHudForFX.PlayerOwner.Pawn.bOwnerNoSee = !bSeeXIII;
    00076
    00077	    switch (iPhase)
    00078	    {
    00079	      Case 1:
    00080		  	MyHudForFX.CWndMat.Update( iA, iB, CWndSizeX, CWndSizeY, cam.location, rotator(Tar.location+vTarOffset-cam.location), CWndFOV, FilterColor,HighLight,FilterTexture );
    00081	      break;
    00082	    }
    00083	    RestoreUnwanted();
    00084	}
    00085
    00086	//_____________________________________________________________________________
    00087	event Timer()
    00088	{
    00089	    if (iPhase==0)
    00090	      MyHudForFX.EraseLowPriorityCartoonWindows();
    00091	    iPhase ++;
    00092	    if ( bDBCWnd )
    00093	      Log(self@"CWndOnTrigger Timer "$IPhase);
    00094	    HideUnwanted();
    00095	    MyHudForFX.PlayerOwner.Pawn.bOwnerNoSee = !bSeeXIII;
    00096
    00097	    switch (iPhase)
    00098	    {
    00099	      Case 1:
    00100	        MyHudForFX.CWndMat.AllocRect( CWndSizeX, CWndSizeY, iA,iB );
    00101	        if ( bDBCWnd )
    00102	          Log("Displaying window coords="$iA@""$iB@" for image"$CWndSizeX$"x"$CWndSizeY);
    00103
    00104	        if ( (iA >= 0) && (iB >= 0) )
    00105	        {
    00106	          MyHudForFX.CWndMat.Update( iA, iB, CWndSizeX, CWndSizeY, Cam.location, rotator(Tar.location+vTarOffset-Cam.location), CWndFOV, FilterColor,HighLight,FilterTexture );
    00107	          LastCWnd = MyHudForFX.HudWnd;
    00108	          if ( LastCWnd != none ) // memorize last CWnd to include OverLayMsg to the new one
    00109	          {
    00110	            while ( LastCWnd.NextHudWnd != none )
    00111	            {
    00112	              LastCWnd = LastCWnd.NextHudWnd;
    00113	            }
    00114	          }
    00115	          AddWnd(vScrPosX, vScrPosY, CWndSizeX, CWndSizeY, MyHudForFX.CWndMat, iA, iB, CWndSizeX, CWndSizeY, CWndDuration, false);
    00116
    00117	          if ( LastCWnd == none ) // Add OverLayMsg
    00118	            MyHudForFX.HudWnd.OverlayMsg = OverlayMsg;
    00119	          else
    00120	            LastCWnd.NextHudWnd.OverlayMsg = OverlayMsg;
    00121
    00122	          if ( OnoTexture != none )
    00123	          {
    00124	            CWndBorderColor = class'canvas'.static.MakeColor(0,0,0,0);
    00125	            AddWnd(OnoPosX, OnoPosY, OnoSize, OnoSizeY, OnoTexture, 0, 0, OnoTexture.USize, OnoTexture.VSize, CWndDuration, false);
    00126	            CWndBorderColor = default.CWndBorderColor;
    00127	          }
    00128	          if ( CWndSoundType > 0 )
    00129	            Owner.PlaySound(hCWndSound, CWndSoundType);
    00130
    00131	          if (bAnimatedInRealtime)
    00132	            SetTimer(AnimationDuration, false);
    00133	          else
    00134	            SetTimer(0.1, false);
    00135	        }
    00136	        else
    00137	        {
    00138	          bAnimatedInRealtime = false;
    00139	          LOG(" Cancel CWND Creation for Cam="$Cam@"Tar="$Tar);
    00140	          SetTimer(0.1, false);
    00141	        }
    00142	        break;
    00143	      Case 2:
    00144	        Destroy();
    00145	        break;
    00146	    }
    00147	    RestoreUnwanted();
    00148	}
    00149
    00150
    00151	defaultproperties
    00152	{
    00153	}

End Source Code