|
5 | 5 | #include "PresetMan.h"
|
6 | 6 | #include "SettingsMan.h"
|
7 | 7 | #include "LuaMan.h"
|
| 8 | +#include "GLResourceMan.h" |
8 | 9 |
|
9 | 10 | #include "AHuman.h"
|
10 | 11 | #include "ContentFile.h"
|
@@ -637,9 +638,13 @@ void PieMenu::Draw(BITMAP* targetBitmap, const Vector& targetPos) const {
|
637 | 638 | if (m_EnabledState != EnabledState::Disabled) {
|
638 | 639 | if (m_DrawBackgroundTransparent && !g_FrameMan.IsInMultiplayerMode()) {
|
639 | 640 | g_FrameMan.SetTransTableFromPreset(TransparencyPreset::MoreTrans);
|
640 |
| - draw_trans_sprite(targetBitmap, m_BGBitmap, drawPos.GetFloorIntX() - m_BGBitmap->w / 2, drawPos.GetFloorIntY() - m_BGBitmap->h / 2); |
| 641 | + //draw_trans_sprite(targetBitmap, m_BGBitmap, drawPos.GetFloorIntX() - m_BGBitmap->w / 2, drawPos.GetFloorIntY() - m_BGBitmap->h / 2); |
| 642 | + g_GLResourceMan.UpdateDynamicBitmap(m_BGBitmap, true); |
| 643 | + DrawTexture(g_GLResourceMan.GetStaticTextureFromBitmap(m_BGBitmap), drawPos.GetFloorIntX() - m_BGBitmap->w / 2, drawPos.GetFloorIntY() - m_BGBitmap->h / 2, {255, 255, 255, g_FrameMan.GetCurrentAlpha()}); |
641 | 644 | } else {
|
642 |
| - draw_sprite(targetBitmap, m_BGBitmap, drawPos.GetFloorIntX() - m_BGBitmap->w / 2, drawPos.GetFloorIntY() - m_BGBitmap->h / 2); |
| 645 | + //draw_sprite(targetBitmap, m_BGBitmap, drawPos.GetFloorIntX() - m_BGBitmap->w / 2, drawPos.GetFloorIntY() - m_BGBitmap->h / 2); |
| 646 | + g_GLResourceMan.UpdateDynamicBitmap(m_BGBitmap, true); |
| 647 | + DrawTexture(g_GLResourceMan.GetStaticTextureFromBitmap(m_BGBitmap), drawPos.GetFloorIntX() - m_BGBitmap->w / 2, drawPos.GetFloorIntY() - m_BGBitmap->h / 2, {255, 255, 255, 255}); |
643 | 648 | }
|
644 | 649 | }
|
645 | 650 |
|
@@ -954,6 +959,59 @@ void PieMenu::CalculateDrawPosition(const BITMAP* targetBitmap, const Vector& ta
|
954 | 959 | }
|
955 | 960 | }
|
956 | 961 |
|
| 962 | +void PieMenu::DrawMenuBackground() { |
| 963 | + int centerX = IsSubPieMenu() ? 0 : m_BGBitmap->w / 2; |
| 964 | + int centerY = IsSubPieMenu() ? 0 : m_BGBitmap->h / 2; |
| 965 | + if (m_DirectionIfSubPieMenu == Directions::Up || m_DirectionIfSubPieMenu == Directions::Left) { |
| 966 | + centerX = m_BGBitmap->w; |
| 967 | + } |
| 968 | + if (m_DirectionIfSubPieMenu == Directions::Up || m_DirectionIfSubPieMenu == Directions::Right) { |
| 969 | + centerY = m_BGBitmap->h; |
| 970 | + } |
| 971 | + if (m_DirectionIfSubPieMenu == Directions::Down) { |
| 972 | + centerX = -2; |
| 973 | + centerY = -2; |
| 974 | + } |
| 975 | + if (m_DirectionIfSubPieMenu == Directions::Left) { |
| 976 | + centerY = -2; |
| 977 | + } |
| 978 | + float subPieMenuRotationOffset = IsSubPieMenu() ? c_QuarterPI : 0; |
| 979 | + |
| 980 | + bool pieMenuNeedsToBeDrawnRotated = GetRotAngle() - subPieMenuRotationOffset != 0; |
| 981 | + BITMAP* bitmapToDrawTo = pieMenuNeedsToBeDrawnRotated ? m_BGRotationBitmap : m_BGBitmap; |
| 982 | + |
| 983 | + bool hasPieSliceWithSubPieMenu = false; |
| 984 | + for (const PieSlice* pieSlice: m_CurrentPieSlices) { |
| 985 | + if (pieSlice->GetSubPieMenu()) { |
| 986 | + hasPieSliceWithSubPieMenu = true; |
| 987 | + break; |
| 988 | + } |
| 989 | + } |
| 990 | + |
| 991 | + DrawRing(Vector2(centerX, centerY), m_CurrentInnerRadius, m_CurrentInnerRadius + m_BackgroundThickness, 0, 2*PI, 36, {255, 255, 255, 75}); |
| 992 | + |
| 993 | + if (m_EnabledState == EnabledState::Enabled) { |
| 994 | + if (hasPieSliceWithSubPieMenu) { |
| 995 | + clear_to_color(m_BGPieSlicesWithSubPieMenuBitmap, ColorKeys::g_MaskColor); |
| 996 | + circlefill(m_BGPieSlicesWithSubPieMenuBitmap, centerX, centerY, m_CurrentInnerRadius + m_BackgroundThickness + c_PieSliceWithSubPieMenuExtraThickness, m_BackgroundColor); |
| 997 | + } |
| 998 | + DrawBackgroundPieSliceSeparators(bitmapToDrawTo, centerX, centerY, subPieMenuRotationOffset); |
| 999 | + if (hasPieSliceWithSubPieMenu) { |
| 1000 | + circlefill(m_BGPieSlicesWithSubPieMenuBitmap, centerX, centerY, m_CurrentInnerRadius + m_BackgroundThickness, ColorKeys::g_MaskColor); |
| 1001 | + draw_sprite(m_BGPieSlicesWithSubPieMenuBitmap, bitmapToDrawTo, 0, 0); |
| 1002 | + clear_to_color(bitmapToDrawTo, ColorKeys::g_MaskColor); |
| 1003 | + draw_sprite(bitmapToDrawTo, m_BGPieSlicesWithSubPieMenuBitmap, 0, 0); |
| 1004 | + } |
| 1005 | + } |
| 1006 | + |
| 1007 | + if (bitmapToDrawTo != m_BGBitmap) { |
| 1008 | + clear_to_color(m_BGBitmap, ColorKeys::g_MaskColor); |
| 1009 | + float rotationAsAllegroAngle = ((GetRotAngle() - subPieMenuRotationOffset) / c_PI) * -128.0F; |
| 1010 | + pivot_sprite(m_BGBitmap, bitmapToDrawTo, m_BGBitmap->w / 2, m_BGBitmap->h / 2, centerX, centerY, ftofix(rotationAsAllegroAngle)); |
| 1011 | + } |
| 1012 | + m_BGBitmapNeedsRedrawing = false; |
| 1013 | + m_BGPieSlicesWithSubPieMenuBitmapNeedsRedrawing = false; |
| 1014 | +} |
957 | 1015 | void PieMenu::DrawPieIcons(BITMAP* targetBitmap, const Vector& drawPos) const {
|
958 | 1016 | for (const PieSlice* pieSlice: m_CurrentPieSlices) {
|
959 | 1017 | BITMAP* pieSliceIcon = pieSlice->GetAppropriateIcon(pieSlice == m_HoveredPieSlice);
|
|
0 commit comments