diff options
| author | Luke Street <luke@street.dev> | 2026-02-28 21:19:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-28 20:19:17 -0800 |
| commit | 6a48380461bc9baabe1706ba57ca0cedfa2d0c51 (patch) | |
| tree | 593e054cfcb0250e63917c58b445a7e1f025a023 /src/Z2AudioLib | |
| parent | b5d3b8c059c10711370437f7db7539cd90f1cb29 (diff) | |
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
Diffstat (limited to 'src/Z2AudioLib')
| -rw-r--r-- | src/Z2AudioLib/Z2Audience.cpp | 2 | ||||
| -rw-r--r-- | src/Z2AudioLib/Z2Creature.cpp | 20 | ||||
| -rw-r--r-- | src/Z2AudioLib/Z2SoundObject.cpp | 16 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/Z2AudioLib/Z2Audience.cpp b/src/Z2AudioLib/Z2Audience.cpp index 46b7107473..5e8522701b 100644 --- a/src/Z2AudioLib/Z2Audience.cpp +++ b/src/Z2AudioLib/Z2Audience.cpp @@ -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; } diff --git a/src/Z2AudioLib/Z2Creature.cpp b/src/Z2AudioLib/Z2Creature.cpp index e02d1abcd5..14b0d31023 100644 --- a/src/Z2AudioLib/Z2Creature.cpp +++ b/src/Z2AudioLib/Z2Creature.cpp @@ -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) { diff --git a/src/Z2AudioLib/Z2SoundObject.cpp b/src/Z2AudioLib/Z2SoundObject.cpp index ec0a70eac4..3904884699 100644 --- a/src/Z2AudioLib/Z2SoundObject.cpp +++ b/src/Z2AudioLib/Z2SoundObject.cpp @@ -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()) { |
