Custom buttons in dialog boxes

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

Custom buttons in dialog boxes

Post by jayhova »

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?'.

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

Re: Custom buttons in dialog boxes

Post by King of Worms »

I can provide the buttons...

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

Re: Custom buttons in dialog boxes

Post by pango »

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...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

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

Re: Custom buttons in dialog boxes

Post by jayhova »

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?'.

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

Re: Custom buttons in dialog boxes

Post by Hazelnut »

FYI You can now disable the exit dungeon prompt with my latest PR submission.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Custom buttons in dialog boxes

Post by jayhova »

Joy!
Remember always 'What would Julian Do?'.

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

Re: Custom buttons in dialog boxes

Post by Hazelnut »

Yep joy at being able to mute the most annoying prompt in the game! :D
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply