More pointer truncation & implicit conversion fixes

This commit is contained in:
Luke Street
2026-02-28 18:47:49 -07:00
parent 8ee459cda0
commit 196b334453
18 changed files with 47 additions and 23 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ extern const char ga4cSignature[4];
const int PARAGRAPH_DATA = 1;
typedef enum TEComposite {
enum TEComposite {
/* 0x0 */ COMPOSITE_NONE,
/* 0x1 */ COMPOSITE_RAW,
/* 0x2 */ COMPOSITE_IDX,
+1 -1
View File
@@ -86,7 +86,7 @@ public:
const void* getSequence() const { return pSequence; }
void setSequence_(const void* arg1) { pSequence = arg1; }
const void* getSequence_offset(s32 i_no) const {
int s32Val = (intptr_t)getSequence();
intptr_t s32Val = (intptr_t)getSequence();
return (const void*)(s32Val + i_no);
}
const void* getSequence_next() const { return pSequence_next; }
+1 -1
View File
@@ -288,7 +288,7 @@ void daBmWindow_c::setBreakEffect(int param_1) {
}
int temp = param_1 * 3;
for (int i = temp; i < temp + 3; i++) {
dComIfGp_particle_set(particle_id[i], &cStack_2c, &cStack_40, &scale, 0xff, 0, 0xffffffff,
dComIfGp_particle_set(particle_id[i], &cStack_2c, &cStack_40, &scale, 0xff, 0, -1,
NULL, NULL, NULL);
}
}
+1 -1
View File
@@ -80,7 +80,7 @@ void daObjFlag_c::calcJointAngle() {
joint->mJoint3 = joint->mJoint1 - joint->mJoint2;
}
if(attr().field_0x25 != NULL) {
if(attr().field_0x25 != 0) {
if(i == 1) {
calcAngleSwingX(joint, power);
}
+2 -2
View File
@@ -62,7 +62,7 @@ static void break_eff(obj_kbox_class* i_this) {
fopAcM_GetRoomNo(&i_this->mActor), NULL, NULL, &particleScale);
dPa_modelEcallBack::setModel(pEmitter, kibako_bmd, i_this->mActor.tevStr, 3, NULL, 0, 0);
for (int i = 0; i < 3; i++) {
dComIfGp_particle_set(particle_id[i], &emitterPos, 0, &particleScale, 0xff, 0, 0xffffffff,
dComIfGp_particle_set(particle_id[i], &emitterPos, 0, &particleScale, 0xff, 0, -1,
0, 0, 0);
}
}
@@ -213,7 +213,7 @@ static void kbox_float(obj_kbox_class* i_this) {
i_this->field_0x5a4 + i_this->field_0x590 + i_this->field_0x58c + i_this->field_0x5ac;
i_this->field_0x9e8 = dComIfGp_particle_set(i_this->field_0x9e8, 0x86c3,
&cStack_88, &a_this->tevStr, &a_this->shape_angle,
&cStack_7c, 0xff, 0, 0xffffffff, 0, 0, 0);
&cStack_7c, 0xff, 0, -1, 0, 0, 0);
if (i_this->field_0x5ac <= -50.0f) {
fopAcM_delete(a_this);
dComIfGp_particle_set(0x86c4, &cStack_88, &a_this->tevStr, &a_this->shape_angle,
+1 -1
View File
@@ -113,7 +113,7 @@ cXyz* daObjLndRope_c::getRopeStartPos() {
}
f32 daObjLndRope_c::getStartRate(cXyz* i_ropeSegmentPos) {
if (mFlag != NULL) {
if (mFlag != 0) {
return mScale * (i_ropeSegmentPos->x - getRopeStartPos()->x);
} else {
return mScale * (i_ropeSegmentPos->z - getRopeStartPos()->z);
+5 -5
View File
@@ -53,14 +53,14 @@ static int tandem;
static int demo_f;
static int target_info[10];
static void* target_info[10];
static int target_info_count;
static void* s_ks_sub(void* param_1, void* param_2) {
if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == 0x60) {
if (target_info_count < 10) {
target_info[target_info_count] = (intptr_t)param_1;
target_info[target_info_count] = param_1;
target_info_count++;
}
return param_1;
@@ -77,7 +77,7 @@ static int hit_check(obj_lp_class* i_this, wd_ss* WdSs) {
fVar1 = 50.0f;
for (int i = 0; i < target_info_count; i++) {
sp6c = WdSs->field_0x10 - *(cXyz *)(target_info[i] + 0x4d0);
sp6c = WdSs->field_0x10 - *(cXyz *)((u8 *)target_info[i] + 0x4d0);
if (sp6c.y >= -3.0f) {
f32 dist = JMAFastSqrt(sp6c.x * sp6c.x + sp6c.z * sp6c.z);
if (dist <= fVar1 * WdSs->field_0x3c) {
@@ -126,7 +126,7 @@ static int hit_check(obj_lp_class* i_this, wd_ss* WdSs) {
cLib_addCalc2(&WdSs->field_0x10.y, WdSs->field_0x4.y + fVar8 * -0.5f, 0.5f, 3.0f);
cLib_addCalc2(&WdSs->field_0x28.x, fVar8, 0.1f, fVar8 * 0.5f);
cLib_addCalcAngleS2(&WdSs->field_0x34, cM_atan2s(sp6c.x, sp6c.z), 0x20, 0x400);
cLib_addCalcAngleS2(&WdSs->field_0x36, 0xfffff060, 0x20, 0x400);
cLib_addCalcAngleS2(&WdSs->field_0x36, -4000, 0x20, 0x400);
rv = 1;
}
}
@@ -221,7 +221,7 @@ static int daObj_Lp_Execute(obj_lp_class* i_this) {
target_info[i] = 0;
}
target_info[0] = (intptr_t)dComIfGp_getPlayer(0);
target_info[0] = dComIfGp_getPlayer(0);
target_info_count = 1;
if (strcmp(dComIfGp_getStartStageName(), "D_MN05") == 0) {
+2 -2
View File
@@ -206,7 +206,7 @@ void daTogeRoll_c::moveTogeRoll() {
&daTogeRoll_c::modeBound, &daTogeRoll_c::modeBound2, &daTogeRoll_c::modeBoundWait,
};
if (field_0x5dc == NULL) {
if (field_0x5dc == 0) {
for (int i = 0; i < 8; i++) {
if (mSph[i].ChkCoHit()) {
fopAc_ac_c* hit_actor = dCc_GetAc(mSph[i].GetCoHitObj()->GetAc());
@@ -264,7 +264,7 @@ void daTogeRoll_c::init_modeBoundWait() {
}
void daTogeRoll_c::modeBoundWait() {
if (field_0x5db != NULL) {
if (field_0x5db != 0) {
field_0x5db -= 1;
} else {
field_0x5dc = 0;
+1 -1
View File
@@ -494,7 +494,7 @@ void daObjLv6Bm_c::calcBeam() {
if (field_0xa19 > 0) {
cXyz sp84(field_0x9f8);
if (fopAcM_lc_c::lineCheck(&field_0x9e4, &field_0x9f8, this) != NULL && fopAcM_lc_c::checkGroundHit()) {
if (fopAcM_lc_c::lineCheck(&field_0x9e4, &field_0x9f8, this) != false && fopAcM_lc_c::checkGroundHit()) {
sp84 = fopAcM_lc_c::getCross();
}
+1 -1
View File
@@ -114,7 +114,7 @@ int daObj_Maki_Execute(obj_maki_class* i_this) {
cxyz.y += 20000.0f;
i_this->field_0x6f8[0] = dComIfGp_particle_set(
i_this->field_0x6f8[0], 0x820b, &i_this->current.pos, &i_this->tevStr,
&i_this->shape_angle, 0, 0xff, 0, 0xffffffff, 0, 0, 0);
&i_this->shape_angle, 0, 0xff, 0, -1, 0, 0, 0);
fopAcM_seStartLevel(i_this, 0x800a6, 0);
}
}
+1 -1
View File
@@ -157,7 +157,7 @@ void daRfHole_c::setBreakEffect() {
mDoMtx_stack_c::multVec(&acStack_24, &acStack_24);
cXyz cStack_30 = current.pos + acStack_24;
for (int i = 0; i < 5; i++) {
dComIfGp_particle_set(particle_id[i], &cStack_30, NULL, &scale, 0xff, 0, 0xffffffff, NULL,
dComIfGp_particle_set(particle_id[i], &cStack_30, NULL, &scale, 0xff, 0, -1, NULL,
NULL, NULL);
}
}
+1 -1
View File
@@ -255,7 +255,7 @@ int daObj_Sekizoa_c::CreateHeap() {
}
if (mType == TYPE_6) {
int success_create = mInvModel.create(mpMorf[0]->getModel(), 1);
if (success_create == NULL) {
if (success_create == 0) {
return 0;
}
+1 -1
View File
@@ -831,7 +831,7 @@ static void demo_camera(obj_so_class* i_this) {
// fallthrough
case 2:
sp3c.set(12459.0f, 3152.0f, 4628.0f);
daPy_getPlayerActorClass()->setPlayerPosAndAngle(&sp3c, 0xfffffaee, 0);
daPy_getPlayerActorClass()->setPlayerPosAndAngle(&sp3c, -1298, 0);
i_this->mDemoCamCenter.x = a_this->current.pos.x;
i_this->mDemoCamCenter.z = a_this->current.pos.z;
sp3c.y = (a_this->current.pos.y + 150.0f) - 50.0f;
+1 -1
View File
@@ -947,7 +947,7 @@ void daObjStone_c::set_carry_eff() {
if (field_0x0950 == 3) {
for (int i = 0; i < 3; i++) {
field_0x0964[i] =
dComIfGp_particle_set(l_carry_eff_id[i], &current.pos, 0, &pos, 0xFF, 0, 0xFFFFFFFF,
dComIfGp_particle_set(l_carry_eff_id[i], &current.pos, 0, &pos, 0xFF, 0, -1,
0, 0, 0); // float literal inline
if (field_0x0964[i] != 0) {
field_0x0964[i]->becomeImmortalEmitter();
+1 -1
View File
@@ -279,7 +279,7 @@ int daObjTks_c::createHeapCallBack(fopAc_ac_c* i_this) {
}
int daObjTks_c::ctrlJointCallBack(J3DJoint* i_joint, int param_1) {
if (param_1 == NULL) {
if (param_1 == 0) {
J3DModel* mdl_p = j3dSys.getModel();
daObjTks_c* a_this = (daObjTks_c*)mdl_p->getUserArea();
+1 -1
View File
@@ -23,7 +23,7 @@ int daPasserMng_c::execute() {
csXyz cStack_20(field_0x596 != 0 ? 0xff : endTime, current.angle.y, 0);
childProcIds[currentChildIndex] =
fopAcM_createChild(npcId, fopAcM_GetID(this), getPasserParam(), &current.pos,
fopAcM_GetRoomNo(this), &cStack_20, 0, 0xffffffff, 0);
fopAcM_GetRoomNo(this), &cStack_20, 0, -1, 0);
currentChildIndex = (currentChildIndex + 1) % getMaxNum();
}
mTime = time + intervalTime;
+24
View File
@@ -561,8 +561,10 @@ int daPeru_c::wait(int param_0) {
_AppearDemoTag_delete();
}
break;
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 1;
}
@@ -632,8 +634,10 @@ int daPeru_c::talk(int param_0) {
}
}
break;
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 0;
@@ -674,7 +678,11 @@ int daPeru_c::jump_st(int param_1) {
setAction(&daPeru_c::jump_ed, actionArg);
}
break;
#ifdef __MWERKS__
case MODE_INVALID:
#else
case (u16)MODE_INVALID:
#endif
field_0xe58 = 0;
break;
}
@@ -712,7 +720,11 @@ int daPeru_c::jump_ed(int param_1) {
return 1;
}
break;
#ifdef __MWERKS__
case MODE_INVALID:
#else
case (u16)MODE_INVALID:
#endif
field_0xe58 = 0;
break;
}
@@ -739,8 +751,10 @@ int daPeru_c::sniff(int param_0) {
mSound.startCreatureVoice(Z2SE_GZ_NE_KNKN, -1);
}
break;
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 0;
@@ -769,8 +783,10 @@ int daPeru_c::demo_appear(int param_0) {
return 1;
}
break;
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 0;
@@ -809,8 +825,10 @@ int daPeru_c::demo_walk_to_link(int param_0) {
}
break;
}
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 0;
}
@@ -838,8 +856,10 @@ int daPeru_c::demo_walk_circle(int param_0) {
field_0xe6e -= 0x155;
break;
}
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 0;
@@ -880,8 +900,10 @@ int daPeru_c::demo_walk_to_window(int param_0) {
}
break;
}
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 0;
@@ -912,8 +934,10 @@ int daPeru_c::demo_walk_to_window(int param_0) {
}
break;
}
#ifdef __MWERKS__
case MODE_INVALID:
break;
#endif
}
return 0;
+1 -1
View File
@@ -44,7 +44,7 @@ static void* search_spinner_sub(void* tag_0, void* tag_1) {
daTagSpinner_c* actor2 = (daTagSpinner_c*)tag_1;
if (actor != NULL &&
fopAcM_IsActor(actor) != NULL &&
fopAcM_IsActor(actor) != 0 &&
fopAcM_GetProfName(actor) == PROC_SPINNER) {
f32 latDist = actor->current.pos.absXZ(actor2->current.pos);
if (latDist < actor2->GetR()) {