ACTION_WALK=-2,// Automatic walk when using gamepad
ACTION_NONE=-1,
ACTION_ATTACK=9,
ACTION_RATTACK=10,
ACTION_SPELL=12,
ACTION_OPERATE=13,
ACTION_DISARM=14,
ACTION_PICKUPITEM=15,// put item in hand (inventory screen open)
ACTION_PICKUPAITEM=16,// put item in inventory
ACTION_TALK=17,
ACTION_OPERATETK=18,// operate via telekinesis
ACTION_ATTACKMON=20,
ACTION_ATTACKPLR=21,
ACTION_RATTACKMON=22,
ACTION_RATTACKPLR=23,
ACTION_SPELLMON=24,
ACTION_SPELLPLR=25,
ACTION_SPELLWALL=26,
// clang-format on
}action_id;
typedefenumplayer_weapon_type{
WT_MELEE,
WT_RANGED,
}player_weapon_type;
typedefstructPlayerStruct{
int_pmode;
charwalkpath[MAX_PATH_LENGTH];
BOOLEANplractive;
intdestAction;
intdestParam1;
intdestParam2;
intdestParam3;
intdestParam4;
intplrlevel;
int_px;// Tile X-position of player
int_py;// Tile Y-position of player
int_pfutx;// Future tile X-position of player. Set at start of walking animation
int_pfuty;// Future tile Y-position of player. Set at start of walking animation
int_ptargx;// Target tile X-position for player movment. Set during pathfinding
int_ptargy;// Target tile Y-position for player movment. Set during pathfinding
int_pownerx;// Tile X-position of player. Set via network on player input
int_pownery;// Tile X-position of player. Set via network on player input
int_poldx;// Most recent X-position in dPlayer.
int_poldy;// Most recent Y-position in dPlayer.
int_pxoff;// Player sprite's pixel X-offset from tile.
int_pyoff;// Player sprite's pixel Y-offset from tile.
int_pxvel;// Pixel X-velocity while walking. Indirectly applied to _pxoff via _pvar6
int_pyvel;// Pixel Y-velocity while walking. Indirectly applied to _pyoff via _pvar7
int_pdir;// Direction faced by player (direction enum)
int_pgfxnum;// Bitmask indicating what variant of the sprite the player is using. Lower byte define weapon (anim_weapon_id) and higher values define armour (starting with anim_armor_id)
unsignedchar*_pAnimData;
int_pAnimDelay;// Tick length of each frame in the current animation
int_pAnimCnt;// Increases by one each game tick, counting how close we are to _pAnimDelay
int_pAnimLen;// Number of frames in current animation
int_pAnimFrame;// Current frame of animation.
int_pAnimWidth;
int_pAnimWidth2;
int_peflag;
int_plid;
int_pvid;
int_pSpell;
char_pSplType;
char_pSplFrom;
int_pTSpell;
char_pTSplType;
int_pRSpell;
PLR_MODE_pmode;
Sint8walkpath[MAX_PATH_LENGTH];
boolplractive;
action_iddestAction;
Sint32destParam1;
Sint32destParam2;
directiondestParam3;
Sint32destParam4;
Sint32plrlevel;
Sint32_px;// Tile X-position of player
Sint32_py;// Tile Y-position of player
Sint32_pfutx;// Future tile X-position of player. Set at start of walking animation
Sint32_pfuty;// Future tile Y-position of player. Set at start of walking animation
Sint32_ptargx;// Target tile X-position for player movment. Set during pathfinding
Sint32_ptargy;// Target tile Y-position for player movment. Set during pathfinding
Sint32_pownerx;// Tile X-position of player. Set via network on player input
Sint32_pownery;// Tile X-position of player. Set via network on player input
Sint32_poldx;// Most recent X-position in dPlayer.
Sint32_poldy;// Most recent Y-position in dPlayer.
Sint32_pxoff;// Player sprite's pixel X-offset from tile.
Sint32_pyoff;// Player sprite's pixel Y-offset from tile.
Sint32_pxvel;// Pixel X-velocity while walking. Indirectly applied to _pxoff via _pvar6
Sint32_pyvel;// Pixel Y-velocity while walking. Indirectly applied to _pyoff via _pvar7
direction_pdir;// Direction faced by player (direction enum)
Sint32_pgfxnum;// Bitmask indicating what variant of the sprite the player is using. Lower byte define weapon (anim_weapon_id) and higher values define armour (starting with anim_armor_id)
Uint8*_pAnimData;
Sint32_pAnimDelay;// Tick length of each frame in the current animation
Sint32_pAnimCnt;// Increases by one each game tick, counting how close we are to _pAnimDelay
Sint32_pAnimLen;// Number of frames in current animation
Sint32_pAnimFrame;// Current frame of animation.
Sint32_pAnimWidth;
Sint32_pAnimWidth2;
Sint32_plid;
Sint32_pvid;
spell_id_pSpell;
spell_type_pSplType;
Sint8_pSplFrom;// TODO Create enum
spell_id_pTSpell;
spell_type_pTSplType;
spell_id_pRSpell;
// enum spell_type
char_pRSplType;
int_pSBkSpell;
char_pSBkSplType;
char_pSplLvl[64];
uint64_t_pMemSpells;// Bitmask of learned spells
uint64_t_pAblSpells;// Bitmask of abilities
uint64_t_pScrlSpells;// Bitmask of spells available via scrolls
UCHAR_pSpellFlags;
int_pSplHotKey[4];
char_pSplTHotKey[4];
int_pwtype;
BOOLEAN_pBlockFlag;
BOOLEAN_pInvincible;
char_pLightRad;
BOOLEAN_pLvlChanging;// True when the player is transitioning between levels
spell_type_pRSplType;
spell_id_pSBkSpell;
spell_type_pSBkSplType;
Sint8_pSplLvl[64];
Uint64_pMemSpells;// Bitmask of learned spells
Uint64_pAblSpells;// Bitmask of abilities
Uint64_pScrlSpells;// Bitmask of spells available via scrolls
Uint8_pSpellFlags;
spell_id_pSplHotKey[4];
spell_type_pSplTHotKey[4];
player_weapon_type_pwtype;
bool_pBlockFlag;
bool_pInvincible;
Sint8_pLightRad;
bool_pLvlChanging;// True when the player is transitioning between levels
char_pName[PLR_NAME_LEN];
// plr_class enum value.
// TODO: this could very well be `enum plr_class _pClass`
// since there are 3 bytes of alingment after this field.
// it could just be that the compiler optimized away all accesses to
// the higher bytes by using byte instructions, since all possible values
// of plr_class fit into one byte.
char_pClass;
int_pStrength;
int_pBaseStr;
int_pMagic;
int_pBaseMag;
int_pDexterity;
int_pBaseDex;
int_pVitality;
int_pBaseVit;
int_pStatPts;
int_pDamageMod;
int_pBaseToBlk;
int_pHPBase;
int_pMaxHPBase;
int_pHitPoints;
int_pMaxHP;
int_pHPPer;
int_pManaBase;
int_pMaxManaBase;
int_pMana;
int_pMaxMana;
int_pManaPer;
char_pLevel;
char_pMaxLvl;
int_pExperience;
int_pMaxExp;
int_pNextExper;
char_pArmorClass;
char_pMagResist;
char_pFireResist;
char_pLghtResist;
int_pGold;
BOOL_pInfraFlag;
int_pVar1;// Used for referring to X-position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks)
int_pVar2;// Used for referring to Y-position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks)
int_pVar3;// Player's direction when ending movement. Also used for casting direction of SPL_FIREWALL.
int_pVar4;// Used for storing X-position of a tile which should have its BFLAG_PLAYERLR flag removed after walking. When starting to walk the game places the player in the dPlayer array -1 in the Y coordinate, and uses BFLAG_PLAYERLR to check if it should be using -1 to the Y coordinate when rendering the player (also used for storing the level of a spell when the player casts it)
int_pVar5;// Used for storing Y-position of a tile which should have its BFLAG_PLAYERLR flag removed after walking. When starting to walk the game places the player in the dPlayer array -1 in the Y coordinate, and uses BFLAG_PLAYERLR to check if it should be using -1 to the Y coordinate when rendering the player (also used for storing the level of a spell when the player casts it)
int_pVar6;// Same as _pxoff but contains the value in a higher range
int_pVar7;// Same as _pyoff but contains the value in a higher range
int_pVar8;// Used for counting how close we are to reaching the next tile when walking (usually counts to 8, which is equal to the walk animation length). Also used for stalling the appearance of the options screen after dying in singleplayer
Sint32_pVar1;// Used for referring to X-position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks)
Sint32_pVar2;// Used for referring to Y-position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks)
direction_pVar3;// Player's direction when ending movement. Also used for casting direction of SPL_FIREWALL.
Sint32_pVar4;// Used for storing X-position of a tile which should have its BFLAG_PLAYERLR flag removed after walking. When starting to walk the game places the player in the dPlayer array -1 in the Y coordinate, and uses BFLAG_PLAYERLR to check if it should be using -1 to the Y coordinate when rendering the player (also used for storing the level of a spell when the player casts it)
Sint32_pVar5;// Used for storing Y-position of a tile which should have its BFLAG_PLAYERLR flag removed after walking. When starting to walk the game places the player in the dPlayer array -1 in the Y coordinate, and uses BFLAG_PLAYERLR to check if it should be using -1 to the Y coordinate when rendering the player (also used for storing the level of a spell when the player casts it)
Sint32_pVar6;// Same as _pxoff but contains the value in a higher range
Sint32_pVar7;// Same as _pyoff but contains the value in a higher range
Sint32_pVar8;// Used for counting how close we are to reaching the next tile when walking (usually counts to 8, which is equal to the walk animation length). Also used for stalling the appearance of the options screen after dying in singleplayer