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

@@ -60,11 +60,11 @@ func (g *RogueGame) newMonster(tp *Monster, typ byte, cp Coord) {
tp.Stats.Exp = mp.Stats.Exp + levAdd*10 + expAdd(tp)
tp.Flags = mp.Flags
if g.Depth > 29 {
tp.Flags.Set(IsHaste)
tp.Flags.Set(Hasted)
}
tp.Turn = true
tp.Pack = nil
if g.Player.IsWearing(RAggr) {
if g.Player.IsWearing(RingAggravateMonsters) {
g.runto(cp)
}
if typ == 'X' {
@@ -101,9 +101,9 @@ func (g *RogueGame) wanderer() {
}
}
g.newMonster(tp, g.randMonster(true), cp)
if g.Player.On(SeeMonst) {
if g.Player.On(SenseMonsters) {
g.standout()
if !g.Player.On(IsHalu) {
if !g.Player.On(Hallucinating) {
g.addch(tp.Type)
} else {
g.addch(byte(g.rnd(26) + 'A'))
@@ -123,24 +123,24 @@ func (g *RogueGame) wakeMonster(y, x int) *Monster {
}
ch := tp.Type
// Every time he sees a mean monster, it might start chasing him
if !tp.On(IsRun) && g.rnd(3) != 0 && tp.On(IsMean) && !tp.On(IsHeld) &&
!p.IsWearing(RStealth) && !p.On(IsLevit) {
if !tp.On(Awake) && g.rnd(3) != 0 && tp.On(Mean) && !tp.On(Held) &&
!p.IsWearing(RingStealth) && !p.On(Levitating) {
tp.Dest = &p.Pos
tp.Flags.Set(IsRun)
tp.Flags.Set(Awake)
}
if ch == 'M' && !p.On(IsBlind) && !p.On(IsHalu) &&
!tp.On(IsFound) && !tp.On(IsCanc) && tp.On(IsRun) {
if ch == 'M' && !p.On(Blind) && !p.On(Hallucinating) &&
!tp.On(Found) && !tp.On(Cancelled) && tp.On(Awake) {
rp := p.Room
if (rp != nil && !rp.Flags.Has(IsDark)) ||
if (rp != nil && !rp.Flags.Has(Dark)) ||
distance(y, x, p.Pos.Y, p.Pos.X) < LampDist {
tp.Flags.Set(IsFound)
tp.Flags.Set(Found)
if !g.save(VsMagic) {
if p.On(IsHuh) {
if p.On(Confused) {
g.Lengthen(DUnconfuse, g.spread(HuhDuration))
} else {
g.Fuse(DUnconfuse, 0, g.spread(HuhDuration), After)
}
p.Flags.Set(IsHuh)
p.Flags.Set(Confused)
mname := g.setMname(tp)
g.addmsg("%s", mname)
if mname != "it" {
@@ -151,8 +151,8 @@ func (g *RogueGame) wakeMonster(y, x int) *Monster {
}
}
// Let greedy ones guard gold
if tp.On(IsGreed) && !tp.On(IsRun) {
tp.Flags.Set(IsRun)
if tp.On(Greedy) && !tp.On(Awake) {
tp.Flags.Set(Awake)
if p.Room.GoldVal != 0 {
tp.Dest = &p.Room.Gold
} else {
@@ -182,10 +182,10 @@ func (g *RogueGame) saveThrow(which int, st *Stats) bool {
func (g *RogueGame) save(which int) bool {
p := &g.Player
if which == VsMagic {
if p.IsRing(Left, RProtect) {
if p.IsRing(Left, RingProtection) {
which -= p.CurRing[Left].Arm
}
if p.IsRing(Right, RProtect) {
if p.IsRing(Right, RingProtection) {
which -= p.CurRing[Right].Arm
}
}