diff options
author | Filippos Karapetis | 2009-12-27 03:57:59 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-12-27 03:57:59 +0000 |
commit | ebb391790f88f4eb370764062d6bd54e4479e47f (patch) | |
tree | 52e752ec3de6cc64e838253539eead95b9c67299 /engines | |
parent | 88516633636680866d6ccb269756e81a85a7c2f4 (diff) | |
download | scummvm-rg350-ebb391790f88f4eb370764062d6bd54e4479e47f.tar.gz scummvm-rg350-ebb391790f88f4eb370764062d6bd54e4479e47f.tar.bz2 scummvm-rg350-ebb391790f88f4eb370764062d6bd54e4479e47f.zip |
SCI32: Partially implemented kOnMe. Now the main menu in GK1 works
svn-id: r46614
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index af1516f22b..513afdc67a 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -759,13 +759,23 @@ reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv) { } reg_t kOnMe(EngineState *s, int argc, reg_t *argv) { - // This kernel function looks like it calls a function in the object (arg 2) with - // the x/y coordinates supplied in args 0/1. Arg 3 seems to be 0. - - // TODO + // Tests if the cursor is on the passed object - //warning("kOnMe: (%d, %d) on object %04x:%04x", argv[0].toUint16(), argv[1].toUint16(), PRINT_REG(argv[2])); - return s->r_acc; + uint16 x = argv[0].toUint16(); + uint16 y = argv[1].toUint16(); + reg_t targetObject = argv[2]; + // TODO: argv[3] - it's usually 0 + Common::Rect nsRect; + + // Get the bounding rectangle of the object + nsRect.left = GET_SEL32V(s->_segMan, targetObject, nsLeft); + nsRect.top = GET_SEL32V(s->_segMan, targetObject, nsTop); + nsRect.right = GET_SEL32V(s->_segMan, targetObject, nsRight); + nsRect.bottom = GET_SEL32V(s->_segMan, targetObject, nsBottom); + + //warning("kOnMe: (%d, %d) on object %04x:%04x, parameter %d", argv[0].toUint16(), argv[1].toUint16(), PRINT_REG(argv[2]), argv[3].toUint16()); + + return make_reg(0, nsRect.contains(x, y)); } } // End of namespace Sci |