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:
256
game/types.go
256
game/types.go
@@ -100,9 +100,9 @@ const (
|
||||
type RoomFlags int16
|
||||
|
||||
const (
|
||||
IsDark RoomFlags = 1 << iota // room is dark
|
||||
IsGone // room is gone (a corridor)
|
||||
IsMaze // room is a maze
|
||||
Dark RoomFlags = 1 << iota // room is dark
|
||||
Gone // room is gone (a corridor)
|
||||
Maze // room is a maze
|
||||
)
|
||||
|
||||
func (f RoomFlags) Has(b RoomFlags) bool { return f&b != 0 }
|
||||
@@ -113,12 +113,12 @@ func (f *RoomFlags) Clear(b RoomFlags) { *f &^= b }
|
||||
type ObjFlags int32
|
||||
|
||||
const (
|
||||
IsCursed ObjFlags = 1 << iota // object is cursed
|
||||
IsKnow // player knows details about the object
|
||||
IsMissl // object is a missile type
|
||||
IsMany // object comes in groups
|
||||
ObjIsFound // object has been seen (ISFOUND shares the bit with creatures)
|
||||
IsProt // armor is permanently protected
|
||||
Cursed ObjFlags = 1 << iota // ISCURSED: object is cursed
|
||||
Known // ISKNOW: player knows details about the object
|
||||
Missile // ISMISL: object is a missile type
|
||||
Stackable // ISMANY: object comes in groups
|
||||
WasFound // ISFOUND (objects): object has been seen (ISFOUND shares the bit with creatures)
|
||||
Protected // ISPROT: armor is permanently protected
|
||||
)
|
||||
|
||||
func (f ObjFlags) Has(b ObjFlags) bool { return f&b != 0 }
|
||||
@@ -131,25 +131,25 @@ func (f *ObjFlags) Clear(b ObjFlags) { *f &^= b }
|
||||
type CreatureFlags int32
|
||||
|
||||
const (
|
||||
CanHuh CreatureFlags = 0o000001 // creature can confuse
|
||||
CanSee CreatureFlags = 0o000002 // creature can see invisible creatures
|
||||
IsBlind CreatureFlags = 0o000004 // creature is blind
|
||||
IsCanc CreatureFlags = 0o000010 // creature has special qualities cancelled
|
||||
IsLevit CreatureFlags = 0o000010 // hero is levitating
|
||||
IsFound CreatureFlags = 0o000020 // creature has been seen
|
||||
IsGreed CreatureFlags = 0o000040 // creature runs to protect gold
|
||||
IsHaste CreatureFlags = 0o000100 // creature has been hastened
|
||||
IsTarget CreatureFlags = 0o000200 // creature is the target of an 'f' command
|
||||
IsHeld CreatureFlags = 0o000400 // creature has been held
|
||||
IsHuh CreatureFlags = 0o001000 // creature is confused
|
||||
IsInvis CreatureFlags = 0o002000 // creature is invisible
|
||||
IsMean CreatureFlags = 0o004000 // creature can wake when player enters room
|
||||
IsHalu CreatureFlags = 0o004000 // hero is on acid trip
|
||||
IsRegen CreatureFlags = 0o010000 // creature can regenerate
|
||||
IsRun CreatureFlags = 0o020000 // creature is running at the player
|
||||
SeeMonst CreatureFlags = 0o040000 // hero can detect unseen monsters
|
||||
IsFly CreatureFlags = 0o040000 // creature can fly
|
||||
IsSlow CreatureFlags = 0o100000 // creature has been slowed
|
||||
CanConfuse CreatureFlags = 0o000001 // CANHUH: creature can confuse
|
||||
CanSeeInvisible CreatureFlags = 0o000002 // CANSEE: creature can see invisible creatures
|
||||
Blind CreatureFlags = 0o000004 // ISBLIND: creature is blind
|
||||
Cancelled CreatureFlags = 0o000010 // ISCANC: creature has special qualities cancelled
|
||||
Levitating CreatureFlags = 0o000010 // ISLEVIT: hero is levitating
|
||||
Found CreatureFlags = 0o000020 // ISFOUND: creature has been seen
|
||||
Greedy CreatureFlags = 0o000040 // ISGREED: creature runs to protect gold
|
||||
Hasted CreatureFlags = 0o000100 // ISHASTE: creature has been hastened
|
||||
Targeted CreatureFlags = 0o000200 // ISTARGET: creature is the target of an 'f' command
|
||||
Held CreatureFlags = 0o000400 // ISHELD: creature has been held
|
||||
Confused CreatureFlags = 0o001000 // ISHUH: creature is confused
|
||||
Invisible CreatureFlags = 0o002000 // ISINVIS: creature is invisible
|
||||
Mean CreatureFlags = 0o004000 // ISMEAN: creature can wake when player enters room
|
||||
Hallucinating CreatureFlags = 0o004000 // ISHALU: hero is on acid trip
|
||||
Regenerates CreatureFlags = 0o010000 // ISREGEN: creature can regenerate
|
||||
Awake CreatureFlags = 0o020000 // ISRUN: creature is running at the player
|
||||
SenseMonsters CreatureFlags = 0o040000 // SEEMONST: hero can detect unseen monsters
|
||||
Flying CreatureFlags = 0o040000 // ISFLY: creature can fly
|
||||
Slowed CreatureFlags = 0o100000 // ISSLOW: creature has been slowed
|
||||
)
|
||||
|
||||
func (f CreatureFlags) Has(b CreatureFlags) bool { return f&b != 0 }
|
||||
@@ -160,13 +160,13 @@ func (f *CreatureFlags) Clear(b CreatureFlags) { *f &^= b }
|
||||
type PlaceFlags uint8
|
||||
|
||||
const (
|
||||
FPass PlaceFlags = 0x80 // is a passageway
|
||||
FSeen PlaceFlags = 0x40 // have seen this spot before
|
||||
FDropped PlaceFlags = 0x20 // object was dropped here
|
||||
FLocked PlaceFlags = 0x20 // door is locked
|
||||
FReal PlaceFlags = 0x10 // what you see is what you get
|
||||
FPNum PlaceFlags = 0x0f // passage number mask
|
||||
FTMask PlaceFlags = 0x07 // trap number mask
|
||||
FPassage PlaceFlags = 0x80 // F_PASS: is a passageway
|
||||
FSeen PlaceFlags = 0x40 // have seen this spot before
|
||||
FDropped PlaceFlags = 0x20 // object was dropped here
|
||||
FLocked PlaceFlags = 0x20 // door is locked
|
||||
FReal PlaceFlags = 0x10 // what you see is what you get
|
||||
FPassNum PlaceFlags = 0x0f // F_PNUM: passage number mask
|
||||
FTrapMask PlaceFlags = 0x07 // F_TMASK: trap number mask
|
||||
)
|
||||
|
||||
func (f PlaceFlags) Has(b PlaceFlags) bool { return f&b != 0 }
|
||||
@@ -175,123 +175,123 @@ func (f *PlaceFlags) Clear(b PlaceFlags) { *f &^= b }
|
||||
|
||||
// Trap types (rogue.h)
|
||||
const (
|
||||
TDoor = 0
|
||||
TArrow = 1
|
||||
TSleep = 2
|
||||
TBear = 3
|
||||
TTelep = 4
|
||||
TDart = 5
|
||||
TRust = 6
|
||||
TMyst = 7
|
||||
NTraps = 8
|
||||
TrapDoor = 0
|
||||
TrapArrow = 1
|
||||
TrapSleep = 2
|
||||
TrapBear = 3
|
||||
TrapTeleport = 4
|
||||
TrapDart = 5
|
||||
TrapRust = 6
|
||||
TrapMystery = 7
|
||||
NumTrapTypes = 8
|
||||
)
|
||||
|
||||
// Potion types (rogue.h)
|
||||
const (
|
||||
PConfuse = iota
|
||||
PLSD
|
||||
PPoison
|
||||
PStrength
|
||||
PSeeInvis
|
||||
PHealing
|
||||
PMFind
|
||||
PTFind
|
||||
PRaise
|
||||
PXHeal
|
||||
PHaste
|
||||
PRestore
|
||||
PBlind
|
||||
PLevit
|
||||
MaxPotions
|
||||
PotionConfusion = iota
|
||||
PotionLSD
|
||||
PotionPoison
|
||||
PotionGainStrength
|
||||
PotionSeeInvisible
|
||||
PotionHealing
|
||||
PotionDetectMonsters
|
||||
PotionDetectMagic
|
||||
PotionRaiseLevel
|
||||
PotionExtraHealing
|
||||
PotionHaste
|
||||
PotionRestoreStrength
|
||||
PotionBlindness
|
||||
PotionLevitation
|
||||
NumPotionTypes
|
||||
)
|
||||
|
||||
// Scroll types (rogue.h)
|
||||
const (
|
||||
SConfuse = iota
|
||||
SMap
|
||||
SHold
|
||||
SSleep
|
||||
SArmor
|
||||
SIDPotion
|
||||
SIDScroll
|
||||
SIDWeapon
|
||||
SIDArmor
|
||||
SIDRorS
|
||||
SScare
|
||||
SFDet
|
||||
STelep
|
||||
SEnch
|
||||
SCreate
|
||||
SRemove
|
||||
SAggr
|
||||
SProtect
|
||||
MaxScrolls
|
||||
ScrollMonsterConfusion = iota
|
||||
ScrollMagicMapping
|
||||
ScrollHoldMonster
|
||||
ScrollSleep
|
||||
ScrollEnchantArmor
|
||||
ScrollIdentifyPotion
|
||||
ScrollIdentifyScroll
|
||||
ScrollIdentifyWeapon
|
||||
ScrollIdentifyArmor
|
||||
ScrollIdentifyRingOrStick
|
||||
ScrollScareMonster
|
||||
ScrollFoodDetection
|
||||
ScrollTeleportation
|
||||
ScrollEnchantWeapon
|
||||
ScrollCreateMonster
|
||||
ScrollRemoveCurse
|
||||
ScrollAggravateMonsters
|
||||
ScrollProtectArmor
|
||||
NumScrollTypes
|
||||
)
|
||||
|
||||
// Weapon types (rogue.h)
|
||||
const (
|
||||
Mace = iota
|
||||
Sword
|
||||
Bow
|
||||
Arrow
|
||||
Dagger
|
||||
TwoSword
|
||||
Dart
|
||||
Shiraken
|
||||
Spear
|
||||
Flame // fake entry for dragon breath (ick)
|
||||
MaxWeapons = Flame
|
||||
WeaponMace = iota
|
||||
WeaponLongSword
|
||||
WeaponBow
|
||||
WeaponArrow
|
||||
WeaponDagger
|
||||
WeaponTwoHandedSword
|
||||
WeaponDart
|
||||
WeaponShuriken
|
||||
WeaponSpear
|
||||
WeaponFlame // fake entry for dragon breath (ick)
|
||||
NumWeaponTypes = WeaponFlame
|
||||
)
|
||||
|
||||
// Armor types (rogue.h)
|
||||
const (
|
||||
Leather = iota
|
||||
RingMail
|
||||
StuddedLeather
|
||||
ScaleMail
|
||||
ChainMail
|
||||
SplintMail
|
||||
BandedMail
|
||||
PlateMail
|
||||
MaxArmors
|
||||
ArmorLeather = iota
|
||||
ArmorRingMail
|
||||
ArmorStuddedLeather
|
||||
ArmorScaleMail
|
||||
ArmorChainMail
|
||||
ArmorSplintMail
|
||||
ArmorBandedMail
|
||||
ArmorPlateMail
|
||||
NumArmorTypes
|
||||
)
|
||||
|
||||
// Ring types (rogue.h)
|
||||
const (
|
||||
RProtect = iota
|
||||
RAddStr
|
||||
RSustStr
|
||||
RSearch
|
||||
RSeeInvis
|
||||
RNop
|
||||
RAggr
|
||||
RAddHit
|
||||
RAddDam
|
||||
RRegen
|
||||
RDigest
|
||||
RTeleport
|
||||
RStealth
|
||||
RSustArm
|
||||
MaxRings
|
||||
RingProtection = iota
|
||||
RingAddStrength
|
||||
RingSustainStrength
|
||||
RingSearching
|
||||
RingSeeInvisible
|
||||
RingAdornment
|
||||
RingAggravateMonsters
|
||||
RingDexterity
|
||||
RingIncreaseDamage
|
||||
RingRegeneration
|
||||
RingSlowDigestion
|
||||
RingTeleportation
|
||||
RingStealth
|
||||
RingMaintainArmor
|
||||
NumRingTypes
|
||||
)
|
||||
|
||||
// Rod/Wand/Staff types (rogue.h)
|
||||
const (
|
||||
WsLight = iota
|
||||
WsInvis
|
||||
WsElect
|
||||
WsFire
|
||||
WsCold
|
||||
WsPolymorph
|
||||
WsMissile
|
||||
WsHasteM
|
||||
WsSlowM
|
||||
WsDrain
|
||||
WsNop
|
||||
WsTelAway
|
||||
WsTelTo
|
||||
WsCancel
|
||||
MaxSticks
|
||||
WandLight = iota
|
||||
WandInvisibility
|
||||
WandLightning
|
||||
WandFire
|
||||
WandCold
|
||||
WandPolymorph
|
||||
WandMagicMissile
|
||||
WandHasteMonster
|
||||
WandSlowMonster
|
||||
WandDrainLife
|
||||
WandNothing
|
||||
WandTeleportAway
|
||||
WandTeleportTo
|
||||
WandCancellation
|
||||
NumWandTypes
|
||||
)
|
||||
|
||||
// Coord is a position on the level (rogue.h coord). A value type: the C
|
||||
|
||||
Reference in New Issue
Block a user