The goal of this code is to determine if we can pickup the item listed, and if we can, add it to an array for use later. Now, this works great for everything EXCEPT ammuniton, which seems to get picked up when this is done if the player has the weapon which uses the ammo.
Code:
var int /*-------------------*/ WFMode, HUDPanelOffset;
var byte /*------------------*/ ECost, MaxItems;
var() float /*---------------*/ TraceRange, SelectRadius;
var array<pickup> /*-------*/ Items;
var vector /*----------------*/ EndEffect;
<snip>
simulated function DrawWeaponInfo(Canvas Canvas)
{
local byte h, i;
local float Distance;
local Vector StartTrace, EndTrace, X,Y,Z;
local Vector HitLocation, HitNormal;
local Actor Other;
Canvas.DrawColor = class'HUD'.Default.WhiteColor;
Canvas.Font = font'DefaultFont';
switch (WFMode)
{
case 0:
<snip>
case 1:
GetViewAxes(X,Y,Z);
// the to-hit trace always starts right in front of the eye
StartTrace = Instigator.Location + Instigator.EyePosition() + X*Instigator.CollisionRadius;
EndTrace = StartTrace + TraceRange * X;
Other=Trace(HitLocation, HitNormal, EndTrace, StartTrace, false);
GetItemList ( HitLocation, Items );
Canvas.SetPos( ( Canvas.ClipX / 2 ) + HUDPanelOffset, ( Canvas.ClipY / 2) + HUDPanelOffset);
Canvas.DrawTile( Material'InterfaceContent.Menu.EditBox', 100, 10, 0,0,64,64);
Canvas.SetPos( ( Canvas.ClipX / 2 ) + HUDPanelOffset + 5, ( Canvas.ClipY / 2) + HUDPanelOffset +1 );
Canvas.DrawText("Pickups",true);
ECost=0;
h=1;
for(i=0; i<MaxItems; i++)
{
if(Items[i] != None)
{
if (Items[i].ReadyToPickup(0) && FastTrace(Items[i].location, instigator.Location)
&& Level.Game.PickupQuery(Instigator, Items[i]) /* oO */ )
{
Canvas.SetPos( ( Canvas.ClipX / 2 ) + HUDPanelOffset, ( Canvas.ClipY / 2) + HUDPanelOffset + 10*h);
Canvas.DrawTile( Material'InterfaceContent.Menu.EditBox', 100, 10, 0,0,64,64);
Canvas.SetPos( ( Canvas.ClipX / 2 ) + HUDPanelOffset + 5, ( Canvas.ClipY / 2) + HUDPanelOffset + 10*h+1 );
Canvas.DrawText(Items[i].PickupForce,true);
ECost++;
h++;
}
}
}
}
}