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:
@@ -12,7 +12,7 @@ const (
|
||||
// NewLevel digs and draws a new level (new_level.c new_level).
|
||||
func (g *RogueGame) NewLevel() {
|
||||
p := &g.Player
|
||||
p.Flags.Clear(IsHeld) // unhold when you go down just in case
|
||||
p.Flags.Clear(Held) // unhold when you go down just in case
|
||||
if g.Depth > g.MaxDepth {
|
||||
g.MaxDepth = g.Depth
|
||||
}
|
||||
@@ -31,11 +31,11 @@ func (g *RogueGame) NewLevel() {
|
||||
g.putThings() // Place objects (if any)
|
||||
// Place the traps
|
||||
if g.rnd(10) < g.Depth {
|
||||
g.Level.NTraps = g.rnd(g.Depth/4) + 1
|
||||
if g.Level.NTraps > MaxTraps {
|
||||
g.Level.NTraps = MaxTraps
|
||||
g.Level.TrapCount = g.rnd(g.Depth/4) + 1
|
||||
if g.Level.TrapCount > MaxTraps {
|
||||
g.Level.TrapCount = MaxTraps
|
||||
}
|
||||
for i := g.Level.NTraps; i > 0; i-- {
|
||||
for i := g.Level.TrapCount; i > 0; i-- {
|
||||
// not only wouldn't it be NICE to have traps in mazes (not
|
||||
// that we care about being nice), since the trap number is
|
||||
// stored where the passage number is, we can't actually do it.
|
||||
@@ -48,7 +48,7 @@ func (g *RogueGame) NewLevel() {
|
||||
}
|
||||
sp := g.Level.FlagsAt(stairs.Y, stairs.X)
|
||||
sp.Clear(FReal)
|
||||
*sp |= PlaceFlags(g.rnd(NTraps))
|
||||
*sp |= PlaceFlags(g.rnd(NumTrapTypes))
|
||||
}
|
||||
}
|
||||
// Place the staircase down.
|
||||
@@ -65,10 +65,10 @@ func (g *RogueGame) NewLevel() {
|
||||
p.Pos = hero
|
||||
g.enterRoom(hero)
|
||||
g.mvaddch(hero.Y, hero.X, PlayerCh)
|
||||
if p.On(SeeMonst) {
|
||||
if p.On(SenseMonsters) {
|
||||
g.turnSee(false)
|
||||
}
|
||||
if p.On(IsHalu) {
|
||||
if p.On(Hallucinating) {
|
||||
g.visuals(0)
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func (g *RogueGame) NewLevel() {
|
||||
func (g *RogueGame) rndRoom() int {
|
||||
for {
|
||||
rm := g.rnd(MaxRooms)
|
||||
if !g.Level.Rooms[rm].Flags.Has(IsGone) {
|
||||
if !g.Level.Rooms[rm].Flags.Has(Gone) {
|
||||
return rm
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ func (g *RogueGame) treasRoom() {
|
||||
if mp, ok := g.findFloorIn(rp, maxTries, true); ok {
|
||||
tp := &Monster{}
|
||||
g.newMonster(tp, g.randMonster(false), mp)
|
||||
tp.Flags.Set(IsMean) // no sloughers in THIS room
|
||||
tp.Flags.Set(Mean) // no sloughers in THIS room
|
||||
g.givePack(tp)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user