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

@@ -122,21 +122,21 @@ func (g *RogueGame) wield() {
}
// initWeaps is the weapons.c init_dam[] table.
var initWeaps = [MaxWeapons]struct {
var initWeaps = [NumWeaponTypes]struct {
dam string // damage when wielded
hrl string // damage when thrown
launch int // launching weapon
flags ObjFlags
}{
{"2x4", "1x3", noWeapon, 0}, // Mace
{"3x4", "1x2", noWeapon, 0}, // Long sword
{"1x1", "1x1", noWeapon, 0}, // Bow
{"1x1", "2x3", Bow, IsMany | IsMissl}, // Arrow
{"1x6", "1x4", noWeapon, IsMissl}, // Dagger
{"4x4", "1x2", noWeapon, 0}, // 2h sword
{"1x1", "1x3", noWeapon, IsMany | IsMissl}, // Dart
{"1x2", "2x4", noWeapon, IsMany | IsMissl}, // Shuriken
{"2x3", "1x6", noWeapon, IsMissl}, // Spear
{"2x4", "1x3", noWeapon, 0}, // WeaponMace
{"3x4", "1x2", noWeapon, 0}, // Long sword
{"1x1", "1x1", noWeapon, 0}, // WeaponBow
{"1x1", "2x3", WeaponBow, Stackable | Missile}, // WeaponArrow
{"1x6", "1x4", noWeapon, Missile}, // WeaponDagger
{"4x4", "1x2", noWeapon, 0}, // 2h sword
{"1x1", "1x3", noWeapon, Stackable | Missile}, // WeaponDart
{"1x2", "2x4", noWeapon, Stackable | Missile}, // Shuriken
{"2x3", "1x6", noWeapon, Missile}, // WeaponSpear
}
// initWeapon sets up a new weapon (weapons.c init_weapon).
@@ -150,11 +150,11 @@ func (g *RogueGame) initWeapon(weap *Object, which int) {
weap.Flags = iwp.flags
weap.HPlus = 0
weap.DPlus = 0
if which == Dagger {
if which == WeaponDagger {
weap.Count = g.rnd(4) + 2
weap.Group = g.Items.Group
g.Items.Group++
} else if weap.Flags.Has(IsMany) {
} else if weap.Flags.Has(Stackable) {
weap.Count = g.rnd(8) + 8
weap.Group = g.Items.Group
g.Items.Group++