Player struct variable name revision #7302
Replies: 2 comments 1 reply
-
I'll only add that we should try to maybe come up with an accepted list of abbreviations. I personally think that most of the super common ones are okay. position > pos None of these are really "gaming" related like dungeon > dung, or spell > spl. They are common abbreviations throughout codebases. RPG related abbreviations if you want to go that far: strength > str What gets a bit troublesome is stuff like "inv". Inventory, invincibility, and invisibility all start with inv. Durability and duration both start with "dur". |
Beta Was this translation helpful? Give feedback.
-
For reference, these are the names used for the player struct fields in Djavul. Feel free to use any for inspiration : ) // _pmode
PlayerMode d1enum.PlayerMode
// walkpath
Walk [25]d1enum.Step
// plractive
Active bool
// destAction
DestAction d1enum.PlayerCmd
// destParam1, destParam2, destParam3, destParam4
DestParam1, DestParam2, DestParam3, DestParam4 int
// plrlevel
DLvl int
// _pfutx, _pfuty
Next Coordinate // NextX, NextY
// _ptargx, _ptargy
Target Coordinate // TargetX, TargetY
// _pownerx, _pownery
Owner Coordinate // OwnerX, OwernY
// _poldx, _poldy
Prev Coordinate // PrevX, PrevY
// _nextdir
NextDir d1enum.Dir
// _pgfxnum
AnimType d1enum.PlayerAnimType
// _plid
LightNum int
// _pvid
VisionID int
// _pSpell
CastSpellID d1enum.SpellID
// _pSplType
CastSpellType d1enum.SpellType
// _pSplFrom
CastSpellFrom d1enum.SpellFrom
// _pTSpell
TargetedSpellID d1enum.SpellID
// _pTSplType
TargetedSpellType d1enum.SpellType
// _pRSpell
ActiveSpellID d1enum.SpellID
// _pRSplType
ActiveSpellType d1enum.SpellType
// _pSBkSpell
SpellbookSpellID d1enum.SpellID
// _pSBkSplType
SpellbookSpellType d1enum.SpellType
// _pSplLvl
SpellLvlFromSpellID [64]int
// _pMemSpells
KnownSpells uint64
// _pAblSpells
KnownSkills uint64
// _pScrlSpells
KnownScrolls uint64
// _pSpellFlags
SpellFlags d1enum.SpellFlags
// _pSplHotKey
SpellIDFromHotkeyID [4]d1enum.SpellID
// _pSplTHotKey
SpellTypeFromHotkeyID [4]d1enum.SpellType
// _pwtype
WeaponType d1enum.WeaponType
// _pBlockFlag
CanBlock bool
// _pInvincible
Invincible bool
// _pLightRad
LightRadius int
// _pLvlChanging
ChangingDLvl bool
// _pClass
PlayerClass d1enum.PlayerClass
// _pStrength, _pBaseStr
CurStr, BaseStr int
// _pMagic, _pBaseMag
CurMag, BaseMag int
// _pDexterity, _pBaseDex
CurDex, BaseDex int
// _pVitality, _pBaseVit
CurVit, BaseVit int
// _pStatPts
StatPoints int
// _pDamageMod
DamageModifier int
// _pBaseToBlk
BaseBlockChance int
// _pHPBase, _pMaxHPBase
CurBaseHP, MaxBaseHP int
// _pHitPoints, _pMaxHP
CurHP, MaxHP int
// _pManaBase, _pMaxManaBase
CurBaseMP, MaxBaseMP int
// _pMana, _pMaxMana
CurMP, MaxMP int
// _pLevel
CLvl int
// _pMaxLvl
MaxCLvl int
// _pExperience
Exp int
// _pMaxExp
MaxExp int
// _pNextExper
ExpNextCLvl int
// _pArmorClass
ArmorClass int
// _pMagResist
MagicResist int
// _pFireResist
FireResist int
// _pLghtResist
LightningResist int
// _pGold
Gold int
// _pInfraFlag
HasInfravision bool
// _pVar1, _pVar2, _pVar3, _pVar4, _pVar5, _pVar6, _pVar7, _pVar8
Var1, Var2, Var3, Var4, Var5, Var6, Var7, Var8 int
// _pLvlVisited
VisitedDLvl [NDLvls]bool
// _pSLvlVisited
VisitedSetLevel [NDLvls]bool
// _pGFXLoad
LoadedAnims d1enum.PlayerAnimModes `json:"-"`
// _pNFrames
StandNFrames int
// _pWFrames
WalkNFrames int
// _pAFrames
AttackNFrames int
// _pAFNum
AttackFrameNum int
// _pSFrames
SpellNFrames int
// _pSFNum
SpellFrameNum int
// _pHFrames
HitNFrames int
// _pDFrames
DeathNFrames int
// _pBFrames
BlockNFrames int
// InvBody
BodyItems [MaxBodyItems]*Item
// InvList
InvItems [MaxInvItems]*Item
// _pNumInv
NInvItems int
// InvGrid
InvNumFromInvGrid [MaxInvItems]int
// SpdList
BeltItems [MaxBeltItems]*Item
// HoldItem
HoldItem *Item
// _pIMinDam, _pIMaxDam
ItemMinDamage, ItemMaxDamage int
// _pIAC
ItemArmorClass int
// _pIBonusDam
ItemEnhancedDamage int
// _pIBonusToHit
ItemChanceToHitBonus int
// _pIBonusAC
ItemArmorClassBonus int
// _pIBonusDamMod
ItemDamageModifier int
// _pISpells
KnownCharges uint64
// _pIFlags
ItemAbilityFlags d1enum.ItemAbilityFlags
// _pIGetHit
ItemDamageFromEnemies int
// _pISplLvlAdd
ItemSpellLvlBonus int
// _pISplCost
ItemReducedSpellCost int
// _pISplDur
ItemSpellDuration int
// _pIEnAc
ItemEnhancedAccuracy int
// _pIFMinDam, _pIFMaxDam
ItemMinFireDamage, ItemMaxFireDamage int
// _pILMinDam, _pILMaxDam
ItemMinLightningDamage, ItemMaxLightningDamage int
// _pOilType
OilType uint8
// pTownWarps
EntranceOpen uint8
// pDungMsgs
DungMsgs d1enum.DungeonMsgs
// pLvlLoad
LvlLoad int
// pBattleNet
OnBattlenet bool
// pManaShield
HasManashield bool
// pDiabloKillLevel
Rank d1enum.Difficulty |
Beta Was this translation helpful? Give feedback.
-
Suggested names to rename these variables to. All variable names are kept between 3-20 characters. I opted for full words when possible for clarity, and I'm assuming most modern IDEs have an autofill/autocomplete feature that makes it less tedious to type longer variable names.
_pName
->name
InvBody
->bodySlot
InvList
->inventorySlot
SpdList
->beltSlot
HoldItem
->heldItem
lightId
_pNumInv
->numInventoryItems
_pStrength
->strength
_pBaseStr
->baseStrength
_pMagic
->magic
_pBaseMag
->baseMagic
_pDexterity
->dexterity
_pBaseDex
->baseDexterity
_pVitality
->vitality
_pBaseVit
->baseVitality
_pStatPts
->statPoints
_pDamageMod
->damageModifier
_pHPBase
->baseLife
_pMaxHPBase
->baseMaxLife
_pHitPoints
->life
_pMaxHP
->maxLife
_pHPPer
->lifePercentage
_pManaBase
->baseMana
_pMaxManaBase
->baseMaxMana
_pMana
->mana
_pMaxMana
->maxMana
_pManaPer
->manaPercentage
_pIMinDam
->minDamage
_pIMaxDam
->maxDamage
_pIAC
->armorClass
_pIBonusDam
->bonusDamagePercent
(Note: This is a percentage based increase, as opposed to the to hit and armor class bonuses which modify by a flat amount)_pIBonusToHit
->bonusToHit
_pIBonusAC
->bonusArmorClass
_pIBonusDamMod
->bonusDamage
(Note: This is a flat adjustment to damage, and it's confusing when it shares "mod" with the previous variable that's just used in calculations per class that adjust damage as a whole using multiplication and division)_pIGetHit
->damageFromEnemies
(Note: This coincides with the in-game description)_pIEnAc
->armorPierce
_pIFMinDam
->minFireDamage
_pIFMaxDam
->maxFireDamage
_pILMinDam
->minLightningDamage
_pILMaxDam
->maxLightningDamage
_pExperience
->experience
_pmode
->mode
walkpath
->walkPath
plractive
->isPlayerActive
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)destAction
->destinationAction
destParam1
->destinationParam1
destParam2
->destinationParam2
destParam3
->destinationParam3
destParam4
->destinationParam4
_pGold
->gold
AnimInfo
->animationInfo
previewCelSprite
progressToNextGameTickWhenPreviewWasSet
_pIFlags
->itemFlags
AnimationData
->animationData
_pNFrames
->numIdleFrames
_pWFrames
->numWalkFrames
_pAFrames
->numAttackFrames
_pAFNum
->attackActionFrame
_pSFrames
->numSpellFrames
_pSFNum
->spellActionFrame
_pHFrames
->numRecoveryFrames
_pDFrames
->numDeathFrames
_pBFrames
->numBlockFrames
InvGrid
->inventoryGrid
plrlevel
->dungeonLevel
plrIsOnSetLevel
->isOnSetLevel
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)position
_pdir
->direction
_pClass
->heroClass
(Note: Cannot use "class")_pLevel
->characterLevel
(Note: Good to differentiate character level with dungeon level)_pgfxnum
->graphicNum
_pISplLvlAdd
->bonusSpellLevel
friendlyMode
->isFriendly
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)queuedSpell
executedSpell
inventorySpell
spellFrom
_pRSpell
->selectedSpell
_pRSplType
->selectedSpellType
_pSBkSpell
-> REMOVED (Note: unused)_pSplLvl
->spellLevel
_pISpells
->staffSpells
_pMemSpells
->learnedSpells
_pAblSpells
->skills
_pScrlSpells
->scrollSpells
_pSpellFlags
->spellFlags
_pSplHotKey
->hotkeySpell
_pSplTHotKey
->hotkeySpellType
_pBlockFlag
->hasBlockFlag
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)_pInvincible
->isInvincible
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)_pLightRad
->lightRadius
_pLvlChanging
->isChangingLevel
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)_pArmorClass
-> REMOVED (Note: unused)_pMagResist
->resistMagic
_pFireResist
->resistFire
_pLghtResist
->resistLightning
_pInfraFlag
->hasInfravisionFlag
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)tempDirection
_pLvlVisited
->isLevelVisited
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)_pSLvlVisited
->isSetLevelVisited
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)_pOilType
->oilType
pTownWarps
->townWarps
pDungMsgs
->dungeonMessages
pLvlLoad
->levelLoading
pManaShield
->hasManaShield
(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)pDungMsgs2
->dungeonMessages2
pOriginalCathedral
->originalCathedral
(Note: consistent boolean naming convention wouldn't make sense here)pDiabloKillLevel
->difficultyCompletion
wReflections
->reflections
pDamAcFlags
->hellfireItemFlags
Beta Was this translation helpful? Give feedback.
All reactions