Allow menu records to be processed hierarchically by the UI driver

Nothing is actually processed in this way yet, but there is a new
assertion forbidding certain types of records from having children.

Because of this new assertion, our menutype tweaks must be moved up a
layer into internal/menus. They fit better there anyway.
This commit is contained in:
2020-03-31 23:29:43 +01:00
parent 7586b90f8a
commit 2ae3611d7f
5 changed files with 61 additions and 34 deletions

View File

@@ -8,12 +8,12 @@ import (
)
func init() {
registerBuilder(menus.TypeSimpleButton, registerSimpleButton)
registerBuilder(menus.TypeInvokeButton, registerInvokeButton)
registerBuilder(menus.TypeMainButton, registerMainButton)
registerBuilder(menus.TypeDoorHotspot, registerDoorHotspot)
registerBuilder(menus.TypeDoorHotspot2, registerDoorHotspot)
registerBuilder(menus.TypeDoorHotspot3, registerDoorHotspot)
registerBuilder(menus.TypeSimpleButton, noChildren(registerSimpleButton))
registerBuilder(menus.TypeInvokeButton, noChildren(registerInvokeButton))
registerBuilder(menus.TypeMainButton, noChildren(registerMainButton))
registerBuilder(menus.TypeDoorHotspot, noChildren(registerDoorHotspot))
registerBuilder(menus.TypeDoorHotspot2, noChildren(registerDoorHotspot))
registerBuilder(menus.TypeDoorHotspot3, noChildren(registerDoorHotspot))
}
// A button without hover animation
@@ -39,11 +39,6 @@ type mainButton struct {
}
func registerSimpleButton(d *Driver, r *menus.Record) error {
// FIXME: LevelPly.mnu specifies a menu oddly. This tweak gets us past it
if d.Name == "levelply" && r.Id == 2 {
return nil
}
return registerButton(d, r, r.SpriteId[0])
}