format fixes

This commit is contained in:
2026-08-29 23:33:29 +02:00
parent 954bd762f7
commit 1fa19f0b2e
23 changed files with 335 additions and 147 deletions
-1
View File
@@ -33,7 +33,6 @@ func New(o Opts) *inkwell.Game {
func bootOpening(w *World, start string, finale bool) []inkwell.Action {
acts := []inkwell.Action{
EnterScene(w, start),
inkwell.SetFlag(FlagPoliceTip),
inkwell.Say(Paul, "Back alley. Just like the clerk said."),
TapeSay(Dex, "A government office tipped you off to remove something from a scene. That doesn't strike you as odd?"),
+4 -2
View File
@@ -10,8 +10,10 @@ func characterPaul() inkwell.Character {
Speed: 96,
W: 28,
H: 68,
Start: inkwell.Point{X: 120, Y: 232},
Start: inkwell.Point{
X: 120,
Y: 232,
},
SpeechColor: Ink,
}
}
+4 -1
View File
@@ -10,7 +10,10 @@ func dialogDexTalk() inkwell.Dialogue {
Start: "root",
Nodes: []inkwell.DialogueNode{{
Name: "root",
Lines: []inkwell.DialogueLine{{Speaker: Dex, Text: "Talk."}},
Lines: []inkwell.DialogueLine{{
Speaker: Dex,
Text: "Talk.",
}},
Choices: []inkwell.DialogueChoice{
{
Text: "What am I doing here, Dex?",
+4 -1
View File
@@ -10,7 +10,10 @@ func dialogMysteryTapeSilent() inkwell.Dialogue {
Start: "root",
Nodes: []inkwell.DialogueNode{{
Name: "root",
Lines: []inkwell.DialogueLine{{Speaker: Dex, Text: "Nothing. Warm, spinning, and silent."}},
Lines: []inkwell.DialogueLine{{
Speaker: Dex,
Text: "Nothing. Warm, spinning, and silent.",
}},
Choices: []inkwell.DialogueChoice{
{
Text: "Are you sure it works?",
-1
View File
@@ -13,7 +13,6 @@ func itemBlackMarketArmilla() inkwell.Item {
TapeSay(Dex, "Two slots, and both of them lie about the temperature. Don't trade me in for it."),
),
OnUseWith: map[string]inkwell.Action{
ItemNoodleLetter: inkwell.Seq(
inkwell.Say(Paul, "A letter and a bracelet. Brilliant."),
TapeSay(Dex, "Nothing. Which is what I'd charge for it."),
+12 -4
View File
@@ -10,11 +10,20 @@ func screenAlley() screen {
title: "ALLEY — BEHIND NOODLE'S HOUSE",
background: BgAlley,
exits: []exit{
{to: ScreenNoodleHouse, label: "back out to the street", side: sideLeft},
{
to: ScreenNoodleHouse,
label: "back out to the street",
side: sideLeft,
},
},
actors: []inkwell.SceneActor{
{CharacterName: Paul, At: inkwell.Point{X: 120, Y: 232}},
{
CharacterName: Paul,
At: inkwell.Point{
X: 120,
Y: 232,
},
},
},
onEnter: setVarIfEmpty(VarArmillaStrip, "SRP: 1 tape"),
hotspots: []inkwell.Hotspot{hidingPlace(), backDoor(), bin(), fireEscape()},
@@ -59,7 +68,6 @@ func backDoor() inkwell.Hotspot {
),
OnTalk: inkwell.Say(Paul, "To the door? I'm not there yet."),
OnUseWith: map[string]inkwell.Action{
ItemBlackArmilla: inkwell.Seq(
inkwell.Say(Paul, "A black-market bracelet doesn't open a keypad."),
TapeSay(Dex, "But you do get an advert out of it."),
+4 -1
View File
@@ -6,7 +6,10 @@ func screenBbsTerminal() screen {
title: "TERMINAL — BBS ACCESS POINT",
background: BgBBSTerminal,
exits: []exit{
{label: "step back from the terminal", side: sideNear},
{
label: "step back from the terminal",
side: sideNear,
},
},
}
}
+5 -1
View File
@@ -38,7 +38,11 @@ type exit struct {
}
func toSelector() exit {
return exit{to: ScreenSelector, label: "the rest of the city", side: sideNear}
return exit{
to: ScreenSelector,
label: "the rest of the city",
side: sideNear,
}
}
func exitName(to string) string {
+21 -3
View File
@@ -57,8 +57,20 @@ func registerScreen(w *World) {
var screenFloor = []inkwell.Polygon{
inkwell.Poly(
inkwell.Point{X: 16, Y: 196}, inkwell.Point{X: 624, Y: 196},
inkwell.Point{X: 624, Y: 258}, inkwell.Point{X: 16, Y: 258},
inkwell.Point{
X: 16,
Y: 196,
}, inkwell.Point{
X: 624,
Y: 196,
},
inkwell.Point{
X: 624,
Y: 258,
}, inkwell.Point{
X: 16,
Y: 258,
},
),
}
@@ -76,7 +88,13 @@ func screenBuild(w *World, s screen) inkwell.Scene {
actors := s.actors
if actors == nil {
actors = []inkwell.SceneActor{
{CharacterName: Paul, At: inkwell.Point{X: 320, Y: 232}},
{
CharacterName: Paul,
At: inkwell.Point{
X: 320,
Y: 232,
},
},
}
}
walkboxes := s.walkboxes
+5 -1
View File
@@ -7,7 +7,11 @@ func screenNoodleHouse() screen {
background: BgNoodleHouse,
onSelector: true,
exits: []exit{
{to: ScreenAlley, label: "the alley behind the house", side: sideRight},
{
to: ScreenAlley,
label: "the alley behind the house",
side: sideRight,
},
},
}
}
+10 -2
View File
@@ -7,8 +7,16 @@ func screenNormanApartment() screen {
background: BgNormanApartment,
onSelector: true,
exits: []exit{
{to: ScreenRooftopHideout, label: "the stairs up to the roof", side: sideBack},
{to: ScreenBBSTerminal, label: "Norman's terminal", side: sideRight},
{
to: ScreenRooftopHideout,
label: "the stairs up to the roof",
side: sideBack,
},
{
to: ScreenBBSTerminal,
label: "Norman's terminal",
side: sideRight,
},
},
}
}
+5 -1
View File
@@ -6,7 +6,11 @@ func screenPaulShop() screen {
title: "PAUL'S SHOP — JUNK AND GARAGE",
background: BgPaulShop,
exits: []exit{
{to: ScreenNoodleHouse, label: "the bus to San Francisco", side: sideNear},
{
to: ScreenNoodleHouse,
label: "the bus to San Francisco",
side: sideNear,
},
},
}
}
+10 -2
View File
@@ -6,8 +6,16 @@ func screenRooftopHideout() screen {
title: "NORMAN'S ROOFTOP HIDEOUT",
background: BgRooftopHideout,
exits: []exit{
{to: ScreenNormanApartment, label: "back down into the flat", side: sideNear},
{to: ScreenBBSTerminal, label: "the old terminal", side: sideRight},
{
to: ScreenNormanApartment,
label: "back down into the flat",
side: sideNear,
},
{
to: ScreenBBSTerminal,
label: "the old terminal",
side: sideRight,
},
},
}
}
+10 -2
View File
@@ -6,8 +6,16 @@ func screenSecretClub() screen {
title: "SECRET CLUB — THE UNDERWATER SUN",
background: BgSecretClub,
exits: []exit{
{to: ScreenBBSTerminal, label: "the terminal in the corner", side: sideBack},
{to: ScreenTrinketShop, label: "back out through the shop", side: sideNear},
{
to: ScreenBBSTerminal,
label: "the terminal in the corner",
side: sideBack,
},
{
to: ScreenTrinketShop,
label: "back out through the shop",
side: sideNear,
},
},
}
}
-1
View File
@@ -23,7 +23,6 @@ func screenSelector(rest []screen) screen {
title: "SAN FRANCISCO",
background: BgSelector,
exits: exits,
actors: []inkwell.SceneActor{},
walkboxes: []inkwell.Polygon{},
}
+5 -1
View File
@@ -6,7 +6,11 @@ func screenSmallRestaurant() screen {
title: "SMALL RESTAURANT — NEXT DOOR",
background: BgSmallRestaurant,
exits: []exit{
{to: ScreenTrinketShop, label: "back to the trinket shop", side: sideLeft},
{
to: ScreenTrinketShop,
label: "back to the trinket shop",
side: sideLeft,
},
},
}
}
+8 -2
View File
@@ -7,9 +7,15 @@ func screenTrinketShop() screen {
background: BgTrinketShop,
onSelector: true,
exits: []exit{
{to: ScreenSmallRestaurant, label: "the eating place next door", side: sideRight},
{
to: ScreenSecretClub, label: "the way in at the back", side: sideBack,
to: ScreenSmallRestaurant,
label: "the eating place next door",
side: sideRight,
},
{
to: ScreenSecretClub,
label: "the way in at the back",
side: sideBack,
needs: FlagClubEntry,
blocked: "Just a shop, as far as the man behind the counter is concerned.",
},
+12 -20
View File
@@ -12,11 +12,21 @@ const (
)
func RGB(hex uint32) color.Color {
return color.RGBA{R: uint8(hex >> 16), G: uint8(hex >> 8), B: uint8(hex), A: 0xff}
return color.RGBA{
R: uint8(hex >> 16),
G: uint8(hex >> 8),
B: uint8(hex),
A: 0xff,
}
}
func RGBA(hex uint32, a uint8) color.Color {
return color.RGBA{R: uint8(hex >> 16), G: uint8(hex >> 8), B: uint8(hex), A: a}
return color.RGBA{
R: uint8(hex >> 16),
G: uint8(hex >> 8),
B: uint8(hex),
A: a,
}
}
var (
@@ -35,40 +45,31 @@ func realWorldTheme() inkwell.Theme {
PanelBG: black,
StatusText: Ink,
FlashText: Amber,
VerbButtonBG: RGB(0x1E1A14),
VerbButtonSelectedBG: AmberLo,
VerbButtonText: Ink,
InventorySlotBG: RGB(0x1E1A14),
InventorySlotSelectedBG: AmberLo,
SpeechBubbleBG: RGBA(0x14120E, 0xDC),
SpeechDefaultText: Ink,
DialogBG: RGBA(0x0D0B08, 0xF0),
DialogBorder: AmberLo,
DialogChoiceBG: RGB(0x1E1A14),
DialogChoiceHover: Amber,
DialogSpeaker: Amber,
DialogText: Ink,
EndCardBG: RGBA(0x000000, 0xFA),
EndCardText: Ink,
CursorColor: Amber,
HotspotOutline: RGB(0x7A6A44),
SceneBackdrop: sceneBG,
TopBarBG: panel,
TopBarText: InkDim,
TopBarAccent: Amber,
ChatLogBG: panel,
ChatLogPrompt: InkDim,
ChatLogResponse: Amber,
ChatLogSystem: RGB(0x6B6353),
CharacterPanelBG: panel,
CharacterPanelBorder: AmberLo,
CharacterPanelTitle: Amber,
@@ -87,40 +88,31 @@ func nokiaPunkTheme() inkwell.Theme {
PanelBG: npBlack,
StatusText: Green,
FlashText: RGB(0xD8F06A),
VerbButtonBG: RGB(0x08140A),
VerbButtonSelectedBG: GreenLo,
VerbButtonText: Green,
InventorySlotBG: RGB(0x08140A),
InventorySlotSelectedBG: GreenLo,
SpeechBubbleBG: RGBA(0x030603, 0xDC),
SpeechDefaultText: Green,
DialogBG: RGBA(0x030603, 0xF0),
DialogBorder: Green,
DialogChoiceBG: RGB(0x08140A),
DialogChoiceHover: RGB(0xB4FFC8),
DialogSpeaker: RGB(0xB4FFC8),
DialogText: Green,
EndCardBG: RGBA(0x000000, 0xFA),
EndCardText: Green,
CursorColor: Green,
HotspotOutline: GreenLo,
SceneBackdrop: npBlack,
TopBarBG: RGB(0x061006),
TopBarText: GreenLo,
TopBarAccent: Green,
ChatLogBG: RGB(0x040A04),
ChatLogPrompt: GreenLo,
ChatLogResponse: Green,
ChatLogSystem: RGB(0x156030),
CharacterPanelBG: RGB(0x040A04),
CharacterPanelBorder: Green,
CharacterPanelTitle: RGB(0xB4FFC8),
+68 -20
View File
@@ -30,57 +30,101 @@ const (
func registerUI(w *World) {
g := w.G
g.UIManager.Register(&UseWithGuard{Name: "usewith_guard", W: w})
g.UIManager.Register(&ActionPump{Name: "pump", W: w})
g.UIManager.Register(&screenNav{Name: "screen_nav", W: w})
g.UIManager.Register(&windowSizer{Name: "window", Scale: 2})
g.UIManager.Register(&inkwell.HotspotDebug{Name: "hotspot_debug"})
g.UIManager.Register(&UseWithGuard{
Name: "usewith_guard",
W: w,
})
g.UIManager.Register(&ActionPump{
Name: "pump",
W: w,
})
g.UIManager.Register(&screenNav{
Name: "screen_nav",
W: w,
})
g.UIManager.Register(&windowSizer{
Name: "window",
Scale: 2,
})
g.UIManager.Register(&inkwell.HotspotDebug{
Name: "hotspot_debug",
})
top := &inkwell.TopBar{
Name: "topbar",
Height: TopBarH,
TimeVar: VarArmillaStrip,
}
w.SetTopBar(top)
g.UIManager.Register(gated(w, "topbar_gate", top))
g.UIManager.Register(&Letterbox{Name: "letterbox", W: w, Bar: 36})
g.UIManager.Register(&hudFrame{Name: "hudframe", W: w})
g.UIManager.Register(&Letterbox{
Name: "letterbox",
W: w,
Bar: 36,
})
g.UIManager.Register(&hudFrame{
Name: "hudframe",
W: w,
})
g.UIManager.Register(gated(w, "status_gate", &inkwell.StatusLine{
Name: "status", Y: statusY, Align: inkwell.AlignLeft, ScreenWidth: DividerX,
Name: "status",
Y: statusY,
Align: inkwell.AlignLeft,
ScreenWidth: DividerX,
}))
g.UIManager.Register(gated(w, "inventory_gate", &inkwell.InventoryBar{
Name: "inventory", Origin: inkwell.Point{X: Pad + 2, Y: invY},
Slots: 8, Cols: 4, SlotSize: invSlot, Gap: invGap,
Name: "inventory",
Origin: inkwell.Point{
X: Pad + 2,
Y: invY,
},
Slots: 8,
Cols: 4,
SlotSize: invSlot,
Gap: invGap,
}))
g.UIManager.Register(&TapeSlots{
Name: "tapes", W: w,
Name: "tapes",
W: w,
Bounds: inkwell.Rect(192, slotsY, 194, slotsH),
})
g.UIManager.Register(&TapeChannel{
Name: "channel", W: w,
Name: "channel",
W: w,
Bounds: inkwell.Rect(DividerX+2, HUDTop+2, ScreenW-DividerX-4, ScreenH-HUDTop-4),
})
g.UIManager.Register(&inkwell.SpeechBubble{
Name: "speech", MaxWidth: 360, Padding: Pad, OffsetY: 8, FallbackY: TopBarH + Pad,
Name: "speech",
MaxWidth: 360,
Padding: Pad,
OffsetY: 8,
FallbackY: TopBarH + Pad,
})
g.UIManager.Register(&inkwell.DialogBox{
Name: "dialog", Bounds: inkwell.Rect(0, ScreenH-LineH*9, DividerX, LineH*9),
LineHeight: LineH, Padding: Pad,
Name: "dialog",
Bounds: inkwell.Rect(0, ScreenH-LineH*9, DividerX, LineH*9),
LineHeight: LineH,
Padding: Pad,
})
g.UIManager.Register(&inkwell.RadialVerbs{
Name: "verbs", Trigger: inkwell.MouseButtonRight, Radius: 58,
Name: "verbs",
Trigger: inkwell.MouseButtonRight,
Radius: 58,
Labels: map[string]string{
"look": "Look", "use": "Use", "talk": "Talk", "take": "Take",
},
})
g.UIManager.Register(&inkwell.EndCard{Name: "endcard"})
g.UIManager.Register(&inkwell.Cursor{Name: "cursor"})
g.UIManager.Register(&inkwell.EndCard{
Name: "endcard",
})
g.UIManager.Register(&inkwell.Cursor{
Name: "cursor",
})
}
type windowSizer struct {
@@ -111,7 +155,11 @@ type gate struct {
}
func gated(w *World, name string, inner inkwell.Widget) inkwell.Widget {
return &gate{Name: name, W: w, Inner: inner}
return &gate{
Name: name,
W: w,
Inner: inner,
}
}
func (n *gate) GetName() string { return n.Name }
+43 -5
View File
@@ -9,19 +9,57 @@ import (
func TestScreenNavWrapsBothWays(t *testing.T) {
g := inkwell.NewGame("t", ScreenW, ScreenH)
for _, n := range []string{"a", "b", "c"} {
g.SceneManager.Register(inkwell.Scene{Name: n, Background: "bg"})
g.SceneManager.Register(inkwell.Scene{
Name: n,
Background: "bg",
})
}
w := newWorld(g)
nav := &screenNav{Name: "screen_nav", W: w}
at := func(name string) { EnterScene(w, name).Start().Tick(&inkwell.Ctx{Game: g}) }
nav := &screenNav{
Name: "screen_nav",
W: w,
}
at := func(name string) {
EnterScene(w, name).Start().Tick(&inkwell.Ctx{
Game: g,
})
}
for _, tc := range []struct {
from string
step int
want string
}{
{"a", 1, "b"}, {"b", 1, "c"}, {"c", 1, "a"},
{"c", -1, "b"}, {"b", -1, "a"}, {"a", -1, "c"},
{
from: "a",
step: 1,
want: "b",
},
{
from: "b",
step: 1,
want: "c",
},
{
from: "c",
step: 1,
want: "a",
},
{
from: "c",
step: -1,
want: "b",
},
{
from: "b",
step: -1,
want: "a",
},
{
from: "a",
step: -1,
want: "c",
},
} {
at(tc.from)
if got := nav.neighbour(g, tc.step); got != tc.want {
+4 -1
View File
@@ -64,7 +64,10 @@ func (t *TapeChannel) Draw(dst *ebiten.Image, ctx *inkwell.UICtx) {
col, txt = th.ChatLogSystem, m.Text
}
for _, wl := range wrap(txt, wrapW) {
rendered = append(rendered, line{text: wl, col: col})
rendered = append(rendered, line{
text: wl,
col: col,
})
}
}
+31 -7
View File
@@ -28,7 +28,10 @@ func (w *World) PumpTick(dt float64) {
w.running = w.queue[0].Start()
w.queue = w.queue[1:]
}
ctx := &inkwell.Ctx{Game: w.G, DT: dt}
ctx := &inkwell.Ctx{
Game: w.G,
DT: dt,
}
if s, ok := w.G.SceneManager.Get(w.scene); ok {
ctx.Scene = &s
}
@@ -59,7 +62,11 @@ func (p *ActionPump) Draw(dst *ebiten.Image, ctx *inkwell.UICtx) {}
type fnAction struct{ fn func(*inkwell.Ctx) }
func (a *fnAction) Start() inkwell.Runner { return &fnRunner{spec: a} }
func (a *fnAction) Start() inkwell.Runner {
return &fnRunner{
spec: a,
}
}
type fnRunner struct{ spec *fnAction }
@@ -68,7 +75,11 @@ func (r *fnRunner) Tick(ctx *inkwell.Ctx) inkwell.Status {
return inkwell.StatusDone
}
func Fn(f func(*inkwell.Ctx)) inkwell.Action { return &fnAction{fn: f} }
func Fn(f func(*inkwell.Ctx)) inkwell.Action {
return &fnAction{
fn: f,
}
}
func UseTheme(name string) inkwell.Action {
return Fn(func(ctx *inkwell.Ctx) { ctx.Game.UseTheme(name) })
@@ -97,12 +108,19 @@ func Back(w *World) inkwell.Action {
}
func TapeSay(speaker, text string) inkwell.Action {
return &tapeSayAction{speaker: speaker, text: text}
return &tapeSayAction{
speaker: speaker,
text: text,
}
}
type tapeSayAction struct{ speaker, text string }
func (a *tapeSayAction) Start() inkwell.Runner { return &tapeSayRunner{spec: a} }
func (a *tapeSayAction) Start() inkwell.Runner {
return &tapeSayRunner{
spec: a,
}
}
type tapeSayRunner struct {
spec *tapeSayAction
@@ -143,7 +161,10 @@ func (w *World) TakeTapeOffer() {
}
func Paused(w *World, inner inkwell.Action) inkwell.Action {
return &pausedAction{w: w, inner: inner}
return &pausedAction{
w: w,
inner: inner,
}
}
type pausedAction struct {
@@ -152,7 +173,10 @@ type pausedAction struct {
}
func (a *pausedAction) Start() inkwell.Runner {
return &pausedRunner{spec: a, inner: a.inner.Start()}
return &pausedRunner{
spec: a,
inner: a.inner.Start(),
}
}
type pausedRunner struct {
+4 -1
View File
@@ -30,7 +30,10 @@ type World struct {
}
func newWorld(g *inkwell.Game) *World {
return &World{G: g, mode: ModePlay}
return &World{
G: g,
mode: ModePlay,
}
}
func (w *World) Mode() Mode { return w.mode }