mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-10-12 02:13:06 +00:00
Rename player globals
This commit is contained in:
+4
-4
@@ -209,7 +209,7 @@ void DrawAutomapTile(const Surface &out, Point center, uint16_t automapType)
|
||||
|
||||
void SearchAutomapItem(const Surface &out)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
Point tile = myPlayer.position.tile;
|
||||
if (myPlayer._pmode == PM_WALK3) {
|
||||
tile = myPlayer.position.future;
|
||||
@@ -257,7 +257,7 @@ void DrawAutomapPlr(const Surface &out, int playerId)
|
||||
{
|
||||
int playerColor = MapColorsPlayer + (8 * playerId) % 128;
|
||||
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
Point tile = player.position.tile;
|
||||
if (player._pmode == PM_WALK3) {
|
||||
tile = player.position.future;
|
||||
@@ -617,8 +617,8 @@ void DrawAutomap(const Surface &out)
|
||||
}
|
||||
|
||||
for (int playerId = 0; playerId < MAX_PLRS; playerId++) {
|
||||
auto &player = plr[playerId];
|
||||
if (player.plrlevel == plr[myplr].plrlevel && player.plractive && !player._pLvlChanging) {
|
||||
auto &player = Players[playerId];
|
||||
if (player.plrlevel == Players[MyPlayerId].plrlevel && player.plractive && !player._pLvlChanging) {
|
||||
DrawAutomapPlr(out, playerId);
|
||||
}
|
||||
}
|
||||
|
||||
+32
-32
@@ -303,14 +303,14 @@ void SetSpellTrans(spell_type t)
|
||||
|
||||
void DrawSpell(const Surface &out)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
spell_id spl = myPlayer._pRSpell;
|
||||
spell_type st = myPlayer._pRSplType;
|
||||
|
||||
// BUGFIX: Move the next line into the if statement to avoid OOB (SPL_INVALID is -1) (fixed)
|
||||
if (st == RSPLTYPE_SPELL && spl != SPL_INVALID) {
|
||||
int tlvl = myPlayer._pISplLvlAdd + myPlayer._pSplLvl[spl];
|
||||
if (!CheckSpell(myplr, spl, st, true))
|
||||
if (!CheckSpell(MyPlayerId, spl, st, true))
|
||||
st = RSPLTYPE_INVALID;
|
||||
if (tlvl <= 0)
|
||||
st = RSPLTYPE_INVALID;
|
||||
@@ -350,7 +350,7 @@ void DrawSpellList(const Surface &out)
|
||||
ClearPanel();
|
||||
|
||||
for (int i = RSPLTYPE_SKILL; i < RSPLTYPE_INVALID; i++) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
switch ((spell_type)i) {
|
||||
case RSPLTYPE_SKILL:
|
||||
SetSpellTrans(RSPLTYPE_SKILL);
|
||||
@@ -476,7 +476,7 @@ void SetSpell()
|
||||
|
||||
ClearPanel();
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
myPlayer._pRSpell = pSpell;
|
||||
myPlayer._pRSplType = pSplType;
|
||||
|
||||
@@ -488,7 +488,7 @@ void SetSpeedSpell(int slot)
|
||||
if (pSpell == SPL_INVALID) {
|
||||
return;
|
||||
}
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (myPlayer._pSplHotKey[i] == pSpell && myPlayer._pSplTHotKey[i] == pSplType)
|
||||
myPlayer._pSplHotKey[i] = SPL_INVALID;
|
||||
@@ -501,7 +501,7 @@ void ToggleSpell(int slot)
|
||||
{
|
||||
uint64_t spells;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pSplHotKey[slot] == SPL_INVALID) {
|
||||
return;
|
||||
@@ -625,31 +625,31 @@ void DrawFlaskLower(const Surface &out, const Surface &sourceBuffer, int offset,
|
||||
void DrawLifeFlaskUpper(const Surface &out)
|
||||
{
|
||||
constexpr int LifeFlaskUpperOffset = 109;
|
||||
DrawFlaskUpper(out, pLifeBuff, LifeFlaskUpperOffset, plr[myplr]._pHPPer);
|
||||
DrawFlaskUpper(out, pLifeBuff, LifeFlaskUpperOffset, Players[MyPlayerId]._pHPPer);
|
||||
}
|
||||
|
||||
void DrawManaFlaskUpper(const Surface &out)
|
||||
{
|
||||
constexpr int ManaFlaskUpperOffset = 475;
|
||||
DrawFlaskUpper(out, pManaBuff, ManaFlaskUpperOffset, plr[myplr]._pManaPer);
|
||||
DrawFlaskUpper(out, pManaBuff, ManaFlaskUpperOffset, Players[MyPlayerId]._pManaPer);
|
||||
}
|
||||
|
||||
void DrawLifeFlaskLower(const Surface &out)
|
||||
{
|
||||
constexpr int LifeFlaskLowerOffset = 96;
|
||||
DrawFlaskLower(out, pLifeBuff, LifeFlaskLowerOffset, plr[myplr]._pHPPer);
|
||||
DrawFlaskLower(out, pLifeBuff, LifeFlaskLowerOffset, Players[MyPlayerId]._pHPPer);
|
||||
}
|
||||
|
||||
void DrawManaFlaskLower(const Surface &out)
|
||||
{
|
||||
constexpr int ManaFlaskLowerOffeset = 464;
|
||||
DrawFlaskLower(out, pManaBuff, ManaFlaskLowerOffeset, plr[myplr]._pManaPer);
|
||||
DrawFlaskLower(out, pManaBuff, ManaFlaskLowerOffeset, Players[MyPlayerId]._pManaPer);
|
||||
}
|
||||
|
||||
void control_update_life_mana()
|
||||
{
|
||||
plr[myplr].UpdateManaPercentage();
|
||||
plr[myplr].UpdateHitPointPercentage();
|
||||
Players[MyPlayerId].UpdateManaPercentage();
|
||||
Players[MyPlayerId].UpdateHitPointPercentage();
|
||||
}
|
||||
|
||||
void InitControlPan()
|
||||
@@ -716,7 +716,7 @@ void InitControlPan()
|
||||
sbooktab = 0;
|
||||
sbookflag = false;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pClass == HeroClass::Warrior) {
|
||||
SpellPages[0][0] = SPL_REPAIR;
|
||||
@@ -774,7 +774,7 @@ void DoSpeedBook()
|
||||
int x = xo + SPLICONLENGTH / 2;
|
||||
int y = yo - SPLICONLENGTH / 2;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pRSpell != SPL_INVALID) {
|
||||
for (int i = RSPLTYPE_SKILL; i <= RSPLTYPE_CHARGES; i++) {
|
||||
@@ -838,7 +838,7 @@ void DoPanBtn()
|
||||
}
|
||||
if (!spselflag && MousePosition.x >= 565 + PANEL_LEFT && MousePosition.x < 621 + PANEL_LEFT && MousePosition.y >= 64 + PANEL_TOP && MousePosition.y < 120 + PANEL_TOP) {
|
||||
if ((SDL_GetModState() & KMOD_SHIFT) != 0) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
myPlayer._pRSpell = SPL_INVALID;
|
||||
myPlayer._pRSplType = RSPLTYPE_INVALID;
|
||||
force_redraw = 255;
|
||||
@@ -924,7 +924,7 @@ void CheckPanelInfo()
|
||||
pinfoflag = true;
|
||||
strcpy(tempstr, _("Hotkey: 's'"));
|
||||
AddPanelString(tempstr);
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
spell_id v = myPlayer._pRSpell;
|
||||
if (v != SPL_INVALID) {
|
||||
switch (myPlayer._pRSplType) {
|
||||
@@ -1112,7 +1112,7 @@ void DrawInfoBox(const Surface &out)
|
||||
if (spselflag || trigflag) {
|
||||
infoclr = UIS_SILVER;
|
||||
} else if (pcurs >= CURSOR_FIRSTITEM) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
if (myPlayer.HoldItem._itype == ITYPE_GOLD) {
|
||||
int nGold = myPlayer.HoldItem._ivalue;
|
||||
strcpy(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold).c_str());
|
||||
@@ -1151,7 +1151,7 @@ void DrawInfoBox(const Surface &out)
|
||||
}
|
||||
if (pcursplr != -1) {
|
||||
infoclr = UIS_GOLD;
|
||||
auto &target = plr[pcursplr];
|
||||
auto &target = Players[pcursplr];
|
||||
strcpy(infostr, target._pName);
|
||||
ClearPanel();
|
||||
strcpy(tempstr, fmt::format(_("{:s}, Level: {:d}"), _(ClassStrTbl[static_cast<std::size_t>(target._pClass)]), target._pLevel).c_str());
|
||||
@@ -1169,7 +1169,7 @@ void DrawChr(const Surface &out)
|
||||
uint32_t style = UIS_SILVER;
|
||||
char chrstr[64];
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
CelDrawTo(out, { 0, 351 }, *pChrPanel, 1);
|
||||
DrawString(out, myPlayer._pName, { { 20, 32 }, { 131, 0 } }, UIS_SILVER | UIS_CENTER);
|
||||
@@ -1395,7 +1395,7 @@ void DrawLevelUpIcon(const Surface &out)
|
||||
|
||||
void CheckChrBtns()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (chrbtnactive || myPlayer._pStatPts == 0)
|
||||
return;
|
||||
@@ -1447,7 +1447,7 @@ void ReleaseChrBtns(bool addAllStatPoints)
|
||||
|
||||
chrbtn[buttonId] = false;
|
||||
if (ChrBtnsRect[buttonId].Contains(MousePosition)) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
int statPointsToAdd = 1;
|
||||
if (addAllStatPoints)
|
||||
statPointsToAdd = CapStatPointsToAdd(myPlayer._pStatPts, myPlayer, attribute);
|
||||
@@ -1523,7 +1523,7 @@ void DrawDurIcon(const Surface &out)
|
||||
x -= SPANEL_WIDTH - (gnScreenWidth - PANEL_WIDTH) / 2;
|
||||
}
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
x = DrawDurIcon4Item(out, &myPlayer.InvBody[INVLOC_HEAD], x, 4);
|
||||
x = DrawDurIcon4Item(out, &myPlayer.InvBody[INVLOC_CHEST], x, 3);
|
||||
x = DrawDurIcon4Item(out, &myPlayer.InvBody[INVLOC_HAND_LEFT], x, 0);
|
||||
@@ -1550,7 +1550,7 @@ static void PrintSBookStr(const Surface &out, Point position, const char *text)
|
||||
|
||||
spell_type GetSBookTrans(spell_id ii, bool townok)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
if ((myPlayer._pClass == HeroClass::Monk) && (ii == SPL_SEARCH))
|
||||
return RSPLTYPE_SKILL;
|
||||
spell_type st = RSPLTYPE_SPELL;
|
||||
@@ -1561,7 +1561,7 @@ spell_type GetSBookTrans(spell_id ii, bool townok)
|
||||
st = RSPLTYPE_SKILL;
|
||||
}
|
||||
if (st == RSPLTYPE_SPELL) {
|
||||
if (!CheckSpell(myplr, ii, st, true)) {
|
||||
if (!CheckSpell(MyPlayerId, ii, st, true)) {
|
||||
st = RSPLTYPE_INVALID;
|
||||
}
|
||||
if ((char)(myPlayer._pSplLvl[ii] + myPlayer._pISplLvlAdd) <= 0) {
|
||||
@@ -1588,7 +1588,7 @@ void DrawSpellBook(const Surface &out)
|
||||
}
|
||||
CelDrawTo(out, { sx, 348 }, *pSBkBtnCel, sbooktab + 1);
|
||||
}
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
uint64_t spl = myPlayer._pMemSpells | myPlayer._pISpells | myPlayer._pAblSpells;
|
||||
|
||||
int yp = 55;
|
||||
@@ -1647,7 +1647,7 @@ void CheckSBook()
|
||||
{
|
||||
if (MousePosition.x >= RIGHT_PANEL + 11 && MousePosition.x < RIGHT_PANEL + 48 && MousePosition.y >= 18 && MousePosition.y < 314) {
|
||||
spell_id sn = SpellPages[sbooktab][(MousePosition.y - 18) / 43];
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
uint64_t spl = myPlayer._pMemSpells | myPlayer._pISpells | myPlayer._pAblSpells;
|
||||
if (sn != SPL_INVALID && (spl & GetSpellBitmask(sn)) != 0) {
|
||||
spell_type st = RSPLTYPE_SPELL;
|
||||
@@ -1713,7 +1713,7 @@ void control_drop_gold(char vkey)
|
||||
{
|
||||
char input[6];
|
||||
|
||||
if (plr[myplr]._pHitPoints >> 6 <= 0) {
|
||||
if (Players[MyPlayerId]._pHitPoints >> 6 <= 0) {
|
||||
dropGoldFlag = false;
|
||||
dropGoldValue = 0;
|
||||
return;
|
||||
@@ -1723,7 +1723,7 @@ void control_drop_gold(char vkey)
|
||||
snprintf(input, sizeof(input), "%i", dropGoldValue);
|
||||
if (vkey == DVL_VK_RETURN) {
|
||||
if (dropGoldValue > 0)
|
||||
control_remove_gold(myplr, initialDropGoldIndex);
|
||||
control_remove_gold(MyPlayerId, initialDropGoldIndex);
|
||||
dropGoldFlag = false;
|
||||
} else if (vkey == DVL_VK_ESCAPE) {
|
||||
dropGoldFlag = false;
|
||||
@@ -1751,7 +1751,7 @@ static void ControlSetGoldCurs(PlayerStruct &player)
|
||||
|
||||
void control_remove_gold(int pnum, int goldIndex)
|
||||
{
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
int gi = goldIndex - INVITEM_INV_FIRST;
|
||||
player.InvList[gi]._ivalue -= dropGoldValue;
|
||||
@@ -1795,7 +1795,7 @@ void DrawTalkPan(const Surface &out)
|
||||
x += 46;
|
||||
int talkBtn = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (i == myplr)
|
||||
if (i == MyPlayerId)
|
||||
continue;
|
||||
|
||||
uint16_t color = UIS_RED;
|
||||
@@ -1812,7 +1812,7 @@ void DrawTalkPan(const Surface &out)
|
||||
nCel += 4;
|
||||
CelDrawTo(out, talkPanPosition, *talkButtons, nCel);
|
||||
}
|
||||
auto &player = plr[i];
|
||||
auto &player = Players[i];
|
||||
if (player.plractive) {
|
||||
DrawString(out, player._pName, { { x, y + 60 + talkBtn * 18 }, { 204, 0 } }, color);
|
||||
}
|
||||
@@ -1859,7 +1859,7 @@ void control_release_talk_btn()
|
||||
|
||||
int p = 0;
|
||||
for (; p < MAX_PLRS && off != -1; p++) {
|
||||
if (p != myplr)
|
||||
if (p != MyPlayerId)
|
||||
off--;
|
||||
}
|
||||
if (p <= MAX_PLRS)
|
||||
|
||||
@@ -40,7 +40,7 @@ bool InGameMenu()
|
||||
|| qtextflag
|
||||
|| gmenu_is_active()
|
||||
|| PauseMode == 2
|
||||
|| plr[myplr]._pInvincible;
|
||||
|| Players[MyPlayerId]._pInvincible;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -54,7 +54,7 @@ int slot = SLOTXY_INV_FIRST;
|
||||
*/
|
||||
int GetRotaryDistance(Point destination)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer.position.future == destination)
|
||||
return -1;
|
||||
@@ -75,7 +75,7 @@ int GetRotaryDistance(Point destination)
|
||||
*/
|
||||
int GetMinDistance(Point position)
|
||||
{
|
||||
return plr[myplr].position.future.WalkingDistance(position);
|
||||
return Players[MyPlayerId].position.future.WalkingDistance(position);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ int GetDistance(Point destination, int maxDistance)
|
||||
}
|
||||
|
||||
int8_t walkpath[MAX_PATH_LENGTH];
|
||||
int steps = FindPath(PosOkPlayer, myplr, plr[myplr].position.future.x, plr[myplr].position.future.y, destination.x, destination.y, walkpath);
|
||||
int steps = FindPath(PosOkPlayer, MyPlayerId, Players[MyPlayerId].position.future.x, Players[MyPlayerId].position.future.y, destination.x, destination.y, walkpath);
|
||||
if (steps > maxDistance)
|
||||
return 0;
|
||||
|
||||
@@ -104,7 +104,7 @@ int GetDistance(Point destination, int maxDistance)
|
||||
*/
|
||||
int GetDistanceRanged(Point destination)
|
||||
{
|
||||
return plr[myplr].position.future.ExactDistance(destination);
|
||||
return Players[MyPlayerId].position.future.ExactDistance(destination);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,8 +114,8 @@ int GetDistanceRanged(Point destination)
|
||||
*/
|
||||
void FindItemOrObject()
|
||||
{
|
||||
int mx = plr[myplr].position.future.x;
|
||||
int my = plr[myplr].position.future.y;
|
||||
int mx = Players[MyPlayerId].position.future.x;
|
||||
int my = Players[MyPlayerId].position.future.y;
|
||||
int rotations = 5;
|
||||
|
||||
// As the player can not stand on the edge of the map this is safe from OOB
|
||||
@@ -176,7 +176,7 @@ void CheckTownersNearby()
|
||||
|
||||
bool HasRangedSpell()
|
||||
{
|
||||
int spl = plr[myplr]._pRSpell;
|
||||
int spl = Players[MyPlayerId]._pRSpell;
|
||||
|
||||
return spl != SPL_INVALID
|
||||
&& spl != SPL_TOWN
|
||||
@@ -247,8 +247,8 @@ void FindMeleeTarget()
|
||||
std::list<SearchNode> queue;
|
||||
|
||||
{
|
||||
const int startX = plr[myplr].position.future.x;
|
||||
const int startY = plr[myplr].position.future.y;
|
||||
const int startX = Players[MyPlayerId].position.future.x;
|
||||
const int startY = Players[MyPlayerId].position.future.y;
|
||||
visited[startX][startY] = true;
|
||||
queue.push_back({ startX, startY, 0 });
|
||||
}
|
||||
@@ -269,7 +269,7 @@ void FindMeleeTarget()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!PosOkPlayer(myplr, { dx, dy })) {
|
||||
if (!PosOkPlayer(MyPlayerId, { dx, dy })) {
|
||||
visited[dx][dy] = true;
|
||||
|
||||
if (dMonster[dx][dy] != 0) {
|
||||
@@ -305,7 +305,7 @@ void FindMeleeTarget()
|
||||
|
||||
void CheckMonstersNearby()
|
||||
{
|
||||
if (plr[myplr]._pwtype == WT_RANGED || HasRangedSpell()) {
|
||||
if (Players[MyPlayerId]._pwtype == WT_RANGED || HasRangedSpell()) {
|
||||
FindRangedTarget();
|
||||
return;
|
||||
}
|
||||
@@ -322,16 +322,16 @@ void CheckPlayerNearby()
|
||||
if (pcursmonst != -1)
|
||||
return;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int spl = myPlayer._pRSpell;
|
||||
if (gbFriendlyMode && spl != SPL_RESURRECT && spl != SPL_HEALOTHER)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < MAX_PLRS; i++) {
|
||||
if (i == myplr)
|
||||
if (i == MyPlayerId)
|
||||
continue;
|
||||
const auto &player = plr[i];
|
||||
const auto &player = Players[i];
|
||||
const int mx = player.position.future.x;
|
||||
const int my = player.position.future.y;
|
||||
if (dPlayer[mx][my] == 0
|
||||
@@ -442,13 +442,13 @@ void Interact()
|
||||
if (leveltype == DTYPE_TOWN && pcursmonst != -1) {
|
||||
NetSendCmdLocParam1(true, CMD_TALKXY, towners[pcursmonst].position, pcursmonst);
|
||||
} else if (pcursmonst != -1) {
|
||||
if (plr[myplr]._pwtype != WT_RANGED || CanTalkToMonst(pcursmonst)) {
|
||||
if (Players[MyPlayerId]._pwtype != WT_RANGED || CanTalkToMonst(pcursmonst)) {
|
||||
NetSendCmdParam1(true, CMD_ATTACKID, pcursmonst);
|
||||
} else {
|
||||
NetSendCmdParam1(true, CMD_RATTACKID, pcursmonst);
|
||||
}
|
||||
} else if (leveltype != DTYPE_TOWN && pcursplr != -1 && !gbFriendlyMode) {
|
||||
NetSendCmdParam1(true, plr[myplr]._pwtype == WT_RANGED ? CMD_RATTACKPID : CMD_ATTACKPID, pcursplr);
|
||||
NetSendCmdParam1(true, Players[MyPlayerId]._pwtype == WT_RANGED ? CMD_RATTACKPID : CMD_ATTACKPID, pcursplr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ void AttrIncBtnSnap(AxisDirection dir)
|
||||
if (dir.y == AxisDirectionY_NONE)
|
||||
return;
|
||||
|
||||
if (chrbtnactive && plr[myplr]._pStatPts <= 0)
|
||||
if (chrbtnactive && Players[MyPlayerId]._pStatPts <= 0)
|
||||
return;
|
||||
|
||||
// first, find our cursor location
|
||||
@@ -576,7 +576,7 @@ Size GetItemSizeOnSlot(int slot, char &itemInvId)
|
||||
{
|
||||
if (slot >= SLOTXY_INV_FIRST && slot <= SLOTXY_INV_LAST) {
|
||||
int ig = slot - SLOTXY_INV_FIRST;
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
char ii = myPlayer.InvGrid[ig];
|
||||
if (ii != 0) {
|
||||
int iv = ii;
|
||||
@@ -614,7 +614,7 @@ void ResetInvCursorPosition()
|
||||
// search the 'first slot' for that item in the inventory, it should have the positive number of that same InvId
|
||||
if (itemInvId < 0) {
|
||||
for (int s = 0; s < SLOTXY_INV_LAST - SLOTXY_INV_FIRST; ++s) {
|
||||
if (plr[myplr].InvGrid[s] == -itemInvId) {
|
||||
if (Players[MyPlayerId].InvGrid[s] == -itemInvId) {
|
||||
slot = SLOTXY_INV_FIRST + s;
|
||||
break;
|
||||
}
|
||||
@@ -670,7 +670,7 @@ void InvMove(AxisDirection dir)
|
||||
slot = SLOTXY_BELT_LAST;
|
||||
|
||||
const int initialSlot = slot;
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
// when item is on cursor (pcurs > 1), this is the real cursor XY
|
||||
if (dir.x == AxisDirectionX_LEFT) {
|
||||
@@ -952,7 +952,7 @@ void HotSpellMove(AxisDirection dir)
|
||||
if (dir.x == AxisDirectionX_NONE && dir.y == AxisDirectionY_NONE)
|
||||
return;
|
||||
|
||||
int spbslot = plr[myplr]._pRSpell;
|
||||
int spbslot = Players[MyPlayerId]._pRSpell;
|
||||
for (int r = 0; r < speedspellcount; r++) {
|
||||
if (MousePosition.x >= speedspellscoords[r].x - SPLICONLENGTH / 2
|
||||
&& MousePosition.x < speedspellscoords[r].x + SPLICONLENGTH / 2
|
||||
@@ -1053,7 +1053,7 @@ bool IsPathBlocked(Point position, Direction dir)
|
||||
if (!nSolidTable[dPiece[leftStep.x][leftStep.y]] && !nSolidTable[dPiece[rightStep.x][rightStep.y]])
|
||||
return false;
|
||||
|
||||
return !PosOkPlayer(myplr, leftStep) && !PosOkPlayer(myplr, rightStep);
|
||||
return !PosOkPlayer(MyPlayerId, leftStep) && !PosOkPlayer(MyPlayerId, rightStep);
|
||||
}
|
||||
|
||||
bool CanChangeDirection(const PlayerStruct &player)
|
||||
@@ -1071,7 +1071,7 @@ bool CanChangeDirection(const PlayerStruct &player)
|
||||
|
||||
void WalkInDir(int playerId, AxisDirection dir)
|
||||
{
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
|
||||
if (dir.x == AxisDirectionX_NONE && dir.y == AxisDirectionY_NONE) {
|
||||
if (sgbControllerActive && player.walkpath[0] != WALK_NONE && player.destAction == ACTION_NONE)
|
||||
@@ -1118,7 +1118,7 @@ HandleLeftStickOrDPadFn GetLeftStickOrDPadGameUIHandler()
|
||||
if (invflag) {
|
||||
return &InvMove;
|
||||
}
|
||||
if (chrflag && plr[myplr]._pStatPts > 0) {
|
||||
if (chrflag && Players[MyPlayerId]._pStatPts > 0) {
|
||||
return &AttrIncBtnSnap;
|
||||
}
|
||||
if (spselflag) {
|
||||
@@ -1207,7 +1207,7 @@ void StoreSpellCoords()
|
||||
int yo = endY;
|
||||
for (int i = RSPLTYPE_SKILL; i <= RSPLTYPE_CHARGES; i++) {
|
||||
std::uint64_t spells;
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
switch (i) {
|
||||
case RSPLTYPE_SKILL:
|
||||
spells = myPlayer._pAblSpells;
|
||||
@@ -1315,7 +1315,7 @@ void plrctrls_after_check_curs_move()
|
||||
pcursquest = -1;
|
||||
cursmx = -1;
|
||||
cursmy = -1;
|
||||
if (plr[myplr]._pInvincible) {
|
||||
if (Players[MyPlayerId]._pInvincible) {
|
||||
return;
|
||||
}
|
||||
if (DoomFlag) {
|
||||
@@ -1339,20 +1339,20 @@ void plrctrls_every_frame()
|
||||
|
||||
void plrctrls_after_game_logic()
|
||||
{
|
||||
Movement(myplr);
|
||||
Movement(MyPlayerId);
|
||||
}
|
||||
|
||||
void UseBeltItem(int type)
|
||||
{
|
||||
for (int i = 0; i < MAXBELTITEMS; i++) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
const int id = AllItemsList[myPlayer.SpdList[i].IDidx].iMiscId;
|
||||
const int spellId = AllItemsList[myPlayer.SpdList[i].IDidx].iSpell;
|
||||
if ((type == BLT_HEALING && (id == IMISC_HEAL || id == IMISC_FULLHEAL || (id == IMISC_SCROLL && spellId == SPL_HEAL)))
|
||||
|| (type == BLT_MANA && (id == IMISC_MANA || id == IMISC_FULLMANA))
|
||||
|| id == IMISC_REJUV || id == IMISC_FULLREJUV) {
|
||||
if (myPlayer.SpdList[i]._itype > -1) {
|
||||
UseInvItem(myplr, INVITEM_BELT_FIRST + i);
|
||||
UseInvItem(MyPlayerId, INVITEM_BELT_FIRST + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1376,7 +1376,7 @@ void PerformPrimaryAction()
|
||||
return;
|
||||
}
|
||||
|
||||
if (chrflag && !chrbtnactive && plr[myplr]._pStatPts > 0) {
|
||||
if (chrflag && !chrbtnactive && Players[MyPlayerId]._pStatPts > 0) {
|
||||
CheckChrBtns();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (ChrBtnsRect[i].Contains(MousePosition)) {
|
||||
@@ -1393,7 +1393,7 @@ void PerformPrimaryAction()
|
||||
|
||||
bool SpellHasActorTarget()
|
||||
{
|
||||
int spl = plr[myplr]._pRSpell;
|
||||
int spl = Players[MyPlayerId]._pRSpell;
|
||||
if (spl == SPL_TOWN || spl == SPL_TELEPORT)
|
||||
return false;
|
||||
|
||||
@@ -1414,10 +1414,10 @@ void UpdateSpellTarget()
|
||||
pcursmonst = -1;
|
||||
|
||||
int range = 1;
|
||||
if (plr[myplr]._pRSpell == SPL_TELEPORT)
|
||||
if (Players[MyPlayerId]._pRSpell == SPL_TELEPORT)
|
||||
range = 4;
|
||||
|
||||
auto cursm = plr[myplr].position.future + Displacement::fromDirection(plr[myplr]._pdir) * range;
|
||||
auto cursm = Players[MyPlayerId].position.future + Displacement::fromDirection(Players[MyPlayerId]._pdir) * range;
|
||||
cursmx = cursm.x;
|
||||
cursmy = cursm.y;
|
||||
}
|
||||
@@ -1427,7 +1427,7 @@ void UpdateSpellTarget()
|
||||
*/
|
||||
bool TryDropItem()
|
||||
{
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
cursmx = myPlayer.position.future.x + 1;
|
||||
cursmy = myPlayer.position.future.y;
|
||||
@@ -1469,7 +1469,7 @@ void PerformSpellAction()
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
int spl = myPlayer._pRSpell;
|
||||
if ((pcursplr == -1 && (spl == SPL_RESURRECT || spl == SPL_HEALOTHER))
|
||||
|| (pcursobj == -1 && spl == SPL_DISARM)) {
|
||||
@@ -1488,7 +1488,7 @@ void CtrlUseInvItem()
|
||||
if (pcursinvitem == -1)
|
||||
return;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (pcursinvitem <= INVITEM_INV_LAST)
|
||||
item = &myPlayer.InvList[pcursinvitem - INVITEM_INV_FIRST];
|
||||
@@ -1503,7 +1503,7 @@ void CtrlUseInvItem()
|
||||
CheckInvItem(true); // auto-equip if it's an equipment
|
||||
ResetInvCursorPosition();
|
||||
} else {
|
||||
UseInvItem(myplr, pcursinvitem);
|
||||
UseInvItem(MyPlayerId, pcursinvitem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1524,14 +1524,14 @@ void PerformSecondaryAction()
|
||||
} else if (pcursobj != -1) {
|
||||
NetSendCmdLocParam1(true, CMD_OPOBJXY, { cursmx, cursmy }, pcursobj);
|
||||
} else if (pcursmissile != -1) {
|
||||
MakePlrPath(myplr, missile[pcursmissile].position.tile, true);
|
||||
plr[myplr].destAction = ACTION_WALK;
|
||||
MakePlrPath(MyPlayerId, missile[pcursmissile].position.tile, true);
|
||||
Players[MyPlayerId].destAction = ACTION_WALK;
|
||||
} else if (pcurstrig != -1) {
|
||||
MakePlrPath(myplr, trigs[pcurstrig].position, true);
|
||||
plr[myplr].destAction = ACTION_WALK;
|
||||
MakePlrPath(MyPlayerId, trigs[pcurstrig].position, true);
|
||||
Players[MyPlayerId].destAction = ACTION_WALK;
|
||||
} else if (pcursquest != -1) {
|
||||
MakePlrPath(myplr, quests[pcursquest].position, true);
|
||||
plr[myplr].destAction = ACTION_WALK;
|
||||
MakePlrPath(MyPlayerId, quests[pcursquest].position, true);
|
||||
Players[MyPlayerId].destAction = ACTION_WALK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -192,7 +192,7 @@ void CelDrawCursor(const Surface &out, Point position, int cursId)
|
||||
const auto &sprite = GetInvItemSprite(cursId);
|
||||
const int frame = GetInvItemFrame(cursId);
|
||||
if (IsItemSprite(cursId)) {
|
||||
const auto &heldItem = plr[myplr].HoldItem;
|
||||
const auto &heldItem = Players[MyPlayerId].HoldItem;
|
||||
CelBlitOutlineTo(out, GetOutlineColor(heldItem, true), position, sprite, frame, false);
|
||||
CelDrawItem(heldItem, out, position, sprite, frame);
|
||||
} else {
|
||||
@@ -228,7 +228,7 @@ void CheckTown()
|
||||
trigflag = true;
|
||||
ClearPanel();
|
||||
strcpy(infostr, _("Town Portal"));
|
||||
strcpy(tempstr, fmt::format(_("from {:s}"), plr[missile[mx]._misource]._pName).c_str());
|
||||
strcpy(tempstr, fmt::format(_("from {:s}"), Players[missile[mx]._misource]._pName).c_str());
|
||||
AddPanelString(tempstr);
|
||||
cursmx = missile[mx].position.tile.x;
|
||||
cursmy = missile[mx].position.tile.y;
|
||||
@@ -300,7 +300,7 @@ void CheckCursMove()
|
||||
int xo = 0;
|
||||
int yo = 0;
|
||||
CalcTileOffset(&xo, &yo);
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
Displacement offset = ScrollInfo.offset;
|
||||
if (myPlayer.IsWalking())
|
||||
offset = GetOffsetForWalking(myPlayer.AnimInfo, myPlayer._pdir, true);
|
||||
@@ -574,7 +574,7 @@ void CheckCursMove()
|
||||
if (pcursmonst == -1) {
|
||||
if (!flipflag && mx + 1 < MAXDUNX && dPlayer[mx + 1][my] != 0) {
|
||||
int8_t bv = dPlayer[mx + 1][my] > 0 ? dPlayer[mx + 1][my] - 1 : -(dPlayer[mx + 1][my] + 1);
|
||||
if (bv != myplr && plr[bv]._pHitPoints != 0) {
|
||||
if (bv != MyPlayerId && Players[bv]._pHitPoints != 0) {
|
||||
cursmx = mx + 1;
|
||||
cursmy = my;
|
||||
pcursplr = bv;
|
||||
@@ -582,7 +582,7 @@ void CheckCursMove()
|
||||
}
|
||||
if (flipflag && my + 1 < MAXDUNY && dPlayer[mx][my + 1] != 0) {
|
||||
int8_t bv = dPlayer[mx][my + 1] > 0 ? dPlayer[mx][my + 1] - 1 : -(dPlayer[mx][my + 1] + 1);
|
||||
if (bv != myplr && plr[bv]._pHitPoints != 0) {
|
||||
if (bv != MyPlayerId && Players[bv]._pHitPoints != 0) {
|
||||
cursmx = mx;
|
||||
cursmy = my + 1;
|
||||
pcursplr = bv;
|
||||
@@ -590,7 +590,7 @@ void CheckCursMove()
|
||||
}
|
||||
if (dPlayer[mx][my] != 0) {
|
||||
int8_t bv = dPlayer[mx][my] > 0 ? dPlayer[mx][my] - 1 : -(dPlayer[mx][my] + 1);
|
||||
if (bv != myplr) {
|
||||
if (bv != MyPlayerId) {
|
||||
cursmx = mx;
|
||||
cursmy = my;
|
||||
pcursplr = bv;
|
||||
@@ -598,7 +598,7 @@ void CheckCursMove()
|
||||
}
|
||||
if ((dFlags[mx][my] & BFLAG_DEAD_PLAYER) != 0) {
|
||||
for (int i = 0; i < MAX_PLRS; i++) {
|
||||
if (plr[i].position.tile.x == mx && plr[i].position.tile.y == my && i != myplr) {
|
||||
if (Players[i].position.tile.x == mx && Players[i].position.tile.y == my && i != MyPlayerId) {
|
||||
cursmx = mx;
|
||||
cursmy = my;
|
||||
pcursplr = i;
|
||||
@@ -610,7 +610,7 @@ void CheckCursMove()
|
||||
for (int yy = -1; yy < 2; yy++) {
|
||||
if (mx + xx < MAXDUNX && my + yy < MAXDUNY && (dFlags[mx + xx][my + yy] & BFLAG_DEAD_PLAYER) != 0) {
|
||||
for (int i = 0; i < MAX_PLRS; i++) {
|
||||
if (plr[i].position.tile.x == mx + xx && plr[i].position.tile.y == my + yy && i != myplr) {
|
||||
if (Players[i].position.tile.x == mx + xx && Players[i].position.tile.y == my + yy && i != MyPlayerId) {
|
||||
cursmx = mx + xx;
|
||||
cursmy = my + yy;
|
||||
pcursplr = i;
|
||||
@@ -622,7 +622,7 @@ void CheckCursMove()
|
||||
}
|
||||
if (mx + 1 < MAXDUNX && my + 1 < MAXDUNY && dPlayer[mx + 1][my + 1] != 0) {
|
||||
int8_t bv = dPlayer[mx + 1][my + 1] > 0 ? dPlayer[mx + 1][my + 1] - 1 : -(dPlayer[mx + 1][my + 1] + 1);
|
||||
if (bv != myplr && plr[bv]._pHitPoints != 0) {
|
||||
if (bv != MyPlayerId && Players[bv]._pHitPoints != 0) {
|
||||
cursmx = mx + 1;
|
||||
cursmy = my + 1;
|
||||
pcursplr = bv;
|
||||
|
||||
+18
-18
@@ -53,7 +53,7 @@ void CheckDungeonClear()
|
||||
|
||||
void GiveGoldCheat()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (int8_t &itemId : myPlayer.InvGrid) {
|
||||
if (itemId != 0)
|
||||
@@ -71,7 +71,7 @@ void GiveGoldCheat()
|
||||
|
||||
void TakeGoldCheat()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (auto itemId : myPlayer.InvGrid) {
|
||||
itemId -= 1;
|
||||
@@ -89,7 +89,7 @@ void TakeGoldCheat()
|
||||
|
||||
void MaxSpellsCheat()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (int i = SPL_FIREBOLT; i < MAX_SPELLS; i++) {
|
||||
if (GetSpellBookLevel((spell_id)i) != -1) {
|
||||
@@ -101,7 +101,7 @@ void MaxSpellsCheat()
|
||||
|
||||
void SetSpellLevelCheat(spell_id spl, int spllvl)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
myPlayer._pMemSpells |= GetSpellBitmask(spl);
|
||||
myPlayer._pSplLvl[spl] = spllvl;
|
||||
@@ -142,23 +142,23 @@ void PrintDebugPlayer(bool bNextPlayer)
|
||||
if (bNextPlayer)
|
||||
DebugPlayerId = ((BYTE)DebugPlayerId + 1) & 3;
|
||||
|
||||
auto &player = plr[DebugPlayerId];
|
||||
auto &player = Players[DebugPlayerId];
|
||||
|
||||
sprintf(dstr, "Plr %i : Active = %i", DebugPlayerId, player.plractive ? 1 : 0);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
|
||||
if (player.plractive) {
|
||||
sprintf(dstr, " Plr %i is %s", DebugPlayerId, player._pName);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
sprintf(dstr, " Lvl = %i : Change = %i", player.plrlevel, player._pLvlChanging ? 1 : 0);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
const Point target = player.GetTargetPosition();
|
||||
sprintf(dstr, " x = %i, y = %i : tx = %i, ty = %i", player.position.tile.x, player.position.tile.y, target.x, target.y);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
sprintf(dstr, " mode = %i : daction = %i : walk[0] = %i", player._pmode, player.destAction, player.walkpath[0]);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
sprintf(dstr, " inv = %i : hp = %i", player._pInvincible ? 1 : 0, player._pHitPoints);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ void PrintDebugQuest()
|
||||
char dstr[128];
|
||||
|
||||
sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", DebugQuestId, quests[DebugQuestId]._qactive, quests[DebugQuestId]._qvar1);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
|
||||
DebugQuestId++;
|
||||
if (DebugQuestId == MAXQUESTS)
|
||||
@@ -183,13 +183,13 @@ void PrintDebugMonster(int m)
|
||||
char dstr[128];
|
||||
|
||||
sprintf(dstr, "Monster %i = %s", m, _(Monsters[m].mName));
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
sprintf(dstr, "X = %i, Y = %i", Monsters[m].position.tile.x, Monsters[m].position.tile.y);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
sprintf(dstr, "Enemy = %i, HP = %i", Monsters[m]._menemy, Monsters[m]._mhitpoints);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
sprintf(dstr, "Mode = %i, Var1 = %i", Monsters[m]._mmode, Monsters[m]._mVar1);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
|
||||
bActive = false;
|
||||
|
||||
@@ -199,7 +199,7 @@ void PrintDebugMonster(int m)
|
||||
}
|
||||
|
||||
sprintf(dstr, "Active List = %i, Squelch = %i", bActive ? 1 : 0, Monsters[m]._msquelch);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
}
|
||||
|
||||
int DebugMonsterId;
|
||||
@@ -229,7 +229,7 @@ void NextDebugMonster()
|
||||
DebugMonsterId = 0;
|
||||
|
||||
sprintf(dstr, "Current debug monster = %i", DebugMonsterId);
|
||||
NetSendCmdString(1 << myplr, dstr);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+44
-44
@@ -245,7 +245,7 @@ static void DiabloParseFlags(int argc, char **argv)
|
||||
leveldebug = true;
|
||||
leveltype = (dungeon_type)SDL_atoi(argv[++i]);
|
||||
currlevel = SDL_atoi(argv[++i]);
|
||||
plr[0].plrlevel = currlevel;
|
||||
Players[0].plrlevel = currlevel;
|
||||
} else if (strcasecmp("-m", argv[i]) == 0) {
|
||||
monstdebug = true;
|
||||
DebugMonsters[debugmonsttypes++] = (_monster_id)SDL_atoi(argv[++i]);
|
||||
@@ -316,7 +316,7 @@ static void FreeGame()
|
||||
FreeQuestText();
|
||||
FreeStoreMem();
|
||||
|
||||
for (auto &player : plr)
|
||||
for (auto &player : Players)
|
||||
ResetPlayerGFX(player);
|
||||
|
||||
FreeCursor();
|
||||
@@ -450,7 +450,7 @@ bool StartGame(bool bNewGame, bool bSinglePlayer)
|
||||
InitLevels();
|
||||
InitQuests();
|
||||
InitPortals();
|
||||
InitDungMsgs(plr[myplr]);
|
||||
InitDungMsgs(Players[MyPlayerId]);
|
||||
}
|
||||
interface_mode uMsg = WM_DIABNEWGAME;
|
||||
if (gbValidSaveFile && gbLoadGame) {
|
||||
@@ -621,7 +621,7 @@ static bool LeftMouseCmd(bool bShift)
|
||||
if (pcursitem == -1 && pcursmonst == -1 && pcursplr == -1)
|
||||
return true;
|
||||
} else {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
bNear = myPlayer.position.tile.WalkingDistance({ cursmx, cursmy }) < 2;
|
||||
if (pcursitem != -1 && pcurs == CURSOR_HAND && !bShift) {
|
||||
NetSendCmdLocParam1(true, invflag ? CMD_GOTOGETITEM : CMD_GOTOAGETITEM, { cursmx, cursmy }, pcursitem);
|
||||
@@ -629,7 +629,7 @@ static bool LeftMouseCmd(bool bShift)
|
||||
NetSendCmdLocParam1(true, pcurs == CURSOR_DISARM ? CMD_DISARMXY : CMD_OPOBJXY, { cursmx, cursmy }, pcursobj);
|
||||
} else if (myPlayer._pwtype == WT_RANGED) {
|
||||
if (bShift) {
|
||||
NetSendCmdLoc(myplr, true, CMD_RATTACKXY, { cursmx, cursmy });
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_RATTACKXY, { cursmx, cursmy });
|
||||
} else if (pcursmonst != -1) {
|
||||
if (CanTalkToMonst(pcursmonst)) {
|
||||
NetSendCmdParam1(true, CMD_ATTACKID, pcursmonst);
|
||||
@@ -645,10 +645,10 @@ static bool LeftMouseCmd(bool bShift)
|
||||
if (CanTalkToMonst(pcursmonst)) {
|
||||
NetSendCmdParam1(true, CMD_ATTACKID, pcursmonst);
|
||||
} else {
|
||||
NetSendCmdLoc(myplr, true, CMD_SATTACKXY, { cursmx, cursmy });
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_SATTACKXY, { cursmx, cursmy });
|
||||
}
|
||||
} else {
|
||||
NetSendCmdLoc(myplr, true, CMD_SATTACKXY, { cursmx, cursmy });
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_SATTACKXY, { cursmx, cursmy });
|
||||
}
|
||||
} else if (pcursmonst != -1) {
|
||||
NetSendCmdParam1(true, CMD_ATTACKID, pcursmonst);
|
||||
@@ -682,7 +682,7 @@ bool TryIconCurs()
|
||||
|
||||
if (pcurs == CURSOR_IDENTIFY) {
|
||||
if (pcursinvitem != -1)
|
||||
CheckIdentify(myplr, pcursinvitem);
|
||||
CheckIdentify(MyPlayerId, pcursinvitem);
|
||||
else
|
||||
NewCursor(CURSOR_HAND);
|
||||
return true;
|
||||
@@ -690,7 +690,7 @@ bool TryIconCurs()
|
||||
|
||||
if (pcurs == CURSOR_REPAIR) {
|
||||
if (pcursinvitem != -1)
|
||||
DoRepair(myplr, pcursinvitem);
|
||||
DoRepair(MyPlayerId, pcursinvitem);
|
||||
else
|
||||
NewCursor(CURSOR_HAND);
|
||||
return true;
|
||||
@@ -698,7 +698,7 @@ bool TryIconCurs()
|
||||
|
||||
if (pcurs == CURSOR_RECHARGE) {
|
||||
if (pcursinvitem != -1)
|
||||
DoRecharge(myplr, pcursinvitem);
|
||||
DoRecharge(MyPlayerId, pcursinvitem);
|
||||
else
|
||||
NewCursor(CURSOR_HAND);
|
||||
return true;
|
||||
@@ -706,20 +706,20 @@ bool TryIconCurs()
|
||||
|
||||
if (pcurs == CURSOR_OIL) {
|
||||
if (pcursinvitem != -1)
|
||||
DoOil(myplr, pcursinvitem);
|
||||
DoOil(MyPlayerId, pcursinvitem);
|
||||
else
|
||||
NewCursor(CURSOR_HAND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pcurs == CURSOR_TELEPORT) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
if (pcursmonst != -1)
|
||||
NetSendCmdParam3(true, CMD_TSPELLID, pcursmonst, myPlayer._pTSpell, GetSpellLevel(myplr, myPlayer._pTSpell));
|
||||
NetSendCmdParam3(true, CMD_TSPELLID, pcursmonst, myPlayer._pTSpell, GetSpellLevel(MyPlayerId, myPlayer._pTSpell));
|
||||
else if (pcursplr != -1)
|
||||
NetSendCmdParam3(true, CMD_TSPELLPID, pcursplr, myPlayer._pTSpell, GetSpellLevel(myplr, myPlayer._pTSpell));
|
||||
NetSendCmdParam3(true, CMD_TSPELLPID, pcursplr, myPlayer._pTSpell, GetSpellLevel(MyPlayerId, myPlayer._pTSpell));
|
||||
else
|
||||
NetSendCmdLocParam2(true, CMD_TSPELLXY, { cursmx, cursmy }, myPlayer._pTSpell, GetSpellLevel(myplr, myPlayer._pTSpell));
|
||||
NetSendCmdLocParam2(true, CMD_TSPELLXY, { cursmx, cursmy }, myPlayer._pTSpell, GetSpellLevel(MyPlayerId, myPlayer._pTSpell));
|
||||
NewCursor(CURSOR_HAND);
|
||||
return true;
|
||||
}
|
||||
@@ -743,7 +743,7 @@ static bool LeftMouseDown(int wParam)
|
||||
if (sgnTimeoutCurs != CURSOR_NONE)
|
||||
return false;
|
||||
|
||||
if (deathflag) {
|
||||
if (MyPlayerIsDead) {
|
||||
control_check_btn_press();
|
||||
return false;
|
||||
}
|
||||
@@ -788,7 +788,7 @@ static bool LeftMouseDown(int wParam)
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
} else {
|
||||
if (plr[myplr]._pStatPts != 0 && !spselflag)
|
||||
if (Players[MyPlayerId]._pStatPts != 0 && !spselflag)
|
||||
CheckLvlBtn();
|
||||
if (!lvlbtndown)
|
||||
return LeftMouseCmd(isShiftHeld);
|
||||
@@ -822,7 +822,7 @@ static void LeftMouseUp(int wParam)
|
||||
|
||||
static void RightMouseDown()
|
||||
{
|
||||
if (gmenu_is_active() || sgnTimeoutCurs != CURSOR_NONE || PauseMode == 2 || plr[myplr]._pInvincible) {
|
||||
if (gmenu_is_active() || sgnTimeoutCurs != CURSOR_NONE || PauseMode == 2 || Players[MyPlayerId]._pInvincible) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -839,9 +839,9 @@ static void RightMouseDown()
|
||||
if (MousePosition.y >= SPANEL_HEIGHT
|
||||
|| ((!sbookflag || MousePosition.x <= RIGHT_PANEL)
|
||||
&& !TryIconCurs()
|
||||
&& (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem)))) {
|
||||
&& (pcursinvitem == -1 || !UseInvItem(MyPlayerId, pcursinvitem)))) {
|
||||
if (pcurs == CURSOR_HAND) {
|
||||
if (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem))
|
||||
if (pcursinvitem == -1 || !UseInvItem(MyPlayerId, pcursinvitem))
|
||||
CheckPlrSpell();
|
||||
} else if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM) {
|
||||
NewCursor(CURSOR_HAND);
|
||||
@@ -969,7 +969,7 @@ static void PressKey(int vkey)
|
||||
if (vkey == DVL_VK_MENU || vkey == DVL_VK_LMENU || vkey == DVL_VK_RMENU)
|
||||
AltPressed(true);
|
||||
|
||||
if (deathflag) {
|
||||
if (MyPlayerIsDead) {
|
||||
if (sgnTimeoutCurs != CURSOR_NONE) {
|
||||
return;
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ static void PressKey(int vkey)
|
||||
*/
|
||||
static void PressChar(int32_t vkey)
|
||||
{
|
||||
if (gmenu_is_active() || control_talk_last_key(vkey) || sgnTimeoutCurs != CURSOR_NONE || deathflag) {
|
||||
if (gmenu_is_active() || control_talk_last_key(vkey) || sgnTimeoutCurs != CURSOR_NONE || MyPlayerIsDead) {
|
||||
return;
|
||||
}
|
||||
if ((char)vkey == 'p' || (char)vkey == 'P') {
|
||||
@@ -1114,7 +1114,7 @@ static void PressChar(int32_t vkey)
|
||||
if (arrowdebug > 2) {
|
||||
arrowdebug = 0;
|
||||
}
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
if (arrowdebug == 0) {
|
||||
myPlayer._pIFlags &= ~ISPL_FIRE_ARROWS;
|
||||
myPlayer._pIFlags &= ~ISPL_LIGHT_ARROWS;
|
||||
@@ -1146,7 +1146,7 @@ static void PressChar(int32_t vkey)
|
||||
case 'a':
|
||||
if (debug_mode_key_inverted_v) {
|
||||
spelldata[SPL_TELEPORT].sTownSpell = true;
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
myPlayer._pSplLvl[myPlayer._pSpell]++;
|
||||
}
|
||||
return;
|
||||
@@ -1171,20 +1171,20 @@ static void PressChar(int32_t vkey)
|
||||
case 'R':
|
||||
case 'r':
|
||||
sprintf(tempstr, "seed = %i", glSeedTbl[currlevel]);
|
||||
NetSendCmdString(1 << myplr, tempstr);
|
||||
NetSendCmdString(1 << MyPlayerId, tempstr);
|
||||
sprintf(tempstr, "Mid1 = %i : Mid2 = %i : Mid3 = %i", glMid1Seed[currlevel], glMid2Seed[currlevel], glMid3Seed[currlevel]);
|
||||
NetSendCmdString(1 << myplr, tempstr);
|
||||
NetSendCmdString(1 << MyPlayerId, tempstr);
|
||||
sprintf(tempstr, "End = %i", glEndSeed[currlevel]);
|
||||
NetSendCmdString(1 << myplr, tempstr);
|
||||
NetSendCmdString(1 << MyPlayerId, tempstr);
|
||||
return;
|
||||
case 'T':
|
||||
case 't':
|
||||
if (debug_mode_key_inverted_v) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
sprintf(tempstr, "PX = %i PY = %i", myPlayer.position.tile.x, myPlayer.position.tile.y);
|
||||
NetSendCmdString(1 << myplr, tempstr);
|
||||
NetSendCmdString(1 << MyPlayerId, tempstr);
|
||||
sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]);
|
||||
NetSendCmdString(1 << myplr, tempstr);
|
||||
NetSendCmdString(1 << MyPlayerId, tempstr);
|
||||
}
|
||||
return;
|
||||
case '|':
|
||||
@@ -1453,7 +1453,7 @@ static void UpdateMonsterLights()
|
||||
for (int i = 0; i < ActiveMonsterCount; i++) {
|
||||
MonsterStruct *mon = &Monsters[ActiveMonsters[i]];
|
||||
if (mon->mlid != NO_LIGHT) {
|
||||
if (mon->mlid == plr[myplr]._plid) { // Fix old saves where some monsters had 0 instead of NO_LIGHT
|
||||
if (mon->mlid == Players[MyPlayerId]._plid) { // Fix old saves where some monsters had 0 instead of NO_LIGHT
|
||||
mon->mlid = NO_LIGHT;
|
||||
continue;
|
||||
}
|
||||
@@ -1506,7 +1506,7 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
|
||||
InitLevelMonsters();
|
||||
IncProgress();
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (!setlevel) {
|
||||
CreateLevel(lvldir);
|
||||
@@ -1536,7 +1536,7 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
|
||||
IncProgress();
|
||||
|
||||
for (int i = 0; i < MAX_PLRS; i++) {
|
||||
auto &player = plr[i];
|
||||
auto &player = Players[i];
|
||||
if (player.plractive && currlevel == player.plrlevel) {
|
||||
InitPlayerGFX(player);
|
||||
if (lvldir != ENTRY_LOAD)
|
||||
@@ -1551,7 +1551,7 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
|
||||
bool visited = false;
|
||||
int players = gbIsMultiplayer ? MAX_PLRS : 1;
|
||||
for (int i = 0; i < players; i++) {
|
||||
auto &player = plr[i];
|
||||
auto &player = Players[i];
|
||||
if (player.plractive)
|
||||
visited = visited || player._pLvlVisited[currlevel];
|
||||
}
|
||||
@@ -1631,7 +1631,7 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
|
||||
IncProgress();
|
||||
|
||||
for (int i = 0; i < MAX_PLRS; i++) {
|
||||
auto &player = plr[i];
|
||||
auto &player = Players[i];
|
||||
if (player.plractive && currlevel == player.plrlevel) {
|
||||
InitPlayerGFX(player);
|
||||
if (lvldir != ENTRY_LOAD)
|
||||
@@ -1657,8 +1657,8 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
|
||||
SyncPortals();
|
||||
|
||||
for (int i = 0; i < MAX_PLRS; i++) {
|
||||
auto &player = plr[i];
|
||||
if (player.plractive && player.plrlevel == currlevel && (!player._pLvlChanging || i == myplr)) {
|
||||
auto &player = Players[i];
|
||||
if (player.plractive && player.plrlevel == currlevel && (!player._pLvlChanging || i == MyPlayerId)) {
|
||||
if (player._pHitPoints > 0) {
|
||||
if (!gbIsMultiplayer)
|
||||
dPlayer[player.position.tile.x][player.position.tile.y] = i + 1;
|
||||
@@ -1849,10 +1849,10 @@ void itemInfoKeyPressed()
|
||||
Items[pcursitem].IDidx,
|
||||
Items[pcursitem]._iSeed,
|
||||
Items[pcursitem]._iCreateInfo);
|
||||
NetSendCmdString(1 << myplr, tempstr);
|
||||
NetSendCmdString(1 << MyPlayerId, tempstr);
|
||||
}
|
||||
sprintf(tempstr, "Numitems : %i", ActiveItemCount);
|
||||
NetSendCmdString(1 << myplr, tempstr);
|
||||
NetSendCmdString(1 << MyPlayerId, tempstr);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1954,7 +1954,7 @@ void spellBookKeyPressed()
|
||||
|
||||
bool isPlayerDead()
|
||||
{
|
||||
return plr[myplr]._pmode == PM_DEATH || deathflag;
|
||||
return Players[MyPlayerId]._pmode == PM_DEATH || MyPlayerIsDead;
|
||||
}
|
||||
|
||||
void initKeymapActions()
|
||||
@@ -2062,7 +2062,7 @@ void initKeymapActions()
|
||||
_("Hell"),
|
||||
};
|
||||
strcpy(pszStr, fmt::format(_(/* TRANSLATORS: {:s} means: Character Name, Game Version, Game Difficulty. */ "{:s}, version = {:s}, mode = {:s}"), gszProductName, PROJECT_VERSION, difficulties[sgGameInitInfo.nDifficulty]).c_str());
|
||||
NetSendCmdString(1 << myplr, pszStr);
|
||||
NetSendCmdString(1 << MyPlayerId, pszStr);
|
||||
},
|
||||
[&]() { return !isPlayerDead(); },
|
||||
});
|
||||
@@ -2071,9 +2071,9 @@ void initKeymapActions()
|
||||
std::string("BeltItem") + std::to_string(i + 1),
|
||||
'1' + i,
|
||||
[i] {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
if (!myPlayer.SpdList[i].isEmpty() && myPlayer.SpdList[i]._itype != ITYPE_GOLD) {
|
||||
UseInvItem(myplr, INVITEM_BELT_FIRST + i);
|
||||
UseInvItem(MyPlayerId, INVITEM_BELT_FIRST + i);
|
||||
}
|
||||
},
|
||||
[&]() { return !isPlayerDead(); },
|
||||
@@ -2112,7 +2112,7 @@ void initKeymapActions()
|
||||
keymapper.addAction({
|
||||
"StopHero",
|
||||
DVL_VK_INVALID,
|
||||
[] { plr[myplr].Stop(); },
|
||||
[] { Players[MyPlayerId].Stop(); },
|
||||
[&]() { return !isPlayerDead(); },
|
||||
});
|
||||
}
|
||||
|
||||
+3
-3
@@ -2310,7 +2310,7 @@ static void DrlgL5(lvl_entry entry)
|
||||
}
|
||||
} else if (entry == ENTRY_MAIN) {
|
||||
if (currlevel < 21) {
|
||||
if (!plr[myplr].pOriginalCathedral) {
|
||||
if (!Players[MyPlayerId].pOriginalCathedral) {
|
||||
if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, true, -1, 0) < 0)
|
||||
doneflag = false;
|
||||
if (DrlgPlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0)
|
||||
@@ -2336,7 +2336,7 @@ static void DrlgL5(lvl_entry entry)
|
||||
}
|
||||
ViewY++;
|
||||
}
|
||||
} else if (!plr[myplr].pOriginalCathedral && entry == ENTRY_PREV) {
|
||||
} else if (!Players[MyPlayerId].pOriginalCathedral && entry == ENTRY_PREV) {
|
||||
if (currlevel < 21) {
|
||||
if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0)
|
||||
doneflag = false;
|
||||
@@ -2360,7 +2360,7 @@ static void DrlgL5(lvl_entry entry)
|
||||
}
|
||||
} else {
|
||||
if (currlevel < 21) {
|
||||
if (!plr[myplr].pOriginalCathedral) {
|
||||
if (!Players[MyPlayerId].pOriginalCathedral) {
|
||||
if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0)
|
||||
doneflag = false;
|
||||
if (DrlgPlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0)
|
||||
|
||||
@@ -155,7 +155,7 @@ template <class P>
|
||||
void base_protocol<P>::send(packet &pkt)
|
||||
{
|
||||
if (pkt.dest() < MAX_PLRS) {
|
||||
if (pkt.dest() == myplr)
|
||||
if (pkt.dest() == MyPlayerId)
|
||||
return;
|
||||
if (peers[pkt.dest()])
|
||||
proto.send(peers[pkt.dest()], pkt.data());
|
||||
|
||||
+4
-4
@@ -1144,7 +1144,7 @@ void FreeMonsterSnd()
|
||||
|
||||
bool calc_snd_position(Point soundPosition, int *plVolume, int *plPan)
|
||||
{
|
||||
const auto &playerPosition = plr[myplr].position.tile;
|
||||
const auto &playerPosition = Players[MyPlayerId].position.tile;
|
||||
const auto delta = soundPosition - playerPosition;
|
||||
|
||||
int pan = (delta.deltaX - delta.deltaY) * 256;
|
||||
@@ -1163,7 +1163,7 @@ bool calc_snd_position(Point soundPosition, int *plVolume, int *plPan)
|
||||
|
||||
static void PlaySfxPriv(TSFX *pSFX, bool loc, Point position)
|
||||
{
|
||||
if (plr[myplr].pLvlLoad != 0 && gbIsMultiplayer) {
|
||||
if (Players[MyPlayerId].pLvlLoad != 0 && gbIsMultiplayer) {
|
||||
return;
|
||||
}
|
||||
if (!gbSndInited || !gbSoundOn || gbBufferMsgs != 0) {
|
||||
@@ -1194,7 +1194,7 @@ static void PlaySfxPriv(TSFX *pSFX, bool loc, Point position)
|
||||
|
||||
void PlayEffect(int i, int mode)
|
||||
{
|
||||
if (plr[myplr].pLvlLoad != 0) {
|
||||
if (Players[MyPlayerId].pLvlLoad != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1337,7 +1337,7 @@ void sound_init()
|
||||
if (gbIsHellfire)
|
||||
mask |= sfx_MONK;
|
||||
} else {
|
||||
switch (plr[myplr]._pClass) {
|
||||
switch (Players[MyPlayerId]._pClass) {
|
||||
case HeroClass::Warrior:
|
||||
case HeroClass::Barbarian:
|
||||
mask |= sfx_WARRIOR;
|
||||
|
||||
+6
-6
@@ -80,14 +80,14 @@ void GamemenuUpdateSingle()
|
||||
{
|
||||
gmenu_enable(&sgSingleMenu[3], gbValidSaveFile);
|
||||
|
||||
bool enable = plr[myplr]._pmode != PM_DEATH && !deathflag;
|
||||
bool enable = Players[MyPlayerId]._pmode != PM_DEATH && !MyPlayerIsDead;
|
||||
|
||||
gmenu_enable(&sgSingleMenu[0], enable);
|
||||
}
|
||||
|
||||
void GamemenuUpdateMulti()
|
||||
{
|
||||
gmenu_enable(&sgMultiMenu[2], deathflag);
|
||||
gmenu_enable(&sgMultiMenu[2], MyPlayerIsDead);
|
||||
}
|
||||
|
||||
void GamemenuPrevious(bool /*bActivate*/)
|
||||
@@ -97,12 +97,12 @@ void GamemenuPrevious(bool /*bActivate*/)
|
||||
|
||||
void GamemenuNewGame(bool /*bActivate*/)
|
||||
{
|
||||
for (auto &player : plr) {
|
||||
for (auto &player : Players) {
|
||||
player._pmode = PM_QUIT;
|
||||
player._pInvincible = true;
|
||||
}
|
||||
|
||||
deathflag = false;
|
||||
MyPlayerIsDead = false;
|
||||
force_redraw = 255;
|
||||
scrollrt_draw_game_screen();
|
||||
CornerStone.activated = false;
|
||||
@@ -319,7 +319,7 @@ void gamemenu_load_game(bool /*bActivate*/)
|
||||
ClrDiabloMsg();
|
||||
CornerStone.activated = false;
|
||||
PaletteFadeOut(8);
|
||||
deathflag = false;
|
||||
MyPlayerIsDead = false;
|
||||
force_redraw = 255;
|
||||
DrawAndBlit();
|
||||
LoadPWaterPalette();
|
||||
@@ -335,7 +335,7 @@ void gamemenu_save_game(bool /*bActivate*/)
|
||||
return;
|
||||
}
|
||||
|
||||
if (plr[myplr]._pmode == PM_DEATH || deathflag) {
|
||||
if (Players[MyPlayerId]._pmode == PM_DEATH || MyPlayerIsDead) {
|
||||
gamemenu_off();
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ static Cutscenes PickCutscene(interface_mode uMsg)
|
||||
case WM_DIABPREVLVL:
|
||||
case WM_DIABTOWNWARP:
|
||||
case WM_DIABTWARPUP: {
|
||||
int lvl = plr[myplr].plrlevel;
|
||||
int lvl = Players[MyPlayerId].plrlevel;
|
||||
if (lvl == 1 && uMsg == WM_DIABNEXTLVL)
|
||||
return CutTown;
|
||||
if (lvl == 16 && uMsg == WM_DIABNEXTLVL)
|
||||
@@ -235,7 +235,7 @@ void ShowProgress(interface_mode uMsg)
|
||||
sound_init();
|
||||
IncProgress();
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_DIABLOADGAME:
|
||||
|
||||
+32
-32
@@ -141,7 +141,7 @@ void FreeInvGFX()
|
||||
|
||||
void InitInv()
|
||||
{
|
||||
switch (plr[myplr]._pClass) {
|
||||
switch (Players[MyPlayerId]._pClass) {
|
||||
case HeroClass::Warrior:
|
||||
case HeroClass::Barbarian:
|
||||
pInvCels = LoadCel("Data\\Inv\\Inv.CEL", SPANEL_WIDTH);
|
||||
@@ -210,7 +210,7 @@ void DrawInv(const Surface &out)
|
||||
{ 133, 160 }, // chest
|
||||
};
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (int slot = INVLOC_HEAD; slot < NUM_INVLOC; slot++) {
|
||||
if (!myPlayer.InvBody[slot].isEmpty()) {
|
||||
@@ -303,7 +303,7 @@ void DrawInvBelt(const Surface &out)
|
||||
|
||||
DrawPanelBox(out, { 205, 21, 232, 28 }, { PANEL_X + 205, PANEL_Y + 5 });
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (int i = 0; i < MAXBELTITEMS; i++) {
|
||||
if (myPlayer.SpdList[i].isEmpty()) {
|
||||
@@ -534,7 +534,7 @@ bool CanEquip(PlayerStruct &player, const ItemStruct &item, inv_body_loc bodyLoc
|
||||
*/
|
||||
bool AutoEquip(int playerId, const ItemStruct &item, inv_body_loc bodyLocation, bool persistItem)
|
||||
{
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
|
||||
if (!CanEquip(player, item, bodyLocation)) {
|
||||
return false;
|
||||
@@ -543,7 +543,7 @@ bool AutoEquip(int playerId, const ItemStruct &item, inv_body_loc bodyLocation,
|
||||
if (persistItem) {
|
||||
player.InvBody[bodyLocation] = item;
|
||||
|
||||
if (sgOptions.Audio.bAutoEquipSound && playerId == myplr) {
|
||||
if (sgOptions.Audio.bAutoEquipSound && playerId == MyPlayerId) {
|
||||
PlaySFX(ItemInvSnds[ItemCAnimTbl[item._iCurs]]);
|
||||
}
|
||||
|
||||
@@ -791,7 +791,7 @@ int SwapItem(ItemStruct *a, ItemStruct *b)
|
||||
|
||||
void CheckInvPaste(int pnum, Point cursorPosition)
|
||||
{
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
SetICursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
int i = cursorPosition.x + (IsHardwareCursor() ? 0 : (icursW / 2));
|
||||
@@ -922,7 +922,7 @@ void CheckInvPaste(int pnum, Point cursorPosition)
|
||||
if (!done)
|
||||
return;
|
||||
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
PlaySFX(ItemInvSnds[ItemCAnimTbl[player.HoldItem._iCurs]]);
|
||||
|
||||
int cn = CURSOR_HAND;
|
||||
@@ -1013,13 +1013,13 @@ void CheckInvPaste(int pnum, Point cursorPosition)
|
||||
player.HoldItem = player.InvBody[INVLOC_HAND_RIGHT];
|
||||
else
|
||||
player.HoldItem = player.InvBody[INVLOC_HAND_LEFT];
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
NewCursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
else
|
||||
SetICursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
bool done2h = AutoPlaceItemInInventory(player, player.HoldItem, true);
|
||||
player.HoldItem = tempitem;
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
NewCursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
else
|
||||
SetICursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
@@ -1122,7 +1122,7 @@ void CheckInvPaste(int pnum, Point cursorPosition)
|
||||
break;
|
||||
}
|
||||
CalcPlrInv(pnum, true);
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
if (cn == CURSOR_HAND && !IsHardwareCursor())
|
||||
SetCursorPos(MousePosition.x + (cursW / 2), MousePosition.y + (cursH / 2));
|
||||
NewCursor(cn);
|
||||
@@ -1134,7 +1134,7 @@ void CheckInvSwap(int pnum, BYTE bLoc, int idx, uint16_t wCI, int seed, bool bId
|
||||
memset(&Items[MAXITEMS], 0, sizeof(*Items));
|
||||
RecreateItem(MAXITEMS, idx, wCI, seed, 0, (dwBuff & CF_HELLFIRE) != 0);
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
player.HoldItem = Items[MAXITEMS];
|
||||
|
||||
@@ -1157,7 +1157,7 @@ void CheckInvSwap(int pnum, BYTE bLoc, int idx, uint16_t wCI, int seed, bool bId
|
||||
|
||||
void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||
{
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
if (player._pmode > PM_WALK3) {
|
||||
return;
|
||||
@@ -1343,7 +1343,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||
CalcPlrInv(pnum, true);
|
||||
CheckItemStats(player);
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
if (automaticallyEquipped) {
|
||||
PlaySFX(ItemInvSnds[ItemCAnimTbl[holdItem._iCurs]]);
|
||||
} else if (!automaticMove || automaticallyMoved) {
|
||||
@@ -1373,7 +1373,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||
|
||||
void inv_update_rem_item(int pnum, BYTE iv)
|
||||
{
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
if (iv < NUM_INVLOC) {
|
||||
player.InvBody[iv]._itype = ITYPE_NONE;
|
||||
@@ -1385,9 +1385,9 @@ void inv_update_rem_item(int pnum, BYTE iv)
|
||||
void CheckInvItem(bool isShiftHeld)
|
||||
{
|
||||
if (pcurs >= CURSOR_FIRSTITEM) {
|
||||
CheckInvPaste(myplr, MousePosition);
|
||||
CheckInvPaste(MyPlayerId, MousePosition);
|
||||
} else {
|
||||
CheckInvCut(myplr, MousePosition, isShiftHeld);
|
||||
CheckInvCut(MyPlayerId, MousePosition, isShiftHeld);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1447,7 +1447,7 @@ static void CheckNaKrulNotes(PlayerStruct &player)
|
||||
}
|
||||
}
|
||||
|
||||
plr[myplr].Say(HeroSpeech::JustWhatIWasLookingFor, 10);
|
||||
Players[MyPlayerId].Say(HeroSpeech::JustWhatIWasLookingFor, 10);
|
||||
|
||||
for (auto note : notes) {
|
||||
if (idx != note) {
|
||||
@@ -1466,7 +1466,7 @@ static void CheckNaKrulNotes(PlayerStruct &player)
|
||||
|
||||
static void CheckQuestItem(PlayerStruct &player)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (player.HoldItem.IDidx == IDI_OPTAMULET && quests[Q_BLIND]._qactive == QUEST_ACTIVE)
|
||||
quests[Q_BLIND]._qactive = QUEST_DONE;
|
||||
@@ -1507,7 +1507,7 @@ static void CheckQuestItem(PlayerStruct &player)
|
||||
quests[Q_GRAVE]._qlog = false;
|
||||
quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
|
||||
quests[Q_GRAVE]._qvar1 = 1;
|
||||
plr[myplr].Say(HeroSpeech::UhHuh, 10);
|
||||
Players[MyPlayerId].Say(HeroSpeech::UhHuh, 10);
|
||||
}
|
||||
|
||||
CheckNaKrulNotes(player);
|
||||
@@ -1548,9 +1548,9 @@ void InvGetItem(int pnum, ItemStruct *item, int ii)
|
||||
if (dItem[item->position.x][item->position.y] == 0)
|
||||
return;
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
if (myplr == pnum && pcurs >= CURSOR_FIRSTITEM)
|
||||
if (MyPlayerId == pnum && pcurs >= CURSOR_FIRSTITEM)
|
||||
NetSendCmdPItem(true, CMD_SYNCPUTITEM, player.position.tile);
|
||||
|
||||
item->_iCreateInfo &= ~CF_PREGEN;
|
||||
@@ -1583,7 +1583,7 @@ void AutoGetItem(int pnum, ItemStruct *item, int ii)
|
||||
if (dItem[item->position.x][item->position.y] == 0)
|
||||
return;
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
item->_iCreateInfo &= ~CF_PREGEN;
|
||||
player.HoldItem = *item; /// BUGFIX: overwrites cursor item, allowing for belt dupe bug
|
||||
@@ -1612,7 +1612,7 @@ void AutoGetItem(int pnum, ItemStruct *item, int ii)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
player.Say(HeroSpeech::ICantCarryAnymore);
|
||||
}
|
||||
player.HoldItem = *item;
|
||||
@@ -1706,7 +1706,7 @@ bool TryInvPut()
|
||||
if (ActiveItemCount >= MAXITEMS)
|
||||
return false;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
Direction dir = GetDirection(myPlayer.position.tile, { cursmx, cursmy });
|
||||
if (CanPut(myPlayer.position.tile + dir)) {
|
||||
@@ -1877,7 +1877,7 @@ char CheckInvHLight()
|
||||
int8_t rv = -1;
|
||||
infoclr = UIS_SILVER;
|
||||
ItemStruct *pi = nullptr;
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
ClearPanel();
|
||||
if (r >= SLOTXY_HEAD_FIRST && r <= SLOTXY_HEAD_LAST) {
|
||||
@@ -1970,7 +1970,7 @@ bool UseScroll()
|
||||
if (pcurs != CURSOR_HAND)
|
||||
return false;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (leveltype == DTYPE_TOWN && !spelldata[myPlayer._pRSpell].sTownSpell)
|
||||
return false;
|
||||
@@ -2018,7 +2018,7 @@ bool UseStaff()
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
return CanUseStaff(myPlayer.InvBody[INVLOC_HAND_LEFT], myPlayer._pRSpell);
|
||||
}
|
||||
@@ -2027,7 +2027,7 @@ void StartGoldDrop()
|
||||
{
|
||||
initialDropGoldIndex = pcursinvitem;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (pcursinvitem <= INVITEM_INV_LAST)
|
||||
initialDropGoldValue = myPlayer.InvList[pcursinvitem - INVITEM_INV_FIRST]._ivalue;
|
||||
@@ -2046,9 +2046,9 @@ bool UseInvItem(int pnum, int cii)
|
||||
int c;
|
||||
ItemStruct *item;
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
if (player._pInvincible && player._pHitPoints == 0 && pnum == myplr)
|
||||
if (player._pInvincible && player._pHitPoints == 0 && pnum == MyPlayerId)
|
||||
return true;
|
||||
if (pcurs != CURSOR_HAND)
|
||||
return true;
|
||||
@@ -2113,7 +2113,7 @@ bool UseInvItem(int pnum, int cii)
|
||||
int idata = ItemCAnimTbl[item->_iCurs];
|
||||
if (item->_iMiscId == IMISC_BOOK)
|
||||
PlaySFX(IS_RBOOK);
|
||||
else if (pnum == myplr)
|
||||
else if (pnum == MyPlayerId)
|
||||
PlaySFX(ItemInvSnds[idata]);
|
||||
|
||||
UseItem(pnum, item->_iMiscId, item->_iSpell);
|
||||
@@ -2144,7 +2144,7 @@ void DoTelekinesis()
|
||||
if (pcursobj != -1)
|
||||
NetSendCmdParam1(true, CMD_OPOBJT, pcursobj);
|
||||
if (pcursitem != -1)
|
||||
NetSendCmdGItem(true, CMD_REQUESTAGITEM, myplr, myplr, pcursitem);
|
||||
NetSendCmdGItem(true, CMD_REQUESTAGITEM, MyPlayerId, MyPlayerId, pcursitem);
|
||||
if (pcursmonst != -1 && !M_Talker(pcursmonst) && Monsters[pcursmonst].mtalkmsg == TEXT_NONE)
|
||||
NetSendCmdParam1(true, CMD_KNOCKBACK, pcursmonst);
|
||||
NewCursor(CURSOR_HAND);
|
||||
|
||||
+41
-41
@@ -553,7 +553,7 @@ void InitItems()
|
||||
|
||||
void CalcPlrItemVals(int playerId, bool loadgfx)
|
||||
{
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
|
||||
int mind = 0; // min damage
|
||||
int maxd = 0; // max damage
|
||||
@@ -686,7 +686,7 @@ void CalcPlrItemVals(int playerId, bool loadgfx)
|
||||
|
||||
lrad = clamp(lrad, 2, 15);
|
||||
|
||||
if (player._pLightRad != lrad && playerId == myplr) {
|
||||
if (player._pLightRad != lrad && playerId == MyPlayerId) {
|
||||
ChangeLightRadius(player._plid, lrad);
|
||||
ChangeVisionRadius(player._pvid, lrad);
|
||||
player._pLightRad = lrad;
|
||||
@@ -795,7 +795,7 @@ void CalcPlrItemVals(int playerId, bool loadgfx)
|
||||
player._pMaxHP = ihp + player._pMaxHPBase;
|
||||
player._pHitPoints = std::min(ihp + player._pHPBase, player._pMaxHP);
|
||||
|
||||
if (playerId == myplr && (player._pHitPoints >> 6) <= 0) {
|
||||
if (playerId == MyPlayerId && (player._pHitPoints >> 6) <= 0) {
|
||||
SetPlayerHitPoints(playerId, 0);
|
||||
}
|
||||
|
||||
@@ -1016,17 +1016,17 @@ void CalcPlrBookVals(PlayerStruct &player)
|
||||
|
||||
void CalcPlrInv(int playerId, bool loadgfx)
|
||||
{
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
|
||||
CalcPlrItemMin(player);
|
||||
CalcSelfItems(player);
|
||||
CalcPlrItemVals(playerId, loadgfx);
|
||||
CalcPlrItemMin(player);
|
||||
if (playerId == myplr) {
|
||||
if (playerId == MyPlayerId) {
|
||||
CalcPlrBookVals(player);
|
||||
player.CalcScrolls();
|
||||
CalcPlrStaff(player);
|
||||
if (playerId == myplr && currlevel == 0)
|
||||
if (playerId == MyPlayerId && currlevel == 0)
|
||||
RecalcStoreStats();
|
||||
}
|
||||
}
|
||||
@@ -1095,9 +1095,9 @@ void GetGoldSeed(int pnum, ItemStruct *h)
|
||||
if (Items[ii]._iSeed == s)
|
||||
doneflag = false;
|
||||
}
|
||||
if (pnum == myplr) {
|
||||
for (int i = 0; i < plr[pnum]._pNumInv; i++) {
|
||||
if (plr[pnum].InvList[i]._iSeed == s)
|
||||
if (pnum == MyPlayerId) {
|
||||
for (int i = 0; i < Players[pnum]._pNumInv; i++) {
|
||||
if (Players[pnum].InvList[i]._iSeed == s)
|
||||
doneflag = false;
|
||||
}
|
||||
}
|
||||
@@ -1133,7 +1133,7 @@ void SetPlrHandGoldCurs(ItemStruct *h)
|
||||
|
||||
void CreatePlrItems(int playerId)
|
||||
{
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
|
||||
for (auto &item : player.InvBody) {
|
||||
item._itype = ITYPE_NONE;
|
||||
@@ -1992,7 +1992,7 @@ void SaveItemPower(int i, item_effect_type power, int param1, int param2, int mi
|
||||
Items[i]._iLMaxDam = 0;
|
||||
break;
|
||||
case IPL_FIRERESCLVL:
|
||||
Items[i]._iPLFR = 30 - plr[myplr]._pLevel;
|
||||
Items[i]._iPLFR = 30 - Players[MyPlayerId]._pLevel;
|
||||
Items[i]._iPLFR = std::max<int16_t>(Items[i]._iPLFR, 0);
|
||||
|
||||
break;
|
||||
@@ -2030,12 +2030,12 @@ void SaveItemPower(int i, item_effect_type power, int param1, int param2, int mi
|
||||
Items[i]._iDamAcFlags |= ISPLHF_ACUNDEAD;
|
||||
break;
|
||||
case IPL_MANATOLIFE:
|
||||
r2 = ((plr[myplr]._pMaxManaBase >> 6) * 50 / 100);
|
||||
r2 = ((Players[MyPlayerId]._pMaxManaBase >> 6) * 50 / 100);
|
||||
Items[i]._iPLMana -= (r2 << 6);
|
||||
Items[i]._iPLHP += (r2 << 6);
|
||||
break;
|
||||
case IPL_LIFETOMANA:
|
||||
r2 = ((plr[myplr]._pMaxHPBase >> 6) * 40 / 100);
|
||||
r2 = ((Players[MyPlayerId]._pMaxHPBase >> 6) * 40 / 100);
|
||||
Items[i]._iPLHP -= (r2 << 6);
|
||||
Items[i]._iPLMana += (r2 << 6);
|
||||
break;
|
||||
@@ -2209,7 +2209,7 @@ void GetItemBonus(int i, int minlvl, int maxlvl, bool onlygood, bool allowspells
|
||||
|
||||
void SetupItem(int i)
|
||||
{
|
||||
Items[i].SetNewAnimation(plr[myplr].pLvlLoad == 0);
|
||||
Items[i].SetNewAnimation(Players[MyPlayerId].pLvlLoad == 0);
|
||||
Items[i]._iIdentified = false;
|
||||
}
|
||||
|
||||
@@ -2985,14 +2985,14 @@ void CheckIdentify(int pnum, int cii)
|
||||
ItemStruct *pi;
|
||||
|
||||
if (cii >= NUM_INVLOC)
|
||||
pi = &plr[pnum].InvList[cii - NUM_INVLOC];
|
||||
pi = &Players[pnum].InvList[cii - NUM_INVLOC];
|
||||
else
|
||||
pi = &plr[pnum].InvBody[cii];
|
||||
pi = &Players[pnum].InvBody[cii];
|
||||
|
||||
pi->_iIdentified = true;
|
||||
CalcPlrInv(pnum, true);
|
||||
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
|
||||
@@ -3024,7 +3024,7 @@ void DoRepair(int pnum, int cii)
|
||||
{
|
||||
ItemStruct *pi;
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
PlaySfxLoc(IS_REPAIR, player.position.tile);
|
||||
|
||||
@@ -3037,7 +3037,7 @@ void DoRepair(int pnum, int cii)
|
||||
RepairItem(pi, player._pLevel);
|
||||
CalcPlrInv(pnum, true);
|
||||
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
|
||||
@@ -3061,7 +3061,7 @@ void DoRecharge(int pnum, int cii)
|
||||
{
|
||||
ItemStruct *pi;
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
if (cii >= NUM_INVLOC) {
|
||||
pi = &player.InvList[cii - NUM_INVLOC];
|
||||
} else {
|
||||
@@ -3074,7 +3074,7 @@ void DoRecharge(int pnum, int cii)
|
||||
CalcPlrInv(pnum, true);
|
||||
}
|
||||
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
|
||||
@@ -3191,11 +3191,11 @@ void DoOil(int pnum, int cii)
|
||||
{
|
||||
if (cii < NUM_INVLOC && cii != INVLOC_HEAD && (cii <= INVLOC_AMULET || cii > INVLOC_CHEST))
|
||||
return;
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
if (!OilItem(&player.InvBody[cii], player))
|
||||
return;
|
||||
CalcPlrInv(pnum, true);
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
}
|
||||
@@ -3847,7 +3847,7 @@ void PrintItemDur(ItemStruct *x)
|
||||
|
||||
void UseItem(int p, item_misc_id mid, spell_id spl)
|
||||
{
|
||||
auto &player = plr[p];
|
||||
auto &player = Players[p];
|
||||
|
||||
switch (mid) {
|
||||
case IMISC_HEAL:
|
||||
@@ -3944,7 +3944,7 @@ void UseItem(int p, item_misc_id mid, spell_id spl)
|
||||
case IMISC_SCROLL:
|
||||
if (spelldata[spl].sTargeted) {
|
||||
player._pTSpell = spl;
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEPORT);
|
||||
} else {
|
||||
ClrPlrPath(player);
|
||||
@@ -3954,14 +3954,14 @@ void UseItem(int p, item_misc_id mid, spell_id spl)
|
||||
player.destAction = ACTION_SPELL;
|
||||
player.destParam1 = cursmx;
|
||||
player.destParam2 = cursmy;
|
||||
if (p == myplr && spl == SPL_NOVA)
|
||||
NetSendCmdLoc(myplr, true, CMD_NOVA, { cursmx, cursmy });
|
||||
if (p == MyPlayerId && spl == SPL_NOVA)
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_NOVA, { cursmx, cursmy });
|
||||
}
|
||||
break;
|
||||
case IMISC_SCROLLT:
|
||||
if (spelldata[spl].sTargeted) {
|
||||
player._pTSpell = spl;
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEPORT);
|
||||
} else {
|
||||
ClrPlrPath(player);
|
||||
@@ -3983,7 +3983,7 @@ void UseItem(int p, item_misc_id mid, spell_id spl)
|
||||
player._pManaBase += spelldata[spl].sManaCost << 6;
|
||||
player._pManaBase = std::min(player._pManaBase, player._pMaxManaBase);
|
||||
}
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
CalcPlrBookVals(player);
|
||||
drawmanaflag = true;
|
||||
break;
|
||||
@@ -4001,7 +4001,7 @@ void UseItem(int p, item_misc_id mid, spell_id spl)
|
||||
case IMISC_OILHARD:
|
||||
case IMISC_OILIMP:
|
||||
player._pOilType = mid;
|
||||
if (p != myplr) {
|
||||
if (p != MyPlayerId) {
|
||||
return;
|
||||
}
|
||||
if (sbookflag) {
|
||||
@@ -4020,27 +4020,27 @@ void UseItem(int p, item_misc_id mid, spell_id spl)
|
||||
break;
|
||||
case IMISC_RUNEF:
|
||||
player._pTSpell = SPL_RUNEFIRE;
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEPORT);
|
||||
break;
|
||||
case IMISC_RUNEL:
|
||||
player._pTSpell = SPL_RUNELIGHT;
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEPORT);
|
||||
break;
|
||||
case IMISC_GR_RUNEL:
|
||||
player._pTSpell = SPL_RUNENOVA;
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEPORT);
|
||||
break;
|
||||
case IMISC_GR_RUNEF:
|
||||
player._pTSpell = SPL_RUNEIMMOLAT;
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEPORT);
|
||||
break;
|
||||
case IMISC_RUNES:
|
||||
player._pTSpell = SPL_RUNESTONE;
|
||||
if (p == myplr)
|
||||
if (p == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEPORT);
|
||||
break;
|
||||
default:
|
||||
@@ -4050,7 +4050,7 @@ void UseItem(int p, item_misc_id mid, spell_id spl)
|
||||
|
||||
bool StoreStatOk(ItemStruct *h)
|
||||
{
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pStrength < h->_iMinStr)
|
||||
return false;
|
||||
@@ -4195,7 +4195,7 @@ static void SpawnOnePremium(int i, int plvl, int playerId)
|
||||
bool keepGoing = false;
|
||||
ItemStruct tempItem = Items[0];
|
||||
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
|
||||
int strength = std::max(player.GetMaximumAttributeValue(CharacterAttribute::Strength), player._pStrength);
|
||||
int dexterity = std::max(player.GetMaximumAttributeValue(CharacterAttribute::Dexterity), player._pDexterity);
|
||||
@@ -4277,7 +4277,7 @@ static void SpawnOnePremium(int i, int plvl, int playerId)
|
||||
|
||||
void SpawnPremium(int pnum)
|
||||
{
|
||||
int8_t lvl = plr[pnum]._pLevel;
|
||||
int8_t lvl = Players[pnum]._pLevel;
|
||||
int maxItems = gbIsHellfire ? SMITH_PREMIUM_ITEMS : 6;
|
||||
if (numpremium < maxItems) {
|
||||
for (int i = 0; i < maxItems; i++) {
|
||||
@@ -4342,7 +4342,7 @@ void WitchBookLevel(int ii)
|
||||
if (witchitem[ii]._iMiscId != IMISC_BOOK)
|
||||
return;
|
||||
witchitem[ii]._iMinMag = spelldata[witchitem[ii]._iSpell].sMinInt;
|
||||
int8_t spellLevel = plr[myplr]._pSplLvl[witchitem[ii]._iSpell];
|
||||
int8_t spellLevel = Players[MyPlayerId]._pSplLvl[witchitem[ii]._iSpell];
|
||||
while (spellLevel > 0) {
|
||||
witchitem[ii]._iMinMag += 20 * witchitem[ii]._iMinMag / 100;
|
||||
spellLevel--;
|
||||
@@ -4442,7 +4442,7 @@ void SpawnBoy(int lvl)
|
||||
bool keepgoing = false;
|
||||
int count = 0;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
HeroClass pc = myPlayer._pClass;
|
||||
int strength = std::max(myPlayer.GetMaximumAttributeValue(CharacterAttribute::Strength), myPlayer._pStrength);
|
||||
@@ -4562,7 +4562,7 @@ bool HealerItemOk(int i)
|
||||
return AllItemsList[i].iSpell == SPL_HEALOTHER && gbIsMultiplayer;
|
||||
|
||||
if (!gbIsMultiplayer) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (AllItemsList[i].iMiscId == IMISC_ELIXSTR)
|
||||
return !gbIsHellfire || myPlayer._pBaseStr < myPlayer.GetMaximumAttributeValue(CharacterAttribute::Strength);
|
||||
|
||||
+1
-1
@@ -940,7 +940,7 @@ void ToggleLighting()
|
||||
}
|
||||
|
||||
memcpy(dLight, dPreLight, sizeof(dLight));
|
||||
for (const auto &player : plr) {
|
||||
for (const auto &player : Players) {
|
||||
if (player.plractive && player.plrlevel == currlevel) {
|
||||
DoLighting(player.position.tile, player._pLightRad, -1);
|
||||
}
|
||||
|
||||
+18
-18
@@ -324,7 +324,7 @@ static void LoadItems(LoadHelper *file, const int n, ItemStruct *pItem)
|
||||
|
||||
static void LoadPlayer(LoadHelper *file, int p)
|
||||
{
|
||||
auto &player = plr[p];
|
||||
auto &player = Players[p];
|
||||
|
||||
player._pmode = static_cast<PLR_MODE>(file->NextLE<int32_t>());
|
||||
|
||||
@@ -413,7 +413,7 @@ static void LoadPlayer(LoadHelper *file, int p)
|
||||
player._pDamageMod = file->NextLE<int32_t>();
|
||||
player._pBaseToBlk = file->NextLE<int32_t>();
|
||||
if (player._pBaseToBlk == 0)
|
||||
player._pBaseToBlk = ToBlkTbl[static_cast<std::size_t>(player._pClass)];
|
||||
player._pBaseToBlk = BlockBonuses[static_cast<std::size_t>(player._pClass)];
|
||||
player._pHPBase = file->NextLE<int32_t>();
|
||||
player._pMaxHPBase = file->NextLE<int32_t>();
|
||||
player._pHitPoints = file->NextLE<int32_t>();
|
||||
@@ -642,7 +642,7 @@ static void LoadMonster(LoadHelper *file, int i)
|
||||
pMonster->leaderflag = file->NextLE<uint8_t>();
|
||||
pMonster->packsize = file->NextLE<uint8_t>();
|
||||
pMonster->mlid = file->NextLE<int8_t>();
|
||||
if (pMonster->mlid == plr[myplr]._plid)
|
||||
if (pMonster->mlid == Players[MyPlayerId]._plid)
|
||||
pMonster->mlid = NO_LIGHT; // Correct incorect values in old saves
|
||||
|
||||
// Omit pointer mName;
|
||||
@@ -1000,7 +1000,7 @@ void LoadHotkeys()
|
||||
if (!file.IsValid())
|
||||
return;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (auto &spellId : myPlayer._pSplHotKey) {
|
||||
spellId = static_cast<spell_id>(file.NextLE<int32_t>());
|
||||
@@ -1014,7 +1014,7 @@ void LoadHotkeys()
|
||||
|
||||
void SaveHotkeys()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
const size_t nHotkeyTypes = sizeof(myPlayer._pSplHotKey) / sizeof(myPlayer._pSplHotKey[0]);
|
||||
const size_t nHotkeySpells = sizeof(myPlayer._pSplTHotKey) / sizeof(myPlayer._pSplTHotKey[0]);
|
||||
@@ -1131,9 +1131,9 @@ void LoadGame(bool firstflag)
|
||||
file.Skip(4); // Skip loading gnLevelTypeTbl
|
||||
}
|
||||
|
||||
LoadPlayer(&file, myplr);
|
||||
LoadPlayer(&file, MyPlayerId);
|
||||
|
||||
sgGameInitInfo.nDifficulty = plr[myplr].pDifficulty;
|
||||
sgGameInitInfo.nDifficulty = Players[MyPlayerId].pDifficulty;
|
||||
if (sgGameInitInfo.nDifficulty < DIFF_NORMAL || sgGameInitInfo.nDifficulty > DIFF_HELL)
|
||||
sgGameInitInfo.nDifficulty = DIFF_NORMAL;
|
||||
|
||||
@@ -1144,12 +1144,12 @@ void LoadGame(bool firstflag)
|
||||
|
||||
if (gbIsHellfireSaveGame != gbIsHellfire) {
|
||||
ConvertLevels();
|
||||
RemoveEmptyInventory(plr[myplr]);
|
||||
RemoveEmptyInventory(Players[MyPlayerId]);
|
||||
}
|
||||
|
||||
LoadGameLevel(firstflag, ENTRY_LOAD);
|
||||
SyncInitPlr(myplr);
|
||||
SyncPlrAnim(myplr);
|
||||
SyncInitPlr(MyPlayerId);
|
||||
SyncPlrAnim(MyPlayerId);
|
||||
|
||||
ViewX = viewX;
|
||||
ViewY = viewY;
|
||||
@@ -1258,7 +1258,7 @@ void LoadGame(bool firstflag)
|
||||
for (int i = 0; i < giNumberOfSmithPremiumItems; i++)
|
||||
LoadPremium(&file, i);
|
||||
if (gbIsHellfire && !gbIsHellfireSaveGame)
|
||||
SpawnPremium(myplr);
|
||||
SpawnPremium(MyPlayerId);
|
||||
|
||||
AutomapActive = file.NextBool8();
|
||||
AutoMapScale = file.NextBE<int32_t>();
|
||||
@@ -1385,7 +1385,7 @@ static void SaveItems(SaveHelper *file, ItemStruct *pItem, const int n)
|
||||
|
||||
static void SavePlayer(SaveHelper *file, int p)
|
||||
{
|
||||
auto &player = plr[p];
|
||||
auto &player = Players[p];
|
||||
|
||||
file->WriteLE<int32_t>(player._pmode);
|
||||
for (int8_t step : player.walkpath)
|
||||
@@ -1915,8 +1915,8 @@ void SaveGameData()
|
||||
file.WriteBE<int32_t>(gnLevelTypeTbl[i]);
|
||||
}
|
||||
|
||||
plr[myplr].pDifficulty = sgGameInitInfo.nDifficulty;
|
||||
SavePlayer(&file, myplr);
|
||||
Players[MyPlayerId].pDifficulty = sgGameInitInfo.nDifficulty;
|
||||
SavePlayer(&file, MyPlayerId);
|
||||
|
||||
for (int i = 0; i < giNumberQuests; i++)
|
||||
SaveQuest(&file, i);
|
||||
@@ -2034,7 +2034,7 @@ void SaveLevel()
|
||||
{
|
||||
PFileScopedArchiveWriter scopedWriter;
|
||||
|
||||
DoUnVision(plr[myplr].position.tile, plr[myplr]._pLightRad); // fix for vision staying on the level
|
||||
DoUnVision(Players[MyPlayerId].position.tile, Players[MyPlayerId]._pLightRad); // fix for vision staying on the level
|
||||
|
||||
if (currlevel == 0)
|
||||
glSeedTbl[0] = AdvanceRndSeed();
|
||||
@@ -2112,9 +2112,9 @@ void SaveLevel()
|
||||
}
|
||||
|
||||
if (!setlevel)
|
||||
plr[myplr]._pLvlVisited[currlevel] = true;
|
||||
Players[MyPlayerId]._pLvlVisited[currlevel] = true;
|
||||
else
|
||||
plr[myplr]._pSLvlVisited[setlvlnum] = true;
|
||||
Players[MyPlayerId]._pSLvlVisited[setlvlnum] = true;
|
||||
}
|
||||
|
||||
void LoadLevel()
|
||||
@@ -2208,7 +2208,7 @@ void LoadLevel()
|
||||
UpdateLighting = true;
|
||||
}
|
||||
|
||||
for (auto &player : plr) {
|
||||
for (auto &player : Players) {
|
||||
if (player.plractive && currlevel == player.plrlevel)
|
||||
Lights[player._plid]._lunflag = true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ bool mainmenu_select_hero_dialog(GameData *gameData)
|
||||
return false;
|
||||
}
|
||||
|
||||
pfile_read_player_from_save(gszHero, myplr);
|
||||
pfile_read_player_from_save(gszHero, MyPlayerId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ void SetCursorPos(int x, int y)
|
||||
// Moves the mouse to the first attribute "+" button.
|
||||
void FocusOnCharInfo()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (invflag || myPlayer._pStatPts <= 0)
|
||||
return;
|
||||
@@ -283,7 +283,7 @@ bool BlurInventory()
|
||||
{
|
||||
if (pcurs >= CURSOR_FIRSTITEM) {
|
||||
if (!TryDropItem()) {
|
||||
plr[myplr].Say(HeroSpeech::WhereWouldIPutThis);
|
||||
Players[MyPlayerId].Say(HeroSpeech::WhereWouldIPutThis);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+131
-131
@@ -67,10 +67,10 @@ int GenerateRndSum(int range, int iterations)
|
||||
|
||||
void GetDamageAmt(int i, int *mind, int *maxd)
|
||||
{
|
||||
assert(myplr >= 0 && myplr < MAX_PLRS);
|
||||
assert(MyPlayerId >= 0 && MyPlayerId < MAX_PLRS);
|
||||
assert(i >= 0 && i < 64);
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int sl = myPlayer._pSplLvl[i] + myPlayer._pISplLvlAdd;
|
||||
|
||||
@@ -226,9 +226,9 @@ static int FindClosest(Point source, int rad)
|
||||
|
||||
int GetSpellLevel(int playerId, spell_id sn)
|
||||
{
|
||||
auto &player = plr[playerId];
|
||||
auto &player = Players[playerId];
|
||||
|
||||
if (playerId != myplr)
|
||||
if (playerId != MyPlayerId)
|
||||
return 1; // BUGFIX spell level will be wrong in multiplayer
|
||||
|
||||
return std::max(player._pISplLvlAdd + player._pSplLvl[sn], 0);
|
||||
@@ -300,9 +300,9 @@ void DeleteMissile(int mi, int i)
|
||||
{
|
||||
if (missile[mi]._mitype == MIS_MANASHIELD) {
|
||||
int src = missile[mi]._misource;
|
||||
if (src == myplr)
|
||||
if (src == MyPlayerId)
|
||||
NetSendCmd(true, CMD_REMSHIELD);
|
||||
plr[src].pManaShield = false;
|
||||
Players[src].pManaShield = false;
|
||||
}
|
||||
|
||||
missileavail[MAXMISSILES - nummissiles] = mi;
|
||||
@@ -506,7 +506,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool
|
||||
int hit = GenerateRnd(100);
|
||||
int hper = 0;
|
||||
if (pnum != -1) {
|
||||
const auto &player = plr[pnum];
|
||||
const auto &player = Players[pnum];
|
||||
if (missiledata[t].mType == 0) {
|
||||
hper = player._pDexterity;
|
||||
hper += player._pIBonusToHit;
|
||||
@@ -555,7 +555,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool
|
||||
}
|
||||
|
||||
if (missiledata[t].mType == 0) {
|
||||
const auto &player = plr[pnum];
|
||||
const auto &player = Players[pnum];
|
||||
dam = player._pIBonusDamMod + dam * player._pIBonusDam / 100 + dam;
|
||||
if (player._pClass == HeroClass::Rogue)
|
||||
dam += player._pDamageMod;
|
||||
@@ -568,10 +568,10 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool
|
||||
if (resist)
|
||||
dam >>= 2;
|
||||
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
Monsters[m]._mhitpoints -= dam;
|
||||
|
||||
if ((gbIsHellfire && (plr[pnum]._pIFlags & ISPL_NOHEALMON) != 0) || (!gbIsHellfire && (plr[pnum]._pIFlags & ISPL_FIRE_ARROWS) != 0))
|
||||
if ((gbIsHellfire && (Players[pnum]._pIFlags & ISPL_NOHEALMON) != 0) || (!gbIsHellfire && (Players[pnum]._pIFlags & ISPL_FIRE_ARROWS) != 0))
|
||||
Monsters[m]._mFlags |= MFLAG_NOHEAL;
|
||||
|
||||
if (Monsters[m]._mhitpoints >> 6 <= 0) {
|
||||
@@ -589,7 +589,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool
|
||||
M_StartHit(m, pnum, dam);
|
||||
Monsters[m].Petrify();
|
||||
} else {
|
||||
if (missiledata[t].mType == 0 && (plr[pnum]._pIFlags & ISPL_KNOCKBACK) != 0) {
|
||||
if (missiledata[t].mType == 0 && (Players[pnum]._pIFlags & ISPL_KNOCKBACK) != 0) {
|
||||
M_GetKnockback(m);
|
||||
}
|
||||
if (m > MAX_PLRS - 1)
|
||||
@@ -599,7 +599,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool
|
||||
|
||||
if (Monsters[m]._msquelch == 0) {
|
||||
Monsters[m]._msquelch = UINT8_MAX;
|
||||
Monsters[m].position.last = plr[pnum].position.tile;
|
||||
Monsters[m].position.last = Players[pnum].position.tile;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -609,7 +609,7 @@ bool PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, bool s
|
||||
{
|
||||
*blocked = false;
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
if (player._pHitPoints >> 6 <= 0) {
|
||||
return false;
|
||||
@@ -728,7 +728,7 @@ bool PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, bool s
|
||||
|
||||
if (resper > 0) {
|
||||
dam -= dam * resper / 100;
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
ApplyPlrDamage(pnum, 0, 0, dam, earflag);
|
||||
}
|
||||
|
||||
@@ -738,7 +738,7 @@ bool PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, bool s
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
ApplyPlrDamage(pnum, 0, 0, dam, earflag);
|
||||
}
|
||||
|
||||
@@ -756,8 +756,8 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b
|
||||
|
||||
*blocked = false;
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &target = plr[p];
|
||||
auto &player = Players[pnum];
|
||||
auto &target = Players[p];
|
||||
|
||||
if (target._pInvincible) {
|
||||
return false;
|
||||
@@ -842,7 +842,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b
|
||||
dam /= 2;
|
||||
if (resper > 0) {
|
||||
dam -= (dam * resper) / 100;
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
NetSendCmdDamage(true, p, dam);
|
||||
player.Say(HeroSpeech::ArghClang);
|
||||
return true;
|
||||
@@ -852,7 +852,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b
|
||||
StartPlrBlock(p, GetDirection(target.position.tile, player.position.tile));
|
||||
*blocked = true;
|
||||
} else {
|
||||
if (pnum == myplr)
|
||||
if (pnum == MyPlayerId)
|
||||
NetSendCmdDamage(true, p, dam);
|
||||
StartPlrHit(p, dam, false);
|
||||
}
|
||||
@@ -1127,7 +1127,7 @@ void FreeMissiles2()
|
||||
|
||||
void InitMissiles()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
AutoMapShowItems = false;
|
||||
myPlayer._pSpellFlags &= ~0x1;
|
||||
@@ -1136,8 +1136,8 @@ void InitMissiles()
|
||||
int mi = missileactive[i];
|
||||
if (missile[mi]._mitype == MIS_INFRA) {
|
||||
int src = missile[mi]._misource;
|
||||
if (src == myplr)
|
||||
CalcPlrItemVals(myplr, true);
|
||||
if (src == MyPlayerId)
|
||||
CalcPlrItemVals(MyPlayerId, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1148,10 +1148,10 @@ void InitMissiles()
|
||||
for (int i = 0; i < nummissiles; ++i) {
|
||||
int mi = missileactive[i];
|
||||
if (missile[mi]._mitype == MIS_BLODBOIL) {
|
||||
if (missile[mi]._misource == myplr) {
|
||||
if (missile[mi]._misource == MyPlayerId) {
|
||||
int missingHP = myPlayer._pMaxHP - myPlayer._pHitPoints;
|
||||
CalcPlrItemVals(myplr, true);
|
||||
ApplyPlrDamage(myplr, 0, 1, missingHP + missile[mi]._miVar2);
|
||||
CalcPlrItemVals(MyPlayerId, true);
|
||||
ApplyPlrDamage(MyPlayerId, 0, 1, missingHP + missile[mi]._miVar2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1303,7 +1303,7 @@ void AddReflection(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /
|
||||
if (missile[mi]._mispllvl != 0)
|
||||
lvl = missile[mi]._mispllvl;
|
||||
|
||||
plr[id].wReflections += lvl * plr[id]._pLevel;
|
||||
Players[id].wReflections += lvl * Players[id]._pLevel;
|
||||
|
||||
UseMana(id, SPL_REFLECT);
|
||||
}
|
||||
@@ -1422,7 +1422,7 @@ void AddStealPotions(int mi, Point src, Point /*dst*/, int /*midir*/, int8_t /*m
|
||||
int8_t pnum = dPlayer[tx][ty];
|
||||
if (pnum == 0)
|
||||
continue;
|
||||
auto &player = plr[pnum > 0 ? pnum - 1 : -(pnum + 1)];
|
||||
auto &player = Players[pnum > 0 ? pnum - 1 : -(pnum + 1)];
|
||||
|
||||
bool hasPlayedSFX = false;
|
||||
for (int si = 0; si < MAXBELTITEMS; si++) {
|
||||
@@ -1495,7 +1495,7 @@ void AddManaTrap(int mi, Point src, Point /*dst*/, int /*midir*/, int8_t /*miene
|
||||
if (0 < tx && tx < MAXDUNX && 0 < ty && ty < MAXDUNY) {
|
||||
int8_t pid = dPlayer[tx][ty];
|
||||
if (pid != 0) {
|
||||
auto &player = plr[(pid > 0) ? pid - 1 : -(pid + 1)];
|
||||
auto &player = Players[(pid > 0) ? pid - 1 : -(pid + 1)];
|
||||
|
||||
player._pMana = 0;
|
||||
player._pManaBase = player._pMana + player._pMaxManaBase - player._pMaxMana;
|
||||
@@ -1515,7 +1515,7 @@ void AddSpecArrow(int mi, Point /*src*/, Point dst, int /*midir*/, int8_t mienem
|
||||
int av = 0;
|
||||
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
if (player._pClass == HeroClass::Rogue)
|
||||
av += (player._pLevel - 1) / 4;
|
||||
@@ -1542,7 +1542,7 @@ void AddWarp(int mi, Point src, Point /*dst*/, int /*midir*/, int8_t mienemy, in
|
||||
{
|
||||
int minDistanceSq = std::numeric_limits<int>::max();
|
||||
if (id >= 0) {
|
||||
src = plr[id].position.tile;
|
||||
src = Players[id].position.tile;
|
||||
}
|
||||
Point tile = src;
|
||||
|
||||
@@ -1580,15 +1580,15 @@ void AddLightningWall(int mi, Point src, Point dst, int /*midir*/, int8_t /*mien
|
||||
missile[mi]._miVar1 = src.x;
|
||||
missile[mi]._miVar2 = src.y;
|
||||
} else {
|
||||
missile[mi]._miVar1 = plr[id].position.tile.x;
|
||||
missile[mi]._miVar2 = plr[id].position.tile.y;
|
||||
missile[mi]._miVar1 = Players[id].position.tile.x;
|
||||
missile[mi]._miVar2 = Players[id].position.tile.y;
|
||||
}
|
||||
}
|
||||
|
||||
void AddRuneExplosion(int mi, Point src, Point /*dst*/, int /*midir*/, int8_t mienemy, int id, int /*dam*/)
|
||||
{
|
||||
if (mienemy == TARGET_MONSTERS || mienemy == TARGET_BOTH) {
|
||||
int dmg = 2 * (plr[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
int dmg = 2 * (Players[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
dmg = ScaleSpellEffect(dmg, missile[mi]._mispllvl);
|
||||
|
||||
missile[mi]._midam = dmg;
|
||||
@@ -1612,7 +1612,7 @@ void AddImmolation(int mi, Point src, Point dst, int midir, int8_t mienemy, int
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
sp += std::min(missile[mi]._mispllvl * 2, 34);
|
||||
|
||||
int dmg = 2 * (plr[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
int dmg = 2 * (Players[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
missile[mi]._midam = ScaleSpellEffect(dmg, missile[mi]._mispllvl);
|
||||
|
||||
UseMana(id, SPL_FIREBALL);
|
||||
@@ -1662,15 +1662,15 @@ void AddLightningArrow(int mi, Point src, Point dst, int midir, int8_t /*mienemy
|
||||
missile[mi]._miVar1 = src.x;
|
||||
missile[mi]._miVar2 = src.y;
|
||||
} else {
|
||||
missile[mi]._miVar1 = plr[id].position.tile.x;
|
||||
missile[mi]._miVar2 = plr[id].position.tile.y;
|
||||
missile[mi]._miVar1 = Players[id].position.tile.x;
|
||||
missile[mi]._miVar2 = Players[id].position.tile.y;
|
||||
}
|
||||
missile[mi]._midam <<= 6;
|
||||
}
|
||||
|
||||
void AddMana(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*mienemy*/, int id, int /*dam*/)
|
||||
{
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
int manaAmount = (GenerateRnd(10) + 1) << 6;
|
||||
for (int i = 0; i < player._pLevel; i++) {
|
||||
@@ -1696,7 +1696,7 @@ void AddMana(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*miene
|
||||
|
||||
void AddMagi(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*mienemy*/, int id, int /*dam*/)
|
||||
{
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
player._pMana = player._pMaxMana;
|
||||
player._pManaBase = player._pMaxManaBase;
|
||||
@@ -1736,7 +1736,7 @@ void AddSearch(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t miene
|
||||
AutoMapShowItems = true;
|
||||
int lvl = 2;
|
||||
if (id > -1)
|
||||
lvl = plr[id]._pLevel * 2;
|
||||
lvl = Players[id]._pLevel * 2;
|
||||
missile[mi]._mirange = lvl + 10 * missile[mi]._mispllvl + 245;
|
||||
if (mienemy == TARGET_MONSTERS)
|
||||
UseMana(id, SPL_SEARCH);
|
||||
@@ -1783,7 +1783,7 @@ void AddLArrow(int mi, Point src, Point dst, int midir, int8_t mienemy, int id,
|
||||
}
|
||||
int av = 32;
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
if (player._pClass == HeroClass::Rogue)
|
||||
av += (player._pLevel) / 4;
|
||||
else if (player._pClass == HeroClass::Warrior || player._pClass == HeroClass::Bard)
|
||||
@@ -1819,7 +1819,7 @@ void AddArrow(int mi, Point src, Point dst, int midir, int8_t mienemy, int id, i
|
||||
}
|
||||
int av = 32;
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
if ((player._pIFlags & ISPL_RNDARROWVEL) != 0) {
|
||||
av = GenerateRnd(32) + 16;
|
||||
@@ -1852,7 +1852,7 @@ void UpdateVileMissPos(int mi, Point dst)
|
||||
int yy = j + dst.y;
|
||||
for (int i = -k; i <= k; i++) {
|
||||
int xx = i + dst.x;
|
||||
if (PosOkPlayer(myplr, { xx, yy })) {
|
||||
if (PosOkPlayer(MyPlayerId, { xx, yy })) {
|
||||
missile[mi].position.tile = { xx, yy };
|
||||
return;
|
||||
}
|
||||
@@ -1901,7 +1901,7 @@ void AddRndTeleport(int mi, Point src, Point dst, int /*midir*/, int8_t mienemy,
|
||||
// BUGFIX: should only run magic circle check if dObject[dx][dy] is non-zero.
|
||||
if (object[oi]._otype == OBJ_MCIRCLE1 || object[oi]._otype == OBJ_MCIRCLE2) {
|
||||
missile[mi].position.tile = dst;
|
||||
if (!PosOkPlayer(myplr, dst))
|
||||
if (!PosOkPlayer(MyPlayerId, dst))
|
||||
UpdateVileMissPos(mi, dst);
|
||||
}
|
||||
}
|
||||
@@ -1997,15 +1997,15 @@ void AddLightball(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy*
|
||||
missile[mi]._miVar1 = src.x;
|
||||
missile[mi]._miVar2 = src.y;
|
||||
} else {
|
||||
missile[mi]._miVar1 = plr[id].position.tile.x;
|
||||
missile[mi]._miVar2 = plr[id].position.tile.y;
|
||||
missile[mi]._miVar1 = Players[id].position.tile.x;
|
||||
missile[mi]._miVar2 = Players[id].position.tile.y;
|
||||
}
|
||||
}
|
||||
|
||||
void AddFirewall(int mi, Point src, Point dst, int /*midir*/, int8_t mienemy, int id, int /*dam*/)
|
||||
{
|
||||
missile[mi]._midam = GenerateRndSum(10, 2) + 2;
|
||||
missile[mi]._midam += id >= 0 ? plr[id]._pLevel : currlevel; // BUGFIX: missing parenthesis around ternary (fixed)
|
||||
missile[mi]._midam += id >= 0 ? Players[id]._pLevel : currlevel; // BUGFIX: missing parenthesis around ternary (fixed)
|
||||
missile[mi]._midam <<= 3;
|
||||
UpdateMissileVel(mi, src, dst, 16);
|
||||
int i = missile[mi]._mispllvl;
|
||||
@@ -2015,7 +2015,7 @@ void AddFirewall(int mi, Point src, Point dst, int /*midir*/, int8_t mienemy, in
|
||||
if (mienemy == TARGET_PLAYERS || id < 0)
|
||||
missile[mi]._mirange += currlevel;
|
||||
else
|
||||
missile[mi]._mirange += (plr[id]._pISplDur * missile[mi]._mirange) / 128;
|
||||
missile[mi]._mirange += (Players[id]._pISplDur * missile[mi]._mirange) / 128;
|
||||
missile[mi]._mirange *= 16;
|
||||
missile[mi]._miVar1 = missile[mi]._mirange - missile[mi]._miAnimLen;
|
||||
missile[mi]._miVar2 = 0;
|
||||
@@ -2030,7 +2030,7 @@ void AddFireball(int mi, Point src, Point dst, int midir, int8_t mienemy, int id
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
sp += std::min(missile[mi]._mispllvl * 2, 34);
|
||||
|
||||
int dmg = 2 * (plr[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
int dmg = 2 * (Players[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
missile[mi]._midam = ScaleSpellEffect(dmg, missile[mi]._mispllvl);
|
||||
|
||||
UseMana(id, SPL_FIREBALL);
|
||||
@@ -2174,7 +2174,7 @@ void AddTown(int mi, Point /*src*/, Point dst, int /*midir*/, int8_t /*mienemy*/
|
||||
missile[mx]._mirange = 0;
|
||||
}
|
||||
PutMissile(mi);
|
||||
if (id == myplr && !missile[mi]._miDelFlag && currlevel != 0) {
|
||||
if (id == MyPlayerId && !missile[mi]._miDelFlag && currlevel != 0) {
|
||||
if (!setlevel) {
|
||||
NetSendCmdLocParam3(true, CMD_ACTIVATEPORTAL, { tx, ty }, currlevel, leveltype, 0);
|
||||
} else {
|
||||
@@ -2187,7 +2187,7 @@ void AddFlash(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t mienem
|
||||
{
|
||||
if (id != -1) {
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
int dmg = GenerateRndSum(20, plr[id]._pLevel + 1) + plr[id]._pLevel + 1;
|
||||
int dmg = GenerateRndSum(20, Players[id]._pLevel + 1) + Players[id]._pLevel + 1;
|
||||
missile[mi]._midam = ScaleSpellEffect(dmg, missile[mi]._mispllvl);
|
||||
missile[mi]._midam += missile[mi]._midam / 2;
|
||||
UseMana(id, SPL_FLASH);
|
||||
@@ -2204,7 +2204,7 @@ void AddFlash2(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t miene
|
||||
{
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
if (id != -1) {
|
||||
int dmg = GenerateRndSum(20, plr[id]._pLevel + 1) + plr[id]._pLevel + 1;
|
||||
int dmg = GenerateRndSum(20, Players[id]._pLevel + 1) + Players[id]._pLevel + 1;
|
||||
missile[mi]._midam = ScaleSpellEffect(dmg, missile[mi]._mispllvl);
|
||||
missile[mi]._midam += missile[mi]._midam / 2;
|
||||
} else {
|
||||
@@ -2217,17 +2217,17 @@ void AddFlash2(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t miene
|
||||
|
||||
void AddManashield(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t mienemy, int id, int /*dam*/)
|
||||
{
|
||||
missile[mi]._mirange = 48 * plr[id]._pLevel;
|
||||
missile[mi]._mirange = 48 * Players[id]._pLevel;
|
||||
if (mienemy == TARGET_MONSTERS)
|
||||
UseMana(id, SPL_MANASHIELD);
|
||||
if (id == myplr)
|
||||
if (id == MyPlayerId)
|
||||
NetSendCmd(true, CMD_SETSHIELD);
|
||||
plr[id].pManaShield = true;
|
||||
Players[id].pManaShield = true;
|
||||
}
|
||||
|
||||
void AddFiremove(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy*/, int id, int /*dam*/)
|
||||
{
|
||||
missile[mi]._midam = GenerateRnd(10) + plr[id]._pLevel + 1;
|
||||
missile[mi]._midam = GenerateRnd(10) + Players[id]._pLevel + 1;
|
||||
UpdateMissileVel(mi, src, dst, 16);
|
||||
missile[mi]._mirange = 255;
|
||||
missile[mi]._miVar1 = 0;
|
||||
@@ -2239,7 +2239,7 @@ void AddFiremove(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy*/
|
||||
|
||||
void AddGuardian(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy*/, int id, int /*dam*/)
|
||||
{
|
||||
int dmg = GenerateRnd(10) + (plr[id]._pLevel / 2) + 1;
|
||||
int dmg = GenerateRnd(10) + (Players[id]._pLevel / 2) + 1;
|
||||
missile[mi]._midam = ScaleSpellEffect(dmg, missile[mi]._mispllvl);
|
||||
|
||||
missile[mi]._miDelFlag = true;
|
||||
@@ -2268,8 +2268,8 @@ void AddGuardian(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy*/
|
||||
if (!missile[mi]._miDelFlag) {
|
||||
missile[mi]._misource = id;
|
||||
missile[mi]._mlid = AddLight(missile[mi].position.tile, 1);
|
||||
missile[mi]._mirange = missile[mi]._mispllvl + (plr[id]._pLevel / 2);
|
||||
missile[mi]._mirange += (missile[mi]._mirange * plr[id]._pISplDur) / 128;
|
||||
missile[mi]._mirange = missile[mi]._mispllvl + (Players[id]._pLevel / 2);
|
||||
missile[mi]._mirange += (missile[mi]._mirange * Players[id]._pISplDur) / 128;
|
||||
|
||||
if (missile[mi]._mirange > 30)
|
||||
missile[mi]._mirange = 30;
|
||||
@@ -2473,7 +2473,7 @@ void AddStone(int mi, Point /*src*/, Point dst, int /*midir*/, int8_t /*mienemy*
|
||||
missile[mi].position.tile = { tx, ty };
|
||||
missile[mi].position.start = missile[mi].position.tile;
|
||||
missile[mi]._mirange = missile[mi]._mispllvl + 6;
|
||||
missile[mi]._mirange += (missile[mi]._mirange * plr[id]._pISplDur) / 128;
|
||||
missile[mi]._mirange += (missile[mi]._mirange * Players[id]._pISplDur) / 128;
|
||||
|
||||
if (missile[mi]._mirange > 15)
|
||||
missile[mi]._mirange = 15;
|
||||
@@ -2497,14 +2497,14 @@ void AddGolem(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy*/, i
|
||||
missile[mi]._miVar2 = src.y;
|
||||
missile[mi]._miVar4 = dst.x;
|
||||
missile[mi]._miVar5 = dst.y;
|
||||
if ((Monsters[id].position.tile.x != 1 || Monsters[id].position.tile.y != 0) && id == myplr)
|
||||
if ((Monsters[id].position.tile.x != 1 || Monsters[id].position.tile.y != 0) && id == MyPlayerId)
|
||||
M_StartKill(id, id);
|
||||
UseMana(id, SPL_GOLEM);
|
||||
}
|
||||
|
||||
void AddEtherealize(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t mienemy, int id, int /*dam*/)
|
||||
{
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
int range = 8 * player._pLevel;
|
||||
missile[mi]._mirange = ScaleSpellEffect(range, missile[mi]._mispllvl);
|
||||
@@ -2547,7 +2547,7 @@ void AddBoom(int mi, Point /*src*/, Point dst, int /*midir*/, int8_t /*mienemy*/
|
||||
|
||||
void AddHeal(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*mienemy*/, int id, int /*dam*/)
|
||||
{
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
int hp = (GenerateRnd(10) + 1) << 6;
|
||||
for (int i = 0; i < player._pLevel; i++) {
|
||||
@@ -2575,7 +2575,7 @@ void AddHealOther(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*
|
||||
{
|
||||
missile[mi]._miDelFlag = true;
|
||||
UseMana(id, SPL_HEALOTHER);
|
||||
if (id == myplr) {
|
||||
if (id == MyPlayerId) {
|
||||
NewCursor(CURSOR_HEALOTHER);
|
||||
if (sgbControllerActive)
|
||||
TryIconCurs();
|
||||
@@ -2588,7 +2588,7 @@ void AddElement(int mi, Point src, Point dst, int midir, int8_t /*mienemy*/, int
|
||||
dst += static_cast<Direction>(midir);
|
||||
}
|
||||
|
||||
int dmg = 2 * (plr[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
int dmg = 2 * (Players[id]._pLevel + GenerateRndSum(10, 2)) + 4;
|
||||
missile[mi]._midam = ScaleSpellEffect(dmg, missile[mi]._mispllvl) / 2;
|
||||
|
||||
UpdateMissileVel(mi, src, dst, 16);
|
||||
@@ -2609,7 +2609,7 @@ void AddIdentify(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*m
|
||||
{
|
||||
missile[mi]._miDelFlag = true;
|
||||
UseMana(id, SPL_IDENTIFY);
|
||||
if (id == myplr) {
|
||||
if (id == MyPlayerId) {
|
||||
if (sbookflag)
|
||||
sbookflag = false;
|
||||
if (!invflag) {
|
||||
@@ -2660,7 +2660,7 @@ void AddFirewallC(int mi, Point src, Point dst, int midir, int8_t /*mienemy*/, i
|
||||
void AddInfra(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t mienemy, int id, int /*dam*/)
|
||||
{
|
||||
missile[mi]._mirange = ScaleSpellEffect(1584, missile[mi]._mispllvl);
|
||||
missile[mi]._mirange += missile[mi]._mirange * plr[id]._pISplDur / 128;
|
||||
missile[mi]._mirange += missile[mi]._mirange * Players[id]._pISplDur / 128;
|
||||
|
||||
if (mienemy == TARGET_MONSTERS)
|
||||
UseMana(id, SPL_INFRA);
|
||||
@@ -2683,7 +2683,7 @@ void AddNova(int mi, Point /*src*/, Point dst, int /*midir*/, int8_t mienemy, in
|
||||
missile[mi]._miVar2 = dst.y;
|
||||
|
||||
if (id != -1) {
|
||||
int dmg = GenerateRndSum(6, 5) + plr[id]._pLevel + 5;
|
||||
int dmg = GenerateRndSum(6, 5) + Players[id]._pLevel + 5;
|
||||
missile[mi]._midam = ScaleSpellEffect(dmg / 2, missile[mi]._mispllvl);
|
||||
|
||||
if (mienemy == TARGET_MONSTERS)
|
||||
@@ -2697,7 +2697,7 @@ void AddNova(int mi, Point /*src*/, Point dst, int /*midir*/, int8_t mienemy, in
|
||||
|
||||
void AddBlodboil(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*mienemy*/, int id, int /*dam*/)
|
||||
{
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
if ((player._pSpellFlags & 6) != 0 || player._pHitPoints <= player._pLevel << 6) {
|
||||
missile[mi]._miDelFlag = true;
|
||||
@@ -2721,7 +2721,7 @@ void AddRepair(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*mie
|
||||
{
|
||||
missile[mi]._miDelFlag = true;
|
||||
UseMana(id, SPL_REPAIR);
|
||||
if (id == myplr) {
|
||||
if (id == MyPlayerId) {
|
||||
if (sbookflag)
|
||||
sbookflag = false;
|
||||
if (!invflag) {
|
||||
@@ -2737,7 +2737,7 @@ void AddRecharge(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*m
|
||||
{
|
||||
missile[mi]._miDelFlag = true;
|
||||
UseMana(id, SPL_RECHARGE);
|
||||
if (id == myplr) {
|
||||
if (id == MyPlayerId) {
|
||||
if (sbookflag)
|
||||
sbookflag = false;
|
||||
if (!invflag) {
|
||||
@@ -2753,7 +2753,7 @@ void AddDisarm(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*mie
|
||||
{
|
||||
missile[mi]._miDelFlag = true;
|
||||
UseMana(id, SPL_DISARM);
|
||||
if (id == myplr) {
|
||||
if (id == MyPlayerId) {
|
||||
NewCursor(CURSOR_DISARM);
|
||||
if (sgbControllerActive) {
|
||||
if (pcursobj != -1)
|
||||
@@ -2780,7 +2780,7 @@ void AddApoca(int mi, Point src, Point /*dst*/, int /*midir*/, int8_t /*mienemy*
|
||||
missile[mi]._miVar4 = 1;
|
||||
if (missile[mi]._miVar5 >= MAXDUNX)
|
||||
missile[mi]._miVar5 = MAXDUNX - 1;
|
||||
missile[mi]._midam = GenerateRndSum(6, plr[id]._pLevel) + plr[id]._pLevel;
|
||||
missile[mi]._midam = GenerateRndSum(6, Players[id]._pLevel) + Players[id]._pLevel;
|
||||
missile[mi]._mirange = 255;
|
||||
missile[mi]._miDelFlag = false;
|
||||
UseMana(id, SPL_APOCA);
|
||||
@@ -2795,7 +2795,7 @@ void AddFlame(int mi, Point src, Point dst, int midir, int8_t mienemy, int id, i
|
||||
missile[mi]._mirange = missile[mi]._miVar2 + 20;
|
||||
missile[mi]._mlid = AddLight(src, 1);
|
||||
if (mienemy == TARGET_MONSTERS) {
|
||||
int i = GenerateRnd(plr[id]._pLevel) + GenerateRnd(2);
|
||||
int i = GenerateRnd(Players[id]._pLevel) + GenerateRnd(2);
|
||||
missile[mi]._midam = 8 * i + 16 + ((8 * i + 16) / 2);
|
||||
} else {
|
||||
missile[mi]._midam = Monsters[id].mMinDamage + GenerateRnd(Monsters[id].mMaxDamage - Monsters[id].mMinDamage + 1);
|
||||
@@ -2822,7 +2822,7 @@ void AddCbolt(int mi, Point src, Point dst, int midir, int8_t micaster, int id,
|
||||
assert((DWORD)mi < MAXMISSILES);
|
||||
|
||||
missile[mi]._mirnd = GenerateRnd(15) + 1;
|
||||
missile[mi]._midam = (micaster == 0) ? (GenerateRnd(plr[id]._pMagic / 4) + 1) : 15;
|
||||
missile[mi]._midam = (micaster == 0) ? (GenerateRnd(Players[id]._pMagic / 4) + 1) : 15;
|
||||
|
||||
if (src == dst) {
|
||||
dst += static_cast<Direction>(midir);
|
||||
@@ -2854,14 +2854,14 @@ void AddHbolt(int mi, Point src, Point dst, int midir, int8_t /*micaster*/, int
|
||||
missile[mi]._miVar1 = src.x;
|
||||
missile[mi]._miVar2 = src.y;
|
||||
missile[mi]._mlid = AddLight(src, 8);
|
||||
missile[mi]._midam = GenerateRnd(10) + plr[id]._pLevel + 9;
|
||||
missile[mi]._midam = GenerateRnd(10) + Players[id]._pLevel + 9;
|
||||
UseMana(id, SPL_HBOLT);
|
||||
}
|
||||
|
||||
void AddResurrect(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t /*mienemy*/, int id, int /*dam*/)
|
||||
{
|
||||
UseMana(id, SPL_RESURRECT);
|
||||
if (id == myplr) {
|
||||
if (id == MyPlayerId) {
|
||||
NewCursor(CURSOR_RESURRECT);
|
||||
if (sgbControllerActive)
|
||||
TryIconCurs();
|
||||
@@ -2881,7 +2881,7 @@ void AddTelekinesis(int mi, Point /*src*/, Point /*dst*/, int /*midir*/, int8_t
|
||||
{
|
||||
missile[mi]._miDelFlag = true;
|
||||
UseMana(id, SPL_TELEKINESIS);
|
||||
if (id == myplr)
|
||||
if (id == MyPlayerId)
|
||||
NewCursor(CURSOR_TELEKINESIS);
|
||||
}
|
||||
|
||||
@@ -2920,7 +2920,7 @@ void AddDiabApoca(int mi, Point src, Point /*dst*/, int /*midir*/, int8_t mienem
|
||||
{
|
||||
int players = gbIsMultiplayer ? MAX_PLRS : 1;
|
||||
for (int pnum = 0; pnum < players; pnum++) {
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
if (!player.plractive)
|
||||
continue;
|
||||
if (!LineClearMissile(src, player.position.future))
|
||||
@@ -2936,8 +2936,8 @@ int AddMissile(Point src, Point dst, int midir, int mitype, int8_t micaster, int
|
||||
if (nummissiles >= MAXMISSILES - 1)
|
||||
return -1;
|
||||
|
||||
if (mitype == MIS_MANASHIELD && plr[id].pManaShield) {
|
||||
if (currlevel != plr[id].plrlevel)
|
||||
if (mitype == MIS_MANASHIELD && Players[id].pManaShield) {
|
||||
if (currlevel != Players[id].plrlevel)
|
||||
return -1;
|
||||
|
||||
for (int i = 0; i < nummissiles; i++) {
|
||||
@@ -3053,8 +3053,8 @@ void MI_LArrow(int i)
|
||||
int mind;
|
||||
int maxd;
|
||||
if (p != -1) {
|
||||
mind = plr[p]._pILMinDam;
|
||||
maxd = plr[p]._pILMaxDam;
|
||||
mind = Players[p]._pILMinDam;
|
||||
maxd = Players[p]._pILMaxDam;
|
||||
} else {
|
||||
mind = GenerateRnd(10) + 1 + currlevel;
|
||||
maxd = GenerateRnd(10) + 1 + currlevel * 2;
|
||||
@@ -3066,8 +3066,8 @@ void MI_LArrow(int i)
|
||||
int mind;
|
||||
int maxd;
|
||||
if (p != -1) {
|
||||
mind = plr[p]._pIFMinDam;
|
||||
maxd = plr[p]._pIFMaxDam;
|
||||
mind = Players[p]._pIFMinDam;
|
||||
maxd = Players[p]._pIFMaxDam;
|
||||
} else {
|
||||
mind = GenerateRnd(10) + 1 + currlevel;
|
||||
maxd = GenerateRnd(10) + 1 + currlevel * 2;
|
||||
@@ -3085,8 +3085,8 @@ void MI_LArrow(int i)
|
||||
int maxd;
|
||||
if (p != -1) {
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
mind = plr[p]._pIMinDam;
|
||||
maxd = plr[p]._pIMaxDam;
|
||||
mind = Players[p]._pIMinDam;
|
||||
maxd = Players[p]._pIMaxDam;
|
||||
} else {
|
||||
mind = Monsters[p].mMinDamage;
|
||||
maxd = Monsters[p].mMaxDamage;
|
||||
@@ -3139,8 +3139,8 @@ void MI_Arrow(int i)
|
||||
int maxd;
|
||||
if (p != -1) {
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
mind = plr[p]._pIMinDam;
|
||||
maxd = plr[p]._pIMaxDam;
|
||||
mind = Players[p]._pIMinDam;
|
||||
maxd = Players[p]._pIMaxDam;
|
||||
} else {
|
||||
mind = Monsters[p].mMinDamage;
|
||||
maxd = Monsters[p].mMaxDamage;
|
||||
@@ -3171,10 +3171,10 @@ void MI_Firebolt(int i)
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
switch (missile[i]._mitype) {
|
||||
case MIS_FIREBOLT:
|
||||
d = GenerateRnd(10) + (plr[p]._pMagic / 8) + missile[i]._mispllvl + 1;
|
||||
d = GenerateRnd(10) + (Players[p]._pMagic / 8) + missile[i]._mispllvl + 1;
|
||||
break;
|
||||
case MIS_FLARE:
|
||||
d = 3 * missile[i]._mispllvl - (plr[p]._pMagic / 8) + (plr[p]._pMagic / 2);
|
||||
d = 3 * missile[i]._mispllvl - (Players[p]._pMagic / 8) + (Players[p]._pMagic / 2);
|
||||
break;
|
||||
case MIS_BONESPIRIT:
|
||||
d = 0;
|
||||
@@ -3332,7 +3332,7 @@ static void FireballUpdate(int i, Displacement offset, bool alwaysDelete)
|
||||
missile[i]._mirange--;
|
||||
|
||||
int id = missile[i]._misource;
|
||||
Point p = (missile[i]._micaster == TARGET_MONSTERS) ? plr[id].position.tile : Monsters[id].position.tile;
|
||||
Point p = (missile[i]._micaster == TARGET_MONSTERS) ? Players[id].position.tile : Monsters[id].position.tile;
|
||||
|
||||
if (missile[i]._miAnimType == MFILE_BIGEXP) {
|
||||
if (missile[i]._mirange == 0) {
|
||||
@@ -3436,7 +3436,7 @@ void MI_Rune(int i)
|
||||
dir = GetDirection(missile[i].position.tile, Monsters[mid].position.tile);
|
||||
} else {
|
||||
pid = (pid > 0) ? (pid - 1) : -(pid + 1);
|
||||
dir = GetDirection(missile[i].position.tile, plr[pid].position.tile);
|
||||
dir = GetDirection(missile[i].position.tile, Players[pid].position.tile);
|
||||
}
|
||||
missile[i]._miDelFlag = true;
|
||||
AddUnLight(missile[i]._mlid);
|
||||
@@ -3568,9 +3568,9 @@ void MI_FlashFront(int i)
|
||||
{
|
||||
int src = missile[i]._misource;
|
||||
if (missile[i]._micaster == TARGET_MONSTERS && src != -1) {
|
||||
missile[i].position.tile = plr[src].position.tile;
|
||||
missile[i].position.traveled.deltaX = plr[src].position.offset.deltaX << 16;
|
||||
missile[i].position.traveled.deltaY = plr[src].position.offset.deltaY << 16;
|
||||
missile[i].position.tile = Players[src].position.tile;
|
||||
missile[i].position.traveled.deltaX = Players[src].position.offset.deltaX << 16;
|
||||
missile[i].position.traveled.deltaY = Players[src].position.offset.deltaY << 16;
|
||||
}
|
||||
missile[i]._mirange--;
|
||||
if (missile[i]._mirange == 0) {
|
||||
@@ -3578,7 +3578,7 @@ void MI_FlashFront(int i)
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
src = missile[i]._misource;
|
||||
if (src != -1)
|
||||
plr[src]._pBaseToBlk -= 50;
|
||||
Players[src]._pBaseToBlk -= 50;
|
||||
}
|
||||
}
|
||||
PutMissile(i);
|
||||
@@ -3587,9 +3587,9 @@ void MI_FlashFront(int i)
|
||||
void MI_Reflect(int i)
|
||||
{
|
||||
int src = missile[i]._misource;
|
||||
if (src != myplr && currlevel != plr[src].plrlevel)
|
||||
if (src != MyPlayerId && currlevel != Players[src].plrlevel)
|
||||
missile[i]._miDelFlag = true;
|
||||
if (plr[src].wReflections <= 0) {
|
||||
if (Players[src].wReflections <= 0) {
|
||||
missile[i]._miDelFlag = true;
|
||||
NetSendCmd(true, CMD_REFLECT);
|
||||
}
|
||||
@@ -3600,7 +3600,7 @@ static void MissileRing(int i, int type)
|
||||
{
|
||||
missile[i]._miDelFlag = true;
|
||||
int8_t src = missile[i]._micaster;
|
||||
uint8_t lvl = src > 0 ? plr[src]._pLevel : currlevel;
|
||||
uint8_t lvl = src > 0 ? Players[src]._pLevel : currlevel;
|
||||
int dmg = 16 * (GenerateRndSum(10, 2) + lvl + 2) / 2;
|
||||
|
||||
int k = CrawlNum[3];
|
||||
@@ -3643,7 +3643,7 @@ void MI_Search(int i)
|
||||
return;
|
||||
|
||||
missile[i]._miDelFlag = true;
|
||||
PlaySfxLoc(IS_CAST7, plr[missile[i]._miVar1].position.tile);
|
||||
PlaySfxLoc(IS_CAST7, Players[missile[i]._miVar1].position.tile);
|
||||
AutoMapShowItems = false;
|
||||
}
|
||||
|
||||
@@ -3656,7 +3656,7 @@ bool GrowWall(int playerId, Point position, Point target, missile_id type, int s
|
||||
return false;
|
||||
}
|
||||
|
||||
AddMissile(position, position, plr[playerId]._pdir, type, TARGET_BOTH, playerId, damage, spellLevel);
|
||||
AddMissile(position, position, Players[playerId]._pdir, type, TARGET_BOTH, playerId, damage, spellLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3669,7 +3669,7 @@ void MI_LightningWallC(int i)
|
||||
}
|
||||
|
||||
int id = missile[i]._misource;
|
||||
int lvl = (id > -1) ? plr[id]._pLevel : 0;
|
||||
int lvl = (id > -1) ? Players[id]._pLevel : 0;
|
||||
int dmg = 16 * (GenerateRndSum(10, 2) + lvl + 2);
|
||||
|
||||
{
|
||||
@@ -3707,7 +3707,7 @@ void MI_FireNova(int i)
|
||||
Direction dir = DIR_S;
|
||||
mienemy_type en = TARGET_PLAYERS;
|
||||
if (id != -1) {
|
||||
dir = plr[id]._pdir;
|
||||
dir = Players[id]._pdir;
|
||||
en = TARGET_MONSTERS;
|
||||
}
|
||||
for (const auto &k : VisionCrawlTable) {
|
||||
@@ -3735,10 +3735,10 @@ void MI_SpecArrow(int i)
|
||||
Direction dir = DIR_S;
|
||||
mienemy_type micaster = TARGET_PLAYERS;
|
||||
if (id != -1) {
|
||||
dir = plr[id]._pdir;
|
||||
dir = Players[id]._pdir;
|
||||
micaster = TARGET_MONSTERS;
|
||||
|
||||
switch (plr[id]._pILMinDam) {
|
||||
switch (Players[id]._pILMinDam) {
|
||||
case 0:
|
||||
mitype = MIS_FIRENOVA;
|
||||
break;
|
||||
@@ -3772,7 +3772,7 @@ void MI_Lightctrl(int i)
|
||||
int id = missile[i]._misource;
|
||||
if (id != -1) {
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
dam = (GenerateRnd(2) + GenerateRnd(plr[id]._pLevel) + 2) << 6;
|
||||
dam = (GenerateRnd(2) + GenerateRnd(Players[id]._pLevel) + 2) << 6;
|
||||
} else {
|
||||
dam = 2 * (Monsters[id].mMinDamage + GenerateRnd(Monsters[id].mMaxDamage - Monsters[id].mMinDamage + 1));
|
||||
}
|
||||
@@ -3873,10 +3873,10 @@ void MI_Town(int i)
|
||||
}
|
||||
|
||||
for (int p = 0; p < MAX_PLRS; p++) {
|
||||
auto &player = plr[p];
|
||||
auto &player = Players[p];
|
||||
if (player.plractive && currlevel == player.plrlevel && !player._pLvlChanging && player._pmode == PM_STAND && player.position.tile == missile[i].position.tile) {
|
||||
ClrPlrPath(player);
|
||||
if (p == myplr) {
|
||||
if (p == MyPlayerId) {
|
||||
NetSendCmdParam1(true, CMD_WARP, missile[i]._misource);
|
||||
player._pmode = PM_NEWLVL;
|
||||
}
|
||||
@@ -3894,7 +3894,7 @@ void MI_Flash(int i)
|
||||
{
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
if (missile[i]._misource != -1)
|
||||
plr[missile[i]._misource]._pInvincible = true;
|
||||
Players[missile[i]._misource]._pInvincible = true;
|
||||
}
|
||||
missile[i]._mirange--;
|
||||
|
||||
@@ -3906,7 +3906,7 @@ void MI_Flash(int i)
|
||||
missile[i]._miDelFlag = true;
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
if (missile[i]._misource != -1)
|
||||
plr[missile[i]._misource]._pInvincible = false;
|
||||
Players[missile[i]._misource]._pInvincible = false;
|
||||
}
|
||||
}
|
||||
PutMissile(i);
|
||||
@@ -3916,7 +3916,7 @@ void MI_Flash2(int i)
|
||||
{
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
if (missile[i]._misource != -1)
|
||||
plr[missile[i]._misource]._pInvincible = true;
|
||||
Players[missile[i]._misource]._pInvincible = true;
|
||||
}
|
||||
missile[i]._mirange--;
|
||||
|
||||
@@ -3928,7 +3928,7 @@ void MI_Flash2(int i)
|
||||
missile[i]._miDelFlag = true;
|
||||
if (missile[i]._micaster == TARGET_MONSTERS) {
|
||||
if (missile[i]._misource != -1)
|
||||
plr[missile[i]._misource]._pInvincible = false;
|
||||
Players[missile[i]._misource]._pInvincible = false;
|
||||
}
|
||||
}
|
||||
PutMissile(i);
|
||||
@@ -3937,11 +3937,11 @@ void MI_Flash2(int i)
|
||||
void MI_Manashield(int i)
|
||||
{
|
||||
int id = missile[i]._misource;
|
||||
if (id != myplr) {
|
||||
if (currlevel != plr[id].plrlevel)
|
||||
if (id != MyPlayerId) {
|
||||
if (currlevel != Players[id].plrlevel)
|
||||
missile[i]._miDelFlag = true;
|
||||
} else {
|
||||
if (plr[id]._pMana <= 0 || !plr[id].plractive)
|
||||
if (Players[id]._pMana <= 0 || !Players[id].plractive)
|
||||
missile[i]._mirange = 0;
|
||||
|
||||
if (missile[i]._mirange == 0) {
|
||||
@@ -3956,7 +3956,7 @@ void MI_Etherealize(int i)
|
||||
{
|
||||
missile[i]._mirange--;
|
||||
|
||||
auto &player = plr[missile[i]._misource];
|
||||
auto &player = Players[missile[i]._misource];
|
||||
|
||||
missile[i].position.tile = player.position.tile;
|
||||
missile[i].position.traveled.deltaX = player.position.offset.deltaX << 16;
|
||||
@@ -4136,12 +4136,12 @@ void MI_Weapexp(int i)
|
||||
int mind;
|
||||
int maxd;
|
||||
if (missile[i]._miVar2 == 1) {
|
||||
mind = plr[id]._pIFMinDam;
|
||||
maxd = plr[id]._pIFMaxDam;
|
||||
mind = Players[id]._pIFMinDam;
|
||||
maxd = Players[id]._pIFMaxDam;
|
||||
missiledata[missile[i]._mitype].mResist = MISR_FIRE;
|
||||
} else {
|
||||
mind = plr[id]._pILMinDam;
|
||||
maxd = plr[id]._pILMaxDam;
|
||||
mind = Players[id]._pILMinDam;
|
||||
maxd = Players[id]._pILMaxDam;
|
||||
missiledata[missile[i]._mitype].mResist = MISR_LIGHTNING;
|
||||
}
|
||||
CheckMissileCol(i, mind, maxd, false, missile[i].position.tile, false);
|
||||
@@ -4205,7 +4205,7 @@ void MI_Teleport(int i)
|
||||
}
|
||||
|
||||
int id = missile[i]._misource;
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
dPlayer[player.position.tile.x][player.position.tile.y] = 0;
|
||||
PlrClrTrans(player.position.tile);
|
||||
@@ -4219,7 +4219,7 @@ void MI_Teleport(int i)
|
||||
ChangeLightXY(player._plid, player.position.tile);
|
||||
ChangeVisionXY(player._pvid, player.position.tile);
|
||||
}
|
||||
if (id == myplr) {
|
||||
if (id == MyPlayerId) {
|
||||
ViewX = player.position.tile.x - ScrollInfo.tile.x;
|
||||
ViewY = player.position.tile.y - ScrollInfo.tile.y;
|
||||
}
|
||||
@@ -4310,7 +4310,7 @@ void MI_Fireman(int i)
|
||||
int src = missile[i]._misource;
|
||||
Point b = missile[i].position.tile;
|
||||
int enemy = Monsters[src]._menemy;
|
||||
Point c = (Monsters[src]._mFlags & MFLAG_TARGETS_MONSTER) == 0 ? plr[enemy].position.tile : Monsters[enemy].position.tile;
|
||||
Point c = (Monsters[src]._mFlags & MFLAG_TARGETS_MONSTER) == 0 ? Players[enemy].position.tile : Monsters[enemy].position.tile;
|
||||
|
||||
int j = 0;
|
||||
if (b != a && (((missile[i]._miVar1 & 1) != 0 && a.WalkingDistance(c) >= 4) || missile[i]._miVar2 > 1) && PosOkMonst(missile[i]._misource, a)) {
|
||||
@@ -4371,7 +4371,7 @@ void MI_FirewallC(int i)
|
||||
void MI_Infra(int i)
|
||||
{
|
||||
missile[i]._mirange--;
|
||||
plr[missile[i]._misource]._pInfraFlag = true;
|
||||
Players[missile[i]._misource]._pInfraFlag = true;
|
||||
if (missile[i]._mirange == 0) {
|
||||
missile[i]._miDelFlag = true;
|
||||
CalcPlrItemVals(missile[i]._misource, true);
|
||||
@@ -4392,7 +4392,7 @@ void MI_Apoca(int i)
|
||||
continue;
|
||||
if (gbIsHellfire && !LineClearMissile(missile[i].position.tile, { k, j }))
|
||||
continue;
|
||||
AddMissile({ k, j }, { k, j }, plr[id]._pdir, MIS_BOOM, TARGET_MONSTERS, id, missile[i]._midam, 0);
|
||||
AddMissile({ k, j }, { k, j }, Players[id]._pdir, MIS_BOOM, TARGET_MONSTERS, id, missile[i]._midam, 0);
|
||||
exit = true;
|
||||
}
|
||||
if (!exit) {
|
||||
@@ -4423,7 +4423,7 @@ void MI_Wave(int i)
|
||||
int pn = dPiece[na.x][na.y];
|
||||
assert((DWORD)pn <= MAXTILES);
|
||||
if (!nMissileTable[pn]) {
|
||||
Direction pdir = plr[id]._pdir;
|
||||
Direction pdir = Players[id]._pdir;
|
||||
AddMissile(na, na + sd, pdir, MIS_FIREMOVE, TARGET_MONSTERS, id, 0, missile[i]._mispllvl);
|
||||
na += dira;
|
||||
Point nb = src + sd + dirb;
|
||||
@@ -4462,7 +4462,7 @@ void MI_Nova(int i)
|
||||
Direction dir = DIR_S;
|
||||
mienemy_type en = TARGET_PLAYERS;
|
||||
if (id != -1) {
|
||||
dir = plr[id]._pdir;
|
||||
dir = Players[id]._pdir;
|
||||
en = TARGET_MONSTERS;
|
||||
}
|
||||
for (const auto &k : VisionCrawlTable) {
|
||||
@@ -4489,7 +4489,7 @@ void MI_Blodboil(int i)
|
||||
}
|
||||
|
||||
int id = missile[i]._miVar1;
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
int hpdif = player._pMaxHP - player._pHitPoints;
|
||||
|
||||
@@ -4646,7 +4646,7 @@ void MI_Element(int i)
|
||||
int id = missile[i]._misource;
|
||||
if (missile[i]._miAnimType == MFILE_BIGEXP) {
|
||||
Point c = missile[i].position.tile;
|
||||
Point p = plr[id].position.tile;
|
||||
Point p = Players[id].position.tile;
|
||||
ChangeLight(missile[i]._mlid, missile[i].position.tile, missile[i]._miAnimFrame);
|
||||
if (!CheckBlock(p, c))
|
||||
CheckMissileCol(i, dam, dam, true, c, true);
|
||||
@@ -4677,7 +4677,7 @@ void MI_Element(int i)
|
||||
SetMissDir(i, sd);
|
||||
UpdateMissileVel(i, c, Monsters[mid].position.tile, 16);
|
||||
} else {
|
||||
Direction sd = plr[id]._pdir;
|
||||
Direction sd = Players[id]._pdir;
|
||||
SetMissDir(i, sd);
|
||||
UpdateMissileVel(i, c, c + sd, 16);
|
||||
}
|
||||
@@ -4724,7 +4724,7 @@ void MI_Bonespirit(int i)
|
||||
SetMissDir(i, GetDirection(c, Monsters[mid].position.tile));
|
||||
UpdateMissileVel(i, c, Monsters[mid].position.tile, 16);
|
||||
} else {
|
||||
Direction sd = plr[id]._pdir;
|
||||
Direction sd = Players[id]._pdir;
|
||||
SetMissDir(i, sd);
|
||||
UpdateMissileVel(i, c, c + sd, 16);
|
||||
}
|
||||
|
||||
+66
-66
@@ -627,7 +627,7 @@ void ClrAllMonsters()
|
||||
monst->_mFlags = 0;
|
||||
monst->_mDelFlag = false;
|
||||
monst->_menemy = GenerateRnd(gbActivePlayers);
|
||||
monst->enemyPosition = plr[monst->_menemy].position.future;
|
||||
monst->enemyPosition = Players[monst->_menemy].position.future;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1309,18 +1309,18 @@ void M_Enemy(int i)
|
||||
MonsterStruct *monst = &Monsters[i];
|
||||
if ((monst->_mFlags & MFLAG_BERSERK) != 0 || (monst->_mFlags & MFLAG_GOLEM) == 0) {
|
||||
for (int pnum = 0; pnum < MAX_PLRS; pnum++) {
|
||||
if (!plr[pnum].plractive || currlevel != plr[pnum].plrlevel || plr[pnum]._pLvlChanging
|
||||
|| (((plr[pnum]._pHitPoints >> 6) == 0) && gbIsMultiplayer))
|
||||
if (!Players[pnum].plractive || currlevel != Players[pnum].plrlevel || Players[pnum]._pLvlChanging
|
||||
|| (((Players[pnum]._pHitPoints >> 6) == 0) && gbIsMultiplayer))
|
||||
continue;
|
||||
bool sameroom = (dTransVal[monst->position.tile.x][monst->position.tile.y] == dTransVal[plr[pnum].position.tile.x][plr[pnum].position.tile.y]);
|
||||
int dist = monst->position.tile.WalkingDistance(plr[pnum].position.tile);
|
||||
bool sameroom = (dTransVal[monst->position.tile.x][monst->position.tile.y] == dTransVal[Players[pnum].position.tile.x][Players[pnum].position.tile.y]);
|
||||
int dist = monst->position.tile.WalkingDistance(Players[pnum].position.tile);
|
||||
if ((sameroom && !bestsameroom)
|
||||
|| ((sameroom || !bestsameroom) && dist < bestDist)
|
||||
|| (menemy == -1)) {
|
||||
monst->_mFlags &= ~MFLAG_TARGETS_MONSTER;
|
||||
menemy = pnum;
|
||||
enemyx = plr[pnum].position.future.x;
|
||||
enemyy = plr[pnum].position.future.y;
|
||||
enemyx = Players[pnum].position.future.x;
|
||||
enemyy = Players[pnum].position.future.y;
|
||||
bestDist = dist;
|
||||
bestsameroom = sameroom;
|
||||
}
|
||||
@@ -1587,7 +1587,7 @@ void M_StartHit(int i, int pnum, int dam)
|
||||
{
|
||||
if (pnum >= 0)
|
||||
Monsters[i].mWhoHit |= 1 << pnum;
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
delta_monster_hp(i, Monsters[i]._mhitpoints, currlevel);
|
||||
NetSendCmdMonDmg(false, i, dam);
|
||||
}
|
||||
@@ -1595,7 +1595,7 @@ void M_StartHit(int i, int pnum, int dam)
|
||||
if ((Monsters[i].MType->mtype >= MT_SNEAK && Monsters[i].MType->mtype <= MT_ILLWEAV) || dam >> 6 >= Monsters[i].mLevel + 3) {
|
||||
if (pnum >= 0) {
|
||||
Monsters[i]._menemy = pnum;
|
||||
Monsters[i].enemyPosition = plr[pnum].position.future;
|
||||
Monsters[i].enemyPosition = Players[pnum].position.future;
|
||||
Monsters[i]._mFlags &= ~MFLAG_TARGETS_MONSTER;
|
||||
Monsters[i]._mdir = M_GetDir(i);
|
||||
}
|
||||
@@ -1815,7 +1815,7 @@ void M_StartKill(int i, int pnum)
|
||||
{
|
||||
assurance((DWORD)i < MAXMONSTERS, i);
|
||||
|
||||
if (myplr == pnum) {
|
||||
if (MyPlayerId == pnum) {
|
||||
delta_kill_monster(i, Monsters[i].position.tile, currlevel);
|
||||
if (i != pnum) {
|
||||
NetSendCmdLocParam1(false, CMD_MONSTDEATH, Monsters[i].position.tile, i);
|
||||
@@ -2016,9 +2016,9 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
M_TryM2MHit(i, pnum, hit, minDam, maxDam);
|
||||
return;
|
||||
}
|
||||
if (plr[pnum]._pHitPoints >> 6 <= 0 || plr[pnum]._pInvincible || (plr[pnum]._pSpellFlags & 1) != 0)
|
||||
if (Players[pnum]._pHitPoints >> 6 <= 0 || Players[pnum]._pInvincible || (Players[pnum]._pSpellFlags & 1) != 0)
|
||||
return;
|
||||
if (Monsters[i].position.tile.WalkingDistance(plr[pnum].position.tile) >= 2)
|
||||
if (Monsters[i].position.tile.WalkingDistance(Players[pnum].position.tile) >= 2)
|
||||
return;
|
||||
|
||||
int hper = GenerateRnd(100);
|
||||
@@ -2026,15 +2026,15 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
if (debug_mode_dollar_sign || debug_mode_key_inverted_v)
|
||||
hper = 1000;
|
||||
#endif
|
||||
int ac = plr[pnum]._pIBonusAC + plr[pnum]._pIAC;
|
||||
if ((plr[pnum].pDamAcFlags & ISPLHF_ACDEMON) != 0 && Monsters[i].MData->mMonstClass == MC_DEMON)
|
||||
int ac = Players[pnum]._pIBonusAC + Players[pnum]._pIAC;
|
||||
if ((Players[pnum].pDamAcFlags & ISPLHF_ACDEMON) != 0 && Monsters[i].MData->mMonstClass == MC_DEMON)
|
||||
ac += 40;
|
||||
if ((plr[pnum].pDamAcFlags & ISPLHF_ACUNDEAD) != 0 && Monsters[i].MData->mMonstClass == MC_UNDEAD)
|
||||
if ((Players[pnum].pDamAcFlags & ISPLHF_ACUNDEAD) != 0 && Monsters[i].MData->mMonstClass == MC_UNDEAD)
|
||||
ac += 20;
|
||||
hit += 2 * (Monsters[i].mLevel - plr[pnum]._pLevel)
|
||||
hit += 2 * (Monsters[i].mLevel - Players[pnum]._pLevel)
|
||||
+ 30
|
||||
- ac
|
||||
- plr[pnum]._pDexterity / 5;
|
||||
- Players[pnum]._pDexterity / 5;
|
||||
if (hit < 15)
|
||||
hit = 15;
|
||||
if (currlevel == 14 && hit < 20)
|
||||
@@ -2044,13 +2044,13 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
if (currlevel == 16 && hit < 30)
|
||||
hit = 30;
|
||||
int blkper = 100;
|
||||
if ((plr[pnum]._pmode == PM_STAND || plr[pnum]._pmode == PM_ATTACK) && plr[pnum]._pBlockFlag) {
|
||||
if ((Players[pnum]._pmode == PM_STAND || Players[pnum]._pmode == PM_ATTACK) && Players[pnum]._pBlockFlag) {
|
||||
blkper = GenerateRnd(100);
|
||||
}
|
||||
int blk = plr[pnum]._pDexterity
|
||||
+ plr[pnum]._pBaseToBlk
|
||||
int blk = Players[pnum]._pDexterity
|
||||
+ Players[pnum]._pBaseToBlk
|
||||
- (Monsters[i].mLevel * 2)
|
||||
+ (plr[pnum]._pLevel * 2);
|
||||
+ (Players[pnum]._pLevel * 2);
|
||||
if (blk < 0)
|
||||
blk = 0;
|
||||
if (blk > 100)
|
||||
@@ -2058,12 +2058,12 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
if (hper >= hit)
|
||||
return;
|
||||
if (blkper < blk) {
|
||||
Direction dir = GetDirection(plr[pnum].position.tile, Monsters[i].position.tile);
|
||||
Direction dir = GetDirection(Players[pnum].position.tile, Monsters[i].position.tile);
|
||||
StartPlrBlock(pnum, dir);
|
||||
if (pnum == myplr && plr[pnum].wReflections > 0) {
|
||||
plr[pnum].wReflections--;
|
||||
if (pnum == MyPlayerId && Players[pnum].wReflections > 0) {
|
||||
Players[pnum].wReflections--;
|
||||
int dam = GenerateRnd((maxDam - minDam + 1) << 6) + (minDam << 6);
|
||||
dam += plr[pnum]._pIGetHit << 6;
|
||||
dam += Players[pnum]._pIGetHit << 6;
|
||||
if (dam < 64)
|
||||
dam = 64;
|
||||
int mdam = dam * (GenerateRnd(10) + 20L) / 100;
|
||||
@@ -2078,7 +2078,7 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (Monsters[i].MType->mtype == MT_YZOMBIE && pnum == myplr) {
|
||||
if (Monsters[i].MType->mtype == MT_YZOMBIE && pnum == MyPlayerId) {
|
||||
int currentMissileId = -1;
|
||||
for (int j = 0; j < nummissiles; j++) {
|
||||
int mi = missileactive[j];
|
||||
@@ -2087,30 +2087,30 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
if (missile[mi]._misource == pnum)
|
||||
currentMissileId = mi;
|
||||
}
|
||||
if (plr[pnum]._pMaxHP > 64) {
|
||||
if (plr[pnum]._pMaxHPBase > 64) {
|
||||
plr[pnum]._pMaxHP -= 64;
|
||||
if (plr[pnum]._pHitPoints > plr[pnum]._pMaxHP) {
|
||||
plr[pnum]._pHitPoints = plr[pnum]._pMaxHP;
|
||||
if (Players[pnum]._pMaxHP > 64) {
|
||||
if (Players[pnum]._pMaxHPBase > 64) {
|
||||
Players[pnum]._pMaxHP -= 64;
|
||||
if (Players[pnum]._pHitPoints > Players[pnum]._pMaxHP) {
|
||||
Players[pnum]._pHitPoints = Players[pnum]._pMaxHP;
|
||||
if (currentMissileId >= 0)
|
||||
missile[currentMissileId]._miVar1 = plr[pnum]._pHitPoints;
|
||||
missile[currentMissileId]._miVar1 = Players[pnum]._pHitPoints;
|
||||
}
|
||||
plr[pnum]._pMaxHPBase -= 64;
|
||||
if (plr[pnum]._pHPBase > plr[pnum]._pMaxHPBase) {
|
||||
plr[pnum]._pHPBase = plr[pnum]._pMaxHPBase;
|
||||
Players[pnum]._pMaxHPBase -= 64;
|
||||
if (Players[pnum]._pHPBase > Players[pnum]._pMaxHPBase) {
|
||||
Players[pnum]._pHPBase = Players[pnum]._pMaxHPBase;
|
||||
if (currentMissileId >= 0)
|
||||
missile[currentMissileId]._miVar2 = plr[pnum]._pHPBase;
|
||||
missile[currentMissileId]._miVar2 = Players[pnum]._pHPBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int dam = (minDam << 6) + GenerateRnd((maxDam - minDam + 1) << 6);
|
||||
dam += (plr[pnum]._pIGetHit << 6);
|
||||
dam += (Players[pnum]._pIGetHit << 6);
|
||||
if (dam < 64)
|
||||
dam = 64;
|
||||
if (pnum == myplr) {
|
||||
if (plr[pnum].wReflections > 0) {
|
||||
plr[pnum].wReflections--;
|
||||
if (pnum == MyPlayerId) {
|
||||
if (Players[pnum].wReflections > 0) {
|
||||
Players[pnum].wReflections--;
|
||||
int mdam = dam * (GenerateRnd(10) + 20L) / 100;
|
||||
Monsters[i]._mhitpoints -= mdam;
|
||||
dam -= mdam;
|
||||
@@ -2123,7 +2123,7 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
}
|
||||
ApplyPlrDamage(pnum, 0, 0, dam);
|
||||
}
|
||||
if ((plr[pnum]._pIFlags & ISPL_THORNS) != 0) {
|
||||
if ((Players[pnum]._pIFlags & ISPL_THORNS) != 0) {
|
||||
int mdam = (GenerateRnd(3) + 1) << 6;
|
||||
Monsters[i]._mhitpoints -= mdam;
|
||||
if (Monsters[i]._mhitpoints >> 6 <= 0)
|
||||
@@ -2133,23 +2133,23 @@ void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam)
|
||||
}
|
||||
if ((Monsters[i]._mFlags & MFLAG_NOLIFESTEAL) == 0 && Monsters[i].MType->mtype == MT_SKING && gbIsMultiplayer)
|
||||
Monsters[i]._mhitpoints += dam;
|
||||
if (plr[pnum]._pHitPoints >> 6 <= 0) {
|
||||
if (Players[pnum]._pHitPoints >> 6 <= 0) {
|
||||
if (gbIsHellfire)
|
||||
M_StartStand(i, Monsters[i]._mdir);
|
||||
return;
|
||||
}
|
||||
StartPlrHit(pnum, dam, false);
|
||||
if ((Monsters[i]._mFlags & MFLAG_KNOCKBACK) != 0) {
|
||||
if (plr[pnum]._pmode != PM_GOTHIT)
|
||||
if (Players[pnum]._pmode != PM_GOTHIT)
|
||||
StartPlrHit(pnum, 0, true);
|
||||
|
||||
Point newPosition = plr[pnum].position.tile + Monsters[i]._mdir;
|
||||
Point newPosition = Players[pnum].position.tile + Monsters[i]._mdir;
|
||||
if (PosOkPlayer(pnum, newPosition)) {
|
||||
plr[pnum].position.tile = newPosition;
|
||||
FixPlayerLocation(pnum, plr[pnum]._pdir);
|
||||
Players[pnum].position.tile = newPosition;
|
||||
FixPlayerLocation(pnum, Players[pnum]._pdir);
|
||||
FixPlrWalkTags(pnum);
|
||||
dPlayer[newPosition.x][newPosition.y] = pnum + 1;
|
||||
SetPlayerOld(plr[pnum]);
|
||||
SetPlayerOld(Players[pnum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2489,7 +2489,7 @@ void DoEnding()
|
||||
if (gbIsSpawn)
|
||||
return;
|
||||
|
||||
switch (plr[myplr]._pClass) {
|
||||
switch (Players[MyPlayerId]._pClass) {
|
||||
case HeroClass::Sorcerer:
|
||||
case HeroClass::Monk:
|
||||
play_movie("gendata\\DiabVic1.smk", false);
|
||||
@@ -2524,12 +2524,12 @@ void PrepDoEnding()
|
||||
{
|
||||
gbSoundOn = sgbSaveSoundOn;
|
||||
gbRunGame = false;
|
||||
deathflag = false;
|
||||
MyPlayerIsDead = false;
|
||||
cineflag = true;
|
||||
|
||||
plr[myplr].pDiabloKillLevel = std::max(plr[myplr].pDiabloKillLevel, static_cast<uint8_t>(sgGameInitInfo.nDifficulty + 1));
|
||||
Players[MyPlayerId].pDiabloKillLevel = std::max(Players[MyPlayerId].pDiabloKillLevel, static_cast<uint8_t>(sgGameInitInfo.nDifficulty + 1));
|
||||
|
||||
for (auto &player : plr) {
|
||||
for (auto &player : Players) {
|
||||
player._pmode = PM_QUIT;
|
||||
player._pInvincible = true;
|
||||
if (gbIsMultiplayer) {
|
||||
@@ -3131,7 +3131,7 @@ void MAI_Sneak(int i)
|
||||
if ((monst->_mFlags & MFLAG_TARGETS_MONSTER) != 0)
|
||||
md = GetDirection(monst->position.tile, Monsters[monst->_menemy].position.tile);
|
||||
else
|
||||
md = GetDirection(monst->position.tile, plr[monst->_menemy].position.last);
|
||||
md = GetDirection(monst->position.tile, Players[monst->_menemy].position.last);
|
||||
md = opposite[md];
|
||||
if (monst->MType->mtype == MT_UNSEEN) {
|
||||
if (GenerateRnd(2) != 0)
|
||||
@@ -3792,7 +3792,7 @@ void MAI_Golum(int i)
|
||||
if (Monsters[i]._pathcount > 8)
|
||||
Monsters[i]._pathcount = 5;
|
||||
|
||||
bool ok = M_CallWalk(i, plr[i]._pdir);
|
||||
bool ok = M_CallWalk(i, Players[i]._pdir);
|
||||
if (ok)
|
||||
return;
|
||||
|
||||
@@ -4203,7 +4203,7 @@ void MAI_Lazurus(int i)
|
||||
Direction md = M_GetDir(i);
|
||||
if ((dFlags[mx][my] & BFLAG_VISIBLE) != 0) {
|
||||
if (!gbIsMultiplayer) {
|
||||
if (monst->mtalkmsg == TEXT_VILE13 && monst->_mgoal == MGOAL_INQUIRING && plr[myplr].position.tile.x == 35 && plr[myplr].position.tile.y == 46) {
|
||||
if (monst->mtalkmsg == TEXT_VILE13 && monst->_mgoal == MGOAL_INQUIRING && Players[MyPlayerId].position.tile.x == 35 && Players[MyPlayerId].position.tile.y == 46) {
|
||||
PlayInGameMovie("gendata\\fprst3.smk");
|
||||
monst->_mmode = MM_TALK;
|
||||
quests[Q_BETRAYER]._qvar1 = 5;
|
||||
@@ -4402,10 +4402,10 @@ void ProcessMonsters()
|
||||
} else {
|
||||
menemy = monst->_menemy;
|
||||
assurance((DWORD)menemy < MAX_PLRS, menemy);
|
||||
monst->enemyPosition = plr[monst->_menemy].position.future;
|
||||
monst->enemyPosition = Players[monst->_menemy].position.future;
|
||||
if ((dFlags[mx][my] & BFLAG_VISIBLE) != 0) {
|
||||
monst->_msquelch = UINT8_MAX;
|
||||
monst->position.last = plr[monst->_menemy].position.future;
|
||||
monst->position.last = Players[monst->_menemy].position.future;
|
||||
} else if (monst->_msquelch != 0 && monst->MType->mtype != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype'
|
||||
monst->_msquelch--;
|
||||
}
|
||||
@@ -4871,15 +4871,15 @@ void MissToMonst(int i, Point position)
|
||||
if (monst->MType->mtype != MT_GLOOM && (monst->MType->mtype < MT_INCIN || monst->MType->mtype > MT_HELLBURN)) {
|
||||
M_TryH2HHit(m, dPlayer[oldPosition.x][oldPosition.y] - 1, 500, monst->mMinDamage2, monst->mMaxDamage2);
|
||||
if (pnum == dPlayer[oldPosition.x][oldPosition.y] - 1 && (monst->MType->mtype < MT_NSNAKE || monst->MType->mtype > MT_GSNAKE)) {
|
||||
if (plr[pnum]._pmode != PM_GOTHIT && plr[pnum]._pmode != PM_DEATH)
|
||||
if (Players[pnum]._pmode != PM_GOTHIT && Players[pnum]._pmode != PM_DEATH)
|
||||
StartPlrHit(pnum, 0, true);
|
||||
Point newPosition = oldPosition + monst->_mdir;
|
||||
if (PosOkPlayer(pnum, newPosition)) {
|
||||
plr[pnum].position.tile = newPosition;
|
||||
FixPlayerLocation(pnum, plr[pnum]._pdir);
|
||||
Players[pnum].position.tile = newPosition;
|
||||
FixPlayerLocation(pnum, Players[pnum]._pdir);
|
||||
FixPlrWalkTags(pnum);
|
||||
dPlayer[newPosition.x][newPosition.y] = pnum + 1;
|
||||
SetPlayerOld(plr[pnum]);
|
||||
SetPlayerOld(Players[pnum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5107,14 +5107,14 @@ void TalktoMonster(int i)
|
||||
}
|
||||
|
||||
if (QuestStatus(Q_LTBANNER) && quests[Q_LTBANNER]._qvar1 == 2) {
|
||||
if (plr[pnum].TryRemoveInvItemById(IDI_BANNER)) {
|
||||
if (Players[pnum].TryRemoveInvItemById(IDI_BANNER)) {
|
||||
quests[Q_LTBANNER]._qactive = QUEST_DONE;
|
||||
monst->mtalkmsg = TEXT_BANNER12;
|
||||
monst->_mgoal = MGOAL_INQUIRING;
|
||||
}
|
||||
}
|
||||
if (QuestStatus(Q_VEIL) && monst->mtalkmsg >= TEXT_VEIL9) {
|
||||
if (plr[pnum].TryRemoveInvItemById(IDI_GLDNELIX)) {
|
||||
if (Players[pnum].TryRemoveInvItemById(IDI_GLDNELIX)) {
|
||||
monst->mtalkmsg = TEXT_VEIL11;
|
||||
monst->_mgoal = MGOAL_INQUIRING;
|
||||
}
|
||||
@@ -5130,16 +5130,16 @@ void SpawnGolum(int i, Point position, int mi)
|
||||
Monsters[i].position.future = position;
|
||||
Monsters[i].position.old = position;
|
||||
Monsters[i]._pathcount = 0;
|
||||
Monsters[i]._mmaxhp = 2 * (320 * missile[mi]._mispllvl + plr[i]._pMaxMana / 3);
|
||||
Monsters[i]._mmaxhp = 2 * (320 * missile[mi]._mispllvl + Players[i]._pMaxMana / 3);
|
||||
Monsters[i]._mhitpoints = Monsters[i]._mmaxhp;
|
||||
Monsters[i].mArmorClass = 25;
|
||||
Monsters[i].mHit = 5 * (missile[mi]._mispllvl + 8) + 2 * plr[i]._pLevel;
|
||||
Monsters[i].mHit = 5 * (missile[mi]._mispllvl + 8) + 2 * Players[i]._pLevel;
|
||||
Monsters[i].mMinDamage = 2 * (missile[mi]._mispllvl + 4);
|
||||
Monsters[i].mMaxDamage = 2 * (missile[mi]._mispllvl + 8);
|
||||
Monsters[i]._mFlags |= MFLAG_GOLEM;
|
||||
M_StartSpStand(i, DIR_S);
|
||||
M_Enemy(i);
|
||||
if (i == myplr) {
|
||||
if (i == MyPlayerId) {
|
||||
NetSendCmdGolem(
|
||||
Monsters[i].position.tile.x,
|
||||
Monsters[i].position.tile.y,
|
||||
@@ -5195,7 +5195,7 @@ void decode_enemy(int m, int enemy)
|
||||
if (enemy < MAX_PLRS) {
|
||||
Monsters[m]._mFlags &= ~MFLAG_TARGETS_MONSTER;
|
||||
Monsters[m]._menemy = enemy;
|
||||
Monsters[m].enemyPosition = plr[enemy].position.future;
|
||||
Monsters[m].enemyPosition = Players[enemy].position.future;
|
||||
} else {
|
||||
Monsters[m]._mFlags |= MFLAG_TARGETS_MONSTER;
|
||||
enemy -= MAX_PLRS;
|
||||
|
||||
+286
-286
File diff suppressed because it is too large
Load Diff
+62
-62
@@ -113,18 +113,18 @@ byte *ReceivePacket(TBuffer *pBuf, byte *body, size_t *size)
|
||||
|
||||
void NetReceivePlayerData(TPkt *pkt)
|
||||
{
|
||||
const Point target = plr[myplr].GetTargetPosition();
|
||||
const Point target = Players[MyPlayerId].GetTargetPosition();
|
||||
|
||||
pkt->hdr.wCheck = LoadBE32("\0\0ip");
|
||||
pkt->hdr.px = plr[myplr].position.tile.x;
|
||||
pkt->hdr.py = plr[myplr].position.tile.y;
|
||||
pkt->hdr.px = Players[MyPlayerId].position.tile.x;
|
||||
pkt->hdr.py = Players[MyPlayerId].position.tile.y;
|
||||
pkt->hdr.targx = target.x;
|
||||
pkt->hdr.targy = target.y;
|
||||
pkt->hdr.php = plr[myplr]._pHitPoints;
|
||||
pkt->hdr.pmhp = plr[myplr]._pMaxHP;
|
||||
pkt->hdr.bstr = plr[myplr]._pBaseStr;
|
||||
pkt->hdr.bmag = plr[myplr]._pBaseMag;
|
||||
pkt->hdr.bdex = plr[myplr]._pBaseDex;
|
||||
pkt->hdr.php = Players[MyPlayerId]._pHitPoints;
|
||||
pkt->hdr.pmhp = Players[MyPlayerId]._pMaxHP;
|
||||
pkt->hdr.bstr = Players[MyPlayerId]._pBaseStr;
|
||||
pkt->hdr.bmag = Players[MyPlayerId]._pBaseMag;
|
||||
pkt->hdr.bdex = Players[MyPlayerId]._pBaseDex;
|
||||
}
|
||||
|
||||
void SendPacket(int playerId, void *packet, BYTE dwSize)
|
||||
@@ -155,9 +155,9 @@ void HandleTurnUpperBit(int pnum)
|
||||
break;
|
||||
}
|
||||
|
||||
if (myplr == i) {
|
||||
if (MyPlayerId == i) {
|
||||
sgbSendDeltaTbl[pnum] = true;
|
||||
} else if (myplr == pnum) {
|
||||
} else if (MyPlayerId == pnum) {
|
||||
gbDeltaSender = i;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void ParseTurn(int pnum, uint32_t turn)
|
||||
|
||||
void PlayerLeftMsg(int pnum, bool left)
|
||||
{
|
||||
if (!plr[pnum].plractive) {
|
||||
if (!Players[pnum].plractive) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,11 +197,11 @@ void PlayerLeftMsg(int pnum, bool left)
|
||||
pszFmt = _("Player '{:s}' dropped due to timeout");
|
||||
break;
|
||||
}
|
||||
EventPlrMsg(fmt::format(pszFmt, plr[pnum]._pName).c_str());
|
||||
EventPlrMsg(fmt::format(pszFmt, Players[pnum]._pName).c_str());
|
||||
}
|
||||
plr[pnum].plractive = false;
|
||||
plr[pnum]._pName[0] = '\0';
|
||||
ResetPlayerGFX(plr[pnum]);
|
||||
Players[pnum].plractive = false;
|
||||
Players[pnum]._pName[0] = '\0';
|
||||
ResetPlayerGFX(Players[pnum]);
|
||||
gbActivePlayers--;
|
||||
}
|
||||
|
||||
@@ -279,10 +279,10 @@ void BeginTimeout()
|
||||
} else if (bGroupPlayers == bGroupCount) {
|
||||
if (nLowestPlayer != nLowestActive) {
|
||||
gbGameDestroyed = true;
|
||||
} else if (nLowestActive == myplr) {
|
||||
} else if (nLowestActive == MyPlayerId) {
|
||||
CheckDropPlayer();
|
||||
}
|
||||
} else if (nLowestActive == myplr) {
|
||||
} else if (nLowestActive == MyPlayerId) {
|
||||
CheckDropPlayer();
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void ProcessTmsgs()
|
||||
TPkt pkt;
|
||||
|
||||
while ((cnt = tmsg_get((byte *)&pkt)) != 0) {
|
||||
HandleAllPackets(myplr, (byte *)&pkt, cnt);
|
||||
HandleAllPackets(MyPlayerId, (byte *)&pkt, cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ void SendPlayerInfo(int pnum, _cmd_id cmd)
|
||||
{
|
||||
PkPlayerStruct pkplr;
|
||||
|
||||
PackPlayer(&pkplr, plr[myplr], true);
|
||||
PackPlayer(&pkplr, Players[MyPlayerId], true);
|
||||
dthread_send_delta(pnum, cmd, (byte *)&pkplr, sizeof(pkplr));
|
||||
}
|
||||
|
||||
@@ -354,15 +354,15 @@ void SetupLocalPositions()
|
||||
}
|
||||
#endif
|
||||
|
||||
x += plrxoff[myplr];
|
||||
y += plryoff[myplr];
|
||||
plr[myplr].position.tile = { x, y };
|
||||
plr[myplr].position.future = { x, y };
|
||||
plr[myplr].plrlevel = currlevel;
|
||||
plr[myplr]._pLvlChanging = true;
|
||||
plr[myplr].pLvlLoad = 0;
|
||||
plr[myplr]._pmode = PM_NEWLVL;
|
||||
plr[myplr].destAction = ACTION_NONE;
|
||||
x += plrxoff[MyPlayerId];
|
||||
y += plryoff[MyPlayerId];
|
||||
Players[MyPlayerId].position.tile = { x, y };
|
||||
Players[MyPlayerId].position.future = { x, y };
|
||||
Players[MyPlayerId].plrlevel = currlevel;
|
||||
Players[MyPlayerId]._pLvlChanging = true;
|
||||
Players[MyPlayerId].pLvlLoad = 0;
|
||||
Players[MyPlayerId]._pmode = PM_NEWLVL;
|
||||
Players[MyPlayerId].destAction = ACTION_NONE;
|
||||
}
|
||||
|
||||
void HandleEvents(_SNETEVENT *pEvt)
|
||||
@@ -426,7 +426,7 @@ bool InitSingle(GameData *gameData)
|
||||
app_fatal("SNetCreateGame1:\n%s", SDL_GetError());
|
||||
}
|
||||
|
||||
myplr = 0;
|
||||
MyPlayerId = 0;
|
||||
gbIsMultiplayer = false;
|
||||
|
||||
return true;
|
||||
@@ -451,10 +451,10 @@ bool InitMulti(GameData *gameData)
|
||||
if ((DWORD)playerId >= MAX_PLRS) {
|
||||
return false;
|
||||
}
|
||||
myplr = playerId;
|
||||
MyPlayerId = playerId;
|
||||
gbIsMultiplayer = true;
|
||||
|
||||
pfile_read_player_from_save(gszHero, myplr);
|
||||
pfile_read_player_from_save(gszHero, MyPlayerId);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -565,12 +565,12 @@ bool multi_handle_delta()
|
||||
sgbTimeout = false;
|
||||
if (received) {
|
||||
if (!gbShouldValidatePackage) {
|
||||
NetSendHiPri(myplr, nullptr, 0);
|
||||
NetSendHiPri(MyPlayerId, nullptr, 0);
|
||||
gbShouldValidatePackage = false;
|
||||
} else {
|
||||
gbShouldValidatePackage = false;
|
||||
if (sgHiPriBuf.dwNextWriteOffset != 0)
|
||||
NetSendHiPri(myplr, nullptr, 0);
|
||||
NetSendHiPri(MyPlayerId, nullptr, 0);
|
||||
}
|
||||
}
|
||||
MonsterSeeds();
|
||||
@@ -597,36 +597,36 @@ void multi_process_network_packets()
|
||||
continue;
|
||||
if (pkt->wLen != dwMsgSize)
|
||||
continue;
|
||||
plr[dwID].position.last = { pkt->px, pkt->py };
|
||||
if (dwID != myplr) {
|
||||
Players[dwID].position.last = { pkt->px, pkt->py };
|
||||
if (dwID != MyPlayerId) {
|
||||
assert(gbBufferMsgs != 2);
|
||||
plr[dwID]._pHitPoints = pkt->php;
|
||||
plr[dwID]._pMaxHP = pkt->pmhp;
|
||||
Players[dwID]._pHitPoints = pkt->php;
|
||||
Players[dwID]._pMaxHP = pkt->pmhp;
|
||||
bool cond = gbBufferMsgs == 1;
|
||||
plr[dwID]._pBaseStr = pkt->bstr;
|
||||
plr[dwID]._pBaseMag = pkt->bmag;
|
||||
plr[dwID]._pBaseDex = pkt->bdex;
|
||||
if (!cond && plr[dwID].plractive && plr[dwID]._pHitPoints != 0) {
|
||||
if (currlevel == plr[dwID].plrlevel && !plr[dwID]._pLvlChanging) {
|
||||
int dx = abs(plr[dwID].position.tile.x - pkt->px);
|
||||
int dy = abs(plr[dwID].position.tile.y - pkt->py);
|
||||
Players[dwID]._pBaseStr = pkt->bstr;
|
||||
Players[dwID]._pBaseMag = pkt->bmag;
|
||||
Players[dwID]._pBaseDex = pkt->bdex;
|
||||
if (!cond && Players[dwID].plractive && Players[dwID]._pHitPoints != 0) {
|
||||
if (currlevel == Players[dwID].plrlevel && !Players[dwID]._pLvlChanging) {
|
||||
int dx = abs(Players[dwID].position.tile.x - pkt->px);
|
||||
int dy = abs(Players[dwID].position.tile.y - pkt->py);
|
||||
if ((dx > 3 || dy > 3) && dPlayer[pkt->px][pkt->py] == 0) {
|
||||
FixPlrWalkTags(dwID);
|
||||
plr[dwID].position.old = plr[dwID].position.tile;
|
||||
Players[dwID].position.old = Players[dwID].position.tile;
|
||||
FixPlrWalkTags(dwID);
|
||||
plr[dwID].position.tile = { pkt->px, pkt->py };
|
||||
plr[dwID].position.future = { pkt->px, pkt->py };
|
||||
dPlayer[plr[dwID].position.tile.x][plr[dwID].position.tile.y] = dwID + 1;
|
||||
Players[dwID].position.tile = { pkt->px, pkt->py };
|
||||
Players[dwID].position.future = { pkt->px, pkt->py };
|
||||
dPlayer[Players[dwID].position.tile.x][Players[dwID].position.tile.y] = dwID + 1;
|
||||
}
|
||||
dx = abs(plr[dwID].position.future.x - plr[dwID].position.tile.x);
|
||||
dy = abs(plr[dwID].position.future.y - plr[dwID].position.tile.y);
|
||||
dx = abs(Players[dwID].position.future.x - Players[dwID].position.tile.x);
|
||||
dy = abs(Players[dwID].position.future.y - Players[dwID].position.tile.y);
|
||||
if (dx > 1 || dy > 1) {
|
||||
plr[dwID].position.future = plr[dwID].position.tile;
|
||||
Players[dwID].position.future = Players[dwID].position.tile;
|
||||
}
|
||||
MakePlrPath(dwID, { pkt->targx, pkt->targy }, true);
|
||||
} else {
|
||||
plr[dwID].position.tile = { pkt->px, pkt->py };
|
||||
plr[dwID].position.future = { pkt->px, pkt->py };
|
||||
Players[dwID].position.tile = { pkt->px, pkt->py };
|
||||
Players[dwID].position.future = { pkt->px, pkt->py };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -638,7 +638,7 @@ void multi_process_network_packets()
|
||||
|
||||
void multi_send_zero_packet(int pnum, _cmd_id bCmd, byte *pbSrc, DWORD dwLen)
|
||||
{
|
||||
assert(pnum != myplr);
|
||||
assert(pnum != MyPlayerId);
|
||||
assert(pbSrc);
|
||||
assert(dwLen <= 0x0ffff);
|
||||
|
||||
@@ -717,7 +717,7 @@ bool NetInit(bool bSinglePlayer)
|
||||
memset(sgbPlayerLeftGameTbl, 0, sizeof(sgbPlayerLeftGameTbl));
|
||||
memset(sgdwPlayerLeftReasonTbl, 0, sizeof(sgdwPlayerLeftReasonTbl));
|
||||
memset(sgbSendDeltaTbl, 0, sizeof(sgbSendDeltaTbl));
|
||||
for (auto &player : plr) {
|
||||
for (auto &player : Players) {
|
||||
player.Reset();
|
||||
}
|
||||
memset(sgwPackPlrOffsetTbl, 0, sizeof(sgwPackPlrOffsetTbl));
|
||||
@@ -737,22 +737,22 @@ bool NetInit(bool bSinglePlayer)
|
||||
BufferInit(&sgLoPriBuf);
|
||||
gbShouldValidatePackage = false;
|
||||
sync_init();
|
||||
nthread_start(sgbPlayerTurnBitTbl[myplr]);
|
||||
nthread_start(sgbPlayerTurnBitTbl[MyPlayerId]);
|
||||
dthread_start();
|
||||
tmsg_start();
|
||||
sgdwGameLoops = 0;
|
||||
sgbSentThisCycle = 0;
|
||||
gbDeltaSender = myplr;
|
||||
gbDeltaSender = MyPlayerId;
|
||||
gbSomebodyWonGameKludge = false;
|
||||
nthread_send_and_recv_turn(0, 0);
|
||||
SetupLocalPositions();
|
||||
SendPlayerInfo(-2, CMD_SEND_PLRINFO);
|
||||
|
||||
ResetPlayerGFX(plr[myplr]);
|
||||
plr[myplr].plractive = true;
|
||||
ResetPlayerGFX(Players[MyPlayerId]);
|
||||
Players[MyPlayerId].plractive = true;
|
||||
gbActivePlayers = 1;
|
||||
|
||||
if (!sgbPlayerTurnBitTbl[myplr] || msg_wait_resync())
|
||||
if (!sgbPlayerTurnBitTbl[MyPlayerId] || msg_wait_resync())
|
||||
break;
|
||||
NetClose();
|
||||
gbSelectProvider = false;
|
||||
@@ -776,11 +776,11 @@ void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, bool recv)
|
||||
{
|
||||
const char *szEvent;
|
||||
|
||||
if (myplr == pnum) {
|
||||
if (MyPlayerId == pnum) {
|
||||
return;
|
||||
}
|
||||
assert((DWORD)pnum < MAX_PLRS);
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
if (sgwPackPlrOffsetTbl[pnum] != p->wOffset) {
|
||||
sgwPackPlrOffsetTbl[pnum] = 0;
|
||||
|
||||
+359
-359
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -195,7 +195,7 @@ static void VerifyGoldSeeds(PlayerStruct &player)
|
||||
|
||||
void UnPackPlayer(const PkPlayerStruct *pPack, int pnum, bool netSync)
|
||||
{
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
player.position.tile = { pPack->px, pPack->py };
|
||||
player.position.future = { pPack->px, pPack->py };
|
||||
@@ -219,7 +219,7 @@ void UnPackPlayer(const PkPlayerStruct *pPack, int pnum, bool netSync)
|
||||
player._pGold = SDL_SwapLE32(pPack->pGold);
|
||||
player._pMaxHPBase = SDL_SwapLE32(pPack->pMaxHPBase);
|
||||
player._pHPBase = SDL_SwapLE32(pPack->pHPBase);
|
||||
player._pBaseToBlk = ToBlkTbl[static_cast<std::size_t>(player._pClass)];
|
||||
player._pBaseToBlk = BlockBonuses[static_cast<std::size_t>(player._pClass)];
|
||||
if (!netSync)
|
||||
if ((int)(player._pHPBase & 0xFFFFFFC0) < 64)
|
||||
player._pHPBase = 64;
|
||||
@@ -257,7 +257,7 @@ void UnPackPlayer(const PkPlayerStruct *pPack, int pnum, bool netSync)
|
||||
UnPackItem(&packedItem, &player.SpdList[i], isHellfire);
|
||||
}
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
for (int i = 0; i < 20; i++)
|
||||
witchitem[i]._itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
+13
-13
@@ -266,7 +266,7 @@ const char *pfile_get_password()
|
||||
}
|
||||
|
||||
PFileScopedArchiveWriter::PFileScopedArchiveWriter(bool clearTables)
|
||||
: save_num_(GetSaveNumberFromName(plr[myplr]._pName))
|
||||
: save_num_(GetSaveNumberFromName(Players[MyPlayerId]._pName))
|
||||
, clear_tables_(clearTables)
|
||||
{
|
||||
if (!OpenArchive(save_num_))
|
||||
@@ -286,11 +286,11 @@ void pfile_write_hero(bool writeGameData, bool clearTables)
|
||||
RenameTempToPerm();
|
||||
}
|
||||
PkPlayerStruct pkplr;
|
||||
PackPlayer(&pkplr, plr[myplr], !gbIsMultiplayer);
|
||||
PackPlayer(&pkplr, Players[MyPlayerId], !gbIsMultiplayer);
|
||||
EncodeHero(&pkplr);
|
||||
if (!gbVanilla) {
|
||||
SaveHotkeys();
|
||||
SaveHeroItems(plr[myplr]);
|
||||
SaveHeroItems(Players[MyPlayerId]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,11 +312,11 @@ bool pfile_ui_set_hero_infos(bool (*uiAddHeroInfo)(_uiheroinfo *))
|
||||
UnPackPlayer(&pkplr, 0, false);
|
||||
|
||||
CloseArchive(&archive);
|
||||
LoadHeroItems(plr[0]);
|
||||
RemoveEmptyInventory(plr[0]);
|
||||
LoadHeroItems(Players[0]);
|
||||
RemoveEmptyInventory(Players[0]);
|
||||
CalcPlrInv(0, false);
|
||||
|
||||
Game2UiPlayer(plr[0], &uihero, hasSaveGame);
|
||||
Game2UiPlayer(Players[0], &uihero, hasSaveGame);
|
||||
uiAddHeroInfo(&uihero);
|
||||
}
|
||||
CloseArchive(&archive);
|
||||
@@ -353,7 +353,7 @@ bool pfile_ui_save_create(_uiheroinfo *heroinfo)
|
||||
strncpy(hero_names[saveNum], heroinfo->name, PLR_NAME_LEN);
|
||||
hero_names[saveNum][PLR_NAME_LEN - 1] = '\0';
|
||||
|
||||
auto &player = plr[0];
|
||||
auto &player = Players[0];
|
||||
CreatePlayer(0, heroinfo->heroclass);
|
||||
strncpy(player._pName, heroinfo->name, PLR_NAME_LEN);
|
||||
player._pName[PLR_NAME_LEN - 1] = '\0';
|
||||
@@ -399,8 +399,8 @@ void pfile_read_player_from_save(char name[16], int playerId)
|
||||
|
||||
UnPackPlayer(&pkplr, playerId, false);
|
||||
|
||||
LoadHeroItems(plr[playerId]);
|
||||
RemoveEmptyInventory(plr[playerId]);
|
||||
LoadHeroItems(Players[playerId]);
|
||||
RemoveEmptyInventory(Players[playerId]);
|
||||
CalcPlrInv(playerId, false);
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ bool LevelFileExists()
|
||||
|
||||
GetPermLevelNames(szName);
|
||||
|
||||
uint32_t saveNum = GetSaveNumberFromName(plr[myplr]._pName);
|
||||
uint32_t saveNum = GetSaveNumberFromName(Players[MyPlayerId]._pName);
|
||||
if (!OpenArchive(saveNum))
|
||||
app_fatal("%s", _("Unable to read to save file archive"));
|
||||
|
||||
@@ -429,7 +429,7 @@ void GetTempLevelNames(char *szTemp)
|
||||
|
||||
void GetPermLevelNames(char *szPerm)
|
||||
{
|
||||
uint32_t saveNum = GetSaveNumberFromName(plr[myplr]._pName);
|
||||
uint32_t saveNum = GetSaveNumberFromName(Players[MyPlayerId]._pName);
|
||||
GetTempLevelNames(szPerm);
|
||||
if (!OpenArchive(saveNum))
|
||||
app_fatal("%s", _("Unable to read to save file archive"));
|
||||
@@ -449,7 +449,7 @@ void pfile_remove_temp_files()
|
||||
if (gbIsMultiplayer)
|
||||
return;
|
||||
|
||||
uint32_t saveNum = GetSaveNumberFromName(plr[myplr]._pName);
|
||||
uint32_t saveNum = GetSaveNumberFromName(Players[MyPlayerId]._pName);
|
||||
if (!OpenArchive(saveNum))
|
||||
app_fatal("%s", _("Unable to write to save file archive"));
|
||||
mpqapi_remove_hash_entries(GetTempSaveNames);
|
||||
@@ -460,7 +460,7 @@ std::unique_ptr<byte[]> pfile_read(const char *pszName, size_t *pdwLen)
|
||||
{
|
||||
HANDLE archive;
|
||||
|
||||
uint32_t saveNum = GetSaveNumberFromName(plr[myplr]._pName);
|
||||
uint32_t saveNum = GetSaveNumberFromName(Players[MyPlayerId]._pName);
|
||||
archive = OpenSaveArchive(saveNum);
|
||||
if (archive == nullptr)
|
||||
return nullptr;
|
||||
|
||||
+159
-159
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -434,10 +434,10 @@ struct PlayerStruct {
|
||||
}
|
||||
};
|
||||
|
||||
extern int myplr;
|
||||
extern PlayerStruct plr[MAX_PLRS];
|
||||
extern bool deathflag;
|
||||
extern int ToBlkTbl[enum_size<HeroClass>::value];
|
||||
extern int MyPlayerId;
|
||||
extern PlayerStruct Players[MAX_PLRS];
|
||||
extern bool MyPlayerIsDead;
|
||||
extern int BlockBonuses[enum_size<HeroClass>::value];
|
||||
|
||||
void LoadPlrGFX(PlayerStruct &player, player_graphic graphic);
|
||||
void InitPlayerGFX(PlayerStruct &player);
|
||||
|
||||
+2
-2
@@ -70,9 +70,9 @@ void SendPlrMsg(int pnum, const char *pszStr)
|
||||
plr_msg_slot = (plr_msg_slot + 1) & (PMSG_COUNT - 1);
|
||||
pMsg->player = pnum;
|
||||
pMsg->time = SDL_GetTicks();
|
||||
assert(strlen(plr[pnum]._pName) < PLR_NAME_LEN);
|
||||
assert(strlen(Players[pnum]._pName) < PLR_NAME_LEN);
|
||||
assert(strlen(pszStr) < MAX_SEND_STR_LEN);
|
||||
strcpy(pMsg->str, fmt::format(_(/* TRANSLATORS: Shown if player presses "v" button. {:s} is player name, {:d} is level, {:s} is location */ "{:s} (lvl {:d}): {:s}"), plr[pnum]._pName, plr[pnum]._pLevel, pszStr).c_str());
|
||||
strcpy(pMsg->str, fmt::format(_(/* TRANSLATORS: Shown if player presses "v" button. {:s} is player name, {:d} is level, {:s} is location */ "{:s} (lvl {:d}): {:s}"), Players[pnum]._pName, Players[pnum]._pLevel, pszStr).c_str());
|
||||
}
|
||||
|
||||
void ClearPlrMsg()
|
||||
|
||||
+5
-5
@@ -138,7 +138,7 @@ void GetPortalLevel()
|
||||
if (currlevel != 0) {
|
||||
setlevel = false;
|
||||
currlevel = 0;
|
||||
plr[myplr].plrlevel = 0;
|
||||
Players[MyPlayerId].plrlevel = 0;
|
||||
leveltype = DTYPE_TOWN;
|
||||
return;
|
||||
}
|
||||
@@ -147,16 +147,16 @@ void GetPortalLevel()
|
||||
setlevel = true;
|
||||
setlvlnum = (_setlevels)portal[portalindex].level;
|
||||
currlevel = portal[portalindex].level;
|
||||
plr[myplr].plrlevel = setlvlnum;
|
||||
Players[MyPlayerId].plrlevel = setlvlnum;
|
||||
leveltype = portal[portalindex].ltype;
|
||||
} else {
|
||||
setlevel = false;
|
||||
currlevel = portal[portalindex].level;
|
||||
plr[myplr].plrlevel = currlevel;
|
||||
Players[MyPlayerId].plrlevel = currlevel;
|
||||
leveltype = portal[portalindex].ltype;
|
||||
}
|
||||
|
||||
if (portalindex == myplr) {
|
||||
if (portalindex == MyPlayerId) {
|
||||
NetSendCmd(true, CMD_DEACTIVATEPORTAL);
|
||||
DeactivatePortal(portalindex);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ void GetPortalLvlPos()
|
||||
ViewX = portal[portalindex].position.x;
|
||||
ViewY = portal[portalindex].position.y;
|
||||
|
||||
if (portalindex != myplr) {
|
||||
if (portalindex != MyPlayerId) {
|
||||
ViewX++;
|
||||
ViewY++;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace {
|
||||
|
||||
bool HasRoomForGold()
|
||||
{
|
||||
for (int idx : plr[myplr].InvGrid) {
|
||||
for (int idx : Players[MyPlayerId].InvGrid) {
|
||||
// Secondary item cell. No need to check those as we'll go through the main item cells anyway.
|
||||
if (idx < 0)
|
||||
continue;
|
||||
@@ -22,7 +22,7 @@ bool HasRoomForGold()
|
||||
return true;
|
||||
|
||||
// Main item cell. Potentially a gold pile so check it.
|
||||
auto item = plr[myplr].InvList[idx - 1];
|
||||
auto item = Players[MyPlayerId].InvList[idx - 1];
|
||||
if (item._itype == ITYPE_GOLD && item._ivalue < MaxGold)
|
||||
return true;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void AutoGoldPickup(int pnum)
|
||||
if (!sgOptions.Gameplay.bAutoGoldPickup)
|
||||
return;
|
||||
|
||||
if (pnum != myplr)
|
||||
if (pnum != MyPlayerId)
|
||||
return;
|
||||
if (leveltype == DTYPE_TOWN)
|
||||
return;
|
||||
@@ -45,8 +45,8 @@ void AutoGoldPickup(int pnum)
|
||||
return;
|
||||
|
||||
for (int dir = 0; dir < 8; dir++) {
|
||||
int x = plr[pnum].position.tile.x + pathxdir[dir];
|
||||
int y = plr[pnum].position.tile.y + pathydir[dir];
|
||||
int x = Players[pnum].position.tile.x + pathxdir[dir];
|
||||
int y = Players[pnum].position.tile.y + pathydir[dir];
|
||||
if (dItem[x][y] != 0) {
|
||||
int itemIndex = dItem[x][y] - 1;
|
||||
if (Items[itemIndex]._itype == ITYPE_GOLD) {
|
||||
|
||||
@@ -149,7 +149,7 @@ void DrawItemNameLabels(const Surface &out)
|
||||
ItemStruct &itm = Items[label.id];
|
||||
|
||||
if (MousePosition.x >= label.pos.x && MousePosition.x < label.pos.x + label.width && MousePosition.y >= label.pos.y - Height + MarginY && MousePosition.y < label.pos.y + MarginY) {
|
||||
if (!gmenu_is_active() && PauseMode == 0 && !deathflag && IsMouseOverGameArea()) {
|
||||
if (!gmenu_is_active() && PauseMode == 0 && !MyPlayerIsDead && IsMouseOverGameArea()) {
|
||||
isLabelHighlighted = true;
|
||||
cursmx = itm.position.x;
|
||||
cursmy = itm.position.y;
|
||||
|
||||
@@ -70,7 +70,7 @@ void DrawXPBar(const Surface &out)
|
||||
if (!sgOptions.Gameplay.bExperienceBar)
|
||||
return;
|
||||
|
||||
const auto &player = plr[myplr];
|
||||
const auto &player = Players[MyPlayerId];
|
||||
|
||||
const int backX = PANEL_LEFT + PANEL_WIDTH / 2 - 155;
|
||||
const int backY = PANEL_TOP + PANEL_HEIGHT - 11;
|
||||
@@ -121,7 +121,7 @@ bool CheckXPBarInfo()
|
||||
if (MousePosition.x < backX || MousePosition.x >= backX + BackWidth || MousePosition.y < backY || MousePosition.y >= backY + BackHeight)
|
||||
return false;
|
||||
|
||||
const auto &player = plr[myplr];
|
||||
const auto &player = Players[MyPlayerId];
|
||||
|
||||
const int charLevel = player._pLevel;
|
||||
|
||||
|
||||
+14
-14
@@ -215,7 +215,7 @@ void CheckQuests()
|
||||
quests[Q_BETRAYER].position.y = 2 * quests[Q_BETRAYER].position.y + 16;
|
||||
int rportx = quests[Q_BETRAYER].position.x;
|
||||
int rporty = quests[Q_BETRAYER].position.y;
|
||||
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, myplr, 0, 0);
|
||||
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
|
||||
quests[Q_BETRAYER]._qvar2 = 1;
|
||||
if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) {
|
||||
quests[Q_BETRAYER]._qvar1 = 3;
|
||||
@@ -228,7 +228,7 @@ void CheckQuests()
|
||||
&& quests[Q_BETRAYER]._qvar2 == 4) {
|
||||
int rportx = 35;
|
||||
int rporty = 32;
|
||||
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, myplr, 0, 0);
|
||||
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
|
||||
quests[Q_BETRAYER]._qvar2 = 3;
|
||||
}
|
||||
|
||||
@@ -239,21 +239,21 @@ void CheckQuests()
|
||||
&& ActiveMonsterCount == 4
|
||||
&& quests[Q_PWATER]._qactive != QUEST_DONE) {
|
||||
quests[Q_PWATER]._qactive = QUEST_DONE;
|
||||
PlaySfxLoc(IS_QUESTDN, plr[myplr].position.tile);
|
||||
PlaySfxLoc(IS_QUESTDN, Players[MyPlayerId].position.tile);
|
||||
LoadPalette("Levels\\L3Data\\L3pwater.pal", false);
|
||||
UpdatePWaterPalette();
|
||||
WaterDone = 32;
|
||||
}
|
||||
} else if (plr[myplr]._pmode == PM_STAND) {
|
||||
} else if (Players[MyPlayerId]._pmode == PM_STAND) {
|
||||
for (auto &quest : quests) {
|
||||
if (currlevel == quest._qlevel
|
||||
&& quest._qslvl != 0
|
||||
&& quest._qactive != QUEST_NOTAVAIL
|
||||
&& plr[myplr].position.tile == quest.position) {
|
||||
&& Players[MyPlayerId].position.tile == quest.position) {
|
||||
if (quest._qlvltype != DTYPE_NONE) {
|
||||
setlvltype = quest._qlvltype;
|
||||
}
|
||||
StartNewLvl(myplr, WM_DIABSETLVL, quest._qslvl);
|
||||
StartNewLvl(MyPlayerId, WM_DIABSETLVL, quest._qslvl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,21 +308,21 @@ void CheckQuestKill(int m, bool sendmsg)
|
||||
|
||||
if (Monsters[m].MType->mtype == MT_SKING) {
|
||||
quests[Q_SKELKING]._qactive = QUEST_DONE;
|
||||
plr[myplr].Say(HeroSpeech::RestWellLeoricIllFindYourSon, 30);
|
||||
Players[MyPlayerId].Say(HeroSpeech::RestWellLeoricIllFindYourSon, 30);
|
||||
if (sendmsg)
|
||||
NetSendCmdQuest(true, Q_SKELKING);
|
||||
|
||||
} else if (Monsters[m].MType->mtype == MT_CLEAVER) {
|
||||
quests[Q_BUTCHER]._qactive = QUEST_DONE;
|
||||
plr[myplr].Say(HeroSpeech::TheSpiritsOfTheDeadAreNowAvenged, 30);
|
||||
Players[MyPlayerId].Say(HeroSpeech::TheSpiritsOfTheDeadAreNowAvenged, 30);
|
||||
if (sendmsg)
|
||||
NetSendCmdQuest(true, Q_BUTCHER);
|
||||
} else if (Monsters[m]._uniqtype - 1 == UMT_GARBUD) { //"Gharbad the Weak"
|
||||
quests[Q_GARBUD]._qactive = QUEST_DONE;
|
||||
plr[myplr].Say(HeroSpeech::ImNotImpressed, 30);
|
||||
Players[MyPlayerId].Say(HeroSpeech::ImNotImpressed, 30);
|
||||
} else if (Monsters[m]._uniqtype - 1 == UMT_ZHAR) { //"Zhar the Mad"
|
||||
quests[Q_ZHAR]._qactive = QUEST_DONE;
|
||||
plr[myplr].Say(HeroSpeech::ImSorryDidIBreakYourConcentration, 30);
|
||||
Players[MyPlayerId].Say(HeroSpeech::ImSorryDidIBreakYourConcentration, 30);
|
||||
} else if (Monsters[m]._uniqtype - 1 == UMT_LAZURUS && gbIsMultiplayer) { //"Arch-Bishop Lazarus"
|
||||
quests[Q_BETRAYER]._qactive = QUEST_DONE;
|
||||
quests[Q_BETRAYER]._qvar1 = 7;
|
||||
@@ -337,7 +337,7 @@ void CheckQuestKill(int m, bool sendmsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
plr[myplr].Say(HeroSpeech::YourMadnessEndsHereBetrayer, 30);
|
||||
Players[MyPlayerId].Say(HeroSpeech::YourMadnessEndsHereBetrayer, 30);
|
||||
if (sendmsg) {
|
||||
NetSendCmdQuest(true, Q_BETRAYER);
|
||||
NetSendCmdQuest(true, Q_DIABLO);
|
||||
@@ -348,11 +348,11 @@ void CheckQuestKill(int m, bool sendmsg)
|
||||
quests[Q_BETRAYER]._qvar1 = 7;
|
||||
quests[Q_BETRAYER]._qvar2 = 4;
|
||||
quests[Q_DIABLO]._qactive = QUEST_ACTIVE;
|
||||
AddMissile({ 35, 32 }, { 35, 32 }, 0, MIS_RPORTAL, TARGET_MONSTERS, myplr, 0, 0);
|
||||
plr[myplr].Say(HeroSpeech::YourMadnessEndsHereBetrayer, 30);
|
||||
AddMissile({ 35, 32 }, { 35, 32 }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
|
||||
Players[MyPlayerId].Say(HeroSpeech::YourMadnessEndsHereBetrayer, 30);
|
||||
} else if (Monsters[m]._uniqtype - 1 == UMT_WARLORD) { //"Warlord of Blood"
|
||||
quests[Q_WARLORD]._qactive = QUEST_DONE;
|
||||
plr[myplr].Say(HeroSpeech::YourReignOfPainHasEnded, 30);
|
||||
Players[MyPlayerId].Say(HeroSpeech::YourReignOfPainHasEnded, 30);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -317,7 +317,7 @@ static void UndrawCursor(const Surface &out)
|
||||
|
||||
static bool ShouldShowCursor()
|
||||
{
|
||||
return !(sgbControllerActive && !IsMovingMouseCursorWithController() && pcurs != CURSOR_TELEPORT && !invflag && (!chrflag || plr[myplr]._pStatPts <= 0));
|
||||
return !(sgbControllerActive && !IsMovingMouseCursorWithController() && pcurs != CURSOR_TELEPORT && !invflag && (!chrflag || Players[MyPlayerId]._pStatPts <= 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -458,7 +458,7 @@ static void DrawMonster(const Surface &out, int x, int y, int mx, int my, int m)
|
||||
trans = Monsters[m]._uniqtrans + 4;
|
||||
if (Monsters[m]._mmode == MM_STONE)
|
||||
trans = 2;
|
||||
if (plr[myplr]._pInfraFlag && LightTableIndex > 8)
|
||||
if (Players[MyPlayerId]._pInfraFlag && LightTableIndex > 8)
|
||||
trans = 1;
|
||||
if (trans != 0)
|
||||
Cl2DrawLightTbl(out, mx, my, cel, nCel, trans);
|
||||
@@ -471,14 +471,14 @@ static void DrawMonster(const Surface &out, int x, int y, int mx, int my, int m)
|
||||
*/
|
||||
static void DrawPlayerIconHelper(const Surface &out, int pnum, missile_graphic_id missileGraphicId, int x, int y, bool lighting)
|
||||
{
|
||||
x += CalculateWidth2(plr[pnum].AnimInfo.pCelSprite->Width()) - misfiledata[missileGraphicId].mAnimWidth2[0];
|
||||
x += CalculateWidth2(Players[pnum].AnimInfo.pCelSprite->Width()) - misfiledata[missileGraphicId].mAnimWidth2[0];
|
||||
|
||||
int width = misfiledata[missileGraphicId].mAnimWidth[0];
|
||||
byte *pCelBuff = misfiledata[missileGraphicId].mAnimData[0];
|
||||
|
||||
CelSprite cel { pCelBuff, width };
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
Cl2Draw(out, x, y, cel, 1);
|
||||
return;
|
||||
}
|
||||
@@ -501,9 +501,9 @@ static void DrawPlayerIconHelper(const Surface &out, int pnum, missile_graphic_i
|
||||
*/
|
||||
static void DrawPlayerIcons(const Surface &out, int pnum, int x, int y, bool lighting)
|
||||
{
|
||||
if (plr[pnum].pManaShield)
|
||||
if (Players[pnum].pManaShield)
|
||||
DrawPlayerIconHelper(out, pnum, MFILE_MANASHLD, x, y, lighting);
|
||||
if (plr[pnum].wReflections > 0)
|
||||
if (Players[pnum].wReflections > 0)
|
||||
DrawPlayerIconHelper(out, pnum, MFILE_REFLECT, x, y + 16, lighting);
|
||||
}
|
||||
|
||||
@@ -521,11 +521,11 @@ static void DrawPlayerIcons(const Surface &out, int pnum, int x, int y, bool lig
|
||||
*/
|
||||
static void DrawPlayer(const Surface &out, int pnum, int x, int y, int px, int py)
|
||||
{
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 && !plr[myplr]._pInfraFlag && leveltype != DTYPE_TOWN) {
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 && !Players[MyPlayerId]._pInfraFlag && leveltype != DTYPE_TOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
auto *pCelSprite = player.AnimInfo.pCelSprite;
|
||||
int nCel = player.AnimInfo.GetFrameToUseForRendering();
|
||||
@@ -554,13 +554,13 @@ static void DrawPlayer(const Surface &out, int pnum, int x, int y, int px, int p
|
||||
if (pnum == pcursplr)
|
||||
Cl2DrawOutline(out, 165, px, py, *pCelSprite, nCel);
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
Cl2Draw(out, px, py, *pCelSprite, nCel);
|
||||
DrawPlayerIcons(out, pnum, px, py, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 || (plr[myplr]._pInfraFlag && LightTableIndex > 8)) {
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 || (Players[MyPlayerId]._pInfraFlag && LightTableIndex > 8)) {
|
||||
Cl2DrawLightTbl(out, px, py, *pCelSprite, nCel, 1);
|
||||
DrawPlayerIcons(out, pnum, px, py, true);
|
||||
return;
|
||||
@@ -591,7 +591,7 @@ void DrawDeadPlayer(const Surface &out, int x, int y, int sx, int sy)
|
||||
dFlags[x][y] &= ~BFLAG_DEAD_PLAYER;
|
||||
|
||||
for (int i = 0; i < MAX_PLRS; i++) {
|
||||
auto &player = plr[i];
|
||||
auto &player = Players[i];
|
||||
if (player.plractive && player._pHitPoints == 0 && player.plrlevel == (BYTE)currlevel && player.position.tile.x == x && player.position.tile.y == y) {
|
||||
dFlags[x][y] |= BFLAG_DEAD_PLAYER;
|
||||
int px = sx + player.position.offset.deltaX - CalculateWidth2(player.AnimInfo.pCelSprite == nullptr ? 96 : player.AnimInfo.pCelSprite->Width());
|
||||
@@ -784,7 +784,7 @@ static void DrawMonsterHelper(const Surface &out, int x, int y, int oy, int sx,
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 && !plr[myplr]._pInfraFlag)
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 && !Players[MyPlayerId]._pInfraFlag)
|
||||
return;
|
||||
|
||||
if (mi < 0 || mi >= MAXMONSTERS) {
|
||||
@@ -834,7 +834,7 @@ static void DrawPlayerHelper(const Surface &out, int x, int y, int sx, int sy)
|
||||
Log("draw player: tried to draw illegal player {}", p);
|
||||
return;
|
||||
}
|
||||
auto &player = plr[p];
|
||||
auto &player = Players[p];
|
||||
|
||||
Displacement offset = player.position.offset;
|
||||
if (player.IsWalking()) {
|
||||
@@ -1270,7 +1270,7 @@ static void DrawGame(const Surface &fullOut, int x, int y)
|
||||
: fullOut.subregionY(0, (gnViewportHeight + 1) / 2);
|
||||
|
||||
// Adjust by player offset and tile grid alignment
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
Displacement offset = ScrollInfo.offset;
|
||||
if (myPlayer.IsWalking())
|
||||
offset = GetOffsetForWalking(myPlayer.AnimInfo, myPlayer._pdir, true);
|
||||
@@ -1392,7 +1392,7 @@ void DrawView(const Surface &out, int startX, int startY)
|
||||
} else if (questlog) {
|
||||
DrawQuestLog(out);
|
||||
}
|
||||
if (!chrflag && plr[myplr]._pStatPts != 0 && !spselflag
|
||||
if (!chrflag && Players[MyPlayerId]._pStatPts != 0 && !spselflag
|
||||
&& (!questlog || gnScreenHeight >= SPANEL_HEIGHT + PANEL_HEIGHT + 74 || gnScreenWidth >= 4 * SPANEL_WIDTH)) {
|
||||
DrawLevelUpIcon(out);
|
||||
}
|
||||
@@ -1414,7 +1414,7 @@ void DrawView(const Surface &out, int startX, int startY)
|
||||
if (msgflag != EMSG_NONE) {
|
||||
DrawDiabloMsg(out);
|
||||
}
|
||||
if (deathflag) {
|
||||
if (MyPlayerIsDead) {
|
||||
RedBack(out);
|
||||
} else if (PauseMode != 0) {
|
||||
gmenu_draw_pause(out);
|
||||
|
||||
+36
-36
@@ -68,24 +68,24 @@ void UseMana(int id, spell_id sn)
|
||||
{
|
||||
int ma; // mana cost
|
||||
|
||||
if (id == myplr) {
|
||||
switch (plr[id]._pSplType) {
|
||||
if (id == MyPlayerId) {
|
||||
switch (Players[id]._pSplType) {
|
||||
case RSPLTYPE_SKILL:
|
||||
case RSPLTYPE_INVALID:
|
||||
break;
|
||||
case RSPLTYPE_SCROLL:
|
||||
RemoveScroll(plr[id]);
|
||||
RemoveScroll(Players[id]);
|
||||
break;
|
||||
case RSPLTYPE_CHARGES:
|
||||
UseStaffCharge(plr[id]);
|
||||
UseStaffCharge(Players[id]);
|
||||
break;
|
||||
case RSPLTYPE_SPELL:
|
||||
#ifdef _DEBUG
|
||||
if (!debug_mode_key_inverted_v) {
|
||||
#endif
|
||||
ma = GetManaAmount(plr[id], sn);
|
||||
plr[id]._pMana -= ma;
|
||||
plr[id]._pManaBase -= ma;
|
||||
ma = GetManaAmount(Players[id], sn);
|
||||
Players[id]._pMana -= ma;
|
||||
Players[id]._pManaBase -= ma;
|
||||
drawmanaflag = true;
|
||||
#ifdef _DEBUG
|
||||
}
|
||||
@@ -172,16 +172,16 @@ bool CheckSpell(int id, spell_id sn, spell_type st, bool manaonly)
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &player = plr[id];
|
||||
auto &player = Players[id];
|
||||
|
||||
return player._pMana >= GetManaAmount(player, sn);
|
||||
}
|
||||
|
||||
void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int spllvl)
|
||||
{
|
||||
Direction dir = plr[id]._pdir;
|
||||
Direction dir = Players[id]._pdir;
|
||||
if (spl == SPL_FIREWALL || spl == SPL_LIGHTWALL) {
|
||||
dir = plr[id].tempDirection;
|
||||
dir = Players[id].tempDirection;
|
||||
}
|
||||
|
||||
for (int i = 0; spelldata[spl].sMissiles[i] != MIS_NULL && i < 3; i++) {
|
||||
@@ -203,9 +203,9 @@ static void PlacePlayer(int pnum)
|
||||
{
|
||||
Point newPosition = {};
|
||||
|
||||
if (plr[pnum].plrlevel == currlevel) {
|
||||
if (Players[pnum].plrlevel == currlevel) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
newPosition = plr[pnum].position.tile + Displacement { plrxoff2[i], plryoff2[i] };
|
||||
newPosition = Players[pnum].position.tile + Displacement { plrxoff2[i], plryoff2[i] };
|
||||
if (PosOkPlayer(pnum, newPosition)) {
|
||||
break;
|
||||
}
|
||||
@@ -217,10 +217,10 @@ static void PlacePlayer(int pnum)
|
||||
int min = -1;
|
||||
for (int max = 1; min > -50 && !done; max++, min--) {
|
||||
for (int y = min; y <= max && !done; y++) {
|
||||
newPosition.y = plr[pnum].position.tile.y + y;
|
||||
newPosition.y = Players[pnum].position.tile.y + y;
|
||||
|
||||
for (int x = min; x <= max && !done; x++) {
|
||||
newPosition.x = plr[pnum].position.tile.x + x;
|
||||
newPosition.x = Players[pnum].position.tile.x + x;
|
||||
|
||||
if (PosOkPlayer(pnum, newPosition)) {
|
||||
done = true;
|
||||
@@ -230,11 +230,11 @@ static void PlacePlayer(int pnum)
|
||||
}
|
||||
}
|
||||
|
||||
plr[pnum].position.tile = newPosition;
|
||||
Players[pnum].position.tile = newPosition;
|
||||
|
||||
dPlayer[newPosition.x][newPosition.y] = pnum + 1;
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
ViewX = newPosition.x;
|
||||
ViewY = newPosition.y;
|
||||
}
|
||||
@@ -250,57 +250,57 @@ void DoResurrect(int pnum, int rid)
|
||||
int hp;
|
||||
|
||||
if ((char)rid != -1) {
|
||||
AddMissile(plr[rid].position.tile, plr[rid].position.tile, 0, MIS_RESURRECTBEAM, TARGET_MONSTERS, pnum, 0, 0);
|
||||
AddMissile(Players[rid].position.tile, Players[rid].position.tile, 0, MIS_RESURRECTBEAM, TARGET_MONSTERS, pnum, 0, 0);
|
||||
}
|
||||
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
|
||||
if ((char)rid != -1 && plr[rid]._pHitPoints == 0) {
|
||||
if (rid == myplr) {
|
||||
deathflag = false;
|
||||
if ((char)rid != -1 && Players[rid]._pHitPoints == 0) {
|
||||
if (rid == MyPlayerId) {
|
||||
MyPlayerIsDead = false;
|
||||
gamemenu_off();
|
||||
drawhpflag = true;
|
||||
drawmanaflag = true;
|
||||
}
|
||||
|
||||
ClrPlrPath(plr[rid]);
|
||||
plr[rid].destAction = ACTION_NONE;
|
||||
plr[rid]._pInvincible = false;
|
||||
ClrPlrPath(Players[rid]);
|
||||
Players[rid].destAction = ACTION_NONE;
|
||||
Players[rid]._pInvincible = false;
|
||||
PlacePlayer(rid);
|
||||
|
||||
hp = 10 << 6;
|
||||
if (plr[rid]._pMaxHPBase < (10 << 6)) {
|
||||
hp = plr[rid]._pMaxHPBase;
|
||||
if (Players[rid]._pMaxHPBase < (10 << 6)) {
|
||||
hp = Players[rid]._pMaxHPBase;
|
||||
}
|
||||
SetPlayerHitPoints(rid, hp);
|
||||
|
||||
plr[rid]._pHPBase = plr[rid]._pHitPoints + (plr[rid]._pMaxHPBase - plr[rid]._pMaxHP); // CODEFIX: does the same stuff as SetPlayerHitPoints above, can be removed
|
||||
plr[rid]._pMana = 0;
|
||||
plr[rid]._pManaBase = plr[rid]._pMana + (plr[rid]._pMaxManaBase - plr[rid]._pMaxMana);
|
||||
Players[rid]._pHPBase = Players[rid]._pHitPoints + (Players[rid]._pMaxHPBase - Players[rid]._pMaxHP); // CODEFIX: does the same stuff as SetPlayerHitPoints above, can be removed
|
||||
Players[rid]._pMana = 0;
|
||||
Players[rid]._pManaBase = Players[rid]._pMana + (Players[rid]._pMaxManaBase - Players[rid]._pMaxMana);
|
||||
|
||||
CalcPlrInv(rid, true);
|
||||
|
||||
if (plr[rid].plrlevel == currlevel) {
|
||||
StartStand(rid, plr[rid]._pdir);
|
||||
if (Players[rid].plrlevel == currlevel) {
|
||||
StartStand(rid, Players[rid]._pdir);
|
||||
} else {
|
||||
plr[rid]._pmode = PM_STAND;
|
||||
Players[rid]._pmode = PM_STAND;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DoHealOther(int pnum, uint16_t rid)
|
||||
{
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
|
||||
if ((DWORD)pnum >= MAX_PLRS || rid >= MAX_PLRS) {
|
||||
return;
|
||||
}
|
||||
auto &player = plr[pnum];
|
||||
auto &target = plr[rid];
|
||||
auto &player = Players[pnum];
|
||||
auto &target = Players[rid];
|
||||
|
||||
if ((target._pHitPoints >> 6) <= 0) {
|
||||
return;
|
||||
@@ -325,7 +325,7 @@ void DoHealOther(int pnum, uint16_t rid)
|
||||
target._pHitPoints = std::min(target._pHitPoints + hp, target._pMaxHP);
|
||||
target._pHPBase = std::min(target._pHPBase + hp, target._pMaxHPBase);
|
||||
|
||||
if (rid == myplr) {
|
||||
if (rid == MyPlayerId) {
|
||||
drawhpflag = true;
|
||||
}
|
||||
}
|
||||
|
||||
+60
-60
@@ -199,9 +199,9 @@ void PrintStoreItem(ItemStruct *x, int l, uint16_t flags)
|
||||
|
||||
void StoreAutoPlace()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(myplr, myPlayer.HoldItem)) {
|
||||
if (AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(MyPlayerId, myPlayer.HoldItem)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void StartSmithBuy()
|
||||
stextsval = 0;
|
||||
|
||||
/* TRANSLATORS: This text is white space sensitive. Check for correct alignment! */
|
||||
strcpy(tempstr, fmt::format(_("I have these items for sale: Your gold: {:d}"), plr[myplr]._pGold).c_str());
|
||||
strcpy(tempstr, fmt::format(_("I have these items for sale: Your gold: {:d}"), Players[MyPlayerId]._pGold).c_str());
|
||||
|
||||
AddSText(0, 1, tempstr, UIS_GOLD | UIS_CENTER, false);
|
||||
AddSLine(3);
|
||||
@@ -326,7 +326,7 @@ bool StartSmithPremiumBuy()
|
||||
stextsval = 0;
|
||||
|
||||
/* TRANSLATORS: This text is white space sensitive. Check for correct alignment! */
|
||||
strcpy(tempstr, fmt::format(_("I have these premium items for sale: Your gold: {:d}"), plr[myplr]._pGold).c_str());
|
||||
strcpy(tempstr, fmt::format(_("I have these premium items for sale: Your gold: {:d}"), Players[MyPlayerId]._pGold).c_str());
|
||||
|
||||
AddSText(0, 1, tempstr, UIS_GOLD | UIS_CENTER, false);
|
||||
AddSLine(3);
|
||||
@@ -348,9 +348,9 @@ bool SmithSellOk(int i)
|
||||
ItemStruct *pI;
|
||||
|
||||
if (i >= 0) {
|
||||
pI = &plr[myplr].InvList[i];
|
||||
pI = &Players[MyPlayerId].InvList[i];
|
||||
} else {
|
||||
pI = &plr[myplr].SpdList[-(i + 1)];
|
||||
pI = &Players[MyPlayerId].SpdList[-(i + 1)];
|
||||
}
|
||||
|
||||
if (pI->isEmpty())
|
||||
@@ -415,7 +415,7 @@ void StartSmithSell()
|
||||
item._itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (int i = 0; i < myPlayer._pNumInv; i++) {
|
||||
if (storenumh >= 48)
|
||||
@@ -482,7 +482,7 @@ void StartSmithSell()
|
||||
|
||||
bool SmithRepairOk(int i)
|
||||
{
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer.InvList[i].isEmpty())
|
||||
return false;
|
||||
@@ -506,7 +506,7 @@ void StartSmithRepair()
|
||||
item._itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
auto &helmet = myPlayer.InvBody[INVLOC_HEAD];
|
||||
if (!helmet.isEmpty() && helmet._iDurability != helmet._iMaxDur) {
|
||||
@@ -575,7 +575,7 @@ void FillManaPlayer()
|
||||
if (!sgOptions.Gameplay.bAdriaRefillsMana)
|
||||
return;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pMana != myPlayer._pMaxMana) {
|
||||
PlaySFX(IS_CAST8);
|
||||
@@ -637,7 +637,7 @@ void StartWitchBuy()
|
||||
stextsmax = 20;
|
||||
|
||||
/* TRANSLATORS: This text is white space sensitive. Check for correct alignment! */
|
||||
strcpy(tempstr, fmt::format(_("I have these items for sale: Your gold: {:d}"), plr[myplr]._pGold).c_str());
|
||||
strcpy(tempstr, fmt::format(_("I have these items for sale: Your gold: {:d}"), Players[MyPlayerId]._pGold).c_str());
|
||||
|
||||
AddSText(0, 1, tempstr, UIS_GOLD | UIS_CENTER, false);
|
||||
AddSLine(3);
|
||||
@@ -662,9 +662,9 @@ bool WitchSellOk(int i)
|
||||
bool rv = false;
|
||||
|
||||
if (i >= 0)
|
||||
pI = &plr[myplr].InvList[i];
|
||||
pI = &Players[MyPlayerId].InvList[i];
|
||||
else
|
||||
pI = &plr[myplr].SpdList[-(i + 1)];
|
||||
pI = &Players[MyPlayerId].SpdList[-(i + 1)];
|
||||
|
||||
if (pI->_itype == ITYPE_MISC)
|
||||
rv = true;
|
||||
@@ -691,7 +691,7 @@ void StartWitchSell()
|
||||
item._itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (int i = 0; i < myPlayer._pNumInv; i++) {
|
||||
if (storenumh >= 48)
|
||||
@@ -758,7 +758,7 @@ void StartWitchSell()
|
||||
|
||||
bool WitchRechargeOk(int i)
|
||||
{
|
||||
const auto &item = plr[myplr].InvList[i];
|
||||
const auto &item = Players[MyPlayerId].InvList[i];
|
||||
|
||||
if (item._itype == ITYPE_STAFF && item._iCharges != item._iMaxCharges) {
|
||||
return true;
|
||||
@@ -791,7 +791,7 @@ void StartWitchRecharge()
|
||||
item._itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
const auto &myPlayer = plr[myplr];
|
||||
const auto &myPlayer = Players[MyPlayerId];
|
||||
const auto &leftHand = myPlayer.InvBody[INVLOC_HAND_LEFT];
|
||||
|
||||
if ((leftHand._itype == ITYPE_STAFF || leftHand._iMiscId == IMISC_UNIQUE) && leftHand._iCharges != leftHand._iMaxCharges) {
|
||||
@@ -860,7 +860,7 @@ void StoreConfirm()
|
||||
stextscrl = false;
|
||||
ClearSText(5, 23);
|
||||
|
||||
auto &item = plr[myplr].HoldItem;
|
||||
auto &item = Players[MyPlayerId].HoldItem;
|
||||
|
||||
uint16_t iclr = item.getTextColorWithStatCheck();
|
||||
|
||||
@@ -942,7 +942,7 @@ void SStartBoyBuy()
|
||||
stextscrl = false;
|
||||
|
||||
/* TRANSLATORS: This text is white space sensitive. Check for correct alignment! */
|
||||
strcpy(tempstr, fmt::format(_("I have this item for sale: Your gold: {:d}"), plr[myplr]._pGold).c_str());
|
||||
strcpy(tempstr, fmt::format(_("I have this item for sale: Your gold: {:d}"), Players[MyPlayerId]._pGold).c_str());
|
||||
|
||||
AddSText(0, 1, tempstr, UIS_GOLD | UIS_CENTER, false);
|
||||
AddSLine(3);
|
||||
@@ -965,7 +965,7 @@ void SStartBoyBuy()
|
||||
|
||||
void HealPlayer()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pHitPoints != myPlayer._pMaxHP) {
|
||||
PlaySFX(IS_CAST8);
|
||||
@@ -1019,7 +1019,7 @@ void StartHealerBuy()
|
||||
stextsval = 0;
|
||||
|
||||
/* TRANSLATORS: This text is white space sensitive. Check for correct alignment! */
|
||||
strcpy(tempstr, fmt::format(_("I have these items for sale: Your gold: {:d}"), plr[myplr]._pGold).c_str());
|
||||
strcpy(tempstr, fmt::format(_("I have these items for sale: Your gold: {:d}"), Players[MyPlayerId]._pGold).c_str());
|
||||
|
||||
AddSText(0, 1, tempstr, UIS_GOLD | UIS_CENTER, false);
|
||||
AddSLine(3);
|
||||
@@ -1079,7 +1079,7 @@ void StartStorytellerIdentify()
|
||||
item._itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
auto &helmet = myPlayer.InvBody[INVLOC_HEAD];
|
||||
if (IdItemOk(&helmet)) {
|
||||
@@ -1168,7 +1168,7 @@ void StartStorytellerIdentifyShow()
|
||||
stextscrl = false;
|
||||
ClearSText(5, 23);
|
||||
|
||||
auto &item = plr[myplr].HoldItem;
|
||||
auto &item = Players[MyPlayerId].HoldItem;
|
||||
|
||||
uint16_t iclr = item.getTextColorWithStatCheck();
|
||||
|
||||
@@ -1294,7 +1294,7 @@ void SmithEnter()
|
||||
*/
|
||||
void SmithBuyItem()
|
||||
{
|
||||
auto &item = plr[myplr].HoldItem;
|
||||
auto &item = Players[MyPlayerId].HoldItem;
|
||||
|
||||
TakePlrsMoney(item._iIvalue);
|
||||
if (item._iMagical == ITEM_QUALITY_NORMAL)
|
||||
@@ -1309,7 +1309,7 @@ void SmithBuyItem()
|
||||
}
|
||||
smithitem[idx]._itype = ITYPE_NONE;
|
||||
}
|
||||
CalcPlrInv(myplr, true);
|
||||
CalcPlrInv(MyPlayerId, true);
|
||||
}
|
||||
|
||||
void SmitBuyEnter()
|
||||
@@ -1324,7 +1324,7 @@ void SmitBuyEnter()
|
||||
stextvhold = stextsval;
|
||||
stextshold = STORE_SBUY;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
if (myPlayer._pGold < smithitem[idx]._iIvalue) {
|
||||
@@ -1335,7 +1335,7 @@ void SmitBuyEnter()
|
||||
myPlayer.HoldItem = smithitem[idx];
|
||||
NewCursor(myPlayer.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(myplr, myPlayer.HoldItem, false);
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(MyPlayerId, myPlayer.HoldItem, false);
|
||||
|
||||
if (done || AutoPlaceItemInInventory(myPlayer, myPlayer.HoldItem, false))
|
||||
StartStore(STORE_CONFIRM);
|
||||
@@ -1349,7 +1349,7 @@ void SmitBuyEnter()
|
||||
*/
|
||||
void SmithBuyPItem()
|
||||
{
|
||||
auto &item = plr[myplr].HoldItem;
|
||||
auto &item = Players[MyPlayerId].HoldItem;
|
||||
|
||||
TakePlrsMoney(item._iIvalue);
|
||||
|
||||
@@ -1369,7 +1369,7 @@ void SmithBuyPItem()
|
||||
|
||||
premiumitems[xx]._itype = ITYPE_NONE;
|
||||
numpremium--;
|
||||
SpawnPremium(myplr);
|
||||
SpawnPremium(MyPlayerId);
|
||||
}
|
||||
|
||||
void SmitPremiumBuyEnter()
|
||||
@@ -1393,7 +1393,7 @@ void SmitPremiumBuyEnter()
|
||||
}
|
||||
}
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pGold < premiumitems[idx]._iIvalue) {
|
||||
StartStore(STORE_NOMONEY);
|
||||
@@ -1402,7 +1402,7 @@ void SmitPremiumBuyEnter()
|
||||
|
||||
myPlayer.HoldItem = premiumitems[idx];
|
||||
NewCursor(myPlayer.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(myplr, myPlayer.HoldItem, false);
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(MyPlayerId, myPlayer.HoldItem, false);
|
||||
|
||||
if (done || AutoPlaceItemInInventory(myPlayer, myPlayer.HoldItem, false))
|
||||
StartStore(STORE_CONFIRM);
|
||||
@@ -1426,7 +1426,7 @@ bool StoreGoldFit(int idx)
|
||||
if (numsqrs >= sz)
|
||||
return true;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (int8_t itemId : myPlayer.InvGrid) {
|
||||
if (itemId == 0)
|
||||
@@ -1456,12 +1456,12 @@ bool StoreGoldFit(int idx)
|
||||
*/
|
||||
void PlaceStoreGold(int v)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
for (auto &gridNum : myPlayer.InvGrid) {
|
||||
if (gridNum == 0) {
|
||||
int ii = myPlayer._pNumInv;
|
||||
GetGoldSeed(myplr, &golditem);
|
||||
GetGoldSeed(MyPlayerId, &golditem);
|
||||
myPlayer.InvList[ii] = golditem;
|
||||
myPlayer._pNumInv++;
|
||||
gridNum = myPlayer._pNumInv;
|
||||
@@ -1477,7 +1477,7 @@ void PlaceStoreGold(int v)
|
||||
*/
|
||||
void StoreSellItem()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int idx = stextvhold + ((stextlhold - stextup) / 4);
|
||||
if (storehidx[idx] >= 0)
|
||||
@@ -1529,7 +1529,7 @@ void SmitSellEnter()
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
stextshold = STORE_SSELL;
|
||||
stextvhold = stextsval;
|
||||
plr[myplr].HoldItem = storehold[idx];
|
||||
Players[MyPlayerId].HoldItem = storehold[idx];
|
||||
|
||||
if (StoreGoldFit(idx))
|
||||
StartStore(STORE_CONFIRM);
|
||||
@@ -1542,7 +1542,7 @@ void SmitSellEnter()
|
||||
*/
|
||||
void SmithRepairItem()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
TakePlrsMoney(myPlayer.HoldItem._iIvalue);
|
||||
|
||||
@@ -1580,7 +1580,7 @@ void SmitRepairEnter()
|
||||
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
myPlayer.HoldItem = storehold[idx];
|
||||
if (myPlayer._pGold < storehold[idx]._iIvalue)
|
||||
@@ -1620,7 +1620,7 @@ void WitchEnter()
|
||||
*/
|
||||
void WitchBuyItem()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int idx = stextvhold + ((stextlhold - stextup) / 4);
|
||||
|
||||
@@ -1641,7 +1641,7 @@ void WitchBuyItem()
|
||||
}
|
||||
}
|
||||
|
||||
CalcPlrInv(myplr, true);
|
||||
CalcPlrInv(MyPlayerId, true);
|
||||
}
|
||||
|
||||
void WitchBuyEnter()
|
||||
@@ -1656,7 +1656,7 @@ void WitchBuyEnter()
|
||||
stextvhold = stextsval;
|
||||
stextshold = STORE_WBUY;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
|
||||
@@ -1667,7 +1667,7 @@ void WitchBuyEnter()
|
||||
|
||||
myPlayer.HoldItem = witchitem[idx];
|
||||
NewCursor(myPlayer.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(myplr, myPlayer.HoldItem, false);
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(MyPlayerId, myPlayer.HoldItem, false);
|
||||
|
||||
if (done || AutoPlaceItemInInventory(myPlayer, myPlayer.HoldItem, false) || AutoPlaceItemInBelt(myPlayer, myPlayer.HoldItem, false))
|
||||
StartStore(STORE_CONFIRM);
|
||||
@@ -1690,7 +1690,7 @@ void WitchSellEnter()
|
||||
stextvhold = stextsval;
|
||||
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
plr[myplr].HoldItem = storehold[idx];
|
||||
Players[MyPlayerId].HoldItem = storehold[idx];
|
||||
if (StoreGoldFit(idx))
|
||||
StartStore(STORE_CONFIRM);
|
||||
else
|
||||
@@ -1702,7 +1702,7 @@ void WitchSellEnter()
|
||||
*/
|
||||
void WitchRechargeItem()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
TakePlrsMoney(myPlayer.HoldItem._iIvalue);
|
||||
|
||||
@@ -1715,7 +1715,7 @@ void WitchRechargeItem()
|
||||
else
|
||||
myPlayer.InvList[i]._iCharges = myPlayer.InvList[i]._iMaxCharges;
|
||||
|
||||
CalcPlrInv(myplr, true);
|
||||
CalcPlrInv(MyPlayerId, true);
|
||||
}
|
||||
|
||||
void WitchRechargeEnter()
|
||||
@@ -1730,7 +1730,7 @@ void WitchRechargeEnter()
|
||||
stextlhold = stextsel;
|
||||
stextvhold = stextsval;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
myPlayer.HoldItem = storehold[idx];
|
||||
@@ -1743,7 +1743,7 @@ void WitchRechargeEnter()
|
||||
void BoyEnter()
|
||||
{
|
||||
if (!boyitem.isEmpty() && stextsel == 18) {
|
||||
if (plr[myplr]._pGold < 50) {
|
||||
if (Players[MyPlayerId]._pGold < 50) {
|
||||
stextshold = STORE_BOY;
|
||||
stextlhold = 18;
|
||||
stextvhold = stextsval;
|
||||
@@ -1770,11 +1770,11 @@ void BoyEnter()
|
||||
|
||||
void BoyBuyItem()
|
||||
{
|
||||
TakePlrsMoney(plr[myplr].HoldItem._iIvalue);
|
||||
TakePlrsMoney(Players[MyPlayerId].HoldItem._iIvalue);
|
||||
StoreAutoPlace();
|
||||
boyitem._itype = ITYPE_NONE;
|
||||
stextshold = STORE_BOY;
|
||||
CalcPlrInv(myplr, true);
|
||||
CalcPlrInv(MyPlayerId, true);
|
||||
stextlhold = 12;
|
||||
}
|
||||
|
||||
@@ -1783,7 +1783,7 @@ void BoyBuyItem()
|
||||
*/
|
||||
void HealerBuyItem()
|
||||
{
|
||||
auto &item = plr[myplr].HoldItem;
|
||||
auto &item = Players[MyPlayerId].HoldItem;
|
||||
|
||||
int idx = stextvhold + ((stextlhold - stextup) / 4);
|
||||
if (!gbIsMultiplayer) {
|
||||
@@ -1815,7 +1815,7 @@ void HealerBuyItem()
|
||||
}
|
||||
healitem[idx]._itype = ITYPE_NONE;
|
||||
}
|
||||
CalcPlrInv(myplr, true);
|
||||
CalcPlrInv(MyPlayerId, true);
|
||||
}
|
||||
|
||||
void BoyBuyEnter()
|
||||
@@ -1834,7 +1834,7 @@ void BoyBuyEnter()
|
||||
else
|
||||
price += boyitem._iIvalue / 2;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pGold < price) {
|
||||
StartStore(STORE_NOMONEY);
|
||||
@@ -1846,7 +1846,7 @@ void BoyBuyEnter()
|
||||
NewCursor(myPlayer.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
|
||||
bool done = false;
|
||||
if (AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(myplr, myPlayer.HoldItem, false)) {
|
||||
if (AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(MyPlayerId, myPlayer.HoldItem, false)) {
|
||||
done = true;
|
||||
}
|
||||
|
||||
@@ -1861,7 +1861,7 @@ void BoyBuyEnter()
|
||||
|
||||
void StorytellerIdentifyItem()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int idx = storehidx[((stextlhold - stextup) / 4) + stextvhold];
|
||||
if (idx < 0) {
|
||||
@@ -1884,7 +1884,7 @@ void StorytellerIdentifyItem()
|
||||
}
|
||||
myPlayer.HoldItem._iIdentified = true;
|
||||
TakePlrsMoney(myPlayer.HoldItem._iIvalue);
|
||||
CalcPlrInv(myplr, true);
|
||||
CalcPlrInv(MyPlayerId, true);
|
||||
}
|
||||
|
||||
void ConfirmEnter()
|
||||
@@ -1972,7 +1972,7 @@ void HealerBuyEnter()
|
||||
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pGold < healitem[idx]._iIvalue) {
|
||||
StartStore(STORE_NOMONEY);
|
||||
@@ -1982,7 +1982,7 @@ void HealerBuyEnter()
|
||||
myPlayer.HoldItem = healitem[idx];
|
||||
NewCursor(myPlayer.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(myplr, myPlayer.HoldItem, false);
|
||||
bool done = AutoEquipEnabled(myPlayer, myPlayer.HoldItem) && AutoEquip(MyPlayerId, myPlayer.HoldItem, false);
|
||||
|
||||
if (done || AutoPlaceItemInInventory(myPlayer, myPlayer.HoldItem, false) || AutoPlaceItemInBelt(myPlayer, myPlayer.HoldItem, false))
|
||||
StartStore(STORE_CONFIRM);
|
||||
@@ -2024,7 +2024,7 @@ void StorytellerIdentifyEnter()
|
||||
stextlhold = stextsel;
|
||||
stextvhold = stextsval;
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int idx = stextsval + ((stextsel - stextup) / 4);
|
||||
myPlayer.HoldItem = storehold[idx];
|
||||
@@ -2214,7 +2214,7 @@ void SetupTownStores()
|
||||
{
|
||||
SetRndSeed(glSeedTbl[currlevel] * SDL_GetTicks());
|
||||
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
int l = myPlayer._pLevel / 2;
|
||||
if (!gbIsMultiplayer) {
|
||||
@@ -2231,7 +2231,7 @@ void SetupTownStores()
|
||||
SpawnWitch(l);
|
||||
SpawnHealer(l);
|
||||
SpawnBoy(myPlayer._pLevel);
|
||||
SpawnPremium(myplr);
|
||||
SpawnPremium(MyPlayerId);
|
||||
}
|
||||
|
||||
void FreeStoreMem()
|
||||
@@ -2648,7 +2648,7 @@ void StoreNext()
|
||||
|
||||
void TakePlrsMoney(int cost)
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
myPlayer._pGold -= cost;
|
||||
|
||||
|
||||
+6
-6
@@ -23,7 +23,7 @@ void SyncOneMonster()
|
||||
{
|
||||
for (int i = 0; i < ActiveMonsterCount; i++) {
|
||||
int m = ActiveMonsters[i];
|
||||
sgnMonsterPriority[m] = plr[myplr].position.tile.ManhattanDistance(Monsters[m].position.tile);
|
||||
sgnMonsterPriority[m] = Players[MyPlayerId].position.tile.ManhattanDistance(Monsters[m].position.tile);
|
||||
if (Monsters[m]._msquelch == 0) {
|
||||
sgnMonsterPriority[m] += 0x1000;
|
||||
} else if (sgwLRU[m] != 0) {
|
||||
@@ -131,7 +131,7 @@ void SyncPlrInv(TSyncHeader *pHdr)
|
||||
}
|
||||
|
||||
assert(sgnSyncPInv > -1 && sgnSyncPInv < NUM_INVLOC);
|
||||
pItem = &plr[myplr].InvBody[sgnSyncPInv];
|
||||
pItem = &Players[MyPlayerId].InvBody[sgnSyncPInv];
|
||||
if (!pItem->isEmpty()) {
|
||||
pHdr->bPInvLoc = sgnSyncPInv;
|
||||
pHdr->wPInvIndx = pItem->IDidx;
|
||||
@@ -197,12 +197,12 @@ static void SyncMonster(int pnum, const TSyncMonster *p)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t delta = plr[myplr].position.tile.ManhattanDistance(Monsters[ndx].position.tile);
|
||||
uint32_t delta = Players[MyPlayerId].position.tile.ManhattanDistance(Monsters[ndx].position.tile);
|
||||
if (delta > 255) {
|
||||
delta = 255;
|
||||
}
|
||||
|
||||
if (delta < p->_mdelta || (delta == p->_mdelta && pnum > myplr)) {
|
||||
if (delta < p->_mdelta || (delta == p->_mdelta && pnum > MyPlayerId)) {
|
||||
return;
|
||||
}
|
||||
if (Monsters[ndx].position.future.x == p->_mx && Monsters[ndx].position.future.y == p->_my) {
|
||||
@@ -251,7 +251,7 @@ uint32_t sync_update(int pnum, const byte *pbBuf)
|
||||
if (gbBufferMsgs == 1) {
|
||||
return pHdr->wLen + sizeof(*pHdr);
|
||||
}
|
||||
if (pnum == myplr) {
|
||||
if (pnum == MyPlayerId) {
|
||||
return pHdr->wLen + sizeof(*pHdr);
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ uint32_t sync_update(int pnum, const byte *pbBuf)
|
||||
|
||||
void sync_init()
|
||||
{
|
||||
sgnMonsters = 16 * myplr;
|
||||
sgnMonsters = 16 * MyPlayerId;
|
||||
memset(sgwLRU, 255, sizeof(sgwLRU));
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -168,14 +168,14 @@ void DrlgTPass3()
|
||||
FillSector("Levels\\TownData\\Sector4s.DUN", 0, 0);
|
||||
|
||||
if (gbIsSpawn || !gbIsMultiplayer) {
|
||||
if (gbIsSpawn || ((plr[myplr].pTownWarps & 1) == 0 && (!gbIsHellfire || plr[myplr]._pLevel < 10))) {
|
||||
if (gbIsSpawn || ((Players[MyPlayerId].pTownWarps & 1) == 0 && (!gbIsHellfire || Players[MyPlayerId]._pLevel < 10))) {
|
||||
FillTile(48, 20, 320);
|
||||
}
|
||||
if (gbIsSpawn || ((plr[myplr].pTownWarps & 2) == 0 && (!gbIsHellfire || plr[myplr]._pLevel < 15))) {
|
||||
if (gbIsSpawn || ((Players[MyPlayerId].pTownWarps & 2) == 0 && (!gbIsHellfire || Players[MyPlayerId]._pLevel < 15))) {
|
||||
FillTile(16, 68, 332);
|
||||
FillTile(16, 70, 331);
|
||||
}
|
||||
if (gbIsSpawn || ((plr[myplr].pTownWarps & 4) == 0 && (!gbIsHellfire || plr[myplr]._pLevel < 20))) {
|
||||
if (gbIsSpawn || ((Players[MyPlayerId].pTownWarps & 4) == 0 && (!gbIsHellfire || Players[MyPlayerId]._pLevel < 20))) {
|
||||
for (int x = 36; x < 46; x++) {
|
||||
FillTile(x, 78, GenerateRnd(4) + 1);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ void DrlgTPass3()
|
||||
} else {
|
||||
TownCloseHive();
|
||||
}
|
||||
if (quests[Q_GRAVE]._qactive == QUEST_DONE || plr[myplr]._pLvlVisited[21])
|
||||
if (quests[Q_GRAVE]._qactive == QUEST_DONE || Players[MyPlayerId]._pLvlVisited[21])
|
||||
TownOpenGrave();
|
||||
else
|
||||
TownCloseGrave();
|
||||
|
||||
+1
-1
@@ -815,7 +815,7 @@ void InitTowners()
|
||||
continue;
|
||||
break;
|
||||
case TOWN_GIRL:
|
||||
if (!gbIsHellfire || sgGameInitInfo.bTheoQuest == 0 || !plr->_pLvlVisited[17])
|
||||
if (!gbIsHellfire || sgGameInitInfo.bTheoQuest == 0 || !Players->_pLvlVisited[17])
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@ void track_process()
|
||||
if (cursmx < 0 || cursmx >= MAXDUNX - 1 || cursmy < 0 || cursmy >= MAXDUNY - 1)
|
||||
return;
|
||||
|
||||
const auto &player = plr[myplr];
|
||||
const auto &player = Players[MyPlayerId];
|
||||
|
||||
if (player._pmode != PM_STAND && !(player.IsWalking() && player.AnimInfo.GetFrameToUseForRendering() > 6))
|
||||
return;
|
||||
@@ -42,7 +42,7 @@ void track_process()
|
||||
tickMultiplier = 3;
|
||||
if ((int)(tick - sgdwLastWalk) >= gnTickDelay * tickMultiplier) {
|
||||
sgdwLastWalk = tick;
|
||||
NetSendCmdLoc(myplr, true, CMD_WALKXY, { cursmx, cursmy });
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_WALKXY, { cursmx, cursmy });
|
||||
if (!sgbIsScrolling)
|
||||
sgbIsScrolling = true;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ void track_repeat_walk(bool rep)
|
||||
if (rep) {
|
||||
sgbIsScrolling = false;
|
||||
sgdwLastWalk = SDL_GetTicks() - gnTickDelay;
|
||||
NetSendCmdLoc(myplr, true, CMD_WALKXY, { cursmx, cursmy });
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_WALKXY, { cursmx, cursmy });
|
||||
} else if (sgbIsScrolling) {
|
||||
sgbIsScrolling = false;
|
||||
}
|
||||
|
||||
+9
-9
@@ -76,7 +76,7 @@ void InitTownTriggers()
|
||||
townwarp = gbIsMultiplayer && !gbIsSpawn;
|
||||
}
|
||||
if (!gbIsSpawn) {
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (gbIsMultiplayer || (myPlayer.pTownWarps & 1) != 0 || (gbIsHellfire && myPlayer._pLevel >= 10)) {
|
||||
townwarps[0] = true;
|
||||
@@ -798,7 +798,7 @@ void CheckTrigForce()
|
||||
|
||||
void CheckTriggers()
|
||||
{
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (myPlayer._pmode != PM_STAND)
|
||||
return;
|
||||
@@ -811,18 +811,18 @@ void CheckTriggers()
|
||||
switch (trigs[i]._tmsg) {
|
||||
case WM_DIABNEXTLVL:
|
||||
if (gbIsSpawn && currlevel >= 2) {
|
||||
NetSendCmdLoc(myplr, true, CMD_WALKXY, { myPlayer.position.tile.x, myPlayer.position.tile.y + 1 });
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_WALKXY, { myPlayer.position.tile.x, myPlayer.position.tile.y + 1 });
|
||||
myPlayer.Say(HeroSpeech::NotAChance);
|
||||
InitDiabloMsg(EMSG_NOT_IN_SHAREWARE);
|
||||
} else {
|
||||
StartNewLvl(myplr, trigs[i]._tmsg, currlevel + 1);
|
||||
StartNewLvl(MyPlayerId, trigs[i]._tmsg, currlevel + 1);
|
||||
}
|
||||
break;
|
||||
case WM_DIABPREVLVL:
|
||||
StartNewLvl(myplr, trigs[i]._tmsg, currlevel - 1);
|
||||
StartNewLvl(MyPlayerId, trigs[i]._tmsg, currlevel - 1);
|
||||
break;
|
||||
case WM_DIABRTNLVL:
|
||||
StartNewLvl(myplr, trigs[i]._tmsg, ReturnLvl);
|
||||
StartNewLvl(MyPlayerId, trigs[i]._tmsg, ReturnLvl);
|
||||
break;
|
||||
case WM_DIABTOWNWARP:
|
||||
if (gbIsMultiplayer) {
|
||||
@@ -852,16 +852,16 @@ void CheckTriggers()
|
||||
myPlayer.Say(HeroSpeech::ICantGetThereFromHere);
|
||||
|
||||
InitDiabloMsg(abortflag);
|
||||
NetSendCmdLoc(myplr, true, CMD_WALKXY, position);
|
||||
NetSendCmdLoc(MyPlayerId, true, CMD_WALKXY, position);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StartNewLvl(myplr, trigs[i]._tmsg, trigs[i]._tlvl);
|
||||
StartNewLvl(MyPlayerId, trigs[i]._tmsg, trigs[i]._tlvl);
|
||||
break;
|
||||
case WM_DIABTWARPUP:
|
||||
TWarpFrom = currlevel;
|
||||
StartNewLvl(myplr, trigs[i]._tmsg, 0);
|
||||
StartNewLvl(MyPlayerId, trigs[i]._tmsg, 0);
|
||||
break;
|
||||
default:
|
||||
app_fatal("Unknown trigger msg");
|
||||
|
||||
@@ -10,7 +10,7 @@ TEST(Control, SetSpell)
|
||||
pinfoflag = true;
|
||||
pSpell = SPL_FIREBOLT;
|
||||
pSplType = RSPLTYPE_CHARGES;
|
||||
auto &myPlayer = plr[myplr];
|
||||
auto &myPlayer = Players[MyPlayerId];
|
||||
SetSpell();
|
||||
EXPECT_EQ(spselflag, false);
|
||||
EXPECT_EQ(myPlayer._pRSpell, SPL_FIREBOLT);
|
||||
|
||||
@@ -7,7 +7,7 @@ using namespace devilution;
|
||||
|
||||
TEST(Effects, calc_snd_position_center)
|
||||
{
|
||||
plr[myplr].position.tile = { 50, 50 };
|
||||
Players[MyPlayerId].position.tile = { 50, 50 };
|
||||
int plVolume = 0;
|
||||
int plPan = 0;
|
||||
EXPECT_EQ(calc_snd_position({ 50, 50 }, &plVolume, &plPan), true);
|
||||
@@ -17,7 +17,7 @@ TEST(Effects, calc_snd_position_center)
|
||||
|
||||
TEST(Effects, calc_snd_position_near)
|
||||
{
|
||||
plr[myplr].position.tile = { 50, 50 };
|
||||
Players[MyPlayerId].position.tile = { 50, 50 };
|
||||
int plVolume = 0;
|
||||
int plPan = 0;
|
||||
EXPECT_EQ(calc_snd_position({ 55, 50 }, &plVolume, &plPan), true);
|
||||
@@ -27,7 +27,7 @@ TEST(Effects, calc_snd_position_near)
|
||||
|
||||
TEST(Effects, calc_snd_position_out_of_range)
|
||||
{
|
||||
plr[myplr].position.tile = { 12, 12 };
|
||||
Players[MyPlayerId].position.tile = { 12, 12 };
|
||||
int plVolume = 1234;
|
||||
int plPan = 0;
|
||||
EXPECT_EQ(calc_snd_position({ 112, 112 }, &plVolume, &plPan), false);
|
||||
@@ -37,7 +37,7 @@ TEST(Effects, calc_snd_position_out_of_range)
|
||||
|
||||
TEST(Effects, calc_snd_position_extreme_right)
|
||||
{
|
||||
plr[myplr].position.tile = { 50, 50 };
|
||||
Players[MyPlayerId].position.tile = { 50, 50 };
|
||||
int plVolume = 0;
|
||||
int plPan = 0;
|
||||
EXPECT_EQ(calc_snd_position({ 75, 25 }, &plVolume, &plPan), true);
|
||||
@@ -47,7 +47,7 @@ TEST(Effects, calc_snd_position_extreme_right)
|
||||
|
||||
TEST(Effects, calc_snd_position_extreme_left)
|
||||
{
|
||||
plr[myplr].position.tile = { 50, 50 };
|
||||
Players[MyPlayerId].position.tile = { 50, 50 };
|
||||
int plVolume = 0;
|
||||
int plPan = 0;
|
||||
EXPECT_EQ(calc_snd_position({ 25, 75 }, &plVolume, &plPan), true);
|
||||
|
||||
+83
-83
@@ -11,34 +11,34 @@ void set_up_scroll(ItemStruct &item, spell_id spell)
|
||||
{
|
||||
pcurs = CURSOR_HAND;
|
||||
leveltype = DTYPE_CATACOMBS;
|
||||
plr[myplr]._pRSpell = static_cast<spell_id>(spell);
|
||||
Players[MyPlayerId]._pRSpell = static_cast<spell_id>(spell);
|
||||
item._itype = ITYPE_MISC;
|
||||
item._iMiscId = IMISC_SCROLL;
|
||||
item._iSpell = spell;
|
||||
}
|
||||
|
||||
/* Clear the inventory of myplr. */
|
||||
/* Clear the inventory of MyPlayerId. */
|
||||
void clear_inventory()
|
||||
{
|
||||
for (int i = 0; i < NUM_INV_GRID_ELEM; i++) {
|
||||
memset(&plr[myplr].InvList[i], 0, sizeof(ItemStruct));
|
||||
plr[myplr].InvGrid[i] = 0;
|
||||
memset(&Players[MyPlayerId].InvList[i], 0, sizeof(ItemStruct));
|
||||
Players[MyPlayerId].InvGrid[i] = 0;
|
||||
}
|
||||
plr[myplr]._pNumInv = 0;
|
||||
Players[MyPlayerId]._pNumInv = 0;
|
||||
}
|
||||
|
||||
// Test that the scroll is used in the inventory in correct conditions
|
||||
TEST(Inv, UseScroll_from_inventory)
|
||||
{
|
||||
set_up_scroll(plr[myplr].InvList[2], SPL_FIREBOLT);
|
||||
plr[myplr]._pNumInv = 5;
|
||||
set_up_scroll(Players[MyPlayerId].InvList[2], SPL_FIREBOLT);
|
||||
Players[MyPlayerId]._pNumInv = 5;
|
||||
EXPECT_TRUE(UseScroll());
|
||||
}
|
||||
|
||||
// Test that the scroll is used in the belt in correct conditions
|
||||
TEST(Inv, UseScroll_from_belt)
|
||||
{
|
||||
set_up_scroll(plr[myplr].SpdList[2], SPL_FIREBOLT);
|
||||
set_up_scroll(Players[MyPlayerId].SpdList[2], SPL_FIREBOLT);
|
||||
EXPECT_TRUE(UseScroll());
|
||||
}
|
||||
|
||||
@@ -47,27 +47,27 @@ TEST(Inv, UseScroll_from_inventory_invalid_conditions)
|
||||
{
|
||||
// Empty the belt to prevent using a scroll from the belt
|
||||
for (int i = 0; i < MAXBELTITEMS; i++) {
|
||||
plr[myplr].SpdList[i]._itype = ITYPE_NONE;
|
||||
Players[MyPlayerId].SpdList[i]._itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
set_up_scroll(plr[myplr].InvList[2], SPL_FIREBOLT);
|
||||
set_up_scroll(Players[MyPlayerId].InvList[2], SPL_FIREBOLT);
|
||||
pcurs = CURSOR_IDENTIFY;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].InvList[2], SPL_FIREBOLT);
|
||||
set_up_scroll(Players[MyPlayerId].InvList[2], SPL_FIREBOLT);
|
||||
leveltype = DTYPE_TOWN;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].InvList[2], SPL_FIREBOLT);
|
||||
plr[myplr]._pRSpell = static_cast<spell_id>(SPL_HEAL);
|
||||
set_up_scroll(Players[MyPlayerId].InvList[2], SPL_FIREBOLT);
|
||||
Players[MyPlayerId]._pRSpell = static_cast<spell_id>(SPL_HEAL);
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].InvList[2], SPL_FIREBOLT);
|
||||
plr[myplr].InvList[2]._iMiscId = IMISC_STAFF;
|
||||
set_up_scroll(Players[MyPlayerId].InvList[2], SPL_FIREBOLT);
|
||||
Players[MyPlayerId].InvList[2]._iMiscId = IMISC_STAFF;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].InvList[2], SPL_FIREBOLT);
|
||||
plr[myplr].InvList[2]._itype = ITYPE_NONE;
|
||||
set_up_scroll(Players[MyPlayerId].InvList[2], SPL_FIREBOLT);
|
||||
Players[MyPlayerId].InvList[2]._itype = ITYPE_NONE;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
}
|
||||
|
||||
@@ -75,45 +75,45 @@ TEST(Inv, UseScroll_from_inventory_invalid_conditions)
|
||||
TEST(Inv, UseScroll_from_belt_invalid_conditions)
|
||||
{
|
||||
// Disable the inventory to prevent using a scroll from the inventory
|
||||
plr[myplr]._pNumInv = 0;
|
||||
Players[MyPlayerId]._pNumInv = 0;
|
||||
|
||||
set_up_scroll(plr[myplr].SpdList[2], SPL_FIREBOLT);
|
||||
set_up_scroll(Players[MyPlayerId].SpdList[2], SPL_FIREBOLT);
|
||||
pcurs = CURSOR_IDENTIFY;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].SpdList[2], SPL_FIREBOLT);
|
||||
set_up_scroll(Players[MyPlayerId].SpdList[2], SPL_FIREBOLT);
|
||||
leveltype = DTYPE_TOWN;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].SpdList[2], SPL_FIREBOLT);
|
||||
plr[myplr]._pRSpell = static_cast<spell_id>(SPL_HEAL);
|
||||
set_up_scroll(Players[MyPlayerId].SpdList[2], SPL_FIREBOLT);
|
||||
Players[MyPlayerId]._pRSpell = static_cast<spell_id>(SPL_HEAL);
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].SpdList[2], SPL_FIREBOLT);
|
||||
plr[myplr].SpdList[2]._iMiscId = IMISC_STAFF;
|
||||
set_up_scroll(Players[MyPlayerId].SpdList[2], SPL_FIREBOLT);
|
||||
Players[MyPlayerId].SpdList[2]._iMiscId = IMISC_STAFF;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
|
||||
set_up_scroll(plr[myplr].SpdList[2], SPL_FIREBOLT);
|
||||
plr[myplr].SpdList[2]._itype = ITYPE_NONE;
|
||||
set_up_scroll(Players[MyPlayerId].SpdList[2], SPL_FIREBOLT);
|
||||
Players[MyPlayerId].SpdList[2]._itype = ITYPE_NONE;
|
||||
EXPECT_FALSE(UseScroll());
|
||||
}
|
||||
|
||||
// Test gold calculation
|
||||
TEST(Inv, CalculateGold)
|
||||
{
|
||||
plr[myplr]._pNumInv = 10;
|
||||
Players[MyPlayerId]._pNumInv = 10;
|
||||
// Set up 4 slots of gold in the inventory
|
||||
plr[myplr].InvList[1]._itype = ITYPE_GOLD;
|
||||
plr[myplr].InvList[5]._itype = ITYPE_GOLD;
|
||||
plr[myplr].InvList[2]._itype = ITYPE_GOLD;
|
||||
plr[myplr].InvList[3]._itype = ITYPE_GOLD;
|
||||
Players[MyPlayerId].InvList[1]._itype = ITYPE_GOLD;
|
||||
Players[MyPlayerId].InvList[5]._itype = ITYPE_GOLD;
|
||||
Players[MyPlayerId].InvList[2]._itype = ITYPE_GOLD;
|
||||
Players[MyPlayerId].InvList[3]._itype = ITYPE_GOLD;
|
||||
// Set the gold amount to arbitrary values
|
||||
plr[myplr].InvList[1]._ivalue = 100;
|
||||
plr[myplr].InvList[5]._ivalue = 200;
|
||||
plr[myplr].InvList[2]._ivalue = 3;
|
||||
plr[myplr].InvList[3]._ivalue = 30;
|
||||
Players[MyPlayerId].InvList[1]._ivalue = 100;
|
||||
Players[MyPlayerId].InvList[5]._ivalue = 200;
|
||||
Players[MyPlayerId].InvList[2]._ivalue = 3;
|
||||
Players[MyPlayerId].InvList[3]._ivalue = 30;
|
||||
|
||||
EXPECT_EQ(CalculateGold(plr[myplr]), 333);
|
||||
EXPECT_EQ(CalculateGold(Players[MyPlayerId]), 333);
|
||||
}
|
||||
|
||||
// Test automatic gold placing
|
||||
@@ -124,18 +124,18 @@ TEST(Inv, GoldAutoPlace)
|
||||
|
||||
// Put gold into the inventory:
|
||||
// | 1000 | ... | ...
|
||||
plr[myplr].InvList[0]._itype = ITYPE_GOLD;
|
||||
plr[myplr].InvList[0]._ivalue = 1000;
|
||||
plr[myplr]._pNumInv = 1;
|
||||
Players[MyPlayerId].InvList[0]._itype = ITYPE_GOLD;
|
||||
Players[MyPlayerId].InvList[0]._ivalue = 1000;
|
||||
Players[MyPlayerId]._pNumInv = 1;
|
||||
// Put (max gold - 100) gold, which is 4900, into the player's hand
|
||||
plr[myplr].HoldItem._itype = ITYPE_GOLD;
|
||||
plr[myplr].HoldItem._ivalue = GOLD_MAX_LIMIT - 100;
|
||||
Players[MyPlayerId].HoldItem._itype = ITYPE_GOLD;
|
||||
Players[MyPlayerId].HoldItem._ivalue = GOLD_MAX_LIMIT - 100;
|
||||
|
||||
GoldAutoPlace(plr[myplr]);
|
||||
GoldAutoPlace(Players[MyPlayerId]);
|
||||
// We expect the inventory:
|
||||
// | 5000 | 900 | ...
|
||||
EXPECT_EQ(plr[myplr].InvList[0]._ivalue, GOLD_MAX_LIMIT);
|
||||
EXPECT_EQ(plr[myplr].InvList[1]._ivalue, 900);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvList[0]._ivalue, GOLD_MAX_LIMIT);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvList[1]._ivalue, 900);
|
||||
}
|
||||
|
||||
// Test removing an item from inventory with no other items.
|
||||
@@ -144,15 +144,15 @@ TEST(Inv, RemoveInvItem)
|
||||
clear_inventory();
|
||||
// Put a two-slot misc item into the inventory:
|
||||
// | (item) | (item) | ... | ...
|
||||
plr[myplr]._pNumInv = 1;
|
||||
plr[myplr].InvGrid[0] = 1;
|
||||
plr[myplr].InvGrid[1] = -1;
|
||||
plr[myplr].InvList[0]._itype = ITYPE_MISC;
|
||||
Players[MyPlayerId]._pNumInv = 1;
|
||||
Players[MyPlayerId].InvGrid[0] = 1;
|
||||
Players[MyPlayerId].InvGrid[1] = -1;
|
||||
Players[MyPlayerId].InvList[0]._itype = ITYPE_MISC;
|
||||
|
||||
plr[myplr].RemoveInvItem(0);
|
||||
EXPECT_EQ(plr[myplr].InvGrid[0], 0);
|
||||
EXPECT_EQ(plr[myplr].InvGrid[1], 0);
|
||||
EXPECT_EQ(plr[myplr]._pNumInv, 0);
|
||||
Players[MyPlayerId].RemoveInvItem(0);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvGrid[0], 0);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvGrid[1], 0);
|
||||
EXPECT_EQ(Players[MyPlayerId]._pNumInv, 0);
|
||||
}
|
||||
|
||||
// Test removing an item from inventory with other items in it.
|
||||
@@ -161,20 +161,20 @@ TEST(Inv, RemoveInvItem_other_item)
|
||||
clear_inventory();
|
||||
// Put a two-slot misc item and a ring into the inventory:
|
||||
// | (item) | (item) | (ring) | ...
|
||||
plr[myplr]._pNumInv = 2;
|
||||
plr[myplr].InvGrid[0] = 1;
|
||||
plr[myplr].InvGrid[1] = -1;
|
||||
plr[myplr].InvList[0]._itype = ITYPE_MISC;
|
||||
Players[MyPlayerId]._pNumInv = 2;
|
||||
Players[MyPlayerId].InvGrid[0] = 1;
|
||||
Players[MyPlayerId].InvGrid[1] = -1;
|
||||
Players[MyPlayerId].InvList[0]._itype = ITYPE_MISC;
|
||||
|
||||
plr[myplr].InvGrid[2] = 2;
|
||||
plr[myplr].InvList[1]._itype = ITYPE_RING;
|
||||
Players[MyPlayerId].InvGrid[2] = 2;
|
||||
Players[MyPlayerId].InvList[1]._itype = ITYPE_RING;
|
||||
|
||||
plr[myplr].RemoveInvItem(0);
|
||||
EXPECT_EQ(plr[myplr].InvGrid[0], 0);
|
||||
EXPECT_EQ(plr[myplr].InvGrid[1], 0);
|
||||
EXPECT_EQ(plr[myplr].InvGrid[2], 1);
|
||||
EXPECT_EQ(plr[myplr].InvList[0]._itype, ITYPE_RING);
|
||||
EXPECT_EQ(plr[myplr]._pNumInv, 1);
|
||||
Players[MyPlayerId].RemoveInvItem(0);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvGrid[0], 0);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvGrid[1], 0);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvGrid[2], 1);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvList[0]._itype, ITYPE_RING);
|
||||
EXPECT_EQ(Players[MyPlayerId]._pNumInv, 1);
|
||||
}
|
||||
|
||||
// Test removing an item from the belt
|
||||
@@ -182,13 +182,13 @@ TEST(Inv, RemoveSpdBarItem)
|
||||
{
|
||||
// Clear the belt
|
||||
for (int i = 0; i < MAXBELTITEMS; i++) {
|
||||
plr[myplr].SpdList[i]._itype = ITYPE_NONE;
|
||||
Players[MyPlayerId].SpdList[i]._itype = ITYPE_NONE;
|
||||
}
|
||||
// Put an item in the belt: | x | x | item | x | x | x | x | x |
|
||||
plr[myplr].SpdList[3]._itype = ITYPE_MISC;
|
||||
Players[MyPlayerId].SpdList[3]._itype = ITYPE_MISC;
|
||||
|
||||
plr[myplr].RemoveSpdBarItem(3);
|
||||
EXPECT_EQ(plr[myplr].SpdList[3]._itype, ITYPE_NONE);
|
||||
Players[MyPlayerId].RemoveSpdBarItem(3);
|
||||
EXPECT_EQ(Players[MyPlayerId].SpdList[3]._itype, ITYPE_NONE);
|
||||
}
|
||||
|
||||
// Test removing a scroll from the inventory
|
||||
@@ -197,15 +197,15 @@ TEST(Inv, RemoveScroll_inventory)
|
||||
clear_inventory();
|
||||
|
||||
// Put a firebolt scroll into the inventory
|
||||
plr[myplr]._pNumInv = 1;
|
||||
plr[myplr]._pRSpell = static_cast<spell_id>(SPL_FIREBOLT);
|
||||
plr[myplr].InvList[0]._itype = ITYPE_MISC;
|
||||
plr[myplr].InvList[0]._iMiscId = IMISC_SCROLL;
|
||||
plr[myplr].InvList[0]._iSpell = SPL_FIREBOLT;
|
||||
Players[MyPlayerId]._pNumInv = 1;
|
||||
Players[MyPlayerId]._pRSpell = static_cast<spell_id>(SPL_FIREBOLT);
|
||||
Players[MyPlayerId].InvList[0]._itype = ITYPE_MISC;
|
||||
Players[MyPlayerId].InvList[0]._iMiscId = IMISC_SCROLL;
|
||||
Players[MyPlayerId].InvList[0]._iSpell = SPL_FIREBOLT;
|
||||
|
||||
RemoveScroll(plr[myplr]);
|
||||
EXPECT_EQ(plr[myplr].InvGrid[0], 0);
|
||||
EXPECT_EQ(plr[myplr]._pNumInv, 0);
|
||||
RemoveScroll(Players[MyPlayerId]);
|
||||
EXPECT_EQ(Players[MyPlayerId].InvGrid[0], 0);
|
||||
EXPECT_EQ(Players[MyPlayerId]._pNumInv, 0);
|
||||
}
|
||||
|
||||
// Test removing a scroll from the belt
|
||||
@@ -213,14 +213,14 @@ TEST(Inv, RemoveScroll_belt)
|
||||
{
|
||||
// Clear the belt
|
||||
for (int i = 0; i < MAXBELTITEMS; i++) {
|
||||
plr[myplr].SpdList[i]._itype = ITYPE_NONE;
|
||||
Players[MyPlayerId].SpdList[i]._itype = ITYPE_NONE;
|
||||
}
|
||||
// Put a firebolt scroll into the belt
|
||||
plr[myplr]._pSpell = static_cast<spell_id>(SPL_FIREBOLT);
|
||||
plr[myplr].SpdList[3]._itype = ITYPE_MISC;
|
||||
plr[myplr].SpdList[3]._iMiscId = IMISC_SCROLL;
|
||||
plr[myplr].SpdList[3]._iSpell = SPL_FIREBOLT;
|
||||
Players[MyPlayerId]._pSpell = static_cast<spell_id>(SPL_FIREBOLT);
|
||||
Players[MyPlayerId].SpdList[3]._itype = ITYPE_MISC;
|
||||
Players[MyPlayerId].SpdList[3]._iMiscId = IMISC_SCROLL;
|
||||
Players[MyPlayerId].SpdList[3]._iSpell = SPL_FIREBOLT;
|
||||
|
||||
RemoveScroll(plr[myplr]);
|
||||
EXPECT_EQ(plr[myplr].SpdList[3]._itype, ITYPE_NONE);
|
||||
RemoveScroll(Players[MyPlayerId]);
|
||||
EXPECT_EQ(Players[MyPlayerId].SpdList[3]._itype, ITYPE_NONE);
|
||||
}
|
||||
|
||||
+8
-8
@@ -335,8 +335,8 @@ TEST(pack, UnPackItem_diablo)
|
||||
gbIsMultiplayer = false;
|
||||
gbIsSpawn = false;
|
||||
|
||||
plr[myplr]._pMaxManaBase = 125 << 6;
|
||||
plr[myplr]._pMaxHPBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxManaBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxHPBase = 125 << 6;
|
||||
|
||||
for (size_t i = 0; i < sizeof(PackedDiabloItems) / sizeof(*PackedDiabloItems); i++) {
|
||||
UnPackItem(&PackedDiabloItems[i], &id, false);
|
||||
@@ -406,8 +406,8 @@ TEST(pack, UnPackItem_spawn)
|
||||
gbIsMultiplayer = false;
|
||||
gbIsSpawn = true;
|
||||
|
||||
plr[myplr]._pMaxManaBase = 125 << 6;
|
||||
plr[myplr]._pMaxHPBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxManaBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxHPBase = 125 << 6;
|
||||
|
||||
for (size_t i = 0; i < sizeof(PackedSpawnItems) / sizeof(*PackedSpawnItems); i++) {
|
||||
UnPackItem(&PackedSpawnItems[i], &id, false);
|
||||
@@ -450,8 +450,8 @@ TEST(pack, UnPackItem_diablo_multiplayer)
|
||||
gbIsMultiplayer = true;
|
||||
gbIsSpawn = false;
|
||||
|
||||
plr[myplr]._pMaxManaBase = 125 << 6;
|
||||
plr[myplr]._pMaxHPBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxManaBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxHPBase = 125 << 6;
|
||||
|
||||
for (size_t i = 0; i < sizeof(PackedDiabloMPItems) / sizeof(*PackedDiabloMPItems); i++) {
|
||||
UnPackItem(&PackedDiabloMPItems[i], &id, false);
|
||||
@@ -659,8 +659,8 @@ TEST(pack, UnPackItem_hellfire)
|
||||
gbIsMultiplayer = false;
|
||||
gbIsSpawn = false;
|
||||
|
||||
plr[myplr]._pMaxManaBase = 125 << 6;
|
||||
plr[myplr]._pMaxHPBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxManaBase = 125 << 6;
|
||||
Players[MyPlayerId]._pMaxHPBase = 125 << 6;
|
||||
|
||||
for (size_t i = 0; i < sizeof(PackedHellfireItems) / sizeof(*PackedHellfireItems); i++) {
|
||||
UnPackItem(&PackedHellfireItems[i], &id, true);
|
||||
|
||||
@@ -11,7 +11,7 @@ extern bool PM_DoGotHit(int pnum);
|
||||
int RunBlockTest(int frames, int flags)
|
||||
{
|
||||
int pnum = 0;
|
||||
auto &player = plr[pnum];
|
||||
auto &player = Players[pnum];
|
||||
|
||||
player._pHFrames = frames;
|
||||
player._pIFlags = flags;
|
||||
|
||||
@@ -360,15 +360,15 @@ TEST(Writehero, pfile_write_hero)
|
||||
gbIsHellfireSaveGame = false;
|
||||
leveltype = DTYPE_TOWN;
|
||||
|
||||
myplr = 0;
|
||||
MyPlayerId = 0;
|
||||
_uiheroinfo info {};
|
||||
strcpy(info.name, "TestPlayer");
|
||||
info.heroclass = HeroClass::Rogue;
|
||||
pfile_ui_save_create(&info);
|
||||
PkPlayerStruct pks;
|
||||
PackPlayerTest(&pks);
|
||||
UnPackPlayer(&pks, myplr, true);
|
||||
AssertPlayer(plr[0]);
|
||||
UnPackPlayer(&pks, MyPlayerId, true);
|
||||
AssertPlayer(Players[0]);
|
||||
pfile_write_hero();
|
||||
|
||||
std::ifstream f("multi_0.sv", std::ios::binary);
|
||||
|
||||
Reference in New Issue
Block a user