diff --git a/Source/automap.cpp b/Source/automap.cpp index f20077062..37f0151e5 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -173,7 +173,7 @@ void DrawAutomap() return; } - gpBufEnd = (unsigned char *)&gpBuffer[(352 + 160) * 768]; + gpBufEnd = (unsigned char *)&gpBuffer[(VIEWPORT_HEIGHT + 160) * 768]; MapX = (ViewX - 16) >> 1; while (MapX + AutoMapXOfs < 0) diff --git a/Source/control.cpp b/Source/control.cpp index b9567b075..9c2ed89c2 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2092,7 +2092,7 @@ void RedBack() add edi, SCREENXY(0, 0) mov ebx, pLightTbl add ebx, idx - mov edx, 352 + mov edx, VIEWPORT_HEIGHT lx_label1: mov ecx, 640 lx_label2: @@ -2110,7 +2110,7 @@ void RedBack() add edi, SCREENXY(0, 0) mov ebx, pLightTbl add ebx, idx - mov edx, 352 + mov edx, VIEWPORT_HEIGHT l4_label1: mov ecx, 640 l4_label2: @@ -2133,7 +2133,7 @@ void RedBack() if (leveltype != DTYPE_HELL) { dst = &gpBuffer[SCREENXY(0, 0)]; tbl = &pLightTbl[idx]; - for (h = 352; h; h--, dst += 768 - 640) { + for (h = VIEWPORT_HEIGHT; h; h--, dst += 768 - 640) { for (w = 640; w; w--) { *dst = tbl[*dst]; dst++; @@ -2142,7 +2142,7 @@ void RedBack() } else { dst = &gpBuffer[SCREENXY(0, 0)]; tbl = &pLightTbl[idx]; - for (h = 352; h; h--, dst += 768 - 640) { + for (h = VIEWPORT_HEIGHT; h; h--, dst += 768 - 640) { for (w = 640; w; w--) { if (*dst >= 32) *dst = tbl[*dst]; diff --git a/Source/cursor.cpp b/Source/cursor.cpp index dc8095d6a..613ea2967 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -190,8 +190,8 @@ void CheckCursMove() sx = 0; } } - if(sy > 351 && track_isscrolling()) { - sy = 351; + if(sy > VIEWPORT_HEIGHT - 1 && track_isscrolling()) { + sy = VIEWPORT_HEIGHT - 1; } if(!zoomflag) { sx >>= 1; @@ -271,7 +271,7 @@ void CheckCursMove() cursmy = my; return; } - if(MouseY > 352) { + if(MouseY > VIEWPORT_HEIGHT) { CheckPanelInfo(); return; } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index fe423d1c1..82d5a8282 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -801,7 +801,7 @@ BOOL LeftMouseDown(int wParam) SetSpell(); } else if (stextflag) { CheckStoreBtn(); - } else if (MouseY < 352) { + } else if (MouseY < VIEWPORT_HEIGHT) { if (!gmenu_exception() && !TryIconCurs()) { if (questlog && MouseX > 32 && MouseX < 288 && MouseY > 32 && MouseY < 308) { QuestlogESC(); @@ -844,7 +844,7 @@ BOOL LeftMouseCmd(BOOL bShift) { BOOL bNear; - /// ASSERT: assert(MouseY < 352); + /// ASSERT: assert(MouseY < VIEWPORT_HEIGHT); if (leveltype == DTYPE_TOWN) { if (pcursitem != -1 && pcurs == CURSOR_HAND) @@ -972,7 +972,7 @@ void RightMouseDown() } else if (!stextflag) { if (spselflag) { SetSpell(); - } else if (MouseY >= 352 + } else if (MouseY >= VIEWPORT_HEIGHT || (!sbookflag || MouseX <= 320) && !TryIconCurs() && (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem))) { @@ -1210,10 +1210,10 @@ void PressKey(int vkey) } else if(vkey == VK_TAB) { DoAutoMap(); } else if(vkey == VK_SPACE) { - if(!chrflag && invflag && MouseX < 480 && MouseY < 352) { + if(!chrflag && invflag && MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX + 160, MouseY); } - if(!invflag && chrflag && MouseX > 160 && MouseY < 352) { + if(!invflag && chrflag && MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX - 160, MouseY); } helpflag = 0; @@ -1294,11 +1294,11 @@ void PressChar(int vkey) sbookflag = 0; invflag = invflag == 0; if(!invflag || chrflag) { - if(MouseX < 480 && MouseY < 352) { + if(MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX + 160, MouseY); } } else { - if(MouseX > 160 && MouseY < 352) { + if(MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX - 160, MouseY); } } @@ -1310,11 +1310,11 @@ void PressChar(int vkey) questlog = FALSE; chrflag = chrflag == 0; if(!chrflag || invflag) { - if(MouseX > 160 && MouseY < 352) { + if(MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX - 160, MouseY); } } else { - if(MouseX < 480 && MouseY < 352) { + if(MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX + 160, MouseY); } } diff --git a/Source/engine.cpp b/Source/engine.cpp index 065c9ea4b..850b2207e 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -2123,10 +2123,10 @@ void DrawLine(int x0, int y0, int x1, int y1, BYTE col) if (x1 < 0 + 64 || x1 >= 640 + 64) { gbNotInView = TRUE; } - if (y0 < 0 + 160 || y0 >= 352 + 160) { + if (y0 < 0 + 160 || y0 >= VIEWPORT_HEIGHT + 160) { gbNotInView = TRUE; } - if (y1 < 0 + 160 || y1 >= 352 + 160) { + if (y1 < 0 + 160 || y1 >= VIEWPORT_HEIGHT + 160) { gbNotInView = TRUE; } diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 6675303ae..23cf8dbdd 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -539,7 +539,7 @@ void SetDungeonMicros() if (zoomflag) { scr_pix_width = 640; - scr_pix_height = 352; + scr_pix_height = VIEWPORT_HEIGHT; dword_5C2FF8 = 10; dword_5C2FFC = 11; } else { diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index d97ad5e9a..07155430c 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -359,7 +359,7 @@ BOOL gmenu_left_mouse(BOOL isDown) if (!sgpCurrentMenu) { return FALSE; } - if (MouseY >= 352) { + if (MouseY >= VIEWPORT_HEIGHT) { return FALSE; } if (MouseY - 117 >= 0) { diff --git a/Source/inv.cpp b/Source/inv.cpp index 563fd17b6..e61950485 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1363,7 +1363,7 @@ void CheckInvItem() void CheckInvScrn() { if (MouseX > 190 && MouseX < 437 - && MouseY > 352 && MouseY < 385) { + && MouseY > VIEWPORT_HEIGHT && MouseY < 385) { CheckInvItem(); } } diff --git a/Source/player.cpp b/Source/player.cpp index 7abab017c..87710ebdf 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3618,7 +3618,7 @@ void CheckPlrSpell() } if (pcurs != CURSOR_HAND - || MouseY >= 352 + || MouseY >= VIEWPORT_HEIGHT || (chrflag && MouseX < 320 || invflag && MouseX > 320) && rspell != SPL_HEAL && rspell != SPL_IDENTIFY diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 80d886657..83d4be3e6 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -432,7 +432,7 @@ void DrawGame(int x, int y) int i, sx, sy, chunks, blocks; scr_pix_width = 640; - scr_pix_height = 352; + scr_pix_height = VIEWPORT_HEIGHT; dword_5C2FF8 = 10; dword_5C2FFC = 11; @@ -505,7 +505,7 @@ void DrawGame(int x, int y) sy += 16; } /// ASSERT: assert(gpBuffer); - gpBufEnd = &gpBuffer[PitchTbl[352 + SCREEN_Y]]; + gpBufEnd = &gpBuffer[PitchTbl[VIEWPORT_HEIGHT + SCREEN_Y]]; for (i = 0; i < blocks; i++) { scrollrt_draw_lower(x, y, sx, sy, chunks, 0); y++; diff --git a/Source/town.cpp b/Source/town.cpp index 3e46d0a61..81d0e7e1f 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -931,7 +931,7 @@ void T_DrawGame(int x, int y) int i, sx, sy, chunks, blocks; scr_pix_width = 640; - scr_pix_height = 352; + scr_pix_height = VIEWPORT_HEIGHT; dword_5C2FF8 = 10; dword_5C2FFC = 11; @@ -1280,7 +1280,7 @@ void SetTownMicros() if (zoomflag) { scr_pix_width = 640; - scr_pix_height = 352; + scr_pix_height = VIEWPORT_HEIGHT; dword_5C2FF8 = 10; dword_5C2FFC = 11; } else { diff --git a/Source/trigs.cpp b/Source/trigs.cpp index c8dcd14c3..458b93c9b 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -654,7 +654,7 @@ void CheckTrigForce() { trigflag = FALSE; - if(MouseY > 352 - 1) { + if(MouseY > VIEWPORT_HEIGHT - 1) { return; } diff --git a/defs.h b/defs.h index a8c1fe1e8..986323e36 100644 --- a/defs.h +++ b/defs.h @@ -108,6 +108,8 @@ #define BUFFER_HEIGHT (BORDER_TOP + SCREEN_HEIGHT + BORDER_BOTTOM) #define TILE_SIZE 32 +#define VIEWPORT_HEIGHT 352 + #define SCREENXY(x, y) ((x) + SCREEN_X + ((y) + SCREEN_Y) * BUFFER_WIDTH) #define MemFreeDbg(p) \