go: port command loop, save/restore, tcell terminal, and the binary
- command.c in full: the command dispatcher with repeat counts, run prefixes, ctrl-run door-stop mode, fight-to-death targeting, and all wizard debug commands; search, help, identify, d_level/u_level, call, current - main.c completed: Run()/playit() with the C double ROGUEOPTS parse; exit()-anywhere becomes a gameEnd panic recovered in Run - save.c + state.c: gob SaveState snapshot with explicit pointer-to- index fixups for equipment, monster rooms, and chase targets (the rs_fix_thing role); save file deleted on restore as in C; SIGHUP/ SIGTERM autosave hook - wizard.c completed (create_obj, show_map), passages.c add_pass - term/: tcell/v2 Terminal — the one third-party dependency — replacing curses and mdport's 900-line key decoder; shell escape via suspend - cmd/rogue: flags -s/-d, SEED (wizard), ROGUEOPTS, ROGUE_WIZARD Tests: full scripted sessions through Run (quit, descend stairs, 3200-move crash sweep, save-command round trip). Notable fixes found by tests: gob silently drops embedded fields of unexported types, and --More-- prompts swallow space-free input scripts.
This commit is contained in:
@@ -246,6 +246,38 @@ func (g *RogueGame) door(rm *Room, cp Coord) {
|
||||
}
|
||||
}
|
||||
|
||||
// addPass adds the passages to the current window — wizard command
|
||||
// (passages.c add_pass).
|
||||
func (g *RogueGame) addPass() {
|
||||
for y := 1; y < NumLines-1; y++ {
|
||||
for x := 0; x < NumCols; x++ {
|
||||
pp := g.Level.At(y, x)
|
||||
if pp.Flags.Has(FPass) || pp.Ch == Door ||
|
||||
(!pp.Flags.Has(FReal) && (pp.Ch == '|' || pp.Ch == '-')) {
|
||||
ch := pp.Ch
|
||||
if pp.Flags.Has(FPass) {
|
||||
ch = Passage
|
||||
}
|
||||
pp.Flags.Set(FSeen)
|
||||
g.move(y, x)
|
||||
if pp.Monst != nil {
|
||||
pp.Monst.OldCh = pp.Ch
|
||||
} else if pp.Flags.Has(FReal) {
|
||||
g.addch(ch)
|
||||
} else {
|
||||
g.standout()
|
||||
if pp.Flags.Has(FPass) {
|
||||
g.addch(Passage)
|
||||
} else {
|
||||
g.addch(Door)
|
||||
}
|
||||
g.standend()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// passnum assigns a number to each passageway (passages.c passnum).
|
||||
func (g *RogueGame) passnum() {
|
||||
g.pnum = 0
|
||||
|
||||
Reference in New Issue
Block a user