[Scummvm-git-logs] scummvm branch-2-2 -> 97a92d2030f03ba63c0aeaf03e1832aee82fc114
criezy
criezy at scummvm.org
Wed Sep 9 23:48:40 UTC 2020
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0f27168b39 CINE: Loop Amiga music instead of playing it once
e1d90bbff6 CINE: FW: Fix Amiga/Atari ST copy protection text
7e08870d8d CINE: Fix mouse responsiveness after player death
ca75696105 CINE: Fix using F3 for INVENTORY and F4 for USE.
25e2cd34cd CINE: Try to fix bad_alloc with empty event queue
caca1ac2f0 CINE: Fix total playtime loading from savegame.
43fb440756 CINE: FW: Fix 8 half speed scenes (Amiga/Atari ST)
0f9dc9096d CINE: Fix loading inexistent music.
32f4459823 CINE: FW: Fix command line updating
60c56f5fcb GRIFFON: Fix out of bound write when loading map
85fb717275 GRIFFON: Fix use of uninitialized variables reported by valgrind
97a92d2030 GUI: Fix use of uninitialized variable in ListWidget constructor
Commit: 0f27168b39c39aa6183f8e38eefa3eb3514065e6
https://github.com/scummvm/scummvm/commit/0f27168b39c39aa6183f8e38eefa3eb3514065e6
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:36:51+01:00
Commit Message:
CINE: Loop Amiga music instead of playing it once
Make Amiga music loop until fade out when changing scene. This is
based on watching a video of Future Wars Amiga walkthrough, not on
playing the Amiga version or reading its disassembly. But it does seem
that the music loops instead of just playing once.
Changed paths:
audio/mods/soundfx.cpp
audio/mods/soundfx.h
engines/cine/sound.cpp
diff --git a/audio/mods/soundfx.cpp b/audio/mods/soundfx.cpp
index 962e687583..3462e55fd0 100644
--- a/audio/mods/soundfx.cpp
+++ b/audio/mods/soundfx.cpp
@@ -47,7 +47,7 @@ public:
NUM_INSTRUMENTS = 15
};
- SoundFx(int rate, bool stereo, int periodScaleDivisor = 1);
+ SoundFx(int rate, bool stereo, bool repeat, int periodScaleDivisor = 1);
virtual ~SoundFx();
bool load(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb);
@@ -73,9 +73,10 @@ protected:
uint8 _ordersTable[128];
uint8 *_patternData;
uint16 _effects[NUM_CHANNELS];
+ bool _repeat;
};
-SoundFx::SoundFx(int rate, bool stereo, int periodScaleDivisor)
+SoundFx::SoundFx(int rate, bool stereo, bool repeat, int periodScaleDivisor)
: Paula(stereo, rate, 0, Paula::defaultFilterMode(), periodScaleDivisor) {
setTimerBaseValue(kPalCiaClock);
_ticks = 0;
@@ -87,6 +88,7 @@ SoundFx::SoundFx(int rate, bool stereo, int periodScaleDivisor)
memset(_ordersTable, 0, sizeof(_ordersTable));
_patternData = 0;
memset(_effects, 0, sizeof(_effects));
+ _repeat = repeat;
}
SoundFx::~SoundFx() {
@@ -244,7 +246,10 @@ void SoundFx::handleTick() {
_curPos = 0;
++_curOrder;
if (_curOrder == _numOrders) {
- stopPaula();
+ if (_repeat)
+ _curOrder = 0;
+ else
+ stopPaula();
}
}
}
@@ -264,8 +269,8 @@ void SoundFx::interrupt() {
handleTick();
}
-AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo, int periodScaleDivisor) {
- SoundFx *stream = new SoundFx(rate, stereo, periodScaleDivisor);
+AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo, bool repeat, int periodScaleDivisor) {
+ SoundFx *stream = new SoundFx(rate, stereo, repeat, periodScaleDivisor);
if (stream->load(data, loadCb)) {
stream->play();
return stream;
diff --git a/audio/mods/soundfx.h b/audio/mods/soundfx.h
index 71128b7277..b029e75bbf 100644
--- a/audio/mods/soundfx.h
+++ b/audio/mods/soundfx.h
@@ -45,7 +45,7 @@ typedef byte *(*LoadSoundFxInstrumentCallback)(const char *name, uint32 *size);
* stream object is kept). If loadCb is non 0, then instruments are loaded using
* it, buffers returned are free'd at the end of playback.
*/
-AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate = 44100, bool stereo = true, int periodScaleDivisor = 1);
+AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate = 44100, bool stereo = true, bool repeat = true, int periodScaleDivisor = 1);
} // End of namespace Audio
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 282923782c..2e678340a4 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -1405,7 +1405,7 @@ void PaulaSound::loadMusic(const char *name) {
// Operation Stealth for Amiga has to have its music frequency halved
// or otherwise the music sounds too high pitched.
const int periodScaleDivisor = 2;
- _moduleStream = Audio::makeSoundFxStream(&s, readBundleSoundFile, _mixer->getOutputRate(), true, periodScaleDivisor);
+ _moduleStream = Audio::makeSoundFxStream(&s, readBundleSoundFile, _mixer->getOutputRate(), true, true, periodScaleDivisor);
free(buf);
}
}
Commit: e1d90bbff6eb2f2fb53e0ce123878ae515e00c57
https://github.com/scummvm/scummvm/commit/e1d90bbff6eb2f2fb53e0ce123878ae515e00c57
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:37:05+01:00
Commit Message:
CINE: FW: Fix Amiga/Atari ST copy protection text
Fix transparency of page number and grid position (e.g. 04 and D2) in
the copy protection scene of Amiga and Atari ST versions of Future Wars.
Changed paths:
engines/cine/anim.cpp
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index fa1f3db527..517cff9ab5 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -670,6 +670,16 @@ int loadAni(const char *resourceName, int16 idx, int16 frameIndex) {
transparentColor = getAnimTransparentColor(resourceName);
+ // TODO: Merge this special case hack into getAnimTransparentColor somehow.
+ // HACK: Amiga and Atari ST versions of ALPHA.ANI in Future Wars use 0 instead of 0xF for transparency.
+ // Fixes transparency of page number and grid position (e.g. 04 and D2) in the copy protection scene
+ // of Amiga and Atari ST versions of Future Wars.
+ if (hacksEnabled && g_cine->getGameType() == Cine::GType_FW &&
+ (g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) &&
+ scumm_stricmp(resourceName, "ALPHA.ANI") == 0) {
+ transparentColor = 0;
+ }
+
// TODO: Merge this special case hack into getAnimTransparentColor somehow.
// HACK: Versions of TITRE.ANI with height 37 use color 0xF for transparency.
// Versions of TITRE.ANI with height 57 use color 0x0 for transparency.
Commit: 7e08870d8d0beba034eee8f41e1771483db8ab58
https://github.com/scummvm/scummvm/commit/7e08870d8d0beba034eee8f41e1771483db8ab58
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:37:15+01:00
Commit Message:
CINE: Fix mouse responsiveness after player death
After player has died it was hard to get the system menu to appear by
pressing the left and right mouse buttons simultaneously or the middle
mouse button. Fix that by using the maximum values of the mouse button
states for the polling period (Around 110ms at default play speed).
Changed paths:
engines/cine/various.cpp
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 7f925deff3..d9ca43334e 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -1193,7 +1193,7 @@ uint16 executePlayerInput() {
// the command line.
manageEvents(EXECUTE_PLAYER_INPUT, UNTIL_WAIT_ENDED, true);
} else {
- manageEvents(EXECUTE_PLAYER_INPUT, UNTIL_MOUSE_BUTTON_UP_AND_WAIT_ENDED);
+ manageEvents(EXECUTE_PLAYER_INPUT, UNTIL_MOUSE_BUTTON_UP_AND_WAIT_ENDED, true);
}
// Get mouse position and button states
Commit: ca7569610536196f03ecfb5a980a1c66738641e5
https://github.com/scummvm/scummvm/commit/ca7569610536196f03ecfb5a980a1c66738641e5
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:37:31+01:00
Commit Message:
CINE: Fix using F3 for INVENTORY and F4 for USE.
Previously the inventory could be summoned multiple times by pressing
F3 or F4. Fix that by keeping track when the inventory has been opened
and not allowing multiple use of it simultaneously.
Changed paths:
engines/cine/main_loop.cpp
engines/cine/various.cpp
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index a743ce2e0c..4f1c1d9cff 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -103,13 +103,13 @@ static void processEvent(Common::Event &event) {
}
break;
case Common::KEYCODE_F3:
- if (allowPlayerInput) {
+ if (allowPlayerInput && !inMenu) {
playerCommand = 2; // INVENTORY
makeCommandLine();
}
break;
case Common::KEYCODE_F4:
- if (allowPlayerInput) {
+ if (allowPlayerInput && !inMenu) {
playerCommand = 3; // USE
makeCommandLine();
}
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index d9ca43334e..c0ff495ccd 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -587,6 +587,9 @@ void processInventory(int16 x, int16 y) {
for (int i = 0; i < listSize; ++i)
list.push_back(objectListCommand[i]);
SelectionMenu *menu = new SelectionMenu(Common::Point(x, y), menuWidth, list);
+
+ inMenu = true;
+
renderer->pushMenu(menu);
renderer->drawFrame();
renderer->popMenu();
@@ -594,6 +597,8 @@ void processInventory(int16 x, int16 y) {
menu = 0;
manageEvents(PROCESS_INVENTORY, UNTIL_MOUSE_BUTTON_DOWN_UP);
+
+ inMenu = false;
}
int16 buildObjectListCommand(int16 param) {
@@ -624,7 +629,9 @@ int16 selectSubObject(int16 x, int16 y, int16 param) {
}
if (disableSystemMenu == 0) {
+ inMenu = true;
selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140, 0, osExtras, osExtras);
+ inMenu = false;
}
if (selectedObject == -1)
Commit: 25e2cd34cd64974fc57eabf8a276058616e9859e
https://github.com/scummvm/scummvm/commit/25e2cd34cd64974fc57eabf8a276058616e9859e
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:38:18+01:00
Commit Message:
CINE: Try to fix bad_alloc with empty event queue
Previously I encountered an std::bad_alloc with the code in manageEvents
pushing an empty Event into the event queue. It did not happen very
often but I got it to appear while debugging at least once or maybe
twice.
This is an attempt to fix this possible behaviour by not pushing empty
events into the event queue but making sure the current status is
checked without needing to push empty events into an empty event queue.
I played through Italian Amiga version of Future Wars with this change
and encountered no problems with it.
Changed paths:
engines/cine/main_loop.cpp
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index 4f1c1d9cff..dd787bdd75 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -242,9 +242,9 @@ void manageEvents(CallSource callSource, EventTarget eventTarget, bool useMaxMou
bool updateAudio = false;
do {
- Common::Event event;
+ Common::Event event = Common::Event();
int eventsCheckedBeforePolling = eventsChecked;
- while (!foundTarget && !frameEnded && eventMan->pollEvent(event)) {
+ while (!foundTarget && !frameEnded && (eventMan->pollEvent(event) || eventsChecked == 0)) {
processEvent(event);
eventsChecked++;
maxMouseLeft = MAX<uint16>(mouseLeft, maxMouseLeft);
@@ -340,14 +340,6 @@ void manageEvents(CallSource callSource, EventTarget eventTarget, bool useMaxMou
}
foundTarget |= (checkWaitEnd && waitEnded);
-
- if (!foundTarget && eventsChecked == 0) {
- // If there are no events to check then
- // add an empty event to check the current state.
- eventMan->pushEvent(Common::Event());
- continue;
- }
-
updateScreen = updateAudio = (foundTarget || frameEnded);
if (updateScreen) {
Commit: caca1ac2f08f26fd329bf2f18e51498dd3721980
https://github.com/scummvm/scummvm/commit/caca1ac2f08f26fd329bf2f18e51498dd3721980
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:38:31+01:00
Commit Message:
CINE: Fix total playtime loading from savegame.
Total playtime is kept as milliseconds in the engine. It is saved as
seconds. Previously it was not converted to milliseconds on load but
seconds were took as milliseconds (i.e. 10s -> 10ms). Fix that by
converting total playtime on load from seconds to milliseconds.
Changed paths:
engines/cine/saveload.cpp
diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp
index 378b43f3c9..6b03f4fcd3 100644
--- a/engines/cine/saveload.cpp
+++ b/engines/cine/saveload.cpp
@@ -880,7 +880,7 @@ bool CineEngine::makeLoad(const Common::String &saveName) {
ExtendedSavegameHeader header;
if (MetaEngine::readSavegameHeader(saveFile.get(), &header)) {
- setTotalPlayTime(header.playtime);
+ setTotalPlayTime(header.playtime * 1000); // Seconds to milliseconds
}
}
Commit: 43fb440756ef9ca4b5e92a866af527471edf1cce
https://github.com/scummvm/scummvm/commit/43fb440756ef9ca4b5e92a866af527471edf1cce
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:38:43+01:00
Commit Message:
CINE: FW: Fix 8 half speed scenes (Amiga/Atari ST)
Previously there was a fix for bug #2669415
("FW: half walking speed in a screen") which only addressed a single
scene in Amiga and Atari ST versions of Future Wars.
This fix fixes half walking speed in 8 more scenes in Amiga and Atari ST
versions of Future Wars. The scenes were identified by playing through
an Italian version of Amiga Future Wars.
3 more scenes were left over with half walking speed because they could
not be fixed as easily (i.e. using this fix on them broke the scenes in
some way, made them too fast or made the people walk into wrong
positions or something else). The scenes left over are the ones using
the following background files:
- "L10.PI1": The medieval castle's hall.
- "L18.PI1": The medieval castle's teleport room.
- "L45.PI1": Space station's computer room.
Changed paths:
engines/cine/script_fw.cpp
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index f5833e4661..f7bea6c679 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -1545,14 +1545,42 @@ int FWScript::o1_break() {
// Thus the longer pause is eliminated by running only one BREAK when several
// are designated (i.e. ignoring a BREAK if there's another BREAK after it).
//
- // TODO: Check whether the speed is halved in any other scenes in Amiga/Atari ST versions under ScummVM
// TODO: Check whether the speed is halved when running the original executable under an emulator
if (g_cine->getGameType() == Cine::GType_FW &&
(g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) &&
- _pos < _script._size && _script.getByte(_pos) == (0x4F + 1) && // Is the next opcode a BREAK too?
- scumm_stricmp(currentPrcName, "PART02.PRC") == 0 &&
- scumm_stricmp(renderer->getBgName(), "L11.PI1") == 0) {
- return 0;
+ _pos < _script._size && _script.getByte(_pos) == (0x4F + 1)) { // Is the next opcode a BREAK too?
+ // Determine whether to combine breaks into a single break based on
+ // current procedure's part number (e.g. "PART02.PRC" -> 2) and the
+ // current background's number (e.g. "L11.PI1" -> 11).
+ if ((Common::matchString(currentPrcName, "PART0#.PRC", true) || // e.g. "PART03.PRC"
+ Common::matchString(currentPrcName, "PART0#?.PRC", true)) && // e.g. "PART02C.PRC"
+ (Common::matchString(renderer->getBgName(), "L#.PI1", true) ||
+ Common::matchString(renderer->getBgName(), "L##.PI1", true))) {
+ const int partNum = (currentPrcName[5] - '0'); // The single digit after "PART0" prefix
+ if (partNum >= 2 && partNum <= 4) {
+ Common::String bgName(renderer->getBgName());
+ bgName.deleteChar(0); // Remove prefix "L"
+ bgName.erase(bgName.find('.'), Common::String::npos); // Remove suffix ".PI1"
+ const int bgNum = (int)bgName.asUint64(); // The rest is the background number
+
+ // Fall through by default on each case in this switch statement:
+ switch (bgNum) {
+ case 6: // Swamp with mosquitoes
+ case 9: // Inside the medieval tavern
+ //case 10: // The medieval castle's hall (Fix breaks scene)
+ case 11: // Tree with monks habit
+ case 14: // Room with stained glass windows in monastery (Door on left)
+ case 16: // Father superior's room in monastery (Door on right)
+ //case 18: // The medieval castle's teleport room (Fix breaks scene)
+ case 21: // Sewers in the future
+ case 25: // Bathroom at the metro station
+ case 27: // Cell in the future
+ case 35: // At door of Crughons' shuttle
+ //case 45: // Space station's computer room (Fix breaks scene)
+ return 0;
+ }
+ }
+ }
}
// Jump over breaks when running only until o1_freePartRange(0, 200) in AUTO00.PRC.
Commit: 0f9dc9096d6d179ec1dfc0f9784d317b09b641ba
https://github.com/scummvm/scummvm/commit/0f9dc9096d6d179ec1dfc0f9784d317b09b641ba
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:38:51+01:00
Commit Message:
CINE: Fix loading inexistent music.
The Italian Amiga version of Future Wars tries to load music from file
"TELESONG.DAT" which does not exist. Previously after this starting to
play music might either try to play a null stream and crash or play an
old wrong music in memory. Fix that by setting the stream to null if
no music exists (Checked that the stream is destroyed i.e. the
destructor is run so it should be safe to set the _moduleStream variable
to nullptr directly).
Changed paths:
engines/cine/sound.cpp
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 2e678340a4..07f4962e3a 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -1390,11 +1390,13 @@ void PaulaSound::loadMusic(const char *name) {
Common::StackLock lock(_musicMutex);
assert(!_mixer->isSoundHandleActive(_moduleHandle));
+ bool foundFile = false;
if (_vm->getGameType() == GType_FW) {
// look for separate files
Common::File f;
if (f.open(name)) {
_moduleStream = Audio::makeSoundFxStream(&f, 0, _mixer->getOutputRate());
+ foundFile = true;
}
} else {
// look in bundle files
@@ -1407,8 +1409,19 @@ void PaulaSound::loadMusic(const char *name) {
const int periodScaleDivisor = 2;
_moduleStream = Audio::makeSoundFxStream(&s, readBundleSoundFile, _mixer->getOutputRate(), true, true, periodScaleDivisor);
free(buf);
+ foundFile = true;
}
}
+
+ if (!foundFile) {
+ warning("Unable to find music file '%s', not playing music...", name);
+
+ // Remove the old module stream so that it won't be played.
+ // Fixes not trying to play a null stream or an old wrong music in
+ // e.g. Italian version of Future Wars when first teleporting from
+ // the office to to the swamp.
+ _moduleStream = nullptr;
+ }
}
void PaulaSound::playMusic() {
Commit: 32f4459823a48d8de524cb5ca37638ccf17f8c43
https://github.com/scummvm/scummvm/commit/32f4459823a48d8de524cb5ca37638ccf17f8c43
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-10T00:39:01+01:00
Commit Message:
CINE: FW: Fix command line updating
In Future Wars the command line was not always updated and thus failed
sometimes to be up to date (i.e. showing wrong text, e.g. "EXAMINE" only
when it should have read "EXAMINE scaffolding" because the mouse cursor
was on the scaffolding).
Now we just always update the command line for both Future Wars and
Operation Stealth which seems to fix the command line updating.
I think this probably was a regression caused by adding support for
Operation Stealth (i.e. pull request #2365) and the efforts made in it
to make the user interface responsive.
Changed paths:
engines/cine/main_loop.cpp
engines/cine/various.cpp
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index dd787bdd75..0444249786 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -350,12 +350,9 @@ void manageEvents(CallSource callSource, EventTarget eventTarget, bool useMaxMou
// responsive by updating it here.
if (allowPlayerInput && playerCommand != -1 && !mouseLeft && !mouseRight) {
// A player command is given, left and right mouse buttons are up
- Common::String oldCommand = renderer->getCommand();
mousePos = eventMan->getMousePos();
playerCommandMouseLeftRightUp(mousePos.x, mousePos.y);
- if (!oldCommand.equals(renderer->getCommand())) {
- renderer->drawCommand();
- }
+ renderer->drawCommand();
}
renderer->blit();
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index c0ff495ccd..5f41b2628e 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -1102,7 +1102,20 @@ void playerCommandMouseLeftRightUp(uint16 mouseX, uint16 mouseY) {
objIdx = getObjectUnderCursor(mouseX, mouseY);
- if (g_cine->getGameType() == Cine::GType_OS || commandVar2 != objIdx) {
+ // Previously in Operation Stealth the following code was always run but in
+ // Future Wars only if commandVar2 != objIdx (Both cases based on disassembly).
+ // Trying to update the command line e.g. "EXAMINE" -> "EXAMINE scaffolding"
+ // in the manageEvents function to make the user interface responsive made a
+ // regression in Future Wars.
+ //
+ // In Future Wars the command line was not always updated and thus failed sometimes
+ // to be up to date (i.e. showing wrong text, e.g. "EXAMINE" only when it should
+ // have read "EXAMINE scaffolding" because the mouse cursor was on the scaffolding).
+ //
+ // Now we just always run this code for both Future Wars and Operation Stealth
+ // which seems to fix the command line updating.
+ const bool update = true; // Previously: g_cine->getGameType() == Cine::GType_OS || commandVar2 != objIdx
+ if (update) {
if (objIdx != -1) {
renderer->setCommand(g_cine->_commandBuffer + " " + g_cine->_objectTable[objIdx].name);
} else {
Commit: 60c56f5fcb632ff399ed7b751068f328f6b57bee
https://github.com/scummvm/scummvm/commit/60c56f5fcb632ff399ed7b751068f328f6b57bee
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-10T00:39:12+01:00
Commit Message:
GRIFFON: Fix out of bound write when loading map
This was a bug present in both the original FreeBASIC code and the
C port by Dmitry Smagin. So having no referemce, I am not completely
sure this is the correct way to fix it, but I have not detected any
issue playing the game after this change.
Changed paths:
engines/griffon/resources.cpp
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index 9211aec572..f1cfaae3c6 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -396,8 +396,8 @@ void GriffonEngine::loadMap(int mapnum) {
for (int i = 0; i < kMaxNPC; i++)
_npcInfo[i].onMap = false;
- for (int x = 0; x <= 19; x++) {
- for (int y = 0; y <= 19; y++) {
+ for (int x = 0; x <= 20; x++) {
+ for (int y = 0; y <= 14; y++) {
int d = tempmap[3 * 40 + x][y];
int npc = 0;
Commit: 85fb7172753e83f8a7b87703aa3309843be9e14e
https://github.com/scummvm/scummvm/commit/85fb7172753e83f8a7b87703aa3309843be9e14e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-10T00:39:21+01:00
Commit Message:
GRIFFON: Fix use of uninitialized variables reported by valgrind
Changed paths:
engines/griffon/resources.cpp
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index f1cfaae3c6..e48c56cb84 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -54,8 +54,18 @@ namespace Griffon {
void GriffonEngine::initialize() {
// init char *_floatstri[kMaxFloat]
- for (int i = 0; i < kMaxFloat; i++)
+ for (int i = 0; i < kMaxFloat; i++) {
_floatText[i].text = (char *)malloc(64); // 64 bytes each string (should be enough)
+ _floatText[i].framesLeft = 0;
+ _floatText[i].x = 0;
+ _floatText[i].y = 0;
+ _floatText[i].col = 0;
+
+ _floatIcon[i].framesLeft = 0;
+ _floatIcon[i].x = 0;
+ _floatIcon[i].y = 0;
+ _floatIcon[i].ico = 0;
+ }
_video = new Graphics::TransparentSurface;
_video->create(320, 240, g_system->getScreenFormat());
@@ -491,8 +501,11 @@ void GriffonEngine::loadMap(int mapnum) {
INPUT("%i", &_npcInfo[i].item3);
INPUT("%i", &_npcInfo[i].script);
+ _npcInfo[i].cframe = 0;
+ _npcInfo[i].frame = 0;
_npcInfo[i].frame2 = 0;
_npcInfo[i].attackattempt = 0;
+ _npcInfo[i].ticks = 0;
// baby dragon
if (_npcInfo[i].spriteset == kMonsterBabyDragon) {
Commit: 97a92d2030f03ba63c0aeaf03e1832aee82fc114
https://github.com/scummvm/scummvm/commit/97a92d2030f03ba63c0aeaf03e1832aee82fc114
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-10T00:39:46+01:00
Commit Message:
GUI: Fix use of uninitialized variable in ListWidget constructor
The _scrollBarWidth variable was used (to create the ScrollBarWidget)
before it was initialized.
Changed paths:
gui/widgets/list.cpp
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 2ee3a6793b..10104685fc 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -37,6 +37,7 @@ ListWidget::ListWidget(Dialog *boss, const String &name, const char *tooltip, ui
: EditableWidget(boss, name, tooltip), _cmd(cmd) {
_entriesPerPage = 0;
+ _scrollBarWidth = 0;
_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, 0, _scrollBarWidth, _h);
_scrollBar->setTarget(this);
@@ -66,8 +67,6 @@ ListWidget::ListWidget(Dialog *boss, const String &name, const char *tooltip, ui
_hlLeftPadding = _hlRightPadding = 0;
_leftPadding = _rightPadding = 0;
_topPadding = _bottomPadding = 0;
-
- _scrollBarWidth = 0;
}
ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const char *tooltip, uint32 cmd)
More information about the Scummvm-git-logs
mailing list