[Scummvm-cvs-logs] scummvm master -> c3d8f5610f6e5e4259e93b4f59fa7a8c73b7d652
bluegr
md5 at scummvm.org
Wed Mar 2 07:26:51 CET 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ed7c481e93 SCI: Cleanup
c3d8f5610f SCI: Fixed script bug #3059871 - "SCI Fanmade - Ocean Battle: Crash while playing"
Commit: ed7c481e93e7563751cd6260ee89ea29df7e4f7f
https://github.com/scummvm/scummvm/commit/ed7c481e93e7563751cd6260ee89ea29df7e4f7f
Author: md5 (md5 at scummvm.org)
Date: 2011-03-01T22:24:31-08:00
Commit Message:
SCI: Cleanup
Changed paths:
engines/sci/engine/kgraphics.cpp
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index afcc2d1..ca794e9 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -58,6 +58,17 @@
namespace Sci {
+static int16 adjustGraphColor(int16 color) {
+ // WORKAROUND: SCI1 EGA and Amiga games can set invalid colors (above 0 - 15).
+ // Colors above 15 are all white in SCI1 EGA games, which is why this was never
+ // observed. We clip them all to (0, 15) instead, as colors above 15 are used
+ // for the undithering algorithm in EGA games - bug #3048908.
+ if (getSciVersion() >= SCI_VERSION_1_EARLY && g_sci->getResMan()->getViewType() == kViewEga)
+ return color & 0x0F; // 0 - 15
+ else
+ return color;
+}
+
void showScummVMDialog(const Common::String &message) {
GUI::MessageDialog dialog(message, "OK");
dialog.runModal();
@@ -248,17 +259,10 @@ reg_t kGraphGetColorCount(EngineState *s, int argc, reg_t *argv) {
}
reg_t kGraphDrawLine(EngineState *s, int argc, reg_t *argv) {
- int16 color = argv[4].toSint16();
+ int16 color = adjustGraphColor(argv[4].toSint16());
int16 priority = (argc > 5) ? argv[5].toSint16() : -1;
int16 control = (argc > 6) ? argv[6].toSint16() : -1;
- // WORKAROUND: SCI1 EGA games can set invalid colors (above 0 - 15).
- // Colors above 15 are all white in SCI1 EGA games, which is why this was never
- // observed. We clip them all to (0, 15) instead, as colors above 15 are used
- // for the undithering algorithm in EGA games - bug #3048908.
- if (g_sci->getResMan()->getViewType() == kViewEga && getSciVersion() >= SCI_VERSION_1_EARLY)
- color &= 0x0F;
-
g_sci->_gfxPaint16->kernelGraphDrawLine(getGraphPoint(argv), getGraphPoint(argv + 2), color, priority, control);
return s->r_acc;
}
@@ -290,17 +294,10 @@ reg_t kGraphFillBoxForeground(EngineState *s, int argc, reg_t *argv) {
reg_t kGraphFillBoxAny(EngineState *s, int argc, reg_t *argv) {
Common::Rect rect = getGraphRect(argv);
int16 colorMask = argv[4].toUint16();
- int16 color = argv[5].toSint16();
+ int16 color = adjustGraphColor(argv[5].toSint16());
int16 priority = argv[6].toSint16(); // yes, we may read from stack sometimes here
int16 control = argv[7].toSint16(); // sierra did the same
- // WORKAROUND: SCI1 EGA games can set invalid colors (above 0 - 15).
- // Colors above 15 are all white in SCI1 EGA games, which is why this was never
- // observed. We clip them all to (0, 15) instead, as colors above 15 are used
- // for the undithering algorithm in EGA games - bug #3048908.
- if (g_sci->getResMan()->getViewType() == kViewEga && getSciVersion() >= SCI_VERSION_1_EARLY)
- color &= 0x0F;
-
g_sci->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
return s->r_acc;
}
@@ -1083,17 +1080,8 @@ reg_t kNewWindow(EngineState *s, int argc, reg_t *argv) {
int argextra = argc >= 13 ? 4 : 0; // Triggers in PQ3 and SCI1.1 games, argc 13 for DOS argc 15 for mac
int style = argv[5 + argextra].toSint16();
int priority = (argc > 6 + argextra) ? argv[6 + argextra].toSint16() : -1;
- int colorPen = (argc > 7 + argextra) ? argv[7 + argextra].toSint16() : 0;
- int colorBack = (argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255;
-
- // WORKAROUND: SCI1 EGA games can set invalid colors (above 0 - 15).
- // Colors above 15 are all white in SCI1 EGA games, which is why this was never
- // observed. We clip them all to (0, 15) instead, as colors above 15 are used
- // for the undithering algorithm in EGA games - bug #3048908.
- if (g_sci->getResMan()->getViewType() == kViewEga && getSciVersion() >= SCI_VERSION_1_EARLY) {
- colorPen &= 0x0F;
- colorBack &= 0x0F;
- }
+ int colorPen = adjustGraphColor((argc > 7 + argextra) ? argv[7 + argextra].toSint16() : 0);
+ int colorBack = adjustGraphColor((argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255);
// const char *title = argv[4 + argextra].segment ? kernel_dereference_char_pointer(s, argv[4 + argextra], 0) : NULL;
if (argc>=13) {
Commit: c3d8f5610f6e5e4259e93b4f59fa7a8c73b7d652
https://github.com/scummvm/scummvm/commit/c3d8f5610f6e5e4259e93b4f59fa7a8c73b7d652
Author: md5 (md5 at scummvm.org)
Date: 2011-03-01T22:25:35-08:00
Commit Message:
SCI: Fixed script bug #3059871 - "SCI Fanmade - Ocean Battle: Crash while playing"
Changed paths:
engines/sci/engine/script.cpp
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 6719b73..3c81a93 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -129,6 +129,17 @@ void Script::load(ResourceManager *resMan) {
Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, _nr), 0);
assert(script != 0);
+ uint extraLocalsWorkaround = 0;
+ if (g_sci->getGameId() == GID_FANMADE && _nr == 1 && script->size == 11140) {
+ // WORKAROUND: Script 1 in Ocean Battle doesn't have enough locals to
+ // fit the string showing how many shots are left (a nasty script bug,
+ // corrupting heap memory). We add 10 more locals so that it has enough
+ // space to use as the target for its kFormat operation. Fixes bug
+ // #3059871.
+ extraLocalsWorkaround = 10;
+ }
+ _bufSize += extraLocalsWorkaround * 2;
+
_buf = (byte *)malloc(_bufSize);
assert(_buf);
@@ -187,6 +198,9 @@ void Script::load(ResourceManager *resMan) {
_localsOffset = 24 + _numExports * 2;
}
+ // WORKAROUND: Increase locals, if needed (check above)
+ _localsCount += extraLocalsWorkaround;
+
if (getSciVersion() == SCI_VERSION_0_EARLY) {
// SCI0 early
// Old script block. There won't be a localvar block in this case.
@@ -202,7 +216,7 @@ void Script::load(ResourceManager *resMan) {
if (_localsOffset + _localsCount * 2 + 1 >= (int)_bufSize) {
error("Locals extend beyond end of script: offset %04x, count %d vs size %d", _localsOffset, _localsCount, _bufSize);
- _localsCount = (_bufSize - _localsOffset) >> 1;
+ //_localsCount = (_bufSize - _localsOffset) >> 1;
}
}
}
More information about the Scummvm-git-logs
mailing list