Finally, how are weapon offsets calculated? My assumption was that it uses the offsets set on the image the sprite uses, these offsets must then be added to the PSprite offsets and multiplied by the scale the weapon's resolution scale. Problem is, DrawImage doesn't seem to use the images offsets like a normal HUDWeapon does and even when I tried adding the offsets manually to offset field in DrawImage, the weapon still did not appear in the correct location on screen.
Here is a simple function I created to test drawing the weapon to the screen:
Code: Select all
Void DrawMachinegun(Void)
{
If (Plr)
{
If (Plr.Player.ReadyWeapon Is 'AlphaMachinegun')
{
Vector2 WScale = (VWidth / 320.0,VHeight / 200.0);
Let PWSprite = Plr.Player.GetPSprite(PSP_WEAPON);
DrawImage("MGUNTEST",((PWSprite.X - 134) * WScale.X,(PWSprite.Y - 113) * WScale.Y),0,1.0,(-1,-1),(WScale.X * PWSprite.Scale.X,WScale.Y * PWSprite.Scale.Y),STYLE_Normal);
}
}
}
EDIT:
Looking at the screenshot, it occurred to me that HUDWeapons are affected by sector light levels, how is this done as that is something I will also have to replicate.