Rename constants to descriptive names (refactor step 1)

Pure rename, no behavior change; the full suite (RNG goldens,
generation invariants, scripted sessions, save round trip) is
unchanged and green.

- Creature flags: IsHuh→Confused, IsHalu→Hallucinating,
  CanHuh→CanConfuse, CanSee→CanSeeInvisible, IsRun→Awake,
  SeeMonst→SenseMonsters, IsCanc→Cancelled, IsLevit→Levitating,
  IsBlind/IsGreed/IsHaste/IsTarget/IsHeld/IsInvis/IsMean/IsRegen/
  IsFly/IsSlow → Blind/Greedy/Hasted/Targeted/Held/Invisible/Mean/
  Regenerates/Flying/Slowed, IsFound→Found
- Object flags: IsCursed→Cursed, IsKnow→Known, IsMissl→Missile,
  IsMany→Stackable, ObjIsFound→WasFound, IsProt→Protected
- Room flags: IsDark/IsGone/IsMaze → Dark/Gone/Maze; place flags:
  FPass→FPassage, FPNum→FPassNum, FTMask→FTrapMask
- Trap types: TDoor→TrapDoor ... TMyst→TrapMystery
- Item subtypes: P*→Potion* (PLSD→PotionLSD, PMFind→
  PotionDetectMonsters, ...), S*→Scroll* (SIDRorS→
  ScrollIdentifyRingOrStick, ...), R*→Ring* (RAddHit→RingDexterity,
  RNop→RingAdornment, ...), Ws*→Wand* (WsElect→WandLightning, ...),
  weapons (TwoSword→WeaponTwoHandedSword, Shiraken→WeaponShuriken,
  ...), armor (RingMail→ArmorRingMail, ...)
- Counts: Max{Potions,Scrolls,Rings,Sticks,Weapons,Armors} →
  Num{Potion,Scroll,Ring,Wand,Weapon,Armor}Types; NTraps→NumTrapTypes
- Level.NTraps field → TrapCount (also in the save snapshot)
- Original C constant names preserved as comment breadcrumbs in
  types.go so the lineage stays greppable

TODO.md: step 1 moved to Completed, step 2 (typed kinds) promoted to
Next Step.
This commit is contained in:
2026-07-06 21:28:57 +02:00
parent 1133feb0ba
commit e71a2ef3fd
32 changed files with 646 additions and 650 deletions

View File

@@ -33,14 +33,14 @@ func (g *RogueGame) doRooms() {
// Put the gone rooms, if any, on the level
leftOut := g.rnd(4)
for i := 0; i < leftOut; i++ {
g.Level.Rooms[g.rndRoom()].Flags.Set(IsGone)
g.Level.Rooms[g.rndRoom()].Flags.Set(Gone)
}
// dig and populate all the rooms on the level
for i := range g.Level.Rooms {
rp := &g.Level.Rooms[i]
// Find upper left corner of box that this room goes in
top := Coord{X: (i%3)*bsze.X + 1, Y: (i / 3) * bsze.Y}
if rp.Flags.Has(IsGone) {
if rp.Flags.Has(Gone) {
// Place a gone room. Make certain that there is a blank line
// for passage drawing.
for {
@@ -56,13 +56,13 @@ func (g *RogueGame) doRooms() {
}
// set room type
if g.rnd(10) < g.Depth-1 {
rp.Flags.Set(IsDark) // dark room
rp.Flags.Set(Dark) // dark room
if g.rnd(15) == 0 {
rp.Flags = IsMaze // maze room
rp.Flags = Maze // maze room
}
}
// Find a place and size for a random room
if rp.Flags.Has(IsMaze) {
if rp.Flags.Has(Maze) {
rp.Max.X = bsze.X - 1
rp.Max.Y = bsze.Y - 1
if rp.Pos.X = top.X; rp.Pos.X == 1 {
@@ -92,7 +92,7 @@ func (g *RogueGame) doRooms() {
rp.Gold, _ = g.findFloorIn(rp, 0, false)
gold.Pos = rp.Gold
g.Level.SetChar(rp.Gold.Y, rp.Gold.X, Gold)
gold.Flags = IsMany
gold.Flags = Stackable
gold.Group = goldGrp
gold.Type = Gold
attachObj(&g.Level.Objects, gold)
@@ -114,7 +114,7 @@ func (g *RogueGame) doRooms() {
// drawRoom draws a box around a room and lays down the floor for normal
// rooms; for maze rooms, draws the maze (rooms.c draw_room).
func (g *RogueGame) drawRoom(rp *Room) {
if rp.Flags.Has(IsMaze) {
if rp.Flags.Has(Maze) {
g.doMaze(rp)
return
}
@@ -180,7 +180,7 @@ func (g *RogueGame) dig(y, x int) {
if newy < 0 || newy > m.maxy || newx < 0 || newx > m.maxx {
continue
}
if g.Level.FlagsAt(newy+m.starty, newx+m.startx).Has(FPass) {
if g.Level.FlagsAt(newy+m.starty, newx+m.startx).Has(FPassage) {
continue
}
if cnt++; g.rnd(cnt) == 0 {
@@ -257,7 +257,7 @@ func (g *RogueGame) findFloorImpl(rp *Room, limit int, monst, pickroom bool) (Co
var compchar byte
if !pickroom {
compchar = Floor
if rp.Flags.Has(IsMaze) {
if rp.Flags.Has(Maze) {
compchar = Passage
}
}
@@ -271,7 +271,7 @@ func (g *RogueGame) findFloorImpl(rp *Room, limit int, monst, pickroom bool) (Co
if pickroom {
rp = &g.Level.Rooms[g.rndRoom()]
compchar = Floor
if rp.Flags.Has(IsMaze) {
if rp.Flags.Has(Maze) {
compchar = Passage
}
}
@@ -294,7 +294,7 @@ func (g *RogueGame) enterRoom(cp Coord) {
rp := g.roomin(cp)
p.Room = rp
g.doorOpen(rp)
if !rp.Flags.Has(IsDark) && !p.On(IsBlind) {
if !rp.Flags.Has(Dark) && !p.On(Blind) {
for y := rp.Pos.Y; y < rp.Max.Y+rp.Pos.Y; y++ {
g.move(y, rp.Pos.X)
for x := rp.Pos.X; x < rp.Max.X+rp.Pos.X; x++ {
@@ -309,7 +309,7 @@ func (g *RogueGame) enterRoom(cp Coord) {
} else {
tp.OldCh = ch
if !g.seeMonst(tp) {
if p.On(SeeMonst) {
if p.On(SenseMonsters) {
g.standout()
g.addch(tp.Disguise)
g.standend()
@@ -330,21 +330,21 @@ func (g *RogueGame) leaveRoom(cp Coord) {
p := &g.Player
rp := p.Room
if rp.Flags.Has(IsMaze) {
if rp.Flags.Has(Maze) {
return
}
var floor byte
switch {
case rp.Flags.Has(IsGone):
case rp.Flags.Has(Gone):
floor = Passage
case !rp.Flags.Has(IsDark) || p.On(IsBlind):
case !rp.Flags.Has(Dark) || p.On(Blind):
floor = Floor
default:
floor = ' '
}
p.Room = &g.Level.Passages[*g.Level.FlagsAt(cp.Y, cp.X)&FPNum]
p.Room = &g.Level.Passages[*g.Level.FlagsAt(cp.Y, cp.X)&FPassNum]
for y := rp.Pos.Y; y < rp.Max.Y+rp.Pos.Y; y++ {
for x := rp.Pos.X; x < rp.Max.X+rp.Pos.X; x++ {
g.move(y, x)
@@ -357,7 +357,7 @@ func (g *RogueGame) leaveRoom(cp Coord) {
// to check for monster, we have to strip out the standout
// bit (our Window returns the bare character already)
if isUpper(ch) {
if p.On(SeeMonst) {
if p.On(SenseMonsters) {
g.standout()
g.addch(ch)
g.standend()