[Scummvm-git-logs] scummvm master -> 6bd08e16278f8162ccbe85f67389845bcf810e7f
athrxx
noreply at scummvm.org
Sun Oct 9 01:18:31 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6bd08e1627 KYRA: code style fixes
Commit: 6bd08e16278f8162ccbe85f67389845bcf810e7f
https://github.com/scummvm/scummvm/commit/6bd08e16278f8162ccbe85f67389845bcf810e7f
Author: athrxx (athrxx at scummvm.org)
Date: 2022-10-09T03:08:03+02:00
Commit Message:
KYRA: code style fixes
Changed paths:
engines/kyra/engine/eobcommon.cpp
engines/kyra/graphics/vqa.cpp
engines/kyra/sequence/sequences_hof.cpp
engines/kyra/sound/drivers/halestorm.cpp
engines/kyra/text/text_lol.cpp
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index 3bb89856b5d..488726c5791 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -446,7 +446,8 @@ Common::Error EoBCoreEngine::init() {
}
assert(_sound);
- _sound->init();
+ if (!_sound->init())
+ error("Sound init failed");
if (_flags.platform == Common::kPlatformPC98)
_sound->loadSfxFile("EFECT.OBJ");
diff --git a/engines/kyra/graphics/vqa.cpp b/engines/kyra/graphics/vqa.cpp
index bf8fd668198..66fb1b82e14 100644
--- a/engines/kyra/graphics/vqa.cpp
+++ b/engines/kyra/graphics/vqa.cpp
@@ -58,7 +58,7 @@ static uint32 readTag(Common::SeekableReadStream *stream) {
return tag;
}
-VQADecoder::VQADecoder() : _fileStream(nullptr) {
+VQADecoder::VQADecoder() : _fileStream(nullptr), _frameInfo(nullptr) {
memset(&_header, 0, sizeof(_header));
}
diff --git a/engines/kyra/sequence/sequences_hof.cpp b/engines/kyra/sequence/sequences_hof.cpp
index 952e8030c5f..251cc3d509c 100644
--- a/engines/kyra/sequence/sequences_hof.cpp
+++ b/engines/kyra/sequence/sequences_hof.cpp
@@ -1696,6 +1696,7 @@ void SeqPlayer_HOF::displayHoFTalkieScrollText(uint8 *data, const ScreenDim *d,
textData[1].text += strlen((char *)textData[1].text);
textData[1].text[0] = textData[1].unk1;
cnt--;
+ assert(cnt >= 0);
memmove(&textData[1], &textData[2], cnt * sizeof(ScrollTextData));
}
diff --git a/engines/kyra/sound/drivers/halestorm.cpp b/engines/kyra/sound/drivers/halestorm.cpp
index fe0a08046e0..d78324aa19d 100644
--- a/engines/kyra/sound/drivers/halestorm.cpp
+++ b/engines/kyra/sound/drivers/halestorm.cpp
@@ -88,7 +88,7 @@ public:
ShStBuffer(ShStBuffer &&buff) noexcept : ptr(buff.ptr), len(buff.len), lifes(buff.lifes) { buff.lifes = nullptr; }
ShStBuffer(const void *p, uint32 cb, bool allocate = false) : ptr((const uint8*)p), len(cb), lifes(nullptr) { if (allocate) memcpy(crtbuf(), p, cb); }
ShStBuffer() : ShStBuffer(nullptr, 0) {}
- ShStBuffer(Common::SeekableReadStream *s) : len(s ? s->size() : 0), lifes(nullptr) { s->read(crtbuf(), len); }
+ ShStBuffer(Common::SeekableReadStream *s) : len(s ? s->size() : 0), lifes(nullptr) { if (s) s->read(crtbuf(), len); }
~ShStBuffer() { dcrlif(); }
ShStBuffer &operator=(Common::SeekableReadStream *s) { return operator=(ShStBuffer(s)); }
ShStBuffer &operator=(ShStBuffer &&buff) noexcept {
diff --git a/engines/kyra/text/text_lol.cpp b/engines/kyra/text/text_lol.cpp
index 54e760b024e..a997b094faa 100644
--- a/engines/kyra/text/text_lol.cpp
+++ b/engines/kyra/text/text_lol.cpp
@@ -181,11 +181,14 @@ void TextDisplayer_LoL::printMessage(uint16 type, const char *str, ...) {
const uint8 *textColors = _vm->gameFlags().use16ColorMode ? textColors16 : textColors256;
if (type & 4)
- type ^= 4;
+ type &= ~4;
else
_vm->stopPortraitSpeechAnim();
- uint16 col = textColors[type & 0x7FFF];
+ int index = type & 0x7FFF;
+ assert(index < 5);
+
+ uint16 col = textColors[index];
int od = _screen->curDimIndex();
@@ -216,11 +219,11 @@ void TextDisplayer_LoL::printMessage(uint16 type, const char *str, ...) {
_lineCount = 0;
if (!(type & 0x8000)) {
- if (soundEffect[type])
- _vm->sound()->playSoundEffect(soundEffect[type]);
+ if (soundEffect[index])
+ _vm->sound()->playSoundEffect(soundEffect[index]);
}
- _vm->_textColorFlag = type & 0x7FFF;
+ _vm->_textColorFlag = index;
_vm->_fadeText = false;
}
More information about the Scummvm-git-logs
mailing list