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

@@ -53,10 +53,10 @@ func (g *RogueGame) doctor(int) {
} else if g.Quiet >= 3 {
p.Stats.HP += g.rnd(lv-7) + 1
}
if p.IsRing(Left, RRegen) {
if p.IsRing(Left, RingRegeneration) {
p.Stats.HP++
}
if p.IsRing(Right, RRegen) {
if p.IsRing(Right, RingRegeneration) {
p.Stats.HP++
}
if ohp != p.Stats.HP {
@@ -92,27 +92,27 @@ func wanderTime(g *RogueGame) int { return g.spread(70) }
// unconfuse releases the poor player from his confusion (daemons.c
// unconfuse).
func (g *RogueGame) unconfuse(int) {
g.Player.Flags.Clear(IsHuh)
g.Player.Flags.Clear(Confused)
g.msg("you feel less %s now", g.chooseStr("trippy", "confused"))
}
// unsee turns off the ability to see invisible (daemons.c unsee).
func (g *RogueGame) unsee(int) {
for _, th := range g.Level.Monsters {
if th.On(IsInvis) && g.seeMonst(th) {
if th.On(Invisible) && g.seeMonst(th) {
g.mvaddch(th.Pos.Y, th.Pos.X, th.OldCh)
}
}
g.Player.Flags.Clear(CanSee)
g.Player.Flags.Clear(CanSeeInvisible)
}
// sight gives the hero his sight back (daemons.c sight).
func (g *RogueGame) sight(int) {
p := &g.Player
if p.On(IsBlind) {
if p.On(Blind) {
g.Extinguish(DSight)
p.Flags.Clear(IsBlind)
if !p.Room.Flags.Has(IsGone) {
p.Flags.Clear(Blind)
if !p.Room.Flags.Has(Gone) {
g.enterRoom(p.Pos)
}
g.msg("%s", g.chooseStr("far out! Everything is all cosmic again",
@@ -122,7 +122,7 @@ func (g *RogueGame) sight(int) {
// nohaste ends the hasting (daemons.c nohaste).
func (g *RogueGame) nohaste(int) {
g.Player.Flags.Clear(IsHaste)
g.Player.Flags.Clear(Hasted)
g.msg("you feel yourself slowing down")
}
@@ -170,7 +170,7 @@ func (g *RogueGame) stomach(int) {
}
}
if p.HungryState != origHungry {
p.Flags.Clear(IsRun)
p.Flags.Clear(Awake)
g.Running = false
g.ToDeath = false
g.Count = 0
@@ -180,14 +180,14 @@ func (g *RogueGame) stomach(int) {
// comeDown takes the hero down off her acid trip (daemons.c come_down).
func (g *RogueGame) comeDown(int) {
p := &g.Player
if !p.On(IsHalu) {
if !p.On(Hallucinating) {
return
}
g.KillDaemon(DVisuals)
p.Flags.Clear(IsHalu)
p.Flags.Clear(Hallucinating)
if p.On(IsBlind) {
if p.On(Blind) {
return
}
@@ -199,11 +199,11 @@ func (g *RogueGame) comeDown(int) {
}
// undo the monsters
seemonst := p.On(SeeMonst)
seemonst := p.On(SenseMonsters)
for _, tp := range g.Level.Monsters {
g.move(tp.Pos.Y, tp.Pos.X)
if g.cansee(tp.Pos.Y, tp.Pos.X) {
if !tp.On(IsInvis) || p.On(CanSee) {
if !tp.On(Invisible) || p.On(CanSeeInvisible) {
g.addch(tp.Disguise)
} else {
g.addch(g.Level.Char(tp.Pos.Y, tp.Pos.X))
@@ -237,7 +237,7 @@ func (g *RogueGame) visuals(int) {
}
// change the monsters
seemonst := p.On(SeeMonst)
seemonst := p.On(SenseMonsters)
for _, tp := range g.Level.Monsters {
g.move(tp.Pos.Y, tp.Pos.X)
if g.seeMonst(tp) {
@@ -256,7 +256,7 @@ func (g *RogueGame) visuals(int) {
// land lands the hero from a levitation potion (daemons.c land).
func (g *RogueGame) land(int) {
g.Player.Flags.Clear(IsLevit)
g.Player.Flags.Clear(Levitating)
g.msg("%s", g.chooseStr("bummer! You've hit the ground",
"you float gently to the ground"))
}