summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Roncace <me@caseif.net>2026-04-11 02:43:37 -0400
committerGitHub <noreply@github.com>2026-04-10 23:43:37 -0700
commitd7c34741e23297863254089125ed9ab56617dc5b (patch)
tree6165df2b21a161a4349dd9c62440283a1909a9c1
parentdabd6961a674f23ec0df8f2b4d16ba12e1e090e5 (diff)
Replace magic constants derived from framebuffer size (#3144)
-rw-r--r--include/m_Do/m_Do_graphic.h6
-rw-r--r--src/d/d_com_inf_game.cpp2
-rw-r--r--src/d/d_file_select.cpp2
-rw-r--r--src/d/d_jcam_editor.cpp3
-rw-r--r--src/d/d_kankyo.cpp4
-rw-r--r--src/d/d_menu_collect.cpp2
-rw-r--r--src/d/d_menu_fmap.cpp24
-rw-r--r--src/d/d_menu_insect.cpp3
-rw-r--r--src/d/d_menu_item_explain.cpp3
-rw-r--r--src/d/d_menu_ring.cpp36
-rw-r--r--src/d/d_meter2_info.cpp8
-rw-r--r--src/d/d_meter_HIO.cpp6
-rw-r--r--src/d/d_meter_button.cpp2
-rw-r--r--src/d/d_meter_haihai.cpp12
-rw-r--r--src/d/d_msg_scrn_explain.cpp13
-rw-r--r--src/d/d_msg_scrn_item.cpp3
-rw-r--r--src/d/d_msg_scrn_talk.cpp7
-rw-r--r--src/d/d_s_logo.cpp11
-rw-r--r--src/d/d_scope.cpp22
-rw-r--r--src/m_Do/m_Do_graphic.cpp34
20 files changed, 111 insertions, 92 deletions
diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h
index a00d62dbe8..123326c207 100644
--- a/include/m_Do/m_Do_graphic.h
+++ b/include/m_Do/m_Do_graphic.h
@@ -5,12 +5,14 @@
#include "m_Do/m_Do_mtx.h"
#include "global.h"
+#define FB_WIDTH_BASE (608)
+#define FB_HEIGHT_BASE (448)
#if WIDESCREEN_SUPPORT
#define FB_WIDTH (640)
#define FB_HEIGHT (456)
#else
-#define FB_WIDTH (608)
-#define FB_HEIGHT (448)
+#define FB_WIDTH FB_WIDTH_BASE
+#define FB_HEIGHT FB_HEIGHT_BASE
#endif
int mDoGph_Create();
diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp
index b461738e11..8dd0118685 100644
--- a/src/d/d_com_inf_game.cpp
+++ b/src/d/d_com_inf_game.cpp
@@ -1018,7 +1018,7 @@ bool dComIfG_inf_c::baseCsr_c::navi_c::draw(f32 param_1, f32 param_2, u8 param_3
f32 f27 = f31 - field_0x5c;
field_0x58 = f29;
field_0x5c = f31;
- cXyz spdc(param_1 - 304.0f, param_2 - 224.0f, 0.0f);
+ cXyz spdc(param_1 - FB_WIDTH_BASE / 2, param_2 - FB_HEIGHT_BASE / 2, 0.0f);
f32 target = param_3 != 0 ? 1.5f : 0.0f;
diff --git a/src/d/d_file_select.cpp b/src/d/d_file_select.cpp
index 1bbc3eb78c..fc262d4f2b 100644
--- a/src/d/d_file_select.cpp
+++ b/src/d/d_file_select.cpp
@@ -5437,7 +5437,7 @@ void dFile_select3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz*
Mtx adStack_98;
Mtx auStack_c8;
param_0 = (2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f);
- param_1 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f);
+ param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f);
calcViewMtx(adStack_98);
cMtx_inverse(adStack_98, auStack_c8);
f32 tangent = std::tan(M_PI / 8.0f);
diff --git a/src/d/d_jcam_editor.cpp b/src/d/d_jcam_editor.cpp
index 4700fdbe10..a5afe0c117 100644
--- a/src/d/d_jcam_editor.cpp
+++ b/src/d/d_jcam_editor.cpp
@@ -1,11 +1,12 @@
#include "d/d_jcam_editor.h"
+#include "m_Do/m_Do_graphic.h"
#include "m_Do/m_Do_hostIO.h"
#include "m_Do/m_Do_ext.h"
dJcame_c* dJcame_c::m_myObj;
dJcame_c::dJcame_c(const JStage::TSystem* i_system, f32 param_1, JUTGamePad& i_pad) {
- mOrthoGraph = new J2DOrthoGraph(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f);
+ mOrthoGraph = new J2DOrthoGraph(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, -1.0f, 1.0f);
mFont = new JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL);
mHeap = JKRExpHeap::create(0x100000, JKRHeap::getRootHeap2(), false);
diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp
index 2490209efd..09d013115f 100644
--- a/src/d/d_kankyo.cpp
+++ b/src/d/d_kankyo.cpp
@@ -10971,9 +10971,9 @@ void dKy_depth_dist_set(void* process_p) {
if ((sp30.x >= 0.0f && sp30.x < FB_WIDTH) && (sp30.y >= 0.0f &&
#if DEBUG
- sp30.y < 608.0f
+ sp30.y < FB_WIDTH_BASE
#else
- sp30.y < 600.0f
+ sp30.y < (FB_WIDTH_BASE - 8)
#endif
)) {
cXyz sp18;
diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp
index 809a473c9a..c72379a7f2 100644
--- a/src/d/d_menu_collect.cpp
+++ b/src/d/d_menu_collect.cpp
@@ -2568,7 +2568,7 @@ void dMenu_Collect3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz*
Mtx auStack_c8;
param_0 =
(2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f);
- param_1 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f);
+ param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f);
calcViewMtx(adStack_98);
MTXInverse(adStack_98, auStack_c8);
f32 tangent = tan(0.39269909262657166);
diff --git a/src/d/d_menu_fmap.cpp b/src/d/d_menu_fmap.cpp
index 2cb5987613..db722089d7 100644
--- a/src/d/d_menu_fmap.cpp
+++ b/src/d/d_menu_fmap.cpp
@@ -227,17 +227,17 @@ dMenu_Fmap_c::dMenu_Fmap_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
}
if (i_panDirection == 1) {
- mTransX = -608.0f;
+ mTransX = -FB_WIDTH_BASE;
mTransY = 0.0f;
} else if (i_panDirection == 3) {
- mTransX = 608.0f;
+ mTransX = FB_WIDTH_BASE;
mTransY = 0.0f;
} else if (i_panDirection == 2) {
mTransX = 0.0f;
- mTransY = -448.0f;
+ mTransY = -FB_HEIGHT_BASE;
} else if (i_panDirection == 0) {
mTransX = 0.0f;
- mTransY = 448.0f;
+ mTransY = FB_HEIGHT_BASE;
} else {
mTransX = 0.0f;
mTransY = 0.0f;
@@ -1703,17 +1703,17 @@ bool dMenu_Fmap_c::isOpen() {
f32 ratio = (f32)mDisplayFrame / (f32)display_frame_num;
if (mPanDirection == 1) {
- mTransX = (1.0f - ratio) * -608.0f;
+ mTransX = (1.0f - ratio) * -FB_WIDTH_BASE;
mTransY = 0.0f;
} else if (mPanDirection == 3) {
- mTransX = (1.0f - ratio) * 608.0f;
+ mTransX = (1.0f - ratio) * FB_WIDTH_BASE;
mTransY = 0.0f;
} else if (mPanDirection == 2) {
mTransX = 0.0f;
- mTransY = (1.0f - ratio) * -448.0f;
+ mTransY = (1.0f - ratio) * -FB_HEIGHT_BASE;
} else if (mPanDirection == 0) {
mTransX = 0.0f;
- mTransY = (1.0f - ratio) * 448.0f;
+ mTransY = (1.0f - ratio) * FB_HEIGHT_BASE;
}
mAlphaRatio = ratio;
@@ -1753,17 +1753,17 @@ bool dMenu_Fmap_c::isClose() {
}
if (mPanDirection == 1) {
- mTransX = (1.0f - ratio) * 608.0f;
+ mTransX = (1.0f - ratio) * FB_WIDTH_BASE;
mTransY = 0.0f;
} else if (mPanDirection == 3) {
- mTransX = (1.0f - ratio) * -608.0f;
+ mTransX = (1.0f - ratio) * -FB_WIDTH_BASE;
mTransY = 0.0f;
} else if (mPanDirection == 2) {
mTransX = 0.0f;
- mTransY = (1.0f - ratio) * 448.0f;
+ mTransY = (1.0f - ratio) * FB_HEIGHT_BASE;
} else if (mPanDirection == 0) {
mTransX = 0.0f;
- mTransY = (1.0f - ratio) * -448.0f;
+ mTransY = (1.0f - ratio) * -FB_HEIGHT_BASE;
}
mAlphaRatio = ratio;
diff --git a/src/d/d_menu_insect.cpp b/src/d/d_menu_insect.cpp
index d2560b548a..24c4076f01 100644
--- a/src/d/d_menu_insect.cpp
+++ b/src/d/d_menu_insect.cpp
@@ -169,6 +169,9 @@ void dMenu_Insect_c::_draw() {
mpBlackTex->draw(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0, 0, 0);
mpExpScreen->draw(0.0f, 0.0f, grafPort);
mpSelect_c->setOffsetX(g_drawHIO.mInsectListScreen.mConfirmOptionPosX_4x3);
+ // the magic numbers here are correlated with the framebuffer size, but
+ // were likely either chosen by hand or had multiple arithmetic
+ // operations applied which cannot easily be reverse engineered
mpSelect_c->translate(g_drawHIO.mInsectListScreen.mConfirmOptionPosX_4x3 + 486.0f,
g_drawHIO.mInsectListScreen.mConfirmOptionPosY_4x3 + 209.0f);
mpSelect_c->draw(0.0f, 0.0f);
diff --git a/src/d/d_menu_item_explain.cpp b/src/d/d_menu_item_explain.cpp
index cfb76fa24a..5159940d2e 100644
--- a/src/d/d_menu_item_explain.cpp
+++ b/src/d/d_menu_item_explain.cpp
@@ -325,6 +325,9 @@ void dMenu_ItemExplain_c::draw(J2DOrthoGraph* i_graph) {
mpInfoString->drawOutFontLocal((J2DTextBox*)mpInfoText->getPanePtr(), -1.0f);
drawKantera();
if (mpSelect_c != NULL) {
+ // the magic numbers here are correlated with the framebuffer size, but
+ // were likely either chosen by hand or had multiple arithmetic
+ // operations applied which cannot easily be reverse engineered
mpSelect_c->translate(486.0f, 209.0f);
mpSelect_c->draw(0.0f, 0.0f);
}
diff --git a/src/d/d_menu_ring.cpp b/src/d/d_menu_ring.cpp
index 4374dd1826..6de4f86fdb 100644
--- a/src/d/d_menu_ring.cpp
+++ b/src/d/d_menu_ring.cpp
@@ -87,16 +87,16 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
mPikariFlashingSpeed = 0.0f;
if (mRingOrigin == 0) {
mCenterPosX = 0.0f;
- mCenterPosY = 448.0f;
+ mCenterPosY = FB_HEIGHT_BASE;
} else if (mRingOrigin == 2) {
mCenterPosX = 0.0f;
- mCenterPosY = -448.0f;
+ mCenterPosY = -FB_HEIGHT_BASE;
}
if (mRingOrigin == 3) {
- mCenterPosX = 608.0f;
+ mCenterPosX = FB_WIDTH_BASE;
mCenterPosY = 0.0f;
} else if (mRingOrigin == 1) {
- mCenterPosX = -608.0f;
+ mCenterPosX = -FB_WIDTH_BASE;
mCenterPosY = 0.0f;
} else {
mCenterPosX = 0.0f;
@@ -644,15 +644,15 @@ bool dMenu_Ring_c::isOpen() {
mAlphaRate = (f32)mOpenCloseFrames / (f32)g_ringHIO.mOpenFrames;
if (mRingOrigin == 0) {
mCenterPosX = 0.0f;
- mCenterPosY = (1.0f - mAlphaRate) * 448.0f;
+ mCenterPosY = (1.0f - mAlphaRate) * FB_HEIGHT_BASE;
} else if (mRingOrigin == 2) {
mCenterPosX = 0.0f;
- mCenterPosY = (1.0f - mAlphaRate) * -448.0f;
+ mCenterPosY = (1.0f - mAlphaRate) * -FB_HEIGHT_BASE;
} else if (mRingOrigin == 3) {
- mCenterPosX = (1.0f - mAlphaRate) * 608.0f;
+ mCenterPosX = (1.0f - mAlphaRate) * FB_WIDTH_BASE;
mCenterPosY = 0.0f;
} else if (mRingOrigin == 1) {
- mCenterPosX = (1.0f - mAlphaRate) * -608.0f;
+ mCenterPosX = (1.0f - mAlphaRate) * -FB_WIDTH_BASE;
mCenterPosY = 0.0f;
}
if (mOpenCloseFrames >= g_ringHIO.mOpenFrames) {
@@ -715,15 +715,15 @@ bool dMenu_Ring_c::isClose() {
}
if (mRingOrigin == 0) {
mCenterPosX = 0.0f;
- mCenterPosY = (1.0f - mAlphaRate) * -448.0f;
+ mCenterPosY = (1.0f - mAlphaRate) * -FB_HEIGHT_BASE;
} else if (mRingOrigin == 2) {
mCenterPosX = 0.0f;
- mCenterPosY = (1.0f - mAlphaRate) * 448.0f;
+ mCenterPosY = (1.0f - mAlphaRate) * FB_HEIGHT_BASE;
} else if (mRingOrigin == 3) {
- mCenterPosX = (1.0f - mAlphaRate) * -608.0f;
+ mCenterPosX = (1.0f - mAlphaRate) * -FB_WIDTH_BASE;
mCenterPosY = 0.0f;
} else if (mRingOrigin == 1) {
- mCenterPosX = (1.0f - mAlphaRate) * 608.0f;
+ mCenterPosX = (1.0f - mAlphaRate) * FB_WIDTH_BASE;
mCenterPosY = 0.0f;
}
mpDrawCursor->setPos(mItemSlotPosX[mCurrentSlot] + mCenterPosX,
@@ -855,11 +855,11 @@ s16 dMenu_Ring_c::calcStickAngle(STControl* i_stick, u8 param_1) {
}
void dMenu_Ring_c::setRotate() {
- clacEllipsePlotAverage(mItemsTotal, g_ringHIO.mItemRingPosX + 304.0f,
- g_ringHIO.mItemRingPosY + 224.0f);
+ clacEllipsePlotAverage(mItemsTotal, g_ringHIO.mItemRingPosX + FB_WIDTH_BASE / 2,
+ g_ringHIO.mItemRingPosY + FB_HEIGHT_BASE / 2);
for (int i = 0; i < mItemsTotal; i++) {
- field_0x63e[i] = cM_atan2s(mItemSlotPosX[i] - (304.0f + g_ringHIO.mItemRingPosX),
- mItemSlotPosY[i] - (224.0f + g_ringHIO.mItemRingPosY));
+ field_0x63e[i] = cM_atan2s(mItemSlotPosX[i] - (FB_WIDTH_BASE / 2 + g_ringHIO.mItemRingPosX),
+ mItemSlotPosY[i] - (FB_HEIGHT_BASE / 2 + g_ringHIO.mItemRingPosY));
}
}
@@ -1446,9 +1446,9 @@ void dMenu_Ring_c::stick_move_proc() {
setStatus(field_0x6b2);
} else {
f32 itemRingPosX =
- g_ringHIO.mItemRingPosX + 304.0f + mRingRadiusH * cM_ssin(field_0x66e);
+ g_ringHIO.mItemRingPosX + FB_WIDTH_BASE / 2 + mRingRadiusH * cM_ssin(field_0x66e);
f32 itemRingPosY =
- g_ringHIO.mItemRingPosY + 224.0f + mRingRadiusV * cM_scos(field_0x66e);
+ g_ringHIO.mItemRingPosY + FB_HEIGHT_BASE / 2 + mRingRadiusV * cM_scos(field_0x66e);
mpDrawCursor->setPos(itemRingPosX, itemRingPosY);
}
}
diff --git a/src/d/d_meter2_info.cpp b/src/d/d_meter2_info.cpp
index 3e8d2601c1..ed0d81d346 100644
--- a/src/d/d_meter2_info.cpp
+++ b/src/d/d_meter2_info.cpp
@@ -205,11 +205,11 @@ void dMeter2Info_c::init() {
unk_0x5c = 0.0f;
unk_0x60 = 1.0f;
unk_0x64 = 30.0f;
- unk_0x68 = 304.0f;
- unk_0x6c = 224.0f;
+ unk_0x68 = FB_WIDTH_BASE / 2;
+ unk_0x6c = FB_HEIGHT_BASE / 2;
- m2DWidth = 608.0f;
- m2DHeight = 448.0f;
+ m2DWidth = FB_WIDTH_BASE;
+ m2DHeight = FB_HEIGHT_BASE;
m2DPosH = 0.0f;
m2DPosV = 0.0f;
unk_0x80 = 0.0f;
diff --git a/src/d/d_meter_HIO.cpp b/src/d/d_meter_HIO.cpp
index e368881152..72f24f21d9 100644
--- a/src/d/d_meter_HIO.cpp
+++ b/src/d/d_meter_HIO.cpp
@@ -3995,9 +3995,9 @@ void dMeter_fmapHIO_c::genMessage(JORMContext* mctx) {
mctx->genSlider("リージョン拡大表示範囲", &mRegionZoomRange, 1000.0, 1000000.0);
mctx->genCheckBox("表示基準領域枠表示", (u8*)&mDisplayReferenceArea, 0x1);
mctx->genCheckBox("スクロール範囲を表示基準", (u8*)&field_0x308, 0x1);
- mctx->genSlider("左上座標X", &mMapTopLeftPosX, 0.0, 608.0);
- mctx->genSlider("左上座標Y", &mMapTopLeftPosY, 0.0, 448.0);
- mctx->genSlider("領域幅", &mMapScale, 0.0, 608.0);
+ mctx->genSlider("左上座標X", &mMapTopLeftPosX, 0.0, FB_WIDTH_BASE);
+ mctx->genSlider("左上座標Y", &mMapTopLeftPosY, 0.0, FB_HEIGHT_BASE);
+ mctx->genSlider("領域幅", &mMapScale, 0.0, FB_WIDTH_BASE);
mctx->genLabel("\n*** スクロール速度境界 ***", 0);
mctx->genSlider("0~遅", &mScrollSpeedSlowBound, 0.0, 1.0);
mctx->genSlider("遅~速", &mScrollSpeedFastBound, 0.0, 1.0);
diff --git a/src/d/d_meter_button.cpp b/src/d/d_meter_button.cpp
index 9fd0da14e0..9fe5443d63 100644
--- a/src/d/d_meter_button.cpp
+++ b/src/d/d_meter_button.cpp
@@ -1035,7 +1035,7 @@ void dMeterButton_c::screenInitButton() {
}
field_0x4b0 = 0;
- mParentCenterX = (608.0f / 2) - mpParent->getInitCenterPosX();
+ mParentCenterX = (FB_WIDTH_BASE / 2.0f) - mpParent->getInitCenterPosX();
paneTrans(mpParent, mParentCenterX, 0.0f, 0xFF);
mpButtonA = new CPaneMgr(mpButtonScreen, MULTI_CHAR('abtn_n'), 2, NULL);
diff --git a/src/d/d_meter_haihai.cpp b/src/d/d_meter_haihai.cpp
index 5e6c9fd3e7..55da5db550 100644
--- a/src/d/d_meter_haihai.cpp
+++ b/src/d/d_meter_haihai.cpp
@@ -99,28 +99,28 @@ void dMeterHaihai_c::draw() {
}
if (direction & DIR_DOWN_e || i_forceDraw) {
- mpParent->getPanePtr()->translate(x_pos[0] + 304.0f, y_pos[0] + 224.0f);
+ mpParent->getPanePtr()->translate(x_pos[0] + FB_WIDTH_BASE / 2, y_pos[0] + FB_HEIGHT_BASE / 2);
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 0.0f);
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
}
if (direction & DIR_RIGHT_e || i_forceDraw) {
- mpParent->getPanePtr()->translate(x_pos[1] + 304.0f, y_pos[1] + 224.0f);
+ mpParent->getPanePtr()->translate(x_pos[1] + FB_WIDTH_BASE / 2, y_pos[1] + FB_HEIGHT_BASE / 2);
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 90.0f);
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
}
if (direction & DIR_UP_e || i_forceDraw) {
- mpParent->getPanePtr()->translate(x_pos[0] + 304.0f, 224.0f - y_pos[0]);
+ mpParent->getPanePtr()->translate(x_pos[0] + FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2 - y_pos[0]);
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 180.0f);
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
}
if (direction & DIR_LEFT_e || i_forceDraw) {
- mpParent->getPanePtr()->translate(304.0f - x_pos[1], y_pos[1] + 224.0f);
+ mpParent->getPanePtr()->translate(FB_WIDTH_BASE / 2 - x_pos[1], y_pos[1] + FB_HEIGHT_BASE / 2);
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 270.0f);
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
@@ -128,8 +128,8 @@ void dMeterHaihai_c::draw() {
}
void dMeterHaihai_c::drawHaihai(u8 i_direction) {
- f32 center_x = 304.0f;
- f32 center_y = 224.0f;
+ f32 center_x = FB_WIDTH_BASE / 2;
+ f32 center_y = FB_HEIGHT_BASE / 2;
if (mType == 1) {
center_x += (3.0f + g_drawHIO.mScrollArrowCenterPosX);
diff --git a/src/d/d_msg_scrn_explain.cpp b/src/d/d_msg_scrn_explain.cpp
index 7387b36a6c..d14e193a40 100644
--- a/src/d/d_msg_scrn_explain.cpp
+++ b/src/d/d_msg_scrn_explain.cpp
@@ -70,7 +70,7 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs
mpTxScreen = new J2DScreen();
JUT_ASSERT(102, mpTxScreen != NULL);
- field_0x48 = 608.0f;
+ field_0x48 = FB_WIDTH_BASE;
if (param_1 == 1 || param_1 == 3) {
#if PLATFORM_GCN
@@ -306,7 +306,7 @@ void dMsgScrnExplain_c::draw(J2DOrthoGraph* i_graf) {
}
if (mpBackTex != NULL) {
- mpBackTex->draw(0.0f, 0.0f, 608.0f, 448.0f, false, false, false);
+ mpBackTex->draw(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, false, false, false);
}
if (field_0x66 != 2 && field_0x66 != 3) {
@@ -327,6 +327,9 @@ void dMsgScrnExplain_c::draw(J2DOrthoGraph* i_graf) {
strcpy(((J2DTextBox*)mpTm_c[0]->getPanePtr())->getStringPtr(), string_buf);
if (mpSelect_c != NULL && (field_0x64 == 1 || field_0x64 == 2)) {
+ // the magic numbers here are relative to the framebuffer size, but were likely
+ // either chosen by hand or had multiple arithmetic operations applied which
+ // cannot easily be reverse engineered
f32 y_offset = 0.0f;
if (field_0x66 == 2) {
y_offset = -100.0f;
@@ -382,7 +385,7 @@ void dMsgScrnExplain_c::open_request_proc() {
void dMsgScrnExplain_c::open_init() {
field_0x5a = 0;
- field_0x48 = 608.0f;
+ field_0x48 = FB_WIDTH_BASE;
for (int i = 0; i < 2; i++) {
mpRoot_c[i]->setAlphaRate(0.0f);
}
@@ -400,7 +403,7 @@ void dMsgScrnExplain_c::open_proc() {
}
}
- field_0x48 = 608.0f * getAlphaRatio();
+ field_0x48 = FB_WIDTH_BASE * getAlphaRatio();
for (int i = 0; i < 2; i++) {
mpRoot_c[i]->setAlphaRate(1.0f - getAlphaRatio());
}
@@ -580,7 +583,7 @@ void dMsgScrnExplain_c::close_proc() {
}
}
- field_0x48 = 608.0f * getAlphaRatio();
+ field_0x48 = FB_WIDTH_BASE * getAlphaRatio();
for (int i = 0; i < 2; i++) {
mpRoot_c[i]->setAlphaRate(1.0f - getAlphaRatio());
}
diff --git a/src/d/d_msg_scrn_item.cpp b/src/d/d_msg_scrn_item.cpp
index 904b418ab9..3de8119a8f 100644
--- a/src/d/d_msg_scrn_item.cpp
+++ b/src/d/d_msg_scrn_item.cpp
@@ -598,6 +598,9 @@ void dMsgScrnItem_c::fukiPosCalc(u8 param_1) {
field_0x180 = 0.0f;
field_0x19c = param_1;
f32 yOffset;
+ // the magic numbers here are correlated with the framebuffer size, but
+ // were likely either chosen by hand or had multiple arithmetic
+ // operations applied which cannot easily be reverse engineered
switch(field_0x19c) {
case 1:
yOffset = g_MsgObject_HIO_c.mBoxPos[2][3];
diff --git a/src/d/d_msg_scrn_talk.cpp b/src/d/d_msg_scrn_talk.cpp
index 941e984fbd..f7b498357e 100644
--- a/src/d/d_msg_scrn_talk.cpp
+++ b/src/d/d_msg_scrn_talk.cpp
@@ -446,8 +446,8 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) {
f3y = cStack_7c.y;
} else {
mDoLib_project(&msgActor->pos, &local_70);
- if (local_70.x >= 0.0f && local_70.x <= 608.0f && local_70.y >= 0.0f &&
- local_70.y <= 448.0f)
+ if (local_70.x >= 0.0f && local_70.x <= FB_WIDTH_BASE && local_70.y >= 0.0f &&
+ local_70.y <= FB_HEIGHT_BASE)
{
f3y = 0.5f * (cStack_7c.y + local_70.y);
} else {
@@ -482,6 +482,9 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) {
field_0xf0 = 0.0f;
field_0x488 = param_1;
f32 dVar15;
+ // the magic numbers here are correlated with the framebuffer size, but
+ // were likely either chosen by hand or had multiple arithmetic
+ // operations applied which cannot easily be reverse engineered
switch (field_0x488) {
case 1:
dVar15 = g_MsgObject_HIO_c.mBoxPos[2][0];
diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp
index bdf5f325ee..1b8e71d3e8 100644
--- a/src/d/d_s_logo.cpp
+++ b/src/d/d_s_logo.cpp
@@ -1150,19 +1150,20 @@ void dScnLogo_c::logoInitWii() {
break;
}
- width = 608;
- height = 456;
+ // this uses the standard width but the widescreen height?
+ width = FB_WIDTH_BASE;
+ height = FB_HEIGHT;
}
JUT_ASSERT(2309, timg != NULL);
- mStrapImg = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255);
+ mStrapImg = new dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255);
#if VERSION == VERSION_SHIELD
timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 5);
- mNvLogo = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255);
+ mNvLogo = new dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255);
timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 4);
- mMocImg = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255);
+ mMocImg = new dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255);
#endif
OS_REPORT("\x1b[32m%d archiveHeap->getTotalFreeSize %08x\n\x1b[m", 2316, archiveHeap->getTotalFreeSize());
diff --git a/src/d/d_scope.cpp b/src/d/d_scope.cpp
index c81267f174..265b5654c1 100644
--- a/src/d/d_scope.cpp
+++ b/src/d/d_scope.cpp
@@ -136,24 +136,24 @@ void dScope_c::draw() {
u8 alpha = mAlpha * 255.0f;
if (dComIfGp_checkPlayerStatus0(0, 0x1000)) {
- J2DDrawLine(304.0f, mDoGph_gInf_c::getMinYF(), 304.0f, mDoGph_gInf_c::getMaxYF(),
- JUtility::TColor(255, 0, 0, alpha), 6);
- J2DDrawLine(mDoGph_gInf_c::getMinXF(), 224.0f, mDoGph_gInf_c::getMaxXF(), 224.0f,
- JUtility::TColor(255, 0, 0, alpha), 6);
+ J2DDrawLine(FB_WIDTH_BASE / 2, mDoGph_gInf_c::getMinYF(), FB_WIDTH_BASE / 2,
+ mDoGph_gInf_c::getMaxYF(), JUtility::TColor(255, 0, 0, alpha), 6);
+ J2DDrawLine(mDoGph_gInf_c::getMinXF(), FB_HEIGHT_BASE / 2, mDoGph_gInf_c::getMaxXF(),
+ FB_HEIGHT_BASE / 2, JUtility::TColor(255, 0, 0, alpha), 6);
}
mpWipeTex->setAlpha(alpha);
mpBlackTex->setAlpha(alpha);
- f32 temp_f29 = 304.0f - temp_f31;
- f32 temp_f28 = 304.0f + temp_f31;
- f32 temp_f27 = 224.0f - temp_f30;
- f32 temp_f26 = 224.0f + temp_f30;
+ f32 temp_f29 = FB_WIDTH_BASE / 2 - temp_f31;
+ f32 temp_f28 = FB_WIDTH_BASE / 2 + temp_f31;
+ f32 temp_f27 = FB_HEIGHT_BASE / 2 - temp_f30;
+ f32 temp_f26 = FB_HEIGHT_BASE / 2 + temp_f30;
mpWipeTex->draw(temp_f29, temp_f27, temp_f31, temp_f30, false, false, false);
- mpWipeTex->draw(304.0f, temp_f27, temp_f31, temp_f30, true, false, false);
- mpWipeTex->draw(temp_f29, 224.0f, temp_f31, temp_f30, false, true, false);
- mpWipeTex->draw(304.0f, 224.0f, temp_f31, temp_f30, true, true, false);
+ mpWipeTex->draw(FB_WIDTH_BASE / 2, temp_f27, temp_f31, temp_f30, true, false, false);
+ mpWipeTex->draw(temp_f29, FB_HEIGHT_BASE / 2, temp_f31, temp_f30, false, true, false);
+ mpWipeTex->draw(FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, temp_f31, temp_f30, true, true, false);
mpBlackTex->draw(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(),
mDoGph_gInf_c::getWidthF(), temp_f27 - mDoGph_gInf_c::getMinYF(), false, false,
diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp
index 99c6fbeb7b..7f624531f7 100644
--- a/src/m_Do/m_Do_graphic.cpp
+++ b/src/m_Do/m_Do_graphic.cpp
@@ -507,29 +507,29 @@ f32 mDoGph_gInf_c::m_scale = 1.0f;
f32 mDoGph_gInf_c::m_invScale = 1.0f;
-int mDoGph_gInf_c::m_maxX = 608 - 1;
+int mDoGph_gInf_c::m_maxX = FB_WIDTH_BASE - 1;
-int mDoGph_gInf_c::m_maxY = 448 - 1;
+int mDoGph_gInf_c::m_maxY = FB_HEIGHT_BASE - 1;
-int mDoGph_gInf_c::m_width = 608;
+int mDoGph_gInf_c::m_width = FB_WIDTH_BASE;
-int mDoGph_gInf_c::m_height = 448;
+int mDoGph_gInf_c::m_height = FB_HEIGHT_BASE;
-f32 mDoGph_gInf_c::m_maxXF = 608.0f - 1;
+f32 mDoGph_gInf_c::m_maxXF = FB_WIDTH_BASE - 1;
-f32 mDoGph_gInf_c::m_maxYF = 448.0f - 1;
+f32 mDoGph_gInf_c::m_maxYF = FB_HEIGHT_BASE - 1;
-f32 mDoGph_gInf_c::m_widthF = 608.0f;
+f32 mDoGph_gInf_c::m_widthF = FB_WIDTH_BASE;
-f32 mDoGph_gInf_c::m_heightF = 448.0f;
+f32 mDoGph_gInf_c::m_heightF = FB_HEIGHT_BASE;
struct tvSize {
u16 width;
u16 height;
};
const tvSize l_tvSize[2] = {
- {608, 448},
- {808, 448},
+ {FB_WIDTH_BASE, FB_HEIGHT_BASE},
+ {808, FB_HEIGHT_BASE},
};
void mDoGph_gInf_c::setTvSize() {
@@ -537,8 +537,8 @@ void mDoGph_gInf_c::setTvSize() {
m_width = tvsize->width;
m_height = tvsize->height;
- m_minX = -((m_width - 608) / 2);
- m_minY = -((m_height - 448) / 2);
+ m_minX = -((m_width - FB_WIDTH_BASE) / 2);
+ m_minY = -((m_height - FB_HEIGHT_BASE) / 2);
m_maxX = m_minX + m_width;
m_maxY = m_minY + m_height;
@@ -1952,7 +1952,7 @@ int mDoGph_Painter() {
if (fapGmHIO_getParticle()) {
#if WIDESCREEN_SUPPORT
if (mDoGph_gInf_c::isWideZoom()) {
- ortho.setOrtho(0.0f, 0.0f, 608.0f, 448.0f, 100000.0f, -100000.0f);
+ ortho.setOrtho(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, 100000.0f, -100000.0f);
} else
#endif
{
@@ -1963,8 +1963,8 @@ int mDoGph_Painter() {
ortho.setPort();
Mtx m3;
- MTXTrans(m3, FB_WIDTH / 2, FB_HEIGHT / 2, 0.0f);
- JPADrawInfo draw_info2(m3, 0.0f, FB_HEIGHT, 0.0f, FB_WIDTH);
+ MTXTrans(m3, FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, 0.0f);
+ JPADrawInfo draw_info2(m3, 0.0f, FB_HEIGHT_BASE, 0.0f, FB_WIDTH_BASE);
dComIfGp_particle_draw2Dgame(&draw_info2);
}
@@ -2050,9 +2050,9 @@ int mDoGph_Painter() {
cMtx_copy(j3dSys.getViewMtx(), m4);
Mtx m5;
- MTXTrans(m5, FB_WIDTH / 2, FB_HEIGHT / 2, 0.0f);
+ MTXTrans(m5, FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, 0.0f);
- JPADrawInfo draw_info3(m5, 0.0f, FB_HEIGHT, 0.0f, FB_WIDTH);
+ JPADrawInfo draw_info3(m5, 0.0f, FB_HEIGHT_BASE, 0.0f, FB_WIDTH_BASE);
if (!dComIfGp_isPauseFlag()) {
dComIfGp_particle_draw2Dback(&draw_info3);