From e07b6fdce73884de93dbefd7056b3a04d2f4898c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 7 Jun 2020 21:44:43 +0300 Subject: Message box, letterbox and ped attaching --- src/core/Camera.cpp | 30 ++++++++++++++---------------- src/core/Frontend.cpp | 16 +++++++++++++--- src/core/World.cpp | 4 ++++ src/core/main.cpp | 11 +++-------- 4 files changed, 34 insertions(+), 27 deletions(-) (limited to 'src/core') diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index d9cc5c32..9ebec1a6 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -2198,26 +2198,24 @@ CCamera::ProcessWideScreenOn(void) void CCamera::DrawBordersForWideScreen(void) { + float bottomBorderTopY, topBorderBottomY; + if (m_WideScreenOn) { + float centerY = (SCREEN_HEIGHT / 2) * (m_ScreenReductionPercentage / 100.f); + topBorderBottomY = centerY - SCREEN_SCALE_Y(22.f); + bottomBorderTopY = SCREEN_HEIGHT - centerY - SCREEN_SCALE_Y(14.f); + } else { + topBorderBottomY = 0.f; + bottomBorderTopY = SCREEN_HEIGHT; + } + if(m_BlurType == MBLUR_NONE || m_BlurType == MBLUR_NORMAL) SetMotionBlurAlpha(80); - CSprite2d::DrawRect( -#ifdef FIX_BUGS - CRect(0.0f, (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - SCREEN_SCALE_Y(8.0f), -#else - CRect(0.0f, (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f, -#endif - SCREEN_WIDTH, 0.0f), - CRGBA(0, 0, 0, 255)); + // top border + CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, topBorderBottomY), CRGBA(0, 0, 0, 255)); - CSprite2d::DrawRect( - CRect(0.0f, SCREEN_HEIGHT, -#ifdef FIX_BUGS - SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - SCREEN_SCALE_Y(8.0f)), -#else - SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f), -#endif - CRGBA(0, 0, 0, 255)); + // bottom border + CSprite2d::DrawRect(CRect(0.0f, bottomBorderTopY, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255)); } diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index c4af9ce6..d6411c77 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3272,7 +3272,7 @@ CMenuManager::MessageScreen(const char *text, bool blackBg) DoRWStuffEndOfFrame(); } -// TODO(Miami) +// --MIAMI: Done void CMenuManager::SmallMessageScreen(const char* text) { @@ -3284,9 +3284,19 @@ CMenuManager::SmallMessageScreen(const char* text) CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetCentreSize(SCREEN_SCALE_X(430.0f)); CFont::SetCentreOn(); - CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255))); + CFont::SetColor(CRGBA(LABEL_COLOR.r, LABEL_COLOR.g, LABEL_COLOR.b, FadeIn(255))); + CFont::SetDropShadowPosition(2); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE)); - CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(170.0f), TheText.Get(text)); + + int numOfLines = CFont::GetNumberLines(SCREEN_WIDTH / 2.f, SCREEN_SCALE_Y(135.f), TheText.Get(text)); + float y; + if (numOfLines > 1) + y = SCREEN_SCALE_Y(192.f) - numOfLines * SCREEN_SCALE_Y(8.f); + else + y = SCREEN_SCALE_Y(182.f); + + CFont::PrintString(SCREEN_WIDTH / 2.f, y, TheText.Get(text)); } void diff --git a/src/core/World.cpp b/src/core/World.cpp index 53d36854..ecf17575 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -2064,6 +2064,10 @@ CWorld::Process(void) movingPed->bInVehicle = false; movingPed->QuitEnteringCar(); } + } else if (movingPed->m_attachedTo) { + movingPed->PositionAttachedPed(); + movingPed->GetMatrix().UpdateRW(); + movingPed->UpdateRwFrame(); } } } diff --git a/src/core/main.cpp b/src/core/main.cpp index 6ffaabf6..2ea15589 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -234,18 +234,13 @@ DoFade(void) fadeColor.a = alpha; } + // This is CCamera::GetScreenRect in VC if(TheCamera.m_WideScreenOn){ - // what's this? float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f; rect.left = 0.0f; rect.right = SCREEN_WIDTH; -#ifdef FIX_BUGS - rect.top = y - SCREEN_SCALE_Y(8.0f); - rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(8.0f); -#else - rect.top = y - 8.0f; - rect.bottom = SCREEN_HEIGHT - y - 8.0f; -#endif // FIX_BUGS + rect.top = y - SCREEN_SCALE_Y(22.0f); + rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(14.0f); }else{ rect.left = 0.0f; rect.right = SCREEN_WIDTH; -- cgit v1.2.3