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.
Uh oh!
There was an error while loading. Please reload this page.
-
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->nameInvBody->bodySlotInvList->inventorySlotSpdList->beltSlotHoldItem->heldItemlightId_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->modewalkpath->walkPathplractive->isPlayerActive(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)destAction->destinationActiondestParam1->destinationParam1destParam2->destinationParam2destParam3->destinationParam3destParam4->destinationParam4_pGold->goldAnimInfo->animationInfopreviewCelSpriteprogressToNextGameTickWhenPreviewWasSet_pIFlags->itemFlagsAnimationData->animationData_pNFrames->numIdleFrames_pWFrames->numWalkFrames_pAFrames->numAttackFrames_pAFNum->attackActionFrame_pSFrames->numSpellFrames_pSFNum->spellActionFrame_pHFrames->numRecoveryFrames_pDFrames->numDeathFrames_pBFrames->numBlockFramesInvGrid->inventoryGridplrlevel->dungeonLevelplrIsOnSetLevel->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->bonusSpellLevelfriendlyMode->isFriendly(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)queuedSpellexecutedSpellinventorySpellspellFrom_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->oilTypepTownWarps->townWarpspDungMsgs->dungeonMessagespLvlLoad->levelLoadingpManaShield->hasManaShield(Note: this is a boolean, so variable name should indicate as such for consistency in this codebase)pDungMsgs2->dungeonMessages2pOriginalCathedral->originalCathedral(Note: consistent boolean naming convention wouldn't make sense here)pDiabloKillLevel->difficultyCompletionwReflections->reflectionspDamAcFlags->hellfireItemFlagsBeta Was this translation helpful? Give feedback.
All reactions