diff --git a/Source/automap.cpp b/Source/automap.cpp index b676c1dc6..034ed43d0 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -173,7 +173,7 @@ void DrawAutomap() return; } - gpBufEnd = (unsigned char *)&gpBuffer[(VIEWPORT_HEIGHT + SCREEN_Y) * BUFFER_WIDTH]; + gpBufEnd = (unsigned char *)&gpBuffer[(PANEL_Y) * BUFFER_WIDTH]; MapX = (ViewX - 16) >> 1; while (MapX + AutoMapXOfs < 0) diff --git a/Source/capture.cpp b/Source/capture.cpp index 34b1e758d..56369c3b1 100644 --- a/Source/capture.cpp +++ b/Source/capture.cpp @@ -18,9 +18,9 @@ void CaptureScreen() RedPalette(palette); lock_buf(2); - success = CaptureHdr(hObject, 640, 480); + success = CaptureHdr(hObject, SCREEN_WIDTH, SCREEN_HEIGHT); if (success) { - success = CapturePix(hObject, 640, 480, BUFFER_WIDTH, &gpBuffer[SCREENXY(0, 0)]); + success = CapturePix(hObject, SCREEN_WIDTH, SCREEN_HEIGHT, BUFFER_WIDTH, &gpBuffer[SCREENXY(0, 0)]); if (success) { success = CapturePal(hObject, palette); } diff --git a/Source/control.cpp b/Source/control.cpp index 0479a7fe0..52916690a 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -869,7 +869,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) /// ASSERT: assert(gpBuffer); - nSrcOff = x + 640 * y; + nSrcOff = x + PANEL_WIDTH * y; nDstOff = sx + BUFFER_WIDTH * sy; #ifdef USE_ASM @@ -896,7 +896,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) label3: rep movsd label4: - add esi, 640 + add esi, PANEL_WIDTH sub esi, ebx add edi, BUFFER_WIDTH sub edi, ebx @@ -910,7 +910,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) src = &pBtmBuff[nSrcOff]; dst = &gpBuffer[nDstOff]; - for (hgt = h; hgt; hgt--, src += 640 - w, dst += BUFFER_WIDTH - w) { + for (hgt = h; hgt; hgt--, src += PANEL_WIDTH - w, dst += BUFFER_WIDTH - w) { wdt = w; if (wdt & 1) { dst[0] = src[0]; @@ -1030,7 +1030,7 @@ void DrawLifeFlask() DrawFlask(pLifeBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173, filled); if (filled != 13) - DrawFlask(pBtmBuff, 640, 640 * filled + 2029, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173, 13 - filled); + DrawFlask(pBtmBuff, PANEL_WIDTH, PANEL_WIDTH * filled + 2029, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173, 13 - filled); } void UpdateLifeFlask() @@ -1060,7 +1060,7 @@ void DrawManaFlask() DrawFlask(pManaBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173 + 366, filled); if (filled != 13) - DrawFlask(pBtmBuff, 640, 640 * filled + 2029 + 366, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173 + 366, 13 - filled); + DrawFlask(pBtmBuff, PANEL_WIDTH, PANEL_WIDTH * filled + 2029 + 366, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173 + 366, 13 - filled); } void control_update_life_mana() @@ -1112,11 +1112,11 @@ void InitControlPan() int i; if (gbMaxPlayers == 1) { - pBtmBuff = DiabloAllocPtr(144 * 640); - memset(pBtmBuff, 0, 144 * 640); + pBtmBuff = DiabloAllocPtr((PANEL_HEIGHT + 16) * PANEL_WIDTH); + memset(pBtmBuff, 0, (PANEL_HEIGHT + 16) * PANEL_WIDTH); } else { - pBtmBuff = DiabloAllocPtr(288 * 640); - memset(pBtmBuff, 0, 288 * 640); + pBtmBuff = DiabloAllocPtr((PANEL_HEIGHT + 16) * 2 * PANEL_WIDTH); + memset(pBtmBuff, 0, (PANEL_HEIGHT + 16) * 2 * PANEL_WIDTH); } pManaBuff = DiabloAllocPtr(88 * 88); memset(pManaBuff, 0, 88 * 88); @@ -1127,7 +1127,7 @@ void InitControlPan() pSpellCels = LoadFileInMem("CtrlPan\\SpelIcon.CEL", NULL); SetSpellTrans(RSPLTYPE_SKILL); pStatusPanel = LoadFileInMem("CtrlPan\\Panel8.CEL", NULL); - CelDecodeRect(pBtmBuff, 0, 143, 640, pStatusPanel, 1, 640); + CelDecodeRect(pBtmBuff, 0, (PANEL_HEIGHT + 16) - 1, PANEL_WIDTH, pStatusPanel, 1, PANEL_WIDTH); MemFreeDbg(pStatusPanel); pStatusPanel = LoadFileInMem("CtrlPan\\P8Bulbs.CEL", NULL); CelDecodeRect(pLifeBuff, 0, 87, 88, pStatusPanel, 1, 88); @@ -1136,7 +1136,7 @@ void InitControlPan() talkflag = 0; if (gbMaxPlayers != 1) { pTalkPanel = LoadFileInMem("CtrlPan\\TalkPanl.CEL", NULL); - CelDecodeRect(pBtmBuff, 0, 287, 640, pTalkPanel, 1, 640); + CelDecodeRect(pBtmBuff, 0, (PANEL_HEIGHT + 16) * 2 - 1, PANEL_WIDTH, pTalkPanel, 1, PANEL_WIDTH); MemFreeDbg(pTalkPanel); pMultiBtns = LoadFileInMem("CtrlPan\\P8But2.CEL", NULL); pTalkBtns = LoadFileInMem("CtrlPan\\TalkButt.CEL", NULL); @@ -1191,7 +1191,7 @@ void InitControlPan() void ClearCtrlPan() { - DrawPanelBox(0, sgbPlrTalkTbl + 16, 640, 128, 64, 512); + DrawPanelBox(0, sgbPlrTalkTbl + 16, PANEL_WIDTH, PANEL_HEIGHT, 64, 512); DrawInfoBox(); } @@ -2092,15 +2092,15 @@ void RedBack() add edi, SCREENXY(0, 0) mov ebx, pLightTbl add ebx, idx - mov edx, VIEWPORT_HEIGHT + mov edx, PANEL_TOP lx_label1: - mov ecx, 640 + mov ecx, SCREEN_WIDTH lx_label2: mov al, [edi] xlat stosb loop lx_label2 - add edi, BUFFER_WIDTH - 640 + add edi, BUFFER_WIDTH - SCREEN_WIDTH dec edx jnz lx_label1 } @@ -2110,9 +2110,9 @@ void RedBack() add edi, SCREENXY(0, 0) mov ebx, pLightTbl add ebx, idx - mov edx, VIEWPORT_HEIGHT + mov edx, PANEL_TOP l4_label1: - mov ecx, 640 + mov ecx, SCREEN_WIDTH l4_label2: mov al, [edi] cmp al, 32 @@ -2121,7 +2121,7 @@ void RedBack() l4_label3: stosb loop l4_label2 - add edi, BUFFER_WIDTH - 640 + add edi, BUFFER_WIDTH - SCREEN_WIDTH dec edx jnz l4_label1 } @@ -2133,8 +2133,8 @@ void RedBack() if (leveltype != DTYPE_HELL) { dst = &gpBuffer[SCREENXY(0, 0)]; tbl = &pLightTbl[idx]; - for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - 640) { - for (w = 640; w; w--) { + for (h = PANEL_TOP; h; h--, dst += BUFFER_WIDTH - SCREEN_WIDTH) { + for (w = SCREEN_WIDTH; w; w--) { *dst = tbl[*dst]; dst++; } @@ -2142,8 +2142,8 @@ void RedBack() } else { dst = &gpBuffer[SCREENXY(0, 0)]; tbl = &pLightTbl[idx]; - for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - 640) { - for (w = 640; w; w--) { + for (h = PANEL_TOP; h; h--, dst += BUFFER_WIDTH - SCREEN_WIDTH) { + for (w = SCREEN_WIDTH; w; w--) { if (*dst >= 32) *dst = tbl[*dst]; dst++; @@ -2563,7 +2563,7 @@ void control_type_message() for (i = 0; i < 3; i++) { talkbtndown[i] = FALSE; } - sgbPlrTalkTbl = 144; + sgbPlrTalkTbl = PANEL_HEIGHT + 16; drawpanflag = 255; sgbTalkSavePos = sgbNextTalkSave; } diff --git a/Source/cursor.cpp b/Source/cursor.cpp index c1041dab2..196a590fa 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -190,8 +190,8 @@ void CheckCursMove() sx = 0; } } - if (sy > VIEWPORT_HEIGHT - 1 && track_isscrolling()) { - sy = VIEWPORT_HEIGHT - 1; + if (sy > PANEL_TOP - 1 && track_isscrolling()) { + sy = PANEL_TOP - 1; } if (!zoomflag) { sx >>= 1; @@ -209,14 +209,14 @@ void CheckCursMove() if (sx < 0) { sx = 0; } - if (sx >= 640) { - sx = 640; + if (sx >= SCREEN_WIDTH) { + sx = SCREEN_WIDTH; } if (sy < 0) { sy = 0; } - if (sy >= 480) { - sy = 480; + if (sy >= SCREEN_HEIGHT) { + sy = SCREEN_HEIGHT; } tx = sx >> 6; @@ -271,7 +271,7 @@ void CheckCursMove() cursmy = my; return; } - if (MouseY > VIEWPORT_HEIGHT) { + if (MouseY > PANEL_TOP) { CheckPanelInfo(); return; } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 146cec6f4..df13d3a0c 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 < VIEWPORT_HEIGHT) { + } else if (MouseY < PANEL_TOP) { 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 < VIEWPORT_HEIGHT); + /// ASSERT: assert(MouseY < 352); // PANEL_TOP 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 >= VIEWPORT_HEIGHT + } else if (MouseY >= PANEL_TOP || (!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 < VIEWPORT_HEIGHT) { + if (!chrflag && invflag && MouseX < 480 && MouseY < PANEL_TOP) { SetCursorPos(MouseX + 160, MouseY); } - if (!invflag && chrflag && MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { + if (!invflag && chrflag && MouseX > 160 && MouseY < PANEL_TOP) { 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 < VIEWPORT_HEIGHT) { + if (MouseX < 480 && MouseY < PANEL_TOP) { SetCursorPos(MouseX + 160, MouseY); } } else { - if (MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { + if (MouseX > 160 && MouseY < PANEL_TOP) { SetCursorPos(MouseX - 160, MouseY); } } @@ -1310,11 +1310,11 @@ void PressChar(int vkey) questlog = FALSE; chrflag = chrflag == 0; if (!chrflag || invflag) { - if (MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { + if (MouseX > 160 && MouseY < PANEL_TOP) { SetCursorPos(MouseX - 160, MouseY); } } else { - if (MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { + if (MouseX < 480 && MouseY < PANEL_TOP) { SetCursorPos(MouseX + 160, MouseY); } } diff --git a/Source/doom.cpp b/Source/doom.cpp index f20768b65..e2588cd04 100644 --- a/Source/doom.cpp +++ b/Source/doom.cpp @@ -91,5 +91,5 @@ void doom_draw() } } - CelDecodeOnly(64, 511, (BYTE *)pDoomCel, 1, 640); + CelDecodeOnly(SCREEN_X, PANEL_Y - 1, (BYTE *)pDoomCel, 1, 640); } diff --git a/Source/engine.cpp b/Source/engine.cpp index e5dc47329..188fc9e5f 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -2019,7 +2019,7 @@ void ENG_set_pixel(int sx, int sy, BYTE col) /// ASSERT: assert(gpBuffer); - if (sy < 0 || sy >= 640 || sx < 64 || sx >= 704) + if (sy < 0 || sy >= SCREEN_HEIGHT + SCREEN_Y || sx < SCREEN_X || sx >= SCREEN_WIDTH + SCREEN_X) return; dst = &gpBuffer[sx + PitchTbl[sy]]; @@ -2046,11 +2046,11 @@ void engine_draw_pixel(int sx, int sy) /// ASSERT: assert(gpBuffer); if (gbRotateMap) { - if (gbNotInView && (sx < 0 || sx >= 640 || sy < 64 || sy >= 704)) + if (gbNotInView && (sx < 0 || sx >= SCREEN_HEIGHT + SCREEN_Y || sy < SCREEN_X || sy >= SCREEN_WIDTH + SCREEN_X)) return; dst = &gpBuffer[sy + PitchTbl[sx]]; } else { - if (gbNotInView && (sy < 0 || sy >= 640 || sx < 64 || sx >= 704)) + if (gbNotInView && (sy < 0 || sy >= SCREEN_HEIGHT + SCREEN_Y || sx < SCREEN_X || sx >= SCREEN_WIDTH + SCREEN_X)) return; dst = &gpBuffer[sx + PitchTbl[sy]]; } @@ -2099,16 +2099,16 @@ void DrawLine(int x0, int y0, int x1, int y1, BYTE col) gbPixelCol = col; gbNotInView = FALSE; - if (x0 < 0 + 64 || x0 >= 640 + 64) { + if (x0 < 0 + SCREEN_X || x0 >= SCREEN_WIDTH + SCREEN_X) { gbNotInView = TRUE; } - if (x1 < 0 + 64 || x1 >= 640 + 64) { + if (x1 < 0 + SCREEN_X || x1 >= SCREEN_WIDTH + SCREEN_X) { gbNotInView = TRUE; } - if (y0 < 0 + SCREEN_Y || y0 >= VIEWPORT_HEIGHT + SCREEN_Y) { + if (y0 < 0 + SCREEN_Y || y0 >= PANEL_Y) { gbNotInView = TRUE; } - if (y1 < 0 + SCREEN_Y || y1 >= VIEWPORT_HEIGHT + SCREEN_Y) { + if (y1 < 0 + SCREEN_Y || y1 >= PANEL_Y) { gbNotInView = TRUE; } diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 35f59a5a6..076424c5e 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -540,15 +540,15 @@ void SetDungeonMicros() SetSpeedCels(); if (zoomflag) { - scr_pix_width = 640; + scr_pix_width = SCREEN_WIDTH; scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = 10; - dword_5C2FFC = 11; + dword_5C2FF8 = SCREEN_WIDTH / 64; + dword_5C2FFC = VIEWPORT_HEIGHT / 32; } else { - scr_pix_width = 384; - scr_pix_height = 224; - dword_5C2FF8 = 6; - dword_5C2FFC = 7; + scr_pix_width = ZOOM_WIDTH; + scr_pix_height = ZOOM_HEIGHT; + dword_5C2FF8 = ZOOM_WIDTH / 64; + dword_5C2FFC = ZOOM_HEIGHT / 32; } } diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index a796812cc..5acedfd9c 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -39,7 +39,7 @@ const BYTE lfontkern[56] = { void gmenu_draw_pause() { - if (currlevel) + if (currlevel != 0) RedBack(); if (!sgpCurrentMenu) { light_table_index = 0; @@ -150,8 +150,8 @@ void gmenu_draw() if (sgpCurrentMenu) { if (dword_63447C) dword_63447C(sgpCurrentMenu); - CelDecodeOnly(236, 262, sgpLogo, 1, 296); - y = 320; + CelDecodeOnly((SCREEN_WIDTH - 296) / 2 + SCREEN_X, 102 + SCREEN_Y, sgpLogo, 1, 296); + y = 160 + SCREEN_Y; i = sgpCurrentMenu; if (sgpCurrentMenu->fnMenu) { while (i->fnMenu) { @@ -329,7 +329,7 @@ BOOL gmenu_left_mouse(BOOL isDown) if (!sgpCurrentMenu) { return FALSE; } - if (MouseY >= VIEWPORT_HEIGHT) { + if (MouseY >= PANEL_TOP) { return FALSE; } if (MouseY - 117 >= 0) { @@ -338,8 +338,8 @@ BOOL gmenu_left_mouse(BOOL isDown) pItem = &sgpCurrentMenu[i]; if ((sgpCurrentMenu[i].dwFlags & GMENU_ENABLED) != 0) { w = gmenu_get_lfont(pItem); - if (MouseX >= 320 - (w >> 1)) { - if (MouseX <= (w >> 1) + 320) { + if (MouseX >= SCREEN_WIDTH / 2 - w / 2) { + if (MouseX <= SCREEN_WIDTH / 2 + w / 2) { sgpCurrItem = pItem; PlaySFX(IS_TITLEMOV); if (pItem->dwFlags & GMENU_SLIDER) { diff --git a/Source/init.cpp b/Source/init.cpp index 383a7ae7d..9375fadff 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -154,12 +154,12 @@ void init_create_window(int nCmdShow) wcex.hIconSm = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); if (!RegisterClassEx(&wcex)) app_fatal("Unable to register window class"); - if (GetSystemMetrics(SM_CXSCREEN) < 640) - nWidth = 640; + if (GetSystemMetrics(SM_CXSCREEN) < SCREEN_WIDTH) + nWidth = SCREEN_WIDTH; else nWidth = GetSystemMetrics(SM_CXSCREEN); - if (GetSystemMetrics(SM_CYSCREEN) < 480) - nHeight = 480; + if (GetSystemMetrics(SM_CYSCREEN) < SCREEN_HEIGHT) + nHeight = SCREEN_HEIGHT; else nHeight = GetSystemMetrics(SM_CYSCREEN); hWnd = CreateWindowEx(0, "DIABLO", "DIABLO", WS_POPUP, 0, 0, nWidth, nHeight, NULL, NULL, ghInst, NULL); diff --git a/Source/interfac.cpp b/Source/interfac.cpp index fc8cfc0a5..bba9a10ba 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -36,11 +36,11 @@ void DrawCutscene() DWORD i; lock_buf(1); - CelDecodeOnly(64, 639, (BYTE *)sgpBackCel, 1, 640); + CelDecodeOnly(SCREEN_X, 480 + SCREEN_Y - 1, (BYTE *)sgpBackCel, 1, 640); for (i = 0; i < sgdwProgress; i++) { DrawProgress( - progress_bar_screen_pos[progress_id][0] + i + 64, + progress_bar_screen_pos[progress_id][0] + i + SCREEN_X, progress_bar_screen_pos[progress_id][1] + SCREEN_Y, progress_id); } diff --git a/Source/inv.cpp b/Source/inv.cpp index 2385da922..6874b3a7f 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1353,7 +1353,7 @@ void CheckInvItem() void CheckInvScrn() { if (MouseX > 190 && MouseX < 437 - && MouseY > VIEWPORT_HEIGHT && MouseY < 385) { + && MouseY > PANEL_TOP && MouseY < 385) { CheckInvItem(); } } diff --git a/Source/player.cpp b/Source/player.cpp index 9a1e92d32..fe7bbdc90 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3622,7 +3622,7 @@ void CheckPlrSpell() } if (pcurs != CURSOR_HAND - || MouseY >= VIEWPORT_HEIGHT + || MouseY >= PANEL_TOP || (chrflag && MouseX < 320 || invflag && MouseX > 320) && rspell != SPL_HEAL && rspell != SPL_IDENTIFY diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index bfdd56503..ea94596f4 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -431,10 +431,10 @@ void DrawGame(int x, int y) { int i, sx, sy, chunks, blocks; - scr_pix_width = 640; + scr_pix_width = SCREEN_WIDTH; scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = 10; - dword_5C2FFC = 11; + dword_5C2FF8 = SCREEN_WIDTH / 64; + dword_5C2FFC = VIEWPORT_HEIGHT / 32; sx = ScrollInfo._sxoff + 64; sy = ScrollInfo._syoff + 175; @@ -1937,10 +1937,10 @@ void DrawZoom(int x, int y) int i, sx, sy, chunks, blocks; int wdt, nSrcOff, nDstOff; - scr_pix_width = 384; + scr_pix_width = ZOOM_WIDTH; scr_pix_height = 192; - dword_5C2FF8 = 6; - dword_5C2FFC = 6; + dword_5C2FF8 = ZOOM_WIDTH / 64; + dword_5C2FFC = 192 / 32; sx = ScrollInfo._sxoff + 64; sy = ScrollInfo._syoff + 143; @@ -2024,15 +2024,15 @@ void DrawZoom(int x, int y) if (chrflag || questlog) { nSrcOff = SCREENXY(112, 159); nDstOff = SCREENXY(320, 350); - wdt = 160; + wdt = (SCREEN_WIDTH - 320) / 2; } else if (invflag || sbookflag) { nSrcOff = SCREENXY(112, 159); nDstOff = SCREENXY(0, 350); - wdt = 160; + wdt = (SCREEN_WIDTH - 320) / 2; } else { nSrcOff = SCREENXY(32, 159); nDstOff = SCREENXY(0, 350); - wdt = 320; + wdt = SCREEN_WIDTH / 2; } /// ASSERT: assert(gpBuffer); @@ -2357,7 +2357,7 @@ void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BOOL draw } #endif ResetPal(); - ysize = 480; + ysize = SCREEN_HEIGHT; } if (lpDDSBackBuf == NULL) { @@ -2386,7 +2386,7 @@ void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BOOL draw } retry = FALSE; dx_reinit(); - ysize = 480; + ysize = SCREEN_HEIGHT; dwTicks = GetTickCount(); } } @@ -2400,12 +2400,12 @@ void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BOOL draw } } - /// ASSERT: assert(ysize >= 0 && ysize <= 480); + /// ASSERT: assert(ysize >= 0 && ysize <= 480); // SCREEN_HEIGHT if (ysize > 0) { - DoBlitScreen(0, 0, 640, ysize); + DoBlitScreen(0, 0, SCREEN_WIDTH, ysize); } - if (ysize < 480) { + if (ysize < SCREEN_HEIGHT) { if (draw_sbar) { DoBlitScreen(204, 357, 232, 28); } @@ -2598,11 +2598,11 @@ void DrawAndBlit() drawsbarflag = TRUE; ddsdesc = FALSE; ctrlPan = TRUE; - hgt = 480; + hgt = SCREEN_HEIGHT; } else if (drawpanflag == 1) { ddsdesc = TRUE; ctrlPan = FALSE; - hgt = 352; + hgt = VIEWPORT_HEIGHT; } else { return; } diff --git a/Source/town.cpp b/Source/town.cpp index 3121443ae..6dc71d790 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -930,10 +930,10 @@ void T_DrawGame(int x, int y) { int i, sx, sy, chunks, blocks; - scr_pix_width = 640; + scr_pix_width = SCREEN_WIDTH; scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = 10; - dword_5C2FFC = 11; + dword_5C2FF8 = SCREEN_WIDTH / 64; + dword_5C2FFC = VIEWPORT_HEIGHT / 32; sx = ScrollInfo._sxoff + 64; sy = ScrollInfo._syoff + 175; @@ -1044,10 +1044,10 @@ void T_DrawZoom(int x, int y) int i, sx, sy, chunks, blocks; int wdt, nSrcOff, nDstOff; - scr_pix_width = 384; + scr_pix_width = ZOOM_WIDTH; scr_pix_height = 192; - dword_5C2FF8 = 6; - dword_5C2FFC = 6; + dword_5C2FF8 = ZOOM_WIDTH / 64; + dword_5C2FFC = 192 / 32; sx = ScrollInfo._sxoff + 64; sy = ScrollInfo._syoff + 143; @@ -1142,15 +1142,15 @@ void T_DrawZoom(int x, int y) if (chrflag || questlog) { nSrcOff = SCREENXY(112, 159); nDstOff = SCREENXY(320, 350); - wdt = 160; + wdt = (SCREEN_WIDTH - 320) / 2; } else if (invflag || sbookflag) { nSrcOff = SCREENXY(112, 159); nDstOff = SCREENXY(0, 350); - wdt = 160; + wdt = (SCREEN_WIDTH - 320) / 2; } else { nSrcOff = SCREENXY(32, 159); nDstOff = SCREENXY(0, 350); - wdt = 320; + wdt = SCREEN_WIDTH / 2; } /// ASSERT: assert(gpBuffer); @@ -1291,15 +1291,15 @@ void SetTownMicros() } if (zoomflag) { - scr_pix_width = 640; + scr_pix_width = SCREEN_WIDTH; scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = 10; - dword_5C2FFC = 11; + dword_5C2FF8 = SCREEN_WIDTH / 64; + dword_5C2FFC = VIEWPORT_HEIGHT / 32; } else { - scr_pix_width = 384; - scr_pix_height = 224; - dword_5C2FF8 = 6; - dword_5C2FFC = 7; + scr_pix_width = ZOOM_WIDTH; + scr_pix_height = ZOOM_HEIGHT; + dword_5C2FF8 = ZOOM_WIDTH / 64; + dword_5C2FFC = ZOOM_HEIGHT / 32; } } diff --git a/Source/trigs.cpp b/Source/trigs.cpp index fa2249976..974dfcdac 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -652,7 +652,7 @@ void CheckTrigForce() { trigflag = FALSE; - if (MouseY > VIEWPORT_HEIGHT - 1) { + if (MouseY > PANEL_TOP - 1) { return; } diff --git a/defs.h b/defs.h index d0a827502..c930e376f 100644 --- a/defs.h +++ b/defs.h @@ -94,6 +94,9 @@ #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 +#define ZOOM_WIDTH 384 +#define ZOOM_HEIGHT 224 + // If defined, use 32-bit colors instead of 8-bit [Default -> Undefined] //#define RGBMODE @@ -115,7 +118,16 @@ #define BUFFER_HEIGHT (BORDER_TOP + SCREEN_HEIGHT + BORDER_BOTTOM) #define TILE_SIZE 32 -#define VIEWPORT_HEIGHT 352 +#define PANEL_WIDTH 640 +#define PANEL_HEIGHT 128 +#define PANEL_TOP (SCREEN_HEIGHT - PANEL_HEIGHT) +#define PANEL_Y (PANEL_TOP + SCREEN_Y) + +#if SCREEN_WIDTH == PANEL_WIDTH +#define VIEWPORT_HEIGHT (SCREEN_HEIGHT - PANEL_HEIGHT) +#else +#define VIEWPORT_HEIGHT SCREEN_HEIGHT +#endif #define SCREENXY(x, y) ((x) + SCREEN_X + ((y) + SCREEN_Y) * BUFFER_WIDTH)