[Scummvm-git-logs] scummvm master -> 3ff0b6b9b7071c06be0869f4e07ae1bf00c72c2b
dreammaster
noreply at scummvm.org
Sun Aug 23 02:33:08 UTC 2026
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
eae9ba7db4 MADS: NEBULAR: Better fix for ASound command0 being virtual
8f1e5c7b13 MADS: Sound code PVS Warning fixes.
3ff0b6b9b7 MADS: Fix remaining PVS warnings.
Commit: eae9ba7db4c6f8b5ad3d5ce8fb7647b1ac57dbbe
https://github.com/scummvm/scummvm/commit/eae9ba7db4c6f8b5ad3d5ce8fb7647b1ac57dbbe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-23T11:44:32+10:00
Commit Message:
MADS: NEBULAR: Better fix for ASound command0 being virtual
This commit reverts ea91bb50c3c775288617e6a8356712045dc51bc6
Changed paths:
engines/mads/nebular/sound/asound.cpp
engines/mads/nebular/sound/asound.h
engines/mads/nebular/sound/asound_nebular.h
engines/mads/nebular/sound/sound.cpp
diff --git a/engines/mads/nebular/sound/asound.cpp b/engines/mads/nebular/sound/asound.cpp
index f5c15ae507f..eecd32a2ae9 100644
--- a/engines/mads/nebular/sound/asound.cpp
+++ b/engines/mads/nebular/sound/asound.cpp
@@ -172,9 +172,6 @@ ASound::ASound(Audio::Mixer *mixer, const Common::Path &filename, int dataOffset
// Initialize the Adlib
adlibInit();
-
- // Reset the adlib
- command0();
}
ASound::~ASound() {
diff --git a/engines/mads/nebular/sound/asound.h b/engines/mads/nebular/sound/asound.h
index f72c040aadc..83f2a3b25f5 100644
--- a/engines/mads/nebular/sound/asound.h
+++ b/engines/mads/nebular/sound/asound.h
@@ -284,7 +284,7 @@ protected:
*/
byte *getDataPtr(int nearPtr);
- int command0();
+ virtual int command0();
int command1();
int command2();
int command3();
diff --git a/engines/mads/nebular/sound/asound_nebular.h b/engines/mads/nebular/sound/asound_nebular.h
index 3378fc00493..907d586be79 100644
--- a/engines/mads/nebular/sound/asound_nebular.h
+++ b/engines/mads/nebular/sound/asound_nebular.h
@@ -130,7 +130,7 @@ private:
typedef int (ASound2:: *CommandPtr)();
static const CommandPtr _commandList[44];
- int command0();
+ int command0() override;
int command9();
int command10();
int command11();
diff --git a/engines/mads/nebular/sound/sound.cpp b/engines/mads/nebular/sound/sound.cpp
index 3ec45274e88..ad34b4f2be4 100644
--- a/engines/mads/nebular/sound/sound.cpp
+++ b/engines/mads/nebular/sound/sound.cpp
@@ -83,20 +83,6 @@ void RexSoundManager::validate() {
void RexSoundManager::loadDriver(int sectionNumber) {
closeDriver();
- if (_isDemo && _driverType == SOUND_ADLIB) {
- switch (sectionNumber) {
- case 1:
- _driver = new ASoundDemo1(_mixer);
- break;
- case 9:
- _driver = new ASoundDemo9(_mixer);
- break;
- default:
- return;
- }
- return;
- }
-
switch (_driverType) {
case SOUND_MT32:
// Roland MT32 drivers
@@ -236,37 +222,53 @@ void RexSoundManager::loadDriver(int sectionNumber) {
default:
// Adlib drivers
- switch (sectionNumber) {
- case 1:
- _driver = new ASound1(_mixer);
- break;
- case 2:
- _driver = new ASound2(_mixer);
- break;
- case 3:
- _driver = new ASound3(_mixer);
- break;
- case 4:
- _driver = new ASound4(_mixer);
- break;
- case 5:
- _driver = new ASound5(_mixer);
- break;
- case 6:
- _driver = new ASound6(_mixer);
- break;
- case 7:
- _driver = new ASound7(_mixer);
- break;
- case 8:
- _driver = new ASound8(_mixer);
- break;
- case 9:
- _driver = new ASound9(_mixer);
- break;
- default:
- return;
+ if (_isDemo) {
+ switch (sectionNumber) {
+ case 1:
+ _driver = new ASoundDemo1(_mixer);
+ break;
+ case 9:
+ _driver = new ASoundDemo9(_mixer);
+ break;
+ default:
+ return;
+ }
+ } else {
+ switch (sectionNumber) {
+ case 1:
+ _driver = new ASound1(_mixer);
+ break;
+ case 2:
+ _driver = new ASound2(_mixer);
+ break;
+ case 3:
+ _driver = new ASound3(_mixer);
+ break;
+ case 4:
+ _driver = new ASound4(_mixer);
+ break;
+ case 5:
+ _driver = new ASound5(_mixer);
+ break;
+ case 6:
+ _driver = new ASound6(_mixer);
+ break;
+ case 7:
+ _driver = new ASound7(_mixer);
+ break;
+ case 8:
+ _driver = new ASound8(_mixer);
+ break;
+ case 9:
+ _driver = new ASound9(_mixer);
+ break;
+ default:
+ return;
+ }
}
+
+ // Reset the driver
+ _driver->command(0, 0);
}
}
Commit: 8f1e5c7b132fdfb192836b5b07f7aafa6a477d55
https://github.com/scummvm/scummvm/commit/8f1e5c7b132fdfb192836b5b07f7aafa6a477d55
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-23T12:02:36+10:00
Commit Message:
MADS: Sound code PVS Warning fixes.
PVS-Studio V501, V519, V560, V730, V1037, V1048, V1051, V1053, V1071
Changed paths:
engines/mads/nebular/sound/rsound.cpp
engines/mads/nebular/sound/rsound.h
engines/mads/phantom/sound/asound.cpp
engines/mads/phantom/sound/isound.cpp
engines/mads/phantom/sound/isound_phantom.cpp
engines/mads/phantom/sound/psound_phantom.cpp
engines/mads/phantom/sound/rsound_phantom.cpp
engines/mads/phantom/sound/sound.cpp
diff --git a/engines/mads/nebular/sound/rsound.cpp b/engines/mads/nebular/sound/rsound.cpp
index 97bb3726bac..9bcf5bb16df 100644
--- a/engines/mads/nebular/sound/rsound.cpp
+++ b/engines/mads/nebular/sound/rsound.cpp
@@ -597,14 +597,15 @@ void RSound::Channel_processTick(Channel *channel) {
if (channel->_volumeFadeStepSize) {
if (!--channel->_volumeFadeCounter) {
channel->_volumeFadeCounter = channel->_volumeFadeSpeed;
- int8 newVolume = (int8)channel->_volume + (int8)channel->_volumeFadeStepSize;
- if (newVolume < 0) {
+ int volumeSum = (int8)channel->_volume + (int8)channel->_volumeFadeStepSize;
+ if (volumeSum < 0) {
channel->_volumeFadeStepSize = 0;
- newVolume = 0;
- } else if (newVolume >= 0x7F) {
+ volumeSum = 0;
+ } else if (volumeSum >= 0x7F) {
channel->_volumeFadeStepSize = 0;
- newVolume = 0x7F;
+ volumeSum = 0x7F;
}
+ int8 newVolume = (int8)volumeSum;
channel->_volume = newVolume;
sendVolume(midiChannel, newVolume);
}
diff --git a/engines/mads/nebular/sound/rsound.h b/engines/mads/nebular/sound/rsound.h
index b427785e8cc..b6257b02443 100644
--- a/engines/mads/nebular/sound/rsound.h
+++ b/engines/mads/nebular/sound/rsound.h
@@ -160,7 +160,6 @@ private:
int _sysExOffset;
MidiDriver_MT32GM *_midiDriver;
- uint32 _driverCallbackDelta;
void processTick();
void processTickAllChannels();
diff --git a/engines/mads/phantom/sound/asound.cpp b/engines/mads/phantom/sound/asound.cpp
index 30232a70450..207c26be75b 100644
--- a/engines/mads/phantom/sound/asound.cpp
+++ b/engines/mads/phantom/sound/asound.cpp
@@ -221,7 +221,6 @@ ASound::ASound(Audio::Mixer *mixer, const Common::Path &filename, int dataOffset
write(4, 0x80);
Common::fill(_adlibPorts, _adlibPorts + 256, 0);
- command0();
}
ASound::~ASound() {
@@ -1900,7 +1899,6 @@ post_keyon:
if (ch->_fadePeriodCounter == 0) {
ch->_fadePeriodCounter = ch->_fadePeriodReload;
- ch = _activeChannelPtr;
if (ch->_volumeFadeStep != 0) {
if (ch->_pendingStop != 0) {
@@ -1908,7 +1906,6 @@ post_keyon:
if (ch->_velocity > 0) {
ch->_velocity += ch->_volumeFadeStep; /* step is signed */
}
- ch = _activeChannelPtr;
if (ch->_volume != 0) {
ch->_volume += ch->_volumeFadeStep;
}
@@ -1916,12 +1913,10 @@ post_keyon:
/* Normal fade: clamp velocity at 0..127 */
if ((int8)ch->_volumeFadeStep > 0) {
ch->_velocity += ch->_volumeFadeStep;
- ch = _activeChannelPtr;
if ((int16)ch->_velocity > 0x7F)
ch->_velocity = 0x7F;
} else {
ch->_velocity += ch->_volumeFadeStep;
- ch = _activeChannelPtr;
if ((int8)ch->_velocity < 0)
ch->_velocity = 0;
}
@@ -1933,11 +1928,9 @@ post_keyon:
/* ---- Vibrato ---- */
ch = _activeChannelPtr;
ch->_vibPeriodCounter--;
- ch = _activeChannelPtr;
if (ch->_vibPeriodCounter == 0) {
ch->_vibPeriodCounter = ch->_vibPeriodReload;
- ch = _activeChannelPtr;
if ((int8)ch->_vibratoDepth != 0) {
int16 pa = (int16)(int8)ch->_patchAttenuation;
@@ -1954,7 +1947,6 @@ post_keyon:
ch->_vibratoDepth = (uint8)(-ch->_vibratoDepth);
}
- ch = _activeChannelPtr;
ch->_patchAttenuation += ch->_vibratoDepth;
var_8 = 1;
}
diff --git a/engines/mads/phantom/sound/isound.cpp b/engines/mads/phantom/sound/isound.cpp
index dd6faffa239..48fd1ea9a80 100644
--- a/engines/mads/phantom/sound/isound.cpp
+++ b/engines/mads/phantom/sound/isound.cpp
@@ -531,6 +531,7 @@ bool ISound::processControl(byte opcode) {
case 0xf4:
case 0xf1:
case 0xf0:
+ case 0xc3:
_position = (uint16)(_position + 2);
break;
case 0xf3:
@@ -683,9 +684,6 @@ bool ISound::processControl(byte opcode) {
warning("Phantom ISOUND ignored native callback 0x%04x", w);
_position = (uint16)(_position + 3);
break;
- case 0xc3:
- _position = (uint16)(_position + 2);
- break;
case 0xc2:
_position = (uint16)(_position + 4);
break;
diff --git a/engines/mads/phantom/sound/isound_phantom.cpp b/engines/mads/phantom/sound/isound_phantom.cpp
index c169e6af67e..c0ff0dfaea4 100644
--- a/engines/mads/phantom/sound/isound_phantom.cpp
+++ b/engines/mads/phantom/sound/isound_phantom.cpp
@@ -169,12 +169,8 @@ bool ISoundSection::validateSectionLayout(int sectionNumber,
const bool lateLayout = sectionNumber >= 3 && sectionNumber <= 5;
const uint16 noteTableOffset = lateLayout ? 0x00e0 : 0x00f4;
- const uint16 nullSequenceOffset = lateLayout ? 0x00ba : 0x00ce;
- const uint16 randomSeedOffset = lateLayout ? 0x00c8 : 0x00dc;
const uint32 noteTableEnd = noteTableOffset + (0x00ba + 1) * 2U;
- if (noteTableEnd > layout.initializedDataSize ||
- (uint32)nullSequenceOffset + 1 >= layout.initializedDataSize ||
- (uint32)randomSeedOffset + 1 >= layout.initializedDataSize) {
+ if (noteTableEnd > layout.initializedDataSize) {
if (reason)
*reason = "overlay data does not contain the selected section layout";
return false;
diff --git a/engines/mads/phantom/sound/psound_phantom.cpp b/engines/mads/phantom/sound/psound_phantom.cpp
index d281bd2c151..ddd1de4f04a 100644
--- a/engines/mads/phantom/sound/psound_phantom.cpp
+++ b/engines/mads/phantom/sound/psound_phantom.cpp
@@ -515,7 +515,8 @@ int PSound3::executeCommand(int commandId) {
case 0x25:
playSound(0x0653);
break;
- case 0x40: {
+ case 0x40:
+ case 0x4b: {
static const uint16 sounds[] = {0x0622, 0x0627};
playSounds(sounds, ARRAYSIZE(sounds));
break;
@@ -556,11 +557,6 @@ int PSound3::executeCommand(int commandId) {
case 0x4a:
playSound(0x0757);
break;
- case 0x4b: {
- static const uint16 sounds[] = {0x0622, 0x0627};
- playSounds(sounds, ARRAYSIZE(sounds));
- break;
- }
default:
break;
}
diff --git a/engines/mads/phantom/sound/rsound_phantom.cpp b/engines/mads/phantom/sound/rsound_phantom.cpp
index 9c0f39c36b6..2a866e2f111 100644
--- a/engines/mads/phantom/sound/rsound_phantom.cpp
+++ b/engines/mads/phantom/sound/rsound_phantom.cpp
@@ -1552,8 +1552,7 @@ bool RSoundDemoPHA::validate(Common::String *reason) {
*reason = "file size does not match";
return false;
}
- if (kDemoDataOffset + kDemoInitializedDataSize != file.size() ||
- kDemoInitializedDataSize > kDemoDeclaredDataSize) {
+ if (kDemoDataOffset + kDemoInitializedDataSize != file.size()) {
if (reason)
*reason = "declared data segment is inconsistent";
return false;
diff --git a/engines/mads/phantom/sound/sound.cpp b/engines/mads/phantom/sound/sound.cpp
index 65b171238a9..06595bc9f87 100644
--- a/engines/mads/phantom/sound/sound.cpp
+++ b/engines/mads/phantom/sound/sound.cpp
@@ -208,6 +208,7 @@ void PhantomSoundManager::loadDriver(int sectionNumber) {
}
} else if (_isDemo) {
_driver = new ASoundDemo(_mixer);
+ _driver->command(0, 0);
} else if (_driverType == SOUND_PCSPEAKER) {
const Common::Path filename = getISoundFilename(sectionNumber);
Common::String reason;
@@ -217,10 +218,14 @@ void PhantomSoundManager::loadDriver(int sectionNumber) {
warning("Cannot use %s: %s; using AdLib for section %d",
filename.toString().c_str(), reason.c_str(), sectionNumber);
_driver = createASound(_mixer, sectionNumber);
+ if (_driver)
+ _driver->command(0, 0);
}
} else {
// Adlib
_driver = createASound(_mixer, sectionNumber);
+ if (_driver)
+ _driver->command(0, 0);
}
}
Commit: 3ff0b6b9b7071c06be0869f4e07ae1bf00c72c2b
https://github.com/scummvm/scummvm/commit/3ff0b6b9b7071c06be0869f4e07ae1bf00c72c2b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-23T12:32:46+10:00
Commit Message:
MADS: Fix remaining PVS warnings.
PVS-Studio V512, V594, V506, V629, V547, V1048, V557, V769, V1004, V560
Changed paths:
engines/mads/core/conv.cpp
engines/mads/core/game.cpp
engines/mads/core/implode.cpp
engines/mads/core/matte.cpp
engines/mads/core/mem.cpp
engines/mads/core/object.cpp
engines/mads/core/pal.cpp
engines/mads/core/popup.cpp
engines/mads/core/rail.cpp
engines/mads/core/sprite.cpp
engines/mads/dragonsphere/menus.cpp
diff --git a/engines/mads/core/conv.cpp b/engines/mads/core/conv.cpp
index 6891c1b0b91..bb69c693386 100644
--- a/engines/mads/core/conv.cpp
+++ b/engines/mads/core/conv.cpp
@@ -131,10 +131,12 @@ void ConvVariable::load(Common::SeekableReadStream *src) {
if (val >= 0 && val < 20) {
// Index into one of the four 5-element arrays in turn:
// speaker_frame[5], x[5], y[5], width[5]
- int16 *const fieldArrays[] = {
- conv_control.speaker_frame, conv_control.x, conv_control.y, conv_control.width
- };
- ptr = &fieldArrays[val / CONV_MAX_DATA][val % CONV_MAX_DATA];
+ switch (val / CONV_MAX_DATA) {
+ case 0: ptr = &conv_control.speaker_frame[val % CONV_MAX_DATA]; break;
+ case 1: ptr = &conv_control.x[val % CONV_MAX_DATA]; break;
+ case 2: ptr = &conv_control.y[val % CONV_MAX_DATA]; break;
+ case 3: ptr = &conv_control.width[val % CONV_MAX_DATA]; break;
+ }
} else if (val == 20) {
ptr = &conv_control.speaker_val;
} else {
@@ -321,11 +323,18 @@ static void conv_set_variable(int idx, int16 *ptr) {
if (ptr >= global && ptr < (global + GLOBAL_LIST_SIZE)) {
var.type = ConvVariable::PTRTYPE_GLOBAL;
var.val = ptr - global;
- } else if (ptr >= conv_control.speaker_frame && ptr < conv_control.speaker_frame + 20) {
- // Index into one of the sequential 5 element arrays:
- // speaker_frame[5], x[5], y[5], width[5]
+ } else if (ptr >= conv_control.speaker_frame && ptr < conv_control.speaker_frame + CONV_MAX_DATA) {
var.type = ConvVariable::PTRTYPE_CONV_CONTROL;
- var.val = ptr - conv_control.speaker_frame;
+ var.val = 0 * CONV_MAX_DATA + (ptr - conv_control.speaker_frame);
+ } else if (ptr >= conv_control.x && ptr < conv_control.x + CONV_MAX_DATA) {
+ var.type = ConvVariable::PTRTYPE_CONV_CONTROL;
+ var.val = 1 * CONV_MAX_DATA + (ptr - conv_control.x);
+ } else if (ptr >= conv_control.y && ptr < conv_control.y + CONV_MAX_DATA) {
+ var.type = ConvVariable::PTRTYPE_CONV_CONTROL;
+ var.val = 2 * CONV_MAX_DATA + (ptr - conv_control.y);
+ } else if (ptr >= conv_control.width && ptr < conv_control.width + CONV_MAX_DATA) {
+ var.type = ConvVariable::PTRTYPE_CONV_CONTROL;
+ var.val = 3 * CONV_MAX_DATA + (ptr - conv_control.width);
} else if (ptr == &conv_control.speaker_val) {
var.type = ConvVariable::PTRTYPE_CONV_CONTROL;
var.val = 20;
diff --git a/engines/mads/core/game.cpp b/engines/mads/core/game.cpp
index e4a658924e1..3a581c06910 100644
--- a/engines/mads/core/game.cpp
+++ b/engines/mads/core/game.cpp
@@ -1160,8 +1160,7 @@ void game_control() {
if (gameId == GType_RexNebular)
game.going = !kernel_section_startup(new_section);
- if (gameId != GType_Forest)
- kernel.activate_menu = GAME_DIFFICULTY_MENU;
+ kernel.activate_menu = GAME_DIFFICULTY_MENU;
game_exec_function(game_menu_routine);
if (!game.going)
return;
@@ -2135,13 +2134,13 @@ static void game_palette_update() {
item = 'c';
} else if (color_status[count]) {
handle = picture_resource.color_handle;
- picture_flag = 1 << handle;
+ picture_flag = 1L << handle;
any_flag = picture_flag;
walker_flag = 0;
for (count2 = 0; count2 < player.num_series; count2++) {
handle = series_list[count2 + player.series_base]->color_handle;
- walker_flag |= 1 << handle;
+ walker_flag |= 1L << handle;
}
any_flag |= walker_flag;
diff --git a/engines/mads/core/implode.cpp b/engines/mads/core/implode.cpp
index 31e1256db5c..76301914853 100644
--- a/engines/mads/core/implode.cpp
+++ b/engines/mads/core/implode.cpp
@@ -771,9 +771,6 @@ static void imp_fabrice(ImpState *s) {
if (s->qlen > s->zlen)
s->qlen = s->zlen;
- int save_di = di;
- int save_si = si;
-
// Decide encoding type.
int qlen = (int)(int16_t)s->qlen; // treat as signed for comparison
int qoff = (int)s->qoff;
@@ -856,14 +853,11 @@ static void imp_fabrice(ImpState *s) {
s->norms = 0;
}
- // Restore DI and SI, then advance through the input by Qlen characters,
- // maintaining the hash dictionary.
+ // Advance through the input by Qlen characters, maintaining the hash
+ // dictionary. di/si are unchanged since the top of the loop.
//
// Note: on the FIRST iteration we skip Link (jump to UnLink directly)
// because the current di was already linked by Match().
- di = save_di;
- si = save_si;
-
int qlen_advance = (int)(int16_t)s->qlen;
for (int k = 0; k < qlen_advance; k++) {
if (k > 0) {
diff --git a/engines/mads/core/matte.cpp b/engines/mads/core/matte.cpp
index e5769599429..e0ec847692d 100644
--- a/engines/mads/core/matte.cpp
+++ b/engines/mads/core/matte.cpp
@@ -978,8 +978,10 @@ void matte_refresh_inter() {
int id;
id = matte_allocate_inter_image();
- image_inter_list[id].flags = IMAGE_REFRESH;
- image_inter_list[id].segment_id = (byte)-1;
+ if (id >= 0) {
+ image_inter_list[id].flags = IMAGE_REFRESH;
+ image_inter_list[id].segment_id = (byte)-1;
+ }
}
static void make_inter_matte(ImageInterPtr image, MattePtr matte) {
diff --git a/engines/mads/core/mem.cpp b/engines/mads/core/mem.cpp
index 4fc528bb624..5af9de07a8d 100644
--- a/engines/mads/core/mem.cpp
+++ b/engines/mads/core/mem.cpp
@@ -52,6 +52,8 @@ void *mem_get_name(long size, const char *) {
byte *memory_block = nullptr;
if (size > 0) {
memory_block = (byte *)malloc(size);
+ if (!memory_block)
+ error("mem_get_name: Out of memory allocating %ld bytes", size);
Common::fill(memory_block, memory_block + size, 0);
}
diff --git a/engines/mads/core/object.cpp b/engines/mads/core/object.cpp
index 1a2ea04b6ad..3d7637e44ee 100644
--- a/engines/mads/core/object.cpp
+++ b/engines/mads/core/object.cpp
@@ -231,7 +231,7 @@ int object_examine(int number, long message, int speech) {
if (isMacRex)
inter_hide_macintosh_sentence();
- memcpy(&top_eight[0].r, &master_palette[248].r, 8 * sizeof(RGBcolor));
+ memcpy(&top_eight[0], &master_palette[248], 8 * sizeof(RGBcolor));
// Use attribute buffer to cheat on memory requirements a bit
old_master_palette = scr_depth.data;
@@ -346,7 +346,7 @@ int object_examine(int number, long message, int speech) {
if (isRex)
RexNebular::popup_shift_dialog_colors(-10);
- memcpy(&cycling_palette[248].r, &master_palette[248].r, 8 * sizeof(RGBcolor));
+ memcpy(&cycling_palette[248], &master_palette[248], 8 * sizeof(RGBcolor));
if (speech) {
if (speech_system_active && speech_on) {
@@ -438,7 +438,7 @@ int object_examine(int number, long message, int speech) {
}
// Turn color cycling back on.
- memcpy(&cycling_palette[248].r, top_eight, 8 * sizeof(RGBcolor));
+ memcpy(&cycling_palette[248], top_eight, 8 * sizeof(RGBcolor));
mcga_setpal_range(&cycling_palette, 248, 8);
cycling_active = cycling_save;
diff --git a/engines/mads/core/pal.cpp b/engines/mads/core/pal.cpp
index 97bcbe9d09c..0d97116eaa8 100644
--- a/engines/mads/core/pal.cpp
+++ b/engines/mads/core/pal.cpp
@@ -400,7 +400,7 @@ int pal_allocate(ColorListPtr new_list, ShadowListPtr shadow_list, int pal_flags
if (list_color == master_shadow->shadow_color[shadow]) {
found = true;
best_target_color = shadow + PAL_FORCE_SHADOW;
- memcpy(&(master_palette[best_target_color].r), &(new_list->table[list_color].r), 3);
+ memcpy(&(master_palette[best_target_color]), &(new_list->table[list_color]), 3);
}
}
}
@@ -442,7 +442,7 @@ int pal_allocate(ColorListPtr new_list, ShadowListPtr shadow_list, int pal_flags
} else {
// This is a little hack (or "optimization") to compare the 3 RGB bytes much
// more quickly when we are looking for an exact match only.
- hash = !memcmp(&new_list->table[list_color].r, &master_palette[target_color].r, 3) ? 0 : 1;
+ hash = !memcmp(&new_list->table[list_color], &master_palette[target_color], 3) ? 0 : 1;
}
if (hash < best_hash) {
found = true;
@@ -609,7 +609,7 @@ int pal_get_color(RGBcolor color, int color_handle, int override_reserved, int *
for (count = 0; (!found) && (count < 256); count++) {
if (!(color_status[count] & PAL_RESERVED) || override_reserved) {
if (!(color_status[count] & PAL_CYCLE)) {
- if (memcmp(&color, &master_palette[count].r, sizeof(RGBcolor)) == 0) {
+ if (memcmp(&color, &master_palette[count], sizeof(RGBcolor)) == 0) {
color_status[count] |= mask;
if (color_number != NULL) *color_number = count;
found = true;
@@ -621,7 +621,7 @@ int pal_get_color(RGBcolor color, int color_handle, int override_reserved, int *
if (!found) {
for (count = 0; (!found) && (count < 256); count++) {
if (color_status[count] == 0) {
- memcpy(&master_palette[count].r, &color, sizeof(RGBcolor));
+ memcpy(&master_palette[count], &color, sizeof(RGBcolor));
color_status[count] = mask;
if (color_number != NULL) *color_number = count;
found = true;
diff --git a/engines/mads/core/popup.cpp b/engines/mads/core/popup.cpp
index a954beecb76..1d6da08833c 100644
--- a/engines/mads/core/popup.cpp
+++ b/engines/mads/core/popup.cpp
@@ -1029,7 +1029,6 @@ int popup_ask_string(char *target, int maxlen, int save_screen) {
while (!g_engine->shouldQuit() && !keys_any()) {
mouse_begin_cycle(false);
if (mouse_stop_stroke) {
- error_flag = 1;
popup_esc_key = true;
going = false;
goto done;
@@ -1043,7 +1042,6 @@ int popup_ask_string(char *target, int maxlen, int save_screen) {
case alt_q_key:
case ctrl_q_key:
case ctrl_x_key:
- error_flag = 1;
popup_esc_key = true;
going = false;
goto done;
@@ -1123,7 +1121,8 @@ int popup_ask_number(long *value, int maxlen, int save_screen) {
if (popup_ask_string(temp_buf, maxlen, save_screen)) goto done;
- *value = atol(temp_buf);
+ if (value)
+ *value = atol(temp_buf);
error_flag = false;
diff --git a/engines/mads/core/rail.cpp b/engines/mads/core/rail.cpp
index 8f7321df5dc..7a2c636d807 100644
--- a/engines/mads/core/rail.cpp
+++ b/engines/mads/core/rail.cpp
@@ -91,7 +91,7 @@ void rail_connect_node(int id) {
for (count = 0; count < (int)rail_num_nodes; count++) {
if (count != id) {
- if (rail_active[count] && rail_active[id]) {
+ if (rail_active[count]) {
x1 = room->rail[count].x;
y1 = room->rail[count].y;
if (player.walk_anywhere) {
diff --git a/engines/mads/core/sprite.cpp b/engines/mads/core/sprite.cpp
index fb4951c517a..0eb5e56294f 100644
--- a/engines/mads/core/sprite.cpp
+++ b/engines/mads/core/sprite.cpp
@@ -542,14 +542,14 @@ SeriesPtr sprite_series_load(const char *filename, int load_flags) {
for (count = 0; count < color_list->num_colors; count++) {
found = false;
for (low_color = 0; !found && (low_color < 4); low_color++) {
- if (memcmp(&color_list->table[count].r, &master_palette[low_color].r, sizeof(RGBcolor)) == 0) {
+ if (memcmp(&color_list->table[count], &master_palette[low_color], sizeof(RGBcolor)) == 0) {
found = true;
color_list->table[count].x16 = (byte)low_color;
}
}
if (!found) {
- memcpy(&master_palette[color_table[color_pointer]].r,
- &color_list->table[count].r, sizeof(RGBcolor));
+ memcpy(&master_palette[color_table[color_pointer]],
+ &color_list->table[count], sizeof(RGBcolor));
color_list->table[count].x16 = (byte)color_table[color_pointer];
color_pointer = MIN(6, color_pointer + 1);
}
diff --git a/engines/mads/dragonsphere/menus.cpp b/engines/mads/dragonsphere/menus.cpp
index 45128213695..eedc233f9d4 100644
--- a/engines/mads/dragonsphere/menus.cpp
+++ b/engines/mads/dragonsphere/menus.cpp
@@ -381,7 +381,6 @@ static void global_menu_options() {
case f1_key:
case f5_key:
default:
- kernel.activate_menu = GAME_MAIN_MENU;
break;
case f2_key:
@@ -537,7 +536,6 @@ static void global_menu_cdrom() {
case f1_key:
case f5_key:
default:
- kernel.activate_menu = GAME_MAIN_MENU;
break;
case f2_key:
More information about the Scummvm-git-logs
mailing list