mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-21 22:54:37 -04:00
Isolate JKRHeap operator overloads
Fixes #25 This isolates the JKRHeap operator new/delete overloads. Every single new/delete site in the code has been replaced with a macro. Sadly for new[] and delete[] we have to keep global operators. The global new[] just allocates into malloc() however, and delete[] goes into free() if it's not in a JKRHeap. So that's fine.
This commit is contained in:
+30
-30
@@ -54,77 +54,77 @@ dMenu_Insect_c::dMenu_Insect_c(JKRExpHeap* i_heap, STControl* i_stick, CSTContro
|
||||
field_0xfb = 0xff;
|
||||
field_0xf7 = 1;
|
||||
ResTIMG* image = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti");
|
||||
mpBlackTex = new J2DPicture(image);
|
||||
mpBlackTex = JKR_NEW J2DPicture(image);
|
||||
mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xff));
|
||||
field_0xfc = 0;
|
||||
mpDrawCursor = new dSelect_cursor_c(2, 1.0f, NULL);
|
||||
mpDrawCursor = JKR_NEW dSelect_cursor_c(2, 1.0f, NULL);
|
||||
mpDrawCursor->setParam(1.0f, 1.0f, 0.1f, 0.7f, 0.7f);
|
||||
mpDrawCursor->setAlphaRate(0.0f);
|
||||
mpDrawCursor->setScale(0.0f);
|
||||
mpDrawCursor->offPlayAnime(0);
|
||||
mpSelect_c = new dMsgScrn3Select_c();
|
||||
mpSelect_c = JKR_NEW dMsgScrn3Select_c();
|
||||
mpExpItemTex = (ResTIMG*)mpHeap->alloc(0xc00, 0x20);
|
||||
}
|
||||
|
||||
dMenu_Insect_c::~dMenu_Insect_c() {
|
||||
delete mpBlackTex;
|
||||
JKR_DELETE(mpBlackTex);
|
||||
mpBlackTex = NULL;
|
||||
|
||||
delete mpDrawCursor;
|
||||
JKR_DELETE(mpDrawCursor);
|
||||
mpDrawCursor = NULL;
|
||||
|
||||
delete mpSelect_c;
|
||||
JKR_DELETE(mpSelect_c);
|
||||
mpSelect_c = NULL;
|
||||
|
||||
mpHeap->free(mpExpItemTex);
|
||||
mpExpItemTex = NULL;
|
||||
|
||||
delete mpString;
|
||||
JKR_DELETE(mpString);
|
||||
mpString = NULL;
|
||||
|
||||
delete mpScreen;
|
||||
JKR_DELETE(mpScreen);
|
||||
mpScreen = NULL;
|
||||
|
||||
delete mpParent;
|
||||
JKR_DELETE(mpParent);
|
||||
mpParent = NULL;
|
||||
|
||||
for (int i = 0; i < MAX_INSECT_NUM; i++) {
|
||||
delete mpINSParent[i];
|
||||
JKR_DELETE(mpINSParent[i]);
|
||||
mpINSParent[i] = NULL;
|
||||
}
|
||||
|
||||
delete mpExpScreen;
|
||||
JKR_DELETE(mpExpScreen);
|
||||
mpExpScreen = NULL;
|
||||
|
||||
delete mpExpParent;
|
||||
JKR_DELETE(mpExpParent);
|
||||
mpExpParent = NULL;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
delete mpExpSubWin[i];
|
||||
JKR_DELETE(mpExpSubWin[i]);
|
||||
mpExpSubWin[i] = NULL;
|
||||
}
|
||||
|
||||
delete mpInfoText;
|
||||
JKR_DELETE(mpInfoText);
|
||||
mpInfoText = NULL;
|
||||
|
||||
delete mpIconScreen;
|
||||
JKR_DELETE(mpIconScreen);
|
||||
mpIconScreen = NULL;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (mpButtonAB[i] != NULL) {
|
||||
delete mpButtonAB[i];
|
||||
JKR_DELETE(mpButtonAB[i]);
|
||||
mpButtonAB[i] = NULL;
|
||||
}
|
||||
|
||||
if (mpButtonText[i] != NULL) {
|
||||
delete mpButtonText[i];
|
||||
JKR_DELETE(mpButtonText[i]);
|
||||
mpButtonText[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (mpMount != NULL) {
|
||||
mpMount->getArchive()->unmount();
|
||||
delete mpMount;
|
||||
JKR_DELETE(mpMount);
|
||||
mpMount = NULL;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ dMenu_Insect_c::~dMenu_Insect_c() {
|
||||
}
|
||||
|
||||
void dMenu_Insect_c::_create() {
|
||||
mpString = new dMsgString_c();
|
||||
mpString = JKR_NEW dMsgString_c();
|
||||
screenSetBase();
|
||||
screenSetExplain();
|
||||
screenSetDoIcon();
|
||||
@@ -194,7 +194,7 @@ int dMenu_Insect_c::_open() {
|
||||
if (mpMount->sync() != 0) {
|
||||
if (mpArchive == NULL) {
|
||||
mpArchive = (JKRArchive*)mpMount->getArchive();
|
||||
delete mpMount;
|
||||
JKR_DELETE(mpMount);
|
||||
mpMount = NULL;
|
||||
_create();
|
||||
}
|
||||
@@ -450,13 +450,13 @@ void dMenu_Insect_c::screenSetBase() {
|
||||
MULTI_CHAR('ageha16'), MULTI_CHAR('ageha17'), MULTI_CHAR('ageha18'), MULTI_CHAR('ageha19'), MULTI_CHAR('ageha20'), MULTI_CHAR('ageha21'), MULTI_CHAR('ageha22'), MULTI_CHAR('ageha23'),
|
||||
};
|
||||
|
||||
mpScreen = new J2DScreen();
|
||||
mpScreen = JKR_NEW J2DScreen();
|
||||
mpScreen->setPriority("zelda_gold_insects.blo", 0x20000, mpArchive);
|
||||
dPaneClass_showNullPane(mpScreen);
|
||||
mpParent = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL);
|
||||
mpParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL);
|
||||
mpParent->setAlphaRate(0.0f);
|
||||
for (int i = 0; i < MAX_INSECT_NUM; i++) {
|
||||
mpINSParent[i] = new CPaneMgr(mpScreen, insect_tag[i], 0, NULL);
|
||||
mpINSParent[i] = JKR_NEW CPaneMgr(mpScreen, insect_tag[i], 0, NULL);
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
@@ -486,23 +486,23 @@ void dMenu_Insect_c::screenSetBase() {
|
||||
}
|
||||
|
||||
void dMenu_Insect_c::screenSetExplain() {
|
||||
mpExpScreen = new J2DScreen();
|
||||
mpExpScreen = JKR_NEW J2DScreen();
|
||||
mpExpScreen->setPriority("zelda_gold_insects_info.blo", 0x20000, mpArchive);
|
||||
dPaneClass_showNullPane(mpExpScreen);
|
||||
mpExpParent = new CPaneMgr(mpExpScreen, MULTI_CHAR('n_all'), 2, NULL);
|
||||
mpExpParent = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('n_all'), 2, NULL);
|
||||
mpExpParent->setAlphaRate(0.0f);
|
||||
mpExpSubWin[0] = new CPaneMgr(mpExpScreen, MULTI_CHAR('in_win_n'), 0, NULL);
|
||||
mpExpSubWin[1] = new CPaneMgr(mpExpScreen, MULTI_CHAR('w_d_mo_n'), 0, NULL);
|
||||
mpExpSubWin[0] = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('in_win_n'), 0, NULL);
|
||||
mpExpSubWin[1] = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('w_d_mo_n'), 0, NULL);
|
||||
if (field_0xf6 == 0) {
|
||||
mpExpSubWin[1]->hide();
|
||||
}
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
mpInfoText = new CPaneMgr(mpExpScreen, MULTI_CHAR('mg_3line'), 0, NULL);
|
||||
mpInfoText = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('mg_3line'), 0, NULL);
|
||||
mpExpScreen->search(MULTI_CHAR('n_e4line'))->hide();
|
||||
field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('w_msg_jp'));
|
||||
mpExpScreen->search(MULTI_CHAR('ms_for_2'))->hide();
|
||||
#else
|
||||
mpInfoText = new CPaneMgr(mpExpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL);
|
||||
mpInfoText = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL);
|
||||
mpExpScreen->search(MULTI_CHAR('n_3line'))->hide();
|
||||
field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('ms_for_2'));
|
||||
mpExpScreen->search(MULTI_CHAR('w_msg_jp'))->hide();
|
||||
@@ -526,7 +526,7 @@ void dMenu_Insect_c::screenSetDoIcon() {
|
||||
MULTI_CHAR('btext1_1'), MULTI_CHAR('btext1_2'), MULTI_CHAR('btext1_3'), MULTI_CHAR('btext1_4'), MULTI_CHAR('btext1_5'),
|
||||
};
|
||||
|
||||
mpIconScreen = new J2DScreen();
|
||||
mpIconScreen = JKR_NEW J2DScreen();
|
||||
mpIconScreen->setPriority("zelda_collect_soubi_do_icon_parts.blo", 0x20000, mpArchive);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpButtonAB[i] = 0;
|
||||
|
||||
Reference in New Issue
Block a user