♻️ Replace 'icursW' and 'icursH' globals with single 'icursSize'
This commit is contained in:
parent
317ebcdd3e
commit
05d206720a
4 changed files with 9 additions and 14 deletions
|
|
@ -110,10 +110,8 @@ Size icursSize28;
|
|||
|
||||
/** inv_item value */
|
||||
int8_t pcursinvitem;
|
||||
/** Pixel width of the current cursor image */
|
||||
int icursW;
|
||||
/** Pixel height of the current cursor image */
|
||||
int icursH;
|
||||
/** Pixel size of the current cursor image */
|
||||
Size icursSize;
|
||||
/** Current highlighted item */
|
||||
int8_t pcursitem;
|
||||
/** Current highlighted object */
|
||||
|
|
@ -164,10 +162,8 @@ Size GetInvItemSize(int cursId)
|
|||
|
||||
void SetICursor(int cursId)
|
||||
{
|
||||
auto size = GetInvItemSize(cursId);
|
||||
icursW = size.width;
|
||||
icursH = size.height;
|
||||
icursSize28 = Size { icursW, icursH } / 28;
|
||||
icursSize = GetInvItemSize(cursId);
|
||||
icursSize28 = icursSize / 28;
|
||||
}
|
||||
|
||||
void NewCursor(int cursId)
|
||||
|
|
|
|||
|
|
@ -34,9 +34,8 @@ enum cursor_id : uint8_t {
|
|||
extern Size cursSize;
|
||||
extern int pcursmonst;
|
||||
extern Size icursSize28;
|
||||
extern int icursH;
|
||||
extern Size icursSize;
|
||||
extern int8_t pcursinvitem;
|
||||
extern int icursW;
|
||||
extern int8_t pcursitem;
|
||||
extern int8_t pcursobj;
|
||||
extern int8_t pcursplr;
|
||||
|
|
|
|||
|
|
@ -358,8 +358,8 @@ void CheckInvPaste(int pnum, Point cursorPosition)
|
|||
auto &player = Players[pnum];
|
||||
|
||||
SetICursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||
int i = cursorPosition.x + (IsHardwareCursor() ? 0 : (icursW / 2));
|
||||
int j = cursorPosition.y + (IsHardwareCursor() ? 0 : (icursH / 2));
|
||||
int i = cursorPosition.x + (IsHardwareCursor() ? 0 : (icursSize.width / 2));
|
||||
int j = cursorPosition.y + (IsHardwareCursor() ? 0 : (icursSize.height / 2));
|
||||
Size itemSize { icursSize28 };
|
||||
bool done = false;
|
||||
int r = 0;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ TEST(Cursor, SetCursor)
|
|||
EXPECT_EQ(pcurs, i);
|
||||
EXPECT_EQ(cursSize.width, 1 * 28);
|
||||
EXPECT_EQ(cursSize.height, 3 * 28);
|
||||
EXPECT_EQ(icursW, 1 * 28);
|
||||
EXPECT_EQ(icursH, 3 * 28);
|
||||
EXPECT_EQ(icursSize.width, 1 * 28);
|
||||
EXPECT_EQ(icursSize.height, 3 * 28);
|
||||
EXPECT_EQ(icursSize28.width, 1);
|
||||
EXPECT_EQ(icursSize28.height, 3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue