Custom buttons in dialog boxes

Discuss modding questions and implementation details.
Post Reply
User avatar
jayhova
Posts: 651
Joined: Wed Jul 19, 2017 7:54 pm
Contact:

Custom buttons in dialog boxes

Post by jayhova » Mon May 20, 2019 3:11 pm

How would one go about substituting custom response buttons in specific dialog boxes? For instance instead of yes/no to the dialog box to access the wagon at the dungeon exit you could substitute exit/wagon.

How difficult would this be to implement on a scale 1-10?
Remember always 'What would Julian Do?'.
Windows 10 Pro 64 bit. DFU Ver. Alpha 0.10.7

User avatar
King of Worms
Posts: 2493
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Custom buttons in dialog boxes

Post by King of Worms » Tue May 21, 2019 10:42 pm

I can provide the buttons...

User avatar
pango
Posts: 1655
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Custom buttons in dialog boxes

Post by pango » Wed May 22, 2019 8:14 am

I have no direct experience in modding, but I can give some analysis on existing code, and my best guesses about modding... Hopefully some of this will be useful if somebody wants to give it a try.
And from what I understand, the level of difficulty will also depend on how "clean" and "extensible" you want modding to be:

The dialog box you're interested in, is in PlayerActivate.cs, in a long method handling all you can activate.
So I think the first step would be to isolate the creation of that dialog box in its own method so it can be overridden more easily. So that's a modification in Daggerfall Unity itself.

Code already supports using other buttons in dialog boxen, for example MALE / FEMALE buttons during character creation.
Those are identified using an enumeration, that is used as an index for loading their gfxs from BUTTONS.RCI.

So, the shortest route for a mod adding custom buttons would be to provide its own BUTTONS.RCI, with standard buttons and the extra ones; And in the new dialog box code to use extra indices, say (MessageBoxButtons)21 and (MessageBoxButtons)22.
The problem with that approach is that it won't be compatible with any other mod trying to do the same thing for another dialog box, old or new.

A clean solution would be to add some mechanism for a mod to reserve extra MessageBoxButton values (or do C# enumerations provide all what's necessary already?), and then overload buttons gfx loading so that extra values can be mapped to other files. That may be doable without modifying Daggerfall Unity itself by overriding DaggerfallUI.GetTextureFromCifRci(), but it may be cleaner to, again, isolate button gfx loading in its own method.

So, for somebody with modding experience, I'd say:
- some changes to Daggerfall Unity required
- difficulty 2 (dirty implementation) to 4 (clean implementation).

So let's say difficulty 4 for the first mod that will require to mod dialog box buttons.
Until somebody comes with a better estimate...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
jayhova
Posts: 651
Joined: Wed Jul 19, 2017 7:54 pm
Contact:

Re: Custom buttons in dialog boxes

Post by jayhova » Wed May 22, 2019 5:41 pm

That's a lot of good information. In a related question, what would it take to animate buttons? Of course the GUI dialog box would need to stay put for long enough to play the button animation.
Remember always 'What would Julian Do?'.
Windows 10 Pro 64 bit. DFU Ver. Alpha 0.10.7

User avatar
Hazelnut
Posts: 1716
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Custom buttons in dialog boxes

Post by Hazelnut » Mon May 27, 2019 4:53 pm

FYI You can now disable the exit dungeon prompt with my latest PR submission.

User avatar
jayhova
Posts: 651
Joined: Wed Jul 19, 2017 7:54 pm
Contact:

Re: Custom buttons in dialog boxes

Post by jayhova » Wed May 29, 2019 6:40 pm

Joy!
Remember always 'What would Julian Do?'.
Windows 10 Pro 64 bit. DFU Ver. Alpha 0.10.7

User avatar
Hazelnut
Posts: 1716
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Custom buttons in dialog boxes

Post by Hazelnut » Wed May 29, 2019 7:20 pm

Yep joy at being able to mute the most annoying prompt in the game! :D

Post Reply