Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stash #1054

Closed
wants to merge 9 commits into from
Closed

Stash #1054

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ set(devilutionx_SRCS
SourceX/controls/plrctrls.cpp
SourceX/controls/touch.cpp
SourceX/display.cpp
SourceX/stash.cpp
SourceX/miniwin/misc_msg.cpp
SourceX/thread.cpp
SourceX/sound.cpp
Expand Down
2 changes: 2 additions & 0 deletions Source/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "../types.h"

#include "../SourceX/stash.h"

#include "appfat.h"
#include "automap.h"
#include "capture.h"
Expand Down
7 changes: 5 additions & 2 deletions Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ void CheckPanelInfo()
}
if (MouseX > 190 + PANEL_LEFT && MouseX < 437 + PANEL_LEFT && MouseY > 4 + PANEL_TOP && MouseY < 33 + PANEL_TOP)
pcursinvitem = CheckInvHLight();
pcursstashitem = CheckStashHLight();
}

/**
Expand Down Expand Up @@ -1145,10 +1146,12 @@ void CheckBtnUp()
switch (i) {
case PANBTN_CHARINFO:
questlog = FALSE;
stash = false;
chrflag = !chrflag;
break;
case PANBTN_QLOG:
chrflag = FALSE;
stash = false;
if (!questlog)
StartQuestlog();
else
Expand Down Expand Up @@ -1291,7 +1294,7 @@ void DrawInfoBox()
int nGold;

DrawPanelBox(177, 62, 288, 60, PANEL_X + 177, PANEL_Y + 46);
if (!panelflag && !trigflag && pcursinvitem == -1 && !spselflag) {
if (!panelflag && !trigflag && pcursinvitem == -1 && pcursstashitem == -1 && !spselflag) {
infostr[0] = '\0';
infoclr = COL_WHITE;
ClearPanel();
Expand Down Expand Up @@ -1763,7 +1766,7 @@ void DrawDurIcon()
bool hasRoomUnderPanels = SCREEN_HEIGHT >= SPANEL_HEIGHT + PANEL_HEIGHT + 16 + 32 + 16;

if (!hasRoomBetweenPanels && !hasRoomUnderPanels) {
if ((chrflag || questlog) && (invflag || sbookflag))
if ((chrflag || questlog || stash) && (invflag || sbookflag))
return;
}

Expand Down
6 changes: 4 additions & 2 deletions Source/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void CheckCursMove()
sy = MouseY;

if (PANELS_COVER) {
if (chrflag || questlog) {
if (chrflag || questlog || stash) {
if (sx >= SCREEN_WIDTH / 2) { /// BUGFIX: (sx >= SCREEN_WIDTH / 2) (fixed)
sx -= SCREEN_WIDTH / 4;
} else {
Expand Down Expand Up @@ -351,7 +351,9 @@ void CheckCursMove()
if (sbookflag && MouseX > RIGHT_PANEL && MouseY <= SPANEL_HEIGHT) {
return;
}
if ((chrflag || questlog) && MouseX < SPANEL_WIDTH && MouseY <= SPANEL_HEIGHT) {
if ((chrflag || questlog || stash) && MouseX < SPANEL_WIDTH && MouseY <= SPANEL_HEIGHT) {
if (stash)
pcursstashitem = CheckStashHLight();
return;
}

Expand Down
15 changes: 15 additions & 0 deletions Source/diablo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ static BOOL LeftMouseDown(int wParam)
stream_stop();
} else if (chrflag && MouseX < SPANEL_WIDTH && MouseY < SPANEL_HEIGHT) {
CheckChrBtns();
} else if (stash && MouseX < SPANEL_WIDTH && MouseY < SPANEL_HEIGHT) {
CheckStash();
} else if (invflag && MouseX > RIGHT_PANEL && MouseY < SPANEL_HEIGHT) {
if (!dropGoldFlag)
CheckInvItem();
Expand Down Expand Up @@ -927,6 +929,7 @@ static void PressKey(int vkey)
stream_stop();
}
questlog = FALSE;
stash = false;
automapflag = FALSE;
msgdelay = 0;
gamemenu_off();
Expand Down Expand Up @@ -1049,6 +1052,7 @@ static void PressKey(int vkey)
stream_stop();
}
questlog = FALSE;
stash = false;
automapflag = FALSE;
msgdelay = 0;
gamemenu_off();
Expand Down Expand Up @@ -1109,6 +1113,7 @@ static void PressChar(WPARAM vkey)
case 'c':
if (stextflag == STORE_NONE) {
questlog = FALSE;
stash = false;
chrflag = !chrflag;
if (!chrflag || invflag) {
if (MouseX > 160 && MouseY < PANEL_TOP && PANELS_COVER) {
Expand All @@ -1125,13 +1130,22 @@ static void PressChar(WPARAM vkey)
case 'q':
if (stextflag == STORE_NONE) {
chrflag = FALSE;
stash = false;
if (!questlog) {
StartQuestlog();
} else {
questlog = FALSE;
}
}
return;
case 'X':
case 'x':
if (stextflag == STORE_NONE) {
chrflag = FALSE;
questlog = FALSE;
stash = !stash;
}
return;
case 'Z':
case 'z':
zoomflag = !zoomflag;
Expand Down Expand Up @@ -1613,6 +1627,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
InitInv();
InitItemGFX();
InitQuestText();
InitStash();

int players = gbIsMultiplayer ? MAX_PLRS : 1;
for (i = 0; i < players; i++)
Expand Down
2 changes: 1 addition & 1 deletion Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4081,7 +4081,7 @@ void DrawUniqueInfo()
{
int uid, y;

if ((!chrflag && !questlog) || SCREEN_WIDTH >= SPANEL_WIDTH * 3) {
if ((!chrflag && !questlog && !stash) || SCREEN_WIDTH >= SPANEL_WIDTH * 3) {
uid = curruitem._iUid;
DrawUTextBack();
PrintUString(0 + RIGHT_PANEL - SPANEL_WIDTH, 2, TRUE, UniqueItemList[uid].UIName, 3);
Expand Down
8 changes: 4 additions & 4 deletions Source/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static bool LoadBool32()
return buf != 0;
}

static void CopyBytes(const void *src, const int n, void *dst)
void CopyBytes(const void *src, const int n, void *dst)
{
memcpy(dst, src, n);
tbuff += n;
Expand Down Expand Up @@ -79,7 +79,7 @@ static void CopyShorts(const void *src, const int n, void *dst)
}
}

static void CopyInt(const void *src, void *dst)
void CopyInt(const void *src, void *dst)
{
unsigned int buf;
memcpy(&buf, src, 4);
Expand Down Expand Up @@ -193,7 +193,7 @@ static void LoadItemData(ItemStruct *pItem)
pItem->_iDamAcFlags = 0;
}

static void LoadItems(const int n, ItemStruct *pItem)
void LoadItems(const int n, ItemStruct *pItem)
{
for (int i = 0; i < n; i++) {
LoadItemData(&pItem[i]);
Expand Down Expand Up @@ -1071,7 +1071,7 @@ static void SaveItem(ItemStruct *pItem)
CopyInt(&pItem->_iDamAcFlags, tbuff);
}

static void SaveItems(ItemStruct *pItem, const int n)
void SaveItems(ItemStruct *pItem, const int n)
{
for (int i = 0; i < n; i++) {
SaveItem(&pItem[i]);
Expand Down
2 changes: 1 addition & 1 deletion Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3767,7 +3767,7 @@ void CheckPlrSpell()
return;

if (
((chrflag || questlog) && MouseX < SPANEL_WIDTH && MouseY < SPANEL_HEIGHT) // inside left panel
((chrflag || questlog || stash) && MouseX < SPANEL_WIDTH && MouseY < SPANEL_HEIGHT) // inside left panel
|| ((invflag || sbookflag) && MouseX > RIGHT_PANEL && MouseY < SPANEL_HEIGHT) // inside right panel
) {
if (rspell != SPL_HEAL
Expand Down
2 changes: 1 addition & 1 deletion Source/plrmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void DrawPlrMsg()
DWORD width = SCREEN_WIDTH - 20;
_plrmsg *pMsg;

if (chrflag || questlog) {
if (chrflag || questlog || stash) {
x += SPANEL_WIDTH;
width -= SPANEL_WIDTH;
}
Expand Down
10 changes: 6 additions & 4 deletions Source/scrollrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ static void Zoom()
int nDstOff = SCREENXY(SCREEN_WIDTH - 1, VIEWPORT_HEIGHT - 1);

if (PANELS_COVER) {
if (chrflag || questlog) {
if (chrflag || questlog || stash) {
wdt >>= 1;
nSrcOff -= wdt;
} else if (invflag || sbookflag) {
Expand Down Expand Up @@ -1142,7 +1142,7 @@ static void DrawGame(int x, int y)
// Skip rendering parts covered by the panels
if (PANELS_COVER) {
if (zoomflag) {
if (chrflag || questlog) {
if (chrflag || questlog || stash) {
ShiftGrid(&x, &y, 2, 0);
columns -= 4;
sx += SPANEL_WIDTH - TILE_WIDTH / 2;
Expand All @@ -1153,7 +1153,7 @@ static void DrawGame(int x, int y)
sx += -TILE_WIDTH / 2;
}
} else {
if (chrflag || questlog) {
if (chrflag || questlog || stash) {
ShiftGrid(&x, &y, 1, 0);
columns -= 2;
sx += -TILE_WIDTH / 2 / 2; // SPANEL_WIDTH accounted for in Zoom()
Expand Down Expand Up @@ -1248,8 +1248,10 @@ void DrawView(int StartX, int StartY)
DrawChr();
} else if (questlog) {
DrawQuestLog();
} else if (stash) {
DrawStash();
}
if (!chrflag && plr[myplr]._pStatPts != 0 && !spselflag
if (!chrflag && !stash && plr[myplr]._pStatPts != 0 && !spselflag
&& (!questlog || SCREEN_HEIGHT >= SPANEL_HEIGHT + PANEL_HEIGHT + 74 || SCREEN_WIDTH >= 4 * SPANEL_WIDTH)) {
DrawLevelUpIcon();
}
Expand Down
1 change: 1 addition & 0 deletions Source/stores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,7 @@ void StartStore(char s)
invflag = FALSE;
chrflag = FALSE;
questlog = FALSE;
stash = false;
dropGoldFlag = FALSE;
ClearSText(0, STORE_LINES);
ReleaseStoreBtn();
Expand Down
4 changes: 4 additions & 0 deletions SourceX/miniwin/misc_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ int mouseWarpingY;

void SetCursorPos(int X, int Y)
{
SDL_Log("SET CURSOR POS %d %d", X, Y);
mouseWarpingX = X;
mouseWarpingY = Y;
mouseWarping = true;
Expand Down Expand Up @@ -390,6 +391,7 @@ bool PeekMessage(LPMSG lpMsg)
spselflag = false;
chrflag = false;
questlog = false;
stash = false;
sbookflag = false;
StoreSpellCoords();
}
Expand All @@ -398,6 +400,7 @@ bool PeekMessage(LPMSG lpMsg)
chrflag = !chrflag;
if (chrflag) {
questlog = false;
stash = false;
spselflag = false;
if (pcurs == CURSOR_DISARM)
SetCursor_(CURSOR_HAND);
Expand All @@ -409,6 +412,7 @@ bool PeekMessage(LPMSG lpMsg)
StartQuestlog();
chrflag = false;
spselflag = false;
stash = false;
} else {
questlog = false;
}
Expand Down