diff options
-rw-r--r-- | scumm/script_v6.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 336db49cea..b036184701 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -2681,13 +2681,15 @@ void ScummEngine_v6::o6_kernelGetFunctions() { // the virtual mouse coordinates, because that's what used // everywhere else in the script. - if (args[1] != -1 && args[2] != -1) { + { VirtScreen *vs = &virtscr[0]; - assert(0 <= args[1] && args[1] < vs->width); - assert(0 <= args[2] && args[2] < vs->height); - push(vs->screenPtr[args[1] + args[2] * vs->width]); - } else - push(0); + if (args[1] < 0 || args[1] >= vs->width || args[2] < 0 || args[2] >= vs->height) { + // FIXME: Until we know what to do in this case... + warning("o6_kernelGetFunctions:113: asking for pixel (%d, %d) outside of %dx%d screen", args[1], args[2], vs->width, vs->height); + push(0); + } else + push(vs->screenPtr[args[1] + args[2] * vs->width]); + } break; case 115: push(getSpecialBox(args[1], args[2])); |