+10
-4
@@ -5,18 +5,25 @@ import (
|
||||
)
|
||||
|
||||
type Opts struct {
|
||||
Screen string
|
||||
Scene string
|
||||
Finale bool
|
||||
}
|
||||
|
||||
func New(o Opts) *inkwell.Game {
|
||||
start := o.Screen
|
||||
start := o.Scene
|
||||
if start == "" {
|
||||
start = ScreenAlley
|
||||
start = SceneAlley
|
||||
}
|
||||
|
||||
g := inkwell.NewGame("Real World", ScreenW, ScreenH)
|
||||
g.MaxLogLines = 64
|
||||
g.SceneRect = inkwell.Rect(0, TopBarH, ScreenW, HUDTop-TopBarH)
|
||||
g.ExitLook = func(e inkwell.Exit) inkwell.Action {
|
||||
return inkwell.Say(Paul, "That way: "+e.Label+".")
|
||||
}
|
||||
g.ExitTake = func(inkwell.Exit) inkwell.Action {
|
||||
return inkwell.Say(Paul, "It's a way out, not a thing.")
|
||||
}
|
||||
|
||||
World.attach(g)
|
||||
registerTheme()
|
||||
@@ -32,7 +39,6 @@ func New(o Opts) *inkwell.Game {
|
||||
|
||||
func bootOpening(start string, finale bool) []inkwell.Action {
|
||||
acts := []inkwell.Action{
|
||||
EnterScene(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?"),
|
||||
|
||||
@@ -6,5 +6,5 @@ func registerContent() {
|
||||
registerAll(ItemManager, World.G.ItemManager.Register)
|
||||
registerAll(DialogManager, World.G.DialogueManager.Register)
|
||||
registerAll(ScriptManager, World.G.ScriptManager.Register)
|
||||
registerScreen()
|
||||
registerScene()
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ var (
|
||||
_ ManagerInterface[Dialog] = DialogManager
|
||||
_ ManagerInterface[Item] = ItemManager
|
||||
_ ManagerInterface[Script] = ScriptManager
|
||||
_ ManagerInterface[Screen] = ScreenManager
|
||||
_ ManagerInterface[Scene] = SceneManager
|
||||
_ ManagerInterface[Theme] = ThemeManager
|
||||
)
|
||||
|
||||
+24
-24
@@ -36,30 +36,30 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
ScreenSelector = "selector"
|
||||
ScreenPaulShop = "paul_shop"
|
||||
ScreenNoodleHouse = "noodle_house"
|
||||
ScreenNormanApartment = "norman_apartment"
|
||||
ScreenPoliceStation = "police_station"
|
||||
ScreenAlley = "alley"
|
||||
ScreenHackerspace = "hackerspace"
|
||||
ScreenIceCreamShop = "ice_cream_shop"
|
||||
ScreenTrinketShop = "trinket_shop"
|
||||
ScreenSmallRestaurant = "small_restaurant"
|
||||
ScreenSecretClub = "secret_club"
|
||||
ScreenBBSTerminal = "bbs_terminal"
|
||||
ScreenStreet = "street"
|
||||
ScreenHospital = "hospital"
|
||||
ScreenServerFarm = "server_farm"
|
||||
ScreenSecretLab = "secret_lab"
|
||||
ScreenRooftopHideout = "rooftop_hideout"
|
||||
ScreenPublicBBS = "public_bbs"
|
||||
ScreenBVKBranch = "bvk_branch"
|
||||
ScreenCuratorShop = "curator_shop"
|
||||
ScreenScrapMarket = "scrap_market"
|
||||
ScreenSamizdatPress = "samizdat_press"
|
||||
ScreenShowroom = "showroom"
|
||||
ScreenColumbarium = "columbarium"
|
||||
SceneSelector = "selector"
|
||||
ScenePaulShop = "paul_shop"
|
||||
SceneNoodleHouse = "noodle_house"
|
||||
SceneNormanApartment = "norman_apartment"
|
||||
ScenePoliceStation = "police_station"
|
||||
SceneAlley = "alley"
|
||||
SceneHackerspace = "hackerspace"
|
||||
SceneIceCreamShop = "ice_cream_shop"
|
||||
SceneTrinketShop = "trinket_shop"
|
||||
SceneSmallRestaurant = "small_restaurant"
|
||||
SceneSecretClub = "secret_club"
|
||||
SceneBBSTerminal = "bbs_terminal"
|
||||
SceneStreet = "street"
|
||||
SceneHospital = "hospital"
|
||||
SceneServerFarm = "server_farm"
|
||||
SceneSecretLab = "secret_lab"
|
||||
SceneRooftopHideout = "rooftop_hideout"
|
||||
ScenePublicBBS = "public_bbs"
|
||||
SceneBVKBranch = "bvk_branch"
|
||||
SceneCuratorShop = "curator_shop"
|
||||
SceneScrapMarket = "scrap_market"
|
||||
SceneSamizdatPress = "samizdat_press"
|
||||
SceneShowroom = "showroom"
|
||||
SceneColumbarium = "columbarium"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -5,15 +5,15 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenAlley,
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneAlley,
|
||||
Title: "ALLEY — BEHIND NOODLE'S HOUSE",
|
||||
Background: BgAlley,
|
||||
Exits: []exit{
|
||||
Exits: []inkwell.Exit{
|
||||
{
|
||||
to: ScreenNoodleHouse,
|
||||
label: "back out to the street",
|
||||
side: sideLeft,
|
||||
To: SceneNoodleHouse,
|
||||
Label: "back out to the street",
|
||||
Side: inkwell.ExitLeft,
|
||||
},
|
||||
},
|
||||
Actors: []inkwell.SceneActor{
|
||||
@@ -0,0 +1,19 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneBBSTerminal,
|
||||
Title: "TERMINAL — BBS ACCESS POINT",
|
||||
Background: BgBBSTerminal,
|
||||
Exits: []inkwell.Exit{
|
||||
{
|
||||
Label: "step back from the terminal",
|
||||
Side: inkwell.ExitNear,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneBVKBranch,
|
||||
Title: "BVK — SAN FRANCISCO BRANCH",
|
||||
Background: BgBVKBranch,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneColumbarium,
|
||||
Title: "COLUMBARIUM — DEX'S MEMORIAL",
|
||||
Background: BgColumbarium,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneCuratorShop,
|
||||
Title: "CURATOR SERVICE — THE MASTER'S WORKSHOP",
|
||||
Background: BgCuratorShop,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneHackerspace,
|
||||
Title: "HACKERSPACE",
|
||||
Background: BgHackerspace,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneHospital,
|
||||
Title: "HOSPITAL — PSYCHIATRIC WING",
|
||||
Background: BgHospital,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneIceCreamShop,
|
||||
Title: "ICE CREAM SHOP — WHERE THE BAR WAS",
|
||||
Background: BgIceCreamShop,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
type Scene = inkwell.Scene
|
||||
|
||||
var SceneManager = NewManager(func(entity Scene) string { return entity.Name })
|
||||
|
||||
func registerScene() {
|
||||
fillSelectorPins()
|
||||
registerAll(SceneManager, func(entity Scene) {
|
||||
World.G.SceneManager.Register(sceneDefaults(entity))
|
||||
})
|
||||
}
|
||||
|
||||
var sceneFloor = []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,
|
||||
},
|
||||
),
|
||||
}
|
||||
|
||||
func sceneDefaults(s Scene) Scene {
|
||||
if s.Actors == nil {
|
||||
s.Actors = []inkwell.SceneActor{
|
||||
{
|
||||
CharacterName: Paul,
|
||||
At: inkwell.Point{
|
||||
X: 320,
|
||||
Y: 232,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
if s.Walkboxes == nil {
|
||||
s.Walkboxes = sceneFloor
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func setVarIfEmpty(name string, v any) inkwell.Action {
|
||||
return Fn(func(ctx *inkwell.Ctx) {
|
||||
if ctx.Game.State.Var(name) == nil {
|
||||
ctx.Game.State.SetVar(name, v)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneNoodleHouse,
|
||||
Title: "NOODLE'S HOUSE — SEALED",
|
||||
Background: BgNoodleHouse,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
{
|
||||
To: SceneAlley,
|
||||
Label: "the alley behind the house",
|
||||
Side: inkwell.ExitRight,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneNormanApartment,
|
||||
Title: "NORMAN'S APARTMENT",
|
||||
Background: BgNormanApartment,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
{
|
||||
To: SceneRooftopHideout,
|
||||
Label: "the stairs up to the roof",
|
||||
Side: inkwell.ExitBack,
|
||||
},
|
||||
{
|
||||
To: SceneBBSTerminal,
|
||||
Label: "Norman's terminal",
|
||||
Side: inkwell.ExitRight,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: ScenePaulShop,
|
||||
Title: "PAUL'S SHOP — JUNK AND GARAGE",
|
||||
Background: BgPaulShop,
|
||||
Exits: []inkwell.Exit{
|
||||
{
|
||||
To: SceneNoodleHouse,
|
||||
Label: "the bus to San Francisco",
|
||||
Side: inkwell.ExitNear,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: ScenePoliceStation,
|
||||
Title: "SFPD — STATION AND HOLDING",
|
||||
Background: BgPoliceStation,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: ScenePublicBBS,
|
||||
Title: "PUBLIC BBS TERMINAL",
|
||||
Background: BgPublicBBS,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneRooftopHideout,
|
||||
Title: "NORMAN'S ROOFTOP HIDEOUT",
|
||||
Background: BgRooftopHideout,
|
||||
Exits: []inkwell.Exit{
|
||||
{
|
||||
To: SceneNormanApartment,
|
||||
Label: "back down into the flat",
|
||||
Side: inkwell.ExitNear,
|
||||
},
|
||||
{
|
||||
To: SceneBBSTerminal,
|
||||
Label: "the old terminal",
|
||||
Side: inkwell.ExitRight,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneSamizdatPress,
|
||||
Title: "SAMIZDAT PRINTING HOUSE",
|
||||
Background: BgSamizdatPress,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneScrapMarket,
|
||||
Title: "SCRAP MARKET",
|
||||
Background: BgScrapMarket,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneSecretClub,
|
||||
Title: "SECRET CLUB — THE UNDERWATER SUN",
|
||||
Background: BgSecretClub,
|
||||
Exits: []inkwell.Exit{
|
||||
{
|
||||
To: SceneBBSTerminal,
|
||||
Label: "the terminal in the corner",
|
||||
Side: inkwell.ExitBack,
|
||||
},
|
||||
{
|
||||
To: SceneTrinketShop,
|
||||
Label: "back out through the shop",
|
||||
Side: inkwell.ExitNear,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneSecretLab,
|
||||
Title: "SECRET RESEARCH LABORATORY",
|
||||
Background: BgSecretLab,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -6,9 +6,15 @@ import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
var exitToSelector = inkwell.Exit{
|
||||
To: SceneSelector,
|
||||
Label: "the rest of the city",
|
||||
Side: inkwell.ExitNear,
|
||||
}
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenSelector,
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneSelector,
|
||||
Title: "SAN FRANCISCO",
|
||||
Background: BgSelector,
|
||||
Actors: []inkwell.SceneActor{},
|
||||
@@ -17,23 +23,32 @@ func init() {
|
||||
}
|
||||
|
||||
func fillSelectorPins() {
|
||||
selector, ok := ScreenManager.GetByName(ScreenSelector)
|
||||
selector, ok := SceneManager.GetByName(SceneSelector)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
var exits []exit
|
||||
for _, entity := range ScreenManager.GetAll() {
|
||||
if !entity.OnSelector {
|
||||
var exits []inkwell.Exit
|
||||
for _, entity := range SceneManager.GetAll() {
|
||||
if !leadsToSelector(entity) {
|
||||
continue
|
||||
}
|
||||
exits = append(exits, exit{
|
||||
to: entity.Name,
|
||||
label: pinLabel(entity.Title),
|
||||
area: pin(len(exits)),
|
||||
exits = append(exits, inkwell.Exit{
|
||||
To: entity.Name,
|
||||
Label: pinLabel(entity.Title),
|
||||
Area: pin(len(exits)),
|
||||
})
|
||||
}
|
||||
selector.Exits = exits
|
||||
ScreenManager.Register(selector)
|
||||
SceneManager.Register(selector)
|
||||
}
|
||||
|
||||
func leadsToSelector(s Scene) bool {
|
||||
for _, e := range s.Exits {
|
||||
if e.To == SceneSelector {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneServerFarm,
|
||||
Title: "SERVER FARM",
|
||||
Background: BgServerFarm,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneShowroom,
|
||||
Title: "NEUMATRONIC SHOWROOM",
|
||||
Background: BgShowroom,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneSmallRestaurant,
|
||||
Title: "SMALL RESTAURANT — NEXT DOOR",
|
||||
Background: BgSmallRestaurant,
|
||||
Exits: []inkwell.Exit{
|
||||
{
|
||||
To: SceneTrinketShop,
|
||||
Label: "back to the trinket shop",
|
||||
Side: inkwell.ExitLeft,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneStreet,
|
||||
Title: "STREET",
|
||||
Background: BgStreet,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SceneManager.Register(Scene{
|
||||
Name: SceneTrinketShop,
|
||||
Title: "CHINATOWN — TRINKET SHOP",
|
||||
Background: BgTrinketShop,
|
||||
Exits: []inkwell.Exit{
|
||||
exitToSelector,
|
||||
{
|
||||
To: SceneSmallRestaurant,
|
||||
Label: "the eating place next door",
|
||||
Side: inkwell.ExitRight,
|
||||
},
|
||||
{
|
||||
To: SceneSecretClub,
|
||||
Label: "the way in at the back",
|
||||
Side: inkwell.ExitBack,
|
||||
Needs: FlagClubEntry,
|
||||
Blocked: inkwell.Say(Paul, "Just a shop, as far as the man behind the counter is concerned."),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenBBSTerminal,
|
||||
Title: "TERMINAL — BBS ACCESS POINT",
|
||||
Background: BgBBSTerminal,
|
||||
Exits: []exit{
|
||||
{
|
||||
label: "step back from the terminal",
|
||||
side: sideNear,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenBVKBranch,
|
||||
Title: "BVK — SAN FRANCISCO BRANCH",
|
||||
Background: BgBVKBranch,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenColumbarium,
|
||||
Title: "COLUMBARIUM — DEX'S MEMORIAL",
|
||||
Background: BgColumbarium,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenCuratorShop,
|
||||
Title: "CURATOR SERVICE — THE MASTER'S WORKSHOP",
|
||||
Background: BgCuratorShop,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
type side int
|
||||
|
||||
const (
|
||||
sideLeft side = iota
|
||||
sideRight
|
||||
sideBack
|
||||
sideNear
|
||||
)
|
||||
|
||||
func (s side) area() inkwell.Shape {
|
||||
switch s {
|
||||
case sideLeft:
|
||||
return inkwell.Rect(0, 40, 56, 212)
|
||||
case sideRight:
|
||||
return inkwell.Rect(584, 40, 56, 212)
|
||||
case sideBack:
|
||||
return inkwell.Rect(232, 28, 176, 84)
|
||||
default:
|
||||
return inkwell.Rect(232, 214, 176, 48)
|
||||
}
|
||||
}
|
||||
|
||||
type exit struct {
|
||||
to string
|
||||
label string
|
||||
side side
|
||||
|
||||
area inkwell.Shape
|
||||
|
||||
needs string
|
||||
blocked string
|
||||
}
|
||||
|
||||
func toSelector() exit {
|
||||
return exit{
|
||||
to: ScreenSelector,
|
||||
label: "the rest of the city",
|
||||
side: sideNear,
|
||||
}
|
||||
}
|
||||
|
||||
func exitName(to string) string {
|
||||
if to == "" {
|
||||
return "exit:back"
|
||||
}
|
||||
return "exit:" + to
|
||||
}
|
||||
|
||||
func (e exit) hotspot() inkwell.Hotspot {
|
||||
var travel inkwell.Action = inkwell.GoTo(e.to)
|
||||
if e.to == "" {
|
||||
travel = Back()
|
||||
}
|
||||
if e.needs != "" {
|
||||
travel = inkwell.If(inkwell.Flag(e.needs), travel, inkwell.Say(Paul, e.blocked))
|
||||
}
|
||||
area := e.area
|
||||
if area == nil {
|
||||
area = e.side.area()
|
||||
}
|
||||
return inkwell.Hotspot{
|
||||
Name: exitName(e.to),
|
||||
Label: e.label,
|
||||
Area: area,
|
||||
Cursor: inkwell.CursorExit,
|
||||
OnLook: inkwell.Say(Paul, "That way: "+e.label+"."),
|
||||
OnUse: travel,
|
||||
OnTake: inkwell.Say(Paul, "It's a way out, not a thing."),
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenHackerspace,
|
||||
Title: "HACKERSPACE",
|
||||
Background: BgHackerspace,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenHospital,
|
||||
Title: "HOSPITAL — PSYCHIATRIC WING",
|
||||
Background: BgHospital,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenIceCreamShop,
|
||||
Title: "ICE CREAM SHOP — WHERE THE BAR WAS",
|
||||
Background: BgIceCreamShop,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
type Screen struct {
|
||||
Name string
|
||||
Title string
|
||||
Background string
|
||||
|
||||
Exits []exit
|
||||
|
||||
OnSelector bool
|
||||
|
||||
Hotspots []inkwell.Hotspot
|
||||
Actors []inkwell.SceneActor
|
||||
Walkboxes []inkwell.Polygon
|
||||
OnEnter inkwell.Action
|
||||
}
|
||||
|
||||
var ScreenManager = NewManager(func(entity Screen) string { return entity.Name })
|
||||
|
||||
func registerScreen() {
|
||||
fillSelectorPins()
|
||||
registerAll(ScreenManager, func(entity Screen) {
|
||||
World.G.SceneManager.Register(screenBuild(entity))
|
||||
})
|
||||
}
|
||||
|
||||
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,
|
||||
},
|
||||
),
|
||||
}
|
||||
|
||||
func screenBuild(s Screen) inkwell.Scene {
|
||||
exits := s.Exits
|
||||
if s.OnSelector {
|
||||
exits = append(exits, toSelector())
|
||||
}
|
||||
hotspots := make([]inkwell.Hotspot, 0, len(exits)+len(s.Hotspots))
|
||||
hotspots = append(hotspots, s.Hotspots...)
|
||||
for _, e := range exits {
|
||||
hotspots = append(hotspots, e.hotspot())
|
||||
}
|
||||
|
||||
actors := s.Actors
|
||||
if actors == nil {
|
||||
actors = []inkwell.SceneActor{
|
||||
{
|
||||
CharacterName: Paul,
|
||||
At: inkwell.Point{
|
||||
X: 320,
|
||||
Y: 232,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
walkboxes := s.Walkboxes
|
||||
if walkboxes == nil {
|
||||
walkboxes = screenFloor
|
||||
}
|
||||
onEnter := inkwell.Action(EnterScene(s.Name))
|
||||
if s.OnEnter != nil {
|
||||
onEnter = inkwell.Seq(onEnter, s.OnEnter)
|
||||
}
|
||||
|
||||
return inkwell.Scene{
|
||||
Name: s.Name,
|
||||
Title: s.Title,
|
||||
Background: s.Background,
|
||||
Actors: actors,
|
||||
Walkboxes: walkboxes,
|
||||
Hotspots: hotspots,
|
||||
OnEnter: onEnter,
|
||||
}
|
||||
}
|
||||
|
||||
func setVarIfEmpty(name string, v any) inkwell.Action {
|
||||
return Fn(func(ctx *inkwell.Ctx) {
|
||||
if ctx.Game.State.Var(name) == nil {
|
||||
ctx.Game.State.SetVar(name, v)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenNoodleHouse,
|
||||
Title: "NOODLE'S HOUSE — SEALED",
|
||||
Background: BgNoodleHouse,
|
||||
OnSelector: true,
|
||||
Exits: []exit{
|
||||
{
|
||||
to: ScreenAlley,
|
||||
label: "the alley behind the house",
|
||||
side: sideRight,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenNormanApartment,
|
||||
Title: "NORMAN'S APARTMENT",
|
||||
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,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenPaulShop,
|
||||
Title: "PAUL'S SHOP — JUNK AND GARAGE",
|
||||
Background: BgPaulShop,
|
||||
Exits: []exit{
|
||||
{
|
||||
to: ScreenNoodleHouse,
|
||||
label: "the bus to San Francisco",
|
||||
side: sideNear,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenPoliceStation,
|
||||
Title: "SFPD — STATION AND HOLDING",
|
||||
Background: BgPoliceStation,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenPublicBBS,
|
||||
Title: "PUBLIC BBS TERMINAL",
|
||||
Background: BgPublicBBS,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenRooftopHideout,
|
||||
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,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenSamizdatPress,
|
||||
Title: "SAMIZDAT PRINTING HOUSE",
|
||||
Background: BgSamizdatPress,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenScrapMarket,
|
||||
Title: "SCRAP MARKET",
|
||||
Background: BgScrapMarket,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenSecretClub,
|
||||
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,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenSecretLab,
|
||||
Title: "SECRET RESEARCH LABORATORY",
|
||||
Background: BgSecretLab,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenServerFarm,
|
||||
Title: "SERVER FARM",
|
||||
Background: BgServerFarm,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenShowroom,
|
||||
Title: "NEUMATRONIC SHOWROOM",
|
||||
Background: BgShowroom,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenSmallRestaurant,
|
||||
Title: "SMALL RESTAURANT — NEXT DOOR",
|
||||
Background: BgSmallRestaurant,
|
||||
Exits: []exit{
|
||||
{
|
||||
to: ScreenTrinketShop,
|
||||
label: "back to the trinket shop",
|
||||
side: sideLeft,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenStreet,
|
||||
Title: "STREET",
|
||||
Background: BgStreet,
|
||||
OnSelector: true,
|
||||
})
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package inc
|
||||
|
||||
func init() {
|
||||
ScreenManager.Register(Screen{
|
||||
Name: ScreenTrinketShop,
|
||||
Title: "CHINATOWN — TRINKET SHOP",
|
||||
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,
|
||||
needs: FlagClubEntry,
|
||||
blocked: "Just a shop, as far as the man behind the counter is concerned.",
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
+2
-2
@@ -36,8 +36,8 @@ func registerUI() {
|
||||
g.UIManager.Register(&actionPump{
|
||||
Name: "pump",
|
||||
})
|
||||
g.UIManager.Register(&screenNav{
|
||||
Name: "screen_nav",
|
||||
g.UIManager.Register(&sceneNav{
|
||||
Name: "scene_nav",
|
||||
})
|
||||
g.UIManager.Register(&windowSizer{
|
||||
Name: "window",
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2/inpututil"
|
||||
)
|
||||
|
||||
type screenNav struct {
|
||||
type sceneNav struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
func (n *screenNav) GetName() string { return n.Name }
|
||||
func (n *screenNav) Draw(dst *ebiten.Image, ctx *inkwell.UICtx) {}
|
||||
func (n *sceneNav) GetName() string { return n.Name }
|
||||
func (n *sceneNav) Draw(dst *ebiten.Image, ctx *inkwell.UICtx) {}
|
||||
|
||||
func (n *screenNav) Tick(ctx *inkwell.UICtx) {
|
||||
func (n *sceneNav) Tick(ctx *inkwell.UICtx) {
|
||||
if !World.HUDVisible() || World.Paused() {
|
||||
return
|
||||
}
|
||||
@@ -32,13 +32,13 @@ func (n *screenNav) Tick(ctx *inkwell.UICtx) {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *screenNav) neighbour(g *inkwell.Game, step int) string {
|
||||
func (n *sceneNav) neighbour(g *inkwell.Game, step int) string {
|
||||
deck := g.SceneManager.Names()
|
||||
if len(deck) < 2 {
|
||||
return ""
|
||||
}
|
||||
for i, name := range deck {
|
||||
if name == World.Scene() {
|
||||
if name == World.G.CurrentScene() {
|
||||
return deck[((i+step)%len(deck)+len(deck))%len(deck)]
|
||||
}
|
||||
}
|
||||
+2
-20
@@ -32,7 +32,7 @@ func (w *world) PumpTick(dt float64) {
|
||||
Game: w.G,
|
||||
DT: dt,
|
||||
}
|
||||
if s, ok := w.G.SceneManager.Get(w.scene); ok {
|
||||
if s, ok := w.G.SceneManager.Get(w.G.CurrentScene()); ok {
|
||||
ctx.Scene = &s
|
||||
}
|
||||
if w.running.Tick(ctx) != inkwell.StatusRunning {
|
||||
@@ -41,7 +41,7 @@ func (w *world) PumpTick(dt float64) {
|
||||
}
|
||||
|
||||
func (w *world) sceneTitle() string {
|
||||
s, ok := w.G.SceneManager.Get(w.scene)
|
||||
s, ok := w.G.SceneManager.Get(w.G.CurrentScene())
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
@@ -88,24 +88,6 @@ func SetMode(m Mode) inkwell.Action {
|
||||
return Fn(func(*inkwell.Ctx) { World.SetMode(m) })
|
||||
}
|
||||
|
||||
func EnterScene(name string) inkwell.Action {
|
||||
return Fn(func(*inkwell.Ctx) {
|
||||
if name != World.scene {
|
||||
World.prev = World.scene
|
||||
}
|
||||
World.scene = name
|
||||
})
|
||||
}
|
||||
|
||||
func Back() inkwell.Action {
|
||||
return Fn(func(ctx *inkwell.Ctx) {
|
||||
if World.prev == "" {
|
||||
return
|
||||
}
|
||||
inkwell.GoTo(World.prev).Start().Tick(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func TapeSay(speaker, text string) inkwell.Action {
|
||||
return &tapeSayAction{
|
||||
speaker: speaker,
|
||||
|
||||
@@ -17,8 +17,6 @@ type world struct {
|
||||
|
||||
mode Mode
|
||||
|
||||
scene string
|
||||
prev string
|
||||
paused bool
|
||||
pending string
|
||||
queue []inkwell.Action
|
||||
@@ -34,8 +32,6 @@ var World = &world{}
|
||||
func (w *world) attach(g *inkwell.Game) {
|
||||
w.G = g
|
||||
w.mode = ModePlay
|
||||
w.scene = ""
|
||||
w.prev = ""
|
||||
w.paused = false
|
||||
w.pending = ""
|
||||
w.queue = nil
|
||||
@@ -51,10 +47,6 @@ func (w *world) SetMode(m Mode) { w.mode = m }
|
||||
|
||||
func (w *world) HUDVisible() bool { return w.mode == ModePlay }
|
||||
|
||||
func (w *world) Scene() string { return w.scene }
|
||||
|
||||
func (w *world) Previous() string { return w.prev }
|
||||
|
||||
func (w *world) Paused() bool { return w.paused }
|
||||
|
||||
func (w *world) SetTopBar(t *inkwell.TopBar) { w.top = t }
|
||||
|
||||
Reference in New Issue
Block a user