diff --git a/Source/diablo.cpp b/Source/diablo.cpp index c41708393..475b3cfb3 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -428,6 +428,7 @@ static void SaveOptions() setIniInt("Game", "Test Barbarian", sgOptions.bTestBarbarian); setIniInt("Game", "Experience Bar", sgOptions.bExperienceBar); setIniInt("Game", "Enemy Health Bar", sgOptions.bEnemyHealthBar); + setIniInt("Game", "Auto Gold Pickup", sgOptions.bAutoGoldPickup); setIniValue("Network", "Bind Address", sgOptions.szBindAddress); } @@ -472,6 +473,7 @@ static void LoadOptions() sgOptions.bTestBarbarian = getIniBool("Game", "Test Barbarian", false); sgOptions.bExperienceBar = getIniBool("Game", "Experience Bar", false); sgOptions.bEnemyHealthBar = getIniBool("Game", "Enemy Health Bar", false); + sgOptions.bAutoGoldPickup = getIniBool("Game", "Auto Gold Pickup", false); getIniValue("Network", "Bind Address", sgOptions.szBindAddress, sizeof(sgOptions.szBindAddress), "0.0.0.0"); } diff --git a/Source/diablo.h b/Source/diablo.h index 15f3d1509..bbe894fee 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -41,11 +41,12 @@ typedef struct Options { bool bGrabInput; // Do not let the mouse leave the application window bool bTheoQuest; // Enable the Theo quest bool bCowQuest; // Enable the cow quest + bool bFriendlyFire; // Will players still damage other players in non-PvP mode bool bTestBard; // Enable the bard hero class bool bTestBarbarian; // Enable the babarian hero class bool bExperienceBar; // Show the current level progress bool bEnemyHealthBar; // Show enemy health at the top of the screen - bool bFriendlyFire; // Will players still damage other players in non-PvP mode + bool bAutoGoldPickup; // Automatically pick up goald when walking on to it char szBindAddress[129]; // Optionally bind to a specific network interface } Options; diff --git a/Source/player.cpp b/Source/player.cpp index 3aec01d57..a4cf064f5 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -2227,6 +2227,7 @@ bool PM_DoWalk(int pnum, int variant) ChangeLightOff(plr[pnum]._plid, 0, 0); } + AutoGoldPickup(pnum); return true; } else { //We didn't reach new tile so update player's "sub-tile" position PM_ChangeOffset(pnum); diff --git a/SourceX/qol.cpp b/SourceX/qol.cpp index e2f05e7fb..0304a9b3d 100644 --- a/SourceX/qol.cpp +++ b/SourceX/qol.cpp @@ -174,4 +174,26 @@ void DrawXPBar() FastDrawVertLine(xPos - 1 + (barWidth * i / numDividers), yPos - dividerHeight - 1, barHeight + dividerHeight * 2 + 2, frameColor); } +void AutoGoldPickup(int pnum) +{ + if (!sgOptions.bAutoGoldPickup) + return; + if (pnum != myplr) + return; + if (leveltype == DTYPE_TOWN) + return; + + for (int dir = 0; dir < 8; dir++) { + int x = plr[pnum]._px + pathxdir[dir]; + int y = plr[pnum]._py + pathydir[dir]; + if (dItem[x][y] != 0) { + int itemIndex = dItem[x][y] - 1; + if (item[itemIndex]._itype == ITYPE_GOLD) { + NetSendCmdGItem(TRUE, CMD_REQUESTAGITEM, pnum, pnum, itemIndex); + item[itemIndex]._iRequest = TRUE; + } + } + } +} + DEVILUTION_END_NAMESPACE diff --git a/SourceX/qol.h b/SourceX/qol.h index d62cd485e..98447ea7b 100644 --- a/SourceX/qol.h +++ b/SourceX/qol.h @@ -10,6 +10,7 @@ DEVILUTION_BEGIN_NAMESPACE void DrawMonsterHealthBar(); void DrawXPBar(); +void AutoGoldPickup(int pnum); DEVILUTION_END_NAMESPACE