Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: CKid on June 20, 2008, 08:19:11 pm

Title: Hud Not Centred
Post by: CKid on June 20, 2008, 08:19:11 pm
Hey guys, It's me again with another problem involving 03-14-XT build. My primaries and hud crosshairs does not line up. Depending on the fighter that I select, the shots are off by a few degrees. I think my hud is not lined up correctly with my screen. My monitor is not a widescreen and running at 1024 x 768 ingame.
Title: Re: Hud Not Centred
Post by: colecampbell666 on June 20, 2008, 08:39:54 pm
I get this with newer builds as well, all recent kara builds, plus Wanderer's recent build. (080611)
Title: Re: Hud Not Centred
Post by: Swifty on June 21, 2008, 02:42:31 pm
It may be a problem with the view slewing TrackIR stuff. Can you post a screenshot please?
Title: Re: Hud Not Centred
Post by: colecampbell666 on June 21, 2008, 03:31:16 pm
Voila:
(http://i26.tinypic.com/xn8ax4.png)

Not using TrackIR.
Title: Re: Hud Not Centred
Post by: Snail on June 21, 2008, 04:23:09 pm
Maybe it has something to do with faulty viewpoints (or are they called eyepoints?)
Title: Re: Hud Not Centred
Post by: colecampbell666 on June 21, 2008, 07:57:36 pm
I doubt it, it happens with every ship.
Title: Re: Hud Not Centred
Post by: haloboy100 on June 21, 2008, 10:03:08 pm
Is it with all campaigns?
Title: Re: Hud Not Centred
Post by: Goober5000 on June 21, 2008, 11:02:53 pm
It may be a problem with the view slewing TrackIR stuff.
Yep, looks like you introduced several bugs with that feature.  See the first attached screenshot, for example.

There are a number of issues here.  First of all, you neglected to include the HUD_nose_x and HUD_nose_y in all the appropriate places, so the FS1 HUD no longer aligns properly.  Second of all, it looks like your HUD_get_nose_coordinates function does not default to 0 -- which it should -- when the viewer is level and pointed directly ahead.

I've added the missing HUD_nose_x and HUD_nose_y offsets in hudreticle.cpp so that the FS1 HUD now displays properly; see the second attached screenshot.  However, the centering code is still broken.  I've disabled it for the time being, so why don't you take a look and see if you can fix it.  I bet once you fix that bug, this thread's bug will be fixed as well.

[attachment deleted by admin]
Title: Re: Hud Not Centred
Post by: Swifty on June 22, 2008, 03:28:17 am
Nice method of lighting a fire under my ass. :D

Two things are affecting the accuracy of the nose calculation for the HUD. First, I scaled the ship's forward vector too small of a value. The prior calculated magnitude was probably too small to give an accurate vertex projection. Second, I forgot to unscale the projected offsets from the unconventional resolutions to the Freespace defaults. I didn't know that a gr_unsize_screen_posf existed until today. :)

So yeah, bug fixed. It's in the SVN repo.
Title: Re: Hud Not Centred
Post by: Goober5000 on June 22, 2008, 08:53:41 pm
Much better. :yes:

However, it's still not 100% fixed. :p When the viewpoint is level and straight ahead, x is 0, but y is 1.
Title: Re: Hud Not Centred
Post by: Swifty on June 23, 2008, 02:41:36 am
Much better. :yes:

However, it's still not 100% fixed. :p When the viewpoint is level and straight ahead, x is 0, but y is 1.
Okay, I've gone and scaled the forward vector by 10000 instead of 1000. I seem to get (0,0) now for the HUD offsets when centered. Hopefully that'll end this bug once and for all. :sigh:
Title: Re: Hud Not Centred
Post by: Goober5000 on June 23, 2008, 08:00:37 pm
Yup, that seems to have fixed it. :)