PDA

View Full Version : Zoom Crosshair Problem



legacy-Gobi
07-10-2003, 11:36 AM
Strange crosshair problem, if the player dies with zoom enabled the crosshair is hidden until the player picks up the weapon again!

code:
-----------------------------------------------------------------------------------
simulated event RenderOverlays( Canvas Canvas )
{
local PlayerController P;
local float Scale;

P = PlayerController(Instigator.Controller);
LastFOV = PlayerController(Instigator.Controller).DesiredFOV ;

if ( LastFOV > P.DesiredFOV )
{
PlaySound(Sound'WeaponSounds.LightningGun.Lightnin gZoomIn', SLOT_Misc,,,,,false);
}

else if ( LastFOV < P.DesiredFOV )
{
PlaySound(Sound'WeaponSounds.LightningGun.Lightnin gZoomOut', SLOT_Misc,,,,,false);
}

if ( P.DesiredFOV == P.DefaultFOV)
{
P.MyHud.bCrosshairShow = True;
Super.RenderOverlays(Canvas);
zoomed = false;
}

else
{
P.MyHud.bCrosshairShow = False;
SetZoomBlendColor(Canvas);
scale = Canvas.ClipX/640 * 1.1;
Canvas.SetPos(0.5 * Canvas.ClipX - 128 * Scale, 0.5 * Canvas.ClipY - 128 * Scale );
Canvas.Style = ERenderStyle.STY_Translucent;
Canvas.DrawIcon(Texture'CrapTex.Tex.CrapScope', Scale);
Canvas.SetPos(0.5 * Canvas.ClipX + 64 * Scale, 0.5 * Canvas.ClipY + 96 * Scale);
Canvas.DrawColor.R = 0;
Canvas.DrawColor.G = 155;
Canvas.DrawColor.B = 255;
scale = P.DefaultFOV/P.DesiredFOV;
Canvas.DrawText("X"$int(Scale)$"."$int(10 * scale - 10 * int(Scale)));
zoomed = true;
}
}
-----------------------------------------------------------------------------

legacy-Spin
07-10-2003, 12:30 PM
I was only doing this yesterday :) At first I did it exactly the same as you did, however it doesnt take into account wether the player had crosshairs hidden by default and means that the non-zoomed view will put the crosshair back up wether the player wants it or not ;)

Create a variable in your fire class that stores the state of the crosshair default for player and restore to that rather than a direct true or false at bringup, putdown and in event of playerdeath.

legacy-Gobi
07-10-2003, 01:22 PM
:up: THX

Added the following to PutDown and ClientWeaponThrown in my WeaponClass.

Works perfect!
code:
==============================================

simulated function ClientWeaponThrown()
{
if( Instigator != none && Instigator.Controller.IsA( 'PlayerController' ) )
PlayerController(Instigator.Controller).EndZoom();
PlayerController(Instigator.Controller).MyHud.bCro sshairShow = True;
Super.ClientWeaponThrown();
}
simulated function bool PutDown()
{
if( Instigator.Controller.IsA( 'PlayerController' ) )
PlayerController(Instigator.Controller).EndZoom();
PlayerController(Instigator.Controller).MyHud.bCro sshairShow = True;
if ( Super.PutDown() )
{
GotoState('');
return true;
}
return false;
}
==============================================

legacy-WIZARD2K
07-15-2003, 11:15 AM
what happens if they die while zoomed ;)

i had this problem and thought i fixed it but it doesnt seem to work online O_o

legacy-Gobi
07-15-2003, 11:51 AM
Tested it online and it works.