2020-04-11 01:01:05 +01:00
|
|
|
package flow
|
|
|
|
|
2020-06-13 18:11:45 +01:00
|
|
|
import (
|
|
|
|
"code.ur.gs/lupine/ordoor/internal/maps"
|
|
|
|
)
|
|
|
|
|
2020-04-11 01:01:05 +01:00
|
|
|
// TODO: There are Chaos and Ultramarine versions of MainGame. Do we really want
|
|
|
|
// to duplicate everything for both?
|
|
|
|
|
|
|
|
func (f *Flow) linkMainGame() {
|
2020-04-19 18:49:14 +01:00
|
|
|
f.linkMainGameActionMenu()
|
|
|
|
f.linkMainGameInterfaceOptionsMenu()
|
2020-04-11 01:01:05 +01:00
|
|
|
// 5: Holding menu
|
2020-04-20 00:16:21 +01:00
|
|
|
f.linkMainGameViewMenu()
|
|
|
|
|
2020-04-11 01:01:05 +01:00
|
|
|
// 7: General character menu
|
2020-04-19 18:49:14 +01:00
|
|
|
f.onClick(mainGame, "7.4", func() { // More button
|
|
|
|
f.setActiveNow(mainGame, "7", false)
|
|
|
|
f.setActiveNow(mainGame, "8", true)
|
|
|
|
})
|
|
|
|
|
2020-04-11 01:01:05 +01:00
|
|
|
// 8: Character stats
|
2020-06-13 16:37:39 +01:00
|
|
|
f.onClick(mainGame, "8.21", func() { // Stat more buttons
|
2020-04-19 18:49:14 +01:00
|
|
|
f.setActiveNow(mainGame, "7", true)
|
|
|
|
f.setActiveNow(mainGame, "8", false)
|
|
|
|
})
|
|
|
|
|
2020-04-11 01:01:05 +01:00
|
|
|
// 9: Visible enemy menu
|
|
|
|
// 10: Friendly squad menu
|
|
|
|
// 11: Psyker spell dialogue
|
|
|
|
// 12: Inventory dialogue
|
2020-04-19 18:21:08 +01:00
|
|
|
f.onClick(mainGame, "12.21", f.hideDialogue(mainGame)) // Exit
|
2020-04-20 00:16:21 +01:00
|
|
|
|
2020-04-19 18:21:08 +01:00
|
|
|
// 13: exchange menu
|
2020-04-11 01:01:05 +01:00
|
|
|
|
|
|
|
// 14: Map
|
2020-04-19 18:21:08 +01:00
|
|
|
// 14.1: MAP_SPRITE
|
|
|
|
// 14.2: Multiplier button (2x)
|
|
|
|
f.onClick(mainGame, "14.3", f.setActive(mainGame, "14", false))
|
|
|
|
// 14.4: Area
|
2020-04-11 01:01:05 +01:00
|
|
|
|
2020-04-19 18:21:08 +01:00
|
|
|
// FIXME: the display of left and right interface buttons is hidden by these
|
|
|
|
// sprites, because we draw in strict numeric order. Just hide them for now.
|
|
|
|
//
|
|
|
|
// FIXME: The child element is already set to hidden, while the menu itself
|
|
|
|
// is set to active, so maybe this is a hint that menus shouldn't be drawn?
|
|
|
|
//
|
|
|
|
// FIXME: the approach taken by the original binary in resolutions greater
|
|
|
|
// than 640x480 is to draw the menu elements *unscaled*. They are centered,
|
|
|
|
// and the dead space is filled by the "interface wing" sprites in the
|
|
|
|
// background. Should we replicate this, or keep with the current scaling
|
|
|
|
// behaviour? Which is better?
|
|
|
|
f.exit = maybeErr(mainGame, f.setActiveNow(mainGame, "15", false)) // Interface wing left
|
|
|
|
f.exit = maybeErr(mainGame, f.setActiveNow(mainGame, "16", false)) // Interface wing right
|
2020-04-11 01:01:05 +01:00
|
|
|
// 17: Grenade dialogue
|
2020-04-19 18:49:14 +01:00
|
|
|
|
|
|
|
f.onClick(mainGame, "18.12", f.setActive(mainGame, "18", false)) // Info "dialogue"
|
|
|
|
|
2020-04-11 01:01:05 +01:00
|
|
|
// 19: Turn start dialogue
|
|
|
|
// 20: Chat menu
|
2020-04-19 18:49:14 +01:00
|
|
|
|
|
|
|
// Chat list menu box - active by default, hide it
|
|
|
|
f.exit = maybeErr(mainGame, f.setActiveNow(mainGame, "21", false))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *Flow) linkMainGameActionMenu() {
|
|
|
|
// 3: Action menu. These are mostly predicated on selected character state
|
|
|
|
// 3.1: Aimed shot
|
|
|
|
// 3.2: Shooting
|
|
|
|
// 3.3: Walk
|
|
|
|
// 3.4: Run
|
|
|
|
// 3.5: Crouch/Stand
|
|
|
|
// 3.6: Hand to hand (commented out)
|
|
|
|
// 3.7: Retrieve
|
|
|
|
// 3.8: Door
|
|
|
|
// 3.9: Switch
|
|
|
|
// 3.10: Overwatch
|
|
|
|
// 3.11: Rally/Formation
|
|
|
|
// 3.12: Board/Disembark
|
|
|
|
// FIXME: for now, this is "end scenario", for convenience
|
|
|
|
f.onClick(mainGame, "3.13", func() { // End turn button.
|
|
|
|
f.scenario = nil
|
|
|
|
f.returnToLastDriverNow(mainGame)
|
|
|
|
})
|
|
|
|
// 3.14: Special action heal
|
|
|
|
// 3.15: Special action techmarine
|
|
|
|
// 3.16: Special action jump pack
|
|
|
|
// 3.17: Special action spell
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *Flow) linkMainGameInterfaceOptionsMenu() {
|
|
|
|
// 4: Interface options menu
|
|
|
|
f.onClick(mainGame, "4.1", f.setReturningDriver(mainGame, options)) // Options button
|
2020-04-20 00:16:21 +01:00
|
|
|
|
|
|
|
// FIXME: map should be shown top-right, not top-left. We need to support 2x
|
|
|
|
// mode as well.
|
|
|
|
f.onClick(mainGame, "4.2", f.toggleActive(mainGame, "14")) // Map button
|
2020-04-19 18:49:14 +01:00
|
|
|
|
|
|
|
// FIXME: mission objectives should be shown top-left, not centered
|
|
|
|
f.onClick(mainGame, "4.3", f.toggleActive(mainGame, "18")) // Mission objectives
|
|
|
|
|
|
|
|
f.onClick(mainGame, "4.4", f.showDialogue(mainGame, "12")) // Inventory
|
|
|
|
// 4.5: Next man
|
|
|
|
// 4.6: Next enemy
|
|
|
|
// 4.7: Total enemy text
|
2020-04-11 01:01:05 +01:00
|
|
|
}
|
2020-04-20 00:16:21 +01:00
|
|
|
|
|
|
|
func (f *Flow) linkMainGameViewMenu() {
|
|
|
|
// FIXME: all these buttons should show current state as well as have an
|
|
|
|
// effect
|
|
|
|
f.onClick(mainGame, "6.1", f.withScenario(func() { // View 100%
|
|
|
|
f.scenario.Zoom = 1.0
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.2", f.withScenario(func() { // View 50%
|
|
|
|
f.scenario.Zoom = 0.5
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.3", f.withScenario(func() { // View 25%
|
|
|
|
f.scenario.Zoom = 0.25
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.4", f.withScenario(func() { // Z index up
|
|
|
|
f.scenario.ChangeZIdx(+1)
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.5", f.withScenario(func() { // Z index down
|
|
|
|
f.scenario.ChangeZIdx(-1)
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.6", f.withScenario(func() { // Z index 1
|
|
|
|
f.scenario.ZIdx = 0
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.7", f.withScenario(func() { // Z index 2
|
|
|
|
f.scenario.ZIdx = 1
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.8", f.withScenario(func() { // Z index 3
|
|
|
|
f.scenario.ZIdx = 2
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.9", f.withScenario(func() { // Z index 4
|
|
|
|
f.scenario.ZIdx = 3
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.10", f.withScenario(func() { // Z index 5
|
|
|
|
f.scenario.ZIdx = 4
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.11", f.withScenario(func() { // Z index 6
|
|
|
|
f.scenario.ZIdx = 5
|
|
|
|
}))
|
|
|
|
|
|
|
|
f.onClick(mainGame, "6.12", f.withScenario(func() { // Z index 7
|
|
|
|
f.scenario.ZIdx = 6
|
|
|
|
}))
|
|
|
|
|
|
|
|
}
|
2020-06-13 18:11:45 +01:00
|
|
|
|
|
|
|
func (f *Flow) maybeSetErr(next func() error) {
|
|
|
|
if f.exit != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
f.exit = next()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *Flow) selectedMainGameCharacter(chr *maps.Character) {
|
|
|
|
if chr == nil {
|
|
|
|
chr = &maps.Character{}
|
|
|
|
}
|
|
|
|
|
|
|
|
d := f.drivers[mainGame]
|
|
|
|
|
|
|
|
// 7.1 Portrait
|
|
|
|
f.maybeSetErr(func() error { return d.SetValue("7.2", chr.Name) }) // Name
|
|
|
|
// 7.3 doesn't exit
|
|
|
|
// 7.4 more button (ignore)
|
|
|
|
// 7.5 AP icon
|
|
|
|
// f.maybeSetErr(func() error { return d.SetValueInt("7.6", chr.ActionPoints)}) // AP meter
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("7.7", chr.ActionPoints) }) // AP value
|
|
|
|
// 7.8 armor icon
|
|
|
|
// 7.9 armor meter
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("7.10", chr.Armor) }) // armor value
|
|
|
|
// 7.11 health icon
|
|
|
|
// 7.12 health meter
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("7.13", chr.Health) }) // health value
|
|
|
|
// 7.14 action points status bar
|
|
|
|
// 7.15 armor status bar
|
|
|
|
// 7.16 health status bar
|
|
|
|
|
|
|
|
// 8.1 to 8.10 are hot spots
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.11", chr.ActionPoints) }) // AP
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.12", chr.Health) }) // Health
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.13", chr.Armor) }) // Armor
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.14", chr.BallisticSkill) }) // Ballistic Skill
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.15", chr.WeaponSkill) }) // Weapon Skill
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.16", chr.Strength) }) // Strength
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.17", chr.Toughness) }) // Toughness
|
|
|
|
// 8.18 Initiative
|
|
|
|
// 8.19 Attacks
|
|
|
|
f.maybeSetErr(func() error { return d.SetValueInt("8.20", chr.Leadership) }) // Leadership
|
|
|
|
}
|