add support for IFACE_BAR_WIDTH

This commit is contained in:
sonil 2022-10-24 14:50:24 +08:00
parent 21aec548af
commit cd936b86f0
4 changed files with 162 additions and 76 deletions

View File

@ -30,7 +30,7 @@ namespace fallout {
#define DISPLAY_MONITOR_X (23) #define DISPLAY_MONITOR_X (23)
#define DISPLAY_MONITOR_Y (24) #define DISPLAY_MONITOR_Y (24)
#define DISPLAY_MONITOR_WIDTH (167) #define DISPLAY_MONITOR_WIDTH (gInterfaceCustomBar == true ? 167 + ifaceOffset : 167)
#define DISPLAY_MONITOR_HEIGHT (60) #define DISPLAY_MONITOR_HEIGHT (60)
#define DISPLAY_MONITOR_HALF_HEIGHT (DISPLAY_MONITOR_HEIGHT / 2) #define DISPLAY_MONITOR_HALF_HEIGHT (DISPLAY_MONITOR_HEIGHT / 2)
@ -120,6 +120,15 @@ int displayMonitorInit()
return -1; return -1;
} }
if (gInterfaceCustomBar) {
_intface_full_width = gInterfaceBarWidth;
blitBufferToBuffer(GetCustomIfaceBarImageData() + gInterfaceBarWidth * DISPLAY_MONITOR_Y + DISPLAY_MONITOR_X,
DISPLAY_MONITOR_WIDTH,
DISPLAY_MONITOR_HEIGHT,
gInterfaceBarWidth,
gDisplayMonitorBackgroundFrmData,
DISPLAY_MONITOR_WIDTH);
} else {
CacheEntry* backgroundFrmHandle; CacheEntry* backgroundFrmHandle;
int backgroundFid = buildFid(OBJ_TYPE_INTERFACE, 16, 0, 0, 0); int backgroundFid = buildFid(OBJ_TYPE_INTERFACE, 16, 0, 0, 0);
Art* backgroundFrm = artLock(backgroundFid, &backgroundFrmHandle); Art* backgroundFrm = artLock(backgroundFid, &backgroundFrmHandle);
@ -130,6 +139,7 @@ int displayMonitorInit()
unsigned char* backgroundFrmData = artGetFrameData(backgroundFrm, 0, 0); unsigned char* backgroundFrmData = artGetFrameData(backgroundFrm, 0, 0);
_intface_full_width = artGetWidth(backgroundFrm, 0, 0); _intface_full_width = artGetWidth(backgroundFrm, 0, 0);
blitBufferToBuffer(backgroundFrmData + _intface_full_width * DISPLAY_MONITOR_Y + DISPLAY_MONITOR_X, blitBufferToBuffer(backgroundFrmData + _intface_full_width * DISPLAY_MONITOR_Y + DISPLAY_MONITOR_X,
DISPLAY_MONITOR_WIDTH, DISPLAY_MONITOR_WIDTH,
DISPLAY_MONITOR_HEIGHT, DISPLAY_MONITOR_HEIGHT,
@ -138,6 +148,7 @@ int displayMonitorInit()
DISPLAY_MONITOR_WIDTH); DISPLAY_MONITOR_WIDTH);
artUnlock(backgroundFrmHandle); artUnlock(backgroundFrmHandle);
}
gDisplayMonitorScrollUpButton = buttonCreate(gInterfaceBarWindow, gDisplayMonitorScrollUpButton = buttonCreate(gInterfaceBarWindow,
DISPLAY_MONITOR_X, DISPLAY_MONITOR_X,

View File

@ -161,7 +161,7 @@ static int gSingleAttackButton = -1;
static int gInterfaceCurrentHand = HAND_LEFT; static int gInterfaceCurrentHand = HAND_LEFT;
// 0x518F7C // 0x518F7C
static const Rect gInterfaceBarMainActionRect = { 267, 26, 455, 93 }; static const Rect gInterfaceBarMainActionRect = { 267 + 160, 26, 455 + 160, 93 };
// 0x518F8C // 0x518F8C
static int gChangeHandsButton = -1; static int gChangeHandsButton = -1;
@ -172,7 +172,7 @@ static bool gInterfaceBarEndButtonsIsVisible = false;
// Combat mode curtains rect. // Combat mode curtains rect.
// //
// 0x518FA0 // 0x518FA0
static const Rect gInterfaceBarEndButtonsRect = { 580, 38, 637, 96 }; static const Rect gInterfaceBarEndButtonsRect = { 580 + 160, 38, 637 + 160, 96 };
// 0x518FB0 // 0x518FB0
static int gEndTurnButton = -1; static int gEndTurnButton = -1;
@ -181,7 +181,7 @@ static int gEndTurnButton = -1;
static int gEndCombatButton = -1; static int gEndCombatButton = -1;
// 0x518FD4 // 0x518FD4
static const Rect gInterfaceBarActionPointsBarRect = { 316, 14, 406, 19 }; static const Rect gInterfaceBarActionPointsBarRect = { 316 + 160, 14, 406 + 160, 19 };
// 0x518FE8 // 0x518FE8
static IndicatorDescription gIndicatorDescriptions[INDICATOR_COUNT] = { static IndicatorDescription gIndicatorDescriptions[INDICATOR_COUNT] = {
@ -280,6 +280,70 @@ static FrmImage _greenLightFrmImage;
static FrmImage _yellowLightFrmImage; static FrmImage _yellowLightFrmImage;
static FrmImage _redLightFrmImage; static FrmImage _redLightFrmImage;
unsigned char* artLockFrameDataReturningSize2(int fid, int* widthPtr, int* heightPtr)
{
Art* art;
if (art == NULL) {
return NULL;
}
// NOTE: Uninline.
*widthPtr = artGetWidth(art, 0, 0);
if (*widthPtr == -1) {
return NULL;
}
// NOTE: Uninline.
*heightPtr = artGetHeight(art, 0, 0);
if (*heightPtr == -1) {
return NULL;
}
// NOTE: Uninline.
return artGetFrameData(art, 0, 0);
}
int ifaceOffset = 0;
unsigned char* CustomInterfaceData;
int gInterfaceBarWidth = -1;
bool gInterfaceCustomBar = false;
unsigned char* GetCustomIfaceBarImageData()
{
if (!gInterfaceCustomBar) {
return NULL;
}
return artGetFrameData((Art*)CustomInterfaceData, 0, 0);
}
int CustomInterfaceBarInit()
{
ifaceOffset = gInterfaceBarWidth - 640;
char path[128];
int size;
sprintf(path, "art\\intrface\\HR_IFACE_%d.FRM", gInterfaceBarWidth);
if (dbGetFileSize(path, &size) != 0 || ifaceOffset <= 0) {
ifaceOffset = 0;
gInterfaceBarWidth = 640;
gInterfaceCustomBar = false;
} else {
gInterfaceCustomBar = true;
CustomInterfaceData = (unsigned char *)malloc(size);
if (artRead(path, CustomInterfaceData) != 0) {
gInterfaceCustomBar = false;
free(CustomInterfaceData);
}
}
return 0;
}
// intface_init // intface_init
// 0x45D880 // 0x45D880
int interfaceInit() int interfaceInit()
@ -290,12 +354,14 @@ int interfaceInit()
return -1; return -1;
} }
CustomInterfaceBarInit();
gInterfaceBarInitialized = 1; gInterfaceBarInitialized = 1;
int interfaceBarWindowX = (screenGetWidth() - INTERFACE_BAR_WIDTH) / 2; int interfaceBarWindowX = (screenGetWidth() - gInterfaceBarWidth) / 2;
int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT; int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT;
gInterfaceBarWindow = windowCreate(interfaceBarWindowX, interfaceBarWindowY, INTERFACE_BAR_WIDTH, INTERFACE_BAR_HEIGHT, _colorTable[0], WINDOW_HIDDEN); gInterfaceBarWindow = windowCreate(interfaceBarWindowX, interfaceBarWindowY, gInterfaceBarWidth, INTERFACE_BAR_HEIGHT, _colorTable[0], WINDOW_HIDDEN);
if (gInterfaceBarWindow == -1) { if (gInterfaceBarWindow == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -307,15 +373,18 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
if (gInterfaceCustomBar) {
blitBufferToBuffer(GetCustomIfaceBarImageData(), gInterfaceBarWidth, INTERFACE_BAR_HEIGHT - 1, gInterfaceBarWidth, gInterfaceWindowBuffer, gInterfaceBarWidth);
} else {
FrmImage backgroundFrmImage; FrmImage backgroundFrmImage;
fid = buildFid(OBJ_TYPE_INTERFACE, 16, 0, 0, 0); fid = buildFid(OBJ_TYPE_INTERFACE, 16, 0, 0, 0);
if (!backgroundFrmImage.lock(fid)) { if (!backgroundFrmImage.lock(fid)) {
// NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
blitBufferToBuffer(backgroundFrmImage.getData(), INTERFACE_BAR_WIDTH, INTERFACE_BAR_HEIGHT - 1, INTERFACE_BAR_WIDTH, gInterfaceWindowBuffer, 640); blitBufferToBuffer(backgroundFrmImage.getData(), gInterfaceBarWidth, INTERFACE_BAR_HEIGHT - 1, gInterfaceBarWidth, gInterfaceWindowBuffer, gInterfaceBarWidth);
backgroundFrmImage.unlock(); backgroundFrmImage.unlock();
}
fid = buildFid(OBJ_TYPE_INTERFACE, 47, 0, 0, 0); fid = buildFid(OBJ_TYPE_INTERFACE, 47, 0, 0, 0);
if (!_inventoryButtonNormalFrmImage.lock(fid)) { if (!_inventoryButtonNormalFrmImage.lock(fid)) {
@ -329,7 +398,7 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
gInventoryButton = buttonCreate(gInterfaceBarWindow, 211, 40, 32, 21, -1, -1, -1, KEY_LOWERCASE_I, _inventoryButtonNormalFrmImage.getData(), _inventoryButtonPressedFrmImage.getData(), NULL, 0); gInventoryButton = buttonCreate(gInterfaceBarWindow, 211 + ifaceOffset, 40, 32, 21, -1, -1, -1, KEY_LOWERCASE_I, _inventoryButtonNormalFrmImage.getData(), _inventoryButtonPressedFrmImage.getData(), NULL, 0);
if (gInventoryButton == -1) { if (gInventoryButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -349,7 +418,7 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
gOptionsButton = buttonCreate(gInterfaceBarWindow, 210, 61, 34, 34, -1, -1, -1, KEY_LOWERCASE_O, _optionsButtonNormalFrmImage.getData(), _optionsButtonPressedFrmImage.getData(), NULL, 0); gOptionsButton = buttonCreate(gInterfaceBarWindow, 210 + ifaceOffset, 61, 34, 34, -1, -1, -1, KEY_LOWERCASE_O, _optionsButtonNormalFrmImage.getData(), _optionsButtonPressedFrmImage.getData(), NULL, 0);
if (gOptionsButton == -1) { if (gOptionsButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -375,7 +444,7 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
gSkilldexButton = buttonCreate(gInterfaceBarWindow, 523, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_S, _skilldexButtonNormalFrmImage.getData(), _skilldexButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT); gSkilldexButton = buttonCreate(gInterfaceBarWindow, 523 + ifaceOffset, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_S, _skilldexButtonNormalFrmImage.getData(), _skilldexButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
if (gSkilldexButton == -1) { if (gSkilldexButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -402,7 +471,7 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
gMapButton = buttonCreate(gInterfaceBarWindow, 526, 39, 41, 19, -1, -1, -1, KEY_TAB, _mapButtonNormalFrmImage.getData(), _mapButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT); gMapButton = buttonCreate(gInterfaceBarWindow, 526 + ifaceOffset, 39, 41, 19, -1, -1, -1, KEY_TAB, _mapButtonNormalFrmImage.getData(), _mapButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
if (gMapButton == -1) { if (gMapButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -423,7 +492,7 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
gPipboyButton = buttonCreate(gInterfaceBarWindow, 526, 77, 41, 19, -1, -1, -1, KEY_LOWERCASE_P, _pipboyButtonNormalFrmImage.getData(), _pipboyButtonPressedFrmImage.getData(), NULL, 0); gPipboyButton = buttonCreate(gInterfaceBarWindow, 526 + ifaceOffset, 77, 41, 19, -1, -1, -1, KEY_LOWERCASE_P, _pipboyButtonNormalFrmImage.getData(), _pipboyButtonPressedFrmImage.getData(), NULL, 0);
if (gPipboyButton == -1) { if (gPipboyButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -444,7 +513,7 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
gCharacterButton = buttonCreate(gInterfaceBarWindow, 526, 58, 41, 19, -1, -1, -1, KEY_LOWERCASE_C, _characterButtonNormalFrmImage.getData(), _characterButtonPressedFrmImage.getData(), NULL, 0); gCharacterButton = buttonCreate(gInterfaceBarWindow, 526 + ifaceOffset, 58, 41, 19, -1, -1, -1, KEY_LOWERCASE_C, _characterButtonNormalFrmImage.getData(), _characterButtonPressedFrmImage.getData(), NULL, 0);
if (gCharacterButton == -1) { if (gCharacterButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -474,7 +543,7 @@ int interfaceInit()
memcpy(_itemButtonUp, _itemButtonNormalFrmImage.getData(), sizeof(_itemButtonUp)); memcpy(_itemButtonUp, _itemButtonNormalFrmImage.getData(), sizeof(_itemButtonUp));
memcpy(_itemButtonDown, _itemButtonPressedFrmImage.getData(), sizeof(_itemButtonDown)); memcpy(_itemButtonDown, _itemButtonPressedFrmImage.getData(), sizeof(_itemButtonDown));
gSingleAttackButton = buttonCreate(gInterfaceBarWindow, 267, 26, 188, 67, -1, -1, -1, -20, _itemButtonUp, _itemButtonDown, NULL, BUTTON_FLAG_TRANSPARENT); gSingleAttackButton = buttonCreate(gInterfaceBarWindow, 267 + ifaceOffset, 26, 188, 67, -1, -1, -1, -20, _itemButtonUp, _itemButtonDown, NULL, BUTTON_FLAG_TRANSPARENT);
if (gSingleAttackButton == -1) { if (gSingleAttackButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -502,7 +571,7 @@ int interfaceInit()
} }
// Swap hands button // Swap hands button
gChangeHandsButton = buttonCreate(gInterfaceBarWindow, 218, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_B, _changeHandsButtonNormalFrmImage.getData(), _changeHandsButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT); gChangeHandsButton = buttonCreate(gInterfaceBarWindow, 218 + ifaceOffset, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_B, _changeHandsButtonNormalFrmImage.getData(), _changeHandsButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
if (gChangeHandsButton == -1) { if (gChangeHandsButton == -1) {
// NOTE: Uninline. // NOTE: Uninline.
return intface_fatal_error(-1); return intface_fatal_error(-1);
@ -535,7 +604,7 @@ int interfaceInit()
return intface_fatal_error(-1); return intface_fatal_error(-1);
} }
blitBufferToBuffer(gInterfaceWindowBuffer + 640 * 14 + 316, 90, 5, 640, gInterfaceActionPointsBarBackground, 90); blitBufferToBuffer(gInterfaceWindowBuffer + gInterfaceBarWidth * 14 + 316 + ifaceOffset, 90, 5, gInterfaceBarWidth, gInterfaceActionPointsBarBackground, 90);
if (indicatorBarInit() == -1) { if (indicatorBarInit() == -1) {
// NOTE: Uninline. // NOTE: Uninline.
@ -890,10 +959,10 @@ void interfaceRenderHitPoints(bool animate)
if (animate) { if (animate) {
int delay = 250 / (abs(gInterfaceLastRenderedHitPoints - hp) + 1); int delay = 250 / (abs(gInterfaceLastRenderedHitPoints - hp) + 1);
for (int index = 0; index < count; index++) { for (int index = 0; index < count; index++) {
interfaceRenderCounter(473, 40, v1[index], v1[index + 1], v2[index], delay); interfaceRenderCounter(473 + ifaceOffset, 40, v1[index], v1[index + 1], v2[index], delay);
} }
} else { } else {
interfaceRenderCounter(473, 40, gInterfaceLastRenderedHitPoints, hp, color, 0); interfaceRenderCounter(473 + ifaceOffset, 40, gInterfaceLastRenderedHitPoints, hp, color, 0);
} }
gInterfaceLastRenderedHitPoints = hp; gInterfaceLastRenderedHitPoints = hp;
@ -912,7 +981,7 @@ void interfaceRenderArmorClass(bool animate)
delay = 250 / (abs(gInterfaceLastRenderedArmorClass - armorClass) + 1); delay = 250 / (abs(gInterfaceLastRenderedArmorClass - armorClass) + 1);
} }
interfaceRenderCounter(473, 75, gInterfaceLastRenderedArmorClass, armorClass, 0, delay); interfaceRenderCounter(473 + ifaceOffset, 75, gInterfaceLastRenderedArmorClass, armorClass, 0, delay);
gInterfaceLastRenderedArmorClass = armorClass; gInterfaceLastRenderedArmorClass = armorClass;
} }
@ -926,7 +995,7 @@ void interfaceRenderActionPoints(int actionPointsLeft, int bonusActionPoints)
return; return;
} }
blitBufferToBuffer(gInterfaceActionPointsBarBackground, 90, 5, 90, gInterfaceWindowBuffer + 14 * 640 + 316, 640); blitBufferToBuffer(gInterfaceActionPointsBarBackground, 90, 5, 90, gInterfaceWindowBuffer + 14 * gInterfaceBarWidth + ifaceOffset + 316, gInterfaceBarWidth);
if (actionPointsLeft == -1) { if (actionPointsLeft == -1) {
frmData = _redLightFrmImage.getData(); frmData = _redLightFrmImage.getData();
@ -954,11 +1023,11 @@ void interfaceRenderActionPoints(int actionPointsLeft, int bonusActionPoints)
int index; int index;
for (index = 0; index < actionPointsLeft; index++) { for (index = 0; index < actionPointsLeft; index++) {
blitBufferToBuffer(frmData, 5, 5, 5, gInterfaceWindowBuffer + 14 * 640 + 316 + index * 9, 640); blitBufferToBuffer(frmData, 5, 5, 5, gInterfaceWindowBuffer + 14 * gInterfaceBarWidth + 316 + index * 9 + ifaceOffset, gInterfaceBarWidth);
} }
for (; index < (actionPointsLeft + bonusActionPoints); index++) { for (; index < (actionPointsLeft + bonusActionPoints); index++) {
blitBufferToBuffer(_yellowLightFrmImage.getData(), 5, 5, 5, gInterfaceWindowBuffer + 14 * 640 + 316 + index * 9, 640); blitBufferToBuffer(_yellowLightFrmImage.getData(), 5, 5, 5, gInterfaceWindowBuffer + 14 * gInterfaceBarWidth + 316 + ifaceOffset + index * 9, gInterfaceBarWidth);
} }
if (!gInterfaceBarInitialized) { if (!gInterfaceBarInitialized) {
@ -1327,7 +1396,7 @@ int _intface_update_ammo_lights()
} }
} }
interfaceUpdateAmmoBar(463, ratio); interfaceUpdateAmmoBar(463 + ifaceOffset, ratio);
return 0; return 0;
} }
@ -1363,7 +1432,7 @@ void interfaceBarEndButtonsShow(bool animated)
if (getTicksSince(time) >= delay) { if (getTicksSince(time) >= delay) {
unsigned char* src = artGetFrameData(art, frame, 0); unsigned char* src = artGetFrameData(art, frame, 0);
if (src != NULL) { if (src != NULL) {
blitBufferToBuffer(src, 57, 58, 57, gInterfaceWindowBuffer + 640 * 38 + 580, 640); blitBufferToBuffer(src, 57, 58, 57, gInterfaceWindowBuffer + gInterfaceBarWidth * 38 + 580 + ifaceOffset, gInterfaceBarWidth);
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
} }
@ -1377,7 +1446,7 @@ void interfaceBarEndButtonsShow(bool animated)
} }
} else { } else {
unsigned char* src = artGetFrameData(art, frameCount - 1, 0); unsigned char* src = artGetFrameData(art, frameCount - 1, 0);
blitBufferToBuffer(src, 57, 58, 57, gInterfaceWindowBuffer + 640 * 38 + 580, 640); blitBufferToBuffer(src, 57, 58, 57, gInterfaceWindowBuffer + gInterfaceBarWidth * 38 + 580 + ifaceOffset, gInterfaceBarWidth);
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
} }
@ -1421,9 +1490,9 @@ void interfaceBarEndButtonsHide(bool animated)
if (getTicksSince(time) >= delay) { if (getTicksSince(time) >= delay) {
unsigned char* src = artGetFrameData(art, frame - 1, 0); unsigned char* src = artGetFrameData(art, frame - 1, 0);
unsigned char* dest = gInterfaceWindowBuffer + 640 * 38 + 580; unsigned char* dest = gInterfaceWindowBuffer + gInterfaceBarWidth * 38 + 580 + ifaceOffset;
if (src != NULL) { if (src != NULL) {
blitBufferToBuffer(src, 57, 58, 57, dest, 640); blitBufferToBuffer(src, 57, 58, 57, dest, gInterfaceBarWidth);
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
} }
@ -1436,9 +1505,9 @@ void interfaceBarEndButtonsHide(bool animated)
sharedFpsLimiter.throttle(); sharedFpsLimiter.throttle();
} }
} else { } else {
unsigned char* dest = gInterfaceWindowBuffer + 640 * 38 + 580; unsigned char* dest = gInterfaceWindowBuffer + gInterfaceBarWidth * 38 + 580 + ifaceOffset;
unsigned char* src = artGetFrameData(art, 0, 0); unsigned char* src = artGetFrameData(art, 0, 0);
blitBufferToBuffer(src, 57, 58, 57, dest, 640); blitBufferToBuffer(src, 57, 58, 57, dest, gInterfaceBarWidth);
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
} }
@ -1461,7 +1530,7 @@ void interfaceBarEndButtonsRenderGreenLights()
} }
soundPlayFile("icombat2"); soundPlayFile("icombat2");
blitBufferToBufferTrans(lightsFrmImage.getData(), 57, 58, 57, gInterfaceWindowBuffer + 38 * 640 + 580, 640); blitBufferToBufferTrans(lightsFrmImage.getData(), 57, 58, 57, gInterfaceWindowBuffer + 38 * gInterfaceBarWidth + 580 + ifaceOffset, gInterfaceBarWidth);
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
} }
} }
@ -1481,7 +1550,7 @@ void interfaceBarEndButtonsRenderRedLights()
} }
soundPlayFile("icombat1"); soundPlayFile("icombat1");
blitBufferToBufferTrans(lightsFrmImage.getData(), 57, 58, 57, gInterfaceWindowBuffer + 38 * 640 + 580, 640); blitBufferToBufferTrans(lightsFrmImage.getData(), 57, 58, 57, gInterfaceWindowBuffer + 38 * gInterfaceBarWidth + 580 + ifaceOffset, gInterfaceBarWidth);
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
} }
} }
@ -1857,7 +1926,7 @@ static int endTurnButtonInit()
return -1; return -1;
} }
gEndTurnButton = buttonCreate(gInterfaceBarWindow, 590, 43, 38, 22, -1, -1, -1, 32, _endTurnButtonNormalFrmImage.getData(), _endTurnButtonPressedFrmImage.getData(), NULL, 0); gEndTurnButton = buttonCreate(gInterfaceBarWindow, 590 + ifaceOffset, 43, 38, 22, -1, -1, -1, 32, _endTurnButtonNormalFrmImage.getData(), _endTurnButtonPressedFrmImage.getData(), NULL, 0);
if (gEndTurnButton == -1) { if (gEndTurnButton == -1) {
return -1; return -1;
} }
@ -1909,7 +1978,7 @@ static int endCombatButtonInit()
return -1; return -1;
} }
gEndCombatButton = buttonCreate(gInterfaceBarWindow, 590, 65, 38, 22, -1, -1, -1, 13, _endCombatButtonNormalFrmImage.getData(), _endCombatButtonPressedFrmImage.getData(), NULL, 0); gEndCombatButton = buttonCreate(gInterfaceBarWindow, 590 + ifaceOffset, 65, 38, 22, -1, -1, -1, 13, _endCombatButtonNormalFrmImage.getData(), _endCombatButtonPressedFrmImage.getData(), NULL, 0);
if (gEndCombatButton == -1) { if (gEndCombatButton == -1) {
return -1; return -1;
} }
@ -1945,19 +2014,19 @@ static void interfaceUpdateAmmoBar(int x, int ratio)
ratio -= 1; ratio -= 1;
} }
unsigned char* dest = gInterfaceWindowBuffer + 640 * 26 + x; unsigned char* dest = gInterfaceWindowBuffer + gInterfaceBarWidth * 26 + x;
for (int index = 70; index > ratio; index--) { for (int index = 70; index > ratio; index--) {
*dest = 14; *dest = 14;
dest += 640; dest += gInterfaceBarWidth;
} }
while (ratio > 0) { while (ratio > 0) {
*dest = 196; *dest = 196;
dest += 640; dest += gInterfaceBarWidth;
*dest = 14; *dest = 14;
dest += 640; dest += gInterfaceBarWidth;
ratio -= 2; ratio -= 2;
} }
@ -2013,7 +2082,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
} }
unsigned char* numbers = _numbersFrmImage.getData() + offset; unsigned char* numbers = _numbersFrmImage.getData() + offset;
unsigned char* dest = gInterfaceWindowBuffer + 640 * y; unsigned char* dest = gInterfaceWindowBuffer + gInterfaceBarWidth * y;
unsigned char* downSrc = numbers + 90; unsigned char* downSrc = numbers + 90;
unsigned char* upSrc = numbers + 99; unsigned char* upSrc = numbers + 99;
@ -2039,10 +2108,10 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
int tens = (normalizedValue / 10) % 10; int tens = (normalizedValue / 10) % 10;
int hundreds = normalizedValue / 100; int hundreds = normalizedValue / 100;
blitBufferToBuffer(numbers + 9 * hundreds, 9, 17, 360, hundredsDest, 640); blitBufferToBuffer(numbers + 9 * hundreds, 9, 17, 360, hundredsDest, gInterfaceBarWidth);
blitBufferToBuffer(numbers + 9 * tens, 9, 17, 360, tensDest, 640); blitBufferToBuffer(numbers + 9 * tens, 9, 17, 360, tensDest, gInterfaceBarWidth);
blitBufferToBuffer(numbers + 9 * ones, 9, 17, 360, onesDest, 640); blitBufferToBuffer(numbers + 9 * ones, 9, 17, 360, onesDest, gInterfaceBarWidth);
blitBufferToBuffer(normalizedSign >= 0 ? plusSrc : minusSrc, 6, 17, 360, signDest, 640); blitBufferToBuffer(normalizedSign >= 0 ? plusSrc : minusSrc, 6, 17, 360, signDest, gInterfaceBarWidth);
if (!gInterfaceBarInitialized) { if (!gInterfaceBarInitialized) {
Rect numbersRect = { x, y, x + 33, y + 17 }; Rect numbersRect = { x, y, x + 33, y + 17 };
@ -2056,7 +2125,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
v49 = 1; v49 = 1;
} }
blitBufferToBuffer(upSrc, 9, 17, 360, onesDest, 640); blitBufferToBuffer(upSrc, 9, 17, 360, onesDest, gInterfaceBarWidth);
_mouse_info(); _mouse_info();
gameMouseRefresh(); gameMouseRefresh();
renderPresent(); renderPresent();
@ -2066,7 +2135,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
ones += v49; ones += v49;
if (ones > 9 || ones < 0) { if (ones > 9 || ones < 0) {
blitBufferToBuffer(upSrc, 9, 17, 360, tensDest, 640); blitBufferToBuffer(upSrc, 9, 17, 360, tensDest, gInterfaceBarWidth);
_mouse_info(); _mouse_info();
gameMouseRefresh(); gameMouseRefresh();
renderPresent(); renderPresent();
@ -2076,7 +2145,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
tens += v49; tens += v49;
ones -= 10 * v49; ones -= 10 * v49;
if (tens == 10 || tens == -1) { if (tens == 10 || tens == -1) {
blitBufferToBuffer(upSrc, 9, 17, 360, hundredsDest, 640); blitBufferToBuffer(upSrc, 9, 17, 360, hundredsDest, gInterfaceBarWidth);
_mouse_info(); _mouse_info();
gameMouseRefresh(); gameMouseRefresh();
renderPresent(); renderPresent();
@ -2089,7 +2158,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
hundreds -= 10 * v49; hundreds -= 10 * v49;
} }
blitBufferToBuffer(downSrc, 9, 17, 360, hundredsDest, 640); blitBufferToBuffer(downSrc, 9, 17, 360, hundredsDest, gInterfaceBarWidth);
_mouse_info(); _mouse_info();
gameMouseRefresh(); gameMouseRefresh();
renderPresent(); renderPresent();
@ -2097,13 +2166,13 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
windowRefreshRect(gInterfaceBarWindow, &numbersRect); windowRefreshRect(gInterfaceBarWindow, &numbersRect);
} }
blitBufferToBuffer(downSrc, 9, 17, 360, tensDest, 640); blitBufferToBuffer(downSrc, 9, 17, 360, tensDest, gInterfaceBarWidth);
renderPresent(); renderPresent();
inputBlockForTocks(delay); inputBlockForTocks(delay);
windowRefreshRect(gInterfaceBarWindow, &numbersRect); windowRefreshRect(gInterfaceBarWindow, &numbersRect);
} }
blitBufferToBuffer(downSrc, 9, 17, 360, onesDest, 640); blitBufferToBuffer(downSrc, 9, 17, 360, onesDest, gInterfaceBarWidth);
_mouse_info(); _mouse_info();
gameMouseRefresh(); gameMouseRefresh();
renderPresent(); renderPresent();
@ -2112,11 +2181,11 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i
previousValue += change; previousValue += change;
blitBufferToBuffer(numbers + 9 * hundreds, 9, 17, 360, hundredsDest, 640); blitBufferToBuffer(numbers + 9 * hundreds, 9, 17, 360, hundredsDest, gInterfaceBarWidth);
blitBufferToBuffer(numbers + 9 * tens, 9, 17, 360, tensDest, 640); blitBufferToBuffer(numbers + 9 * tens, 9, 17, 360, tensDest, gInterfaceBarWidth);
blitBufferToBuffer(numbers + 9 * ones, 9, 17, 360, onesDest, 640); blitBufferToBuffer(numbers + 9 * ones, 9, 17, 360, onesDest, gInterfaceBarWidth);
blitBufferToBuffer(previousValue >= 0 ? plusSrc : minusSrc, 6, 17, 360, signDest, 640); blitBufferToBuffer(previousValue >= 0 ? plusSrc : minusSrc, 6, 17, 360, signDest, gInterfaceBarWidth);
_mouse_info(); _mouse_info();
gameMouseRefresh(); gameMouseRefresh();
renderPresent(); renderPresent();

View File

@ -33,6 +33,9 @@ typedef enum InterfaceItemAction {
extern int gInterfaceBarWindow; extern int gInterfaceBarWindow;
extern bool gInterfaceBarMode; extern bool gInterfaceBarMode;
extern int gInterfaceBarWidth;
extern bool gInterfaceCustomBar;
extern int ifaceOffset;
int interfaceInit(); int interfaceInit();
void interfaceReset(); void interfaceReset();
@ -65,6 +68,8 @@ int indicatorBarRefresh();
bool indicatorBarShow(); bool indicatorBarShow();
bool indicatorBarHide(); bool indicatorBarHide();
unsigned char* GetCustomIfaceBarImageData();
} // namespace fallout } // namespace fallout
#endif /* INTERFACE_H */ #endif /* INTERFACE_H */

View File

@ -186,6 +186,7 @@ int _GNW95_init_mode_ex(int width, int height, int bpp)
} }
configGetBool(&resolutionConfig, "IFACE", "IFACE_BAR_MODE", &gInterfaceBarMode); configGetBool(&resolutionConfig, "IFACE", "IFACE_BAR_MODE", &gInterfaceBarMode);
configGetInt(&resolutionConfig, "IFACE", "IFACE_BAR_WIDTH", &gInterfaceBarWidth);
} }
configFree(&resolutionConfig); configFree(&resolutionConfig);
} }