mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-26 08:24:31 -04:00
More GCC compatibility/warning fixes (#3118)
* Wrap >4-char literals in a MULTI_CHAR macro Modern compilers do not support CW's non-standard behavior with >4 char literals. We can, however, use a constexpr function to compute the u64 values directly. This leaves <=4 char literals unchanged. * Replace non-pointer usages of NULL with 0 * Define NULL to nullptr on C++11 and above * Fix more -Wpointer-arith and -Woverflow warnings * Replace u32/s32 with uintptr_t/intptr_t where appropriate * JSUOutputStream: Overload all standard int types
This commit is contained in:
+54
-54
@@ -48,34 +48,34 @@ static procFunc stick_proc[] = {
|
||||
dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i_cStick,
|
||||
u8 i_ringOrigin) {
|
||||
static const u64 xy_text[5] = {
|
||||
'yx_text', 'yx_te_s1', 'yx_te_s2', 'yx_te_s3', 'yx_te_s4',
|
||||
MULTI_CHAR('yx_text'), MULTI_CHAR('yx_te_s1'), MULTI_CHAR('yx_te_s2'), MULTI_CHAR('yx_te_s3'), MULTI_CHAR('yx_te_s4'),
|
||||
};
|
||||
static const u64 fxy_text[5] = {
|
||||
'fyx_tex', 'fyx_te_1', 'fyx_te_2', 'fyx_te_3', 'fyx_te_4',
|
||||
MULTI_CHAR('fyx_tex'), MULTI_CHAR('fyx_te_1'), MULTI_CHAR('fyx_te_2'), MULTI_CHAR('fyx_te_3'), MULTI_CHAR('fyx_te_4'),
|
||||
};
|
||||
static const u64 c_text[5] = {
|
||||
'c_text', 'c_te_s1', 'c_te_s2', 'c_te_s3', 'c_te_s4',
|
||||
MULTI_CHAR('c_text'), MULTI_CHAR('c_te_s1'), MULTI_CHAR('c_te_s2'), MULTI_CHAR('c_te_s3'), MULTI_CHAR('c_te_s4'),
|
||||
};
|
||||
static const u64 fc_text[5] = {
|
||||
'fc_text', 'fc_te_s1', 'fc_te_s2', 'fc_te_s3', 'fc_te_s4',
|
||||
MULTI_CHAR('fc_text'), MULTI_CHAR('fc_te_s1'), MULTI_CHAR('fc_te_s2'), MULTI_CHAR('fc_te_s3'), MULTI_CHAR('fc_te_s4'),
|
||||
};
|
||||
static const u64 c_text1[5] = {
|
||||
'c_text1', 'c_texs1', 'c_texs2', 'c_texs3', 'c_texs4',
|
||||
MULTI_CHAR('c_text1'), MULTI_CHAR('c_texs1'), MULTI_CHAR('c_texs2'), MULTI_CHAR('c_texs3'), MULTI_CHAR('c_texs4'),
|
||||
};
|
||||
static const u64 fc_text1[5] = {
|
||||
'fc_text1', 'fc_texs1', 'fc_texs2', 'fc_texs3', 'fc_texs4',
|
||||
MULTI_CHAR('fc_text1'), MULTI_CHAR('fc_texs1'), MULTI_CHAR('fc_texs2'), MULTI_CHAR('fc_texs3'), MULTI_CHAR('fc_texs4'),
|
||||
};
|
||||
static const u64 t_on[5] = {
|
||||
'gr_t_on', 'g_tof_s5', 'g_tof_s6', 'g_tof_s7', 'g_tof_s8',
|
||||
MULTI_CHAR('gr_t_on'), MULTI_CHAR('g_tof_s5'), MULTI_CHAR('g_tof_s6'), MULTI_CHAR('g_tof_s7'), MULTI_CHAR('g_tof_s8'),
|
||||
};
|
||||
static const u64 ft_on[5] = {
|
||||
'fr_t_on', 'f_tof_s5', 'f_tof_s6', 'f_tof_s7', 'f_tof_s8',
|
||||
MULTI_CHAR('fr_t_on'), MULTI_CHAR('f_tof_s5'), MULTI_CHAR('f_tof_s6'), MULTI_CHAR('f_tof_s7'), MULTI_CHAR('f_tof_s8'),
|
||||
};
|
||||
static const u64 t_off[5] = {
|
||||
'gr_t_of', 'g_tof_s1', 'g_tof_s2', 'g_tof_s3', 'g_tof_s4',
|
||||
MULTI_CHAR('gr_t_of'), MULTI_CHAR('g_tof_s1'), MULTI_CHAR('g_tof_s2'), MULTI_CHAR('g_tof_s3'), MULTI_CHAR('g_tof_s4'),
|
||||
};
|
||||
static const u64 ft_off[5] = {
|
||||
'fr_t_of', 'f_tof_s1', 'f_tof_s2', 'f_tof_s3', 'f_tof_s4',
|
||||
MULTI_CHAR('fr_t_of'), MULTI_CHAR('f_tof_s1'), MULTI_CHAR('f_tof_s2'), MULTI_CHAR('f_tof_s3'), MULTI_CHAR('f_tof_s4'),
|
||||
};
|
||||
|
||||
mpHeap = i_heap;
|
||||
@@ -264,12 +264,12 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
|
||||
"SCRN/zelda_item_select_icon_message_ver2.blo", 0x20000,
|
||||
dComIfGp_getRingResArchive());
|
||||
dPaneClass_showNullPane(mpScreen);
|
||||
mpMessageParent = new CPaneMgrAlpha(mpScreen, 'n_all', 2, NULL);
|
||||
mpMessageParent = new CPaneMgrAlpha(mpScreen, MULTI_CHAR('n_all'), 2, NULL);
|
||||
mpTextParent[0] = new CPaneMgr(mpScreen, 'r_n', 0, NULL);
|
||||
mpTextParent[1] = new CPaneMgr(mpScreen, 'c_n', 2, NULL);
|
||||
mpTextParent[1]->setAlphaRate(1.0f);
|
||||
mpTextParent[2] = NULL;
|
||||
mpTextParent[3] = new CPaneMgr(mpScreen, 'c_sen_n', 2, NULL);
|
||||
mpTextParent[3] = new CPaneMgr(mpScreen, MULTI_CHAR('c_sen_n'), 2, NULL);
|
||||
mpTextParent[4] = new CPaneMgr(mpScreen, 'gr_n', 2, NULL);
|
||||
mpTextParent[4]->hide();
|
||||
for (int i = 5; i < 10; i++) {
|
||||
@@ -301,20 +301,20 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
|
||||
mItemSlotParam2[i] = (mpItemBuf[i][0]->height / 48.0f * (texScale / 100.0f));
|
||||
}
|
||||
}
|
||||
mpScreen->search('r_btn_n')->hide();
|
||||
mpScreen->search(MULTI_CHAR('r_btn_n'))->hide();
|
||||
if (mPlayerIsWolf) {
|
||||
mpScreen->search('yx_te_s1')->hide();
|
||||
mpScreen->search('yx_te_s2')->hide();
|
||||
mpScreen->search('yx_te_s3')->hide();
|
||||
mpScreen->search('yx_te_s4')->hide();
|
||||
mpScreen->search('yx_text')->hide();
|
||||
mpScreen->search('fyx_te_1')->hide();
|
||||
mpScreen->search('fyx_te_2')->hide();
|
||||
mpScreen->search('fyx_te_3')->hide();
|
||||
mpScreen->search('fyx_te_4')->hide();
|
||||
mpScreen->search('fyx_tex')->hide();
|
||||
mpScreen->search('x_btn_n')->hide();
|
||||
mpScreen->search('y_btn_n')->hide();
|
||||
mpScreen->search(MULTI_CHAR('yx_te_s1'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('yx_te_s2'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('yx_te_s3'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('yx_te_s4'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('yx_text'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('fyx_te_1'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('fyx_te_2'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('fyx_te_3'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('fyx_te_4'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('fyx_tex'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('x_btn_n'))->hide();
|
||||
mpScreen->search(MULTI_CHAR('y_btn_n'))->hide();
|
||||
}
|
||||
mpString = new dMsgString_c();
|
||||
for (i = 0; i < 5; i++) {
|
||||
@@ -387,38 +387,38 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
|
||||
"SCRN/zelda_item_select_icon3_spot.blo", 0x20000,
|
||||
dComIfGp_getRingResArchive());
|
||||
dPaneClass_showNullPane(mpSpotScreen);
|
||||
mpSpotParent = new CPaneMgrAlpha(mpSpotScreen, 'n_all', 2, NULL);
|
||||
mpSpotParent = new CPaneMgrAlpha(mpSpotScreen, MULTI_CHAR('n_all'), 2, NULL);
|
||||
mpCenterScreen = new J2DScreen();
|
||||
dPaneClass_setPriority(&mpResData[2], mpHeap, mpCenterScreen,
|
||||
"SCRN/zelda_item_select_icon3_center_parts.blo", 0x20000,
|
||||
dComIfGp_getRingResArchive());
|
||||
dPaneClass_showNullPane(mpCenterScreen);
|
||||
mpCenterParent = new CPaneMgrAlpha(mpCenterScreen, 'center_n', 2, NULL);
|
||||
mpNameParent = new CPaneMgr(mpCenterScreen, 'label_n', 1, NULL);
|
||||
mpCircle = new CPaneMgr(mpCenterScreen, 'circle_n', 2, NULL);
|
||||
mpCenterParent = new CPaneMgrAlpha(mpCenterScreen, MULTI_CHAR('center_n'), 2, NULL);
|
||||
mpNameParent = new CPaneMgr(mpCenterScreen, MULTI_CHAR('label_n'), 1, NULL);
|
||||
mpCircle = new CPaneMgr(mpCenterScreen, MULTI_CHAR('circle_n'), 2, NULL);
|
||||
J2DTextBox* textBox[4];
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search('item_n04');
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search('item_n05');
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search('item_n06');
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search('item_n07');
|
||||
J2DPane* pane = mpCenterScreen->search('fitem_n1');
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n04'));
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n05'));
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n06'));
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n07'));
|
||||
J2DPane* pane = mpCenterScreen->search(MULTI_CHAR('fitem_n1'));
|
||||
pane->mVisible = false;
|
||||
pane = mpCenterScreen->search('fitem_n2');
|
||||
pane = mpCenterScreen->search(MULTI_CHAR('fitem_n2'));
|
||||
pane->mVisible = false;
|
||||
pane = mpCenterScreen->search('fitem_n3');
|
||||
pane = mpCenterScreen->search(MULTI_CHAR('fitem_n3'));
|
||||
pane->mVisible = false;
|
||||
pane = mpCenterScreen->search('fitem_n4');
|
||||
pane = mpCenterScreen->search(MULTI_CHAR('fitem_n4'));
|
||||
pane->mVisible = false;
|
||||
#else
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search('fitem_n1');
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search('fitem_n2');
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search('fitem_n3');
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search('fitem_n4');
|
||||
mpCenterScreen->search('item_n04');
|
||||
mpCenterScreen->search('item_n05');
|
||||
mpCenterScreen->search('item_n06');
|
||||
mpCenterScreen->search('item_n07');
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n1'));
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n2'));
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n3'));
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n4'));
|
||||
mpCenterScreen->search(MULTI_CHAR('item_n04'));
|
||||
mpCenterScreen->search(MULTI_CHAR('item_n05'));
|
||||
mpCenterScreen->search(MULTI_CHAR('item_n06'));
|
||||
mpCenterScreen->search(MULTI_CHAR('item_n07'));
|
||||
#endif
|
||||
for (int i = 0; i < 4; i++) {
|
||||
textBox[i]->setFont(mDoExt_getMesgFont());
|
||||
@@ -614,7 +614,7 @@ void dMenu_Ring_c::_draw() {
|
||||
if (mStatus != STATUS_EXPLAIN && mPikariFlashingSpeed > 0.0f) {
|
||||
Vec pos;
|
||||
CPaneMgr paneMgr;
|
||||
pos = paneMgr.getGlobalVtxCenter(mpScreen->search('gr_btn'), true, 0);
|
||||
pos = paneMgr.getGlobalVtxCenter(mpScreen->search(MULTI_CHAR('gr_btn')), true, 0);
|
||||
dMeter2Info_getMeterClass()->getMeterDrawPtr()->drawPikari(
|
||||
pos.x, pos.y, &mPikariFlashingSpeed, g_ringHIO.mPikariScale, g_ringHIO.mPikariFrontOuter,
|
||||
g_ringHIO.mPikariFrontInner, g_ringHIO.mPikariBackOuter, g_ringHIO.mPikariBackInner,
|
||||
@@ -1102,15 +1102,15 @@ void dMenu_Ring_c::setScale() {
|
||||
void dMenu_Ring_c::setNameString(u32 i_stringID) {
|
||||
J2DTextBox* textBox[4];
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search('item_n04');
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search('item_n05');
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search('item_n06');
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search('item_n07');
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n04'));
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n05'));
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n06'));
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n07'));
|
||||
#else
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search('fitem_n1');
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search('fitem_n2');
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search('fitem_n3');
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search('fitem_n4');
|
||||
textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n1'));
|
||||
textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n2'));
|
||||
textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n3'));
|
||||
textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n4'));
|
||||
#endif
|
||||
if (mNameStringID != i_stringID) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
Reference in New Issue
Block a user