Browse Source

Apply more defines to replace magic numbers

pull/843/head
Anders Jenbo 6 years ago
parent
commit
145ab3c48e
  1. 4
      Source/inv.cpp
  2. 8
      Source/plrmsg.cpp
  3. 6
      Source/render.cpp
  4. 6
      Source/render.h

4
Source/inv.cpp

@ -718,7 +718,7 @@ void CheckInvPaste(int pnum, int mx, int my)
sx = icursW28;
sy = icursH28;
done = FALSE;
for (r = 0; r < NUM_XY_SLOTS && !done; r++) {
for (r = 0; (DWORD)r < NUM_XY_SLOTS && !done; r++) {
if (i >= InvRect[r].X && i < InvRect[r].X + INV_SLOT_SIZE_PX) {
if (j >= InvRect[r].Y - INV_SLOT_SIZE_PX - 1 && j < InvRect[r].Y) {
done = TRUE;
@ -1961,7 +1961,7 @@ char CheckInvHLight()
}
}
if ((DWORD)r >= 73)
if ((DWORD)r >= NUM_XY_SLOTS)
return -1;
rv = -1;

8
Source/plrmsg.cpp

@ -89,16 +89,16 @@ void DrawPlrMsg()
int i;
DWORD x = 10 + SCREEN_X;
DWORD y = 70 + SCREEN_Y;
DWORD width = 620;
DWORD width = SCREEN_WIDTH - 20;
_plrmsg *pMsg;
if (chrflag || questlog) {
if (invflag || sbookflag)
return;
x = 330 + SCREEN_X;
width = 300;
x += SPANEL_WIDTH;
width -= SPANEL_WIDTH;
} else if (invflag || sbookflag)
width = 300;
width -= SPANEL_WIDTH;
pMsg = plr_msgs;
for (i = 0; i < 8; i++) {

6
Source/render.cpp

@ -14,7 +14,7 @@ DWORD *gpDrawMask = NULL;
// char world_4B326D[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
/** Specifies the draw masks used to render transparency of the right side of tiles. */
DWORD RightMask[32] = {
DWORD RightMask[TILE_WIDTH] = {
0xEAAAAAAA, 0xF5555555,
0xFEAAAAAA, 0xFF555555,
0xFFEAAAAA, 0xFFF55555,
@ -33,7 +33,7 @@ DWORD RightMask[32] = {
0xFFFFFFFF, 0xFFFFFFFF
};
/** Specifies the draw masks used to render transparency of the left side of tiles. */
DWORD LeftMask[32] = {
DWORD LeftMask[TILE_WIDTH] = {
0xAAAAAAAB, 0x5555555F,
0xAAAAAABF, 0x555555FF,
0xAAAAABFF, 0x55555FFF,
@ -52,7 +52,7 @@ DWORD LeftMask[32] = {
0xFFFFFFFF, 0xFFFFFFFF
};
/** Specifies the draw masks used to render transparency of wall tiles. */
DWORD WallMask[32] = {
DWORD WallMask[TILE_WIDTH] = {
0xAAAAAAAA, 0x55555555,
0xAAAAAAAA, 0x55555555,
0xAAAAAAAA, 0x55555555,

6
Source/render.h

@ -22,9 +22,9 @@ extern DWORD gdwCurrentMask;
extern BYTE *gpCelFrame;
extern DWORD *gpDrawMask;
// extern char world_4B326D[16];
extern DWORD RightMask[32];
extern DWORD LeftMask[32];
extern DWORD WallMask[32];
extern DWORD RightMask[TILE_WIDTH];
extern DWORD LeftMask[TILE_WIDTH];
extern DWORD WallMask[TILE_WIDTH];
extern int WorldTbl3x16[48];
extern int WorldTbl17_1[17];
extern int WorldTbl17_2[17];

Loading…
Cancel
Save