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

@@ -36,7 +36,7 @@ func (g *RogueGame) look(wakeup bool) {
if x < 0 || x >= NumCols {
continue
}
if !p.On(IsBlind) {
if !p.On(Blind) {
if y == hero.Y && x == hero.X {
continue
}
@@ -49,11 +49,11 @@ func (g *RogueGame) look(wakeup bool) {
}
fp := &pp.Flags
if pch != Door && ch != Door {
if (pfl & FPass) != (*fp & FPass) {
if (pfl & FPassage) != (*fp & FPassage) {
continue
}
}
if (fp.Has(FPass) || ch == Door) && (pfl.Has(FPass) || pch == Door) {
if (fp.Has(FPassage) || ch == Door) && (pfl.Has(FPassage) || pch == Door) {
if hero.X != x && hero.Y != y &&
!stepOk(g.Level.Char(y, hero.X)) && !stepOk(g.Level.Char(hero.Y, x)) {
continue
@@ -63,7 +63,7 @@ func (g *RogueGame) look(wakeup bool) {
tp := pp.Monst
if tp == nil {
ch = g.tripCh(y, x, ch)
} else if p.On(SeeMonst) && tp.On(IsInvis) {
} else if p.On(SenseMonsters) && tp.On(Invisible) {
if g.DoorStop && !g.Firstmove {
g.Running = false
}
@@ -73,20 +73,20 @@ func (g *RogueGame) look(wakeup bool) {
g.wakeMonster(y, x)
}
if g.seeMonst(tp) {
if p.On(IsHalu) {
if p.On(Hallucinating) {
ch = byte(g.rnd(26) + 'A')
} else {
ch = tp.Disguise
}
}
}
if p.On(IsBlind) && (y != hero.Y || x != hero.X) {
if p.On(Blind) && (y != hero.Y || x != hero.X) {
continue
}
g.move(y, x)
if p.Room.Flags.Has(IsDark) && !g.Options.SeeFloor && ch == Floor {
if p.Room.Flags.Has(Dark) && !g.Options.SeeFloor && ch == Floor {
ch = ' '
}
@@ -156,7 +156,7 @@ func (g *RogueGame) look(wakeup bool) {
// tripCh returns the character for this space, taking into account whether
// or not the player is tripping (misc.c trip_ch).
func (g *RogueGame) tripCh(y, x int, ch byte) byte {
if g.Player.On(IsHalu) && g.After {
if g.Player.On(Hallucinating) && g.After {
switch ch {
case Floor, ' ', Passage, '-', '|', Door, Trap:
default:
@@ -171,8 +171,8 @@ func (g *RogueGame) tripCh(y, x int, ch byte) byte {
// eraseLamp erases the area shown by a lamp in a dark room
// (misc.c erase_lamp).
func (g *RogueGame) eraseLamp(pos Coord, rp *Room) {
if !(g.Options.SeeFloor && rp.Flags&(IsGone|IsDark) == IsDark &&
!g.Player.On(IsBlind)) {
if !(g.Options.SeeFloor && rp.Flags&(Gone|Dark) == Dark &&
!g.Player.On(Blind)) {
return
}
@@ -195,7 +195,7 @@ func (g *RogueGame) eraseLamp(pos Coord, rp *Room) {
// showFloor reports whether we show the floor in her room at this time
// (misc.c show_floor).
func (g *RogueGame) showFloor() bool {
if g.Player.Room.Flags&(IsGone|IsDark) == IsDark && !g.Player.On(IsBlind) {
if g.Player.Room.Flags&(Gone|Dark) == Dark && !g.Player.On(Blind) {
return g.Options.SeeFloor
}
return true
@@ -278,10 +278,10 @@ func (g *RogueGame) chgStr(amt int) {
p := &g.Player
addStr(&p.Stats.Str, amt)
comp := p.Stats.Str
if p.IsRing(Left, RAddStr) {
if p.IsRing(Left, RingAddStrength) {
addStr(&comp, -p.CurRing[Left].Arm)
}
if p.IsRing(Right, RAddStr) {
if p.IsRing(Right, RingAddStrength) {
addStr(&comp, -p.CurRing[Right].Arm)
}
if comp > p.MaxStats.Str {
@@ -301,14 +301,14 @@ func addStr(sp *int, amt int) {
// addHaste adds a haste to the player (misc.c add_haste).
func (g *RogueGame) addHaste(potion bool) bool {
p := &g.Player
if p.On(IsHaste) {
if p.On(Hasted) {
g.NoCommand += g.rnd(8)
p.Flags.Clear(IsRun | IsHaste)
p.Flags.Clear(Awake | Hasted)
g.Extinguish(DNohaste)
g.msg("you faint from exhaustion")
return false
}
p.Flags.Set(IsHaste)
p.Flags.Set(Hasted)
if potion {
g.Fuse(DNohaste, 0, g.rnd(4)+4, After)
}
@@ -403,7 +403,7 @@ func (g *RogueGame) getDir() bool {
g.LastDir = g.DirCh
g.lastDelt = g.Delta
}
if g.Player.On(IsHuh) && g.rnd(5) == 0 {
if g.Player.On(Confused) && g.rnd(5) == 0 {
for {
g.Delta.Y = g.rnd(3) - 1
g.Delta.X = g.rnd(3) - 1
@@ -451,7 +451,7 @@ func (g *RogueGame) rndThing() byte {
// chooseStr picks the first or second string depending on whether the
// player is tripping (misc.c choose_str).
func (g *RogueGame) chooseStr(ts, ns string) string {
if g.Player.On(IsHalu) {
if g.Player.On(Hallucinating) {
return ts
}
return ns