mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-08 23:19:40 +00:00
(svn r16026) -Codechange: Use font height for chat line spacing instead of fixed value.
This commit is contained in:
parent
f16aa9f509
commit
be7215497c
@ -27,7 +27,7 @@
|
|||||||
assert_compile((int)DRAW_STRING_BUFFER >= (int)NETWORK_CHAT_LENGTH + NETWORK_NAME_LENGTH + 40);
|
assert_compile((int)DRAW_STRING_BUFFER >= (int)NETWORK_CHAT_LENGTH + NETWORK_NAME_LENGTH + 40);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NETWORK_CHAT_LINE_HEIGHT = 13,
|
NETWORK_CHAT_LINE_SPACING = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChatMessage {
|
struct ChatMessage {
|
||||||
@ -113,7 +113,7 @@ void NetworkInitChatMessage()
|
|||||||
_chatmsg_box.x = 10;
|
_chatmsg_box.x = 10;
|
||||||
_chatmsg_box.y = 30;
|
_chatmsg_box.y = 30;
|
||||||
_chatmsg_box.width = _settings_client.gui.network_chat_box_width;
|
_chatmsg_box.width = _settings_client.gui.network_chat_box_width;
|
||||||
_chatmsg_box.height = _settings_client.gui.network_chat_box_height * NETWORK_CHAT_LINE_HEIGHT + 2;
|
_chatmsg_box.height = _settings_client.gui.network_chat_box_height * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 2;
|
||||||
_chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel());
|
_chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel());
|
||||||
|
|
||||||
for (uint i = 0; i < MAX_CHAT_MESSAGES; i++) {
|
for (uint i = 0; i < MAX_CHAT_MESSAGES; i++) {
|
||||||
@ -229,14 +229,14 @@ void NetworkDrawChatMessage()
|
|||||||
/* Paint a half-transparent box behind the chat messages */
|
/* Paint a half-transparent box behind the chat messages */
|
||||||
GfxFillRect(
|
GfxFillRect(
|
||||||
_chatmsg_box.x,
|
_chatmsg_box.x,
|
||||||
_screen.height - _chatmsg_box.y - count * NETWORK_CHAT_LINE_HEIGHT - 2,
|
_screen.height - _chatmsg_box.y - count * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) - 2,
|
||||||
_chatmsg_box.x + _chatmsg_box.width - 1,
|
_chatmsg_box.x + _chatmsg_box.width - 1,
|
||||||
_screen.height - _chatmsg_box.y - 2,
|
_screen.height - _chatmsg_box.y - 2,
|
||||||
PALETTE_TO_TRANSPARENT, FILLRECT_RECOLOUR // black, but with some alpha for background
|
PALETTE_TO_TRANSPARENT, FILLRECT_RECOLOUR // black, but with some alpha for background
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Paint the chat messages starting with the lowest at the bottom */
|
/* Paint the chat messages starting with the lowest at the bottom */
|
||||||
for (uint y = NETWORK_CHAT_LINE_HEIGHT; count-- != 0; y += NETWORK_CHAT_LINE_HEIGHT) {
|
for (uint y = FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING; count-- != 0; y += (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING)) {
|
||||||
DrawString(_chatmsg_box.x + 3, _chatmsg_box.x + _chatmsg_box.width - 1, _screen.height - _chatmsg_box.y - y + 1, _chatmsg_list[count].message, _chatmsg_list[count].colour);
|
DrawString(_chatmsg_box.x + 3, _chatmsg_box.x + _chatmsg_box.width - 1, _screen.height - _chatmsg_box.y - y + 1, _chatmsg_list[count].message, _chatmsg_list[count].colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user