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:
@@ -7,7 +7,7 @@ package game
|
||||
func (g *RogueGame) command() {
|
||||
p := &g.Player
|
||||
ntimes := 1 // number of player moves
|
||||
if p.On(IsHaste) {
|
||||
if p.On(Hasted) {
|
||||
ntimes++
|
||||
}
|
||||
// Let the daemons start up
|
||||
@@ -21,7 +21,7 @@ func (g *RogueGame) command() {
|
||||
}
|
||||
// these are illegal things for the player to be, so if any are
|
||||
// set, someone's been poking in memory
|
||||
if p.On(IsSlow | IsGreed | IsInvis | IsRegen | IsTarget) {
|
||||
if p.On(Slowed | Greedy | Invisible | Regenerates | Targeted) {
|
||||
panic("player flags corrupted")
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func (g *RogueGame) command() {
|
||||
}
|
||||
if g.NoCommand != 0 {
|
||||
if g.NoCommand--; g.NoCommand == 0 {
|
||||
p.Flags.Set(IsRun)
|
||||
p.Flags.Set(Awake)
|
||||
g.msg("you can move again")
|
||||
}
|
||||
} else {
|
||||
@@ -121,14 +121,14 @@ func (g *RogueGame) command() {
|
||||
}
|
||||
g.DoDaemons(After)
|
||||
g.DoFuses(After)
|
||||
if p.IsRing(Left, RSearch) {
|
||||
if p.IsRing(Left, RingSearching) {
|
||||
g.search()
|
||||
} else if p.IsRing(Left, RTeleport) && g.rnd(50) == 0 {
|
||||
} else if p.IsRing(Left, RingTeleportation) && g.rnd(50) == 0 {
|
||||
g.teleport()
|
||||
}
|
||||
if p.IsRing(Right, RSearch) {
|
||||
if p.IsRing(Right, RingSearching) {
|
||||
g.search()
|
||||
} else if p.IsRing(Right, RTeleport) && g.rnd(50) == 0 {
|
||||
} else if p.IsRing(Right, RingTeleportation) && g.rnd(50) == 0 {
|
||||
g.teleport()
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ over:
|
||||
g.doRun('n')
|
||||
case CTRL('H'), CTRL('J'), CTRL('K'), CTRL('L'),
|
||||
CTRL('Y'), CTRL('U'), CTRL('B'), CTRL('N'):
|
||||
if !p.On(IsBlind) {
|
||||
if !p.On(Blind) {
|
||||
g.DoorStop = true
|
||||
g.Firstmove = true
|
||||
}
|
||||
@@ -219,7 +219,7 @@ over:
|
||||
g.Delta.Y += p.Pos.Y
|
||||
g.Delta.X += p.Pos.X
|
||||
mp := g.Level.MonsterAt(g.Delta.Y, g.Delta.X)
|
||||
if mp == nil || (!g.seeMonst(mp) && !p.On(SeeMonst)) {
|
||||
if mp == nil || (!g.seeMonst(mp) && !p.On(SenseMonsters)) {
|
||||
if !g.Options.Terse {
|
||||
g.addmsg("I see ")
|
||||
}
|
||||
@@ -228,7 +228,7 @@ over:
|
||||
} else if g.diagOk(p.Pos, g.Delta) {
|
||||
g.ToDeath = true
|
||||
g.MaxHit = 0
|
||||
mp.Flags.Set(IsTarget)
|
||||
mp.Flags.Set(Targeted)
|
||||
g.RunCh = g.DirCh
|
||||
ch = g.DirCh
|
||||
goto over
|
||||
@@ -333,10 +333,10 @@ over:
|
||||
}
|
||||
if g.Level.Char(g.Delta.Y, g.Delta.X) != Trap {
|
||||
g.msg("no trap there")
|
||||
} else if p.On(IsHalu) {
|
||||
g.msg("%s", trName[g.rnd(NTraps)])
|
||||
} else if p.On(Hallucinating) {
|
||||
g.msg("%s", trName[g.rnd(NumTrapTypes)])
|
||||
} else {
|
||||
g.msg("%s", trName[*fp&FTMask])
|
||||
g.msg("%s", trName[*fp&FTrapMask])
|
||||
fp.Set(FSeen)
|
||||
}
|
||||
}
|
||||
@@ -407,7 +407,7 @@ func (g *RogueGame) wizardCommand(ch byte) {
|
||||
case CTRL('C'):
|
||||
g.addPass()
|
||||
case CTRL('X'):
|
||||
g.turnSee(p.On(SeeMonst))
|
||||
g.turnSee(p.On(SenseMonsters))
|
||||
case CTRL('~'):
|
||||
if item := g.getItem("charge", int(Stick)); item != nil {
|
||||
item.SetCharges(10000)
|
||||
@@ -418,7 +418,7 @@ func (g *RogueGame) wizardCommand(ch byte) {
|
||||
}
|
||||
// Give him a sword (+1,+1)
|
||||
obj := newObject()
|
||||
g.initWeapon(obj, TwoSword)
|
||||
g.initWeapon(obj, WeaponTwoHandedSword)
|
||||
obj.HPlus = 1
|
||||
obj.DPlus = 1
|
||||
g.addPack(obj, true)
|
||||
@@ -426,9 +426,9 @@ func (g *RogueGame) wizardCommand(ch byte) {
|
||||
// And his suit of armor
|
||||
obj = newObject()
|
||||
obj.Type = Armor
|
||||
obj.Which = PlateMail
|
||||
obj.Which = ArmorPlateMail
|
||||
obj.Arm = -5
|
||||
obj.Flags.Set(IsKnow)
|
||||
obj.Flags.Set(Known)
|
||||
obj.Count = 1
|
||||
p.CurArmor = obj
|
||||
g.addPack(obj, true)
|
||||
@@ -453,10 +453,10 @@ func (g *RogueGame) search() {
|
||||
ey := p.Pos.Y + 1
|
||||
ex := p.Pos.X + 1
|
||||
probinc := 0
|
||||
if p.On(IsHalu) {
|
||||
if p.On(Hallucinating) {
|
||||
probinc = 3
|
||||
}
|
||||
if p.On(IsBlind) {
|
||||
if p.On(Blind) {
|
||||
probinc += 2
|
||||
}
|
||||
found := false
|
||||
@@ -486,10 +486,10 @@ func (g *RogueGame) search() {
|
||||
if !g.Options.Terse {
|
||||
g.addmsg("you found ")
|
||||
}
|
||||
if p.On(IsHalu) {
|
||||
g.msg("%s", trName[g.rnd(NTraps)])
|
||||
if p.On(Hallucinating) {
|
||||
g.msg("%s", trName[g.rnd(NumTrapTypes)])
|
||||
} else {
|
||||
g.msg("%s", trName[*fp&FTMask])
|
||||
g.msg("%s", trName[*fp&FTrapMask])
|
||||
fp.Set(FSeen)
|
||||
}
|
||||
foundone = true
|
||||
@@ -661,7 +661,7 @@ func (g *RogueGame) uLevel() {
|
||||
// levitCheck checks whether she's levitating, and if she is, prints an
|
||||
// appropriate message (command.c levit_check).
|
||||
func (g *RogueGame) levitCheck() bool {
|
||||
if !g.Player.On(IsLevit) {
|
||||
if !g.Player.On(Levitating) {
|
||||
return false
|
||||
}
|
||||
g.msg("You can't. You're floating off the ground!")
|
||||
|
||||
Reference in New Issue
Block a user