SCUMM: Use inline member initialization in Player_Towns*

This commit is contained in:
Orgad Shaneh 2022-10-18 08:31:04 +03:00 committed by athrxx
parent c0c2babe9d
commit 1dbd274849
2 changed files with 21 additions and 28 deletions

View File

@ -25,7 +25,7 @@
namespace Scumm {
Player_Towns::Player_Towns(ScummEngine *vm, bool isVersion2) : _vm(vm), _v2(isVersion2), _intf(nullptr), _numSoundMax(isVersion2 ? 256 : 200), _unkFlags(0x33) {
Player_Towns::Player_Towns(ScummEngine *vm, bool isVersion2) : _vm(vm), _v2(isVersion2), _numSoundMax(isVersion2 ? 256 : 200) {
memset(_pcmCurrentSound, 0, sizeof(_pcmCurrentSound));
}
@ -187,14 +187,6 @@ int Player_Towns::allocatePcmChannel(int sound, int sfxChanRelIndex, uint32 prio
}
Player_Towns_v1::Player_Towns_v1(ScummEngine *vm, Audio::Mixer *mixer) : Player_Towns(vm, false) {
_soundOverride = nullptr;
_cdaCurrentSound = _cdaCurrentSoundTemp = _eupCurrentSound = _cdaNumLoops = 0;
_cdaForceRestart = 0;
_cdaVolLeft = _cdaVolRight = 0;
_eupVolLeft = _eupVolRight = 0;
_eupLooping = false;
if (_vm->_game.version == 3) {
_soundOverride = new SoundOvrParameters[_numSoundMax]();
}
@ -581,7 +573,8 @@ void Player_Towns_v1::playCdaTrack(int sound, const uint8 *data, bool skipTrackV
_cdaCurrentSound = sound;
}
Player_Towns_v2::Player_Towns_v2(ScummEngine *vm, Audio::Mixer *mixer, IMuse *imuse, bool disposeIMuse) : Player_Towns(vm, true), _imuse(imuse), _imuseDispose(disposeIMuse), _sblData(nullptr) {
Player_Towns_v2::Player_Towns_v2(ScummEngine *vm, Audio::Mixer *mixer, IMuse *imuse, bool disposeIMuse)
: Player_Towns(vm, true), _imuse(imuse), _imuseDispose(disposeIMuse) {
_soundOverride = new SoundOvrParameters[_numSoundMax]();
_intf = new TownsAudioInterface(mixer, nullptr, true);
}

View File

@ -70,9 +70,9 @@ protected:
} _pcmCurrentSound[9];
friend void syncWithSerializer(Common::Serializer &, PcmCurrentSound &);
uint8 _unkFlags;
uint8 _unkFlags = 0x33;
TownsAudioInterface *_intf;
TownsAudioInterface *_intf = nullptr;
ScummEngine *_vm;
const int _numSoundMax;
@ -118,24 +118,24 @@ private:
uint8 note;
};
SoundOvrParameters *_soundOverride;
SoundOvrParameters *_soundOverride = nullptr;
uint8 _cdaVolLeft;
uint8 _cdaVolRight;
uint8 _cdaVolLeft = 0;
uint8 _cdaVolRight = 0;
uint8 _eupCurrentSound;
uint8 _eupLooping;
uint8 _eupVolLeft;
uint8 _eupVolRight;
uint8 _eupCurrentSound = 0;
uint8 _eupLooping = 0;
uint8 _eupVolLeft = 0;
uint8 _eupVolRight = 0;
uint8 _cdaCurrentSound;
uint8 _cdaNumLoops;
uint8 _cdaForceRestart;
uint8 _cdaCurrentSound = 0;
uint8 _cdaNumLoops = 0;
uint8 _cdaForceRestart = 0;
uint8 _cdaCurrentSoundTemp;
uint8 _cdaNumLoopsTemp;
uint8 _cdaCurrentSoundTemp = 0;
uint8 _cdaNumLoopsTemp = 0;
EuphonyPlayer *_player;
EuphonyPlayer *_player = nullptr;
};
class Player_Towns_v2 : public Player_Towns {
@ -165,11 +165,11 @@ private:
uint8 type;
};
SoundOvrParameters *_soundOverride;
SoundOvrParameters *_soundOverride = nullptr;
uint8 *_sblData;
uint8 *_sblData = nullptr;
IMuse *_imuse;
IMuse *_imuse = nullptr;
const bool _imuseDispose;
};