SpatialFear.SFWeaponDescWindow

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
//=============================================================================
// Spatial Fear
// Name: SFWeaponDesctWindow
// Description: Window, that pops up and describes a new weapon
//
// Author: Markus Nuebel
//=============================================================================



class SFWeaponDescWindow 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 bool		m_bFirstTime;		// Private: Indicates, if the running text has already been set on the window
var string		m_strWeaponText;	// Private: Running weapon text.

var MeshActor   m_actMesh;  // Private: Mesh actor for weapon display
var Rotator     m_rotView;  // Private: Rotator used to animate the weapon mesh
var int			m_nWeaponIconHeight;	// Private: Height of weapon icon window;
var int			m_nWeaponIconWidth;     // Private: Width of weapon 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 float		m_fMeshScale;			// Private: Scaling factor for the icon mesh
var bool		m_bIntroMode;			// Flag to enable the intro mode display of the 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);

	// 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 = 63;

/*
     // Setup mesh actor to display weapon
     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);
}

// Custom show function to enable a fade-in
simulated function show()
{
	m_bFirstTime	= false;
	m_wndIcon.show();
	clearRunningText();

	setSingleFadeReverse(1.0f);

	Super.show();

}

// Custom show function to enable a fade-in
simulated function showInIntro()
{
	m_bIntroMode	= true;
	m_bFirstTime	= false;
	m_bNoFade		= true;
	m_bRunningText	= false;
	m_strText		= m_strWeaponText;

	// Call to base class
	Super.show();

	m_wndIcon.show();
	stopRunning();

}

// Custom hide to provide a fade out
simulated function hide()
{
	m_bIntroMode	= false;

	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.hide();

}

// Called every frame
function Tick(float fDelta)
{
 	if(!isVisible() || m_bIntroMode)
		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

		setRunningText(m_strWeaponText, SFGameInfo(Level.Game).fReadingSpeed);
		m_bFirstTime	= true;

	}

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

}

// Overwritten in child class, to do different foreground
simulated function renderForeground(Canvas C)
{
	// Call to base class
	Super.renderForeground(C);

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

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

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

/*
	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 = -1 -((m_fMeshScale-1)*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_nWeaponIconWidth*m_fHUDScale, m_nWeaponIconHeight*m_fHUDScale, m_actMesh, false, m_rotView, vectLocation);

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

defaultproperties
{
     m_nIconSize=64
     m_nIconLeftOffset=15
     m_nIconTopOffset=-3
     m_nWeaponIconHeight=100
     m_nWeaponIconWidth=300
     m_fMeshScale=1.000000
     m_fFadeOutTime=1.000000
     m_nTextOffset=115
     m_nTextIndent=16
     m_texBkg=Texture'SfResource1.Background.WeaponWin'
     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:45 PM
Created with UnCodeX