# SpatialFear.SFCapWindow

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 |
    //=============================================================================
    // Spatial Fear
    // Name: SFCapWindow
    // Description: Window that pops up for a captain communication window
    //
    // Author: Markus Nuebel
    // Modified By: Chris Rogers
    //=============================================================================
    class SFCapWindow extends SFCommWindow;

    var Rotator     m_rotView;  // Private: Rotator used to animate the weapon mesh
    var int			m_nCommIconHeight;	// Private: Height of comm icon window;
    var int			m_nCommIconWidth;     // Private: Width of comm icon window;
    var int			m_nModelOffsetX;		// Private: X offset of weapon model to window top/left corner
    var int			m_nModelOffsetY;		// Private: Y offset of weapon model to window top/left corner
    var bool		m_bIsTrainer;			// Hack, to make this a trainer window

    // All initialization stuff
    simulated function init(float fHUDScale, int X, int Y, int nWidth, int nHeight, optional Pawn Owner, optional string strText, optional SFWindow wndParent)
    {
    	// Call to base class
    	Super.init(fHUDScale, X, Y, nWidth, nHeight, Owner, strText, wndParent);

    	m_nTextOffset = 221;
    	m_nTextIndent = 14;
    	m_nTextIndentR = 7;

    	// Setup mesh actor to display weapon
    	m_actMesh = m_oPawnOwner.Spawn(class'SFCaptainHead');
    	if(None == m_actMesh)
    		class'SFUtils'.Static.sfError("SFCommWindow - init: Cannot create  Captain head mesh!");
    	else
    	{
    		m_actMesh.DrawScale=0.1;
    		m_actMesh.bHidden=true;
    		m_actMesh.bUnlit=true;
    		m_actMesh.AmbientGlow=128;

    	}
    	m_rotView.Yaw =  65535* 3/4;
    }

    // Cleanup
    simulated function terminate()
    {
    	// Call to base class
    	Super.terminate();

    	// Release references
    	m_actMesh	= None;
    }

    // Overwritten in child class, to do different backgrounds and effects
    simulated function renderBackground(Canvas C)
    {
    	local float          OldFov;
    	local vector		  vectLocation;

    	// Call to base class
    	Super.renderBackground(C);

    	if ((m_actMesh != None) && !isFading())
    	{
    		// Save old FOV
    		OldFov = PlayerPawn(m_oPawnOwner).FOVAngle;

    		// Set new FOV
    		PlayerPawn(m_oPawnOwner).SetFOVAngle(30);

    		// Some scaling depending on collision radius
    		vectLocation.x = -1;
    		vectLocation.y = 0;
    		vectLocation.z = 0;

    		// Check for trainer window
    		if(m_bIsTrainer)
    		{
    			m_actMesh.MultiSkins[1] = Texture'SFResource1.Skins.Trainer';
    		}

    		m_nModelOffsetX = 16;

    		// Draw the clipped actor
    		DrawClippedActor(C, (m_XCur+m_nModelOffsetX)*m_fHUDScale,  (m_YCur+m_nModelOffsetY)*m_fHUDScale, m_nCommIconWidth*m_fHUDScale, m_nCommIconHeight*m_fHUDScale, m_actMesh, false, m_rotView, vectLocation);

    		// Restore old FOV
    		PlayerPawn(m_oPawnOwner).SetFOVAngle(OldFov);
    	}
    }

    simulated function show()
    {
    	// Call to base class
    	Super.show();

    	// Show the mesh
    	m_actMesh.bHidden=false;
    	if(None != m_actMesh)
    	{
    		m_actMesh.LoopAnim('All', 0.2);
    	}
    }

    simulated function hide()
    {
    	// Call to base class
    	Super.hide();
    	// Remove the mesh actor
    	m_actMesh.bHidden=true;
    }

    defaultproperties
    {
         m_nCommIconHeight=250
         m_nCommIconWidth=200
         m_nModelOffsetX=40
         m_nModelOffsetY=30
         m_nTextOffset=200
         m_nBorderSize=12
         m_sndOpen=Sound'SfResource1.Window.OpenCaptainWnd'
         m_sndClose=Sound'SfResource1.Window.CloseCaptainWnd'
    }

class file time: 12/7/2003 3:58:24 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX