class UMenuWeaponPriorityListBox expands UWindowListBox
	config;

function Created()
{
	local name ClassName;
	local class<Inventory> WeaponClass;
	local UMenuWeaponPriorityList L;

	local int i;

	local PlayerPawn P;

	ListClass = class'UMenuWeaponPriorityList';

	Super.Created();

	ItemHeight = 60;

	P = Root.Console.Viewport.Actor;

	// Load weapons into the list
	for(i=0;i<20;i++) {
		ClassName = P.WeaponPriority[i];
		if(ClassName == 'None') break;

		// Aghh, weapon powerups
		if(Left(ClassName, 15) == "DispersionPower")
			ClassName = 'WeaponPowerUp';

		WeaponClass = class<Inventory>(DynamicLoadObject("UnrealI."$string(ClassName), class'Class'));
		L = UMenuWeaponPriorityList(Items.Append(class'UMenuWeaponPriorityList'));
		L.Mesh = WeaponClass.Default.Mesh;
		L.Skin = WeaponClass.Default.Skin;
		L.DrawType = DT_Mesh;
		L.bHidden = True;
		L.bUnLit = True;
		L.bOnlyOwnerSee = True;
		L.WeaponName = String(P.WeaponPriority[i]);
	}
}


function DrawItem(Canvas C, UWindowList Item, float X, float Y, float W, float H)
{
	local vector V;
	local float Xs, Ys, Zproj;
	local PlayerPawn P;

	P = Root.Console.Viewport.Actor;

	WindowToGlobal(X, Y, Xs, Ys);

	Xs = Xs + 60;
	Ys = Ys + H/2;

	Zproj = (Root.WinWidth / 2) / ( tan(P.FOVAngle * Pi / 360) );
	v.X = 230;

	v.Y = ((Xs - Root.WinWidth/2) * v.X) / Zproj;
	v.Z = -((Ys - Root.WinHeight/2) * v.X) / Zproj;

	//Log("V is "$v);
	
	v = P.Location + (v >> P.ViewRotation);

	//Log("Player: "$P.Location$", Weapon: "$v);
	Item.SetLocation(v);
	Item.SetRotation(P.ViewRotation);
	C.DrawActor(Item, False);

	C.DrawColor.r = 255;
	C.DrawColor.g = 255;
	C.DrawColor.b = 255;

	C.Font = C.SmallFont;

	ClipText(C, X + 100, Y + H, UMenuWeaponPriorityList(Item).WeaponName);
}