# SpatialFear.SFItemDescWindow

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 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 |
    //=============================================================================
    // Spatial Fear
    // Name: SFItemDescWindow
    // Description: Window, that pops up and describes a new item
    //
    // Author: Markus Nuebel
    //=============================================================================

    class SFItemDescWindow extends SFFadeWindow;

    var SFIconWindow	m_wndIcon;		// Private: Icon for this item.
    var int			m_nIconSize;		// Private: Icon size
    var int			m_nIconLeftOffset;	// Private: Left offset for icon
    var int			m_nIconTopOffset;	// Private: Top offset for icon

    var MeshActor   m_actMesh;			// Private: Mesh actor for item display
    var Rotator     m_rotView;			// Private: Rotator used to animate the weapon mesh
    var int			m_nItemIconHeight;	// Private: Height of item icon window;
    var int			m_nItemIconWidth;   // Private: Width of item icon window;
    var int			m_nModelOffsetX;	// Private: X offset of item model to window top/left corner
    var int			m_nModelOffsetY;	// Private: Y offset of item model to window top/left corner
    var int			m_nTitelWidth;		// Private: Width of item name display;
    var int			m_nTitleHeight;		// Private: Height of item name display;
    var string		m_strItemText;		// Private: Running item text.
    var bool		m_bFirstTime;		// Private: Indicates, if the running text has already been set on the window

    var float		m_fMeshScale;		// Private: Scaling factor for the icon mesh
    var string		m_strName;			// Private: Name of item, used for header

    // 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);

    	// Setup the item icon
    	m_wndIcon	=  Spawn(class'SFIconWindow');
    	m_wndIcon.init(m_fHUDScale, m_XCur+m_nIconLeftOffset, m_YCur-m_nIconTopOffset, m_nIconSize, m_nIconSize, Owner, "", Self);
    	m_wndIcon.setDisplaySize(64);
    	m_wndIcon.m_bNoFade = false;

    	m_nTextOffset = 71;
    	m_nTextIndent = 12;
    	m_nTextIndentR = 12;

    /*
    	m_actMesh	= PlayerPawn(m_oPawnOwner).Spawn(class'MeshActor');
    	m_actMesh.Mesh = None;
    	m_actMesh.Skin = None;
    	m_actMesh.DrawScale=0.07;
    	m_actMesh.AmbientGlow=255;
    	m_actMesh.ScaleGlow=3;
    */
    }

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

    	 if(None != m_wndIcon)
    		m_wndIcon.terminate();

         // Release references
    	 m_actMesh	= None;
    	 m_wndIcon	= None;
    }

    // Sets the texture for the item icon
    simulated function setIcon(Texture tex)
    {
    	m_wndIcon.setTexture(tex);
    }

    simulated function show()
    {
    	m_bFirstTime	= false;
    	m_wndIcon.show();
    	clearRunningText();

    	setSingleFadeReverse(1.0f);

    	Super.show();

    }

    simulated function hide()
    {
    	setSingleFade(1.0f);

    	stopRunning();
    	// Force window do fade out
    	m_bUsedRunningText=false;

    	// Because the fade out replaces the hide command
    	if(None != m_sndClose)
    		m_oPawnOwner.PlaySound(m_sndClose, SLOT_Misc, m_fCloseSoundVol);

    //	Super.show();

    }

    // Called every frame
    function Tick(float fDelta)
    {
    	local float	fSpeed;

    	if(!isVisible())
    		return;

         // Call to base class
         Super.Tick(fDelta);

    	if(isFadedIn() && !m_bRunningText && !m_bFirstTime)
    	{
    		// Set Fade out parameter when running text is done
    		setSingleFade(1.0f);
    		resetFadeCounter();		// To show the window with full fade

    		fSpeed	= SFGameInfo(Level.Game).fReadingSpeed;
    		setRunningText(m_strItemText, fSpeed);

    		m_bFirstTime	= true;

    	}

         // Increments the rotation yaw, thereby flipping back to 0 when at 360
         m_rotView.Yaw = (m_rotView.Yaw + fDelta * 16384) & 65535;
    	 m_rotView.Pitch = 65535/8;
    }

    // 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);

    	// Show the icon
    	m_wndIcon.render(C, m_fHUDScale);

    /*
    	if (m_actMesh != None && m_actMesh.Mesh != 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 = -10;
    		vectLocation.y = 0;
    		vectLocation.z = 0;
    		// Draw the clipped actor
    		DrawClippedActor(C, (m_XCur+m_nModelOffsetX)*m_fHUDScale,  (m_YCur+m_nModelOffsetY)*m_fHUDScale, m_nItemIconHeight*m_fHUDScale, m_nItemIconWidth*m_fHUDScale, m_actMesh, false, m_rotView, vectLocation);

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

    // Base class override: Added display of item name to upper left corner
    simulated function renderForeground(Canvas C)
    {
    	local color colSave;
    	local int	nStyleSave;

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

    	// Just display title when fully visible
    	if(isFading())
    		return;

        // Save current canvas settings
    	colSave		= C.DrawColor;
    	nStyleSave	= C.Style;

    	// Draw black title
    	C.Style = ERenderStyle.STY_Normal;
    	C.DrawColor.R = 255;
    	C.DrawColor.G = 0;
    	C.DrawColor.B = 0;

    	// Draw the item title
    	renderTextArea(C, int(m_XCur)+m_nItemIconWidth, int(m_YCur)-m_nTitleHeight, m_nTitelWidth, m_nTitleHeight, m_strName);

    	C.DrawColor = colSave;
    	C.Style		= nStyleSave;

    }

    defaultproperties
    {
         m_nIconSize=64
         m_nIconLeftOffset=17
         m_nItemIconHeight=100
         m_nItemIconWidth=110
         m_nTitelWidth=250
         m_nTitleHeight=65
         m_fMeshScale=1.000000
         m_fFadeOutTime=1.000000
         m_nTextOffset=95
         m_nTextIndent=16
         m_texBkg=Texture'SfResource1.Background.ItemWin'
         m_nBorderSize=12
         m_sndOpen=Sound'SfResource1.Window.OpenDescWnd'
         m_sndClose=Sound'SfResource1.Window.CloseDescWnd'
    }

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