From 2337d9a7adee4605f9021b4747560905704d453e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Mustoha?= Date: Tue, 2 Jul 2024 16:38:46 +0200 Subject: [PATCH 1/4] Made Vec2 generic on the type --- src/common/math/Vec2.h | 51 +++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/common/math/Vec2.h b/src/common/math/Vec2.h index 443efa0d..9108b7b1 100644 --- a/src/common/math/Vec2.h +++ b/src/common/math/Vec2.h @@ -1,34 +1,35 @@ #pragma once -struct Vec2f { - float x = 0.f; - float y = 0.f; +template +struct Vec2 { + T x = 0; + T y = 0; - constexpr explicit Vec2f() = default; - constexpr explicit Vec2f(float inX, float inY) : x(inX), y(inY) {} + constexpr explicit Vec2() = default; + constexpr Vec2(T inX, T inY) : x(inX), y(inY) {} - static constexpr Vec2f zero() { - return Vec2f(); + static constexpr Vec2 zero() { + return Vec2(); } - constexpr Vec2f& operator+=(const Vec2f& rhs) { + constexpr Vec2& operator+=(const Vec2& rhs) { x += rhs.x; y += rhs.y; return *this; } - constexpr Vec2f& operator-=(const Vec2f& rhs) { + constexpr Vec2& operator-=(const Vec2& rhs) { x -= rhs.x; y -= rhs.y; return *this; } - constexpr Vec2f& operator*=(float val) { + template constexpr Vec2& operator*=(Scalar val) { x *= val; y *= val; return *this; } - constexpr Vec2f& operator/=(float val) { + template constexpr Vec2& operator/=(Scalar val) { x /= val; y /= val; return *this; @@ -36,22 +37,26 @@ struct Vec2f { }; -constexpr Vec2f operator+(const Vec2f& lhs, const Vec2f& rhs) { - return Vec2f(lhs.x + rhs.x, lhs.y + rhs.y); +template constexpr Vec2 operator+(const Vec2& lhs, const Vec2& rhs) { + return {lhs.x + rhs.x, lhs.y + rhs.y}; } -constexpr Vec2f operator-(const Vec2f& lhs, const Vec2f& rhs) { - return Vec2f(lhs.x - rhs.x, lhs.y - rhs.y); +template constexpr Vec2 operator-(const Vec2& lhs, const Vec2& rhs) { + return {lhs.x - rhs.x, lhs.y - rhs.y}; } -constexpr Vec2f operator*(const Vec2f& lhs, const Vec2f& rhs) { - return Vec2f(lhs.x * rhs.x, lhs.y * rhs.y); +template constexpr Vec2 operator*(const Vec2& lhs, const Vec2& rhs) { + return {lhs.x * rhs.x, lhs.y * rhs.y}; } -constexpr Vec2f operator/(const Vec2f& lhs, const Vec2f& rhs) { - return Vec2f(lhs.x / rhs.x, lhs.y / rhs.y); +template constexpr Vec2 operator/(const Vec2& lhs, const Vec2& rhs) { + return {lhs.x / rhs.x, lhs.y / rhs.y}; } -constexpr Vec2f operator*(const Vec2f& lhs, float scalar) { - return Vec2f(lhs.x * scalar, lhs.y * scalar); +template constexpr Vec2 operator*(const Vec2& lhs, Scalar scalar) { + return {lhs.x * scalar, lhs.y * scalar}; } -constexpr Vec2f operator/(const Vec2f& lhs, float scalar) { - return Vec2f(lhs.x / scalar, lhs.y / scalar); +template constexpr Vec2 operator/(const Vec2& lhs, Scalar scalar) { + return {lhs.x / scalar, lhs.y / scalar}; } + + +using Vec2f = Vec2; +using Vec2s = Vec2; From 0caec8ce43ce56a70af66a80d5951263527f322c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Mustoha?= Date: Tue, 2 Jul 2024 16:37:59 +0200 Subject: [PATCH 2/4] Moved the separate x-y coords of the UI elements into a position struct --- src/common/ui/MI_Button.cpp | 18 +++++----- src/common/ui/MI_Image.cpp | 4 +-- src/common/ui/MI_Image.h | 8 ++--- src/common/ui/MI_ImageSelectField.cpp | 12 +++---- src/common/ui/MI_MapField.cpp | 20 ++++++------ src/common/ui/MI_MapPreview.cpp | 10 +++--- src/common/ui/MI_ScoreText.cpp | 20 ++++++------ src/common/ui/MI_SelectField.cpp | 24 +++++++------- src/common/ui/MI_SliderField.cpp | 20 ++++++------ src/common/ui/MI_Text.cpp | 8 ++--- src/common/ui/MI_TextField.cpp | 22 ++++++------- src/common/uicontrol.cpp | 6 ++-- src/common/uicontrol.h | 11 ++++--- src/smw/ui/MI_AnnouncerField.cpp | 14 ++++---- src/smw/ui/MI_BonusWheel.cpp | 18 +++++----- src/smw/ui/MI_ChatMessageBox.cpp | 8 ++--- src/smw/ui/MI_FrenzyModeOptions.cpp | 2 +- src/smw/ui/MI_InputControlContainer.cpp | 16 ++++----- src/smw/ui/MI_MapFilterScroll.cpp | 26 +++++++-------- src/smw/ui/MI_PlayerSelect.cpp | 14 ++++---- src/smw/ui/MI_PlaylistField.cpp | 14 ++++---- src/smw/ui/MI_PowerupSelection.cpp | 6 ++-- src/smw/ui/MI_PowerupSlider.cpp | 18 +++++----- src/smw/ui/MI_StoredPowerupResetButton.cpp | 4 +-- src/smw/ui/MI_StringScroll.cpp | 16 ++++----- src/smw/ui/MI_TeamSelect.cpp | 14 ++++---- src/smw/ui/MI_TournamentScoreboard.cpp | 38 +++++++++++----------- src/smw/ui/MI_TournamentScoreboard.h | 2 +- src/smw/ui/MI_WorldPreviewDisplay.cpp | 4 +-- src/smw/ui/NetworkListScroll.cpp | 18 +++++----- 30 files changed, 206 insertions(+), 209 deletions(-) diff --git a/src/common/ui/MI_Button.cpp b/src/common/ui/MI_Button.cpp index e196c147..f8452246 100644 --- a/src/common/ui/MI_Button.cpp +++ b/src/common/ui/MI_Button.cpp @@ -39,24 +39,24 @@ void MI_Button::Draw() if (!fShow) return; - spr->draw(ix, iy, 0, (fSelected ? 32 : 0) + iAdjustmentY, iHalfWidth, 32); - spr->draw(ix + iHalfWidth, iy, 512 - iWidth + iHalfWidth, (fSelected ? 32 : 0) + iAdjustmentY, iWidth - iHalfWidth, 32); + spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + iAdjustmentY, iHalfWidth, 32); + spr->draw(m_pos.x + iHalfWidth, m_pos.y, 512 - iWidth + iHalfWidth, (fSelected ? 32 : 0) + iAdjustmentY, iWidth - iHalfWidth, 32); switch (m_text_align) { case TextAlign::LEFT: - rm->menu_font_large.drawChopRight(ix + 16 + (iImageW > 0 ? iImageW + 2 : 0), iy + 5, iWidth - 32, szName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16 + (iImageW > 0 ? iImageW + 2 : 0), m_pos.y + 5, iWidth - 32, szName.c_str()); if (sprImage) - sprImage->draw(ix + 16, iy + 16 - (iImageH >> 1), iImageSrcX, iImageSrcY, iImageW, iImageH); + sprImage->draw(m_pos.x + 16, m_pos.y + 16 - (iImageH >> 1), iImageSrcX, iImageSrcY, iImageW, iImageH); break; case TextAlign::CENTER: - rm->menu_font_large.drawCentered(ix + ((iWidth + (iImageW > 0 ? iImageW + 2 : 0)) >> 1), iy + 5, szName.c_str()); + rm->menu_font_large.drawCentered(m_pos.x + ((iWidth + (iImageW > 0 ? iImageW + 2 : 0)) >> 1), m_pos.y + 5, szName.c_str()); if (sprImage) - sprImage->draw(ix + (iWidth >> 1) - ((iTextW + iImageW) >> 1) - 1, iy + 16 - (iImageH >> 1), iImageSrcX, iImageSrcY, iImageW, iImageH); + sprImage->draw(m_pos.x + (iWidth >> 1) - ((iTextW + iImageW) >> 1) - 1, m_pos.y + 16 - (iImageH >> 1), iImageSrcX, iImageSrcY, iImageW, iImageH); break; case TextAlign::RIGHT: - rm->menu_font_large.drawRightJustified(ix + iWidth - 16, iy + 5, szName.c_str()); + rm->menu_font_large.drawRightJustified(m_pos.x + iWidth - 16, m_pos.y + 5, szName.c_str()); if (sprImage) - sprImage->draw(ix + iWidth - 18 - iTextW - iImageW, iy + 16 - (iImageH >> 1), iImageSrcX, iImageSrcY, iImageW, iImageH); + sprImage->draw(m_pos.x + iWidth - 18 - iTextW - iImageW, m_pos.y + 16 - (iImageH >> 1), iImageSrcX, iImageSrcY, iImageW, iImageH); break; } } @@ -81,7 +81,7 @@ MenuCodeEnum MI_Button::MouseClick(short iMouseX, short iMouseY) if (fDisable) return MENU_CODE_NONE; - if (iMouseX >= ix && iMouseX < ix + iWidth && iMouseY >= iy && iMouseY < iy + 32) { + if (iMouseX >= m_pos.x && iMouseX < m_pos.x + iWidth && iMouseY >= m_pos.y && iMouseY < m_pos.y + 32) { return menuCode; } diff --git a/src/common/ui/MI_Image.cpp b/src/common/ui/MI_Image.cpp index 4775e4c4..a1e31ccc 100644 --- a/src/common/ui/MI_Image.cpp +++ b/src/common/ui/MI_Image.cpp @@ -91,7 +91,7 @@ void MI_Image::Draw() } if (fPulse) - spr->drawStretch(ix - iPulseValue + iXOffset, iy - iPulseValue + iYOffset, iw + (iPulseValue << 1), ih + (iPulseValue << 1), iXFrame, iYFrame, iw, ih); + spr->drawStretch(m_pos.x - iPulseValue + iXOffset, m_pos.y - iPulseValue + iYOffset, iw + (iPulseValue << 1), ih + (iPulseValue << 1), iXFrame, iYFrame, iw, ih); else - spr->draw(ix + iXOffset, iy + iYOffset, iXFrame, iYFrame, iw, ih); + spr->draw(m_pos.x + iXOffset, m_pos.y + iYOffset, iXFrame, iYFrame, iw, ih); } diff --git a/src/common/ui/MI_Image.h b/src/common/ui/MI_Image.h index 732ad14b..2ac9456d 100644 --- a/src/common/ui/MI_Image.h +++ b/src/common/ui/MI_Image.h @@ -16,10 +16,6 @@ class MI_Image : public UI_Control { void Update() override; void Draw() override; - void SetPosition(short x, short y) { - ix = x; - iy = y; - } void SetAnimationSpeed(short speed) { iSpeed = speed; } @@ -58,8 +54,8 @@ class MI_Image : public UI_Control { } void GetPositionAndSize(short& x, short& y, short& w, short& h) const { - x = ix; - y = iy; + x = m_pos.x; + y = m_pos.y; w = iw; h = ih; } diff --git a/src/common/ui/MI_ImageSelectField.cpp b/src/common/ui/MI_ImageSelectField.cpp index 5dbaf7cc..bc4de957 100644 --- a/src/common/ui/MI_ImageSelectField.cpp +++ b/src/common/ui/MI_ImageSelectField.cpp @@ -26,17 +26,17 @@ void MI_ImageSelectField::Draw() if (!fShow) return; - m_spr->draw(ix, iy, 0, (fSelected ? 32 : 0), m_indent - 16, 32); - m_spr->draw(ix + m_indent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - m_spr->draw(ix + m_indent + 16, iy, 528 - m_width + m_indent, (fSelected ? 32 : 0), m_width - m_indent - 16, 32); + m_spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0), m_indent - 16, 32); + m_spr->draw(m_pos.x + m_indent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + m_spr->draw(m_pos.x + m_indent + 16, m_pos.y, 528 - m_width + m_indent, (fSelected ? 32 : 0), m_width - m_indent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, m_indent - 8, m_name.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, m_indent - 8, m_name.c_str()); if (!m_items.empty()) { - rm->menu_font_large.drawChopRight(ix + m_indent + iImageWidth + 10, iy + 5, m_width - m_indent - 24, currentItem().name.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + m_indent + iImageWidth + 10, m_pos.y + 5, m_width - m_indent - 24, currentItem().name.c_str()); } - spr_image->draw(ix + m_indent + 8, iy + 16 - (iImageHeight >> 1), (currentItem().iconOverride >= 0 ? currentItem().iconOverride : currentItem().value) * iImageWidth, 0, iImageWidth, iImageHeight); + spr_image->draw(m_pos.x + m_indent + 8, m_pos.y + 16 - (iImageHeight >> 1), (currentItem().iconOverride >= 0 ? currentItem().iconOverride : currentItem().value) * iImageWidth, 0, iImageWidth, iImageHeight); miModifyImageRight->Draw(); miModifyImageLeft->Draw(); diff --git a/src/common/ui/MI_MapField.cpp b/src/common/ui/MI_MapField.cpp index 2ecce626..f7e7155d 100644 --- a/src/common/ui/MI_MapField.cpp +++ b/src/common/ui/MI_MapField.cpp @@ -24,10 +24,10 @@ MI_MapField::MI_MapField(gfxSprite* nspr, short x, short y, std::string name, sh , iSearchStringTimer(0) , fShowtags(showtags) { - miModifyImageLeft = std::make_unique(nspr, ix + indent - 26, iy + 4, 32, 64, 26, 24, 4, 1, 8); + miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); miModifyImageLeft->Show(false); - miModifyImageRight = std::make_unique(nspr, ix + iWidth - 16, iy + 4, 32, 88, 26, 24, 4, 1, 8); + miModifyImageRight = std::make_unique(nspr, m_pos.x + iWidth - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); miModifyImageRight->Show(false); if (fShowtags) { @@ -192,12 +192,12 @@ void MI_MapField::Draw() return; //Draw the select field background - spr->draw(ix, iy, 0, (fSelected ? 32 : 0), iIndent - 16, 32); - spr->draw(ix + iIndent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - spr->draw(ix + iIndent + 16, iy, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); + spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0), iIndent - 16, 32); + spr->draw(m_pos.x + iIndent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + spr->draw(m_pos.x + iIndent + 16, m_pos.y, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, iIndent - 8, szName.c_str()); - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iWidth - iIndent - 24, szMapName); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, iIndent - 8, szName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iWidth - iIndent - 24, szMapName); MI_MapPreview::Draw(); @@ -233,7 +233,7 @@ MenuCodeEnum MI_MapField::MouseClick(short iMouseX, short iMouseY) } //Otherwise just check to see if we clicked on the whole control - if (iMouseX >= ix && iMouseX < ix + iWidth && iMouseY >= iy && iMouseY < iy + 32) + if (iMouseX >= m_pos.x && iMouseX < m_pos.x + iWidth && iMouseY >= m_pos.y && iMouseY < m_pos.y + 32) return MENU_CODE_CLICKED; //Otherwise this control wasn't clicked at all @@ -277,8 +277,8 @@ void MI_MapField::SetDimensions(short width, short indent) { MI_MapPreview::SetDimensions(width, indent); - miModifyImageLeft->SetPosition(ix + indent - 26, iy + 4); - miModifyImageRight->SetPosition(ix + iWidth - 16, iy + 4); + miModifyImageLeft->SetPosition(m_pos.x + indent - 26, m_pos.y + 4); + miModifyImageRight->SetPosition(m_pos.x + iWidth - 16, m_pos.y + 4); if (fShowtags) { //iSlideListOut = (iWidth - 352) >> 1; diff --git a/src/common/ui/MI_MapPreview.cpp b/src/common/ui/MI_MapPreview.cpp index a76a1c54..65b5682d 100644 --- a/src/common/ui/MI_MapPreview.cpp +++ b/src/common/ui/MI_MapPreview.cpp @@ -70,13 +70,13 @@ void MI_MapPreview::Draw() if (!fShow) return; - short iMapBoxX = ix + (iWidth >> 1) - 176 - iSlideListOut; + short iMapBoxX = m_pos.x + (iWidth >> 1) - 176 - iSlideListOut; //Draw the background for the map preview - rm->menu_dialog.draw(iMapBoxX, iy + 30, 0, 0, 336, 254); - rm->menu_dialog.draw(iMapBoxX + 336, iy + 30, 496, 0, 16, 254); - rm->menu_dialog.draw(iMapBoxX, iy + 284, 0, 464, 336, 16); - rm->menu_dialog.draw(iMapBoxX + 336, iy + 284, 496, 464, 16, 16); + rm->menu_dialog.draw(iMapBoxX, m_pos.y + 30, 0, 0, 336, 254); + rm->menu_dialog.draw(iMapBoxX + 336, m_pos.y + 30, 496, 0, 16, 254); + rm->menu_dialog.draw(iMapBoxX, m_pos.y + 284, 0, 464, 336, 16); + rm->menu_dialog.draw(iMapBoxX + 336, m_pos.y + 284, 496, 464, 16, 16); rectDst.x = iMapBoxX + 16; diff --git a/src/common/ui/MI_ScoreText.cpp b/src/common/ui/MI_ScoreText.cpp index f5147c9e..c137440d 100644 --- a/src/common/ui/MI_ScoreText.cpp +++ b/src/common/ui/MI_ScoreText.cpp @@ -14,14 +14,14 @@ void MI_ScoreText::Draw() if (!fShow) return; - rm->spr_scoretext.draw(iDigitRightDstX, iy, iDigitRightSrcX, 0, 16, 16); + rm->spr_scoretext.draw(iDigitRightDstX, m_pos.y, iDigitRightSrcX, 0, 16, 16); if (iDigitLeftSrcX > 0) { - rm->spr_scoretext.draw(iDigitMiddleDstX, iy, iDigitMiddleSrcX, 0, 16, 16); - rm->spr_scoretext.draw(iDigitLeftDstX, iy, iDigitLeftSrcX, 0, 16, 16); + rm->spr_scoretext.draw(iDigitMiddleDstX, m_pos.y, iDigitMiddleSrcX, 0, 16, 16); + rm->spr_scoretext.draw(iDigitLeftDstX, m_pos.y, iDigitLeftSrcX, 0, 16, 16); } else if (iDigitMiddleSrcX > 0) { - rm->spr_scoretext.draw(iDigitMiddleDstX, iy, iDigitMiddleSrcX, 0, 16, 16); + rm->spr_scoretext.draw(iDigitMiddleDstX, m_pos.y, iDigitMiddleSrcX, 0, 16, 16); } } @@ -37,14 +37,14 @@ void MI_ScoreText::SetScore(short sScore) if (iDigitLeftSrcX == 0) { if (iDigitMiddleSrcX == 0) { - iDigitRightDstX = ix - 8; + iDigitRightDstX = m_pos.x - 8; } else { - iDigitMiddleDstX = ix - 16; - iDigitRightDstX = ix; + iDigitMiddleDstX = m_pos.x - 16; + iDigitRightDstX = m_pos.x; } } else { - iDigitLeftDstX = ix - 24; - iDigitMiddleDstX = ix - 8; - iDigitRightDstX = ix + 8; + iDigitLeftDstX = m_pos.x - 24; + iDigitMiddleDstX = m_pos.x - 8; + iDigitRightDstX = m_pos.x + 8; } } diff --git a/src/common/ui/MI_SelectField.cpp b/src/common/ui/MI_SelectField.cpp index 470c5f57..487e7fa4 100644 --- a/src/common/ui/MI_SelectField.cpp +++ b/src/common/ui/MI_SelectField.cpp @@ -18,10 +18,10 @@ MI_SelectField::MI_SelectField(gfxSprite* nspr, short x, short y, std::string , m_width(width) , m_indent(indent) { - miModifyImageLeft = std::make_unique(nspr, ix + indent - 26, iy + 4, 32, 64, 26, 24, 4, 1, 8); + miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); miModifyImageLeft->Show(false); - miModifyImageRight = std::make_unique(nspr, ix + width - 16, iy + 4, 32, 88, 26, 24, 4, 1, 8); + miModifyImageRight = std::make_unique(nspr, m_pos.x + width - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); miModifyImageRight->Show(false); } @@ -45,10 +45,10 @@ MI_SelectField::MI_SelectField(const MI_SelectField& other) { setCurrentIndex(other.m_index); - miModifyImageLeft = std::make_unique(m_spr, ix + m_indent - 26, iy + 4, 32, 64, 26, 24, 4, 1, 8); + miModifyImageLeft = std::make_unique(m_spr, m_pos.x + m_indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); miModifyImageLeft->Show(false); - miModifyImageRight = std::make_unique(m_spr, ix + m_width - 16, iy + 4, 32, 88, 26, 24, 4, 1, 8); + miModifyImageRight = std::make_unique(m_spr, m_pos.x + m_width - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); miModifyImageRight->Show(false); } @@ -69,20 +69,20 @@ void MI_SelectField::Draw() if (m_indent == 0) { short iHalfWidth = m_width / 2; - m_spr->draw(ix, iy, 0, (fSelected ? 32 : 0) + m_adjustmentY, iHalfWidth, 32); - m_spr->draw(ix + iHalfWidth, iy, 512 - iHalfWidth, (fSelected ? 32 : 0) + m_adjustmentY, m_width - iHalfWidth, 32); + m_spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + m_adjustmentY, iHalfWidth, 32); + m_spr->draw(m_pos.x + iHalfWidth, m_pos.y, 512 - iHalfWidth, (fSelected ? 32 : 0) + m_adjustmentY, m_width - iHalfWidth, 32); } else { - m_spr->draw(ix, iy, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_indent - 16, 32); - m_spr->draw(ix + m_indent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - m_spr->draw(ix + m_indent + 16, iy, 528 - m_width + m_indent, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_indent - 16, 32); + m_spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_indent - 16, 32); + m_spr->draw(m_pos.x + m_indent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + m_spr->draw(m_pos.x + m_indent + 16, m_pos.y, 528 - m_width + m_indent, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_indent - 16, 32); } if (m_indent> 0) - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, m_indent - 8, m_name.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, m_indent - 8, m_name.c_str()); if (!m_items.empty()) { const short indent = (m_indent > 0) ? m_indent : 8; - rm->menu_font_large.drawChopRight(ix + indent + 8, iy + 5, m_width - indent - 24, currentItem().name.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + indent + 8, m_pos.y + 5, m_width - indent - 24, currentItem().name.c_str()); } const bool drawLeft = m_index > 0; @@ -194,7 +194,7 @@ MenuCodeEnum MI_SelectField::MouseClick(short iMouseX, short iMouseY) { } //Otherwise just check to see if we clicked on the whole control - if (ix <= iMouseX && iMouseX < ix + m_width && iy <= iMouseY && iMouseY < iy + 32) + if (m_pos.x <= iMouseX && iMouseX < m_pos.x + m_width && m_pos.y <= iMouseY && iMouseY < m_pos.y + 32) return MENU_CODE_CLICKED; //Otherwise this control wasn't clicked at all diff --git a/src/common/ui/MI_SliderField.cpp b/src/common/ui/MI_SliderField.cpp index d498ea2f..394e6c99 100644 --- a/src/common/ui/MI_SliderField.cpp +++ b/src/common/ui/MI_SliderField.cpp @@ -25,8 +25,8 @@ MI_SliderField::~MI_SliderField() void MI_SliderField::SetPosition(short x, short y) { MI_SelectField::SetPosition(x, y); - miModifyImageLeft->SetPosition(ix + m_indent - 26, iy + 4); - miModifyImageRight->SetPosition(ix + m_width - 16, iy + 4); + miModifyImageLeft->SetPosition(m_pos.x + m_indent - 26, m_pos.y + 4); + miModifyImageRight->SetPosition(m_pos.x + m_width - 16, m_pos.y + 4); } void MI_SliderField::Draw() @@ -34,14 +34,14 @@ void MI_SliderField::Draw() if (!fShow) return; - m_spr->draw(ix, iy, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_indent - 16, 32); - m_spr->draw(ix + m_indent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - m_spr->draw(ix + m_indent + 16, iy, 528 - m_width + m_indent, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_indent - 16, 32); + m_spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_indent - 16, 32); + m_spr->draw(m_pos.x + m_indent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + m_spr->draw(m_pos.x + m_indent + 16, m_pos.y, 528 - m_width + m_indent, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_indent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, m_indent - 8, m_name.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, m_indent - 8, m_name.c_str()); if (!m_items.empty()) { - rm->menu_font_large.drawChopRight(ix + m_indent2 + 16, iy + 5, m_width - m_indent2 - 24, currentItem().name.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + m_indent2 + 16, m_pos.y + 5, m_width - m_indent2 - 24, currentItem().name.c_str()); } short iSpacing = (m_indent2 - m_indent - 20) / ((short)m_items.size() - 1); @@ -49,14 +49,14 @@ void MI_SliderField::Draw() for (unsigned int index = 0; index < m_items.size(); index++) { if (index < m_items.size() - 1) - m_sprSlider->draw(ix + m_indent + iSpot + 16, iy + 10, 0, 0, iSpacing, 13); + m_sprSlider->draw(m_pos.x + m_indent + iSpot + 16, m_pos.y + 10, 0, 0, iSpacing, 13); else - m_sprSlider->draw(ix + m_indent + iSpot + 16, iy + 10, 164, 0, 4, 13); + m_sprSlider->draw(m_pos.x + m_indent + iSpot + 16, m_pos.y + 10, 164, 0, 4, 13); iSpot += iSpacing; } - m_sprSlider->draw(ix + m_indent + (m_index * iSpacing) + 14, iy + 8, 168, 0, 8, 16); + m_sprSlider->draw(m_pos.x + m_indent + (m_index * iSpacing) + 14, m_pos.y + 8, 168, 0, 8, 16); const bool drawLeft = m_index > 0; if (m_wraps || drawLeft) diff --git a/src/common/ui/MI_Text.cpp b/src/common/ui/MI_Text.cpp index 31dcbb34..3709d450 100644 --- a/src/common/ui/MI_Text.cpp +++ b/src/common/ui/MI_Text.cpp @@ -24,11 +24,11 @@ void MI_Text::Draw() return; if (m_align == TextAlign::LEFT && iw == 0) - font->draw(ix, iy, szText.c_str()); + font->draw(m_pos.x, m_pos.y, szText.c_str()); else if (m_align == TextAlign::LEFT) - font->drawChopRight(ix, iy, iw, szText.c_str()); + font->drawChopRight(m_pos.x, m_pos.y, iw, szText.c_str()); else if (m_align == TextAlign::CENTER) - font->drawCentered(ix, iy, szText.c_str()); + font->drawCentered(m_pos.x, m_pos.y, szText.c_str()); else if (m_align == TextAlign::RIGHT) - font->drawRightJustified(ix, iy, szText.c_str()); + font->drawRightJustified(m_pos.x, m_pos.y, szText.c_str()); } diff --git a/src/common/ui/MI_TextField.cpp b/src/common/ui/MI_TextField.cpp index d20de568..d1cb8bf4 100644 --- a/src/common/ui/MI_TextField.cpp +++ b/src/common/ui/MI_TextField.cpp @@ -24,7 +24,7 @@ MI_TextField::MI_TextField(gfxSprite * nspr, short x, short y, const char * name , iAdjustmentY(width > 256 ? 0 : 128) , iAllowedWidth(iWidth - iIndent - 24) { - miModifyCursor = std::make_unique(nspr, ix + indent, iy + 4, 136, 64, 15, 24, 4, 1, 8); + miModifyCursor = std::make_unique(nspr, m_pos.x + indent, m_pos.y + 4, 136, 64, 15, 24, 4, 1, 8); miModifyCursor->SetBlink(true, 20); miModifyCursor->Show(false); } @@ -186,17 +186,17 @@ void MI_TextField::Draw() if (!fShow) return; - spr->draw(ix, iy, 0, (fSelected ? 32 : 0) + iAdjustmentY, iIndent - 16, 32); - spr->draw(ix + iIndent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - spr->draw(ix + iIndent + 16, iy, 528 - iWidth + iIndent, (fSelected ? 32 : 0) + iAdjustmentY, iWidth - iIndent - 16, 32); + spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + iAdjustmentY, iIndent - 16, 32); + spr->draw(m_pos.x + iIndent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + spr->draw(m_pos.x + iIndent + 16, m_pos.y, 528 - iWidth + iIndent, (fSelected ? 32 : 0) + iAdjustmentY, iWidth - iIndent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, iIndent - 8, szName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, iIndent - 8, szName.c_str()); if (szOutValue) { if (iStringWidth <= iAllowedWidth || !fModifying) { - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iAllowedWidth, szOutValue); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iAllowedWidth, szOutValue); } else { - rm->menu_font_large.drawChopLeft(ix + iWidth - 16, iy + 5, iAllowedWidth, szTempValue.c_str()); + rm->menu_font_large.drawChopLeft(m_pos.x + iWidth - 16, m_pos.y + 5, iAllowedWidth, szTempValue.c_str()); } } @@ -231,7 +231,7 @@ MenuCodeEnum MI_TextField::MouseClick(short iMouseX, short iMouseY) szChar[0] = szOutValue[iChar]; iPixelCount += rm->menu_font_large.getWidth(szChar); - if (iPixelCount >= iMouseX - (ix + iIndent + 8)) { + if (iPixelCount >= iMouseX - (m_pos.x + iIndent + 8)) { iCursorIndex = iChar; UpdateCursor(); return MENU_CODE_NONE; @@ -240,7 +240,7 @@ MenuCodeEnum MI_TextField::MouseClick(short iMouseX, short iMouseY) } //Otherwise just check to see if we clicked on the whole control - if (iMouseX >= ix && iMouseX < ix + iWidth && iMouseY >= iy && iMouseY < iy + 32) { + if (iMouseX >= m_pos.x && iMouseX < m_pos.x + iWidth && iMouseY >= m_pos.y && iMouseY < m_pos.y + 32) { iCursorIndex = strlen(szOutValue); UpdateCursor(); return MENU_CODE_CLICKED; @@ -269,9 +269,9 @@ void MI_TextField::UpdateCursor() iStringWidth = rm->menu_font_large.getWidth(szTempValue.c_str()); if (iStringWidth <= iAllowedWidth) { - miModifyCursor->SetPosition(ix + iIndent + 10 + iStringWidth, iy + 4); + miModifyCursor->SetPosition(m_pos.x + iIndent + 10 + iStringWidth, m_pos.y + 4); } else { - miModifyCursor->SetPosition(ix + iIndent + 10 + iAllowedWidth, iy + 4); + miModifyCursor->SetPosition(m_pos.x + iIndent + 10 + iAllowedWidth, m_pos.y + 4); } } diff --git a/src/common/uicontrol.cpp b/src/common/uicontrol.cpp index 3275e284..783de064 100644 --- a/src/common/uicontrol.cpp +++ b/src/common/uicontrol.cpp @@ -4,8 +4,7 @@ UI_Control::UI_Control(short x, short y) - : ix(x) - , iy(y) + : m_pos(x, y) { neighborControls.fill(nullptr); } @@ -14,8 +13,7 @@ UI_Control::UI_Control(short x, short y) UI_Control& UI_Control::operator= (const UI_Control& other) { if (this != &other) { - ix = other.ix; - iy = other.iy; + m_pos = other.m_pos; fSelected = other.fSelected; fModifying = other.fModifying; diff --git a/src/common/uicontrol.h b/src/common/uicontrol.h index 245ffeba..9204ad6d 100644 --- a/src/common/uicontrol.h +++ b/src/common/uicontrol.h @@ -1,6 +1,7 @@ #pragma once #include "ui/MenuCode.h" +#include "math/Vec2.h" #include @@ -23,9 +24,13 @@ class UI_Control UI_Control& operator=(const UI_Control&); virtual ~UI_Control() = default; + /// Updates animations or other events every frame virtual void Update() {} + + /// Draws every frame virtual void Draw() {} + /// Sends player input to control on every frame virtual MenuCodeEnum SendInput(CPlayerInput*) { return MENU_CODE_NONE; } @@ -55,8 +60,7 @@ class UI_Control } void SetPosition(short x, short y) { - ix = x; - iy = y; + m_pos = {x, y}; } void SetNeighbor(unsigned short iNeighbor, UI_Control* uiControl); @@ -95,8 +99,7 @@ class UI_Control } protected: - short ix = 0; - short iy = 0; + Vec2s m_pos = Vec2s::zero(); bool fSelected = false; bool fModifying = false; diff --git a/src/smw/ui/MI_AnnouncerField.cpp b/src/smw/ui/MI_AnnouncerField.cpp index 922f7681..a72bfca3 100644 --- a/src/smw/ui/MI_AnnouncerField.cpp +++ b/src/smw/ui/MI_AnnouncerField.cpp @@ -19,10 +19,10 @@ MI_AnnouncerField::MI_AnnouncerField(gfxSprite* nspr, short x, short y, std::str { UpdateName(); - miModifyImageLeft = std::make_unique(nspr, ix + indent - 26, iy + 4, 32, 64, 26, 24, 4, 1, 8); + miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); miModifyImageLeft->Show(false); - miModifyImageRight = std::make_unique(nspr, ix + iWidth - 16, iy + 4, 32, 88, 26, 24, 4, 1, 8); + miModifyImageRight = std::make_unique(nspr, m_pos.x + iWidth - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); miModifyImageRight->Show(false); } @@ -88,12 +88,12 @@ void MI_AnnouncerField::Draw() return; //Draw the select field background - spr->draw(ix, iy, 0, (fSelected ? 32 : 0), iIndent - 16, 32); - spr->draw(ix + iIndent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - spr->draw(ix + iIndent + 16, iy, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); + spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0), iIndent - 16, 32); + spr->draw(m_pos.x + iIndent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + spr->draw(m_pos.x + iIndent + 16, m_pos.y, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, iIndent - 8, szName.c_str()); - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iWidth - iIndent - 24, szFieldName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, iIndent - 8, szName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iWidth - iIndent - 24, szFieldName.c_str()); miModifyImageLeft->Draw(); miModifyImageRight->Draw(); diff --git a/src/smw/ui/MI_BonusWheel.cpp b/src/smw/ui/MI_BonusWheel.cpp index 74084daf..ab0aebff 100644 --- a/src/smw/ui/MI_BonusWheel.cpp +++ b/src/smw/ui/MI_BonusWheel.cpp @@ -31,7 +31,7 @@ MI_BonusWheel::MI_BonusWheel(short x, short y) //Fix the last sector to allow correct detection of sector for tick sound dSelectionSector[NUMBONUSITEMSONWHEEL] = TWO_PI; - miContinueButton = new MI_Button(&rm->menu_plain_field, ix + 76, iy + 390, "Continue", 200, TextAlign::CENTER); + miContinueButton = new MI_Button(&rm->menu_plain_field, m_pos.x + 76, m_pos.y + 390, "Continue", 200, TextAlign::CENTER); miContinueButton->Show(false); miContinueButton->SetCode(MENU_CODE_BONUS_DONE); } @@ -89,8 +89,8 @@ void MI_BonusWheel::Update() if (--iDisplayPowerupTimer <= 0) { iDisplayPowerupTimer = 20; - short iPoofX = ix + 152 + (short)(110.0f * cos(dSelectionSector[iDisplayPowerupIndex])); - short iPoofY = iy + 200 + (short)(110.0f * sin(dSelectionSector[iDisplayPowerupIndex])); + short iPoofX = m_pos.x + 152 + (short)(110.0f * cos(dSelectionSector[iDisplayPowerupIndex])); + short iPoofY = m_pos.y + 200 + (short)(110.0f * sin(dSelectionSector[iDisplayPowerupIndex])); uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_poof, iPoofX, iPoofY, 4, 5)); @@ -190,10 +190,10 @@ void MI_BonusWheel::Draw() if (!fShow) return; - rm->spr_tournament_powerup_splash.draw(ix, iy); + rm->spr_tournament_powerup_splash.draw(m_pos.x, m_pos.y); - short iSelectorX = ix + 144 + (short)(110.0f * cos(dSelectionAngle)); - short iSelectorY = iy + 190 + (short)(110.0f * sin(dSelectionAngle)); + short iSelectorX = m_pos.x + 144 + (short)(110.0f * cos(dSelectionAngle)); + short iSelectorY = m_pos.y + 190 + (short)(110.0f * sin(dSelectionAngle)); if (iState > 0) rm->spr_powerupselector.draw(iSelectorX, iSelectorY, iSelectorAnimation * 64, 0, 64, 64); @@ -212,7 +212,7 @@ void MI_BonusWheel::Draw() miContinueButton->Draw(); if (iState == 1 && !fPressedSelect) - rm->menu_font_large.drawCentered(App::screenWidth/2, iy + 390, "Press a Button To Stop The Wheel"); + rm->menu_font_large.drawCentered(App::screenWidth/2, m_pos.y + 390, "Press a Button To Stop The Wheel"); } void MI_BonusWheel::Reset(bool fTournament) @@ -262,9 +262,9 @@ void MI_BonusWheel::Reset(bool fTournament) miPlayerImages = new MI_Image * [iNumPlayers]; - short iPlayerX = ix + 160 - ((iNumPlayers - 1) * 17); + short iPlayerX = m_pos.x + 160 - ((iNumPlayers - 1) * 17); for (short iPlayer = 0; iPlayer < iNumPlayers; iPlayer++) { - miPlayerImages[iPlayer] = new MI_Image(rm->spr_player[game_values.teamids[iWinningTeam][iPlayer]][PGFX_JUMPING_R], iPlayerX, iy + 210, 0, 0, 32, 32, 1, 1, 0); + miPlayerImages[iPlayer] = new MI_Image(rm->spr_player[game_values.teamids[iWinningTeam][iPlayer]][PGFX_JUMPING_R], iPlayerX, m_pos.y + 210, 0, 0, 32, 32, 1, 1, 0); iPlayerX += 34; } diff --git a/src/smw/ui/MI_ChatMessageBox.cpp b/src/smw/ui/MI_ChatMessageBox.cpp index 12433d44..17b066ec 100644 --- a/src/smw/ui/MI_ChatMessageBox.cpp +++ b/src/smw/ui/MI_ChatMessageBox.cpp @@ -14,8 +14,8 @@ MI_ChatMessageBox::MI_ChatMessageBox(short x, short y, short width, short numlin void MI_ChatMessageBox::Draw() { - rm->menu_dialog.draw(ix, iy, 0, 0, iWidth - 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix + iWidth - 16, iy, 496, 0, 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix, iy + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); - rm->menu_dialog.draw(ix + iWidth - 16, iy + iNumLines * 32 + 32, 496, 464, 16, 16); + rm->menu_dialog.draw(m_pos.x, m_pos.y, 0, 0, iWidth - 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y, 496, 0, 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x, m_pos.y + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y + iNumLines * 32 + 32, 496, 464, 16, 16); } diff --git a/src/smw/ui/MI_FrenzyModeOptions.cpp b/src/smw/ui/MI_FrenzyModeOptions.cpp index 6342d3a2..67b6c70f 100644 --- a/src/smw/ui/MI_FrenzyModeOptions.cpp +++ b/src/smw/ui/MI_FrenzyModeOptions.cpp @@ -160,7 +160,7 @@ void MI_FrenzyModeOptions::SetupPowerupFields() slider->Show(false); else { slider->Show(true); - slider->SetPosition(ix + (iPosition % 2) * 295, iy + 118 + 38 * (iPosition / 2 - iOffset)); + slider->SetPosition(m_pos.x + (iPosition % 2) * 295, m_pos.y + 118 + 38 * (iPosition / 2 - iOffset)); } } } diff --git a/src/smw/ui/MI_InputControlContainer.cpp b/src/smw/ui/MI_InputControlContainer.cpp index 333ac0de..e44df4f4 100644 --- a/src/smw/ui/MI_InputControlContainer.cpp +++ b/src/smw/ui/MI_InputControlContainer.cpp @@ -346,20 +346,20 @@ void MI_InputControlField::Draw() if (!fShow) return; - spr->draw(ix, iy, 0, (fSelected ? 32 : 0), iIndent - 16, 32); - spr->draw(ix + iIndent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - spr->draw(ix + iIndent + 16, iy, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); + spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0), iIndent - 16, 32); + spr->draw(m_pos.x + iIndent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + spr->draw(m_pos.x + iIndent + 16, m_pos.y, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, iIndent - 8, szName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, iIndent - 8, szName.c_str()); if (iKey == NULL) - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iWidth - iIndent - 16, "Unassigned"); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iWidth - iIndent - 16, "Unassigned"); else if (fModifying) - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iWidth - iIndent - 16, "(Press Button)"); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iWidth - iIndent - 16, "(Press Button)"); else if (iDevice == DEVICE_KEYBOARD) - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iWidth - iIndent - 16, Keynames(*iKey)); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iWidth - iIndent - 16, Keynames(*iKey)); else - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iWidth - iIndent - 16, Joynames[*iKey]); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iWidth - iIndent - 16, Joynames[*iKey]); } diff --git a/src/smw/ui/MI_MapFilterScroll.cpp b/src/smw/ui/MI_MapFilterScroll.cpp index f2bf3841..4f472e9d 100644 --- a/src/smw/ui/MI_MapFilterScroll.cpp +++ b/src/smw/ui/MI_MapFilterScroll.cpp @@ -99,12 +99,12 @@ void MI_MapFilterScroll::Draw() return; //Draw the background for the map preview - rm->menu_dialog.draw(ix, iy, 0, 0, iWidth - 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix + iWidth - 16, iy, 496, 0, 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix, iy + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); - rm->menu_dialog.draw(ix + iWidth - 16, iy + iNumLines * 32 + 32, 496, 464, 16, 16); + rm->menu_dialog.draw(m_pos.x, m_pos.y, 0, 0, iWidth - 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y, 496, 0, 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x, m_pos.y + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y + iNumLines * 32 + 32, 496, 464, 16, 16); - rm->menu_font_large.drawCentered(ix + (iWidth >> 1), iy + 5, "Map Filters"); + rm->menu_font_large.drawCentered(m_pos.x + (iWidth >> 1), m_pos.y + 5, "Map Filters"); //Draw each filter field for (short iLine = 0; iLine < iNumLines && (unsigned short)iLine < items.size(); iLine++) { @@ -112,22 +112,22 @@ void MI_MapFilterScroll::Draw() short iHalfLineWidth = (iWidth - 64) >> 1; short iLineWidth = iWidth - 64; - spr->draw(ix + 16, iy + 32 + iLine * 32, 0, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iHalfLineWidth, 32); - spr->draw(ix + 16 + iHalfLineWidth, iy + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iLineWidth - iHalfLineWidth, 32); + spr->draw(m_pos.x + 16, m_pos.y + 32 + iLine * 32, 0, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iHalfLineWidth, 32); + spr->draw(m_pos.x + 16 + iHalfLineWidth, m_pos.y + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iLineWidth - iHalfLineWidth, 32); - rm->menu_map_filter.draw(ix + iWidth - 48, iy + 32 + iLine * 32, 48, (iSelectedLine == iLine && iSelectedColumn == 1 ? 32 : 0), 32, 32); + rm->menu_map_filter.draw(m_pos.x + iWidth - 48, m_pos.y + 32 + iLine * 32, 48, (iSelectedLine == iLine && iSelectedColumn == 1 ? 32 : 0), 32, 32); } else { short iHalfLineWidth = (iWidth - 32) >> 1; short iLineWidth = iWidth - 32; - spr->draw(ix + 16, iy + 32 + iLine * 32, 0, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iHalfLineWidth, 32); - spr->draw(ix + 16 + iHalfLineWidth, iy + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iLineWidth - iHalfLineWidth, 32); + spr->draw(m_pos.x + 16, m_pos.y + 32 + iLine * 32, 0, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iHalfLineWidth, 32); + spr->draw(m_pos.x + 16 + iHalfLineWidth, m_pos.y + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine && iSelectedColumn == 0 ? 32 : 0), iLineWidth - iHalfLineWidth, 32); } if (items[iOffset + iLine]->fSelected) - rm->menu_map_filter.draw(ix + 24, iy + 32 + iLine * 32 + 4, 24, 0, 24, 24); + rm->menu_map_filter.draw(m_pos.x + 24, m_pos.y + 32 + iLine * 32 + 4, 24, 0, 24, 24); - rm->menu_font_large.drawChopRight(ix + 52, iy + 5 + iLine * 32 + 32, iWidth - 104, items[iOffset + iLine]->sName.c_str()); - rm->spr_map_filter_icons.draw(ix + 28, iy + 32 + iLine * 32 + 8, items[iOffset + iLine]->iIcon % 10 * 16, items[iOffset + iLine]->iIcon / 10 * 16, 16, 16); + rm->menu_font_large.drawChopRight(m_pos.x + 52, m_pos.y + 5 + iLine * 32 + 32, iWidth - 104, items[iOffset + iLine]->sName.c_str()); + rm->spr_map_filter_icons.draw(m_pos.x + 28, m_pos.y + 32 + iLine * 32 + 8, items[iOffset + iLine]->iIcon % 10 * 16, items[iOffset + iLine]->iIcon / 10 * 16, 16, 16); } } diff --git a/src/smw/ui/MI_PlayerSelect.cpp b/src/smw/ui/MI_PlayerSelect.cpp index e83385e1..b4121c7f 100644 --- a/src/smw/ui/MI_PlayerSelect.cpp +++ b/src/smw/ui/MI_PlayerSelect.cpp @@ -15,7 +15,7 @@ MI_PlayerSelect::MI_PlayerSelect(gfxSprite * nspr, short x, short y, std::string , iWidth(width) , iIndent(indent) { - miModifyImage = std::make_unique(nspr, ix, iy - 6, 32, 128, 78, 78, 4, 1, 8); + miModifyImage = std::make_unique(nspr, m_pos.x, m_pos.y - 6, 32, 128, 78, 78, 4, 1, 8); miModifyImage->Show(false); const short iSpacing = (width - indent - 136) / 5; @@ -94,7 +94,7 @@ MenuCodeEnum MI_PlayerSelect::SendInput(CPlayerInput* playerInput) void MI_PlayerSelect::SetImagePosition() { - miModifyImage->SetPosition(ix + iPlayerPosition[iSelectedPlayer] - 22, iy - 7); + miModifyImage->SetPosition(m_pos.x + iPlayerPosition[iSelectedPlayer] - 22, m_pos.y - 7); } void MI_PlayerSelect::Update() @@ -107,15 +107,15 @@ void MI_PlayerSelect::Draw() if (!fShow) return; - spr->draw(ix, iy, 0, (fSelected ? 64 : 0), iIndent - 16, 64); - spr->draw(ix + iIndent - 16, iy, 0, (fSelected ? 192 : 128), 32, 64); - spr->draw(ix + iIndent + 16, iy, 528 - iWidth + iIndent, (fSelected ? 64 : 0), iWidth - iIndent - 16, 64); + spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 64 : 0), iIndent - 16, 64); + spr->draw(m_pos.x + iIndent - 16, m_pos.y, 0, (fSelected ? 192 : 128), 32, 64); + spr->draw(m_pos.x + iIndent + 16, m_pos.y, 528 - iWidth + iIndent, (fSelected ? 64 : 0), iWidth - iIndent - 16, 64); - rm->menu_font_large.drawChopRight(ix + 16, iy + 20, iIndent - 8, szName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 20, iIndent - 8, szName.c_str()); miModifyImage->Draw(); for (short iPlayer = 0; iPlayer < 4; iPlayer++) { - spr->draw(ix + iPlayerPosition[iPlayer], iy + 16, game_values.playercontrol[iPlayer] * 34 + 32, 206, 34, 32); + spr->draw(m_pos.x + iPlayerPosition[iPlayer], m_pos.y + 16, game_values.playercontrol[iPlayer] * 34 + 32, 206, 34, 32); } } diff --git a/src/smw/ui/MI_PlaylistField.cpp b/src/smw/ui/MI_PlaylistField.cpp index a736e78b..2e908c84 100644 --- a/src/smw/ui/MI_PlaylistField.cpp +++ b/src/smw/ui/MI_PlaylistField.cpp @@ -19,10 +19,10 @@ MI_PlaylistField::MI_PlaylistField(gfxSprite* nspr, short x, short y, std::strin , iWidth(width) , iIndent(indent) { - miModifyImageLeft = std::make_unique(nspr, ix + indent - 26, iy + 4, 32, 64, 26, 24, 4, 1, 8); + miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); miModifyImageLeft->Show(false); - miModifyImageRight = std::make_unique(nspr, ix + iWidth - 16, iy + 4, 32, 88, 26, 24, 4, 1, 8); + miModifyImageRight = std::make_unique(nspr, m_pos.x + iWidth - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); miModifyImageRight->Show(false); } @@ -96,12 +96,12 @@ void MI_PlaylistField::Draw() return; //Draw the select field background - spr->draw(ix, iy, 0, (fSelected ? 32 : 0), iIndent - 16, 32); - spr->draw(ix + iIndent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - spr->draw(ix + iIndent + 16, iy, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); + spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0), iIndent - 16, 32); + spr->draw(m_pos.x + iIndent - 16, m_pos.y, 0, (fSelected ? 96 : 64), 32, 32); + spr->draw(m_pos.x + iIndent + 16, m_pos.y, 528 - iWidth + iIndent, (fSelected ? 32 : 0), iWidth - iIndent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, iIndent - 8, szName.c_str()); - rm->menu_font_large.drawChopRight(ix + iIndent + 8, iy + 5, iWidth - iIndent - 24, musiclist->currentName().c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 16, m_pos.y + 5, iIndent - 8, szName.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + iIndent + 8, m_pos.y + 5, iWidth - iIndent - 24, musiclist->currentName().c_str()); miModifyImageLeft->Draw(); miModifyImageRight->Draw(); diff --git a/src/smw/ui/MI_PowerupSelection.cpp b/src/smw/ui/MI_PowerupSelection.cpp index 3205b43f..46e92fe2 100644 --- a/src/smw/ui/MI_PowerupSelection.cpp +++ b/src/smw/ui/MI_PowerupSelection.cpp @@ -73,7 +73,7 @@ MI_PowerupSelection::MI_PowerupSelection(short x, short y, short width, short nu { mMenu = std::make_unique(); - miOverride = new MI_SelectField(&rm->spr_selectfield, 70, iy, "Use Settings From", 500, 250); + miOverride = new MI_SelectField(&rm->spr_selectfield, 70, m_pos.y, "Use Settings From", 500, 250); miOverride->add("Map Only", 0); miOverride->add("Game Only", 1); miOverride->add("Basic Average", 2); @@ -82,7 +82,7 @@ MI_PowerupSelection::MI_PowerupSelection(short x, short y, short width, short nu miOverride->setCurrentValue(game_values.overridepowerupsettings); //miOverride->SetItemChangedCode(MENU_CODE_POWERUP_OVERRIDE_CHANGED); - miPreset = new MI_SelectField(&rm->spr_selectfield, 70, iy + 40, "Item Set", 500, 250); + miPreset = new MI_SelectField(&rm->spr_selectfield, 70, m_pos.y + 40, "Item Set", 500, 250); miPreset->add("Custom Set 1", 0); miPreset->add("Custom Set 2", 1); miPreset->add("Custom Set 3", 2); @@ -217,7 +217,7 @@ void MI_PowerupSelection::SetupPowerupFields() slider->Show(false); else { slider->Show(true); - slider->SetPosition(ix + (iPosition % 2) * 295, iy + 84 + 38 * (iPosition / 2 - iOffset)); + slider->SetPosition(m_pos.x + (iPosition % 2) * 295, m_pos.y + 84 + 38 * (iPosition / 2 - iOffset)); } } } diff --git a/src/smw/ui/MI_PowerupSlider.cpp b/src/smw/ui/MI_PowerupSlider.cpp index c907e72b..08144a9a 100644 --- a/src/smw/ui/MI_PowerupSlider.cpp +++ b/src/smw/ui/MI_PowerupSlider.cpp @@ -10,8 +10,8 @@ MI_PowerupSlider::MI_PowerupSlider(gfxSprite* nspr, gfxSprite* nsprSlider, gfxSp , m_powerupIndex(powerupIndex) , m_halfWidth((width - 38) / 2) { - miModifyImageLeft->SetPosition(ix + 25, iy + 4); - miModifyImageRight->SetPosition(ix + m_width - 12, iy + 4); + miModifyImageLeft->SetPosition(m_pos.x + 25, m_pos.y + 4); + miModifyImageRight->SetPosition(m_pos.x + m_width - 12, m_pos.y + 4); } void MI_PowerupSlider::Draw() @@ -19,24 +19,24 @@ void MI_PowerupSlider::Draw() if (!fShow) return; - m_spr->draw(ix + 38, iy, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_halfWidth, 32); - m_spr->draw(ix + 38 + m_halfWidth, iy, 550 - m_width + m_halfWidth, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_halfWidth - 38, 32); + m_spr->draw(m_pos.x + 38, m_pos.y, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_halfWidth, 32); + m_spr->draw(m_pos.x + 38 + m_halfWidth, m_pos.y, 550 - m_width + m_halfWidth, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_halfWidth - 38, 32); short iSpacing = (m_width - 100) / ((short)m_items.size() - 1); short iSpot = 0; for (unsigned int index = 0; index < m_items.size(); index++) { if (index < m_items.size() - 1) - m_sprSlider->draw(ix + iSpot + 56, iy + 10, 0, 0, iSpacing, 13); + m_sprSlider->draw(m_pos.x + iSpot + 56, m_pos.y + 10, 0, 0, iSpacing, 13); else - m_sprSlider->draw(ix + iSpot + 56, iy + 10, 164, 0, 4, 13); + m_sprSlider->draw(m_pos.x + iSpot + 56, m_pos.y + 10, 164, 0, 4, 13); iSpot += iSpacing; } - m_sprSlider->draw(ix + (m_index * iSpacing) + 54, iy + 8, 168, 0, 8, 16); - m_sprSlider->draw(ix + m_width - 34, iy + 8, m_index * 16, 16, 16, 16); - m_sprPowerup->draw(ix, iy, m_powerupIndex * 32, 0, 32, 32); + m_sprSlider->draw(m_pos.x + (m_index * iSpacing) + 54, m_pos.y + 8, 168, 0, 8, 16); + m_sprSlider->draw(m_pos.x + m_width - 34, m_pos.y + 8, m_index * 16, 16, 16, 16); + m_sprPowerup->draw(m_pos.x, m_pos.y, m_powerupIndex * 32, 0, 32, 32); const bool drawLeft = m_index > 0; if (m_wraps || drawLeft) diff --git a/src/smw/ui/MI_StoredPowerupResetButton.cpp b/src/smw/ui/MI_StoredPowerupResetButton.cpp index 78740a7d..84b5fbfb 100644 --- a/src/smw/ui/MI_StoredPowerupResetButton.cpp +++ b/src/smw/ui/MI_StoredPowerupResetButton.cpp @@ -20,7 +20,7 @@ void MI_StoredPowerupResetButton::Draw() MI_Button::Draw(); for (short iPowerup = 0; iPowerup < 4; iPowerup++) { - rm->spr_selectfield.draw(ix + iWidth - 142 + iPowerup * 30, iy + 4, 188, 88, 24, 24); - rm->spr_storedpowerupsmall.draw(ix + iWidth - 138 + iPowerup * 30, iy + 8, game_values.storedpowerups[iPowerup] * 16, 0, 16, 16); + rm->spr_selectfield.draw(m_pos.x + iWidth - 142 + iPowerup * 30, m_pos.y + 4, 188, 88, 24, 24); + rm->spr_storedpowerupsmall.draw(m_pos.x + iWidth - 138 + iPowerup * 30, m_pos.y + 8, game_values.storedpowerups[iPowerup] * 16, 0, 16, 16); } } diff --git a/src/smw/ui/MI_StringScroll.cpp b/src/smw/ui/MI_StringScroll.cpp index 8c331af1..e78ad48a 100644 --- a/src/smw/ui/MI_StringScroll.cpp +++ b/src/smw/ui/MI_StringScroll.cpp @@ -136,21 +136,21 @@ void MI_StringScroll::Draw() if (!fShow) return; - rm->menu_dialog.draw(ix, iy, 0, 0, iWidth - 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix + iWidth - 16, iy, 496, 0, 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix, iy + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); - rm->menu_dialog.draw(ix + iWidth - 16, iy + iNumLines * 32 + 32, 496, 464, 16, 16); + rm->menu_dialog.draw(m_pos.x, m_pos.y, 0, 0, iWidth - 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y, 496, 0, 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x, m_pos.y + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y + iNumLines * 32 + 32, 496, 464, 16, 16); - rm->menu_font_large.drawCentered(ix + (iWidth >> 1), iy + 5, sTitle.c_str()); + rm->menu_font_large.drawCentered(m_pos.x + (iWidth >> 1), m_pos.y + 5, sTitle.c_str()); //Draw each filter field for (short iLine = 0; iLine < iNumLines && (unsigned short)iLine < items.size(); iLine++) { short iLineWidth = iWidth - 32; short iHalfLineWidth = iLineWidth >> 1; - spr->draw(ix + 16, iy + 32 + iLine * 32, 0, (iSelectedLine == iLine ? 32 : 0), iHalfLineWidth, 32); - spr->draw(ix + 16 + iHalfLineWidth, iy + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine ? 32 : 0), iLineWidth - iHalfLineWidth, 32); + spr->draw(m_pos.x + 16, m_pos.y + 32 + iLine * 32, 0, (iSelectedLine == iLine ? 32 : 0), iHalfLineWidth, 32); + spr->draw(m_pos.x + 16 + iHalfLineWidth, m_pos.y + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine ? 32 : 0), iLineWidth - iHalfLineWidth, 32); - items[iOffset + iLine].draw(ix, 32 + iy + iLine * 32, iWidth - 104); + items[iOffset + iLine].draw(m_pos.x, 32 + m_pos.y + iLine * 32, iWidth - 104); } } diff --git a/src/smw/ui/MI_TeamSelect.cpp b/src/smw/ui/MI_TeamSelect.cpp index 792f9e76..badaeefa 100644 --- a/src/smw/ui/MI_TeamSelect.cpp +++ b/src/smw/ui/MI_TeamSelect.cpp @@ -21,7 +21,7 @@ MI_TeamSelect::MI_TeamSelect(gfxSprite * spr_background_ref, short x, short y) : UI_Control(x, y) { spr = spr_background_ref; - miImage = new MI_Image(spr, ix, iy, 0, 0, 416, 256, 1, 1, 0); + miImage = new MI_Image(spr, m_pos.x, m_pos.y, 0, 0, 416, 256, 1, 1, 0); for (short iTeam = 0; iTeam < 4; iTeam++) { iTeamCounts[iTeam] = game_values.teamcounts[iTeam]; @@ -76,11 +76,11 @@ void MI_TeamSelect::Draw() short iPlayerID = iTeamIDs[iTeam][iTeamItem]; if (game_values.randomskin[iPlayerID]) - spr->draw(iTeam * 96 + 43 + ix, iTeamItem * 36 + 52 + iy, 416, fReady[iPlayerID] ? 0 : iRandomAnimationFrame, 42, 32); + spr->draw(iTeam * 96 + 43 + m_pos.x, iTeamItem * 36 + 52 + m_pos.y, 416, fReady[iPlayerID] ? 0 : iRandomAnimationFrame, 42, 32); else - rm->spr_player[iPlayerID][fReady[iPlayerID] ? 0 : iAnimationFrame]->draw(iTeam * 96 + 48 + ix, iTeamItem * 36 + 52 + iy, 0, 0, 32, 32); + rm->spr_player[iPlayerID][fReady[iPlayerID] ? 0 : iAnimationFrame]->draw(iTeam * 96 + 48 + m_pos.x, iTeamItem * 36 + 52 + m_pos.y, 0, 0, 32, 32); - rm->spr_menu_boxed_numbers.draw(iTeam * 96 + 44 + ix, iTeamItem * 36 + 72 + iy, iPlayerID * 16, game_values.colorids[iPlayerID] * 16, 16, 16); + rm->spr_menu_boxed_numbers.draw(iTeam * 96 + 44 + m_pos.x, iTeamItem * 36 + 72 + m_pos.y, iPlayerID * 16, game_values.colorids[iPlayerID] * 16, 16, 16); } if (game_values.playercontrol[iTeam] > 0) { @@ -94,9 +94,9 @@ void MI_TeamSelect::Draw() } if (fAllReady) { - rm->menu_plain_field.draw(ix + 108, iy + App::screenHeight * 0.47f, 0, 160, 100, 32); - rm->menu_plain_field.draw(ix + 208, iy + App::screenHeight * 0.47f, 412, 160, 100, 32); - rm->menu_font_large.drawCentered(App::screenWidth/2, iy + App::screenHeight * 0.48f, "Continue"); + rm->menu_plain_field.draw(m_pos.x + 108, m_pos.y + App::screenHeight * 0.47f, 0, 160, 100, 32); + rm->menu_plain_field.draw(m_pos.x + 208, m_pos.y + App::screenHeight * 0.47f, 412, 160, 100, 32); + rm->menu_font_large.drawCentered(App::screenWidth/2, m_pos.y + App::screenHeight * 0.48f, "Continue"); } } diff --git a/src/smw/ui/MI_TournamentScoreboard.cpp b/src/smw/ui/MI_TournamentScoreboard.cpp index d54d610e..8822f2e5 100644 --- a/src/smw/ui/MI_TournamentScoreboard.cpp +++ b/src/smw/ui/MI_TournamentScoreboard.cpp @@ -298,7 +298,7 @@ void MI_TournamentScoreboard::CreateScoreboard(short numTeams, short numGames, g if (fTour) iTeamY += 28; //shift down 28 pxls for extra tour points bar - miTeamImages[iTeam] = new MI_Image(sprBackground, ix - (fNotTournament ? 40 : 0), iTeamY, 0, game_values.matchtype == MatchType::World ? 160 : 0, fNotTournament ? 580 : 500, 64, 1, 2, 0); + miTeamImages[iTeam] = new MI_Image(sprBackground, m_pos.x - (fNotTournament ? 40 : 0), iTeamY, 0, game_values.matchtype == MatchType::World ? 160 : 0, fNotTournament ? 580 : 500, 64, 1, 2, 0); miIconImages[iTeam] = new MI_Image * [iNumGames]; miPlayerImages[iTeam] = new MI_Image * [iTeamCounts[iTeam]]; @@ -306,24 +306,24 @@ void MI_TournamentScoreboard::CreateScoreboard(short numTeams, short numGames, g for (short iGame = 0; iGame < iNumGames; iGame++) { float dSpacing = GetIconSpacing(); - miIconImages[iTeam][iGame] = new MI_Image(sprIcons, ix + 128 + (short)dSpacing + (short)((float)iGame * (32.0f + dSpacing)) - (fTour ? 40 : 0), iTeamY + 16, 0, 0, 32, 32, fTour ? 4 : 1, 1, fTour ? 8 : 0); + miIconImages[iTeam][iGame] = new MI_Image(sprIcons, m_pos.x + 128 + (short)dSpacing + (short)((float)iGame * (32.0f + dSpacing)) - (fTour ? 40 : 0), iTeamY + 16, 0, 0, 32, 32, fTour ? 4 : 1, 1, fTour ? 8 : 0); miIconImages[iTeam][iGame]->Show(false); } } for (short iPlayer = 0; iPlayer < iTeamCounts[iTeam]; iPlayer++) { - miPlayerImages[iTeam][iPlayer] = new MI_Image(rm->spr_player[iTeamIDs[iTeam][iPlayer]][PGFX_STANDING_R], ix + iScoreboardPlayerOffsetsX[iTeamCounts[iTeam] - 1][iPlayer] - (fTour ? 40 : 0), iTeamY + 16, 0, 0, 32, 32, 2, 1, 0); + miPlayerImages[iTeam][iPlayer] = new MI_Image(rm->spr_player[iTeamIDs[iTeam][iPlayer]][PGFX_STANDING_R], m_pos.x + iScoreboardPlayerOffsetsX[iTeamCounts[iTeam] - 1][iPlayer] - (fTour ? 40 : 0), iTeamY + 16, 0, 0, 32, 32, 2, 1, 0); } if (fNotTournament) tourScores[iTeam] = new MI_ScoreText(0, 0); if (game_values.matchtype == MatchType::World) { - worldPointsBackground[iTeam] = new MI_Image(sprBackground, ix + 476, iTeamY, 516, 160, 64, 64, 1, 2, 0); - worldPlace[iTeam] = new MI_Image(sprIcons, ix + 102, iTeamY + 14, 0, 0, 32, 32, 4, 1, 8); + worldPointsBackground[iTeam] = new MI_Image(sprBackground, m_pos.x + 476, iTeamY, 516, 160, 64, 64, 1, 2, 0); + worldPlace[iTeam] = new MI_Image(sprIcons, m_pos.x + 102, iTeamY + 14, 0, 0, 32, 32, 4, 1, 8); for (short iBonus = 0; iBonus < MAX_WORLD_BONUSES_AWARDED; iBonus++) { - worldBonus[iTeam][iBonus] = new MI_Image(&rm->spr_worlditems, ix + 180 + 38 * iBonus, iTeamY + 14, 0, 0, 32, 32, 1, 1, 0); + worldBonus[iTeam][iBonus] = new MI_Image(&rm->spr_worlditems, m_pos.x + 180 + 38 * iBonus, iTeamY + 14, 0, 0, 32, 32, 1, 1, 0); worldBonus[iTeam][iBonus]->Show(false); } } @@ -337,7 +337,7 @@ void MI_TournamentScoreboard::CreateScoreboard(short numTeams, short numGames, g if (fTour) { for (short iGame = 0; iGame < iNumGames; iGame++) { float dSpacing = GetIconSpacing(); - short iTourPointX = ix + 105 + (short)dSpacing + (short)((float)iGame * (32.0f + dSpacing)); + short iTourPointX = m_pos.x + 105 + (short)dSpacing + (short)((float)iGame * (32.0f + dSpacing)); tourPoints[iGame] = new MI_ScoreText(iTourPointX, GetYFromPlace(0)); tourPoints[iGame]->SetScore(game_values.tourstops[iGame]->iPoints); @@ -347,7 +347,7 @@ void MI_TournamentScoreboard::CreateScoreboard(short numTeams, short numGames, g // tourBonus[iGame] = new MI_Image(sprBackground, iTourPointX - 11, GetYFromPlace(0) - 3, 448, 128, 22, 22, 1, 1, 0); } - miTourPointBar = new MI_Image(sprBackground, ix + 88, GetYFromPlace(0) - 8, 0, 128, 372, 32, 1, 1, 0); + miTourPointBar = new MI_Image(sprBackground, m_pos.x + 88, GetYFromPlace(0) - 8, 0, 128, 372, 32, 1, 1, 0); } fCreated = true; @@ -363,16 +363,16 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) for (short iTeam = 0; iTeam < iNumTeams; iTeam++) { short iTeamY = GetYFromPlace(game_values.tournament_scores[iTeam].wins); - miTeamImages[iTeam]->SetPosition(ix - 40, iTeamY); - worldPointsBackground[iTeam]->SetPosition(ix + 476, iTeamY); + miTeamImages[iTeam]->SetPosition(m_pos.x - 40, iTeamY); + worldPointsBackground[iTeam]->SetPosition(m_pos.x + 476, iTeamY); for (short iPlayer = 0; iPlayer < iTeamCounts[iTeam]; iPlayer++) { static short iPlaceSprite[4] = {4, 0, 8, 9}; - miPlayerImages[iTeam][iPlayer]->SetPosition(ix + iScoreboardPlayerOffsetsX[iTeamCounts[iTeam] - 1][iPlayer] - 40, iTeamY + 16); + miPlayerImages[iTeam][iPlayer]->SetPosition(m_pos.x + iScoreboardPlayerOffsetsX[iTeamCounts[iTeam] - 1][iPlayer] - 40, iTeamY + 16); miPlayerImages[iTeam][iPlayer]->SetImageSource(rm->spr_player[iTeamIDs[iTeam][iPlayer]][iPlaceSprite[game_values.tournament_scores[iTeam].wins]]); } - tourScores[iTeam]->SetPosition(ix + 508, iTeamY + 24); + tourScores[iTeam]->SetPosition(m_pos.x + 508, iTeamY + 24); tourScores[iTeam]->SetScore(game_values.tournament_scores[iTeam].total); if (iGameWinner == -1) { @@ -381,7 +381,7 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) } if (iGameWinner == iTeam) { - worldScore->SetPosition(ix + 350, iTeamY + 24); + worldScore->SetPosition(m_pos.x + 350, iTeamY + 24); worldScore->SetScore(tourStop->iPoints); worldScore->Show(true); @@ -389,7 +389,7 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) if (game_values.worldpointsbonus >= 0) { worldScoreModifier->SetImage((game_values.worldpointsbonus + 9) << 5, 0, 32, 32); - worldScoreModifier->SetPosition(ix + 410, iTeamY + 14); + worldScoreModifier->SetPosition(m_pos.x + 410, iTeamY + 14); worldScoreModifier->Show(true); } else { worldScoreModifier->Show(false); @@ -398,7 +398,7 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) miTeamImages[iTeam]->SetImage(0, 160, 344, 64); } - worldPlace[iTeam]->SetPosition(ix + 102, iTeamY + 14); + worldPlace[iTeam]->SetPosition(m_pos.x + 102, iTeamY + 14); worldPlace[iTeam]->SetImage(0, score[iTeam]->place << 5, 32, 32); worldPlace[iTeam]->Show(gameWinner >= 0); } @@ -448,18 +448,18 @@ void MI_TournamentScoreboard::RefreshTourScores() float dSpacing = GetIconSpacing(); - miTeamImages[iTeam]->SetPosition(ix - 40, iTeamY); + miTeamImages[iTeam]->SetPosition(m_pos.x - 40, iTeamY); for (short iPlayer = 0; iPlayer < iTeamCounts[iTeam]; iPlayer++) { static short iPlaceSprite[4] = {4, 0, 8, 9}; - miPlayerImages[iTeam][iPlayer]->SetPosition(ix + iScoreboardPlayerOffsetsX[iTeamCounts[iTeam] - 1][iPlayer] - 40, iTeamY + 16); + miPlayerImages[iTeam][iPlayer]->SetPosition(m_pos.x + iScoreboardPlayerOffsetsX[iTeamCounts[iTeam] - 1][iPlayer] - 40, iTeamY + 16); miPlayerImages[iTeam][iPlayer]->SetImageSource(rm->spr_player[iTeamIDs[iTeam][iPlayer]][iPlaceSprite[game_values.tournament_scores[iTeam].wins]]); } for (short iGame = 0; iGame < game_values.tourstopcurrent; iGame++) { miIconImages[iTeam][iGame]->SetImage(0, game_values.tournament_scores[iTeam].type[iGame] * 32, 32, 32); - miIconImages[iTeam][iGame]->SetPosition(ix + 128 + (short)dSpacing + (short)((float)iGame * (32.0f + dSpacing)) - 40, iTeamY + 16); + miIconImages[iTeam][iGame]->SetPosition(m_pos.x + 128 + (short)dSpacing + (short)((float)iGame * (32.0f + dSpacing)) - 40, iTeamY + 16); miIconImages[iTeam][iGame]->SetSwirl(false, 0.0f, 0.0f, 0.0f, 0.0f); miIconImages[iTeam][iGame]->SetPulse(false); @@ -470,7 +470,7 @@ void MI_TournamentScoreboard::RefreshTourScores() miIconImages[iTeam][iGame]->Show(false); } - tourScores[iTeam]->SetPosition(ix + 508, iTeamY + 24); + tourScores[iTeam]->SetPosition(m_pos.x + 508, iTeamY + 24); tourScores[iTeam]->SetScore(game_values.tournament_scores[iTeam].total); } } diff --git a/src/smw/ui/MI_TournamentScoreboard.h b/src/smw/ui/MI_TournamentScoreboard.h index 20749682..a4452f51 100644 --- a/src/smw/ui/MI_TournamentScoreboard.h +++ b/src/smw/ui/MI_TournamentScoreboard.h @@ -26,7 +26,7 @@ class MI_TournamentScoreboard : public UI_Control { private: void FreeScoreboard(); short GetYFromPlace(short iPlace) const { - return iy + iPlace * 69 + (4 - iNumTeams) * 35; + return m_pos.y + iPlace * 69 + (4 - iNumTeams) * 35; } float GetIconSpacing() const { return (float)(372 - iNumGames * 32) / (float)(iNumGames + 1); diff --git a/src/smw/ui/MI_WorldPreviewDisplay.cpp b/src/smw/ui/MI_WorldPreviewDisplay.cpp index a5bf366e..846e3ddb 100644 --- a/src/smw/ui/MI_WorldPreviewDisplay.cpp +++ b/src/smw/ui/MI_WorldPreviewDisplay.cpp @@ -54,8 +54,8 @@ void MI_WorldPreviewDisplay::Init() rectDstSurface.w = 320; rectDstSurface.h = 240; - rectDstSurface.x = ix; - rectDstSurface.y = iy; + rectDstSurface.x = m_pos.x; + rectDstSurface.y = m_pos.y; if (g_worldmap.iWidth < 20) rectDstSurface.x += (20 - g_worldmap.iWidth) * 8; diff --git a/src/smw/ui/NetworkListScroll.cpp b/src/smw/ui/NetworkListScroll.cpp index 071b1e05..5a07fbf3 100644 --- a/src/smw/ui/NetworkListScroll.cpp +++ b/src/smw/ui/NetworkListScroll.cpp @@ -144,22 +144,22 @@ void MI_NetworkListScroll::Draw() return; //Draw the background for the map preview - rm->menu_dialog.draw(ix, iy, 0, 0, iWidth - 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix + iWidth - 16, iy, 496, 0, 16, iNumLines * 32 + 32); - rm->menu_dialog.draw(ix, iy + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); - rm->menu_dialog.draw(ix + iWidth - 16, iy + iNumLines * 32 + 32, 496, 464, 16, 16); + rm->menu_dialog.draw(m_pos.x, m_pos.y, 0, 0, iWidth - 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y, 496, 0, 16, iNumLines * 32 + 32); + rm->menu_dialog.draw(m_pos.x, m_pos.y + iNumLines * 32 + 32, 0, 464, iWidth - 16, 16); + rm->menu_dialog.draw(m_pos.x + iWidth - 16, m_pos.y + iNumLines * 32 + 32, 496, 464, 16, 16); - rm->menu_font_large.drawCentered(ix + (iWidth >> 1), iy + 5, sTitle.c_str()); + rm->menu_font_large.drawCentered(m_pos.x + (iWidth >> 1), m_pos.y + 5, sTitle.c_str()); //Draw each filter field for (short iLine = 0; iLine < iNumLines && (unsigned short)iLine < items.size(); iLine++) { short iHalfLineWidth = (iWidth - 32) >> 1; short iLineWidth = iWidth - 32; - spr->draw(ix + 16, iy + 32 + iLine * 32, 0, (iSelectedLine == iLine ? 32 : 0), iHalfLineWidth, 32); - spr->draw(ix + 16 + iHalfLineWidth, iy + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine ? 32 : 0), iLineWidth - iHalfLineWidth, 32); + spr->draw(m_pos.x + 16, m_pos.y + 32 + iLine * 32, 0, (iSelectedLine == iLine ? 32 : 0), iHalfLineWidth, 32); + spr->draw(m_pos.x + 16 + iHalfLineWidth, m_pos.y + 32 + iLine * 32, 512 - iLineWidth + iHalfLineWidth, (iSelectedLine == iLine ? 32 : 0), iLineWidth - iHalfLineWidth, 32); - rm->menu_font_large.drawChopRight(ix + 28, iy + 5 + iLine * 32 + 32, iWidth - 104, items[iOffset + iLine].sLeft.c_str()); - rm->menu_font_large.drawRightJustified(ix + 28 + iWidth - 64, iy + 5 + iLine * 32 + 32, items[iOffset + iLine].sRight.c_str()); + rm->menu_font_large.drawChopRight(m_pos.x + 28, m_pos.y + 5 + iLine * 32 + 32, iWidth - 104, items[iOffset + iLine].sLeft.c_str()); + rm->menu_font_large.drawRightJustified(m_pos.x + 28 + iWidth - 64, m_pos.y + 5 + iLine * 32 + 32, items[iOffset + iLine].sRight.c_str()); } } From 67b9f0aeb6b16b3def48d1cab621aac0611662ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Mustoha?= Date: Tue, 2 Jul 2024 16:46:20 +0200 Subject: [PATCH 3/4] Visibility code refacoring in the UI elements --- src/common/ui/MI_Button.cpp | 2 +- src/common/ui/MI_Image.cpp | 4 +- src/common/ui/MI_ImageSelectField.cpp | 2 +- src/common/ui/MI_MapField.cpp | 14 +-- src/common/ui/MI_MapPreview.cpp | 2 +- src/common/ui/MI_ScoreText.cpp | 2 +- src/common/ui/MI_SelectField.cpp | 18 ++-- src/common/ui/MI_SliderField.cpp | 2 +- src/common/ui/MI_Text.cpp | 2 +- src/common/ui/MI_TextField.cpp | 8 +- src/common/uicontrol.cpp | 2 +- src/common/uicontrol.h | 8 +- src/smw/GSMenu.cpp | 2 +- src/smw/menu/GameSettingsMenu.cpp | 48 ++++----- src/smw/menu/MatchSelectionMenu.cpp | 32 +++--- src/smw/menu/OptionsMenu.cpp | 30 +++--- src/smw/menu/TourStopMenu.cpp | 24 ++--- src/smw/menu/WorldMenu.cpp | 30 +++--- src/smw/menu/network/NetEditServersMenu.cpp | 24 ++--- src/smw/menu/network/NetLobbyMenu.cpp | 12 +-- src/smw/menu/network/NetNewRoomMenu.cpp | 12 +-- .../menu/network/NetNewRoomSettingsMenu.cpp | 2 +- src/smw/menu/network/NetRoomMenu.cpp | 12 +-- src/smw/menu/network/NetServersMenu.cpp | 18 ++-- src/smw/ui/MI_AnnouncerField.cpp | 14 +-- src/smw/ui/MI_BonusWheel.cpp | 8 +- src/smw/ui/MI_FrenzyModeOptions.cpp | 16 +-- src/smw/ui/MI_InputControlContainer.cpp | 8 +- src/smw/ui/MI_MapBrowser.cpp | 2 +- src/smw/ui/MI_MapFilterScroll.cpp | 2 +- src/smw/ui/MI_NetRoomTeamSelect.cpp | 18 ++-- src/smw/ui/MI_PlayerSelect.cpp | 8 +- src/smw/ui/MI_PlaylistField.cpp | 14 +-- src/smw/ui/MI_PowerupSelection.cpp | 46 ++++---- src/smw/ui/MI_PowerupSlider.cpp | 2 +- src/smw/ui/MI_StoredPowerupResetButton.cpp | 2 +- src/smw/ui/MI_StringScroll.cpp | 2 +- src/smw/ui/MI_TeamSelect.cpp | 2 +- src/smw/ui/MI_TourStop.cpp | 20 ++-- src/smw/ui/MI_TournamentScoreboard.cpp | 30 +++--- src/smw/ui/MI_World.cpp | 2 +- src/smw/ui/MI_WorldPreviewDisplay.cpp | 4 +- src/smw/ui/NetworkListScroll.cpp | 2 +- src/worldeditor/worldeditor.cpp | 102 +++++++++--------- 44 files changed, 308 insertions(+), 308 deletions(-) diff --git a/src/common/ui/MI_Button.cpp b/src/common/ui/MI_Button.cpp index f8452246..2adaa76f 100644 --- a/src/common/ui/MI_Button.cpp +++ b/src/common/ui/MI_Button.cpp @@ -36,7 +36,7 @@ MenuCodeEnum MI_Button::SendInput(CPlayerInput*) void MI_Button::Draw() { - if (!fShow) + if (!m_visible) return; spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + iAdjustmentY, iHalfWidth, 32); diff --git a/src/common/ui/MI_Image.cpp b/src/common/ui/MI_Image.cpp index a1e31ccc..ed3dc8db 100644 --- a/src/common/ui/MI_Image.cpp +++ b/src/common/ui/MI_Image.cpp @@ -26,7 +26,7 @@ MI_Image::MI_Image( void MI_Image::Update() { - if (!fShow) + if (!m_visible) return; if (iSpeed > 0 && ++iTimer >= iSpeed) { @@ -79,7 +79,7 @@ void MI_Image::Update() void MI_Image::Draw() { - if (!fShow || (fBlink && !fBlinkShow)) + if (!m_visible || (fBlink && !fBlinkShow)) return; short iXOffset = 0; diff --git a/src/common/ui/MI_ImageSelectField.cpp b/src/common/ui/MI_ImageSelectField.cpp index bc4de957..6b1d01dd 100644 --- a/src/common/ui/MI_ImageSelectField.cpp +++ b/src/common/ui/MI_ImageSelectField.cpp @@ -23,7 +23,7 @@ MI_ImageSelectField::MI_ImageSelectField( void MI_ImageSelectField::Draw() { - if (!fShow) + if (!m_visible) return; m_spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0), m_indent - 16, 32); diff --git a/src/common/ui/MI_MapField.cpp b/src/common/ui/MI_MapField.cpp index f7e7155d..6e2c619b 100644 --- a/src/common/ui/MI_MapField.cpp +++ b/src/common/ui/MI_MapField.cpp @@ -25,10 +25,10 @@ MI_MapField::MI_MapField(gfxSprite* nspr, short x, short y, std::string name, sh , fShowtags(showtags) { miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); - miModifyImageLeft->Show(false); + miModifyImageLeft->setVisible(false); miModifyImageRight = std::make_unique(nspr, m_pos.x + iWidth - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); - miModifyImageRight->Show(false); + miModifyImageRight->setVisible(false); if (fShowtags) { iSlideListOut = (iWidth - 352) >> 1; @@ -44,8 +44,8 @@ MenuCodeEnum MI_MapField::Modify(bool modify) if (fDisable) return MENU_CODE_UNSELECT_ITEM; - miModifyImageLeft->Show(modify); - miModifyImageRight->Show(modify); + miModifyImageLeft->setVisible(modify); + miModifyImageRight->setVisible(modify); fModifying = modify; return MENU_CODE_MODIFY_ACCEPTED; @@ -107,8 +107,8 @@ MenuCodeEnum MI_MapField::SendInput(CPlayerInput * playerInput) } if (playerInput->outputControls[iPlayer].menu_select.fPressed || playerInput->outputControls[iPlayer].menu_cancel.fPressed) { - miModifyImageLeft->Show(false); - miModifyImageRight->Show(false); + miModifyImageLeft->setVisible(false); + miModifyImageRight->setVisible(false); fModifying = false; return MENU_CODE_UNSELECT_ITEM; @@ -188,7 +188,7 @@ void MI_MapField::Update() void MI_MapField::Draw() { - if (!fShow) + if (!m_visible) return; //Draw the select field background diff --git a/src/common/ui/MI_MapPreview.cpp b/src/common/ui/MI_MapPreview.cpp index 65b5682d..630461eb 100644 --- a/src/common/ui/MI_MapPreview.cpp +++ b/src/common/ui/MI_MapPreview.cpp @@ -67,7 +67,7 @@ void MI_MapPreview::Update() void MI_MapPreview::Draw() { - if (!fShow) + if (!m_visible) return; short iMapBoxX = m_pos.x + (iWidth >> 1) - 176 - iSlideListOut; diff --git a/src/common/ui/MI_ScoreText.cpp b/src/common/ui/MI_ScoreText.cpp index c137440d..73f855d5 100644 --- a/src/common/ui/MI_ScoreText.cpp +++ b/src/common/ui/MI_ScoreText.cpp @@ -11,7 +11,7 @@ MI_ScoreText::MI_ScoreText(short x, short y) void MI_ScoreText::Draw() { - if (!fShow) + if (!m_visible) return; rm->spr_scoretext.draw(iDigitRightDstX, m_pos.y, iDigitRightSrcX, 0, 16, 16); diff --git a/src/common/ui/MI_SelectField.cpp b/src/common/ui/MI_SelectField.cpp index 487e7fa4..81013805 100644 --- a/src/common/ui/MI_SelectField.cpp +++ b/src/common/ui/MI_SelectField.cpp @@ -19,10 +19,10 @@ MI_SelectField::MI_SelectField(gfxSprite* nspr, short x, short y, std::string , m_indent(indent) { miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); - miModifyImageLeft->Show(false); + miModifyImageLeft->setVisible(false); miModifyImageRight = std::make_unique(nspr, m_pos.x + width - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); - miModifyImageRight->Show(false); + miModifyImageRight->setVisible(false); } @@ -46,10 +46,10 @@ MI_SelectField::MI_SelectField(const MI_SelectField& other) setCurrentIndex(other.m_index); miModifyImageLeft = std::make_unique(m_spr, m_pos.x + m_indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); - miModifyImageLeft->Show(false); + miModifyImageLeft->setVisible(false); miModifyImageRight = std::make_unique(m_spr, m_pos.x + m_width - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); - miModifyImageRight->Show(false); + miModifyImageRight->setVisible(false); } @@ -64,7 +64,7 @@ void MI_SelectField::Update() template void MI_SelectField::Draw() { - if (!fShow) + if (!m_visible) return; if (m_indent == 0) { @@ -109,8 +109,8 @@ MenuCodeEnum MI_SelectField::Modify(bool modify) if (MENU_CODE_NONE != mcControlSelectedCode) return mcControlSelectedCode; - miModifyImageLeft->Show(modify); - miModifyImageRight->Show(modify); + miModifyImageLeft->setVisible(modify); + miModifyImageRight->setVisible(modify); fModifying = modify; return MENU_CODE_MODIFY_ACCEPTED; } @@ -150,8 +150,8 @@ MenuCodeEnum MI_SelectField::SendInput(CPlayerInput * playerInput) } if (playerInput->outputControls[iPlayer].menu_select.fPressed || playerInput->outputControls[iPlayer].menu_cancel.fPressed) { - miModifyImageLeft->Show(false); - miModifyImageRight->Show(false); + miModifyImageLeft->setVisible(false); + miModifyImageRight->setVisible(false); fModifying = false; diff --git a/src/common/ui/MI_SliderField.cpp b/src/common/ui/MI_SliderField.cpp index 394e6c99..de3fd8aa 100644 --- a/src/common/ui/MI_SliderField.cpp +++ b/src/common/ui/MI_SliderField.cpp @@ -31,7 +31,7 @@ void MI_SliderField::SetPosition(short x, short y) void MI_SliderField::Draw() { - if (!fShow) + if (!m_visible) return; m_spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_indent - 16, 32); diff --git a/src/common/ui/MI_Text.cpp b/src/common/ui/MI_Text.cpp index 3709d450..762ee56c 100644 --- a/src/common/ui/MI_Text.cpp +++ b/src/common/ui/MI_Text.cpp @@ -20,7 +20,7 @@ void MI_Text::SetText(std::string text) void MI_Text::Draw() { - if (!fShow) + if (!m_visible) return; if (m_align == TextAlign::LEFT && iw == 0) diff --git a/src/common/ui/MI_TextField.cpp b/src/common/ui/MI_TextField.cpp index d1cb8bf4..bd41a0bd 100644 --- a/src/common/ui/MI_TextField.cpp +++ b/src/common/ui/MI_TextField.cpp @@ -26,7 +26,7 @@ MI_TextField::MI_TextField(gfxSprite * nspr, short x, short y, const char * name { miModifyCursor = std::make_unique(nspr, m_pos.x + indent, m_pos.y + 4, 136, 64, 15, 24, 4, 1, 8); miModifyCursor->SetBlink(true, 20); - miModifyCursor->Show(false); + miModifyCursor->setVisible(false); } void MI_TextField::SetTitle(std::string name) @@ -42,7 +42,7 @@ MenuCodeEnum MI_TextField::Modify(bool modify) if (MENU_CODE_NONE != mcControlSelectedCode) return mcControlSelectedCode; - miModifyCursor->Show(modify); + miModifyCursor->setVisible(modify); fModifying = modify; return MENU_CODE_MODIFY_ACCEPTED; } @@ -65,7 +65,7 @@ MenuCodeEnum MI_TextField::SendInput(CPlayerInput * playerInput) } if (playerInput->outputControls[iPlayer].menu_select.fPressed || playerInput->outputControls[iPlayer].menu_cancel.fPressed) { - miModifyCursor->Show(false); + miModifyCursor->setVisible(false); fModifying = false; @@ -183,7 +183,7 @@ void MI_TextField::Update() void MI_TextField::Draw() { - if (!fShow) + if (!m_visible) return; spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0) + iAdjustmentY, iIndent - 16, 32); diff --git a/src/common/uicontrol.cpp b/src/common/uicontrol.cpp index 783de064..2d093cce 100644 --- a/src/common/uicontrol.cpp +++ b/src/common/uicontrol.cpp @@ -19,7 +19,7 @@ UI_Control& UI_Control::operator= (const UI_Control& other) fModifying = other.fModifying; fAutoModify = other.fAutoModify; fDisable = other.fDisable; - fShow = other.fShow; + m_visible = other.m_visible; uiMenu = nullptr; neighborControls.fill(nullptr); diff --git a/src/common/uicontrol.h b/src/common/uicontrol.h index 9204ad6d..57a716a4 100644 --- a/src/common/uicontrol.h +++ b/src/common/uicontrol.h @@ -69,11 +69,11 @@ class UI_Control return neighborControls[iNeighbor]; } - void Show(bool show) { - fShow = show; + void setVisible(bool show) { + m_visible = show; } bool IsVisible() const { - return fShow; + return m_visible; } void SetMenuParent(UI_Menu* menu) { @@ -105,7 +105,7 @@ class UI_Control bool fModifying = false; bool fAutoModify = false; bool fDisable = false; - bool fShow = true; + bool m_visible = true; std::array neighborControls; diff --git a/src/smw/GSMenu.cpp b/src/smw/GSMenu.cpp index 0560075f..58542dda 100644 --- a/src/smw/GSMenu.cpp +++ b/src/smw/GSMenu.cpp @@ -913,7 +913,7 @@ void MenuState::update() game_values.storedpowerups[iPlayer] = -1; ResetTournamentBackToMainMenu(); - mWorldMenu->miWorldStop->Show(false); + mWorldMenu->miWorldStop->setVisible(false); } } else if (MENU_CODE_BONUS_DONE == code) { if (mBonusWheelMenu->miBonusWheel->GetPowerupSelectionDone()) { diff --git a/src/smw/menu/GameSettingsMenu.cpp b/src/smw/menu/GameSettingsMenu.cpp index 67db23be..64e82338 100644 --- a/src/smw/menu/GameSettingsMenu.cpp +++ b/src/smw/menu/GameSettingsMenu.cpp @@ -57,7 +57,7 @@ UI_GameSettingsMenu::UI_GameSettingsMenu() for (short iGameMode = 0; iGameMode < GAMEMODE_LAST; iGameMode++) { miGoalField[iGameMode] = new MI_SelectField(&rm->spr_selectfield, 70, 125, gamemodes[iGameMode]->GetGoalName().c_str(), 352, 120); // miGoalField[iGameMode]->SetKey(gamemodes[iGameMode]->goal); - miGoalField[iGameMode]->Show(iGameMode == 0); + miGoalField[iGameMode]->setVisible(iGameMode == 0); for (short iGameModeOption = 0; iGameModeOption < GAMEMODE_NUM_OPTIONS; iGameModeOption++) { SModeOption* option = &gamemodes[iGameMode]->GetOptions()[iGameModeOption]; @@ -77,14 +77,14 @@ UI_GameSettingsMenu::UI_GameSettingsMenu() miMapFiltersButton->SetCode(MENU_CODE_TO_MAP_FILTERS); miMapFiltersOnImage = new MI_Image(&rm->menu_map_filter, 530, 213, 0, 48, 16, 16, 1, 1, 0); - miMapFiltersOnImage->Show(false); + miMapFiltersOnImage->setVisible(false); miMapThumbnailsButton = new MI_Button(&rm->spr_selectfield, 430, 245, "Thumbs", 140); miMapThumbnailsButton->SetCode(MENU_CODE_TO_MAP_BROWSER_THUMBNAILS); miMapFilterScroll = new MI_MapFilterScroll(&rm->menu_plain_field, 120, 72, 400, 9); miMapFilterScroll->SetAutoModify(true); - miMapFilterScroll->Show(false); + miMapFilterScroll->setVisible(false); // Add auto map filters for (short iFilter = 0; iFilter < NUM_AUTO_FILTERS; iFilter++) { @@ -113,11 +113,11 @@ UI_GameSettingsMenu::UI_GameSettingsMenu() miGameSettingsExitDialogYesButton->SetCode(MENU_CODE_EXIT_TOURNAMENT_YES); miGameSettingsExitDialogNoButton->SetCode(MENU_CODE_EXIT_TOURNAMENT_NO); - miGameSettingsExitDialogImage->Show(false); - miGameSettingsExitDialogTournamentText->Show(false); - miGameSettingsExitDialogExitText->Show(false); - miGameSettingsExitDialogYesButton->Show(false); - miGameSettingsExitDialogNoButton->Show(false); + miGameSettingsExitDialogImage->setVisible(false); + miGameSettingsExitDialogTournamentText->setVisible(false); + miGameSettingsExitDialogExitText->setVisible(false); + miGameSettingsExitDialogYesButton->setVisible(false); + miGameSettingsExitDialogNoButton->setVisible(false); AddControl(miSettingsStartButton, miMapThumbnailsButton, miModeField, NULL, NULL); AddControl(miModeField, miSettingsStartButton, miGoalField[0], NULL, NULL); @@ -157,17 +157,17 @@ UI_GameSettingsMenu::UI_GameSettingsMenu() void UI_GameSettingsMenu::RefreshGameModeButtons() { // Unhide/hide the settings button - miModeSettingsButton->Show(miModeField->currentValue() != game_mode_owned); + miModeSettingsButton->setVisible(miModeField->currentValue() != game_mode_owned); // Show the approprate goal field for (short iMode = 0; iMode < GAMEMODE_LAST; iMode++) { - miGoalField[iMode]->Show(miModeField->currentValue() == iMode); + miGoalField[iMode]->setVisible(miModeField->currentValue() == iMode); } } void UI_GameSettingsMenu::OpenMapFilters() { - miMapFilterScroll->Show(true); + miMapFilterScroll->setVisible(true); RememberCurrent(); setInitialFocus(miMapFilterScroll); @@ -177,23 +177,23 @@ void UI_GameSettingsMenu::OpenMapFilters() void UI_GameSettingsMenu::CloseMapFilters() { - miMapFilterScroll->Show(false); + miMapFilterScroll->setVisible(false); setInitialFocus(miSettingsStartButton); SetCancelCode(MENU_CODE_BACK_TEAM_SELECT_MENU); RestoreCurrent(); - miMapFiltersOnImage->Show(game_values.fFiltersOn); + miMapFiltersOnImage->setVisible(game_values.fFiltersOn); } void UI_GameSettingsMenu::OpenExitDialog() { - miGameSettingsExitDialogImage->Show(true); - miGameSettingsExitDialogTournamentText->Show(true); - miGameSettingsExitDialogExitText->Show(true); - miGameSettingsExitDialogYesButton->Show(true); - miGameSettingsExitDialogNoButton->Show(true); + miGameSettingsExitDialogImage->setVisible(true); + miGameSettingsExitDialogTournamentText->setVisible(true); + miGameSettingsExitDialogExitText->setVisible(true); + miGameSettingsExitDialogYesButton->setVisible(true); + miGameSettingsExitDialogNoButton->setVisible(true); RememberCurrent(); @@ -204,11 +204,11 @@ void UI_GameSettingsMenu::OpenExitDialog() void UI_GameSettingsMenu::CloseExitDialog() { - miGameSettingsExitDialogImage->Show(false); - miGameSettingsExitDialogTournamentText->Show(false); - miGameSettingsExitDialogExitText->Show(false); - miGameSettingsExitDialogYesButton->Show(false); - miGameSettingsExitDialogNoButton->Show(false); + miGameSettingsExitDialogImage->setVisible(false); + miGameSettingsExitDialogTournamentText->setVisible(false); + miGameSettingsExitDialogExitText->setVisible(false); + miGameSettingsExitDialogYesButton->setVisible(false); + miGameSettingsExitDialogNoButton->setVisible(false); setInitialFocus(miSettingsStartButton); SetCancelCode(MENU_CODE_BACK_TEAM_SELECT_MENU); @@ -230,7 +230,7 @@ void UI_GameSettingsMenu::GameModeChanged(short gmID) void UI_GameSettingsMenu::HideGMSettingsBtn() { - miModeSettingsButton->Show(false); + miModeSettingsButton->setVisible(false); } short UI_GameSettingsMenu::GetCurrentGameModeID() diff --git a/src/smw/menu/MatchSelectionMenu.cpp b/src/smw/menu/MatchSelectionMenu.cpp index a754a210..280536b9 100644 --- a/src/smw/menu/MatchSelectionMenu.cpp +++ b/src/smw/menu/MatchSelectionMenu.cpp @@ -44,7 +44,7 @@ UI_MatchSelectionMenu::UI_MatchSelectionMenu() miTournamentField->add("10", 10); miTournamentField->setOutputPtr(&game_values.tournamentgames); miTournamentField->setCurrentValue(game_values.tournamentgames); - miTournamentField->Show(false); + miTournamentField->setVisible(false); miTourField = new MI_SelectField(&rm->spr_selectfield, 130, 380, "Tour", 380, 100); for (size_t iTour = 0; iTour < tourlist->count(); iTour++) { @@ -54,7 +54,7 @@ UI_MatchSelectionMenu::UI_MatchSelectionMenu() } miTourField->setOutputPtr(&game_values.tourindex); miTourField->setCurrentValue(game_values.tourindex); - miTourField->Show(false); + miTourField->setVisible(false); miWorldField = new MI_SelectField(&rm->spr_selectfield, 130, 380, "World", 380, 100); for (size_t iWorld = 0; iWorld < worldlist->count(); iWorld++) { @@ -64,7 +64,7 @@ UI_MatchSelectionMenu::UI_MatchSelectionMenu() miWorldField->setOutputPtr(&game_values.worldindex); miWorldField->setCurrentValue(game_values.worldindex); miWorldField->setItemChangedCode(MENU_CODE_WORLD_MAP_CHANGED); - miWorldField->Show(false); + miWorldField->setVisible(false); miMinigameField = new MI_SelectField(&rm->spr_selectfield, 130, 380, "Game", 380, 100); miMinigameField->add("Pipe Coin Game", Minigame::PipeCoin); @@ -74,7 +74,7 @@ UI_MatchSelectionMenu::UI_MatchSelectionMenu() miMinigameField->add("Boxes Game", Minigame::Boxes); miMinigameField->setOutputPtr(&game_values.selectedminigame); miMinigameField->setCurrentValue(game_values.selectedminigame); - miMinigameField->Show(false); + miMinigameField->setVisible(false); miMatchSelectionMenuLeftHeaderBar = new MI_Image(&rm->menu_plain_field, 0, 0, 0, 0, 320, 32, 1, 1, 0); miMatchSelectionMenuRightHeaderBar = new MI_Image(&rm->menu_plain_field, 320, 0, 192, 0, 320, 32, 1, 1, 0); @@ -82,7 +82,7 @@ UI_MatchSelectionMenu::UI_MatchSelectionMenu() miMatchSelectionDisplayImage = new MI_Image(&rm->menu_match_select, 160, 80, 0, 0, 320, 240, 1, 1, 0); miWorldPreviewDisplay = new MI_WorldPreviewDisplay(160, 80, 20, 15); - miWorldPreviewDisplay->Show(false); + miWorldPreviewDisplay->setVisible(false); AddNonControl(miMatchSelectionMenuLeftHeaderBar); AddNonControl(miMatchSelectionMenuRightHeaderBar); @@ -104,13 +104,13 @@ UI_MatchSelectionMenu::UI_MatchSelectionMenu() void UI_MatchSelectionMenu::SelectionChanged() { - miTournamentField->Show(game_values.matchtype == MatchType::Tournament); - miTourField->Show(game_values.matchtype == MatchType::Tour); - miWorldField->Show(game_values.matchtype == MatchType::World); - miMinigameField->Show(game_values.matchtype == MatchType::MiniGame); + miTournamentField->setVisible(game_values.matchtype == MatchType::Tournament); + miTourField->setVisible(game_values.matchtype == MatchType::Tour); + miWorldField->setVisible(game_values.matchtype == MatchType::World); + miMinigameField->setVisible(game_values.matchtype == MatchType::MiniGame); // miMatchSelectionDisplayImage->Show(game_values.matchtype != MatchType::World); - miWorldPreviewDisplay->Show(game_values.matchtype == MatchType::World); + miWorldPreviewDisplay->setVisible(game_values.matchtype == MatchType::World); if (game_values.matchtype == MatchType::World) miMatchSelectionDisplayImage->SetImage(320, 0, 320, 240); @@ -128,13 +128,13 @@ void UI_MatchSelectionMenu::ActivateMinigameField() miMatchSelectionField->hideItem(MatchType::MiniGame, false); miMatchSelectionField->setCurrentValue(MatchType::MiniGame); - miTournamentField->Show(false); - miTourField->Show(false); - miWorldField->Show(false); - miMinigameField->Show(true); + miTournamentField->setVisible(false); + miTourField->setVisible(false); + miWorldField->setVisible(false); + miMinigameField->setVisible(true); - miMatchSelectionDisplayImage->Show(true); - miWorldPreviewDisplay->Show(false); + miMatchSelectionDisplayImage->setVisible(true); + miWorldPreviewDisplay->setVisible(false); miMatchSelectionDisplayImage->SetImage(0, 240 * static_cast(game_values.matchtype), 320, 240); } diff --git a/src/smw/menu/OptionsMenu.cpp b/src/smw/menu/OptionsMenu.cpp index 36c591ed..58053beb 100644 --- a/src/smw/menu/OptionsMenu.cpp +++ b/src/smw/menu/OptionsMenu.cpp @@ -61,11 +61,11 @@ UI_OptionsMenu::UI_OptionsMenu() miGenerateThumbsDialogYesButton->SetCode(MENU_CODE_GENERATE_THUMBS_RESET_YES); miGenerateThumbsDialogNoButton->SetCode(MENU_CODE_GENERATE_THUMBS_RESET_NO); - miGenerateThumbsDialogImage->Show(false); - miGenerateThumbsDialogAreYouText->Show(false); - miGenerateThumbsDialogSureText->Show(false); - miGenerateThumbsDialogYesButton->Show(false); - miGenerateThumbsDialogNoButton->Show(false); + miGenerateThumbsDialogImage->setVisible(false); + miGenerateThumbsDialogAreYouText->setVisible(false); + miGenerateThumbsDialogSureText->setVisible(false); + miGenerateThumbsDialogYesButton->setVisible(false); + miGenerateThumbsDialogNoButton->setVisible(false); AddControl(miGameplayOptionsMenuButton, miOptionsMenuBackButton, miTeamOptionsMenuButton, NULL, miOptionsMenuBackButton); AddControl(miTeamOptionsMenuButton, miGameplayOptionsMenuButton, miPowerupOptionsMenuButton, NULL, miOptionsMenuBackButton); @@ -97,11 +97,11 @@ UI_OptionsMenu::UI_OptionsMenu() void UI_OptionsMenu::showThumbnailsPopup() { - miGenerateThumbsDialogImage->Show(true); - miGenerateThumbsDialogAreYouText->Show(true); - miGenerateThumbsDialogSureText->Show(true); - miGenerateThumbsDialogYesButton->Show(true); - miGenerateThumbsDialogNoButton->Show(true); + miGenerateThumbsDialogImage->setVisible(true); + miGenerateThumbsDialogAreYouText->setVisible(true); + miGenerateThumbsDialogSureText->setVisible(true); + miGenerateThumbsDialogYesButton->setVisible(true); + miGenerateThumbsDialogNoButton->setVisible(true); RememberCurrent(); @@ -111,11 +111,11 @@ void UI_OptionsMenu::showThumbnailsPopup() void UI_OptionsMenu::hideThumbnailsPopup() { - miGenerateThumbsDialogImage->Show(false); - miGenerateThumbsDialogAreYouText->Show(false); - miGenerateThumbsDialogSureText->Show(false); - miGenerateThumbsDialogYesButton->Show(false); - miGenerateThumbsDialogNoButton->Show(false); + miGenerateThumbsDialogImage->setVisible(false); + miGenerateThumbsDialogAreYouText->setVisible(false); + miGenerateThumbsDialogSureText->setVisible(false); + miGenerateThumbsDialogYesButton->setVisible(false); + miGenerateThumbsDialogNoButton->setVisible(false); setInitialFocus(miGameplayOptionsMenuButton); SetCancelCode(MENU_CODE_TO_MAIN_MENU); diff --git a/src/smw/menu/TourStopMenu.cpp b/src/smw/menu/TourStopMenu.cpp index c3becf88..25e77686 100644 --- a/src/smw/menu/TourStopMenu.cpp +++ b/src/smw/menu/TourStopMenu.cpp @@ -23,10 +23,10 @@ UI_TourStopMenu::UI_TourStopMenu() miTourStopExitDialogYesButton->SetCode(MENU_CODE_EXIT_TOUR_YES); miTourStopExitDialogNoButton->SetCode(MENU_CODE_EXIT_TOUR_NO); - miTourStopExitDialogImage->Show(false); - miTourStopExitDialogExitTourText->Show(false); - miTourStopExitDialogYesButton->Show(false); - miTourStopExitDialogNoButton->Show(false); + miTourStopExitDialogImage->setVisible(false); + miTourStopExitDialogExitTourText->setVisible(false); + miTourStopExitDialogYesButton->setVisible(false); + miTourStopExitDialogNoButton->setVisible(false); AddControl(miTourStop, NULL, NULL, NULL, NULL); @@ -42,10 +42,10 @@ UI_TourStopMenu::UI_TourStopMenu() void UI_TourStopMenu::OpenExitDialog() { - miTourStopExitDialogImage->Show(true); - miTourStopExitDialogExitTourText->Show(true); - miTourStopExitDialogYesButton->Show(true); - miTourStopExitDialogNoButton->Show(true); + miTourStopExitDialogImage->setVisible(true); + miTourStopExitDialogExitTourText->setVisible(true); + miTourStopExitDialogYesButton->setVisible(true); + miTourStopExitDialogNoButton->setVisible(true); RememberCurrent(); @@ -56,10 +56,10 @@ void UI_TourStopMenu::OpenExitDialog() void UI_TourStopMenu::CloseExitDialog() { - miTourStopExitDialogImage->Show(false); - miTourStopExitDialogExitTourText->Show(false); - miTourStopExitDialogYesButton->Show(false); - miTourStopExitDialogNoButton->Show(false); + miTourStopExitDialogImage->setVisible(false); + miTourStopExitDialogExitTourText->setVisible(false); + miTourStopExitDialogYesButton->setVisible(false); + miTourStopExitDialogNoButton->setVisible(false); setInitialFocus(miTourStop); SetCancelCode(MENU_CODE_BACK_TEAM_SELECT_MENU); diff --git a/src/smw/menu/WorldMenu.cpp b/src/smw/menu/WorldMenu.cpp index e009bf47..5ad30ca3 100644 --- a/src/smw/menu/WorldMenu.cpp +++ b/src/smw/menu/WorldMenu.cpp @@ -18,7 +18,7 @@ UI_WorldMenu::UI_WorldMenu() miWorld->SetAutoModify(true); miWorldStop = new MI_TourStop(70, 45, true); - miWorldStop->Show(false); + miWorldStop->setVisible(false); // Exit tour dialog box miWorldExitDialogImage = new MI_Image(&rm->spr_dialog, 224, 176, 0, 0, 192, 128, 1, 1, 0); @@ -30,10 +30,10 @@ UI_WorldMenu::UI_WorldMenu() miWorldExitDialogYesButton->SetCode(MENU_CODE_EXIT_WORLD_YES); miWorldExitDialogNoButton->SetCode(MENU_CODE_EXIT_WORLD_NO); - miWorldExitDialogImage->Show(false); - miWorldExitDialogExitTourText->Show(false); - miWorldExitDialogYesButton->Show(false); - miWorldExitDialogNoButton->Show(false); + miWorldExitDialogImage->setVisible(false); + miWorldExitDialogExitTourText->setVisible(false); + miWorldExitDialogYesButton->setVisible(false); + miWorldExitDialogNoButton->setVisible(false); AddControl(miWorld, NULL, NULL, NULL, NULL); @@ -52,7 +52,7 @@ UI_WorldMenu::UI_WorldMenu() void UI_WorldMenu::OpenStageStart() { miWorldStop->Refresh(game_values.tourstopcurrent); - miWorldStop->Show(true); + miWorldStop->setVisible(true); RememberCurrent(); @@ -64,7 +64,7 @@ void UI_WorldMenu::OpenStageStart() void UI_WorldMenu::CloseStageStart() { - miWorldStop->Show(false); + miWorldStop->setVisible(false); setInitialFocus(miWorld); SetCancelCode(MENU_CODE_BACK_TEAM_SELECT_MENU); @@ -74,10 +74,10 @@ void UI_WorldMenu::CloseStageStart() void UI_WorldMenu::OpenExitDialog() { - miWorldExitDialogImage->Show(true); - miWorldExitDialogExitTourText->Show(true); - miWorldExitDialogYesButton->Show(true); - miWorldExitDialogNoButton->Show(true); + miWorldExitDialogImage->setVisible(true); + miWorldExitDialogExitTourText->setVisible(true); + miWorldExitDialogYesButton->setVisible(true); + miWorldExitDialogNoButton->setVisible(true); RememberCurrent(); @@ -88,10 +88,10 @@ void UI_WorldMenu::OpenExitDialog() void UI_WorldMenu::CloseExitDialog() { - miWorldExitDialogImage->Show(false); - miWorldExitDialogExitTourText->Show(false); - miWorldExitDialogYesButton->Show(false); - miWorldExitDialogNoButton->Show(false); + miWorldExitDialogImage->setVisible(false); + miWorldExitDialogExitTourText->setVisible(false); + miWorldExitDialogYesButton->setVisible(false); + miWorldExitDialogNoButton->setVisible(false); setInitialFocus(miWorld); SetCancelCode(MENU_CODE_BACK_TEAM_SELECT_MENU); diff --git a/src/smw/menu/network/NetEditServersMenu.cpp b/src/smw/menu/network/NetEditServersMenu.cpp index a8245eb3..1322579b 100644 --- a/src/smw/menu/network/NetEditServersMenu.cpp +++ b/src/smw/menu/network/NetEditServersMenu.cpp @@ -53,10 +53,10 @@ UI_NetEditServersMenu::UI_NetEditServersMenu() miDialogCancel = new MI_Button(&rm->spr_selectfield, 150, 432, "Cancel", 100, TextAlign::CENTER); miDialogCancel->SetCode(MENU_CODE_TO_NET_ADDREMOVE_SERVER_MENU); - miDialogTitle->Show(false); - miDialogTextField->Show(false); - miDialogOK->Show(false); - miDialogCancel->Show(false); + miDialogTitle->setVisible(false); + miDialogTextField->setVisible(false); + miDialogOK->setVisible(false); + miDialogCancel->setVisible(false); AddControl(miAddButton, miBackButton, miEditButton, NULL, NULL); AddControl(miEditButton, miAddButton, miRemoveButton, NULL, NULL); @@ -91,18 +91,18 @@ void UI_NetEditServersMenu::ReloadScroll() void UI_NetEditServersMenu::ShowDialog() { - miDialogTitle->Show(true); - miDialogTextField->Show(true); - miDialogOK->Show(true); - miDialogCancel->Show(true); + miDialogTitle->setVisible(true); + miDialogTextField->setVisible(true); + miDialogOK->setVisible(true); + miDialogCancel->setVisible(true); } void UI_NetEditServersMenu::HideDialog() { - miDialogTitle->Show(false); - miDialogTextField->Show(false); - miDialogOK->Show(false); - miDialogCancel->Show(false); + miDialogTitle->setVisible(false); + miDialogTextField->setVisible(false); + miDialogOK->setVisible(false); + miDialogCancel->setVisible(false); } void UI_NetEditServersMenu::Restore() diff --git a/src/smw/menu/network/NetLobbyMenu.cpp b/src/smw/menu/network/NetLobbyMenu.cpp index e091aadc..bbd3a99d 100644 --- a/src/smw/menu/network/NetLobbyMenu.cpp +++ b/src/smw/menu/network/NetLobbyMenu.cpp @@ -36,8 +36,8 @@ UI_NetLobbyMenu::UI_NetLobbyMenu() miNetLobbyJoiningDialogImage = new MI_Image(&rm->spr_dialog, 224, 176, 0, 0, 192, 128, 1, 1, 0); miNetLobbyJoiningDialogText = new MI_HeaderText("Joining...", 320, 240 - 12); - miNetLobbyJoiningDialogImage->Show(false); - miNetLobbyJoiningDialogText->Show(false); + miNetLobbyJoiningDialogImage->setVisible(false); + miNetLobbyJoiningDialogText->setVisible(false); /*for (unsigned iRoom = 0; iRoom < netplay.rooms.size(); iRoom++) { Room * room = &netplay.rooms[iRoom]; @@ -71,8 +71,8 @@ void UI_NetLobbyMenu::JoinInProgress() netplay.client.sendJoinRoomMessage(); netplay.operationInProgress = true; - miNetLobbyJoiningDialogImage->Show(true); - miNetLobbyJoiningDialogText->Show(true); + miNetLobbyJoiningDialogImage->setVisible(true); + miNetLobbyJoiningDialogText->setVisible(true); setInitialFocus(miNetLobbyJoiningDialogText); SetCancelCode(MENU_CODE_NET_JOIN_ROOM_ABORT); @@ -87,8 +87,8 @@ void UI_NetLobbyMenu::AbortJoin() void UI_NetLobbyMenu::Restore() { - miNetLobbyJoiningDialogImage->Show(false); - miNetLobbyJoiningDialogText->Show(false); + miNetLobbyJoiningDialogImage->setVisible(false); + miNetLobbyJoiningDialogText->setVisible(false); setInitialFocus(miNetLobbyNewRoomButton); SetCancelCode(MENU_CODE_TO_NET_SERVERS_MENU); } diff --git a/src/smw/menu/network/NetNewRoomMenu.cpp b/src/smw/menu/network/NetNewRoomMenu.cpp index b11eed91..c984f676 100644 --- a/src/smw/menu/network/NetNewRoomMenu.cpp +++ b/src/smw/menu/network/NetNewRoomMenu.cpp @@ -35,8 +35,8 @@ UI_NetNewRoomMenu::UI_NetNewRoomMenu() miNetNewRoomCreatingDialogImage = new MI_Image(&rm->spr_dialog, 224, 176, 0, 0, 192, 128, 1, 1, 0); miNetNewRoomCreatingDialogText = new MI_HeaderText("Creating...", 320, 240 - 12); - miNetNewRoomCreatingDialogImage->Show(false); - miNetNewRoomCreatingDialogText->Show(false); + miNetNewRoomCreatingDialogImage->setVisible(false); + miNetNewRoomCreatingDialogText->setVisible(false); AddNonControl(miNetNewRoomCreatingDialogImage); AddNonControl(miNetNewRoomCreatingDialogText); @@ -59,8 +59,8 @@ void UI_NetNewRoomMenu::CreateInProgress() netplay.client.sendCreateRoomMessage(); netplay.operationInProgress = true; - miNetNewRoomCreatingDialogImage->Show(true); - miNetNewRoomCreatingDialogText->Show(true); + miNetNewRoomCreatingDialogImage->setVisible(true); + miNetNewRoomCreatingDialogText->setVisible(true); RememberCurrent(); setInitialFocus(miNetNewRoomCreatingDialogText); @@ -79,8 +79,8 @@ void UI_NetNewRoomMenu::AbortCreate() void UI_NetNewRoomMenu::Restore() { - miNetNewRoomCreatingDialogImage->Show(false); - miNetNewRoomCreatingDialogText->Show(false); + miNetNewRoomCreatingDialogImage->setVisible(false); + miNetNewRoomCreatingDialogText->setVisible(false); setInitialFocus(miNetNewRoomNameField); SetCancelCode(MENU_CODE_TO_NET_NEW_ROOM_LEVEL_SELECT_MENU); } diff --git a/src/smw/menu/network/NetNewRoomSettingsMenu.cpp b/src/smw/menu/network/NetNewRoomSettingsMenu.cpp index 5ecff981..7803bd5e 100644 --- a/src/smw/menu/network/NetNewRoomSettingsMenu.cpp +++ b/src/smw/menu/network/NetNewRoomSettingsMenu.cpp @@ -73,7 +73,7 @@ UI_NetNewRoomSettingsMenu::UI_NetNewRoomSettingsMenu(const UI_GameSettingsMenu* void UI_NetNewRoomSettingsMenu::RefreshGameModeButtons() { for (short iMode = 0; iMode < GAMEMODE_LAST; iMode++) - miGoalField[iMode]->Show(miModeField->currentValue() == iMode); + miGoalField[iMode]->setVisible(miModeField->currentValue() == iMode); } std::string UI_NetNewRoomSettingsMenu::getCurrentMapPath() const diff --git a/src/smw/menu/network/NetRoomMenu.cpp b/src/smw/menu/network/NetRoomMenu.cpp index e44f0722..fdecf5f2 100644 --- a/src/smw/menu/network/NetRoomMenu.cpp +++ b/src/smw/menu/network/NetRoomMenu.cpp @@ -64,8 +64,8 @@ UI_NetRoomMenu::UI_NetRoomMenu() miNetRoomStartingDialogImage = new MI_Image(&rm->spr_dialog, 224, 176, 0, 0, 192, 128, 1, 1, 0); miNetRoomStartingDialogText = new MI_HeaderText("Starting...", 320, 240 - 40); - miNetRoomStartingDialogImage->Show(false); - miNetRoomStartingDialogText->Show(false); + miNetRoomStartingDialogImage->setVisible(false); + miNetRoomStartingDialogText->setVisible(false); AddNonControl(miNetRoomStartingDialogImage); AddNonControl(miNetRoomStartingDialogText); @@ -124,8 +124,8 @@ void UI_NetRoomMenu::StartInProgress() netplay.client.local_gamehost.sendStartRoomMessage(); netplay.operationInProgress = true; - miNetRoomStartingDialogImage->Show(true); - miNetRoomStartingDialogText->Show(true); + miNetRoomStartingDialogImage->setVisible(true); + miNetRoomStartingDialogText->setVisible(true); RememberCurrent(); setInitialFocus(miNetRoomStartingDialogText); @@ -138,8 +138,8 @@ void UI_NetRoomMenu::StartInProgress() void UI_NetRoomMenu::Restore() { - miNetRoomStartingDialogImage->Show(false); - miNetRoomStartingDialogText->Show(false); + miNetRoomStartingDialogImage->setVisible(false); + miNetRoomStartingDialogText->setVisible(false); /*if (netplay.client.theHostIsMe) miNetRoomStartButton->SetName("Start"); else diff --git a/src/smw/menu/network/NetServersMenu.cpp b/src/smw/menu/network/NetServersMenu.cpp index 87ee2d44..e8bda6c5 100644 --- a/src/smw/menu/network/NetServersMenu.cpp +++ b/src/smw/menu/network/NetServersMenu.cpp @@ -23,7 +23,7 @@ UI_NetServersMenu::UI_NetServersMenu() miNetServersScroll = new MI_NetworkListScroll(&rm->menu_plain_field, 90, 72, 640 - 2 * 90, 9, "Saved Servers", MENU_CODE_NET_SERVERLIST_EXIT, MENU_CODE_NET_SERVERLIST_EXIT); miNetServersScroll->SetAutoModify(true); - miNetServersScroll->Show(false); + miNetServersScroll->setVisible(false); miNetServersScroll->RemoteIndex(&netplay.selectedServerIndex); miNetServersNicknameField = new MI_TextField(&rm->menu_plain_field, 70, 120, "Your name", 640 - 2 * 70, 150); @@ -50,8 +50,8 @@ UI_NetServersMenu::UI_NetServersMenu() miNetServersConnectingDialogImage = new MI_Image(&rm->spr_dialog, 224, 176, 0, 0, 192, 128, 1, 1, 0); miNetServersConnectingDialogText = new MI_HeaderText("Connecting...", 640 / 2, 240 - 12); - miNetServersConnectingDialogImage->Show(false); - miNetServersConnectingDialogText->Show(false); + miNetServersConnectingDialogImage->setVisible(false); + miNetServersConnectingDialogText->setVisible(false); miNetServersConnectingDialogText->Disable(true); // miNetServersConnectionDetector = new MI_NetworkStatusDetector(&rm->spr_selectfield, 320, 240 - 10, "Connecting...", 80, 1); @@ -118,8 +118,8 @@ void UI_NetServersMenu::ConnectInProgress() netplay.client.sendConnectRequestToSelectedServer(); netplay.operationInProgress = true; - miNetServersConnectingDialogImage->Show(true); - miNetServersConnectingDialogText->Show(true); + miNetServersConnectingDialogImage->setVisible(true); + miNetServersConnectingDialogText->setVisible(true); RememberCurrent(); setInitialFocus(miNetServersConnectingDialogText); @@ -130,7 +130,7 @@ void UI_NetServersMenu::ConnectInProgress() void UI_NetServersMenu::OpenServerList() { netplay.connectSuccessful = false; - miNetServersScroll->Show(true); + miNetServersScroll->setVisible(true); RememberCurrent(); setInitialFocus(miNetServersScroll); @@ -140,9 +140,9 @@ void UI_NetServersMenu::OpenServerList() void UI_NetServersMenu::Restore() { - miNetServersScroll->Show(false); - miNetServersConnectingDialogImage->Show(false); - miNetServersConnectingDialogText->Show(false); + miNetServersScroll->setVisible(false); + miNetServersConnectingDialogImage->setVisible(false); + miNetServersConnectingDialogText->setVisible(false); setInitialFocus(miNetServersSelectButton); SetCancelCode(MENU_CODE_TO_MAIN_MENU); diff --git a/src/smw/ui/MI_AnnouncerField.cpp b/src/smw/ui/MI_AnnouncerField.cpp index a72bfca3..a6129b73 100644 --- a/src/smw/ui/MI_AnnouncerField.cpp +++ b/src/smw/ui/MI_AnnouncerField.cpp @@ -20,18 +20,18 @@ MI_AnnouncerField::MI_AnnouncerField(gfxSprite* nspr, short x, short y, std::str UpdateName(); miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); - miModifyImageLeft->Show(false); + miModifyImageLeft->setVisible(false); miModifyImageRight = std::make_unique(nspr, m_pos.x + iWidth - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); - miModifyImageRight->Show(false); + miModifyImageRight->setVisible(false); } MI_AnnouncerField::~MI_AnnouncerField() = default; MenuCodeEnum MI_AnnouncerField::Modify(bool modify) { - miModifyImageLeft->Show(modify); - miModifyImageRight->Show(modify); + miModifyImageLeft->setVisible(modify); + miModifyImageRight->setVisible(modify); fModifying = modify; return MENU_CODE_MODIFY_ACCEPTED; @@ -59,8 +59,8 @@ MenuCodeEnum MI_AnnouncerField::SendInput(CPlayerInput* playerInput) } if (playerInput->outputControls[iPlayer].menu_select.fPressed || playerInput->outputControls[iPlayer].menu_cancel.fPressed) { - miModifyImageLeft->Show(false); - miModifyImageRight->Show(false); + miModifyImageLeft->setVisible(false); + miModifyImageRight->setVisible(false); fModifying = false; @@ -84,7 +84,7 @@ void MI_AnnouncerField::Update() void MI_AnnouncerField::Draw() { - if (!fShow) + if (!m_visible) return; //Draw the select field background diff --git a/src/smw/ui/MI_BonusWheel.cpp b/src/smw/ui/MI_BonusWheel.cpp index ab0aebff..45f8c955 100644 --- a/src/smw/ui/MI_BonusWheel.cpp +++ b/src/smw/ui/MI_BonusWheel.cpp @@ -32,7 +32,7 @@ MI_BonusWheel::MI_BonusWheel(short x, short y) dSelectionSector[NUMBONUSITEMSONWHEEL] = TWO_PI; miContinueButton = new MI_Button(&rm->menu_plain_field, m_pos.x + 76, m_pos.y + 390, "Continue", 200, TextAlign::CENTER); - miContinueButton->Show(false); + miContinueButton->setVisible(false); miContinueButton->SetCode(MENU_CODE_BONUS_DONE); } @@ -153,7 +153,7 @@ void MI_BonusWheel::Update() if (!fPowerupSelectionDone) { fPowerupSelectionDone = true; - miContinueButton->Show(true); + miContinueButton->setVisible(true); miContinueButton->Select(true); //Reset all player's stored item @@ -187,7 +187,7 @@ void MI_BonusWheel::Update() void MI_BonusWheel::Draw() { - if (!fShow) + if (!m_visible) return; rm->spr_tournament_powerup_splash.draw(m_pos.x, m_pos.y); @@ -272,7 +272,7 @@ void MI_BonusWheel::Reset(bool fTournament) iPressSelectTimer = 0; fPressedSelect = false; fPowerupSelectionDone = false; - miContinueButton->Show(false); + miContinueButton->setVisible(false); //Counters to animate the selector's wings iSelectorAnimation = 0; diff --git a/src/smw/ui/MI_FrenzyModeOptions.cpp b/src/smw/ui/MI_FrenzyModeOptions.cpp index 67b6c70f..6ed64362 100644 --- a/src/smw/ui/MI_FrenzyModeOptions.cpp +++ b/src/smw/ui/MI_FrenzyModeOptions.cpp @@ -89,7 +89,7 @@ MI_FrenzyModeOptions::MI_FrenzyModeOptions(short x, short y, short width, short miUpArrow = new MI_Image(&rm->menu_verticalarrows, 310, 162, 20, 0, 20, 20, 1, 4, 8); miDownArrow = new MI_Image(&rm->menu_verticalarrows, 310, 402, 0, 0, 20, 20, 1, 4, 8); - miUpArrow->Show(false); + miUpArrow->setVisible(false); mMenu->AddControl(miQuantityField, NULL, miRateField, NULL, NULL); mMenu->AddControl(miRateField, miQuantityField, miStoredShellsField, NULL, NULL); @@ -157,9 +157,9 @@ void MI_FrenzyModeOptions::SetupPowerupFields() MI_PowerupSlider * slider = miPowerupSlider[iPosition]; if ((iPosition >> 1) < iOffset || (iPosition >> 1) >= iOffset + iNumLines) - slider->Show(false); + slider->setVisible(false); else { - slider->Show(true); + slider->setVisible(true); slider->SetPosition(m_pos.x + (iPosition % 2) * 295, m_pos.y + 118 + 38 * (iPosition / 2 - iOffset)); } } @@ -206,7 +206,7 @@ void MI_FrenzyModeOptions::Update() void MI_FrenzyModeOptions::Draw() { - if (!fShow) + if (!m_visible) return; mMenu->Draw(); @@ -249,14 +249,14 @@ void MI_FrenzyModeOptions::SetRandomGameModeSettings() void MI_FrenzyModeOptions::AdjustDisplayArrows() { if (iIndex > iTopStop) - miUpArrow->Show(true); + miUpArrow->setVisible(true); else - miUpArrow->Show(false); + miUpArrow->setVisible(false); if (iIndex < iBottomStop) - miDownArrow->Show(true); + miDownArrow->setVisible(true); else - miDownArrow->Show(false); + miDownArrow->setVisible(false); } MenuCodeEnum MI_FrenzyModeOptions::MouseClick(short iMouseX, short iMouseY) diff --git a/src/smw/ui/MI_InputControlContainer.cpp b/src/smw/ui/MI_InputControlContainer.cpp index e44df4f4..d5a11afa 100644 --- a/src/smw/ui/MI_InputControlContainer.cpp +++ b/src/smw/ui/MI_InputControlContainer.cpp @@ -343,7 +343,7 @@ void MI_InputControlField::SetKey(SDL_KEYTYPE * iSetKey, SDL_KEYTYPE key, short void MI_InputControlField::Draw() { - if (!fShow) + if (!m_visible) return; spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 32 : 0), iIndent - 16, 32); @@ -471,7 +471,7 @@ void MI_InputControlContainer::Update() void MI_InputControlContainer::Draw() { - if (!fShow) + if (!m_visible) return; mInputMenu->Draw(); @@ -521,11 +521,11 @@ void MI_InputControlContainer::SetVisibleInputFields() int selDevice = miDeviceSelectField->currentValue(); for (int iKey = 0; iKey < NUM_KEYS; iKey++) { - miGameInputControlFields[iKey]->Show(0 == iSelectedInputType && (iKey < 6 || DEVICE_KEYBOARD != selDevice || iPlayerID == 0)); + miGameInputControlFields[iKey]->setVisible(0 == iSelectedInputType && (iKey < 6 || DEVICE_KEYBOARD != selDevice || iPlayerID == 0)); } for (int iKey = 0; iKey < NUM_KEYS; iKey++) { - miMenuInputControlFields[iKey]->Show(1 == iSelectedInputType && (iKey < 6 || DEVICE_KEYBOARD != selDevice || iPlayerID == 0)); + miMenuInputControlFields[iKey]->setVisible(1 == iSelectedInputType && (iKey < 6 || DEVICE_KEYBOARD != selDevice || iPlayerID == 0)); } } diff --git a/src/smw/ui/MI_MapBrowser.cpp b/src/smw/ui/MI_MapBrowser.cpp index ab07e8b1..731a01dc 100644 --- a/src/smw/ui/MI_MapBrowser.cpp +++ b/src/smw/ui/MI_MapBrowser.cpp @@ -67,7 +67,7 @@ void MI_MapBrowser::Update() void MI_MapBrowser::Draw() { - if (!fShow) + if (!m_visible) return; SDL_Rect rSrc = {0, 0, 160, 120}; diff --git a/src/smw/ui/MI_MapFilterScroll.cpp b/src/smw/ui/MI_MapFilterScroll.cpp index 4f472e9d..0523b8f8 100644 --- a/src/smw/ui/MI_MapFilterScroll.cpp +++ b/src/smw/ui/MI_MapFilterScroll.cpp @@ -95,7 +95,7 @@ void MI_MapFilterScroll::Update() void MI_MapFilterScroll::Draw() { - if (!fShow) + if (!m_visible) return; //Draw the background for the map preview diff --git a/src/smw/ui/MI_NetRoomTeamSelect.cpp b/src/smw/ui/MI_NetRoomTeamSelect.cpp index 1c5073d2..5e391407 100644 --- a/src/smw/ui/MI_NetRoomTeamSelect.cpp +++ b/src/smw/ui/MI_NetRoomTeamSelect.cpp @@ -24,9 +24,9 @@ MI_NetRoomTeamSelect::MI_NetRoomTeamSelect(short x, short y, short player_id, st , onChangeAccepted(on_change_accepted) { miHoverImage = new MI_Image(&rm->menu_player_select, x - 6, y - 6, 32 + 18, 128 + 18, 44, 44, 1, 1, 1); - miHoverImage->Show(false); + miHoverImage->setVisible(false); miModifyImage = new MI_Image(&rm->menu_player_select, x - 24, y - 24, 32, 128, 78, 78, 4, 1, 8); - miModifyImage->Show(false); + miModifyImage->setVisible(false); } MI_NetRoomTeamSelect::~MI_NetRoomTeamSelect() { @@ -48,23 +48,23 @@ void MI_NetRoomTeamSelect::Update() { } if (fSelected) { - miHoverImage->Show(true); - miModifyImage->Show(false); + miHoverImage->setVisible(true); + miModifyImage->setVisible(false); if (fModifying) { - miHoverImage->Show(false); - miModifyImage->Show(true); + miHoverImage->setVisible(false); + miModifyImage->setVisible(true); miModifyImage->Update(); } } else { - miHoverImage->Show(false); - miModifyImage->Show(false); + miHoverImage->setVisible(false); + miModifyImage->setVisible(false); } } void MI_NetRoomTeamSelect::Draw() { - if (!fShow) + if (!m_visible) return; miHoverImage->Draw(); diff --git a/src/smw/ui/MI_PlayerSelect.cpp b/src/smw/ui/MI_PlayerSelect.cpp index b4121c7f..727aa9c8 100644 --- a/src/smw/ui/MI_PlayerSelect.cpp +++ b/src/smw/ui/MI_PlayerSelect.cpp @@ -16,7 +16,7 @@ MI_PlayerSelect::MI_PlayerSelect(gfxSprite * nspr, short x, short y, std::string , iIndent(indent) { miModifyImage = std::make_unique(nspr, m_pos.x, m_pos.y - 6, 32, 128, 78, 78, 4, 1, 8); - miModifyImage->Show(false); + miModifyImage->setVisible(false); const short iSpacing = (width - indent - 136) / 5; for (size_t i = 0; i < iPlayerPosition.size(); i++) { @@ -28,7 +28,7 @@ MI_PlayerSelect::MI_PlayerSelect(gfxSprite * nspr, short x, short y, std::string MenuCodeEnum MI_PlayerSelect::Modify(bool modify) { - miModifyImage->Show(modify); + miModifyImage->setVisible(modify); fModifying = modify; return MENU_CODE_MODIFY_ACCEPTED; } @@ -83,7 +83,7 @@ MenuCodeEnum MI_PlayerSelect::SendInput(CPlayerInput* playerInput) } if (playerInput->outputControls[iPlayer].menu_select.fPressed || playerInput->outputControls[iPlayer].menu_cancel.fPressed) { - miModifyImage->Show(false); + miModifyImage->setVisible(false); fModifying = false; return MENU_CODE_UNSELECT_ITEM; } @@ -104,7 +104,7 @@ void MI_PlayerSelect::Update() void MI_PlayerSelect::Draw() { - if (!fShow) + if (!m_visible) return; spr->draw(m_pos.x, m_pos.y, 0, (fSelected ? 64 : 0), iIndent - 16, 64); diff --git a/src/smw/ui/MI_PlaylistField.cpp b/src/smw/ui/MI_PlaylistField.cpp index 2e908c84..3e85f639 100644 --- a/src/smw/ui/MI_PlaylistField.cpp +++ b/src/smw/ui/MI_PlaylistField.cpp @@ -20,16 +20,16 @@ MI_PlaylistField::MI_PlaylistField(gfxSprite* nspr, short x, short y, std::strin , iIndent(indent) { miModifyImageLeft = std::make_unique(nspr, m_pos.x + indent - 26, m_pos.y + 4, 32, 64, 26, 24, 4, 1, 8); - miModifyImageLeft->Show(false); + miModifyImageLeft->setVisible(false); miModifyImageRight = std::make_unique(nspr, m_pos.x + iWidth - 16, m_pos.y + 4, 32, 88, 26, 24, 4, 1, 8); - miModifyImageRight->Show(false); + miModifyImageRight->setVisible(false); } MenuCodeEnum MI_PlaylistField::Modify(bool modify) { - miModifyImageLeft->Show(modify); - miModifyImageRight->Show(modify); + miModifyImageLeft->setVisible(modify); + miModifyImageRight->setVisible(modify); fModifying = modify; return MENU_CODE_MODIFY_ACCEPTED; @@ -72,8 +72,8 @@ MenuCodeEnum MI_PlaylistField::SendInput(CPlayerInput * playerInput) } if (playerInput->outputControls[iPlayer].menu_select.fPressed || playerInput->outputControls[iPlayer].menu_cancel.fPressed) { - miModifyImageLeft->Show(false); - miModifyImageRight->Show(false); + miModifyImageLeft->setVisible(false); + miModifyImageRight->setVisible(false); fModifying = false; @@ -92,7 +92,7 @@ void MI_PlaylistField::Update() void MI_PlaylistField::Draw() { - if (!fShow) + if (!m_visible) return; //Draw the select field background diff --git a/src/smw/ui/MI_PowerupSelection.cpp b/src/smw/ui/MI_PowerupSelection.cpp index 46e92fe2..42d5405d 100644 --- a/src/smw/ui/MI_PowerupSelection.cpp +++ b/src/smw/ui/MI_PowerupSelection.cpp @@ -139,18 +139,18 @@ MI_PowerupSelection::MI_PowerupSelection(short x, short y, short width, short nu miDialogYesButton->SetCode(MENU_CODE_POWERUP_RESET_YES); miDialogNoButton->SetCode(MENU_CODE_POWERUP_RESET_NO); - miDialogImage->Show(false); - miDialogAreYouText->Show(false); - miDialogSureText->Show(false); - miDialogYesButton->Show(false); - miDialogNoButton->Show(false); + miDialogImage->setVisible(false); + miDialogAreYouText->setVisible(false); + miDialogSureText->setVisible(false); + miDialogYesButton->setVisible(false); + miDialogNoButton->setVisible(false); mMenu->AddControl(miOverride, NULL, miPreset, NULL, NULL); mMenu->AddControl(miPreset, miOverride, miPowerupSlider[0], NULL, NULL); miUpArrow = new MI_Image(&rm->menu_verticalarrows, 310, 128, 20, 0, 20, 20, 1, 4, 8); miDownArrow = new MI_Image(&rm->menu_verticalarrows, 310, 406, 0, 0, 20, 20, 1, 4, 8); - miUpArrow->Show(false); + miUpArrow->setVisible(false); for (short iPowerup = 0; iPowerup < NUM_POWERUPS; iPowerup++) { UI_Control * upcontrol = NULL; @@ -214,9 +214,9 @@ void MI_PowerupSelection::SetupPowerupFields() MI_PowerupSlider * slider = miPowerupSlider[iPosition]; if ((iPosition >> 1) < iOffset || (iPosition >> 1) >= iOffset + iNumLines) - slider->Show(false); + slider->setVisible(false); else { - slider->Show(true); + slider->setVisible(true); slider->SetPosition(m_pos.x + (iPosition % 2) * 295, m_pos.y + 84 + 38 * (iPosition / 2 - iOffset)); } } @@ -266,11 +266,11 @@ MenuCodeEnum MI_PowerupSelection::SendInput(CPlayerInput* playerInput) game_values.allPowerupPresets[game_values.poweruppreset][iPowerupPositionMap[iPowerup]] = game_values.powerupweights[iPowerupPositionMap[iPowerup]]; } } else if (MENU_CODE_RESTORE_DEFAULT_POWERUP_WEIGHTS == ret || MENU_CODE_CLEAR_POWERUP_WEIGHTS == ret) { - miDialogImage->Show(true); - miDialogAreYouText->Show(true); - miDialogSureText->Show(true); - miDialogYesButton->Show(true); - miDialogNoButton->Show(true); + miDialogImage->setVisible(true); + miDialogAreYouText->setVisible(true); + miDialogSureText->setVisible(true); + miDialogYesButton->setVisible(true); + miDialogNoButton->setVisible(true); mMenu->RememberCurrent(); @@ -284,11 +284,11 @@ MenuCodeEnum MI_PowerupSelection::SendInput(CPlayerInput* playerInput) miDialogYesButton->SetCode(MENU_CODE_POWERUP_RESET_YES); } else if (MENU_CODE_POWERUP_RESET_YES == ret || MENU_CODE_POWERUP_RESET_NO == ret || MENU_CODE_POWERUP_CLEAR_YES == ret) { - miDialogImage->Show(false); - miDialogAreYouText->Show(false); - miDialogSureText->Show(false); - miDialogYesButton->Show(false); - miDialogNoButton->Show(false); + miDialogImage->setVisible(false); + miDialogAreYouText->setVisible(false); + miDialogSureText->setVisible(false); + miDialogYesButton->setVisible(false); + miDialogNoButton->setVisible(false); mMenu->setInitialFocus(miOverride); mMenu->SetCancelCode(MENU_CODE_BACK_TO_OPTIONS_MENU); @@ -329,7 +329,7 @@ void MI_PowerupSelection::Update() void MI_PowerupSelection::Draw() { - if (!fShow) + if (!m_visible) return; mMenu->Draw(); @@ -362,12 +362,12 @@ void MI_PowerupSelection::MovePrev() void MI_PowerupSelection::AdjustDisplayArrows() { if (iIndex > iTopStop) - miUpArrow->Show(true); + miUpArrow->setVisible(true); else - miUpArrow->Show(false); + miUpArrow->setVisible(false); if (iIndex < iBottomStop) - miDownArrow->Show(true); + miDownArrow->setVisible(true); else - miDownArrow->Show(false); + miDownArrow->setVisible(false); } diff --git a/src/smw/ui/MI_PowerupSlider.cpp b/src/smw/ui/MI_PowerupSlider.cpp index 08144a9a..5588b54b 100644 --- a/src/smw/ui/MI_PowerupSlider.cpp +++ b/src/smw/ui/MI_PowerupSlider.cpp @@ -16,7 +16,7 @@ MI_PowerupSlider::MI_PowerupSlider(gfxSprite* nspr, gfxSprite* nsprSlider, gfxSp void MI_PowerupSlider::Draw() { - if (!fShow) + if (!m_visible) return; m_spr->draw(m_pos.x + 38, m_pos.y, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_halfWidth, 32); diff --git a/src/smw/ui/MI_StoredPowerupResetButton.cpp b/src/smw/ui/MI_StoredPowerupResetButton.cpp index 84b5fbfb..03658449 100644 --- a/src/smw/ui/MI_StoredPowerupResetButton.cpp +++ b/src/smw/ui/MI_StoredPowerupResetButton.cpp @@ -14,7 +14,7 @@ MI_StoredPowerupResetButton::MI_StoredPowerupResetButton(gfxSprite* nspr, short void MI_StoredPowerupResetButton::Draw() { - if (!fShow) + if (!m_visible) return; MI_Button::Draw(); diff --git a/src/smw/ui/MI_StringScroll.cpp b/src/smw/ui/MI_StringScroll.cpp index e78ad48a..e87dac24 100644 --- a/src/smw/ui/MI_StringScroll.cpp +++ b/src/smw/ui/MI_StringScroll.cpp @@ -133,7 +133,7 @@ void MI_StringScroll::Update() void MI_StringScroll::Draw() { - if (!fShow) + if (!m_visible) return; rm->menu_dialog.draw(m_pos.x, m_pos.y, 0, 0, iWidth - 16, iNumLines * 32 + 32); diff --git a/src/smw/ui/MI_TeamSelect.cpp b/src/smw/ui/MI_TeamSelect.cpp index badaeefa..2528aaa1 100644 --- a/src/smw/ui/MI_TeamSelect.cpp +++ b/src/smw/ui/MI_TeamSelect.cpp @@ -59,7 +59,7 @@ void MI_TeamSelect::Update() void MI_TeamSelect::Draw() { - if (!fShow) + if (!m_visible) return; miImage->Draw(); diff --git a/src/smw/ui/MI_TourStop.cpp b/src/smw/ui/MI_TourStop.cpp index 99b6a605..48d3ade2 100644 --- a/src/smw/ui/MI_TourStop.cpp +++ b/src/smw/ui/MI_TourStop.cpp @@ -36,17 +36,17 @@ MI_TourStop::MI_TourStop(short x, short y, bool fWorld) miBonusField->Disable(true); miEndStageImage[0] = std::make_unique(&rm->spr_worlditemsplace, 54, 201, 0, 20, 80, 248, 1, 1, 0); - miEndStageImage[0]->Show(false); + miEndStageImage[0]->setVisible(false); miEndStageImage[1] = std::make_unique(&rm->spr_worlditemsplace, 506, 201, 0, 20, 80, 248, 1, 1, 0); - miEndStageImage[1]->Show(false); + miEndStageImage[1]->setVisible(false); for (short iBonus = 0; iBonus < 10; iBonus++) { miBonusIcon[iBonus] = std::make_unique(&rm->spr_worlditemssmall, 170 + iBonus * 20, 133, 0, 0, 16, 16, 1, 1, 0); miBonusBackground[iBonus] = std::make_unique(&rm->spr_worlditemsplace, 168 + iBonus * 20, 131, 0, 0, 20, 20, 1, 1, 0); - miBonusIcon[iBonus]->Show(false); - miBonusBackground[iBonus]->Show(false); + miBonusIcon[iBonus]->setVisible(false); + miBonusBackground[iBonus]->setVisible(false); } } else { miModeField = std::make_unique(&rm->spr_selectfielddisabled, &rm->menu_mode_small, 70, 85, "Mode", 500, 120, 16, 16); @@ -79,7 +79,7 @@ MenuCodeEnum MI_TourStop::Modify(bool fModify) void MI_TourStop::Update() { - if (!fShow) + if (!m_visible) return; miStartButton->Update(); @@ -100,7 +100,7 @@ void MI_TourStop::Update() void MI_TourStop::Draw() { - if (!fShow) + if (!m_visible) return; miStartButton->Draw(); @@ -196,8 +196,8 @@ void MI_TourStop::Refresh(short iTourStop) if (fIsWorld) { miBonusField->clear(); - miEndStageImage[0]->Show(tourstop->fEndStage); - miEndStageImage[1]->Show(tourstop->fEndStage); + miEndStageImage[0]->setVisible(tourstop->fEndStage); + miEndStageImage[1]->setVisible(tourstop->fEndStage); for (short iBonus = 0; iBonus < 10; iBonus++) { bool fShowBonus = iBonus < tourstop->iNumBonuses; @@ -208,8 +208,8 @@ void MI_TourStop::Refresh(short iTourStop) miBonusBackground[iBonus]->SetImage(tourstop->wsbBonuses[iBonus].iWinnerPlace * 20, 0, 20, 20); } - miBonusIcon[iBonus]->Show(fShowBonus); - miBonusBackground[iBonus]->Show(fShowBonus); + miBonusIcon[iBonus]->setVisible(fShowBonus); + miBonusBackground[iBonus]->setVisible(fShowBonus); } } } diff --git a/src/smw/ui/MI_TournamentScoreboard.cpp b/src/smw/ui/MI_TournamentScoreboard.cpp index 8822f2e5..0013173f 100644 --- a/src/smw/ui/MI_TournamentScoreboard.cpp +++ b/src/smw/ui/MI_TournamentScoreboard.cpp @@ -204,7 +204,7 @@ void MI_TournamentScoreboard::Update() void MI_TournamentScoreboard::Draw() { - if (!fShow) + if (!m_visible) return; for (int iTeam = 0; iTeam < iNumTeams; iTeam++) { @@ -307,7 +307,7 @@ void MI_TournamentScoreboard::CreateScoreboard(short numTeams, short numGames, g float dSpacing = GetIconSpacing(); miIconImages[iTeam][iGame] = new MI_Image(sprIcons, m_pos.x + 128 + (short)dSpacing + (short)((float)iGame * (32.0f + dSpacing)) - (fTour ? 40 : 0), iTeamY + 16, 0, 0, 32, 32, fTour ? 4 : 1, 1, fTour ? 8 : 0); - miIconImages[iTeam][iGame]->Show(false); + miIconImages[iTeam][iGame]->setVisible(false); } } @@ -324,7 +324,7 @@ void MI_TournamentScoreboard::CreateScoreboard(short numTeams, short numGames, g for (short iBonus = 0; iBonus < MAX_WORLD_BONUSES_AWARDED; iBonus++) { worldBonus[iTeam][iBonus] = new MI_Image(&rm->spr_worlditems, m_pos.x + 180 + 38 * iBonus, iTeamY + 14, 0, 0, 32, 32, 1, 1, 0); - worldBonus[iTeam][iBonus]->Show(false); + worldBonus[iTeam][iBonus]->setVisible(false); } } } @@ -376,23 +376,23 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) tourScores[iTeam]->SetScore(game_values.tournament_scores[iTeam].total); if (iGameWinner == -1) { - worldScore->Show(false); - worldScoreModifier->Show(false); + worldScore->setVisible(false); + worldScoreModifier->setVisible(false); } if (iGameWinner == iTeam) { worldScore->SetPosition(m_pos.x + 350, iTeamY + 24); worldScore->SetScore(tourStop->iPoints); - worldScore->Show(true); + worldScore->setVisible(true); miTeamImages[iTeam]->SetImage(0, 160, 496, 64); if (game_values.worldpointsbonus >= 0) { worldScoreModifier->SetImage((game_values.worldpointsbonus + 9) << 5, 0, 32, 32); worldScoreModifier->SetPosition(m_pos.x + 410, iTeamY + 14); - worldScoreModifier->Show(true); + worldScoreModifier->setVisible(true); } else { - worldScoreModifier->Show(false); + worldScoreModifier->setVisible(false); } } else { miTeamImages[iTeam]->SetImage(0, 160, 344, 64); @@ -400,7 +400,7 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) worldPlace[iTeam]->SetPosition(m_pos.x + 102, iTeamY + 14); worldPlace[iTeam]->SetImage(0, score[iTeam]->place << 5, 32, 32); - worldPlace[iTeam]->Show(gameWinner >= 0); + worldPlace[iTeam]->setVisible(gameWinner >= 0); } short iBonusCounts[4] = {0, 0, 0, 0}; @@ -415,7 +415,7 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) short iDisplayPosition = game_values.tournament_scores[iTeam].wins; if (iBonusCounts[iDisplayPosition] < MAX_WORLD_BONUSES_AWARDED) { - worldBonus[iDisplayPosition][iBonusCounts[iDisplayPosition]]->Show(true); + worldBonus[iDisplayPosition][iBonusCounts[iDisplayPosition]]->setVisible(true); worldBonus[iDisplayPosition][iBonusCounts[iDisplayPosition]]->SetImageSource(bonus->iBonus < NUM_POWERUPS ? &rm->spr_storedpoweruplarge : &rm->spr_worlditems); worldBonus[iDisplayPosition][iBonusCounts[iDisplayPosition]]->SetImage((bonus->iBonus < NUM_POWERUPS ? bonus->iBonus : bonus->iBonus - NUM_POWERUPS) << 5, 0, 32, 32); @@ -429,7 +429,7 @@ void MI_TournamentScoreboard::RefreshWorldScores(short gameWinner) for (short iTeam = 0; iTeam < iNumTeams; iTeam++) { for (short iBonus = iBonusCounts[iTeam]; iBonus < MAX_WORLD_BONUSES_AWARDED; iBonus++) { - worldBonus[iTeam][iBonus]->Show(false); + worldBonus[iTeam][iBonus]->setVisible(false); } } @@ -463,11 +463,11 @@ void MI_TournamentScoreboard::RefreshTourScores() miIconImages[iTeam][iGame]->SetSwirl(false, 0.0f, 0.0f, 0.0f, 0.0f); miIconImages[iTeam][iGame]->SetPulse(false); - miIconImages[iTeam][iGame]->Show(true); + miIconImages[iTeam][iGame]->setVisible(true); } for (short iGame = game_values.tourstopcurrent; iGame < game_values.tourstoptotal; iGame++) { - miIconImages[iTeam][iGame]->Show(false); + miIconImages[iTeam][iGame]->setVisible(false); } tourScores[iTeam]->SetPosition(m_pos.x + 508, iTeamY + 24); @@ -545,11 +545,11 @@ void MI_TournamentScoreboard::RefreshTournamentScores(short gameWinner) } miIconImages[iTeam][iGame]->SetPulse(false); - miIconImages[iTeam][iGame]->Show(true); + miIconImages[iTeam][iGame]->setVisible(true); } for (short iGame = game_values.tournament_scores[iTeam].wins; iGame < iNumGames; iGame++) { - miIconImages[iTeam][iGame]->Show(false); + miIconImages[iTeam][iGame]->setVisible(false); } } } diff --git a/src/smw/ui/MI_World.cpp b/src/smw/ui/MI_World.cpp index 64f78cc0..39def3bf 100644 --- a/src/smw/ui/MI_World.cpp +++ b/src/smw/ui/MI_World.cpp @@ -416,7 +416,7 @@ void MI_World::RepositionMapImage() void MI_World::Draw() { - if (!fShow) + if (!m_visible) return; short iPlayerX, iPlayerY; diff --git a/src/smw/ui/MI_WorldPreviewDisplay.cpp b/src/smw/ui/MI_WorldPreviewDisplay.cpp index 846e3ddb..85937f0f 100644 --- a/src/smw/ui/MI_WorldPreviewDisplay.cpp +++ b/src/smw/ui/MI_WorldPreviewDisplay.cpp @@ -73,7 +73,7 @@ void MI_WorldPreviewDisplay::Init() void MI_WorldPreviewDisplay::Update() { - if (!fShow) + if (!m_visible) return; bool fNeedMapSurfaceUpdate = false; @@ -190,7 +190,7 @@ void MI_WorldPreviewDisplay::Update() void MI_WorldPreviewDisplay::Draw() { - if (!fShow) + if (!m_visible) return; rectSrcSurface.x = iMapOffsetX; diff --git a/src/smw/ui/NetworkListScroll.cpp b/src/smw/ui/NetworkListScroll.cpp index 5a07fbf3..ddf84c11 100644 --- a/src/smw/ui/NetworkListScroll.cpp +++ b/src/smw/ui/NetworkListScroll.cpp @@ -140,7 +140,7 @@ void MI_NetworkListScroll::Update() void MI_NetworkListScroll::Draw() { - if (!fShow) + if (!m_visible) return; //Draw the background for the map preview diff --git a/src/worldeditor/worldeditor.cpp b/src/worldeditor/worldeditor.cpp index 265c5f6b..ba873e11 100644 --- a/src/worldeditor/worldeditor.cpp +++ b/src/worldeditor/worldeditor.cpp @@ -676,7 +676,7 @@ int main(int argc, char *argv[]) miModeField->add(stagemodes[iGameMode].szName, iGameMode); miGoalField[iGameMode] = new MI_SelectField(&rm->spr_selectfield, 70, 100, stagemodes[iGameMode].szGoal, 352, 120); - miGoalField[iGameMode]->Show(iGameMode == 0); + miGoalField[iGameMode]->setVisible(iGameMode == 0); for (short iGameModeOption = 0; iGameModeOption < GAMEMODE_NUM_OPTIONS - 1; iGameModeOption++) { StageModeOption * option = &stagemodes[iGameMode].options[iGameModeOption]; @@ -694,7 +694,7 @@ int main(int argc, char *argv[]) //Create goal field for pipe game miSpecialGoalField[0] = new MI_SelectField(&rm->spr_selectfield, 70, 100, "Points", 352, 120); - miSpecialGoalField[0]->Show(false); + miSpecialGoalField[0]->setVisible(false); for (short iGameModeOption = 0; iGameModeOption < GAMEMODE_NUM_OPTIONS - 1; iGameModeOption++) { short iValue = 10 + iGameModeOption * 10; @@ -705,7 +705,7 @@ int main(int argc, char *argv[]) //Create goal field for boss game miSpecialGoalField[1] = new MI_SelectField(&rm->spr_selectfield, 70, 100, "Lives", 352, 120); - miSpecialGoalField[1]->Show(false); + miSpecialGoalField[1]->setVisible(false); for (short iGameLives = 1; iGameLives <= 30; iGameLives++) { char szName[16]; @@ -715,7 +715,7 @@ int main(int argc, char *argv[]) //Create goal field for boxes game miSpecialGoalField[2] = new MI_SelectField(&rm->spr_selectfield, 70, 100, "Lives", 352, 120); - miSpecialGoalField[2]->Show(false); + miSpecialGoalField[2]->setVisible(false); for (short iGameLives = 1; iGameLives <= 30; iGameLives++) { char szName[16]; @@ -781,11 +781,11 @@ int main(int argc, char *argv[]) miDeleteStageDialogYesButton->SetCode(MENU_CODE_DELETE_STAGE_YES); miDeleteStageDialogNoButton->SetCode(MENU_CODE_DELETE_STAGE_NO); - miDeleteStageDialogImage->Show(false); - miDeleteStageDialogAreYouText->Show(false); - miDeleteStageDialogSureText->Show(false); - miDeleteStageDialogYesButton->Show(false); - miDeleteStageDialogNoButton->Show(false); + miDeleteStageDialogImage->setVisible(false); + miDeleteStageDialogAreYouText->setVisible(false); + miDeleteStageDialogSureText->setVisible(false); + miDeleteStageDialogYesButton->setVisible(false); + miDeleteStageDialogNoButton->setVisible(false); //Add Name Field mStageSettingsMenu.AddControl(miNameField, miDeleteStageButton, miModeField, NULL, NULL); @@ -3752,30 +3752,30 @@ void EditStage(short iEditStage) iMode += 975; //Show fields applicable for this mode - miPointsField->Show(iStageType == 0); - miFinalStageField->Show(iStageType == 0); - miMapField->Show(iStageType == 0); + miPointsField->setVisible(iStageType == 0); + miFinalStageField->setVisible(iStageType == 0); + miMapField->setVisible(iStageType == 0); - miBonusType->Show(iStageType == 1); - miBonusTextField[0]->Show(iStageType == 1); - miBonusTextField[1]->Show(iStageType == 1); - miBonusTextField[2]->Show(iStageType == 1); - miBonusTextField[3]->Show(iStageType == 1); - miBonusTextField[4]->Show(iStageType == 1); + miBonusType->setVisible(iStageType == 1); + miBonusTextField[0]->setVisible(iStageType == 1); + miBonusTextField[1]->setVisible(iStageType == 1); + miBonusTextField[2]->setVisible(iStageType == 1); + miBonusTextField[3]->setVisible(iStageType == 1); + miBonusTextField[4]->setVisible(iStageType == 1); - miSpecialGoalField[0]->Show(iMode == 1000); - miSpecialGoalField[1]->Show(iMode == 1001); - miSpecialGoalField[2]->Show(iMode == 1002); + miSpecialGoalField[0]->setVisible(iMode == 1000); + miSpecialGoalField[1]->setVisible(iMode == 1001); + miSpecialGoalField[2]->setVisible(iMode == 1002); miBonusItemsButton->SetPosition(430, iStageType == 0 ? 220 : 340); if (iStageType == 0 && iMode >= 0 && iMode < GAMEMODE_LAST) { miModeField->setCurrentValue(iMode); - miModeSettingsButton->Show(iMode != game_mode_owned); + miModeSettingsButton->setVisible(iMode != game_mode_owned); for (short iGameMode = 0; iGameMode < GAMEMODE_LAST; iGameMode++) { - miGoalField[iGameMode]->Show(iMode == iGameMode); + miGoalField[iGameMode]->setVisible(iMode == iGameMode); } miGoalField[iMode]->setOutputPtr(&game_values.tourstops[iEditStage]->iGoal); @@ -3787,10 +3787,10 @@ void EditStage(short iEditStage) game_values.tourstops[iEditStage]->iNumUsedSettings = g_iNumGameModeSettings[iMode]; } else { //Show the settings button for boss mode - miModeSettingsButton->Show(iMode == 1001); + miModeSettingsButton->setVisible(iMode == 1001); for (short iGameMode = 0; iGameMode < GAMEMODE_LAST; iGameMode++) { - miGoalField[iGameMode]->Show(false); + miGoalField[iGameMode]->setVisible(false); } if (iStageType == 1) { //Bonus House @@ -4086,29 +4086,29 @@ int editor_stage() } else if (MENU_CODE_MODE_CHANGED == code) { short iMode = miModeField->currentValue(); - miPointsField->Show(iMode != 24); - miFinalStageField->Show(iMode != 24); + miPointsField->setVisible(iMode != 24); + miFinalStageField->setVisible(iMode != 24); - miMapField->Show(iMode != 24); + miMapField->setVisible(iMode != 24); - miBonusType->Show(iMode == 24); - miBonusTextField[0]->Show(iMode == 24); - miBonusTextField[1]->Show(iMode == 24); - miBonusTextField[2]->Show(iMode == 24); - miBonusTextField[3]->Show(iMode == 24); - miBonusTextField[4]->Show(iMode == 24); + miBonusType->setVisible(iMode == 24); + miBonusTextField[0]->setVisible(iMode == 24); + miBonusTextField[1]->setVisible(iMode == 24); + miBonusTextField[2]->setVisible(iMode == 24); + miBonusTextField[3]->setVisible(iMode == 24); + miBonusTextField[4]->setVisible(iMode == 24); - miSpecialGoalField[0]->Show(iMode == 25); - miSpecialGoalField[1]->Show(iMode == 26); - miSpecialGoalField[2]->Show(iMode == 27); + miSpecialGoalField[0]->setVisible(iMode == 25); + miSpecialGoalField[1]->setVisible(iMode == 26); + miSpecialGoalField[2]->setVisible(iMode == 27); miBonusItemsButton->SetPosition(430, iMode != 24 ? 220 : 340); if (iMode >= 0 && iMode < GAMEMODE_LAST) { - miModeSettingsButton->Show(iMode != game_mode_owned); + miModeSettingsButton->setVisible(iMode != game_mode_owned); for (short iGameMode = 0; iGameMode < GAMEMODE_LAST; iGameMode++) { - miGoalField[iGameMode]->Show(iMode == iGameMode); + miGoalField[iGameMode]->setVisible(iMode == iGameMode); } miGoalField[iMode]->setOutputPtr(&game_values.tourstops[iEditStage]->iGoal); @@ -4120,10 +4120,10 @@ int editor_stage() game_values.tourstops[iEditStage]->iNumUsedSettings = g_iNumGameModeSettings[iMode]; } else { //Show the settings button for boss mode - miModeSettingsButton->Show(iMode == 26); + miModeSettingsButton->setVisible(iMode == 26); for (short iGameMode = 0; iGameMode < GAMEMODE_LAST; iGameMode++) - miGoalField[iGameMode]->Show(false); + miGoalField[iGameMode]->setVisible(false); if (iMode == 24) { game_values.tourstops[iEditStage]->iStageType = 1; @@ -4169,11 +4169,11 @@ int editor_stage() mCurrentMenu = &mBonusItemPicker; mCurrentMenu->ResetMenu(); } else if (MENU_CODE_DELETE_STAGE_BUTTON == code) { - miDeleteStageDialogImage->Show(true); - miDeleteStageDialogAreYouText->Show(true); - miDeleteStageDialogSureText->Show(true); - miDeleteStageDialogYesButton->Show(true); - miDeleteStageDialogNoButton->Show(true); + miDeleteStageDialogImage->setVisible(true); + miDeleteStageDialogAreYouText->setVisible(true); + miDeleteStageDialogSureText->setVisible(true); + miDeleteStageDialogYesButton->setVisible(true); + miDeleteStageDialogNoButton->setVisible(true); EnableStageMenu(false); @@ -4183,11 +4183,11 @@ int editor_stage() mStageSettingsMenu.SetCancelCode(MENU_CODE_DELETE_STAGE_NO); mStageSettingsMenu.ResetMenu(); } else if (MENU_CODE_DELETE_STAGE_YES == code || MENU_CODE_DELETE_STAGE_NO == code) { - miDeleteStageDialogImage->Show(false); - miDeleteStageDialogAreYouText->Show(false); - miDeleteStageDialogSureText->Show(false); - miDeleteStageDialogYesButton->Show(false); - miDeleteStageDialogNoButton->Show(false); + miDeleteStageDialogImage->setVisible(false); + miDeleteStageDialogAreYouText->setVisible(false); + miDeleteStageDialogSureText->setVisible(false); + miDeleteStageDialogYesButton->setVisible(false); + miDeleteStageDialogNoButton->setVisible(false); mStageSettingsMenu.setInitialFocus(miNameField); mStageSettingsMenu.SetCancelCode(MENU_CODE_EXIT_APPLICATION); From 0d023fc4294907be2d68a5a1e9eed5dae4df8656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Mustoha?= Date: Tue, 2 Jul 2024 17:13:58 +0200 Subject: [PATCH 4/4] Neighbor-related refactoring in the UI code --- src/common/GlobalConstants.h | 5 --- src/common/ui/MenuCode.h | 7 ++++ src/common/uicontrol.cpp | 12 +++--- src/common/uicontrol.h | 52 +++++++++++++------------- src/common/uimenu.cpp | 45 +++++++++++++++------- src/common/uimenu.h | 2 +- src/smw/menu/network/NetRoomMenu.cpp | 4 +- src/smw/ui/MI_BonusWheel.cpp | 2 +- src/smw/ui/MI_PowerupSelection.cpp | 2 +- src/smw/ui/MI_StringScroll.cpp | 4 +- src/smw/ui/MI_TournamentScoreboard.cpp | 8 ++-- src/smw/ui/MI_World.cpp | 14 +++---- src/smw/ui/NetworkListScroll.cpp | 4 +- 13 files changed, 91 insertions(+), 70 deletions(-) diff --git a/src/common/GlobalConstants.h b/src/common/GlobalConstants.h index 391d3123..fc22f2f8 100644 --- a/src/common/GlobalConstants.h +++ b/src/common/GlobalConstants.h @@ -133,11 +133,6 @@ #define HALF_PI 1.5707963f #define QUARTER_PI 0.7853982f -#define MENU_ITEM_NEIGHBOR_UP 0 -#define MENU_ITEM_NEIGHBOR_DOWN 1 -#define MENU_ITEM_NEIGHBOR_LEFT 2 -#define MENU_ITEM_NEIGHBOR_RIGHT 3 - #define NUM_POWERUPS 26 #define NUM_WORLD_POWERUPS 15 #define NUM_WORLD_SCORE_BONUSES 20 diff --git a/src/common/ui/MenuCode.h b/src/common/ui/MenuCode.h index 915ce029..d2cd9a09 100644 --- a/src/common/ui/MenuCode.h +++ b/src/common/ui/MenuCode.h @@ -120,3 +120,10 @@ enum MenuCodeEnum { MENU_CODE_TO_NET_ROOM_START_IN_PROGRESS, MENU_CODE_NET_ROOM_GO, }; + +enum class MenuNavDirection : unsigned char { + Up, + Down, + Left, + Right, +}; diff --git a/src/common/uicontrol.cpp b/src/common/uicontrol.cpp index 2d093cce..0dfbe7e4 100644 --- a/src/common/uicontrol.cpp +++ b/src/common/uicontrol.cpp @@ -6,7 +6,7 @@ UI_Control::UI_Control(short x, short y) : m_pos(x, y) { - neighborControls.fill(nullptr); + m_neighbors.fill(nullptr); } @@ -21,8 +21,8 @@ UI_Control& UI_Control::operator= (const UI_Control& other) fDisable = other.fDisable; m_visible = other.m_visible; - uiMenu = nullptr; - neighborControls.fill(nullptr); + m_parentMenu = nullptr; + m_neighbors.fill(nullptr); iControllingTeam = other.iControllingTeam; } return *this; @@ -35,8 +35,8 @@ UI_Control::UI_Control(const UI_Control& other) } -void UI_Control::SetNeighbor(unsigned short iNeighbor, UI_Control* uiControl) +void UI_Control::setNeighbor(MenuNavDirection iNeighbor, UI_Control* uiControl) { - assert(iNeighbor < neighborControls.size()); - neighborControls[iNeighbor] = uiControl; + const auto idx = static_cast(iNeighbor); + m_neighbors[idx] = uiControl; } diff --git a/src/common/uicontrol.h b/src/common/uicontrol.h index 57a716a4..468c4a0f 100644 --- a/src/common/uicontrol.h +++ b/src/common/uicontrol.h @@ -35,6 +35,25 @@ class UI_Control return MENU_CODE_NONE; } + /// Called when user selects this control to change it's value + virtual MenuCodeEnum Modify(bool modify) { + if (fDisable) + return MENU_CODE_UNSELECT_ITEM; + + fModifying = modify; + return MENU_CODE_MODIFY_ACCEPTED; + } + + virtual MenuCodeEnum MouseClick(short iMouseX, short iMouseY) { + return MENU_CODE_NONE; + } + + virtual void Refresh() {} + + virtual void Disable(bool disable) { + fDisable = disable; + } + bool Select(bool select) { fSelected = select; @@ -44,14 +63,6 @@ class UI_Control return fModifying; } - virtual MenuCodeEnum Modify(bool modify) { - if (fDisable) - return MENU_CODE_UNSELECT_ITEM; - - fModifying = modify; - return MENU_CODE_MODIFY_ACCEPTED; - } - void SetAutoModify(bool autoModify) { fAutoModify = autoModify; } @@ -63,10 +74,11 @@ class UI_Control m_pos = {x, y}; } - void SetNeighbor(unsigned short iNeighbor, UI_Control* uiControl); + void setNeighbor(MenuNavDirection iNeighbor, UI_Control* uiControl); - UI_Control* GetNeighbor(short iNeighbor) const { - return neighborControls[iNeighbor]; + UI_Control* neighbor(MenuNavDirection iNeighbor) const { + const auto idx = static_cast(iNeighbor); + return m_neighbors[idx]; } void setVisible(bool show) { @@ -76,8 +88,8 @@ class UI_Control return m_visible; } - void SetMenuParent(UI_Menu* menu) { - uiMenu = menu; + void setParent(UI_Menu* menu) { + m_parentMenu = menu; } bool IsModifying() const { @@ -88,16 +100,6 @@ class UI_Control iControllingTeam = teamid; } - virtual MenuCodeEnum MouseClick(short iMouseX, short iMouseY) { - return MENU_CODE_NONE; - } - - virtual void Refresh() {} - - virtual void Disable(bool disable) { - fDisable = disable; - } - protected: Vec2s m_pos = Vec2s::zero(); @@ -107,8 +109,8 @@ class UI_Control bool fDisable = false; bool m_visible = true; - std::array neighborControls; + std::array m_neighbors; - UI_Menu* uiMenu = nullptr; + UI_Menu* m_parentMenu = nullptr; short iControllingTeam = -1; }; diff --git a/src/common/uimenu.cpp b/src/common/uimenu.cpp index 9b0088d5..6bd231c3 100644 --- a/src/common/uimenu.cpp +++ b/src/common/uimenu.cpp @@ -3,24 +3,41 @@ #include "GameValues.h" // UI_Menu::SendInput #include "uicontrol.h" +#include + extern short LookupTeamID(short id); extern CGameValues game_values; +namespace { +constexpr MenuCodeEnum navDir2menuCode(MenuNavDirection direction) +{ + switch (direction) { + case MenuNavDirection::Up: return MenuCodeEnum::MENU_CODE_NEIGHBOR_UP; + case MenuNavDirection::Down: return MenuCodeEnum::MENU_CODE_NEIGHBOR_DOWN; + case MenuNavDirection::Left: return MenuCodeEnum::MENU_CODE_NEIGHBOR_LEFT; + case MenuNavDirection::Right: return MenuCodeEnum::MENU_CODE_NEIGHBOR_RIGHT; + } + assert(false); + return MenuCodeEnum::MENU_CODE_NONE; +} +} // namespace + + void UI_Menu::AddControl(UI_Control* control, UI_Control* up, UI_Control* down, UI_Control* left, UI_Control* right) { - control->SetMenuParent(this); - control->SetNeighbor(MENU_ITEM_NEIGHBOR_UP, up); - control->SetNeighbor(MENU_ITEM_NEIGHBOR_DOWN, down); - control->SetNeighbor(MENU_ITEM_NEIGHBOR_LEFT, left); - control->SetNeighbor(MENU_ITEM_NEIGHBOR_RIGHT, right); + control->setParent(this); + control->setNeighbor(MenuNavDirection::Up, up); + control->setNeighbor(MenuNavDirection::Down, down); + control->setNeighbor(MenuNavDirection::Left, left); + control->setNeighbor(MenuNavDirection::Right, right); controls.emplace_back(control); } void UI_Menu::AddNonControl(UI_Control* control) { - control->SetMenuParent(this); + control->setParent(this); controls.emplace_back(control); } @@ -94,19 +111,19 @@ MenuCodeEnum UI_Menu::SendInput(CPlayerInput* playerInput) } if (playerInput->outputControls[iPlayer].menu_up.fPressed) { - return MoveNextControl(MENU_CODE_NEIGHBOR_UP); + return MoveNextControl(MenuNavDirection::Up); } if (playerInput->outputControls[iPlayer].menu_down.fPressed) { - return MoveNextControl(MENU_CODE_NEIGHBOR_DOWN); + return MoveNextControl(MenuNavDirection::Down); } if (playerInput->outputControls[iPlayer].menu_left.fPressed) { - return MoveNextControl(MENU_CODE_NEIGHBOR_LEFT); + return MoveNextControl(MenuNavDirection::Left); } if (playerInput->outputControls[iPlayer].menu_right.fPressed) { - return MoveNextControl(MENU_CODE_NEIGHBOR_RIGHT); + return MoveNextControl(MenuNavDirection::Right); } if (playerInput->outputControls[iPlayer].menu_select.fPressed) { @@ -137,22 +154,22 @@ MenuCodeEnum UI_Menu::SendInput(CPlayerInput* playerInput) return MENU_CODE_NONE; } -MenuCodeEnum UI_Menu::MoveNextControl(MenuCodeEnum iDirection) +MenuCodeEnum UI_Menu::MoveNextControl(MenuNavDirection iDirection) { if (!m_currentFocus) return MENU_CODE_NONE; - UI_Control* neighbor = m_currentFocus->GetNeighbor(iDirection); + UI_Control* neighbor = m_currentFocus->neighbor(iDirection); while (neighbor && !neighbor->IsVisible()) { - neighbor = neighbor->GetNeighbor(iDirection); + neighbor = neighbor->neighbor(iDirection); } if (neighbor) { m_currentFocus->Select(false); m_currentFocus = neighbor; fModifyingItem = m_currentFocus->Select(true); - return iDirection; + return navDir2menuCode(iDirection); } return MENU_CODE_NONE; diff --git a/src/common/uimenu.h b/src/common/uimenu.h index a3a4a50e..f7add738 100644 --- a/src/common/uimenu.h +++ b/src/common/uimenu.h @@ -61,7 +61,7 @@ class UI_Menu { void Refresh(); protected: - MenuCodeEnum MoveNextControl(MenuCodeEnum iDirection); + MenuCodeEnum MoveNextControl(MenuNavDirection iDirection); std::vector> controls; diff --git a/src/smw/menu/network/NetRoomMenu.cpp b/src/smw/menu/network/NetRoomMenu.cpp index fdecf5f2..8aa9d1a7 100644 --- a/src/smw/menu/network/NetRoomMenu.cpp +++ b/src/smw/menu/network/NetRoomMenu.cpp @@ -86,8 +86,8 @@ void UI_NetRoomMenu::Refresh() { miNetRoomHeaderText->SetText(netplay.currentRoom.name.c_str()); - miNetRoomStartButton->SetNeighbor(MENU_ITEM_NEIGHBOR_UP, miSkinSelector[netplay.remotePlayerNumber]); - miNetRoomMessageField->SetNeighbor(MENU_ITEM_NEIGHBOR_DOWN, miSkinSelector[netplay.remotePlayerNumber]); + miNetRoomStartButton->setNeighbor(MenuNavDirection::Up, miSkinSelector[netplay.remotePlayerNumber]); + miNetRoomMessageField->setNeighbor(MenuNavDirection::Down, miSkinSelector[netplay.remotePlayerNumber]); for (short p = 0; p < 4; p++) { miNetRoomPlayerName[p]->SetText(netplay.currentRoom.playerNames[p].c_str()); diff --git a/src/smw/ui/MI_BonusWheel.cpp b/src/smw/ui/MI_BonusWheel.cpp index 45f8c955..12f93c1b 100644 --- a/src/smw/ui/MI_BonusWheel.cpp +++ b/src/smw/ui/MI_BonusWheel.cpp @@ -92,7 +92,7 @@ void MI_BonusWheel::Update() short iPoofX = m_pos.x + 152 + (short)(110.0f * cos(dSelectionSector[iDisplayPowerupIndex])); short iPoofY = m_pos.y + 200 + (short)(110.0f * sin(dSelectionSector[iDisplayPowerupIndex])); - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_poof, iPoofX, iPoofY, 4, 5)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_poof, iPoofX, iPoofY, 4, 5)); ifSoundOnPlay(rm->sfx_cannon); diff --git a/src/smw/ui/MI_PowerupSelection.cpp b/src/smw/ui/MI_PowerupSelection.cpp index 42d5405d..a5a26284 100644 --- a/src/smw/ui/MI_PowerupSelection.cpp +++ b/src/smw/ui/MI_PowerupSelection.cpp @@ -228,7 +228,7 @@ void MI_PowerupSelection::EnablePowerupFields(bool fEnable) miPowerupSlider[iPowerup]->Disable(!fEnable); } - miPreset->SetNeighbor(1, fEnable ? miPowerupSlider[0] : NULL); + miPreset->setNeighbor(MenuNavDirection::Down, fEnable ? miPowerupSlider[0] : NULL); } MenuCodeEnum MI_PowerupSelection::Modify(bool modify) diff --git a/src/smw/ui/MI_StringScroll.cpp b/src/smw/ui/MI_StringScroll.cpp index e87dac24..1e6c1d01 100644 --- a/src/smw/ui/MI_StringScroll.cpp +++ b/src/smw/ui/MI_StringScroll.cpp @@ -102,14 +102,14 @@ MenuCodeEnum MI_StringScroll::SendInput(CPlayerInput * playerInput) } if (playerInput->outputControls[iPlayer].menu_left.fPressed) { - if (neighborControls[2]) + if (neighbor(MenuNavDirection::Left)) return MENU_CODE_UNSELECT_ITEM; return MENU_CODE_NONE; } if (playerInput->outputControls[iPlayer].menu_right.fPressed) { - if (neighborControls[3]) + if (neighbor(MenuNavDirection::Right)) return MENU_CODE_UNSELECT_ITEM; return MENU_CODE_NONE; diff --git a/src/smw/ui/MI_TournamentScoreboard.cpp b/src/smw/ui/MI_TournamentScoreboard.cpp index 0013173f..3201c891 100644 --- a/src/smw/ui/MI_TournamentScoreboard.cpp +++ b/src/smw/ui/MI_TournamentScoreboard.cpp @@ -147,7 +147,7 @@ void MI_TournamentScoreboard::Update() } } - if (uiMenu) { + if (m_parentMenu) { if (iTournamentWinner != -1) { //Single tournament winning team if (--iFireworksCounter < 0 && iTournamentWinner >= 0) { iFireworksCounter = (short)(RANDOM_INT(30) + 10); @@ -167,7 +167,7 @@ void MI_TournamentScoreboard::Update() float dVelY = dVel * sin(dAngle); short iRandomColor = (short)RANDOM_INT(iTeamCounts[iTournamentWinner]); - uiMenu->AddEyeCandy(new EC_FallingObject(&rm->spr_bonus, iRandX, iRandY, dVelX, dVelY, 4, 2, 0, game_values.colorids[iTeamIDs[iTournamentWinner][iRandomColor]] << 4, 16, 16)); + m_parentMenu->AddEyeCandy(new EC_FallingObject(&rm->spr_bonus, iRandX, iRandY, dVelX, dVelY, 4, 2, 0, game_values.colorids[iTeamIDs[iTournamentWinner][iRandomColor]] << 4, 16, 16)); dAngle -= (float)PI / 14; } } else { @@ -177,7 +177,7 @@ void MI_TournamentScoreboard::Update() short iRandY = (short)(RANDOM_INT(416)); short iRandomColor = (short)RANDOM_INT(iTeamCounts[iTournamentWinner]); - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireworks, iRandX, iRandY, 8, 4, 0, game_values.colorids[iTeamIDs[iTournamentWinner][iRandomColor]] << 6, 64, 64)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireworks, iRandX, iRandY, 8, 4, 0, game_values.colorids[iTeamIDs[iTournamentWinner][iRandomColor]] << 6, 64, 64)); } } @@ -196,7 +196,7 @@ void MI_TournamentScoreboard::Update() short iRandX = (short)(RANDOM_INT(App::screenWidth - iStringWidth) + (iStringWidth >> 1)); short iRandY = (short)(RANDOM_INT(App::screenHeight - 100) + 100); - uiMenu->AddEyeCandy(new EC_GravText(&rm->menu_font_large, iRandX, iRandY, szWinnerText, -VELJUMP)); + m_parentMenu->AddEyeCandy(new EC_GravText(&rm->menu_font_large, iRandX, iRandY, szWinnerText, -VELJUMP)); } } } diff --git a/src/smw/ui/MI_World.cpp b/src/smw/ui/MI_World.cpp index 39def3bf..07765203 100644 --- a/src/smw/ui/MI_World.cpp +++ b/src/smw/ui/MI_World.cpp @@ -135,7 +135,7 @@ void MI_World::DisplayTeamControlAnnouncement() else sprintf(szMessage, "Team %d Is In Control", iControllingTeam + 1); - uiMenu->AddEyeCandy(new EC_Announcement(&rm->menu_font_large, &rm->spr_announcementicons, szMessage, game_values.colorids[iControllingPlayerId], 120, 100)); + m_parentMenu->AddEyeCandy(new EC_Announcement(&rm->menu_font_large, &rm->spr_announcementicons, szMessage, game_values.colorids[iControllingPlayerId], 120, 100)); } void MI_World::SetCurrentStageToCompleted(short iWinningTeam) @@ -923,7 +923,7 @@ bool MI_World::UsePowerup(short iPlayer, short iTeam, short iIndex, bool fPopupI g_worldmap.UpdateTile(sMapSurface[0], iDestX - iMapDrawOffsetCol, iDestY - iMapDrawOffsetRow, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); g_worldmap.UpdateTile(sMapSurface[1], iDestX - iMapDrawOffsetCol, iDestY - iMapDrawOffsetRow, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_poof, (iDestX << 5) + iMapOffsetX - 8, (iDestY << 5) + iMapOffsetY - 8, 4, 5)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_poof, (iDestX << 5) + iMapOffsetX - 8, (iDestY << 5) + iMapOffsetY - 8, 4, 5)); fUsedItem = true; ifSoundOnPlay(rm->sfx_transform); @@ -938,28 +938,28 @@ bool MI_World::UsePowerup(short iPlayer, short iTeam, short iIndex, bool fPopupI short iPlayerY = (iPlayerCurrentTileY << 5) + iMapOffsetY; if (iDoorsOpened & 0x1) { - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX - TILESIZE, iPlayerY, 3, 8)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX - TILESIZE, iPlayerY, 3, 8)); g_worldmap.UpdateTile(sMapSurface[0], iPlayerCurrentTileX - iMapDrawOffsetCol - 1, iPlayerCurrentTileY - iMapDrawOffsetRow, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); g_worldmap.UpdateTile(sMapSurface[1], iPlayerCurrentTileX - iMapDrawOffsetCol - 1, iPlayerCurrentTileY - iMapDrawOffsetRow, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); } if (iDoorsOpened & 0x2) { - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX + TILESIZE, iPlayerY, 3, 8)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX + TILESIZE, iPlayerY, 3, 8)); g_worldmap.UpdateTile(sMapSurface[0], iPlayerCurrentTileX - iMapDrawOffsetCol + 1, iPlayerCurrentTileY - iMapDrawOffsetRow, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); g_worldmap.UpdateTile(sMapSurface[1], iPlayerCurrentTileX - iMapDrawOffsetCol + 1, iPlayerCurrentTileY - iMapDrawOffsetRow, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); } if (iDoorsOpened & 0x4) { - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX, iPlayerY - TILESIZE, 3, 8)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX, iPlayerY - TILESIZE, 3, 8)); g_worldmap.UpdateTile(sMapSurface[0], iPlayerCurrentTileX - iMapDrawOffsetCol, iPlayerCurrentTileY - iMapDrawOffsetRow - 1, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); g_worldmap.UpdateTile(sMapSurface[1], iPlayerCurrentTileX - iMapDrawOffsetCol, iPlayerCurrentTileY - iMapDrawOffsetRow - 1, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); } if (iDoorsOpened & 0x8) { - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX, iPlayerY + TILESIZE, 3, 8)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_fireballexplosion, iPlayerX, iPlayerY + TILESIZE, 3, 8)); g_worldmap.UpdateTile(sMapSurface[0], iPlayerCurrentTileX - iMapDrawOffsetCol, iPlayerCurrentTileY - iMapDrawOffsetRow + 1, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); g_worldmap.UpdateTile(sMapSurface[1], iPlayerCurrentTileX - iMapDrawOffsetCol, iPlayerCurrentTileY - iMapDrawOffsetRow + 1, iMapDrawOffsetCol, iMapDrawOffsetRow, iAnimationFrame); @@ -1022,5 +1022,5 @@ void MI_World::UseCloud(bool fUseCloud) short iPlayerX, iPlayerY; g_worldmap.GetPlayerPosition(&iPlayerX, &iPlayerY); - uiMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_poof, iPlayerX + iMapOffsetX - 8, iPlayerY + iMapOffsetY - 8, 4, 5)); + m_parentMenu->AddEyeCandy(new EC_SingleAnimation(&rm->spr_poof, iPlayerX + iMapOffsetX - 8, iPlayerY + iMapOffsetY - 8, 4, 5)); } diff --git a/src/smw/ui/NetworkListScroll.cpp b/src/smw/ui/NetworkListScroll.cpp index ddf84c11..9566d0b8 100644 --- a/src/smw/ui/NetworkListScroll.cpp +++ b/src/smw/ui/NetworkListScroll.cpp @@ -102,7 +102,7 @@ MenuCodeEnum MI_NetworkListScroll::SendInput(CPlayerInput * playerInput) } if (playerInput->outputControls[iPlayer].menu_left.fPressed) { - if (neighborControls[2]) { + if (neighbor(MenuNavDirection::Left)) { iSelectedLineBackup = iSelectedLine; iSelectedLine = -1; return MENU_CODE_UNSELECT_ITEM; @@ -111,7 +111,7 @@ MenuCodeEnum MI_NetworkListScroll::SendInput(CPlayerInput * playerInput) } if (playerInput->outputControls[iPlayer].menu_right.fPressed) { - if (neighborControls[3]) { + if (neighbor(MenuNavDirection::Right)) { iSelectedLineBackup = iSelectedLine; iSelectedLine = -1; return MENU_CODE_UNSELECT_ITEM;