Player struct variable name revision #7302
Replies: 1 comment 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.
-
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