mirror of
https://github.com/zeldaret/tp
synced 2026-07-08 14:36:36 -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:
@@ -454,7 +454,7 @@ f32 Z2SpotMic::calcMicVolume(f32 param_0, int camID, f32 param_2) {
|
||||
JUT_ASSERT(687, camID >= 0);
|
||||
JUT_ASSERT(688, camID < 1);
|
||||
|
||||
if (mMicOn == NULL) {
|
||||
if (mMicOn == false) {
|
||||
return param_2;
|
||||
}
|
||||
|
||||
|
||||
@@ -718,11 +718,11 @@ void Z2SoundObjBeeGroup::playBeeGroupSound(JAISoundID soundID, u8 param_1) {
|
||||
Z2SoundHandlePool* handle1 = startLevelSound((u32)soundID, 0, -1);
|
||||
Z2SoundHandlePool* handle2 = startLevelSound(sound_id2, 0, -1);
|
||||
|
||||
if (handle1 != NULL && *handle1 != NULL) {
|
||||
if (handle1 != NULL && *handle1 != false) {
|
||||
f32 volume = Z2Calc::linearTransform(param_1, 1.0f, 5.0f, 0.5f, 1.0f, false);
|
||||
(*handle1)->getAuxiliary().moveVolume(volume, 0);
|
||||
}
|
||||
if (handle2 != NULL && *handle2 != NULL) {
|
||||
if (handle2 != NULL && *handle2 != false) {
|
||||
f32 volume = Z2Calc::linearTransform(param_1, 1.0f, 20.0f, 0.1f, 1.0f, false);
|
||||
(*handle2)->getAuxiliary().moveVolume(volume, 0);
|
||||
}
|
||||
@@ -924,28 +924,28 @@ Z2SoundHandlePool* Z2CreatureOI::startCreatureSoundLevel(JAISoundID soundID, u32
|
||||
f32 pitch = Z2Calc::getParamByExp(mapinfo, 0.0f, 42.0f, 0.4f, 0.9f, 1.1f,
|
||||
Z2Calc::CURVE_POSITIVE);
|
||||
|
||||
if (handle1 != NULL && *handle1 != NULL) {
|
||||
if (handle1 != NULL && *handle1 != false) {
|
||||
(*handle1)->getAuxiliary().moveVolume(volume, 0);
|
||||
(*handle1)->getAuxiliary().movePitch(pitch, 0);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (handle2 != NULL && *handle2 != NULL) {
|
||||
if (handle2 != NULL && *handle2 != false) {
|
||||
(*handle2)->getAuxiliary().moveVolume(volume, 0);
|
||||
(*handle2)->getAuxiliary().movePitch(pitch, 0);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (handle3 != NULL && *handle3 != NULL) {
|
||||
if (handle3 != NULL && *handle3 != false) {
|
||||
(*handle3)->getAuxiliary().moveVolume(volume, 0);
|
||||
(*handle3)->getAuxiliary().movePitch(pitch, 0);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (handle4 != NULL && *handle4 != NULL) {
|
||||
if (handle4 != NULL && *handle4 != false) {
|
||||
(*handle4)->getAuxiliary().moveVolume(volume, 0);
|
||||
(*handle4)->getAuxiliary().movePitch(pitch, 0);
|
||||
return handle4;
|
||||
@@ -979,7 +979,7 @@ Z2SoundHandlePool* Z2CreatureOI::startTentacleSoundLevel(JAISoundID soundID, u8
|
||||
}
|
||||
|
||||
static void Z2_E_sw_modPitch(Z2SoundHandlePool* handle, u32 mapinfo) {
|
||||
if (handle != NULL && *handle != NULL) {
|
||||
if (handle != NULL && *handle != false) {
|
||||
f32 pitch = 1.0f;
|
||||
switch (mapinfo) {
|
||||
case 1:
|
||||
@@ -994,7 +994,7 @@ static void Z2_E_sw_modPitch(Z2SoundHandlePool* handle, u32 mapinfo) {
|
||||
}
|
||||
|
||||
static void Z2_E_ms_modVol(Z2SoundHandlePool* handle, u32 mapinfo) {
|
||||
if (handle != NULL && *handle != NULL) {
|
||||
if (handle != NULL && *handle != false) {
|
||||
f32 var_f31 = 0.2f;
|
||||
if (mapinfo == 1) {
|
||||
(*handle)->getAuxiliary().moveVolume(var_f31, 0);
|
||||
@@ -1003,7 +1003,7 @@ static void Z2_E_ms_modVol(Z2SoundHandlePool* handle, u32 mapinfo) {
|
||||
}
|
||||
|
||||
static void Z2_E_mm_modPitch(Z2SoundHandlePool* handle, u32 mapinfo) {
|
||||
if (handle != NULL && *handle != NULL) {
|
||||
if (handle != NULL && *handle != false) {
|
||||
f32 var_f31 = 0.7f;
|
||||
if (mapinfo == 3) {
|
||||
(*handle)->getAuxiliary().movePitch(var_f31, 0);
|
||||
@@ -1012,7 +1012,7 @@ static void Z2_E_mm_modPitch(Z2SoundHandlePool* handle, u32 mapinfo) {
|
||||
}
|
||||
|
||||
static void Z2_B_zan_modPitch(Z2SoundHandlePool* handle, u32 mapinfo) {
|
||||
if (handle != NULL && *handle != NULL) {
|
||||
if (handle != NULL && *handle != false) {
|
||||
f32 pitch = 1.0f;
|
||||
f32 volume = 1.0f;
|
||||
if (mapinfo > 400) {
|
||||
|
||||
@@ -164,7 +164,7 @@ Z2SoundHandlePool* Z2SoundObjBase::startLevelSound(JAISoundID soundID, u32 mapin
|
||||
if (handle != NULL) {
|
||||
soundStarter_->startSound(soundID, handle, pos_, mapinfo, fxMix,
|
||||
1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||
if (handle != NULL && (*handle) != NULL) {
|
||||
if (handle != NULL && (*handle) != false) {
|
||||
(*handle)->setLifeTime(1, false);
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
@@ -210,7 +210,7 @@ Z2SoundHandlePool* Z2SoundObjBase::startCollisionSE(u32 hitID, u32 mapinfo, Z2So
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(JAISoundID(hitID), mapinfo, -1);
|
||||
if (handle != NULL && (*handle) != NULL) {
|
||||
if (handle != NULL && (*handle) != false) {
|
||||
(*handle)->setUserData(mapinfo);
|
||||
if (30 <= mapinfo && mapinfo <= 52) {
|
||||
Z2Audible* audible = (Z2Audible*)(*handle)->getAudible();
|
||||
@@ -251,7 +251,7 @@ Z2SoundHandlePool* Z2DopplerSoundObjBase::startSound(JAISoundID soundID, u32 map
|
||||
pos_ = NULL;
|
||||
|
||||
Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(soundID, mapinfo, reverb);
|
||||
if (pos != NULL && handle != NULL && (*handle) != NULL) {
|
||||
if (pos != NULL && handle != NULL && (*handle) != false) {
|
||||
if ((*handle)->acceptsNewAudible()) {
|
||||
(*handle)->newAudible(*pos, &field_0x20, 0, NULL);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ Z2SoundHandlePool* Z2DopplerSoundObjBase::startLevelSound(JAISoundID soundID, u3
|
||||
pos_ = NULL;
|
||||
|
||||
Z2SoundHandlePool* handle = Z2SoundObjBase::startLevelSound(soundID, mapinfo, reverb);
|
||||
if (pos != NULL && handle != NULL && (*handle) != NULL) {
|
||||
if (pos != NULL && handle != NULL && (*handle) != false) {
|
||||
if ((*handle)->acceptsNewAudible()) {
|
||||
(*handle)->newAudible(*pos, &field_0x20, 0, NULL);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ void Z2SoundObjSimple::init(Vec* posPtr, u8 handleNum) {
|
||||
Z2SoundHandlePool* Z2SoundObjSimple::startSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(soundID, mapinfo, reverb);
|
||||
|
||||
if (soundID == Z2SE_AL_UKI_POKOPOKO && handle != NULL && (*handle) != NULL) {
|
||||
if (soundID == Z2SE_AL_UKI_POKOPOKO && handle != NULL && (*handle) != false) {
|
||||
f32 volume = Z2Calc::getParamByExp((f32)mapinfo, 0.0f, 127.0f, 0.2f, 0.4f, 1.0f, Z2Calc::CURVE_POSITIVE);
|
||||
f32 pitch = Z2Calc::getParamByExp((f32)mapinfo, 0.0f, 127.0f, 0.2f, 0.6f, 1.2f, Z2Calc::CURVE_POSITIVE);
|
||||
(*handle)->getAuxiliary().movePitch(pitch, 0);
|
||||
@@ -298,7 +298,7 @@ Z2SoundHandlePool* Z2SoundObjSimple::startSound(JAISoundID soundID, u32 mapinfo,
|
||||
Z2SoundHandlePool* Z2SoundObjSimple::startLevelSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
Z2SoundHandlePool* handle = Z2SoundObjBase::startLevelSound(soundID, mapinfo, reverb);
|
||||
|
||||
if (handle != NULL && (*handle) != NULL) {
|
||||
if (handle != NULL && (*handle) != false) {
|
||||
f32 pitch = 1.0f;
|
||||
f32 volume = 1.0f;
|
||||
switch (soundID) {
|
||||
@@ -502,7 +502,7 @@ void Z2SoundObjAnime::startSoundInner(const JGeometry::TVec3<f32>& pos, f32 para
|
||||
u32 id = getSoundID(animationSound, pos, param_1);
|
||||
if (!Z2GetSeMgr()->isSoundCulling(id)) {
|
||||
JAISoundHandle* handle = getHandleUserData(user_data);
|
||||
if (handle != NULL && (*handle) != NULL && (*handle)->getAnimationState() != 1) {
|
||||
if (handle != NULL && (*handle) != false && (*handle)->getAnimationState() != 1) {
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ void Z2SoundObjAnime::startSoundInner(const JGeometry::TVec3<f32>& pos, f32 para
|
||||
bool result = soundStarter->startSound(id, handle, &pos, mapinfo, (f32)reverb / 127.0f,
|
||||
animationSound->field_0x0c, (f32)animationSound->field_0x14 / 127.0f,
|
||||
-1.0f, -1.0f, 0);
|
||||
if ((*handle) != NULL) {
|
||||
if ((*handle) != false) {
|
||||
(*handle)->setAnimationState(1);
|
||||
(*handle)->setUserData(user_data);
|
||||
if (animationSound->setsLifeTime()) {
|
||||
|
||||
Reference in New Issue
Block a user