[Scummvm-git-logs] scummvm master -> 00eb162fb89b7d0ea43318735127b7840c452c4e
neuromancer
noreply at scummvm.org
Wed Jun 10 14:02:58 UTC 2026
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
fa472c1a6f SCUMM: RA2: added missing SAUD code to better handle volume per channel
e80d90092b SCUMM: RA1: apply correct volume setting when changing the volume in-game
1758ffa0f5 SCUMM: RA1: added some missing audio code related with chunks and triggers
00eb162fb8 SCUMM: RA: normalize comments to avoid redunancies or incoherent wording
Commit: fa472c1a6fd5ff755c71be53fc4c2f591ab0b984
https://github.com/scummvm/scummvm/commit/fa472c1a6fd5ff755c71be53fc4c2f591ab0b984
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-10T16:02:41+02:00
Commit Message:
SCUMM: RA2: added missing SAUD code to better handle volume per channel
Changed paths:
engines/scumm/insane/rebel/rebel_audio.cpp
engines/scumm/insane/rebel/rebel_audio.h
engines/scumm/insane/rebel2/audio.cpp
engines/scumm/insane/rebel2/menu.cpp
engines/scumm/insane/rebel2/rebel.h
engines/scumm/smush/rebel/smush_player_ra2.cpp
engines/scumm/smush/rebel/smush_player_ra2.h
diff --git a/engines/scumm/insane/rebel/rebel_audio.cpp b/engines/scumm/insane/rebel/rebel_audio.cpp
index 9e04c4352b9..e5779d9f79b 100644
--- a/engines/scumm/insane/rebel/rebel_audio.cpp
+++ b/engines/scumm/insane/rebel/rebel_audio.cpp
@@ -23,6 +23,8 @@
#include "audio/decoders/raw.h"
#include "audio/mixer.h"
+#include "common/util.h"
+
#include "scumm/scumm_v7.h"
#include "scumm/smush/smush_player.h"
#include "scumm/insane/rebel/rebel_audio.h"
@@ -32,7 +34,11 @@ namespace Scumm {
RebelAudio::RebelAudio() : _vm(nullptr), _sampleRate(11025) {
for (int i = 0; i < kMaxTracks; i++) {
_streams[i] = nullptr;
+ _fadeStreams[i] = nullptr;
_trackActive[i] = false;
+ _fadeTrackActive[i] = false;
+ _streamTypes[i] = Audio::Mixer::kSFXSoundType;
+ _fadeStreamTypes[i] = Audio::Mixer::kSFXSoundType;
}
}
@@ -41,7 +47,11 @@ void RebelAudio::init(ScummEngine_v7 *vm, int sampleRate) {
_sampleRate = sampleRate;
for (int i = 0; i < kMaxTracks; i++) {
_streams[i] = nullptr;
+ _fadeStreams[i] = nullptr;
_trackActive[i] = false;
+ _fadeTrackActive[i] = false;
+ _streamTypes[i] = Audio::Mixer::kSFXSoundType;
+ _fadeStreamTypes[i] = Audio::Mixer::kSFXSoundType;
}
}
@@ -50,15 +60,8 @@ void RebelAudio::reset() {
return;
for (int i = 0; i < kMaxTracks; i++) {
- if (_trackActive[i]) {
- _vm->_mixer->stopHandle(_handles[i]);
- _trackActive[i] = false;
- }
- if (_streams[i]) {
- _streams[i]->finish();
- delete _streams[i];
- _streams[i] = nullptr;
- }
+ stopStream(i);
+ stopFadeStream(i);
}
}
@@ -67,16 +70,165 @@ void RebelAudio::terminate() {
}
void RebelAudio::queueData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate) {
+ queueData(trackIdx, data, size, volume, pan, sampleRate, Audio::Mixer::kSFXSoundType);
+}
+
+void RebelAudio::stopStream(int trackIdx) {
+ if (!_vm || trackIdx < 0 || trackIdx >= kMaxTracks)
+ return;
+
+ if (_trackActive[trackIdx]) {
+ _vm->_mixer->stopHandle(_handles[trackIdx]);
+ _trackActive[trackIdx] = false;
+ }
+
+ if (_streams[trackIdx]) {
+ _streams[trackIdx]->finish();
+ delete _streams[trackIdx];
+ _streams[trackIdx] = nullptr;
+ }
+}
+
+void RebelAudio::stopFadeStream(int trackIdx) {
+ if (!_vm || trackIdx < 0 || trackIdx >= kMaxTracks)
+ return;
+
+ if (_fadeTrackActive[trackIdx]) {
+ _vm->_mixer->stopHandle(_fadeHandles[trackIdx]);
+ _fadeTrackActive[trackIdx] = false;
+ }
+
+ if (_fadeStreams[trackIdx]) {
+ _fadeStreams[trackIdx]->finish();
+ delete _fadeStreams[trackIdx];
+ _fadeStreams[trackIdx] = nullptr;
+ }
+}
+
+Audio::Mixer::SoundType RebelAudio::getSoundType(int flags) const {
+ switch (flags & TRK_TYPE_MASK) {
+ case IS_SPEECH:
+ return Audio::Mixer::kSpeechSoundType;
+ case IS_BKG_MUSIC:
+ return Audio::Mixer::kMusicSoundType;
+ case IS_SFX:
+ default:
+ return Audio::Mixer::kSFXSoundType;
+ }
+}
+
+int RebelAudio::getTrackPan(SmushPlayer *player, int idx) const {
+ if (!player || idx < 0 || idx >= player->_smushNumTracks)
+ return 0;
+
+ return CLIP<int>((int8)player->_smushTracks[idx].pan, -127, 127);
+}
+
+int RebelAudio::computeMixVolume(SmushPlayer *player, int idx) const {
+ if (!player || idx < 0 || idx >= player->_smushNumTracks)
+ return 0;
+
+ const SmushPlayer::SmushAudioTrack &track = player->_smushTracks[idx];
+ int baseVolume;
+
+ switch (track.flags & TRK_TYPE_MASK) {
+ case IS_SFX:
+ baseVolume = (player->_smushTrackVols[1] * track.volume) >> 7;
+ break;
+ case IS_BKG_MUSIC:
+ baseVolume = (player->_smushTrackVols[3] * track.volume) >> 7;
+ break;
+ case IS_SPEECH:
+ baseVolume = (player->_smushTrackVols[2] * track.volume) >> 7;
+ break;
+ default:
+ baseVolume = track.volume;
+ break;
+ }
+
+ int mixVolume = (baseVolume * player->_smushTrackVols[0]) / 127;
+ if ((track.flags & TRK_TYPE_MASK) == IS_BKG_MUSIC && player->isChanActive(CHN_SPEECH))
+ mixVolume = (mixVolume * player->_gainReductionMultiplier) >> 8;
+
+ return CLIP<int>(mixVolume, 0, 127);
+}
+
+void RebelAudio::updateTrackMixerState(SmushPlayer *player, int idx) {
+ if (!_vm || !player || idx < 0 || idx >= player->_smushNumTracks || idx >= kMaxTracks)
+ return;
+
+ if (_trackActive[idx]) {
+ const int scaledVolume = (computeMixVolume(player, idx) * Audio::Mixer::kMaxChannelVolume) / 127;
+ const int scaledPan = (getTrackPan(player, idx) * 127) / 128;
+ _vm->_mixer->setChannelVolume(_handles[idx], scaledVolume);
+ _vm->_mixer->setChannelBalance(_handles[idx], scaledPan);
+ }
+}
+
+void RebelAudio::queueFadeData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate, Audio::Mixer::SoundType soundType) {
if (!_vm || trackIdx < 0 || trackIdx >= kMaxTracks || size <= 0 || !data)
return;
const int sourceRate = sampleRate > 0 ? sampleRate : _sampleRate;
+ if (_fadeStreams[trackIdx] && _fadeStreamTypes[trackIdx] != soundType)
+ stopFadeStream(trackIdx);
+
+ if (!_fadeStreams[trackIdx]) {
+ debugC(DEBUG_INSANE, "RebelAudio: Creating fade audio stream for track %d at %d Hz", trackIdx, _sampleRate);
+ _fadeStreams[trackIdx] = Audio::makeQueuingAudioStream(_sampleRate, false);
+ _fadeStreamTypes[trackIdx] = soundType;
+ _fadeTrackActive[trackIdx] = true;
+ _vm->_mixer->playStream(soundType, &_fadeHandles[trackIdx],
+ _fadeStreams[trackIdx], -1, Audio::Mixer::kMaxChannelVolume, 0,
+ DisposeAfterUse::NO);
+ }
+
+ int32 queueSize = size;
+ if (sourceRate != _sampleRate) {
+ queueSize = ((int64)size * _sampleRate + sourceRate / 2) / sourceRate;
+ if (queueSize <= 0)
+ queueSize = 1;
+ }
+
+ byte *audioCopy = (byte *)malloc(queueSize);
+ if (!audioCopy)
+ return;
+
+ if (sourceRate == _sampleRate) {
+ memcpy(audioCopy, data, queueSize);
+ } else {
+ for (int32 i = 0; i < queueSize; i++) {
+ int32 srcPos = ((int64)i * sourceRate) / _sampleRate;
+ if (srcPos >= size)
+ srcPos = size - 1;
+ audioCopy[i] = data[srcPos];
+ }
+ }
+
+ _fadeStreams[trackIdx]->queueBuffer(audioCopy, queueSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
+
+ const int scaledVolume = (CLIP<int>(volume, 0, 127) * Audio::Mixer::kMaxChannelVolume) / 127;
+ const int scaledPan = (CLIP<int>(pan, -127, 127) * 127) / 128;
+ _vm->_mixer->setChannelVolume(_fadeHandles[trackIdx], scaledVolume);
+ _vm->_mixer->setChannelBalance(_fadeHandles[trackIdx], scaledPan);
+}
+
+void RebelAudio::queueData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate, Audio::Mixer::SoundType soundType) {
+ if (!_vm || trackIdx < 0 || trackIdx >= kMaxTracks || size <= 0 || !data)
+ return;
+
+ const int sourceRate = sampleRate > 0 ? sampleRate : _sampleRate;
+
+ if (_streams[trackIdx] && _streamTypes[trackIdx] != soundType)
+ stopStream(trackIdx);
+
if (!_streams[trackIdx]) {
debugC(DEBUG_INSANE, "RebelAudio: Creating audio stream for track %d at %d Hz", trackIdx, _sampleRate);
_streams[trackIdx] = Audio::makeQueuingAudioStream(_sampleRate, false);
+ _streamTypes[trackIdx] = soundType;
_trackActive[trackIdx] = true;
- _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[trackIdx],
+ _vm->_mixer->playStream(soundType, &_handles[trackIdx],
_streams[trackIdx], -1, Audio::Mixer::kMaxChannelVolume, 0,
DisposeAfterUse::NO);
}
@@ -105,12 +257,63 @@ void RebelAudio::queueData(int trackIdx, const uint8 *data, int32 size, int volu
_streams[trackIdx]->queueBuffer(audioCopy, queueSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
- const int scaledVolume = (volume * Audio::Mixer::kMaxChannelVolume) / 127;
- const int scaledPan = (pan * 127) / 128;
+ const int scaledVolume = (CLIP<int>(volume, 0, 127) * Audio::Mixer::kMaxChannelVolume) / 127;
+ const int scaledPan = (CLIP<int>(pan, -127, 127) * 127) / 128;
_vm->_mixer->setChannelVolume(_handles[trackIdx], scaledVolume);
_vm->_mixer->setChannelBalance(_handles[trackIdx], scaledPan);
}
+void RebelAudio::setGroupVolume(SmushPlayer *player, int groupId, int volume) {
+ if (!player)
+ return;
+
+ volume = CLIP<int>(volume, 0, 127);
+ switch (groupId) {
+ case GRP_MASTER:
+ player->_smushTrackVols[0] = volume;
+ for (int i = 0; i < player->_smushNumTracks; i++)
+ updateTrackMixerState(player, i);
+ return;
+ case GRP_SFX:
+ player->_smushTrackVols[1] = volume;
+ for (int i = 0; i < player->_smushNumTracks; i++)
+ updateTrackMixerState(player, i);
+ return;
+ case GRP_BKGMUS:
+ player->_smushTrackVols[3] = volume;
+ for (int i = 0; i < player->_smushNumTracks; i++)
+ updateTrackMixerState(player, i);
+ return;
+ case GRP_SPEECH:
+ player->_smushTrackVols[2] = volume;
+ for (int i = 0; i < player->_smushNumTracks; i++)
+ updateTrackMixerState(player, i);
+ return;
+ default:
+ break;
+ }
+
+ for (int i = 0; i < player->_smushNumTracks; i++) {
+ if (player->_smushTracks[i].groupId == groupId) {
+ player->_smushTracks[i].volume = volume;
+ updateTrackMixerState(player, i);
+ }
+ }
+}
+
+void RebelAudio::setGroupPan(SmushPlayer *player, int groupId, int pan) {
+ if (!player)
+ return;
+
+ pan = CLIP<int>(pan, -127, 127);
+ for (int i = 0; i < player->_smushNumTracks; i++) {
+ if (player->_smushTracks[i].groupId == groupId) {
+ player->_smushTracks[i].pan = (byte)(int8)pan;
+ updateTrackMixerState(player, i);
+ }
+ }
+}
+
bool RebelAudio::processAudioCodes(SmushPlayer *player, int idx, int32 &tmpFeedSize, int &mixVolume) {
uint8 *code, *buf, subcode, value;
int chunk;
@@ -193,13 +396,11 @@ bool RebelAudio::processAudioCodes(SmushPlayer *player, int idx, int32 &tmpFeedS
switch (code[2]) {
case SAUD_VALUEID_ALL_VOLS:
player->_smushTrackVols[0] = code[3];
+ mixVolume = computeMixVolume(player, idx);
break;
case SAUD_VALUEID_TRK_VOL:
player->_smushTracks[idx].volume = code[3];
- mixVolume = (player->_smushTrackVols[0] * player->_smushTracks[idx].volume) / 127;
-
- if ((player->_smushTracks[idx].flags & TRK_TYPE_MASK) == IS_BKG_MUSIC && player->isChanActive(CHN_SPEECH))
- mixVolume = (mixVolume * player->_gainReductionMultiplier) >> 8;
+ mixVolume = computeMixVolume(player, idx);
break;
case SAUD_VALUEID_TRK_PAN:
player->_smushTracks[idx].pan = code[3];
@@ -215,9 +416,11 @@ bool RebelAudio::processAudioCodes(SmushPlayer *player, int idx, int32 &tmpFeedS
switch (code[2]) {
case SAUD_VALUEID_ALL_VOLS:
player->_smushTrackVols[0] += code[3];
+ mixVolume = computeMixVolume(player, idx);
break;
case SAUD_VALUEID_TRK_VOL:
player->_smushTracks[idx].volume += code[3];
+ mixVolume = computeMixVolume(player, idx);
break;
case SAUD_VALUEID_TRK_PAN:
player->_smushTracks[idx].pan += code[3];
@@ -308,12 +511,16 @@ void RebelAudio::processFrame(SmushPlayer *player, int16 feedSize) {
if (player->_paused)
return;
+ const int kMaxMixChunkSize = 0x100;
+ bool speechIsPlaying = false;
+
if (player->_smushTracksNeedInit) {
player->_smushTracksNeedInit = false;
for (int i = 0; i < SMUSH_MAX_TRACKS; i++) {
player->_smushDispatch[i].fadeRemaining = 0;
player->_smushDispatch[i].fadeVolume = 0;
player->_smushDispatch[i].fadeSampleRate = 0;
+ player->_smushDispatch[i].volumeStep = 0;
player->_smushDispatch[i].elapsedAudio = 0;
player->_smushDispatch[i].audioLength = 0;
}
@@ -323,35 +530,104 @@ void RebelAudio::processFrame(SmushPlayer *player, int16 feedSize) {
SmushPlayer::SmushAudioTrack &track = player->_smushTracks[i];
SmushPlayer::SmushAudioDispatch &dispatch = player->_smushDispatch[i];
- if (track.state == TRK_STATE_INACTIVE || !track.blockPtr)
+ if (!track.blockPtr)
continue;
- bool isPlayableTrack =
+ const bool isPlayableTrack =
((track.flags & TRK_TYPE_MASK) == IS_SPEECH && player->isChanActive(CHN_SPEECH)) ||
((track.flags & TRK_TYPE_MASK) == IS_BKG_MUSIC && player->isChanActive(CHN_BKGMUS)) ||
((track.flags & TRK_TYPE_MASK) == IS_SFX && player->isChanActive(CHN_OTHER));
- if (!isPlayableTrack)
- continue;
+ const Audio::Mixer::SoundType soundType = getSoundType(track.flags);
+ int mixVolume = computeMixVolume(player, i);
+
+ if (track.state == TRK_STATE_FADING && dispatch.state == TRK_STATE_PLAYING &&
+ dispatch.dataBuf && dispatch.dataSize > 0 && track.fadeBuf) {
+ const int32 fadeStartOffset = dispatch.audioRemaining % dispatch.dataSize;
+ dispatch.fadeRemaining = SMUSH_FADE_SIZE;
+ dispatch.fadeVolume = track.volume;
+ dispatch.fadeSampleRate = dispatch.sampleRate;
+
+ memset(track.fadeBuf, 127, dispatch.fadeRemaining);
+ int32 copySize = dispatch.dataSize - fadeStartOffset;
+ if (copySize > dispatch.fadeRemaining)
+ copySize = dispatch.fadeRemaining;
+ if (copySize > 0)
+ memcpy(track.fadeBuf, &dispatch.dataBuf[fadeStartOffset], copySize);
+
+ dispatch.volumeStep = 0;
+ stopFadeStream(i);
+ stopStream(i);
+ } else if (track.state == TRK_STATE_PLAYING && dispatch.dataBuf && dispatch.dataSize > 0 && track.fadeBuf) {
+ if (dispatch.audioRemaining < track.availableSize - track.dataSize + 15000 && track.availableSize < track.sdatSize) {
+ dispatch.volumeStep = 0;
+ int32 mixInFrameCount = track.availableSize - dispatch.audioRemaining - 15000;
+
+ if (mixInFrameCount > dispatch.currentOffset)
+ mixInFrameCount = dispatch.currentOffset;
+
+ if (dispatch.audioRemaining + mixInFrameCount > track.sdatSize - dispatch.dataSize)
+ mixInFrameCount = track.sdatSize - dispatch.dataSize - dispatch.audioRemaining;
+
+ if (mixInFrameCount > 0) {
+ const int32 fadeStartOffset = dispatch.audioRemaining % dispatch.dataSize;
+ dispatch.fadeRemaining = SMUSH_FADE_SIZE;
+ dispatch.fadeSampleRate = dispatch.sampleRate;
+
+ memset(track.fadeBuf, 127, dispatch.fadeRemaining);
+ int32 copySize = dispatch.dataSize - fadeStartOffset;
+ if (copySize > dispatch.fadeRemaining)
+ copySize = dispatch.fadeRemaining;
+ if (copySize > 0)
+ memcpy(track.fadeBuf, &dispatch.dataBuf[fadeStartOffset], copySize);
+
+ dispatch.audioRemaining += mixInFrameCount;
+ dispatch.currentOffset -= mixInFrameCount;
+ stopFadeStream(i);
+ }
+ }
+ }
- int baseVolume;
- switch (track.flags & TRK_TYPE_MASK) {
- case IS_SFX:
- baseVolume = (player->_smushTrackVols[1] * track.volume) >> 7;
- break;
- case IS_BKG_MUSIC:
- baseVolume = (player->_smushTrackVols[3] * track.volume) >> 7;
- break;
- case IS_SPEECH:
- baseVolume = (player->_smushTrackVols[2] * track.volume) >> 7;
- break;
- default:
- baseVolume = track.volume;
- break;
+ if (dispatch.fadeRemaining && dispatch.fadeSampleRate > 0 && player->_smushAudioSampleRate > 0 && track.fadeBuf) {
+ int32 maxFadeChunkSize = ((int64)dispatch.fadeSampleRate * feedSize + player->_smushAudioSampleRate - 1) / player->_smushAudioSampleRate;
+ if (maxFadeChunkSize <= 0)
+ maxFadeChunkSize = 1;
+
+ int32 fadeRemaining = MIN<int32>(dispatch.fadeRemaining, maxFadeChunkSize);
+ while (fadeRemaining > 0) {
+ int32 fadeInFrameCount = MIN<int32>(fadeRemaining, kMaxMixChunkSize);
+ const int fadeOffset = SMUSH_FADE_SIZE - dispatch.fadeRemaining;
+
+ if (isPlayableTrack) {
+ int fadeBaseVolume;
+ switch (track.flags & TRK_TYPE_MASK) {
+ case IS_SFX:
+ fadeBaseVolume = (player->_smushTrackVols[1] * dispatch.fadeVolume) >> 7;
+ break;
+ case IS_BKG_MUSIC:
+ fadeBaseVolume = (player->_smushTrackVols[3] * dispatch.fadeVolume) >> 7;
+ break;
+ case IS_SPEECH:
+ fadeBaseVolume = (player->_smushTrackVols[2] * dispatch.fadeVolume) >> 7;
+ break;
+ default:
+ fadeBaseVolume = dispatch.fadeVolume;
+ break;
+ }
+ const int fadeVolume = CLIP<int>(dispatch.fadeRemaining * fadeBaseVolume * player->_smushTrackVols[0] / (SMUSH_FADE_SIZE * 127), 0, 127);
+ queueFadeData(i, &track.fadeBuf[fadeOffset], fadeInFrameCount, fadeVolume, getTrackPan(player, i), dispatch.fadeSampleRate, soundType);
+ }
+
+ fadeRemaining -= fadeInFrameCount;
+ dispatch.fadeRemaining -= fadeInFrameCount;
+ }
}
- int mixVolume = baseVolume * player->_smushTrackVols[0] / 127;
if (track.state == TRK_STATE_FADING) {
+ if (dispatch.state != TRK_STATE_PLAYING)
+ dispatch.volumeStep = 16;
+
+ stopStream(i);
dispatch.headerPtr = track.dataBuf;
dispatch.dataBuf = track.subChunkPtr;
dispatch.dataSize = track.dataSize;
@@ -366,15 +642,21 @@ void RebelAudio::processFrame(SmushPlayer *player, int16 feedSize) {
while (tmpFeedSize > 0) {
int32 mixInFrameCount = dispatch.currentOffset;
- if (mixInFrameCount > 0 && dispatch.dataBuf && dispatch.dataSize > 0) {
+ if (mixInFrameCount > 0) {
+ if (!dispatch.dataBuf || dispatch.dataSize <= 0)
+ break;
+
if (dispatch.audioRemaining < 0)
dispatch.audioRemaining = 0;
int32 offset = dispatch.audioRemaining % dispatch.dataSize;
+ int32 maxFrames = mixInFrameCount;
if (dispatch.sampleRate > 0 && player->_smushAudioSampleRate > 0) {
- int32 maxFrames = ((int64)dispatch.sampleRate * tmpFeedSize +
+ maxFrames = ((int64)dispatch.sampleRate * tmpFeedSize +
player->_smushAudioSampleRate - 1) / player->_smushAudioSampleRate;
+ if (maxFrames <= 0)
+ maxFrames = 1;
if (mixInFrameCount > maxFrames)
mixInFrameCount = maxFrames;
}
@@ -382,31 +664,57 @@ void RebelAudio::processFrame(SmushPlayer *player, int16 feedSize) {
if (offset + mixInFrameCount > dispatch.dataSize)
mixInFrameCount = dispatch.dataSize - offset;
- if (dispatch.audioRemaining + mixInFrameCount > track.availableSize) {
- mixInFrameCount = track.availableSize - dispatch.audioRemaining;
- if (mixInFrameCount <= 0) {
- track.state = TRK_STATE_ENDING;
- break;
- }
+ if (dispatch.audioRemaining + mixInFrameCount <= track.availableSize) {
+ if (dispatch.volumeStep < 16)
+ dispatch.volumeStep++;
+
+ if (mixInFrameCount > kMaxMixChunkSize)
+ mixInFrameCount = kMaxMixChunkSize;
+
+ track.state = TRK_STATE_PLAYING;
+
+ if (!speechIsPlaying)
+ speechIsPlaying = (track.flags & TRK_TYPE_MASK) == IS_SPEECH;
+ } else {
+ if (dispatch.volumeStep)
+ dispatch.volumeStep--;
+
+ track.state = TRK_STATE_ENDING;
+
+ if (mixInFrameCount > kMaxMixChunkSize)
+ mixInFrameCount = kMaxMixChunkSize;
+
+ dispatch.audioRemaining -= mixInFrameCount;
+ dispatch.currentOffset += mixInFrameCount;
+ offset = dispatch.audioRemaining % dispatch.dataSize;
}
if (mixInFrameCount > 0) {
if (!dispatch.dataBuf || offset < 0 || offset + mixInFrameCount > dispatch.dataSize)
break;
- track.state = TRK_STATE_PLAYING;
- queueData(i, &dispatch.dataBuf[offset], mixInFrameCount, mixVolume, track.pan, dispatch.sampleRate);
+ int32 consumedFeed;
+ if (dispatch.sampleRate > 0 && player->_smushAudioSampleRate > 0) {
+ if (mixInFrameCount == maxFrames) {
+ consumedFeed = tmpFeedSize;
+ } else {
+ consumedFeed = ((int64)mixInFrameCount * player->_smushAudioSampleRate +
+ dispatch.sampleRate - 1) / dispatch.sampleRate;
+ if (consumedFeed <= 0)
+ consumedFeed = 1;
+ }
+ } else {
+ consumedFeed = mixInFrameCount;
+ }
+
+ if (isPlayableTrack)
+ queueData(i, &dispatch.dataBuf[offset], mixInFrameCount,
+ (mixVolume * dispatch.volumeStep) >> 4, getTrackPan(player, i),
+ dispatch.sampleRate, soundType);
dispatch.currentOffset -= mixInFrameCount;
dispatch.audioRemaining += mixInFrameCount;
-
- if (dispatch.sampleRate > 0) {
- int32 consumedFeed = ((int64)mixInFrameCount * player->_smushAudioSampleRate +
- dispatch.sampleRate - 1) / dispatch.sampleRate;
- tmpFeedSize -= consumedFeed;
- } else {
- tmpFeedSize -= mixInFrameCount;
- }
+ tmpFeedSize -= consumedFeed;
}
}
@@ -422,6 +730,18 @@ void RebelAudio::processFrame(SmushPlayer *player, int16 feedSize) {
track.audioRemaining = dispatch.audioRemaining;
dispatch.state = track.state;
}
+
+ if (speechIsPlaying) {
+ if (player->_gainReductionMultiplier > player->_gainReductionLowerBound) {
+ player->_gainReductionMultiplier -= (feedSize * 2 * player->_gainReductionFactor) >> 13;
+ if (player->_gainReductionMultiplier < player->_gainReductionLowerBound)
+ player->_gainReductionMultiplier = player->_gainReductionLowerBound;
+ }
+ } else if (player->_gainReductionMultiplier < 256) {
+ player->_gainReductionMultiplier += (feedSize * 2 * player->_gainReductionFactor) >> 15;
+ if (player->_gainReductionMultiplier > 256)
+ player->_gainReductionMultiplier = 256;
+ }
}
} // End of namespace Scumm
diff --git a/engines/scumm/insane/rebel/rebel_audio.h b/engines/scumm/insane/rebel/rebel_audio.h
index 4b13efe5e06..20ae8d10a0d 100644
--- a/engines/scumm/insane/rebel/rebel_audio.h
+++ b/engines/scumm/insane/rebel/rebel_audio.h
@@ -45,16 +45,31 @@ public:
void queueData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate = 0);
void processFrame(SmushPlayer *player, int16 feedSize);
+ void setGroupVolume(SmushPlayer *player, int groupId, int volume);
+ void setGroupPan(SmushPlayer *player, int groupId, int pan);
private:
static const int kMaxTracks = 4;
bool processAudioCodes(SmushPlayer *player, int idx, int32 &tmpFeedSize, int &mixVolume);
+ int computeMixVolume(SmushPlayer *player, int idx) const;
+ Audio::Mixer::SoundType getSoundType(int flags) const;
+ int getTrackPan(SmushPlayer *player, int idx) const;
+ void updateTrackMixerState(SmushPlayer *player, int idx);
+ void stopStream(int trackIdx);
+ void stopFadeStream(int trackIdx);
+ void queueData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate, Audio::Mixer::SoundType soundType);
+ void queueFadeData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate, Audio::Mixer::SoundType soundType);
ScummEngine_v7 *_vm;
Audio::QueuingAudioStream *_streams[kMaxTracks];
+ Audio::QueuingAudioStream *_fadeStreams[kMaxTracks];
Audio::SoundHandle _handles[kMaxTracks];
+ Audio::SoundHandle _fadeHandles[kMaxTracks];
bool _trackActive[kMaxTracks];
+ bool _fadeTrackActive[kMaxTracks];
+ Audio::Mixer::SoundType _streamTypes[kMaxTracks];
+ Audio::Mixer::SoundType _fadeStreamTypes[kMaxTracks];
int _sampleRate;
};
diff --git a/engines/scumm/insane/rebel2/audio.cpp b/engines/scumm/insane/rebel2/audio.cpp
index 3001e4c4908..bf3b26e9122 100644
--- a/engines/scumm/insane/rebel2/audio.cpp
+++ b/engines/scumm/insane/rebel2/audio.cpp
@@ -20,6 +20,7 @@
*/
#include "common/system.h"
+#include "common/util.h"
#include "scumm/file.h"
#include "scumm/scumm_v7.h"
@@ -175,6 +176,8 @@ void InsaneRebel2::playSfx(int slot, int volume, int pan) {
if (slot < 0 || slot >= kRA2NumSfx || !_sfxData[slot] || _sfxSize[slot] == 0) {
return;
}
+ if (_player && !_player->isChanActive(CHN_OTHER))
+ return;
// Stop any previous instance of this SFX slot
_vm->_mixer->stopHandle(_sfxHandles[slot]);
@@ -190,13 +193,18 @@ void InsaneRebel2::playSfx(int slot, int volume, int pan) {
Audio::SeekableAudioStream *stream = Audio::makeRawStream(
pcmCopy, _sfxSize[slot], 11025, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
- // Scale volume from 0-127 to ScummVM's 0-255 range
- int scaledVolume = (volume * Audio::Mixer::kMaxChannelVolume) / 127;
+ int mixVolume = CLIP(volume, 0, 127);
+ if (_player) {
+ const int baseVolume = (_player->_smushTrackVols[1] * mixVolume) >> 7;
+ mixVolume = (baseVolume * _player->_smushTrackVols[0]) / 127;
+ }
+ const int scaledVolume = (mixVolume * Audio::Mixer::kMaxChannelVolume) / 127;
+ const int clampedPan = CLIP(pan, -127, 127);
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandles[slot],
- stream, -1, scaledVolume, pan);
+ stream, -1, scaledVolume, clampedPan);
- debugC(DEBUG_INSANE, "InsaneRebel2::playSfx: slot=%d vol=%d pan=%d size=%d", slot, volume, pan, _sfxSize[slot]);
+ debugC(DEBUG_INSANE, "InsaneRebel2::playSfx: slot=%d vol=%d pan=%d size=%d", slot, mixVolume, clampedPan, _sfxSize[slot]);
}
// loadAuxSfx -- Load sound data into auxiliary buffer (FUN_004118df).
@@ -222,6 +230,8 @@ void InsaneRebel2::playAuxSfx(int buffer, int volume, int pan) {
if (buffer < 0 || buffer >= kRA2NumAuxSfx || !_auxSfxData[buffer] || _auxSfxSize[buffer] == 0) {
return;
}
+ if (_player && !_player->isChanActive(CHN_OTHER))
+ return;
_vm->_mixer->stopHandle(_auxSfxHandles[buffer]);
@@ -255,12 +265,18 @@ void InsaneRebel2::playAuxSfx(int buffer, int volume, int pan) {
Audio::SeekableAudioStream *stream = Audio::makeRawStream(
pcmCopy, pcmSize, 11025, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
- int scaledVolume = (volume * Audio::Mixer::kMaxChannelVolume) / 127;
+ int mixVolume = CLIP(volume, 0, 127);
+ if (_player) {
+ const int baseVolume = (_player->_smushTrackVols[1] * mixVolume) >> 7;
+ mixVolume = (baseVolume * _player->_smushTrackVols[0]) / 127;
+ }
+ const int scaledVolume = (mixVolume * Audio::Mixer::kMaxChannelVolume) / 127;
+ const int clampedPan = CLIP(pan, -127, 127);
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_auxSfxHandles[buffer],
- stream, -1, scaledVolume, pan);
+ stream, -1, scaledVolume, clampedPan);
- debugC(DEBUG_INSANE, "InsaneRebel2::playAuxSfx: buffer=%d vol=%d pan=%d pcmSize=%d", buffer, volume, pan, pcmSize);
+ debugC(DEBUG_INSANE, "InsaneRebel2::playAuxSfx: buffer=%d vol=%d pan=%d pcmSize=%d", buffer, mixVolume, clampedPan, pcmSize);
}
} // End of namespace Scumm
diff --git a/engines/scumm/insane/rebel2/menu.cpp b/engines/scumm/insane/rebel2/menu.cpp
index ad27d5c391d..7e26e6dd250 100644
--- a/engines/scumm/insane/rebel2/menu.cpp
+++ b/engines/scumm/insane/rebel2/menu.cpp
@@ -45,6 +45,13 @@ namespace Scumm {
// ---------------------------------------------------------------------------
// Emulates retail menu system from FUN_004147B2 and FUN_0041FDC8.
+static void setRebel2MixerVolume(ScummEngine_v7 *vm, int volumeLevel) {
+ const int mixerVolume = CLIP<int>(volumeLevel * 2, 0, (int)Audio::Mixer::kMaxMixerVolume);
+ vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, mixerVolume);
+ vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, mixerVolume);
+ vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, mixerVolume);
+}
+
void InsaneRebel2::resetMenu() {
_menuSelection = 0;
_menuInactivityTimer = 0;
@@ -1891,10 +1898,7 @@ int InsaneRebel2::processOptionsInput() {
// Volume slider: decrease by 4 (original step size)
if (_optionsSelection == 6) {
_optVolumeLevel = MAX(0, _optVolumeLevel - 4);
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType,
- CLIP<int>(_optVolumeLevel * 2, 0, (int)Audio::Mixer::kMaxMixerVolume));
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType,
- CLIP<int>(_optVolumeLevel * 2, 0, (int)Audio::Mixer::kMaxMixerVolume));
+ setRebel2MixerVolume(_vm, _optVolumeLevel);
}
return -1;
@@ -1902,10 +1906,7 @@ int InsaneRebel2::processOptionsInput() {
// Volume slider: increase by 4
if (_optionsSelection == 6) {
_optVolumeLevel = MIN(127, _optVolumeLevel + 4);
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType,
- CLIP<int>(_optVolumeLevel * 2, 0, (int)Audio::Mixer::kMaxMixerVolume));
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType,
- CLIP<int>(_optVolumeLevel * 2, 0, (int)Audio::Mixer::kMaxMixerVolume));
+ setRebel2MixerVolume(_vm, _optVolumeLevel);
}
return -1;
diff --git a/engines/scumm/insane/rebel2/rebel.h b/engines/scumm/insane/rebel2/rebel.h
index 1e26ac3fb71..ca5c902b908 100644
--- a/engines/scumm/insane/rebel2/rebel.h
+++ b/engines/scumm/insane/rebel2/rebel.h
@@ -219,7 +219,7 @@ public:
// Original settings array at DAT_00482e20[0..4]:
// [0]=text, [1]=music, [2]=voices, [3]=sound, [4]=hidden abort flag
// Additional flags: DAT_0047a7fe (controls normal/flipped), DAT_0047a80a (rapid fire)
- // Volume: DAT_0047a804 (0-127), SFX vol: DAT_0047a802 (127-768)
+ // Volume: DAT_0047a804 (0-127), brightness/gamma: DAT_0047a802 (127-768)
void showOptionsMenu();
void drawOptionsOverlay(byte *renderBitmap, int pitch, int width, int height);
diff --git a/engines/scumm/smush/rebel/smush_player_ra2.cpp b/engines/scumm/smush/rebel/smush_player_ra2.cpp
index 1f9e36a6834..163c1923f60 100644
--- a/engines/scumm/smush/rebel/smush_player_ra2.cpp
+++ b/engines/scumm/smush/rebel/smush_player_ra2.cpp
@@ -217,6 +217,7 @@ void SmushPlayerRebel2::ra2InitAudioTrackSizes() {
void SmushPlayerRebel2::initGameVideoState() {
_ra2PendingAnimHeaderPalette = false;
_ra2UsingGameplaySurface = false;
+ _smushAudioTable[100] = 0;
// Re-push the SMUSH palette to the system. Videos like O_LEVEL.SAN
// have no NPAL chunk and inherit the palette from the previous video.
@@ -1308,6 +1309,12 @@ bool SmushPlayerRebel2::handleGameSkipChunk(uint32 subType, int32 subSize, Commo
return true;
}
+ if (subType == MKTAG('P','S','A','D')) {
+ if (!_compressedFileMode && !isFastForwardingCurrentFrame())
+ ra2HandleFrameAudioChunk(subType, subSize, b);
+ return true;
+ }
+
if (subType == MKTAG('X','P','A','L')) {
ra2HandleDeltaPalette(subSize, b);
return true;
@@ -1316,6 +1323,68 @@ bool SmushPlayerRebel2::handleGameSkipChunk(uint32 subType, int32 subSize, Commo
return false;
}
+void SmushPlayerRebel2::ra2HandleFrameAudioChunk(uint32 subType, int32 subSize, Common::SeekableReadStream &b) {
+ if (subSize <= 0)
+ return;
+
+ uint8 *audioChunk = (uint8 *)malloc(subSize + 8);
+ if (!audioChunk) {
+ b.skip(subSize);
+ return;
+ }
+
+ WRITE_BE_UINT32(audioChunk, subType);
+ WRITE_BE_UINT32(audioChunk + 4, subSize);
+ b.read(audioChunk + 8, subSize);
+ ra2FeedAudio(audioChunk, 0, 127, 0, 0);
+ free(audioChunk);
+}
+
+void SmushPlayerRebel2::ra2FeedAudio(uint8 *srcBuf, int groupId, int volume, int pan, int16 flags) {
+ int32 maxFrames;
+ uint16 trkId, index;
+
+ if (!_smushAudioInitialized)
+ return;
+
+ if (srcBuf[8] == 0 && srcBuf[9] == 0 && srcBuf[12] == 0 && srcBuf[13] == 0 && srcBuf[16] == 0 && srcBuf[17] == 0) {
+ trkId = READ_BE_INT16(&srcBuf[10]);
+ index = READ_BE_INT16(&srcBuf[14]);
+ maxFrames = READ_BE_INT16(&srcBuf[18]);
+
+ handleSAUDChunk(
+ srcBuf + 20,
+ READ_BE_UINT32(&srcBuf[4]) - 12,
+ groupId,
+ volume,
+ pan,
+ flags,
+ trkId,
+ index,
+ maxFrames);
+ } else {
+ trkId = READ_LE_INT16(&srcBuf[8]);
+ index = READ_LE_INT16(&srcBuf[10]);
+ maxFrames = READ_LE_INT16(&srcBuf[12]);
+ flags |= READ_LE_INT16(&srcBuf[14]);
+ volume = (volume * srcBuf[16]) >> 7;
+
+ const int panDelta = (int8)srcBuf[17];
+ const int effPan = (panDelta == -128) ? 128 : pan + panDelta;
+
+ handleSAUDChunk(
+ srcBuf + 18,
+ READ_BE_UINT32(&srcBuf[4]) - 10,
+ groupId,
+ volume,
+ effPan,
+ flags,
+ trkId,
+ index,
+ maxFrames);
+ }
+}
+
void SmushPlayerRebel2::handleGameGost(int32 subSize, Common::SeekableReadStream &b) {
ra2HandleGost(subSize, b);
}
diff --git a/engines/scumm/smush/rebel/smush_player_ra2.h b/engines/scumm/smush/rebel/smush_player_ra2.h
index 45a2869db2a..cd5d2351776 100644
--- a/engines/scumm/smush/rebel/smush_player_ra2.h
+++ b/engines/scumm/smush/rebel/smush_player_ra2.h
@@ -81,6 +81,8 @@ private:
int left, int top, int width, int height);
void ra2HandleGost(int32 subSize, Common::SeekableReadStream &b);
void ra2InitAudioTrackSizes();
+ void ra2HandleFrameAudioChunk(uint32 subType, int32 subSize, Common::SeekableReadStream &b);
+ void ra2FeedAudio(uint8 *srcBuf, int groupId, int volume, int pan, int16 flags);
// LOAD chunk streaming buffer (embedded resource data)
byte *_loadBuffer;
Commit: e80d90092b47c1c6162cc8f22fd1b0410ca21afc
https://github.com/scummvm/scummvm/commit/e80d90092b47c1c6162cc8f22fd1b0410ca21afc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-10T16:02:41+02:00
Commit Message:
SCUMM: RA1: apply correct volume setting when changing the volume in-game
Changed paths:
engines/scumm/insane/rebel1/menu.cpp
engines/scumm/insane/rebel1/rebel.cpp
diff --git a/engines/scumm/insane/rebel1/menu.cpp b/engines/scumm/insane/rebel1/menu.cpp
index 6a02456d482..7886ae46923 100644
--- a/engines/scumm/insane/rebel1/menu.cpp
+++ b/engines/scumm/insane/rebel1/menu.cpp
@@ -76,8 +76,10 @@ static int getRebel1MenuAxisDirection(int16 axisValue) {
static void setRebel1Volume(ScummEngine_v7 *vm, int &volume, int delta) {
volume = CLIP<int>(volume + delta, 0, 127);
- vm->_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType,
- (volume * Audio::Mixer::kMaxChannelVolume) / 127);
+ const int mixerVolume = (volume * Audio::Mixer::kMaxChannelVolume) / 127;
+ vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, mixerVolume);
+ vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, mixerVolume);
+ vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, mixerVolume);
ConfMan.setInt("music_volume", (volume * 256) / 127);
ConfMan.setInt("sfx_volume", (volume * 256) / 127);
ConfMan.setInt("speech_volume", (volume * 256) / 127);
diff --git a/engines/scumm/insane/rebel1/rebel.cpp b/engines/scumm/insane/rebel1/rebel.cpp
index b1e67bafc9c..92af6c0367b 100644
--- a/engines/scumm/insane/rebel1/rebel.cpp
+++ b/engines/scumm/insane/rebel1/rebel.cpp
@@ -356,7 +356,7 @@ InsaneRebel1::InsaneRebel1(ScummEngine_v7 *scumm) : Insane(), _vm(scumm) {
_optTextEnabled = ConfMan.getBool("subtitles");
_optControlsYFlip = false;
_optRapidFire = true;
- _optVolume = _vm->_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) * 127 / Audio::Mixer::kMaxChannelVolume;
+ _optVolume = _vm->_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) * 127 / Audio::Mixer::kMaxChannelVolume;
// Default high scores â from DS:0x1D0/0x298/0x2C0
const struct { const char *name; int32 score; byte difficulty; } kDefaultScores[kHighScoreCount] = {
Commit: 1758ffa0f57f8f2a872509b19d0b38a5496678dc
https://github.com/scummvm/scummvm/commit/1758ffa0f57f8f2a872509b19d0b38a5496678dc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-10T16:02:41+02:00
Commit Message:
SCUMM: RA1: added some missing audio code related with chunks and triggers
Changed paths:
engines/scumm/insane/rebel1/audio.cpp
engines/scumm/insane/rebel1/menu.cpp
engines/scumm/insane/rebel1/rebel.cpp
engines/scumm/insane/rebel1/rebel.h
engines/scumm/insane/rebel1/render.cpp
engines/scumm/insane/rebel1/runlevels.cpp
engines/scumm/smush/rebel/smush_player_ra1.cpp
engines/scumm/smush/rebel/smush_player_ra1.h
diff --git a/engines/scumm/insane/rebel1/audio.cpp b/engines/scumm/insane/rebel1/audio.cpp
index 64cc5e095f2..95643e67f17 100644
--- a/engines/scumm/insane/rebel1/audio.cpp
+++ b/engines/scumm/insane/rebel1/audio.cpp
@@ -67,6 +67,18 @@ void InsaneRebel1::processAudioFrame(int16 feedSize) {
_audio.processFrame(_player, feedSize);
}
+void InsaneRebel1::applyAudioOptions() {
+ _vm->_mixer->muteSoundType(Audio::Mixer::kMusicSoundType, !_optMusicEnabled);
+ _vm->_mixer->muteSoundType(Audio::Mixer::kSFXSoundType, !_optSfxEnabled);
+ _vm->_mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, !_optSfxEnabled);
+
+ if (_player) {
+ _player->setChanFlag(CHN_BKGMUS, _optMusicEnabled ? 1 : 0);
+ _player->setChanFlag(CHN_OTHER, _optSfxEnabled ? 1 : 0);
+ _player->setChanFlag(CHN_SPEECH, _optSfxEnabled ? 1 : 0);
+ }
+}
+
void InsaneRebel1::loadSfx() {
for (int i = 0; i < kNumSfx; i++) {
if (_sfxData[i] || _sfxSize[i] != 0)
@@ -133,6 +145,13 @@ void InsaneRebel1::freeSfx() {
}
}
+void InsaneRebel1::stopSfx(int slot) {
+ if (slot < 0 || slot >= kNumSfx)
+ return;
+
+ _vm->_mixer->stopHandle(_sfxHandles[slot]);
+}
+
void InsaneRebel1::playSfx(int slot, int volume, int pan) {
if (slot < 0 || slot >= kNumSfx || !_sfxData[slot] || _sfxSize[slot] == 0)
return;
diff --git a/engines/scumm/insane/rebel1/menu.cpp b/engines/scumm/insane/rebel1/menu.cpp
index 7886ae46923..560cf226793 100644
--- a/engines/scumm/insane/rebel1/menu.cpp
+++ b/engines/scumm/insane/rebel1/menu.cpp
@@ -1359,12 +1359,11 @@ void InsaneRebel1::runOptionsMenu() {
break;
case 2: // Toggle music
_optMusicEnabled = !_optMusicEnabled;
- _vm->_mixer->muteSoundType(Audio::Mixer::kMusicSoundType, !_optMusicEnabled);
+ applyAudioOptions();
break;
case 3: // Toggle SFX + Voice
_optSfxEnabled = !_optSfxEnabled;
- _vm->_mixer->muteSoundType(Audio::Mixer::kSFXSoundType, !_optSfxEnabled);
- _vm->_mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, !_optSfxEnabled);
+ applyAudioOptions();
break;
case 4: // Toggle dialogue text
_optTextEnabled = !ConfMan.getBool("subtitles");
diff --git a/engines/scumm/insane/rebel1/rebel.cpp b/engines/scumm/insane/rebel1/rebel.cpp
index 92af6c0367b..9c3bd5fe5b1 100644
--- a/engines/scumm/insane/rebel1/rebel.cpp
+++ b/engines/scumm/insane/rebel1/rebel.cpp
@@ -349,7 +349,8 @@ InsaneRebel1::InsaneRebel1(ScummEngine_v7 *scumm) : Insane(), _vm(scumm) {
// Options â read initial state from ScummVM mixer
_optRookieOneFemale = false;
_optMusicEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kMusicSoundType);
- _optSfxEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kSFXSoundType);
+ _optSfxEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kSFXSoundType) &&
+ !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kSpeechSoundType);
// Initialize the dialogue-text (subtitles) toggle from ScummVM's global setting so the
// game and the in-game DIALOGUE TEXT menu label reflect it. The menu toggle writes the
// same "subtitles" key, and ra1HandleText() gates rendering on it.
diff --git a/engines/scumm/insane/rebel1/rebel.h b/engines/scumm/insane/rebel1/rebel.h
index 71138104d32..00976d5143c 100644
--- a/engines/scumm/insane/rebel1/rebel.h
+++ b/engines/scumm/insane/rebel1/rebel.h
@@ -291,6 +291,8 @@ private:
void loadSfx();
void freeSfx();
void playSfx(int slot, int volume, int pan);
+ void stopSfx(int slot);
+ void applyAudioOptions();
void queueAudioData(int trackIdx, uint8 *data, int32 size, int volume, int pan);
public:
void drawFontBankString(byte *dst, int pitch, int width, int height, int x, int y, const char *text);
diff --git a/engines/scumm/insane/rebel1/render.cpp b/engines/scumm/insane/rebel1/render.cpp
index a485368963a..c8d62911ad7 100644
--- a/engines/scumm/insane/rebel1/render.cpp
+++ b/engines/scumm/insane/rebel1/render.cpp
@@ -907,6 +907,12 @@ void InsaneRebel1::renderTargeting(byte *dst, int pitch, int width, int height)
const RA1SpriteBank &markerBank = (_techFontBank.numSprites > 0) ? _techFontBank : _hudFontBank;
const int overlayX = ra1GameplayWindowOffsetX(this);
const int overlayY = ra1GameplayWindowOffsetY(this);
+
+ if (_targetProximity > 0 && _prevTargetProx == 0)
+ playSfx(kSfxLockOn, 127, 0);
+ else if (_targetProximity == 0 && _prevTargetProx != 0)
+ stopSfx(kSfxLockOn);
+
if (markerBank.numSprites > 0) {
// FUN_1CB22 can switch marker sets via DAT_75FF bit 1.
// Baseline RA1 targeting uses '^' and animation e..h.
@@ -1771,6 +1777,7 @@ void InsaneRebel1::renderHUD(byte *dst, int pitch, int width, int height) {
// Extra life bonus: every 10,000 points (FUN_1BBCB lines 11-27)
if (_score / 10000 > _prevScore / 10000) {
_lives++;
+ playSfx(kSfxBonus, 127, 0);
}
_prevScore = _score;
@@ -1897,6 +1904,8 @@ void InsaneRebel1::renderHUD(byte *dst, int pitch, int width, int height) {
// FUN_1BBCB pushes string pointers 0x671b ("<<[") or 0x671f ("<<\\") into FUN_221B7.
const char *warningStr = aboveCritical ? "<<[" : "<<\\";
drawFontBankString(dst, pitch, width, height, hudX + 0x49, hudY + 0x07, warningStr);
+ if (!aboveCritical && ((_frameCounter & 0x7) == 0))
+ playSfx(kSfxKlaxon, 127, 0);
}
}
diff --git a/engines/scumm/insane/rebel1/runlevels.cpp b/engines/scumm/insane/rebel1/runlevels.cpp
index b4bc7849507..14e58c258bb 100644
--- a/engines/scumm/insane/rebel1/runlevels.cpp
+++ b/engines/scumm/insane/rebel1/runlevels.cpp
@@ -160,6 +160,7 @@ void InsaneRebel1::playCinematic(const char *filename, int32 startFrame) {
// passive-cinematic audio before chaining the next ANM.
_audio.reset();
splayer->resetAudioTracks();
+ applyAudioOptions();
_interactiveVideoActive = false;
_vm->_smushVideoShouldFinish = false;
splayer->setCurVideoFlags(0x420);
@@ -1701,6 +1702,7 @@ void InsaneRebel1::setupInteractiveVideoState(int32 startFrame) {
SmushPlayer *splayer = _vm->_splayer;
_player = splayer;
+ applyAudioOptions();
restoreScreenFlashPalette();
if (!preserveRuntimeState)
clearBit(0);
diff --git a/engines/scumm/smush/rebel/smush_player_ra1.cpp b/engines/scumm/smush/rebel/smush_player_ra1.cpp
index 8a9fc94d781..43f4d65e882 100644
--- a/engines/scumm/smush/rebel/smush_player_ra1.cpp
+++ b/engines/scumm/smush/rebel/smush_player_ra1.cpp
@@ -765,20 +765,85 @@ static bool ra1ScanFrameGameChunks(Common::SeekableReadStream &b, int32 frameSiz
return hasGameChunk;
}
-void SmushPlayerRebel1::ra1HandleFrameAudioChunk(int32 subSize, Common::SeekableReadStream &b) {
+static int16 getRA1AudioChunkTypeFlags(uint32 subType) {
+ switch (subType) {
+ case MKTAG('P','V','O','C'):
+ return IS_SPEECH;
+ case MKTAG('P','S','A','D'):
+ return IS_BKG_MUSIC;
+ case MKTAG('P','S','D','2'):
+ case MKTAG('S','A','U','D'):
+ default:
+ return IS_SFX;
+ }
+}
+
+void SmushPlayerRebel1::ra1HandleFrameAudioChunk(uint32 subType, int32 subSize, Common::SeekableReadStream &b) {
if (_compressedFileMode || isFastForwardingCurrentFrame())
return;
+ if (subSize <= 0)
+ return;
uint8 *audioChunk = (uint8 *)malloc(subSize + 8);
if (audioChunk == nullptr)
return;
- b.seek(-8, SEEK_CUR);
- b.read(audioChunk, subSize + 8);
- feedAudio(audioChunk, 0, 127, 0, 0);
+ WRITE_BE_UINT32(audioChunk, subType);
+ WRITE_BE_UINT32(audioChunk + 4, subSize);
+ b.read(audioChunk + 8, subSize);
+ ra1FeedAudio(subType, audioChunk, 0, 127, 0, 0);
free(audioChunk);
}
+void SmushPlayerRebel1::ra1FeedAudio(uint32 subType, uint8 *srcBuf, int groupId, int volume, int pan, int16 flags) {
+ if (!_smushAudioInitialized)
+ return;
+
+ const uint32 chunkSize = READ_BE_UINT32(&srcBuf[4]);
+ const int16 typeFlags = getRA1AudioChunkTypeFlags(subType);
+
+ if (chunkSize >= 12 &&
+ srcBuf[8] == 0 && srcBuf[9] == 0 && srcBuf[12] == 0 &&
+ srcBuf[13] == 0 && srcBuf[16] == 0 && srcBuf[17] == 0) {
+ const uint16 trkId = READ_BE_INT16(&srcBuf[10]);
+ const uint16 index = READ_BE_INT16(&srcBuf[14]);
+ const int32 maxFrames = READ_BE_INT16(&srcBuf[18]);
+ flags = (flags & ~TRK_TYPE_MASK) | typeFlags;
+
+ handleSAUDChunk(
+ srcBuf + 20,
+ chunkSize - 12,
+ groupId,
+ volume,
+ pan,
+ flags,
+ trkId,
+ index,
+ maxFrames);
+ } else if (chunkSize >= 10) {
+ const uint16 trkId = READ_LE_INT16(&srcBuf[8]);
+ const uint16 index = READ_LE_INT16(&srcBuf[10]);
+ const int32 maxFrames = READ_LE_INT16(&srcBuf[12]);
+ flags |= READ_LE_INT16(&srcBuf[14]);
+ flags = (flags & ~TRK_TYPE_MASK) | typeFlags;
+ volume = (volume * srcBuf[16]) >> 7;
+
+ const int panDelta = (int8)srcBuf[17];
+ const int effPan = (panDelta == -128) ? 128 : pan + panDelta;
+
+ handleSAUDChunk(
+ srcBuf + 18,
+ chunkSize - 10,
+ groupId,
+ volume,
+ effPan,
+ flags,
+ trkId,
+ index,
+ maxFrames);
+ }
+}
+
void SmushPlayerRebel1::ra1HandleGameFrameChunk(int32 subSize, Common::SeekableReadStream &b, bool fastForwarding) {
if (!fastForwarding && _insane) {
InsaneRebel1 *rebel1 = (InsaneRebel1 *)_insane;
@@ -837,7 +902,7 @@ void SmushPlayerRebel1::ra1HandleObjOverlayFrameChunk(int32 objDataSize, Common:
if (audioBuf == nullptr)
break;
memcpy(audioBuf, objBuf + objPos, embSize + 8);
- feedAudio(audioBuf, 0, 127, 0, 0);
+ ra1FeedAudio(embTag, audioBuf, 0, 127, 0, 0);
free(audioBuf);
}
}
@@ -878,11 +943,11 @@ bool SmushPlayerRebel1::ra1DispatchFrameChunk(uint32 subType, int32 subSize, int
break;
case MKTAG('P','S','A','D'):
case MKTAG('P','V','O','C'):
- ra1HandleFrameAudioChunk(subSize, b);
+ ra1HandleFrameAudioChunk(subType, subSize, b);
break;
case MKTAG('P','S','D','2'):
if (_ra1LastFrameObjectVisible)
- ra1HandleFrameAudioChunk(subSize, b);
+ ra1HandleFrameAudioChunk(subType, subSize, b);
break;
case MKTAG('T','R','E','S'):
case MKTAG('T','E','X','T'):
diff --git a/engines/scumm/smush/rebel/smush_player_ra1.h b/engines/scumm/smush/rebel/smush_player_ra1.h
index 65570b04539..e5ea0da7095 100644
--- a/engines/scumm/smush/rebel/smush_player_ra1.h
+++ b/engines/scumm/smush/rebel/smush_player_ra1.h
@@ -65,7 +65,8 @@ private:
void ra1HandleFade(int32 subSize, Common::SeekableReadStream &b);
SmushFont *ra1GetFont(int font);
void ra1HandleText(int32 subSize, Common::SeekableReadStream &b);
- void ra1HandleFrameAudioChunk(int32 subSize, Common::SeekableReadStream &b);
+ void ra1HandleFrameAudioChunk(uint32 subType, int32 subSize, Common::SeekableReadStream &b);
+ void ra1FeedAudio(uint32 subType, uint8 *srcBuf, int groupId, int volume, int pan, int16 flags);
void ra1HandleGameFrameChunk(int32 subSize, Common::SeekableReadStream &b, bool fastForwarding);
void ra1HandleObjOverlayFrameChunk(int32 objDataSize, Common::SeekableReadStream &b, bool fastForwarding);
bool ra1HandleUnknownFrameChunk(uint32 subType, int32 subSize);
Commit: 00eb162fb89b7d0ea43318735127b7840c452c4e
https://github.com/scummvm/scummvm/commit/00eb162fb89b7d0ea43318735127b7840c452c4e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-10T16:02:41+02:00
Commit Message:
SCUMM: RA: normalize comments to avoid redunancies or incoherent wording
Changed paths:
engines/scumm/insane/rebel1/iact.cpp
engines/scumm/insane/rebel1/menu.cpp
engines/scumm/insane/rebel1/rebel.cpp
engines/scumm/insane/rebel1/rebel.h
engines/scumm/insane/rebel1/render.cpp
engines/scumm/insane/rebel1/runlevels.cpp
engines/scumm/insane/rebel2/iact.cpp
engines/scumm/insane/rebel2/levels.cpp
engines/scumm/insane/rebel2/menu.cpp
engines/scumm/insane/rebel2/rebel.cpp
engines/scumm/insane/rebel2/rebel.h
engines/scumm/insane/rebel2/render.cpp
engines/scumm/smush/rebel/smush_player_ra1.cpp
engines/scumm/smush/rebel/smush_player_ra2.cpp
diff --git a/engines/scumm/insane/rebel1/iact.cpp b/engines/scumm/insane/rebel1/iact.cpp
index 16fb90cce40..0c34182fe5a 100644
--- a/engines/scumm/insane/rebel1/iact.cpp
+++ b/engines/scumm/insane/rebel1/iact.cpp
@@ -736,7 +736,7 @@ void InsaneRebel1::checkDynamicLevelBranch(int32 curFrame) {
return;
const uint32 routeFrame = (uint32)curFrame;
// GAME 0x09 publishes its branch-tested position in g_shipPosX.
- // ScummVM keeps the drawn ship center and the 0x09 aim cursor split,
+ // Keep the drawn ship center and the 0x09 aim cursor split,
// so compare the effective gameplay cursor here.
const int16 branchX = getGameplayCursorX();
const int route = CLIP<int>(_levelRouteIndex, 0, 5);
@@ -860,7 +860,7 @@ void InsaneRebel1::updateFlightVariantCursor() {
// Assembly-verified 0x09 layout:
// ship sprite center = (_74B6 + _74BA, _74B8 + _74BC)
// cursor center = (_74BE, _74C0)
- // In ScummVM the flight sprite center already lives in _shipPos.
+ // The flight sprite center already lives in _shipPos.
const int16 shipBaseX = _shipPosX;
const int16 shipBaseY = _shipPosY;
const int32 liftTerm = (int32)_liftSmooth - 0x0F;
@@ -874,7 +874,7 @@ void InsaneRebel1::updateFlightVariantCursor() {
}
// preprocessMouseAxes â FUN_231BE (0x231BE) centered-axis output law, adapted to
-// ScummVM's absolute 320x200 mouse space. The old DOS virtual-mouse/recenter
+// the absolute 320x200 mouse space. The old DOS virtual-mouse/recenter
// control path is intentionally not used. For opcode 0x0B, gamepad input uses
// the 3DO standard-pad reticle model: axis samples move the reticle, and
// releasing the pad holds the last reticle position.
@@ -1104,7 +1104,7 @@ void InsaneRebel1::updateShipPhysics() {
inputSourceName = "joystick-dpad";
// --- Step 2: Roll accumulator (_74CA) ---
- // Normal mode: accumulate. For ScummVM's absolute mouse in flight handlers,
+ // Normal mode: accumulate. For absolute mouse input in flight handlers,
// steer toward a bounded roll target so holding the cursor off center does
// not continue accelerating the ship until it clamps.
if ((effectiveOpcode == 0x07 || effectiveOpcode == 0x09) &&
@@ -1341,7 +1341,7 @@ void InsaneRebel1::getCollisionShipCenter(int16 &x, int16 &y) const {
// Original 0x0D/0x0E collision compares script zones transformed by
// FUN_223FE against the gameplay-window ship center (base center +
// g_shipOffset). This is DOS screen space; render overlays add the viewport
- // offset separately when drawing into ScummVM's larger source buffer.
+ // offset separately when drawing into the larger source buffer.
//
// In Level 1 part 2, HandleGameOp0A_TurretVariant reuses _shipPos for the
// targeting cursor, so collision must read the movement accumulator instead.
@@ -1435,7 +1435,7 @@ void InsaneRebel1::updateTurretPhysics() {
const int16 rawInputY = inputY;
if (usedJoystick && _flyControlMode == 2) {
- // ScummVM-only concession for Level 1 part 2. The original 0x08 handler
+ // Extra concession for Level 1 part 2. The original 0x08 handler
// uses raw axes directly; do not damp Level 13's surface controls.
inputX /= 2;
inputY /= 2;
@@ -1876,7 +1876,7 @@ bool InsaneRebel1::isTorpedoModeActive() const {
}
-// ScummVM-side splits for the original on-foot GAME handlers:
+// Helper splits for the original on-foot GAME handlers:
// HandleGameOp19_OnFootSequence (0x19) and HandleGameOp1A_OnFootVariant (0x1A).
// On-foot handler for Level 9 (Stormtroopers). Character walks left/right, crosshair tracks mouse.
//
@@ -2055,7 +2055,7 @@ void InsaneRebel1::updateOnFootSequence() {
// this implementation; the original code dispatches the opcode handler directly.
void InsaneRebel1::updateOnFootAimVariant() {
// --- 0x1A: Crosshair positioning (HandleGameOp1A_OnFootVariant) ---
- // DOS used virtual-mouse axes relative to the character offset. ScummVM's
+ // DOS used virtual-mouse axes relative to the character offset. The
// mouse and gamepad reticle are screen-space controls so the cursor remains
// able to cross the whole playfield while Luke is standing at either side.
int16 inputX = 0, inputY = 0;
diff --git a/engines/scumm/insane/rebel1/menu.cpp b/engines/scumm/insane/rebel1/menu.cpp
index 560cf226793..60fc7bdd138 100644
--- a/engines/scumm/insane/rebel1/menu.cpp
+++ b/engines/scumm/insane/rebel1/menu.cpp
@@ -46,7 +46,7 @@ const int kRA1MenuFrameH = 0x0f;
const int kRA1MenuRowH = 0x0f;
const byte kRA1MenuFrameColor = 0xdf;
// Highlight-frame geometry shared by the render*Overlay drawing and the mouse hit-testing
-// (clicking menu items is a ScummVM-exclusive feature, so the rects must stay in sync).
+// (clicking menu items is an extra feature, so the rects must stay in sync).
const int kRA1MainMenuFrameYBase = 0x2c; // frame Y = (item + 1) * kRA1MenuRowH + this
const int kRA1OptionsFrameYBase = 0x1d; // frame Y = (item + 1) * kRA1MenuRowH + this
const int kRA1LevelSelectFrameYBase = 0x2c; // frame Y = row * kRA1MenuRowH + this
@@ -613,7 +613,7 @@ void InsaneRebel1::openGameplayMainMenu() {
_player->unpause();
}
-// ScummVM-exclusive feature (not in the original game): let the player navigate and
+// Extra feature, not in the original game: let the player navigate and
// activate the front-end menus with the mouse. Hovering highlights an item and a left
// click activates it (same as pressing accept). The item hit-rectangles mirror the
// highlight frames drawn by the render*Overlay() functions, so they share the
@@ -679,7 +679,7 @@ bool InsaneRebel1::handleMenuMouse(const Common::Event &event) {
}
bool InsaneRebel1::notifyEvent(const Common::Event &event) {
- // Global ScummVM dialogs pause the engine while their modal event loop runs.
+ // Global dialogs pause the engine while their modal event loop runs.
// Do not consume those mouse/key events as RA1 gameplay/menu input, or the
// dialog buttons cannot receive clicks while an interactive video is active.
if (_vm->isPaused())
@@ -741,7 +741,7 @@ bool InsaneRebel1::notifyEvent(const Common::Event &event) {
event.type == Common::EVENT_LBUTTONDOWN)
_activeInputSource = kInputSourceMouse;
- // ScummVM-exclusive feature: mouse navigation/clicking of the RA1 front-end menus.
+ // Extra feature: mouse navigation/clicking of the RA1 front-end menus.
if (handleMenuMouse(event))
return true;
@@ -1075,7 +1075,7 @@ void InsaneRebel1::renderOptionsOverlay(byte *dst, int pitch, int width, int hei
}
void InsaneRebel1::renderLevelSelectOverlay(byte *dst, int pitch, int width, int height) {
- // --- ScummVM level select submenu, styled like the original frontend menus ---
+ // --- Extra level select submenu, styled like the original frontend menus ---
const int titleW = getFontBankStringWidth("LEVEL SELECT");
drawMenuTitleText(dst, pitch, width, height, getRebel1MenuCenteredX(titleW), 15, "LEVEL SELECT");
@@ -1167,7 +1167,7 @@ void InsaneRebel1::renderMainMenuItems(byte *dst, int pitch, int width, int heig
void InsaneRebel1::renderMainMenuOverlay(byte *dst, int pitch, int width, int height) {
_menuFrameCounter++;
- // ScummVM-exclusive feature: the menus are mouse-clickable, so keep the default
+ // The menus are mouse-clickable, so keep the default
// arrow cursor visible. SmushPlayer::play() hides the system cursor for the whole
// video (and re-hides it every video), so re-assert visibility each rendered frame
// while a menu overlay is on screen. The arrow bitmap/palette is set in
@@ -1233,7 +1233,7 @@ void InsaneRebel1::playMenuBackground() {
_menuActive = true;
_menuConfirmed = false;
_menuFrameCounter = 0;
- // Show ScummVM's built-in arrow pointer for the (mouse-clickable) menus. Set it once
+ // Show the built-in arrow pointer for the mouse-clickable menus. Set it once
// here; renderMainMenuOverlay() re-asserts showMouse() each frame because the SMUSH
// player forces the cursor off while a video plays. disableCursorPalette(false) ensures
// the arrow's own CLUT palette is used rather than the game palette.
diff --git a/engines/scumm/insane/rebel1/rebel.cpp b/engines/scumm/insane/rebel1/rebel.cpp
index 9c3bd5fe5b1..6a2ce686fb6 100644
--- a/engines/scumm/insane/rebel1/rebel.cpp
+++ b/engines/scumm/insane/rebel1/rebel.cpp
@@ -346,12 +346,12 @@ InsaneRebel1::InsaneRebel1(ScummEngine_v7 *scumm) : Insane(), _vm(scumm) {
_levelSelectSel = 0;
_startLevel = 1;
- // Options â read initial state from ScummVM mixer
+ // Options: read initial state from the mixer.
_optRookieOneFemale = false;
_optMusicEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kMusicSoundType);
_optSfxEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kSFXSoundType) &&
!_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kSpeechSoundType);
- // Initialize the dialogue-text (subtitles) toggle from ScummVM's global setting so the
+ // Initialize the dialogue-text (subtitles) toggle from the global setting so the
// game and the in-game DIALOGUE TEXT menu label reflect it. The menu toggle writes the
// same "subtitles" key, and ra1HandleText() gates rendering on it.
_optTextEnabled = ConfMan.getBool("subtitles");
diff --git a/engines/scumm/insane/rebel1/rebel.h b/engines/scumm/insane/rebel1/rebel.h
index 00976d5143c..8a17aae30e8 100644
--- a/engines/scumm/insane/rebel1/rebel.h
+++ b/engines/scumm/insane/rebel1/rebel.h
@@ -460,7 +460,7 @@ private:
int _difficulty;
// Per-difficulty tuning (from assault_data_3.bin, indexed: difficulty * 0x28B + level * 0x1F)
- // Original game loads from C:\rebltune.txt; ScummVM uses hardcoded table.
+ // Original game loads from C:\rebltune.txt; use a hardcoded table.
// 21 sub-levels (1A,1B,2,3,4A,4B,5A,5B,6,7,8,9A,9B,10,11,12,13,14A,14B,15A,15B)
struct TuningParams {
int16 roll; // +0x05: horizontal speed/sensitivity
@@ -503,8 +503,8 @@ private:
byte _hudRenderFlag; // 0x7600: 0xFF when HUD should render (set by combat mode handlers)
byte _hudDirtyFlag; // 0x7601: 0xFF after HUD redraw (set by renderHUD)
int16 _maxChapterUnlocked; // 0x7730: highest unlocked passcode slot (0=none)
- bool _unlockAllLevels; // ScummVM option: expose level select without passcodes
- bool _noDamage; // ScummVM option: suppress player damage
+ bool _unlockAllLevels; // Option: expose level select without passcodes
+ bool _noDamage; // Option: suppress player damage
static const int16 kMaxHealth = 98;
static const int16 kDeathTimerInit = 30;
@@ -565,7 +565,7 @@ private:
bool handleMenuCommand(RA1MenuCommand command);
bool handleControllerMenuAction(ScummAction action);
bool handleControllerMenuAxis(int16 oldAxisX, int16 oldAxisY);
- // ScummVM-exclusive feature: navigate/click the menus with the mouse.
+ // Extra feature: navigate/click the menus with the mouse.
bool handleMenuMouse(const Common::Event &event);
bool handleTextEntryAction(ScummAction action);
bool handleTextEntryKey(const Common::Event &event);
@@ -597,7 +597,7 @@ private:
bool _optSfxEnabled; // DAT_22b8: sfx+voice on/off
bool _optTextEnabled; // DAT_22b9: dialogue text on/off
bool _optControlsYFlip; // DAT_22be: Y-axis inversion
- bool _optRapidFire; // ScummVM option: held fire keeps shooting
+ bool _optRapidFire; // Option: held fire keeps shooting
int _optVolume; // DAT_22c1: master volume 0..127
// High scores / TOP PILOTS display â data at DS:0x1D0
diff --git a/engines/scumm/insane/rebel1/render.cpp b/engines/scumm/insane/rebel1/render.cpp
index c8d62911ad7..8e031771cbf 100644
--- a/engines/scumm/insane/rebel1/render.cpp
+++ b/engines/scumm/insane/rebel1/render.cpp
@@ -47,8 +47,8 @@ int ra1GameplayWindowOffsetX(const InsaneRebel1 *rebel1) {
if (!rebel1 || !rebel1->isInteractiveVideoActive())
return 0;
- // Ship/cursor/shot coordinates are in DOS's 320x200 gameplay window. Under
- // ScummVM's FUN_224FD crop emulation, shift them into the 384x242 source
+ // Ship/cursor/shot coordinates are in DOS's 320x200 gameplay window.
+ // FUN_224FD crop emulation shifts them into the 384x242 source
// buffer so the final source-window crop presents them at the same screen
// position DOS used for gameplay and collision.
switch (rebel1->getEffectiveGameOpcode()) {
@@ -453,7 +453,7 @@ void renderSpriteWithFlags(byte *dst, int pitch, int width, int height,
}
}
-// ScummVM-side helper only: the original keeps this shot-sprite math inline in
+// Helper only: the original keeps this shot-sprite math inline in
// several GAME handlers. It is collapsed here because the direction/lerp/render
// sequence is identical for one-beam shot sprites.
void renderAimedShotSprite(byte *dst, int pitch, int width, int height,
@@ -481,7 +481,7 @@ void renderAimedShotPair(byte *dst, int pitch, int width, int height,
start2X, start2Y, targetX, targetY, lerp);
}
-// ScummVM-side helper for the 0x0B fallback edge-beam path. The original keeps
+// Helper for the 0x0B fallback edge-beam path. The original keeps
// the bucket lookup inline with the renderer, but both left/right beams share it.
void renderBucketedShotSprite(byte *dst, int pitch, int width, int height,
const RA1SpriteBank &laserBank, int startX, int startY, int targetX, int targetY,
@@ -672,7 +672,7 @@ void InsaneRebel1::procPostRendering(byte *renderBitmap, int32 codecparam, int32
shotOverlayHandled = true;
if (_health >= 0) {
// HandleGameOp5A_ObjectOrSceneTrigger can snap g_shipPos to the
- // target center before the shot overlay runs. The ScummVM player
+ // target center before the shot overlay runs. The player
// defers GAME 0x1A until after FOBJ dispatch, so preserve that
// snap instead of immediately replacing it with raw input again.
const bool preserveTargetSnap = (_targetProximity == 2 && _tuning.snap > 0);
@@ -834,7 +834,7 @@ void InsaneRebel1::procPostRendering(byte *renderBitmap, int32 codecparam, int32
_fireCooldown = _playerFired ? 1 : 0;
}
-// ScummVM helper that groups the common shot/lock overlay calls used by the
+// Helper that groups the common shot/lock overlay calls used by the
// original GAME handlers. GAME 0x1A uses the same pipeline without the target
// box draw; 0x09/0x0A/0x0B include DrawTargetIndicators first. GAME 0x0B
// defers FUN_1CB22 targeting until post-render so FTCH can restore cockpit
@@ -959,7 +959,7 @@ void InsaneRebel1::renderTargeting(byte *dst, int pitch, int width, int height)
// handleLevel14Play2BSplice â RunLevel14Flow (0x1ACD1) queues L14PLY2B.ANM
// from inside the L14PLAY2 loop when the current clip reaches maxFrame - 0x0F.
-// This helper is a ScummVM-side extraction; the original keeps the PlayAnmFile
+// This helper is an implementation extraction; the original keeps the PlayAnmFile
// call inline and passes the old L14PLAY2 timeline frame to the ANM frame gate.
void InsaneRebel1::handleLevel14Play2BSplice(int32 curFrame, int32 maxFrame) {
if (_currentLevel != 13 || _levelGameplayPhase != 2 || _level14Play2BSpliced ||
@@ -1505,7 +1505,7 @@ void InsaneRebel1::beginChapterSummaryOverlay(int revealOffsetFromEnd, int stopO
}
}
-// ScummVM keeps the passcodes in clear text. The DOS table is XOR-0xAA
+// Passcodes are kept in clear text. The DOS table is XOR-0xAA
// encoded in 15 20-byte slots at DS:0x00A4.
static const char *const kChapterCompletePasswords[] = {
"FALCON", "BIGGS", "ACKBAR", "ANOAT", "KAIBURR",
@@ -1521,7 +1521,7 @@ const char *InsaneRebel1::getChapterCompletePassword(int passwordIndex) const {
}
// drawChapterSummaryOverlay â RunChapterCompleteSummaryScreen (0x15E42), shared by
-// the RA1 runlevel flows that call it. This helper is a ScummVM-side extraction;
+// the RA1 runlevel flows that call it. This helper is an implementation extraction;
// the original pumps frontend frames from the runlevel after queueing the END ANM.
void InsaneRebel1::drawChapterSummaryOverlay(byte *dst, int pitch, int width, int height,
int32 curFrame, int32 maxFrame) {
diff --git a/engines/scumm/insane/rebel1/runlevels.cpp b/engines/scumm/insane/rebel1/runlevels.cpp
index 14e58c258bb..f9e5fecdd56 100644
--- a/engines/scumm/insane/rebel1/runlevels.cpp
+++ b/engines/scumm/insane/rebel1/runlevels.cpp
@@ -156,7 +156,7 @@ void InsaneRebel1::playCinematic(const char *filename, int32 startFrame) {
_player = splayer;
restoreScreenFlashPalette();
// DOS PlayFrontendAnmAndWait keeps pumping until frontend audio clears.
- // ScummVM's Rebel queues outlive SmushPlayer::play(), so clear stale
+ // Rebel queues outlive SmushPlayer::play(), so clear stale
// passive-cinematic audio before chaining the next ANM.
_audio.reset();
splayer->resetAudioTracks();
@@ -795,7 +795,7 @@ bool InsaneRebel1::runLevel7() {
routeSourceFrame = _pendingRouteStartFrame;
routeVideoStartFrame = _pendingRouteVideoStartFrame;
// DOS does not seek the destination route ANM here. The ANM-local
- // decision frame is used by the playback gate/cutoff; ScummVM
+ // decision frame is used by the playback gate/cutoff; this implementation
// starts at the already-advanced gate target after the cutover.
routeStartFrame = 0;
}
@@ -890,7 +890,7 @@ bool InsaneRebel1::runLevel8() {
}
// RunLevel8Flow keeps pumping the active route while the walker
- // shield register is nonzero. ScummVM's blocking SMUSH play returns
+ // shield register is nonzero. Blocking SMUSH play returns
// when one route pass ends, so explicitly replay that route and
// preserve the accumulated walker damage.
debugC(DEBUG_INSANE, "L8 replaying route=%d walkerHealth=%d killCount=%d",
@@ -927,7 +927,7 @@ bool InsaneRebel1::runLevel8() {
bool InsaneRebel1::runLevel9() {
// DOS RunLevel9Flow calls RandScaleByte(2) three times before the intro.
// That helper advances a byte seed with seed = seed * 9 + 0x35 and returns
- // (2 * seed) >> 8. Do not use ScummVM's session RNG here: it can turn the
+ // (2 * seed) >> 8. Do not use the session RNG here: it can turn the
// original right-side route into the capture/restart branch.
uint8 originalRouteSeed = 0;
auto getOriginalRouteBit = [&originalRouteSeed]() {
@@ -1629,7 +1629,7 @@ void InsaneRebel1::runGame() {
break;
}
case 4: {
- // Level Select â ScummVM-only start point. Continue through the
+ // Level Select: extra start point. Continue through the
// original successor flow so post-level cinematics still play.
int selectedLevel = runLevelSelectMenu();
if (selectedLevel >= 1 && selectedLevel <= numLevels)
@@ -1731,7 +1731,7 @@ void InsaneRebel1::resolveSeek(const char *filename, int32 startFrame, int32 &vi
if (_currentLevel == 6 && level7RouteSplice) {
// DOS opens the route ANM from the beginning, then the armed frame gate
- // suppresses until the adjusted target. With ScummVM's delayed cutover,
+ // suppresses until the adjusted target. With the delayed cutover,
// the destination must advance by the source tail already displayed.
videoStartFrame = (_pendingRouteVideoStartFrame > 0) ?
_pendingRouteVideoStartFrame : 1;
diff --git a/engines/scumm/insane/rebel2/iact.cpp b/engines/scumm/insane/rebel2/iact.cpp
index b640ad26023..a322e039bd1 100644
--- a/engines/scumm/insane/rebel2/iact.cpp
+++ b/engines/scumm/insane/rebel2/iact.cpp
@@ -588,7 +588,7 @@ void InsaneRebel2::iactRebel2Opcode3(Common::SeekableReadStream &b, int16 par2,
}
}
-// ScummVM refactor helper for opcode 6, not a separate retail function.
+// Helper split out of FUN_004033CF case 6; not a separate original function.
void InsaneRebel2::updateOpcode6Handler(int16 par2) {
// Update handler type if par2 is a known handler value (from FUN_4033CF case 6).
if (par2 == 7 || par2 == 8 || par2 == 0x19 || par2 == 0x26) {
@@ -601,7 +601,7 @@ void InsaneRebel2::updateOpcode6Handler(int16 par2) {
}
}
-// ScummVM refactor helper for opcode 6 Handler 8, not a separate retail function.
+// Helper split out of FUN_00401234 case 4; not a separate original function.
void InsaneRebel2::handleOpcode6Handler8(Common::SeekableReadStream &b, int16 par4) {
// Handler 8 specific logic (third-person on foot) - FUN_00401234 case 4.
// DAT_0043e000 = local_14[3], which maps to the IACT header's par4/userId.
@@ -780,7 +780,7 @@ void InsaneRebel2::handleOpcode6Handler8(Common::SeekableReadStream &b, int16 pa
_shipDirectionH, _shipDirectionV, _shipDirectionIndex);
}
-// ScummVM refactor helper for opcode 6 Handler 7, not a separate retail function.
+// Helper split out of FUN_0040C3CC case 4; not a separate original function.
void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 par4) {
// Handler 7 specific logic (third-person ship) - FUN_0040d836 / FUN_0040c3cc
// Used for Level 3 and similar space combat levels.
@@ -851,7 +851,7 @@ void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 pa
int16 scaledInputX = (int16)((inputX * 127) / 160);
int16 scaledInputY = _optControlsFlipped ? (int16)-inputY : inputY; // local_14
- // ScummVM direct mouse/touch/gamepad aiming can hold the cursor at an edge
+ // Direct mouse/touch/gamepad aiming can hold the cursor at an edge
// indefinitely. Keep this sensitivity concession local to Handler 7
// third-person ship steering.
scaledInputX = (int16)((scaledInputX * kRA2Handler7DirectInputNumerator) /
@@ -924,7 +924,7 @@ void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 pa
if (positionDeltaX > 11)
positionDeltaX = 12;
- // Retail integrates relative flight axes. ScummVM's real mouse is an
+ // FUN_0040C3CC integrates relative flight axes. The real mouse is an
// absolute position, so steer toward a bounded position target instead of
// letting a held off-center cursor keep pushing the ship until it bounces.
if (useMouseFlightTarget) {
@@ -1092,7 +1092,7 @@ void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 pa
useMouseFlightTarget ? 1 : 0);
}
-// ScummVM refactor helper for opcode 6 Handler 25, not a separate retail function.
+// Helper split out of FUN_0041CADB case 4; not a separate original function.
void InsaneRebel2::handleOpcode6Handler25(byte *renderBitmap, Common::SeekableReadStream &b, int16 par2, int16 par3, int16 par4) {
// Handler 25 (0x19) specific logic (mixed mode - speeder bike).
// Based on FUN_0041cadb case 4 (opcode 6) lines 113-229.
@@ -1132,7 +1132,7 @@ void InsaneRebel2::handleOpcode6Handler25(byte *renderBitmap, Common::SeekableRe
// Set sprite mode (DAT_00457900 = local_14[3]) - controls which GRD sprite to render.
// From FUN_0041cadb line 122: DAT_00457900 = local_14[3].
- // In ScummVM's IACT parsing: local_14[3] = offset 6-7 = par4.
+ // In this IACT parser: local_14[3] = offset 6-7 = par4.
// Mode 1: Uncovered, shooting position - sprite on left
// Mode 2: Covered, vertical shift
// Mode 3: Transition between covered/uncovered - sprite position depends on direction
@@ -1282,7 +1282,7 @@ void InsaneRebel2::handleOpcode6Handler25(byte *renderBitmap, Common::SeekableRe
drawHandler25CorridorOverlay(renderBitmap);
}
-// ScummVM refactor helper for opcode 6 Handler 0x26, not a separate retail function.
+// Helper split out of FUN_00407FCB case 4; not a separate original function.
void InsaneRebel2::handleOpcode6Turret(Common::SeekableReadStream &b, int16 par4) {
// Handler 0x26: FUN_407FCB line 77-79 - set level type from par4, read par5 for init trigger.
// param_5[3] = par4 = levelType, param_5[4] = par5 = init flag.
@@ -1320,7 +1320,7 @@ void InsaneRebel2::handleOpcode6Turret(Common::SeekableReadStream &b, int16 par4
}
}
-// ScummVM refactor helper for opcode 6 generic init, not a separate retail function.
+// Helper split out of generic opcode 6 initialization; not a separate original function.
void InsaneRebel2::handleOpcode6GenericInit(int16 par4) {
// Other handlers: par4 == 1 triggers init (NOT level type).
if (_rebelHandler != 0x26 && par4 == 1) {
@@ -1344,7 +1344,7 @@ void InsaneRebel2::handleOpcode6GenericInit(int16 par4) {
}
}
-// ScummVM refactor helper for opcode 6 generic flight state, not a separate retail function.
+// Helper split out of generic opcode 6 flight state; not a separate original function.
void InsaneRebel2::updateOpcode6GenericFlightState() {
// Step 3: Autopilot/control mode logic (lines 123-146)
// This determines whether the ship flies on autopilot or manual control.
@@ -1462,7 +1462,7 @@ void InsaneRebel2::updateOpcode6GenericFlightState() {
_rebelLevelType, _rebelAutopilot, _rebelDamageLevel, _rebelViewOffsetX, _rebelViewOffsetY);
}
-// ScummVM refactor helper for opcode 6 embedded ANIM scan, not a separate retail function.
+// Helper split out of opcode 6 embedded ANIM scanning; not a separate original function.
void InsaneRebel2::scanOpcode6EmbeddedAnim(byte *renderBitmap, Common::SeekableReadStream &b, int32 chunkSize, int16 par4) {
// Detect and load embedded ANIM (SAN) within the remaining IACT payload.
// Note: chunkSize is the remaining IACT payload size after par1-par4 header.
@@ -1562,7 +1562,7 @@ void InsaneRebel2::iactRebel2Opcode6(byte *renderBitmap, Common::SeekableReadStr
// Handler 0x26 (turret): Turret HUD NUT via par3/par4 (1-4)
// Handler 0x19: Speeder bike GRD/HUD resources via par4
//
-// ScummVM refactor helper for opcode 8 Handler 7 FLY loading, not a separate retail function.
+// Helper split out of FUN_0040C3CC case 6; not a separate original function.
bool InsaneRebel2::loadOpcode8Handler7FlySprites(Common::SeekableReadStream &b, int64 startPos, int64 remaining, int16 par4) {
// Handler 7: FLY NUT Loading (Third-Person Ship)
// FUN_0040c3cc case 6: par4 determines FLY sprite slot.
@@ -1578,7 +1578,7 @@ bool InsaneRebel2::loadOpcode8Handler7FlySprites(Common::SeekableReadStream &b,
return false;
}
-// ScummVM refactor helper for opcode 8 Handler 7 shot table loading, not a separate retail function.
+// Helper split out of FUN_0040C3CC case 6 shot-table loading; not a separate original function.
bool InsaneRebel2::loadOpcode8Handler7ShotTable(Common::SeekableReadStream &b, int64 startPos, int64 remaining, int16 par4) {
// FUN_0040c3cc case 6:
// par4=12 -> FUN_0040fcfa(text, DAT_004437c2, DAT_00443808)
@@ -1595,14 +1595,14 @@ bool InsaneRebel2::loadOpcode8Handler7ShotTable(Common::SeekableReadStream &b, i
return false;
}
-// ScummVM refactor helper for opcode 8 edge table loading, not a separate retail function.
+// Helper split out of FUN_00405663 edge-table loading; not a separate original function.
bool InsaneRebel2::loadOpcode8EdgeTable(Common::SeekableReadStream &b, int64 startPos, int64 remaining, int16 par4) {
// Edge Blend Table Loading (par4 == 1000)
// FUN_405663: After all handler-specific opcode 8 processing, checks if par4==1000.
// If so, loads a per-level 256x256 color blend table from the IACT chunk data.
// This table controls the edge glow color of laser beams (e.g. red vs green).
// Data starts at byte offset 18 in the IACT chunk (in_stack_00000014 + 9 shorts).
- // The stream is positioned after par1..par4 (8 bytes), so retail's +18 is startPos + 10.
+ // The stream is positioned after par1..par4 (8 bytes), so FUN_00405663's +18 is startPos + 10.
if (par4 == 1000 && remaining >= 10 + 8 + 32896) {
byte *edgeData = (byte *)malloc(8 + 32896);
if (edgeData) {
@@ -1619,7 +1619,7 @@ bool InsaneRebel2::loadOpcode8EdgeTable(Common::SeekableReadStream &b, int64 sta
return false;
}
-// ScummVM refactor helper for opcode 8 aux SFX loading, not a separate retail function.
+// Helper split out of opcode 8 aux SFX loading; not a separate original function.
bool InsaneRebel2::loadOpcode8AuxSfx(Common::SeekableReadStream &b, int64 startPos, int64 remaining, int16 par4) {
// Auxiliary Sound Buffer Loading (par4 20-47)
// FUN_401234 case 6 (handler 8): par4 0x14-0x1b (20-27) -> aux buffer 0
@@ -1663,7 +1663,7 @@ bool InsaneRebel2::loadOpcode8AuxSfx(Common::SeekableReadStream &b, int64 startP
return true;
}
-// ScummVM refactor helper for opcode 8 Handler 25 shot-origin loading, not a separate retail function.
+// Helper split out of FUN_0041CADB case 6 shot-origin loading; not a separate original function.
bool InsaneRebel2::loadOpcode8ShotOriginTable(Common::SeekableReadStream &b, int64 startPos, int64 remaining, int16 par4) {
// Handler 25 (0x19): Shot-Origin Lookup Table (par4 == 8)
// FUN_0041CADB case 6 pushes 30 short pointers into sscanf with format at 0x482360:
@@ -1679,7 +1679,7 @@ bool InsaneRebel2::loadOpcode8ShotOriginTable(Common::SeekableReadStream &b, int
return false;
}
-// ScummVM refactor helper for opcode 8 embedded ANIM scanning, not a separate retail function.
+// Helper split out of opcode 8 embedded ANIM scanning; not a separate original function.
void InsaneRebel2::loadOpcode8EmbeddedAnim(byte *renderBitmap, Common::SeekableReadStream &b, int64 startPos, int64 remaining, int16 par3, int16 par4) {
// Remaining handlers require finding ANIM tag in the stream.
debugC(DEBUG_INSANE, "Opcode 8: Scanning for ANIM tag (startPos=%lld remaining=%lld)",
@@ -1738,7 +1738,7 @@ void InsaneRebel2::loadOpcode8EmbeddedAnim(byte *renderBitmap, Common::SeekableR
b.seek(startPos);
}
-// ScummVM refactor helper for opcode 8 embedded ANIM routing, not a separate retail function.
+// Helper split out of opcode 8 embedded ANIM routing; not a separate original function.
bool InsaneRebel2::handleOpcode8EmbeddedAnim(byte *renderBitmap, byte *animData, int32 animDataSize, int16 par3, int16 par4) {
bool handled = false;
@@ -1851,7 +1851,7 @@ void InsaneRebel2::iactRebel2Opcode8(byte *renderBitmap, Common::SeekableReadStr
bool InsaneRebel2::loadHandler25ShotOriginTable(Common::SeekableReadStream &b, int64 startPos, int64 remaining) {
// IACT layout at this point:
// - stream is positioned after par1..par4 (8 bytes consumed by caller)
- // - retail parser reads from offset +18 relative to IACT start -> startPos + 10
+ // - FUN_0041CADB reads from offset +18 relative to IACT start -> startPos + 10
// - payload size for this opcode family is at offset +14 -> startPos + 6
if (remaining < 12)
return false;
@@ -1918,7 +1918,7 @@ bool InsaneRebel2::loadHandler25ShotOriginTable(Common::SeekableReadStream &b, i
return false;
}
- // Retail mapping (from FUN_41CADB disassembly):
+ // FUN_0041CADB mapping:
// token1->0x4578b0 (X index 5), token2->0x4578d0 (Y index 5), ...
// token29->0x4578cc (X index 19), token30->0x4578ec (Y index 19).
for (int i = 0; i < 15; ++i) {
@@ -1937,7 +1937,7 @@ bool InsaneRebel2::loadHandler25ShotOriginTable(Common::SeekableReadStream &b, i
// loadHandler7ShotTable -- Parse handler 7 laser muzzle coordinate pairs from IACT payload.
bool InsaneRebel2::loadHandler7ShotTable(Common::SeekableReadStream &b, int64 startPos, int64 remaining, int16 par4) {
- // Retail FUN_0040fcfa parses 35 "%hd %hd" pairs from offset +18 in the IACT
+ // FUN_0040FCFA parses 35 "%hd %hd" pairs from offset +18 in the IACT
// chunk into two parallel 35-entry tables. These tables are BSS globals in
// the EXE, so their values only exist in the SAN/IACT stream.
if (remaining < 12)
@@ -2024,7 +2024,7 @@ bool InsaneRebel2::loadHandler7ShotTable(Common::SeekableReadStream &b, int64 st
// Opcode 8 Helper Functions
// ---------------------------------------------------------------------------
// Extracted from the original monolithic iactRebel2Opcode8 to match
-// the retail FUN_* function structure.
+// the original FUN_* function structure.
// loadHandler7FlySprites -- Handler 7 FLY NUT loading (FUN_0040c3cc case 6).
bool InsaneRebel2::loadHandler7FlySprites(Common::SeekableReadStream &b, int64 remaining, int16 par4) {
@@ -2394,7 +2394,7 @@ bool InsaneRebel2::loadLevel2Background(byte *animData, int32 size, byte *render
_level2BackgroundLoaded = true;
foundBackground = true;
- // Handler 25 uses this buffer as a lookup mask; the retail code does not
+ // Handler 25 uses this buffer as a lookup mask; FUN_0041CADB does not
// copy it to the live screen. Handler 8 still uses it as a restore source.
if (renderBitmap && _rebelHandler != 25) {
int bufferPitch = (_player && _player->_width > 0) ? _player->_width : 320;
@@ -2523,7 +2523,7 @@ void InsaneRebel2::iactRebel2Opcode9(byte *renderBitmap, Common::SeekableReadStr
// Check difficulty gate (flag bit 3 = 0x08)
// If set, only show text if difficulty check passes (we skip this check for simplicity)
- // In retail: FUN_00425d30(0) is called
+ // FUN_00425D30(0) is called.
// Get render buffer dimensions
int width = (_player && _player->_width > 0) ? _player->_width : 320;
@@ -2638,7 +2638,7 @@ void InsaneRebel2::iactRebel2Opcode9(byte *renderBitmap, Common::SeekableReadStr
convertedText[dstIdx] = '\0';
// Draw the text string (with converted character indices), but only when subtitles are
- // enabled â opcode 9 is a subtitle/message path, so it honors ScummVM's global
+ // enabled: opcode 9 is a subtitle/message path, so it honors the global
// "subtitles" setting and the in-game TEXT toggle (same ConfMan key). The chunk is
// still fully parsed above so stream consumption is unaffected.
if (ConfMan.getBool("subtitles")) {
diff --git a/engines/scumm/insane/rebel2/levels.cpp b/engines/scumm/insane/rebel2/levels.cpp
index 57e786378cf..41be2808224 100644
--- a/engines/scumm/insane/rebel2/levels.cpp
+++ b/engines/scumm/insane/rebel2/levels.cpp
@@ -49,7 +49,7 @@ static void purgeRebel2GameplayInputEvents(Common::EventManager *eventMan) {
// Level Loading System
// ---------------------------------------------------------------------------
// Emulates the level handler functions from FUN_00417E53 through FUN_0041BBE8.
-// Based on disassembly analysis of the retail Rebel Assault 2 executable.
+// Based on disassembly analysis of the Rebel Assault 2 executable.
Common::String InsaneRebel2::getLevelDir(int levelId) {
return Common::String::format("LEV%02d", levelId);
@@ -472,7 +472,7 @@ int InsaneRebel2::runLevel(int levelId) {
// Lock the mouse to the game window during gameplay.
// The original hides the cursor (ShowCursor(0)) and relies on Windows confining
// the mouse to the game window. Without locking, the cursor can escape the
- // ScummVM window making the ship uncontrollable.
+ // window making the ship uncontrollable.
_gameplaySectionActive = false;
CursorMan.showMouse(false);
g_system->lockMouse(true);
@@ -563,7 +563,7 @@ int InsaneRebel2::getRandomVariant(int max) {
//
// Returns variant suffix ("A", "B", "C", etc.) based on level, phase,
// and the frame where the player died. Emulates the per-level frame
-// threshold tables in the retail level handlers.
+// threshold tables in the original level handlers.
//
Common::String InsaneRebel2::selectDeathVideoVariant(int levelId, int phase, int frame) {
diff --git a/engines/scumm/insane/rebel2/menu.cpp b/engines/scumm/insane/rebel2/menu.cpp
index 7e26e6dd250..0ada7d95441 100644
--- a/engines/scumm/insane/rebel2/menu.cpp
+++ b/engines/scumm/insane/rebel2/menu.cpp
@@ -43,7 +43,7 @@ namespace Scumm {
// ---------------------------------------------------------------------------
// Menu System Implementation
// ---------------------------------------------------------------------------
-// Emulates retail menu system from FUN_004147B2 and FUN_0041FDC8.
+// Emulates original menu system from FUN_004147B2 and FUN_0041FDC8.
static void setRebel2MixerVolume(ScummEngine_v7 *vm, int volumeLevel) {
const int mixerVolume = CLIP<int>(volumeLevel * 2, 0, (int)Audio::Mixer::kMaxMixerVolume);
@@ -123,7 +123,7 @@ Common::String InsaneRebel2::getRandomMenuVideo() {
// Returns -1 (no action) or a 0-based selected menu item.
// Events captured by notifyEvent() before ScummEngine consumes them.
// Keyboard: Up=0x148, Down=0x150, Enter=0x0d.
-// Physical ESC is handled by notifyEvent() and opens the ScummVM menu.
+// Physical ESC is handled by notifyEvent() and opens the global menu.
// Mouse mode (DAT_0047a806 == 1): Y position maps to selection.
//
int InsaneRebel2::processMenuInput() {
diff --git a/engines/scumm/insane/rebel2/rebel.cpp b/engines/scumm/insane/rebel2/rebel.cpp
index df84162a961..babc253b027 100644
--- a/engines/scumm/insane/rebel2/rebel.cpp
+++ b/engines/scumm/insane/rebel2/rebel.cpp
@@ -153,7 +153,7 @@ InsaneRebel2::InsaneRebel2(ScummEngine_v7 *scumm) {
// Set from param_10 of FUN_403BD0 (main game init). Values:
// < 0: Edge highlights disabled (low-detail mode)
// >= 0: Edge highlights enabled, >= 1: high-detail (secondary NUTs, widescreen)
- // Always use high detail in ScummVM.
+ // Always use high detail.
_rebelDetailMode = 1;
_smush_cockpitNut = new NutRenderer(_vm, highRes ? "SYSTM/DIHIFONT.NUT" : "SYSTM/DISPFONT.NUT");
@@ -209,7 +209,7 @@ InsaneRebel2::InsaneRebel2(ScummEngine_v7 *scumm) {
_textOverlayFadeIn = 0;
_textOverlayFadeOut = 0;
- // Retail globals mapped: hit counter, cooldown, movie/auto-play flags
+ // Original globals mapped: hit counter, cooldown, movie/auto-play flags.
_rebelOp6Initialized = false;
_rebelHitCounter = 0;
_rebelKillCounter = 0;
@@ -232,7 +232,7 @@ InsaneRebel2::InsaneRebel2(ScummEngine_v7 *scumm) {
_rebelViewMode1 = 0;
_rebelViewMode2 = 0;
- // Initialize mirrored retail counters
+ // Initialize mirrored original counters.
for (int i = 0; i < 10; ++i) {
_rebelValueCounters[i] = 0;
_rebelMaskCounters[i] = 0;
@@ -542,7 +542,7 @@ InsaneRebel2::InsaneRebel2(ScummEngine_v7 *scumm) {
_optMusicEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kMusicSoundType);
_optSfxEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kSFXSoundType);
_optVoicesEnabled = !_vm->_mixer->isSoundTypeMuted(Audio::Mixer::kSpeechSoundType);
- // Initialize the dialogue-text (subtitles) toggle from ScummVM's global setting so the
+ // Initialize the dialogue-text (subtitles) toggle from the global setting so the
// game and the in-game TEXT menu label reflect it. The menu toggle writes the same
// "subtitles" key, which the text-render paths gate on.
_optTextEnabled = ConfMan.getBool("subtitles");
@@ -676,7 +676,7 @@ void InsaneRebel2::restoreIOSGamepadController() {
bool InsaneRebel2::notifyEvent(const Common::Event &event) {
SmushPlayer *splayer = ((ScummEngine_v7 *)_vm)->_splayer;
- // Global ScummVM dialogs pause the engine while their modal event loop runs.
+ // Global dialogs pause the engine while their modal event loop runs.
// Do not consume those events as RA2 input: a key seen here would otherwise
// trip RA2's "any key unpauses gameplay" path while the Smush player must
// remain paused for the dialog/focus interval.
@@ -686,7 +686,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
if (_rebelYodaMode && event.type == Common::EVENT_KEYDOWN && !event.kbdRepeat && event.kbd.hasFlags(Common::KBD_ALT)) {
switch (event.kbd.keycode) {
case Common::KEYCODE_m:
- // Retail DAT_0047ab60: Yoda-mode Movie Mode skips playable
+ // DAT_0047ab60: Yoda-mode Movie Mode skips playable
// sections and keeps the story/cutscene sequence moving.
_rebelMovieMode = !_rebelMovieMode;
debugC(DEBUG_INSANE, "Movie mode %s", _rebelMovieMode ? "enabled" : "disabled");
@@ -695,7 +695,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
return true;
case Common::KEYCODE_p:
- // Retail DAT_0047ab64: Yoda-mode Auto Play makes gameplay
+ // DAT_0047ab64: Yoda-mode Auto Play makes gameplay
// computer controlled.
_rebelAutoPlay = !_rebelAutoPlay;
debugC(DEBUG_INSANE, "Auto play %s", _rebelAutoPlay ? "enabled" : "disabled");
@@ -915,7 +915,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
return true;
if (_menuInputActive && menuState) {
- debugC(DEBUG_INSANE, "Back/menu action in menu - opening ScummVM menu");
+ debugC(DEBUG_INSANE, "Back/menu action in menu - opening global menu");
openMenuMainMenu(splayer);
return true;
}
@@ -929,7 +929,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
}
}
- debugC(DEBUG_INSANE, "Back/menu action during gameplay - opening ScummVM menu");
+ debugC(DEBUG_INSANE, "Back/menu action during gameplay - opening global menu");
openGameplayMainMenu(splayer);
return true;
}
@@ -1036,7 +1036,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
return true;
}
- debugC(DEBUG_INSANE, "Opening ScummVM menu from menu state");
+ debugC(DEBUG_INSANE, "Opening global menu from menu state");
openMenuMainMenu(splayer);
return true;
}
@@ -1058,7 +1058,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
if (event.type == Common::EVENT_MAINMENU && splayer &&
_gameState == kStateGameplay && _rebelHandler != 0) {
- debugC(DEBUG_INSANE, "Main menu action during gameplay - opening ScummVM menu");
+ debugC(DEBUG_INSANE, "Main menu action during gameplay - opening global menu");
openGameplayMainMenu(splayer);
return true;
}
@@ -1081,7 +1081,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
}
// When paused during gameplay, ANY key unpauses (FUN_405A21 line 360-365).
- // ESC additionally opens the ScummVM menu (original: quit key exits level).
+ // ESC additionally opens the global menu (original: quit key exits level).
if (splayer && splayer->_paused && _gameState == kStateGameplay) {
debugC(DEBUG_INSANE, "Key pressed while paused - unpausing");
// Restore the original palette saved by showPauseOverlay
@@ -1091,7 +1091,7 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
}
splayer->unpause();
if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _rebelHandler != 0) {
- debugC(DEBUG_INSANE, "ESC during pause - opening ScummVM menu");
+ debugC(DEBUG_INSANE, "ESC during pause - opening global menu");
openGameplayMainMenu(splayer);
}
return true;
@@ -1100,13 +1100,13 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
switch (event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
// ESC handling depends on game state:
- // - In menus: Open the ScummVM menu (handled above)
- // - During gameplay: Pause and open ScummVM menu
+ // - In menus: Open the global menu (handled above)
+ // - During gameplay: Pause and open the global menu
// - During cutscenes/intros: Skip video
if (splayer) {
if (_gameState == kStateGameplay && _rebelHandler != 0) {
- // During active gameplay (handler != 0): pause and open ScummVM menu.
- debugC(DEBUG_INSANE, "ESC pressed during gameplay - opening ScummVM menu");
+ // During active gameplay (handler != 0): pause and open the global menu.
+ debugC(DEBUG_INSANE, "ESC pressed during gameplay - opening global menu");
openGameplayMainMenu(splayer);
} else {
// During cutscenes/intros/mission briefings: skip video
@@ -1327,7 +1327,7 @@ InsaneRebel2::LevelDifficultyParams InsaneRebel2::getDifficultyParams() const {
int diff = CLIP(_difficulty, 0, 5);
int lvIdx = 0;
- // Retail uses DAT_0047a7f8 as the per-segment difficulty table index.
+ // DAT_0047a7f8 is the per-segment difficulty table index.
// This is NOT the same as handler 0x26's gun "levelType" from opcode 6.
//
// Index mapping reconstructed from level handlers:
@@ -1435,7 +1435,7 @@ void InsaneRebel2::renderScoreHUD(byte *renderBitmap, int pitch, int width, int
// ---------------------------------------------------------------------------
// Pilot Data System
// ---------------------------------------------------------------------------
-// Save/load pilot profiles using ScummVM's save file system.
+// Save/load pilot profiles using the save file system.
// Original: FUN_00411980 (load) / FUN_00411A5D (save).
const uint32 kPilotSaveMagic = MKTAG('R', 'A', '2', 'P');
@@ -1703,7 +1703,7 @@ int32 InsaneRebel2::processMouse() {
it->id, it->type, mousePos.x, mousePos.y,
it->rect.left, it->rect.top, it->rect.right, it->rect.bottom);
- // Explosion scale is handler-specific in retail:
+ // Explosion scale is handler-specific in the original:
// - H8/H7/H26 use object half-width
// - H25 uses half-width + snapDistance (and type 100 doubles it)
int explosionHalfWidth = it->rect.width() / 2;
@@ -1912,8 +1912,8 @@ void InsaneRebel2::updateGameplayAimFromGamepad() {
activeGamepadAim = true;
}
} else if (_rebelHandler == 0x26) {
- // Retail RA2 maps joystick axes into a small centered handler 0x26 reticle box.
- // ScummVM deliberately exposes the full 320x200 mouse aim range for gamepads
+ // Original RA2 maps joystick axes into a small centered handler 0x26 reticle box.
+ // Gamepad aiming deliberately exposes the full 320x200 mouse aim range
// too, but preserves the original joystick feel: curved response for precise
// center aiming, and automatic return to screen center when the stick is released.
int axisX = 0;
diff --git a/engines/scumm/insane/rebel2/rebel.h b/engines/scumm/insane/rebel2/rebel.h
index ca5c902b908..4d1f76af1fd 100644
--- a/engines/scumm/insane/rebel2/rebel.h
+++ b/engines/scumm/insane/rebel2/rebel.h
@@ -63,7 +63,7 @@ public:
// ---------------------------------------------------------------------------
// Menu System
// ---------------------------------------------------------------------------
- // Main game states (emulates retail state machine from FUN_004142BD)
+ // Main game states (emulates original state machine from FUN_004142BD)
enum GameState {
kStateIntro = 0, // Stage 0: Intro/Credits sequence
kStateMainMenu = 1, // Stage 1: Main menu (FUN_004147B2)
@@ -339,7 +339,7 @@ public:
};
// Main game entry point â full game loop (intro, menu, pilot, chapter, levels)
- // Emulates the retail game flow from FUN_004142BD
+ // Emulates the original game flow from FUN_004142BD
void runGame();
// Play the intro sequence (CREDITS/O_OPEN_C, O_OPEN_D, OPEN/O_OPEN_A, O_OPEN_B)
@@ -419,8 +419,8 @@ public:
WaveEndResult processWaveEnd(int16 mask, int16 *budget, int16 threshold, uint16 flags);
// Play a raw SAN segment from a scripted level handler.
- // Retail reaches these call sites through different wrappers/direct paths; this
- // only collapses ScummVM's shared dispatch step. Callers still choose the original
+ // The original reaches these call sites through different wrappers/direct paths; this
+ // only collapses the shared dispatch step. Callers still choose the original
// flags and when to call processWaveEnd(). recordFrame preserves the original
// split between gameplay/wave calls and transition/init-only segments.
bool playLevelSegment(const char *filename, uint16 flags, bool recordFrame = true);
@@ -655,7 +655,7 @@ public:
bool loadHandler25GrdSprites(byte *animData, int32 size, int16 par4);
// Parse Handler 25 shot-origin table text from opcode 8 (par4 = 8).
- // Retail stores values into DAT_004578a6 / DAT_004578c6 (indices 5..19).
+ // FUN_0041CADB stores values into DAT_004578a6 / DAT_004578c6 (indices 5..19).
bool loadHandler25ShotOriginTable(Common::SeekableReadStream &b, int64 startPos, int64 remaining);
// Load Level 2 background from embedded ANIM
@@ -838,7 +838,7 @@ public:
bool active;
};
- // Two zone tables matching retail DAT_0043fb00 (primary) and DAT_0043f9c8 (secondary)
+ // Two zone tables matching DAT_0043fb00 (primary) and DAT_0043f9c8 (secondary)
static const int kMaxCollisionZones = 5;
CollisionZone _primaryZones[kMaxCollisionZones]; // Sub-opcode 0x0D zones
CollisionZone _secondaryZones[kMaxCollisionZones]; // Sub-opcode 0x0E zones
@@ -922,10 +922,10 @@ public:
int16 _damageHighFlashCounter; // DAT_00482408 - high-damage red flash (0..16)
int16 _damageShakeCounter; // DAT_0048240c - screen shake countdown (0..10)
byte _damageSavedPalette[0x300]; // DAT_00459990 - palette snapshot before flash
- byte _damageRestorePalette[0x300]; // ScummVM boundary restore snapshot
+ byte _damageRestorePalette[0x300]; // Boundary restore snapshot
bool _damageRestorePaletteValid;
- // Rebel per-level counters / flags mapped from retail globals
+ // Rebel per-level counters / flags mapped from original globals
bool _rebelOp6Initialized; // Guard: opcode 6 init block (clearBit/links/wave) runs once per video
int _rebelHitCounter; // DAT_0047ab80 - hit counter / state tracker
int _rebelKillCounter; // DAT_0047ab88 - enemies destroyed this phase
@@ -955,7 +955,7 @@ public:
int _rebelViewMode1; // DAT_00482270
int _rebelViewMode2; // DAT_00482274
- // Retail counters mirrored from DAT_00443618 (values 100..109) and DAT_004436e0 (mask counters 1..9)
+ // Original counters mirrored from DAT_00443618 (values 100..109) and DAT_004436e0 (mask counters 1..9)
short _rebelValueCounters[10]; // Index 0 -> value 100, ... Index 9 -> 109
short _rebelMaskCounters[10]; // Index 1..9 used; index 0 unused
int _rebelLastCounter; // Mirrors DAT_0047ab90 (last updated counter)
@@ -1210,7 +1210,7 @@ public:
NutRenderer *_grd005Sprite; // DAT_00482258 - GRD005 mode 3 overlay NUT
// Handler 25 shot-origin lookup tables from opcode 8/par4=8 text payload.
- // Indices 5..19 are filled by the retail "%hd %hd ..." parser (FUN_0041CADB case 6).
+ // Indices 5..19 are filled by the "%hd %hd ..." parser in FUN_0041CADB case 6.
// Uncovered Level 2 firing uses indices 5..14.
int16 _grdShotOriginX[30]; // DAT_004578a6 equivalent
int16 _grdShotOriginY[30]; // DAT_004578c6 equivalent
diff --git a/engines/scumm/insane/rebel2/render.cpp b/engines/scumm/insane/rebel2/render.cpp
index 4256f4e6638..9d5c7dccb65 100644
--- a/engines/scumm/insane/rebel2/render.cpp
+++ b/engines/scumm/insane/rebel2/render.cpp
@@ -42,7 +42,7 @@ extern void smushDecodeRLE(byte *dst, const byte *src, int left, int top, int wi
extern void smushDecodeUncompressed(byte *dst, const byte *src, int left, int top, int width, int height, int pitch);
int getRebel2IndicatorScale(int width, int height) {
- // Retail only doubles these anchors in true high-res mode (DAT_0047a808 >= 2).
+ // Original only doubles these anchors in true high-res mode (DAT_0047a808 >= 2).
// RA2's 424x260 low-res gameplay buffer is still displayed through a 320x200
// viewport, so it uses the original 320x200 indicator coordinates.
return (width >= 640 || height >= 400) ? 2 : 1;
@@ -555,7 +555,7 @@ void InsaneRebel2::spawnHandler25Shot(int x, int y) {
_turretShots[i].targetX = x + _viewX;
_turretShots[i].targetY = y + _viewY;
- // Compute gun position from retail lookup tables.
+ // Compute gun position from original lookup tables.
// Original (FUN_41DB5E) stores:
// DAT_0045791c[i] = gunXTable[spriteIdx] + DAT_00457910 - DAT_0045790c
// DAT_00457920[i] = gunYTable[spriteIdx] + DAT_00457912 - DAT_0045790e
@@ -598,7 +598,7 @@ void InsaneRebel2::spawnHandler25Shot(int x, int y) {
int16 gunXTable = _grdShotOriginX[spriteIdx];
int16 gunYTable = _grdShotOriginY[spriteIdx];
- // Mirrored X when DAT_00457902 != 0 in retail.
+ // Mirrored X when DAT_00457902 != 0.
if (_rebelFlightDir != 0) {
gunXTable = 320 - gunXTable;
}
@@ -644,7 +644,7 @@ Common::Point InsaneRebel2::getHandler7ProjectedPoint() {
}
Common::Point InsaneRebel2::getHandler7ShotTargetPoint() {
- // Retail handler 7 targets the projected ship/crosshair point computed in
+ // Handler 7 targets the projected ship/crosshair point computed in
// FUN_0040d836; it does not use the generic mouse position for combat shots.
Common::Point projected = getHandler7ProjectedPoint();
@@ -653,7 +653,7 @@ Common::Point InsaneRebel2::getHandler7ShotTargetPoint() {
}
Common::Point InsaneRebel2::getHandler8ShotTargetPoint() {
- // Retail handler 8 stores and draws the shot target from the damped ship
+ // Handler 8 stores and draws the shot target from the damped ship
// position in FUN_00401ccf, not from the current mouse/analog aim point.
return Common::Point(((_shipPosX - 0xa0) >> 3) + 0xa0,
((_shipPosY - 0x28) >> 2) + 0x69);
@@ -1845,8 +1845,8 @@ void InsaneRebel2::checkCollisionZones(byte *renderBitmap, int pitch, int width,
// Two modes: obstacle collision (secondary zones) and wall/boundary
// collision (primary zones with per-edge push-back).
//
-// The helpers in this block are ScummVM refactor helpers split out of
-// checkHandler7CollisionZones; they are not separate retail functions.
+// The helpers in this block are split out of checkHandler7CollisionZones;
+// they are not separate original functions.
//
bool InsaneRebel2::isHandler7ShipInsideObstacleZone(const InsaneRebel2::CollisionZone &zone, int margin) {
int x1 = zone.x1, y1 = zone.y1;
@@ -1936,7 +1936,7 @@ void InsaneRebel2::checkHandler7ObstacleZones(uint16 &warningMask) {
}
// FUN_40E35E line 104: mark near-danger proximity for shadow cue rendering.
- // Uses the low byte of zone.filterValue (retail local_1c) to pick direction bits.
+ // Uses the low byte of zone.filterValue (original local_1c) to pick direction bits.
if (zone.field2 - 13 < zone.field1) {
uint32 bit = 4u << ((byte)zone.filterValue & 0x1f);
warningMask = (uint16)(warningMask | (uint16)bit);
@@ -4102,7 +4102,7 @@ void InsaneRebel2::renderExplosions(byte *renderBitmap, int pitch, int width, in
}
// renderExplosionFrame -- Shared explosion sprite path.
-// The original handlers reach this through separate retail functions. In the
+// The original handlers reach this through separate functions. In the
// 320x200 path used here, they share centered NUT drawing; callers keep their
// coordinate transforms, frame timing, and scale bucket rules explicit.
void InsaneRebel2::renderExplosionFrame(byte *renderBitmap, int pitch, int width, int height,
@@ -4555,7 +4555,7 @@ void InsaneRebel2::renderHandler25LaserShots(byte *renderBitmap, int pitch, int
pan = CLIP<int16>(pan, -127, 127);
// TODO: Apply panning to sound channel i+1
- // Retail adds DAT_0045790c/0e at render time to both gun and target.
+ // FUN_00407FCB adds DAT_0045790c/0e at render time to both gun and target.
int16 targetX = _turretShots[i].targetX + _rebelViewOffsetX;
int16 targetY = _turretShots[i].targetY + _rebelViewOffsetY;
@@ -4602,7 +4602,7 @@ void InsaneRebel2::renderHandler8MonitorEffect(byte *renderBitmap, int pitch, in
return;
// FUN_0041C6EC/FUN_00413EFC: remap every other gameplay row through
- // FUN_00410721()+0x400. ScummVM uses the primary edge table, matching
+ // FUN_00410721()+0x400. Use the primary edge table, matching
// DAT_0047a81c == 0.
const byte *monitorTable = _edgeTable + 0x400;
for (int y = 1; y < effectHeight; y += 2) {
diff --git a/engines/scumm/smush/rebel/smush_player_ra1.cpp b/engines/scumm/smush/rebel/smush_player_ra1.cpp
index 43f4d65e882..69c338d5ba6 100644
--- a/engines/scumm/smush/rebel/smush_player_ra1.cpp
+++ b/engines/scumm/smush/rebel/smush_player_ra1.cpp
@@ -286,7 +286,7 @@ bool SmushPlayerRebel1::handleGameFetch(int32 subSize, Common::SeekableReadStrea
top += _ra1ViewportOffsetY;
} else {
ra1ApplyCenteredFetchPlacement(rebel1, _storedFobjWidth, _storedFobjHeight, left, top);
- // ScummVM currently emulates the RA1 camera with a source-window crop
+ // RA1 camera emulation currently uses a source-window crop
// for interactive scenes. FTCH placement from the original executable
// is computed in fixed presentation space, so convert it back into the
// cropped buffer space used by the current renderer.
@@ -347,7 +347,7 @@ void SmushPlayerRebel1::ra1HandleGost(int32 subSize, Common::SeekableReadStream
// DOS reuses the most recent FOBJ payload for RA1 GOST and places it at the
// absolute BE32 coordinates stored in the chunk. Priority bits are identified
- // here but not yet modeled in the generic ScummVM decode path.
+ // here but not yet modeled in the generic decode path.
decodeFrameObject(_lastFobjCodec, _lastFobjData, ghostX, ghostY,
_lastFobjWidth, _lastFobjHeight, _lastFobjDataSize);
}
@@ -416,7 +416,7 @@ void SmushPlayerRebel1::ra1HandleDeltaPalette(int32 subSize, Common::SeekableRea
b.skip(remaining);
// Command 2 in the DOS dispatcher first restores the palette state before
- // loading a new delta table. ScummVM keeps the active palette in _pal, so
+ // loading a new delta table. The active palette lives in _pal, so
// marking it dirty is the corresponding visible-side effect.
if (command == 2)
setDirtyColors(0, 255);
diff --git a/engines/scumm/smush/rebel/smush_player_ra2.cpp b/engines/scumm/smush/rebel/smush_player_ra2.cpp
index 163c1923f60..dabef54a36e 100644
--- a/engines/scumm/smush/rebel/smush_player_ra2.cpp
+++ b/engines/scumm/smush/rebel/smush_player_ra2.cpp
@@ -229,7 +229,7 @@ void SmushPlayerRebel2::initGameVideoState() {
_width = _vm->_screenWidth;
_height = _vm->_screenHeight;
- // Keep ScummVM's virtual screen consistent with FUN_00424d70: bit 0x20
+ // Keep the virtual screen consistent with FUN_00424d70: bit 0x20
// controls per-frame clearing. Videos that clear every frame can also start
// from a cleared target; videos with bit 0x20 set preserve until their first
// decoded frame overwrites or composes over it.
@@ -451,7 +451,7 @@ bool SmushPlayerRebel2::handleGameTextRendering(const char *str, int fontId, int
int pos_x, int pos_y, int left, int top,
int width, int height, TextStyleFlags flg) {
// RA2 dialogue subtitles. Only render them when subtitles are enabled â this honors
- // both ScummVM's global "subtitles" setting and the in-game TEXT toggle (which writes
+ // both the global "subtitles" setting and the in-game TEXT toggle (which writes
// the same ConfMan key). Still return true so the base handler treats the chunk as
// handled. Querying ConfMan per chunk also lets the setting take effect mid-video.
if (ConfMan.getBool("subtitles"))
@@ -732,7 +732,7 @@ bool SmushPlayerRebel2::handleGameAnimHeader(byte *headerContent) {
debugC(DEBUG_SMUSH, "SmushPlayerRebel2::handleGameAnimHeader: RA2 AHDR has 0x0 dims - using screen size %dx%d", _width, _height);
} else if (width != _vm->_screenWidth || height != _vm->_screenHeight) {
// FUN_00407FCB/FUN_0040C3CC update the active frame descriptor from
- // IACT opcode 6. In ScummVM's low-res path the descriptor remains
+ // IACT opcode 6. In the low-res path the descriptor remains
// 320x200 and perspective is applied through FUN_00424510-equivalent
// FOBJ offsets. Do not let AHDR alone change pitch while _dst still
// points at the virtual screen; FOBJ selection will allocate a larger
@@ -1123,7 +1123,7 @@ void SmushPlayerRebel2::ra2HandleGost(int32 subSize, Common::SeekableReadStream
_lastFobjWidth, _lastFobjHeight, _lastFobjCodec);
// Priority bits (0x2000/0x4000/0x6000) are currently not modeled in
- // ScummVM's SMUSH decoders. Coordinate-correct re-decode restores expected
+ // the SMUSH decoders. Coordinate-correct re-decode restores expected
// RA2 chapter preview behavior.
ra2PrepareFrameObjectSurface(left, top, _lastFobjWidth, _lastFobjHeight);
decodeFrameObject(_lastFobjCodec, _lastFobjData, left, top,
More information about the Scummvm-git-logs
mailing list