menus

package
v0.0.0-...-16767da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeStatic         MenuType = 0
	TypeMenu           MenuType = 1
	TypeDragMenu       MenuType = 2  // Only seen in Configure_Vehicle_{Chaos,Ultra}
	TypeRadioMenu      MenuType = 3  // ???
	TypeMainBackground MenuType = 45 // ???
	TypeDialogue       MenuType = 300

	SubTypeSimpleButton    SubMenuType = 3
	SubTypeDoorHotspot1    SubMenuType = 30 // Like a button I guess? "FONTTYPE is animation speed"
	SubTypeDoorHotspot2    SubMenuType = 31 // Seems like a duplicate of the above? What's different?
	SubTypeLineKbd         SubMenuType = 40
	SubTypeLineBriefing    SubMenuType = 41
	SubTypeThumb           SubMenuType = 45 // A "thumb" appears to be a vertical slider
	SubTypeInvokeButton    SubMenuType = 50
	SubTypeClickText       SubMenuType = 60
	SubTypeOverlay         SubMenuType = 61
	SubTypeHypertext       SubMenuType = 70
	SubTypeCheckbox        SubMenuType = 91
	SubTypeEditBox         SubMenuType = 100
	SubTypeInventorySelect SubMenuType = 110
	SubTypeRadioButton     SubMenuType = 120
	SubTypeDropdownButton  SubMenuType = 200
	SubTypeComboBoxItem    SubMenuType = 205
	SubTypeAnimationSample SubMenuType = 220
	SubTypeAnimationHover  SubMenuType = 221 // FONTTYPE is animation speed. Only animate when hovered
	SubTypeMainButton      SubMenuType = 228
	SubTypeSlider          SubMenuType = 232
	SubTypeStatusBar       SubMenuType = 233

	SubTypeListBoxUp   SubMenuType = 400 // FIXME: these have multiple items in SUBMENUTYPE
	SubTypeListBoxDown SubMenuType = 405
)

Variables

View Source
var DescOverrides = map[string]int{
	"main:2.6":     50992,
	"newgame:2.5":  50993,
	"keyboard:3.3": 50995,
	"levelply:2.6": 50996,
}

FIXME: certain elements - especially overlays - don't have a DESC specified in the .mnu file, but display text specified with a number in i18n. The only conclusion I can draw is that they're hardcoded in the binary and set from outside. So, do that here.

View Source
var TextOverrides = map[string]string{
	"main:2.7": "0.1-ordoor",
}

FIXME: Same idea with text overrides, only these aren't mentioned in the .dta file at all!

View Source
var TypeOverrides = map[string]SubMenuType{

	"configure_ultequip:7.5": SubTypeListBoxUp,
	"configure_ultequip:7.6": SubTypeListBoxDown,
}

Functions

func LoadMenus

func LoadMenus(dir string, palette color.Palette) (map[string]*Menu, error)

Types

type Group

type Group struct {
	Menu    *Menu
	Records []*Record

	Properties
	Type MenuType
}

Group represents an element with a MENUTYPE. It is part of a Menu and may have children.

func (*Group) Props

func (g *Group) Props() *Properties
type Menu struct {
	Name string
	// TODO: load these
	ObjectFiles []string
	FontNames   []string

	// These are properties set in the menu header. We don't know what they're
	// all for.
	BackgroundColor color.Color
	HypertextColor  color.Color
	FontType        int

	// The actual menu records. There are multiple top-level items. Submenus are
	// only ever nested one deep.
	Groups []*Group
}

func LoadMenu

func LoadMenu(filename string, palette color.Palette) (*Menu, error)
func (m *Menu) Internationalize(replacer Replacer)
type MenuType int

MenuType tells us what sort of Group we have

type Properties

type Properties struct {
	Locator string // Not strictly a property. Set for tracking.

	ID        int
	ObjectIdx int // Can be specified in MENUID, defaults to 0

	Accelerator int
	Active      bool
	Desc        string
	DrawType    int
	FontType    int
	Moveable    bool
	Share       int
	SoundType   int
	SpriteId    []int
	X           int
	Y           int

	// From i18n
	Text string
	Help string
}

func (*Properties) BaseSpriteID

func (p *Properties) BaseSpriteID() int

func (*Properties) Point

func (p *Properties) Point() image.Point

type Record

type Record struct {
	Menu  *Menu
	Group *Group

	Properties
	Type SubMenuType
}

func (*Record) Internationalize

func (r *Record) Internationalize(replacer Replacer)

func (*Record) Props

func (r *Record) Props() *Properties

type Replacer

type Replacer interface {
	ReplaceText(int, *string)
	ReplaceHelp(int, *string)
}
type SubMenuType int

SubMenuType tells us what sort of Record we have

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL