Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Set HUD zoom from save file not working

For test results, bug reports, announcements of new builds etc.

Moderators: another_commander, winston, Getafix

Post Reply
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4680
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Set HUD zoom from save file not working

Post by phkb »

I think I'm right in saying that, if the player is using a HUD that has the non linear zoom set, the current setting of the zoom should be saved into the save file and restored from it. However, I don't think the restore from save is working correctly. I suspect that the HUD is being reset after the game is loaded and the zoom value is set, but I'm not sure what to do about it. I confirmed this by only having Xenon HUD installed in 1.85 (I haven't checked in 1.84 yet).

Is someone else able to confirm this behaviour?
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Set HUD zoom from save file not working

Post by Norby »

This is why HUDSelector save and restore the NonLinear and UltraZoom settings. So simply do not uninstall this package, even you already selected your favorite HUD.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4680
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Set HUD zoom from save file not working

Post by phkb »

Norby wrote:
This is why HUDSelector save and restore the NonLinear and UltraZoom settings.
It stores HUD settings, but not the current zoom value (ie 1:1, 2:1, 4:1, 8:1, 16:1).
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6565
Joined: Wed Feb 28, 2007 7:54 am

Re: Set HUD zoom from save file not working

Post by another_commander »

The current zoom value is restored to 1:1 on entry to station by design, even with the standard zoom function. I am not sure this is bug at all.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16065
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Set HUD zoom from save file not working

Post by Cody »

Is it? I must be misunderstanding something.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6565
Joined: Wed Feb 28, 2007 7:54 am

Re: Set HUD zoom from save file not working

Post by another_commander »

Now you made me go look at the source...

The 1:1 zoom is set on docking, launching and witchspace jump start, but only for the linear scanner type. Indeed, non-linear scanner does not reset.

I can see why this might be the case. With the linear scanner, if you dock with it set to a high zoom and then launch after a while, you may be seeing objects on your screen, but not on the scanner, simply because they are out of range at current zoom. This might be a bit confusing, since it is easy to forget that you had the zoom set to high until you actually look closer. So resetting it makes sense. The situation is different with the non-linear scanner, because all objects within scanner range are always visible regardless of the zoom. So in this case a reset is not necessary and it is even probably better to keep it always at the desired value This does raise a question of consistency though.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16065
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Set HUD zoom from save file not working

Post by Cody »

another_commander wrote: Sun Oct 08, 2017 11:32 am
Now you made me go look at the source...
<sniggers>
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6565
Joined: Wed Feb 28, 2007 7:54 am

Re: Set HUD zoom from save file not working

Post by another_commander »

Did some further investigation here. For me, this is working fine.

First, on a clean setup, I set the hud scanner to non-linear and ultra-zoom. I then loaded up a commander, exited the station, set zoom to 8:1, then auto-docked and saved immediately. Exited game, restarted game, loaded that commander and the scanner zoom was correctly set to 8:1, as expected.

This has been supported since 2014 and in order to remember the non-linear scanner zoom, the key "ship_scanner_zoom" must exist in the save file. If an old savefile is used, then the key will not exist and the zoom will be set to 1:1. Otherwise, there could be OXP interference.

Note that the key will be written in the log only if you save with the non-linear scanner set. If you perform a save with the scanner set to linear, then the key will not be saved. So, if you change scanner zoom settings in the meantime and try to load up that game again, you will hit the 1:1 zoom case.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4680
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Set HUD zoom from save file not working

Post by phkb »

Thanks for the confirmation a_c, looks like I’ve busted Xenon HUD somewhere. Now I know where to look!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4680
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Set HUD zoom from save file not working

Post by phkb »

OK, the problem isn't with Xenon HUD after all. The situation is this: after the game first loads, if the default HUD (normally hud.plist in the Resources folder) has scanner_non_linear = yes; and scanner_ultra_zoom = yes;, when you load a save file where the zoom setting has been changed, it will be applied correctly. However, if the default HUD doesn't have those two items set, then the zoom setting is ignored when the first game is loaded. And as the default HUD for the game doesn't have those two settings, this what takes place.

To test this, I created a 1.85 installation where the only OXP was Xenon HUD. I then created a new commander, launched, set the zoom to 4:1, docked and saved the game. I then exited the game, restarted, and loaded the saved game. My zoom setting was gone. I then turned on the two HUD settings in the default "hud.plist" file, restarted the game and reloaded my save file, and voila!, my zoom setting is picked up out of the save game.

There are a couple of solutions:
1. The easiest solution is just for Xenon HUD to include a modified hud.plist file that has the flags turned on. I've tested this and it works OK.
2. A less desirable solution is to turn on those 2 flags in the core game, but that's not likely to be a good solution.
3. The other option is to make the zoom setting read/writable to JS so OXP authors can do their own thing with the zoom.

I'm going with option 1 for now, and it will be in the next Xenon HUD release. Any other thoughts?
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16065
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Set HUD zoom from save file not working

Post by Cody »

phkb wrote: Mon Oct 09, 2017 12:10 am
The easiest solution is just for Xenon HUD to include a modified hud.plist file that has the flags turned on. I've tested this and it works OK.
That's how I've been running - the two flags added to the hud.plist of my custom Fighter Hud.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Post Reply