Fix credits window position (#4)

* Rename variables and match coding style
* Fix character selection position
* Fix credits position

See #3
This commit is contained in:
Jan Šimek 2022-05-21 04:00:30 -07:00 committed by GitHub
parent 44a72c6b2b
commit feaa8f639b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 12 deletions

View File

@ -243,7 +243,9 @@ bool characterSelectorWindowInit()
return false;
}
gCharacterSelectorWindow = windowCreate(0, 0, CS_WINDOW_WIDTH, CS_WINDOW_HEIGHT, _colorTable[0], 0);
int characterSelectorWindowX = (screenGetWidth() - CS_WINDOW_WIDTH) / 2;
int characterSelectorWindowY = (screenGetHeight() - CS_WINDOW_HEIGHT) / 2;
gCharacterSelectorWindow = windowCreate(characterSelectorWindowX, characterSelectorWindowY, CS_WINDOW_WIDTH, CS_WINDOW_HEIGHT, _colorTable[0], 0);
if (gCharacterSelectorWindow == -1) {
goto err;
}

View File

@ -66,7 +66,9 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
mouseShowCursor();
}
int window = windowCreate(0, 0, CREDITS_WINDOW_WIDTH, CREDITS_WINDOW_HEIGHT, _colorTable[0], 20);
int creditsWindowX = (screenGetWidth() - CREDITS_WINDOW_WIDTH) / 2;
int creditsWindowY = (screenGetHeight() - CREDITS_WINDOW_HEIGHT) / 2;
int window = windowCreate(creditsWindowX, creditsWindowY, CREDITS_WINDOW_WIDTH, CREDITS_WINDOW_HEIGHT, _colorTable[0], 20);
soundContinueAll();
if (window != -1) {
unsigned char* windowBuffer = windowGetBuffer(window);

View File

@ -32,6 +32,7 @@
#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.
@ -350,10 +351,10 @@ int interfaceInit()
gInterfaceBarInitialized = 1;
int xPos = (_scr_size.right - 640) / 2;
int yPos = _scr_size.bottom - 99;
int interfaceBarWindowX = (screenGetWidth() - INTERFACE_BAR_WIDTH) / 2;
int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT - 1;
gInterfaceBarWindow = windowCreate(xPos, yPos, 640, 100, _colorTable[0], WINDOW_HIDDEN);
gInterfaceBarWindow = windowCreate(interfaceBarWindowX, interfaceBarWindowY, INTERFACE_BAR_WIDTH, INTERFACE_BAR_HEIGHT, _colorTable[0], WINDOW_HIDDEN);
if (gInterfaceBarWindow == -1) {
goto err;
}
@ -369,7 +370,7 @@ int interfaceInit()
goto err;
}
blitBufferToBuffer(backgroundFrmData, 640, 99, 640, gInterfaceWindowBuffer, 640);
blitBufferToBuffer(backgroundFrmData, INTERFACE_BAR_WIDTH, INTERFACE_BAR_HEIGHT - 1, INTERFACE_BAR_WIDTH, gInterfaceWindowBuffer, 640);
artUnlock(backgroundFrmHandle);
fid = buildFid(6, 47, 0, 0, 0);

View File

@ -502,21 +502,21 @@ int tileSetCenter(int tile, int flags)
}
}
int v9 = gHexGridWidth - 1 - tile % gHexGridWidth;
int v10 = tile / gHexGridWidth;
int tile_x = gHexGridWidth - 1 - tile % gHexGridWidth;
int tile_y = tile / gHexGridWidth;
if (_borderInitialized) {
if (v9 <= _tile_border || v9 >= dword_66BBCC || v10 <= dword_66BBC8 || v10 >= dword_66BBD0) {
if (tile_x <= _tile_border || tile_x >= dword_66BBCC || tile_y <= dword_66BBC8 || tile_y >= dword_66BBD0) {
return -1;
}
}
_tile_y = v10;
_tile_y = tile_y;
_tile_offx = (gTileWindowWidth - 32) / 2;
_tile_x = v9;
_tile_x = tile_x;
_tile_offy = (gTileWindowHeight - 16) / 2;
if (v9 & 1) {
if (tile_x & 1) {
_tile_x -= 1;
_tile_offx -= 32;
}