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

@@ -3,19 +3,19 @@ package game
// ItemLore is the per-game item identity state: the randomized appearance
// names and the seven mutable ObjInfo tables (extern.c/init.c).
type ItemLore struct {
PotColors [MaxPotions]string // p_colors: colors of the potions
ScrNames [MaxScrolls]string // s_names: names of the scrolls
RingStones [MaxRings]string // r_stones: stone settings of the rings
WandMade [MaxSticks]string // ws_made: what sticks are made of
WandType [MaxSticks]string // ws_type: "wand" or "staff"
PotColors [NumPotionTypes]string // p_colors: colors of the potions
ScrNames [NumScrollTypes]string // s_names: names of the scrolls
RingStones [NumRingTypes]string // r_stones: stone settings of the rings
WandMade [NumWandTypes]string // ws_made: what sticks are made of
WandType [NumWandTypes]string // ws_type: "wand" or "staff"
Things [NumThings]ObjInfo
Potions [MaxPotions]ObjInfo
Scrolls [MaxScrolls]ObjInfo
Rings [MaxRings]ObjInfo
Sticks [MaxSticks]ObjInfo
Weapons [MaxWeapons + 1]ObjInfo
Armors [MaxArmors]ObjInfo
Potions [NumPotionTypes]ObjInfo
Scrolls [NumScrollTypes]ObjInfo
Rings [NumRingTypes]ObjInfo
Sticks [NumWandTypes]ObjInfo
Weapons [NumWeaponTypes + 1]ObjInfo
Armors [NumArmorTypes]ObjInfo
Group int // group number for the next stack of missiles (weapons.c `group`)
}
@@ -168,7 +168,7 @@ func NewGame(cfg Config) *RogueGame {
g.FileName = cfg.Home + "/rogue.save"
g.rogueOpts = cfg.RogueOpts
if cfg.Wizard {
g.Player.Flags.Set(SeeMonst)
g.Player.Flags.Set(SenseMonsters)
}
if cfg.RogueOpts != "" {
g.ParseOpts(cfg.RogueOpts)
@@ -177,7 +177,7 @@ func NewGame(cfg Config) *RogueGame {
g.Monsters = monsterTable
g.Items.Group = 2 // weapons.c: int group = 2
for i := range g.Level.Passages {
g.Level.Passages[i].Flags = IsGone | IsDark
g.Level.Passages[i].Flags = Gone | Dark
}
g.initProbs() // set up prob tables for objects