diff --git a/src/combat.cc b/src/combat.cc index f161eb4c..5f5eaa96 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -5266,7 +5266,7 @@ int calledShotSelectHitLocation(Object* critter, int* hitLocation, int hitMode) int calledShotWindowX = (screenGetWidth() - CALLED_SHOT_WINDOW_WIDTH) / 2; // Center vertically for HRP, otherwise maintain original location (20). int calledShotWindowY = screenGetHeight() != 480 - ? (screenGetHeight() - 100 - 1 - CALLED_SHOT_WINDOW_HEIGHT) / 2 + ? (screenGetHeight() - INTERFACE_BAR_HEIGHT - 1 - CALLED_SHOT_WINDOW_HEIGHT) / 2 : CALLED_SHOT_WINDOW_Y; gCalledShotWindow = windowCreate(calledShotWindowX, calledShotWindowY, diff --git a/src/core.cc b/src/core.cc index d94efcc6..0ef12bd5 100644 --- a/src/core.cc +++ b/src/core.cc @@ -4,6 +4,7 @@ #include "color.h" #include "dinput.h" #include "draw.h" +#include "interface.h" #include "memory.h" #include "mmx.h" #include "text_font.h" @@ -2047,6 +2048,8 @@ int _GNW95_init_mode_ex(int width, int height, int bpp) if (configGetBool(&resolutionConfig, "MAIN", "WINDOWED", &windowed)) { fullscreen = !windowed; } + + configGetBool(&resolutionConfig, "IFACE", "IFACE_BAR_MODE", &gInterfaceBarMode); } configFree(&resolutionConfig); } @@ -4617,6 +4620,16 @@ int screenGetHeight() return rectGetHeight(&_scr_size); } +int screenGetVisibleHeight() +{ + int windowBottomMargin = 0; + + if (!gInterfaceBarMode) { + windowBottomMargin = INTERFACE_BAR_HEIGHT; + } + return screenGetHeight() - windowBottomMargin; +} + void mouseGetPositionInWindow(int win, int* x, int* y) { mouseGetPosition(x, y); diff --git a/src/core.h b/src/core.h index 4ffc913d..32ea7383 100644 --- a/src/core.h +++ b/src/core.h @@ -636,6 +636,7 @@ bool _vcr_load_record(STRUCT_51E2F0* ptr, File* stream); int screenGetWidth(); int screenGetHeight(); +int screenGetVisibleHeight(); void mouseGetPositionInWindow(int win, int* x, int* y); bool mouseHitTestInWindow(int win, int left, int top, int right, int bottom); diff --git a/src/elevator.cc b/src/elevator.cc index 4f7e3880..dd4589e8 100644 --- a/src/elevator.cc +++ b/src/elevator.cc @@ -6,6 +6,7 @@ #include "draw.h" #include "game_mouse.h" #include "game_sound.h" +#include "interface.h" #include "map.h" #include "pipboy.h" #include "scripts.h" @@ -535,7 +536,7 @@ int elevatorWindowInit(int elevator) } int elevatorWindowX = (screenGetWidth() - gElevatorBackgroundFrmWidth) / 2; - int elevatorWindowY = (screenGetHeight() - 100 - 1 - gElevatorBackgroundFrmHeight) / 2; + int elevatorWindowY = (screenGetHeight() - INTERFACE_BAR_HEIGHT - 1 - gElevatorBackgroundFrmHeight) / 2; gElevatorWindow = windowCreate( elevatorWindowX, elevatorWindowY, diff --git a/src/game_mouse.cc b/src/game_mouse.cc index f35eadee..0f3c3fba 100644 --- a/src/game_mouse.cc +++ b/src/game_mouse.cc @@ -852,7 +852,8 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState) } } - if (!_mouse_click_in(0, 0, _scr_size.right - _scr_size.left, _scr_size.bottom - _scr_size.top - 100)) { + // TODO: allow clicking to the left and right of the INTERFACE_BAR if gInterfaceBarMode is enabled + if (!_mouse_click_in(0, 0, _scr_size.right - _scr_size.left, _scr_size.bottom - _scr_size.top - INTERFACE_BAR_HEIGHT)) { return; } diff --git a/src/interface.cc b/src/interface.cc index 0f8271bb..13bc579b 100644 --- a/src/interface.cc +++ b/src/interface.cc @@ -29,12 +29,6 @@ #include -#define INDICATOR_BOX_WIDTH 130 -#define INDICATOR_BOX_HEIGHT 21 - -#define INTERFACE_BAR_WIDTH 640 -#define INTERFACE_BAR_HEIGHT 100 - // The width of connectors in the indicator box. // // There are male connectors on the left, and female connectors on the right. @@ -337,6 +331,9 @@ unsigned char* gInventoryButtonDownFrmData; // 0x59D40C unsigned char gInterfaceActionPointsBarBackground[90 * 5]; +// Should the game window stretch all the way to the bottom or sit at the top of the interface bar (default) +bool gInterfaceBarMode = false; + // intface_init // 0x45D880 int interfaceInit() @@ -352,7 +349,7 @@ int interfaceInit() gInterfaceBarInitialized = 1; int interfaceBarWindowX = (screenGetWidth() - INTERFACE_BAR_WIDTH) / 2; - int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT - 1; + int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT; gInterfaceBarWindow = windowCreate(interfaceBarWindowX, interfaceBarWindowY, INTERFACE_BAR_WIDTH, INTERFACE_BAR_HEIGHT, _colorTable[0], WINDOW_HIDDEN); if (gInterfaceBarWindow == -1) { diff --git a/src/interface.h b/src/interface.h index 828c4f05..b7f3141a 100644 --- a/src/interface.h +++ b/src/interface.h @@ -35,6 +35,12 @@ typedef enum InterfaceNumbersColor { INTERFACE_NUMBERS_COLOR_RED = 240, } InterfaceNumbersColor; +#define INDICATOR_BOX_WIDTH 130 +#define INDICATOR_BOX_HEIGHT 21 + +#define INTERFACE_BAR_WIDTH 640 +#define INTERFACE_BAR_HEIGHT 100 + // The maximum number of indicator boxes the indicator bar can display. // // For unknown reason this number is 6, even though there are only 5 different @@ -171,6 +177,7 @@ extern unsigned char* gOptionsButtonDownFrmData; extern unsigned char* gSkilldexButtonUpFrmData; extern unsigned char* gInventoryButtonDownFrmData; extern unsigned char gInterfaceActionPointsBarBackground[450]; +extern bool gInterfaceBarMode; int interfaceInit(); void interfaceReset(); diff --git a/src/map.cc b/src/map.cc index c829cadb..ba7c55d9 100644 --- a/src/map.cc +++ b/src/map.cc @@ -143,7 +143,7 @@ int isoInit() _square[elevation] = &(_square_data[elevation]); } - gIsoWindow = windowCreate(0, 0, _scr_size.right - _scr_size.left + 1, _scr_size.bottom - _scr_size.top - 99, 256, 10); + gIsoWindow = windowCreate(0, 0, screenGetWidth(), screenGetVisibleHeight(), 256, 10); if (gIsoWindow == -1) { debugPrint("win_add failed in iso_init\n"); return -1; @@ -167,14 +167,14 @@ int isoInit() debugPrint(">art_init\t\t"); - if (tileInit(_square, SQUARE_GRID_WIDTH, SQUARE_GRID_HEIGHT, HEX_GRID_WIDTH, HEX_GRID_HEIGHT, gIsoWindowBuffer, _scr_size.right - _scr_size.left + 1, _scr_size.bottom - _scr_size.top - 99, _scr_size.right - _scr_size.left + 1, isoWindowRefreshRect) != 0) { + if (tileInit(_square, SQUARE_GRID_WIDTH, SQUARE_GRID_HEIGHT, HEX_GRID_WIDTH, HEX_GRID_HEIGHT, gIsoWindowBuffer, screenGetWidth(), screenGetVisibleHeight(), screenGetWidth(), isoWindowRefreshRect) != 0) { debugPrint("tile_init failed in iso_init\n"); return -1; } debugPrint(">tile_init\t\t"); - if (objectsInit(gIsoWindowBuffer, _scr_size.right - _scr_size.left + 1, _scr_size.bottom - _scr_size.top - 99, _scr_size.right - _scr_size.left + 1) != 0) { + if (objectsInit(gIsoWindowBuffer, screenGetWidth(), screenGetVisibleHeight(), screenGetWidth()) != 0) { debugPrint("obj_init failed in iso_init\n"); return -1; } @@ -577,9 +577,9 @@ int mapScroll(int dx, int dy) Rect r2; rectCopy(&r2, &r1); - int width = _scr_size.right - _scr_size.left + 1; + int width = screenGetWidth(); int pitch = width; - int height = _scr_size.bottom - _scr_size.top - 99; + int height = screenGetVisibleHeight(); if (screenDx != 0) { width -= 32; @@ -601,7 +601,7 @@ int mapScroll(int dx, int dy) if (screenDy < 0) { r1.bottom = r1.top - screenDy; src = gIsoWindowBuffer + pitch * (height - 1); - dest = gIsoWindowBuffer + pitch * (_scr_size.bottom - _scr_size.top - 100); + dest = gIsoWindowBuffer + pitch * (screenGetVisibleHeight() - 1); if (screenDx < 0) { dest -= screenDx; } else { diff --git a/src/skilldex.cc b/src/skilldex.cc index 711e00b5..3c18c847 100644 --- a/src/skilldex.cc +++ b/src/skilldex.cc @@ -8,6 +8,7 @@ #include "game.h" #include "game_mouse.h" #include "game_sound.h" +#include "interface.h" #include "map.h" #include "memory.h" #include "object.h" @@ -187,7 +188,7 @@ int skilldexWindowInit() // Maintain original position relative to centered interface bar. int skilldexWindowX = (screenGetWidth() - 640) / 2 + 640 - gSkilldexFrmSizes[SKILLDEX_FRM_BACKGROUND].width - SKILLDEX_WINDOW_RIGHT_MARGIN; - int skilldexWindowY = screenGetHeight() - 100 - 1 - gSkilldexFrmSizes[SKILLDEX_FRM_BACKGROUND].height - SKILLDEX_WINDOW_BOTTOM_MARGIN; + int skilldexWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT - 1 - gSkilldexFrmSizes[SKILLDEX_FRM_BACKGROUND].height - SKILLDEX_WINDOW_BOTTOM_MARGIN; gSkilldexWindow = windowCreate(skilldexWindowX, skilldexWindowY, gSkilldexFrmSizes[SKILLDEX_FRM_BACKGROUND].width,