Automap (indoor & dungeon) implementation

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
Post Reply
User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul »

Thanks! Will start investigating now!
Interkarma wrote:Calling SetState() from LoadGame throws an exception in "saveStateAutomapDungeon()", which is called by SetState() itself.
yeah this was a mistake it correctly needs to be called in GetState() will fix that ;)

still have to fix another issue though

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul »

have it working now (and I think it rocks) - do you want me to do the pull request to the master or do you want to make a branch again?

and today I had a laugh:
Image

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma »

Nystul wrote:have it working now (and I think it rocks) - do you want me to do the pull request to the master or do you want to make a branch again?
Just chuck it through to master. :)
Nystul wrote: and today I had a laugh:
Image
BWAHAHA! :lol:

Yeah, um, I really need to fix the minimum capsule height...

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul »

ok ;)
these rats also sometimes climb under my feet and lift me up ;)

I am not satisfied completely with the tooltip popup time - what annoys me a bit is when you are using the buttons with mouse down the tooltip comes up while you are still holding the mouse button down. How much work would it be to prevent tooltips showing up when the button is pressed on them?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma »

I've not tested but something like this should work.

First, capture the defaultToolTip instance in your DaggerfallAutomapWindow constructor (this is a protected member inherited from DaggerfallBaseWindow):

Code: Select all

ToolTip savedToolTip;

public DaggerfallAutomapWindow(IUserInterfaceManager uiManager)
: base(uiManager)
{
    savedToolTip = defaultToolTip;
}
When any button-down action is in process, disable the default tooltip:

Code: Select all

defaultToolTip = null;
When button-down action is complete, set back the default tooltip with your saved instance.

Code: Select all

defaultToolTip = savedToolTip;
The bit of code that does tooltip updates and drawing (in DaggerfallBaseWindow) will take no action if defaultToolTip == null, so setting this while pressing buttons should do the job.

Let me know how you go. Almost midnight here - slightly drunk and tired. Above may be bollocks. :)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma »

I've merged changes. The first issue of state not being generated on new game seems resolved. I'm still getting an exception in restoreStateAutomapDungeon on a fresh start though. Stack trace below.
NullReferenceException: Object reference not set to an instance of an object
DaggerfallWorkshop.Game.DaggerfallAutomap.restoreStateAutomapDungeon (Boolean forceNotVisitedInThisRun) (at Assets/Scripts/Game/DaggerfallAutomap.cs:1547)
DaggerfallWorkshop.Game.DaggerfallAutomap.SetState (System.Collections.Generic.Dictionary`2 savedDictAutomapDungeonsDiscoveryState) (at Assets/Scripts/Game/DaggerfallAutomap.cs:127)
DaggerfallWorkshop.Game.Serialization.SaveLoadManager+<LoadGame>c__Iterator17.MoveNext () (at Assets/Scripts/Game/Serialization/SaveLoadManager.cs:1089)
Steps to reproduce:
  1. Start a new game in PH.
  2. Quick-save F9, exit game completely.
  3. Start game, load quick-save from load menu.
If I just quicksave and quickload without stopping game, it all works fine. Can only reproduce when stopping game and starting up again.

Edit with more information. Exception generated by below line as gameobjectGeometry is null when restoreStateAutomapDungeon() is called. Possibly because map window has not been opened yet. Might just need a null check and call to init that GameObject when setting state from fresh load.

Code: Select all

Transform location = gameobjectGeometry.transform.GetChild(0);

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul »

yep, that worked. thanks!
It is preventing the tooltip. a bit annoying is that once the mouse button is released the tooltip will pop up immediately when the mouse hasn't been moved for the specified second

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul »

Interkarma wrote:I've merged changes. The first issue of state not being generated on new game seems resolved. I'm still getting an exception in restoreStateAutomapDungeon on a fresh start though. Stack trace below.
NullReferenceException: Object reference not set to an instance of an object
DaggerfallWorkshop.Game.DaggerfallAutomap.restoreStateAutomapDungeon (Boolean forceNotVisitedInThisRun) (at Assets/Scripts/Game/DaggerfallAutomap.cs:1547)
DaggerfallWorkshop.Game.DaggerfallAutomap.SetState (System.Collections.Generic.Dictionary`2 savedDictAutomapDungeonsDiscoveryState) (at Assets/Scripts/Game/DaggerfallAutomap.cs:127)
DaggerfallWorkshop.Game.Serialization.SaveLoadManager+<LoadGame>c__Iterator17.MoveNext () (at Assets/Scripts/Game/Serialization/SaveLoadManager.cs:1089)
Steps to reproduce:
  1. Start a new game in PH.
  2. Quick-save F9, exit game completely.
  3. Start game, load quick-save from load menu.
If I just quicksave and quickload without stopping game, it all works fine. Can only reproduce when stopping game and starting up again.

Edit with more information. Exception generated by below line as gameobjectGeometry is null when restoreStateAutomapDungeon() is called. Possibly because map window has not been opened yet. Might just need a null check and call to init that GameObject when setting state from fresh load.

Code: Select all

Transform location = gameobjectGeometry.transform.GetChild(0);
will take a look at this issue

edit1: yes I can reproduce - fix will come soon hopefully

edit2: is it intended that quickload does not fire OnLoadEvent?

edit3: fixed now (still wondering about OnLoadEvent though)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma »

Nystul wrote:yep, that worked. thanks!
It is preventing the tooltip. a bit annoying is that once the mouse button is released the tooltip will pop up immediately when the mouse hasn't been moved for the specified second
Hmm. Try adding a public method to BaseScreenComponent to clear the hoverTime value. If you clear hoverTime at the same point you restore defaultToolTip, that should scrub the time mouse has been over the button while tooltip was disabled. For example, button.ClearTooltipHoverTime().

Sorry, brain tired. Will probably think of something a bit cleaner in the morning. :)

Edit: Will probably make a SuppressToolTip(bool) method somewhere that does all this junk for you. I'll think on it overnight, if you can let this one sit for now.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul »

Interkarma wrote: Edit: Will probably make a SuppressToolTip(bool) method somewhere that does all this junk for you. I'll think on it overnight, if you can let this one sit for now.
of course! no hurry needed!

Post Reply