Display MainGame.mnu and map in ordoor simultaneously

It's a complete mess for now - many things are out of place or shown
when they shouldn't be - and we can't move around the game map. But,
it's a good start.
This commit is contained in:
2020-04-11 01:01:05 +01:00
parent 5f8606377a
commit 76bf8438b0
9 changed files with 176 additions and 77 deletions

View File

@@ -45,6 +45,7 @@ func registerListBox(d *Driver, menu *menus.Record) ([]*menus.Record, error) {
var downBtn *menus.Record
var thumb *menus.Record
var items []*menus.Record
var otherChildren []*menus.Record
for _, rec := range menu.Children {
switch rec.Type {
@@ -66,7 +67,8 @@ func registerListBox(d *Driver, menu *menus.Record) ([]*menus.Record, error) {
}
thumb = rec
default:
return nil, fmt.Errorf("Unrecognised child in listbox menu: %v", rec.Locator())
// e.g. maingame:18.12 includes a button that is not part of the box
otherChildren = append(otherChildren, rec)
}
}
@@ -80,12 +82,21 @@ func registerListBox(d *Driver, menu *menus.Record) ([]*menus.Record, error) {
return nil, err
}
elemUp, err := registerButton(d, upBtn, upBtn.SpriteId[0])
upSprId := upBtn.SpriteId[0]
if upSprId == -1 {
upSprId = upBtn.Share
}
elemUp, err := registerButton(d, upBtn, upSprId)
if err != nil {
return nil, err
}
elemDown, err := registerButton(d, downBtn, downBtn.SpriteId[0])
dnSprId := downBtn.SpriteId[0]
if dnSprId == -1 {
dnSprId = downBtn.Share
}
elemDown, err := registerButton(d, downBtn, dnSprId)
if err != nil {
return nil, err
}
@@ -95,7 +106,12 @@ func registerListBox(d *Driver, menu *menus.Record) ([]*menus.Record, error) {
return nil, err
}
thumbImgSpr, err := d.menu.Sprite(thumb.SpriteId[0])
thumbSprId := thumb.SpriteId[0]
if thumbSprId == -1 {
thumbSprId = thumb.Share
}
thumbImgSpr, err := d.menu.Sprite(thumbSprId)
if err != nil {
return nil, err
}
@@ -145,7 +161,7 @@ func registerListBox(d *Driver, menu *menus.Record) ([]*menus.Record, error) {
element.refresh()
return nil, nil
return otherChildren, nil
}
func (l *listBox) SetStrings(to []string) {