We can reach the bridge \o/

This commit is contained in:
2020-03-26 23:35:34 +00:00
parent e4ce932324
commit 79bfab7d6b
9 changed files with 230 additions and 69 deletions

View File

@@ -40,6 +40,30 @@ const (
TypeDialogue MenuType = 300
)
// 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.
var DescOverrides = map[string]map[string]int{
"main": {
"2.6": 50992,
},
"newgame": {
"2.5": 50993,
},
"levelply": {
"2.6": 50996,
},
}
// FIXME: Same idea with text overrides, only these aren't mentioned in the .dta
// file at all!
var TextOverrides = map[string]map[string]string{
"main": {
"2.7": "0.1-ordoor",
},
}
type Record struct {
Menu *Menu
Parent *Record
@@ -56,8 +80,8 @@ type Record struct {
Y int
// From i18n
Text string
Help string
Text string
Help string
// FIXME: turn these into first-class data
properties map[string]string
@@ -239,13 +263,16 @@ type Replacer interface {
}
func (r *Record) Internationalize(replacer Replacer) {
// FIXME: I can't see how else this would happen in the original
if r.Menu.Name == "main" {
switch r.Path() {
case "2.6":
r.properties["DESC"] = "50992" // Chaos Gate
case "2.7":
r.Text = "ordoor-0.0.0"
if overrides, ok := TextOverrides[r.Menu.Name]; ok {
if override, ok := overrides[r.Path()]; ok {
delete(r.properties, "DESC")
r.Text = override
}
}
if overrides, ok := DescOverrides[r.Menu.Name]; ok {
if override, ok := overrides[r.Path()]; ok {
r.properties["DESC"] = strconv.Itoa(override)
}
}