summaryrefslogtreecommitdiff
path: root/src/JSystem/J2DGraph/J2DMaterial.cpp
diff options
context:
space:
mode:
authorJcw87 <Jcw87@users.noreply.github.com>2025-12-22 12:27:31 -0800
committerGitHub <noreply@github.com>2025-12-22 12:27:31 -0800
commitf156a2a413d622466fd5599f01b8c0493cf8e744 (patch)
treeafea41c955cde2c19aded512bbd7c51184a94f4e /src/JSystem/J2DGraph/J2DMaterial.cpp
parent47ac1d4a4cbc5a6835c80d80e7756d6b4a6cd0a6 (diff)
JAHostIO, JAWExtSystem debug (#2985)
Diffstat (limited to 'src/JSystem/J2DGraph/J2DMaterial.cpp')
-rw-r--r--src/JSystem/J2DGraph/J2DMaterial.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/JSystem/J2DGraph/J2DMaterial.cpp b/src/JSystem/J2DGraph/J2DMaterial.cpp
index 059d12e7bb..4fadaf5ace 100644
--- a/src/JSystem/J2DGraph/J2DMaterial.cpp
+++ b/src/JSystem/J2DGraph/J2DMaterial.cpp
@@ -40,7 +40,7 @@ void J2DMaterial::setGX() {
}
J2DTevBlock* J2DMaterial::createTevBlock(int block_type, bool noAlign) {
- J2DTevBlock* block;
+ J2DTevBlock* block = NULL;
if (noAlign) {
if (block_type <= 1) {
@@ -67,12 +67,15 @@ J2DTevBlock* J2DMaterial::createTevBlock(int block_type, bool noAlign) {
block = new (-4) J2DTevBlock16();
}
}
+ if (!block) {
+ OS_PANIC(101, "Error : allocate memory.");
+ }
return block;
}
J2DIndBlock* J2DMaterial::createIndBlock(int block_type, bool noAlign) {
- J2DIndBlock* block;
+ J2DIndBlock* block = NULL;
if (noAlign) {
if (block_type != 0) {
@@ -87,6 +90,9 @@ J2DIndBlock* J2DMaterial::createIndBlock(int block_type, bool noAlign) {
block = new (-4) J2DIndBlockNull();
}
}
+ if (!block) {
+ OS_PANIC(133, "Error : allocate memory.");
+ }
return block;
}
@@ -116,8 +122,18 @@ J2DMaterial::J2DMaterialAnmPointer::J2DMaterialAnmPointer() {
}
void J2DMaterial::makeAnmPointer() {
+ int r29;
+ int r28;
if (mAnmPointer == NULL) {
mAnmPointer = new J2DMaterialAnmPointer();
+ r29 = 1;
+ if (mAnmPointer == NULL) {
+ OS_PANIC(171, "Error : allocate memory.");
+ r28 = 0;
+ if (!r28) {
+ r29 = 0;
+ }
+ }
}
}
@@ -157,9 +173,7 @@ void J2DMaterial::setAnimation(J2DAnmTextureSRTKey* anm) {
u16 index = getIndex();
for (u16 i = 0; i < matNum; i++) {
- u16 matID = anm->getUpdateMaterialID(i);
-
- if (index == matID) {
+ if (index == anm->getUpdateMaterialID(i)) {
u8 mtxID = anm->getUpdateTexMtxID(i);
mAnmPointer->mSRTIds[mtxID] = i;
}
@@ -183,9 +197,7 @@ void J2DMaterial::setAnimation(J2DAnmTexPattern* anm) {
J3DAnmTexPatternFullTable* anmTbl = anm->getAnmTable();
for (u16 i = 0; i < matNum; i++) {
- u16 matID = anm->getUpdateMaterialID(i);
-
- if (index == matID) {
+ if (index == anm->getUpdateMaterialID(i)) {
mAnmPointer->mPatternIds[anmTbl[i].mTexNo] = i;
}
}