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

@@ -55,7 +55,7 @@ func (g *RogueGame) invName(obj *Object, drop bool) string {
} else {
fmt.Fprintf(&pb, "A%s ", vowelstr(sp))
}
if obj.Flags.Has(IsKnow) {
if obj.Flags.Has(Known) {
fmt.Fprintf(&pb, "%s %s", num(obj.HPlus, obj.DPlus, Weapon), sp)
} else {
pb.WriteString(sp)
@@ -68,7 +68,7 @@ func (g *RogueGame) invName(obj *Object, drop bool) string {
}
case Armor:
sp := it.Armors[which].Name
if obj.Flags.Has(IsKnow) {
if obj.Flags.Has(Known) {
fmt.Fprintf(&pb, "%s %s [", num(aClass[which]-obj.Arm, 0, Armor), sp)
if !g.Options.Terse {
pb.WriteString("protection ")
@@ -151,7 +151,7 @@ func (g *RogueGame) dropCheck(obj *Object) bool {
obj != p.CurRing[Left] && obj != p.CurRing[Right] {
return true
}
if obj.Flags.Has(IsCursed) {
if obj.Flags.Has(Cursed) {
g.msg("you can't. It appears to be cursed")
return false
}
@@ -167,9 +167,9 @@ func (g *RogueGame) dropCheck(obj *Object) bool {
}
p.CurRing[hand] = nil
switch obj.Which {
case RAddStr:
case RingAddStrength:
g.chgStr(-obj.Arm)
case RSeeInvis:
case RingSeeInvisible:
g.unsee(0)
g.Extinguish(DUnsee)
}
@@ -209,9 +209,9 @@ func (g *RogueGame) newThing() *Object {
cur.Which = 1
}
case 3:
g.initWeapon(cur, pickOne(g, g.Items.Weapons[:MaxWeapons]))
g.initWeapon(cur, pickOne(g, g.Items.Weapons[:NumWeaponTypes]))
if r := g.rnd(100); r < 10 {
cur.Flags.Set(IsCursed)
cur.Flags.Set(Cursed)
cur.HPlus -= g.rnd(3) + 1
} else if r < 15 {
cur.HPlus += g.rnd(3) + 1
@@ -221,7 +221,7 @@ func (g *RogueGame) newThing() *Object {
cur.Which = pickOne(g, g.Items.Armors[:])
cur.Arm = aClass[cur.Which]
if r := g.rnd(100); r < 20 {
cur.Flags.Set(IsCursed)
cur.Flags.Set(Cursed)
cur.Arm += g.rnd(3) + 1
} else if r < 28 {
cur.Arm -= g.rnd(3) + 1
@@ -230,13 +230,13 @@ func (g *RogueGame) newThing() *Object {
cur.Type = Ring
cur.Which = pickOne(g, g.Items.Rings[:])
switch cur.Which {
case RAddStr, RProtect, RAddHit, RAddDam:
case RingAddStrength, RingProtection, RingDexterity, RingIncreaseDamage:
if cur.Arm = g.rnd(3); cur.Arm == 0 {
cur.Arm = -1
cur.Flags.Set(IsCursed)
cur.Flags.Set(Cursed)
}
case RAggr, RTeleport:
cur.Flags.Set(IsCursed)
case RingAggravateMonsters, RingTeleportation:
cur.Flags.Set(Cursed)
}
case 6:
cur.Type = Stick
@@ -525,7 +525,7 @@ func (g *RogueGame) prList() {
case Armor:
g.prSpec(g.Items.Armors[:])
case Weapon:
g.prSpec(g.Items.Weapons[:MaxWeapons])
g.prSpec(g.Items.Weapons[:NumWeaponTypes])
}
}