diff options
author | Filippos Karapetis | 2011-10-09 19:09:00 +0300 |
---|---|---|
committer | Filippos Karapetis | 2011-10-09 19:16:04 +0300 |
commit | d2bdcf8051d782ccd9d2d01f4dab4f0b9c5172ec (patch) | |
tree | 20cf06167dd73295e2c4267996319689bac567e8 /engines/sci | |
parent | a6884d7d691834f4e6b4c271f96d06a974cffbfc (diff) | |
download | scummvm-rg350-d2bdcf8051d782ccd9d2d01f4dab4f0b9c5172ec.tar.gz scummvm-rg350-d2bdcf8051d782ccd9d2d01f4dab4f0b9c5172ec.tar.bz2 scummvm-rg350-d2bdcf8051d782ccd9d2d01f4dab4f0b9c5172ec.zip |
SCI: Removed the old kDoAvoider code
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 14f7db47a0..649a1428a0 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -505,116 +505,6 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { } writeSelectorValue(segMan, avoider, SELECTOR(heading), avoiderHeading); return s->r_acc; - -#if 0 - reg_t client, looper, mover; - int angle; - int dx, dy; - int destx, desty; - - s->r_acc = SIGNAL_REG; - - if (!s->_segMan->isHeapObject(avoider)) { - error("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider)); - return NULL_REG; - } - - client = readSelector(segMan, avoider, SELECTOR(client)); - - if (!s->_segMan->isHeapObject(client)) { - error("DoAvoider() where client %04x:%04x is not an object", PRINT_REG(client)); - return NULL_REG; - } - - looper = readSelector(segMan, client, SELECTOR(looper)); - mover = readSelector(segMan, client, SELECTOR(mover)); - - if (!s->_segMan->isHeapObject(mover)) { - if (mover.segment) { - error("DoAvoider() where mover %04x:%04x is not an object", PRINT_REG(mover)); - } - return s->r_acc; - } - - destx = readSelectorValue(segMan, mover, SELECTOR(x)); - desty = readSelectorValue(segMan, mover, SELECTOR(y)); - - debugC(kDebugLevelBresen, "Doing avoider %04x:%04x (dest=%d,%d)", PRINT_REG(avoider), destx, desty); - - invokeSelector(s, mover, SELECTOR(doit), argc, argv); - - mover = readSelector(segMan, client, SELECTOR(mover)); - if (!mover.segment) // Mover has been disposed? - return s->r_acc; // Return gracefully. - - invokeSelector(s, client, SELECTOR(isBlocked), argc, argv); - - dx = destx - readSelectorValue(segMan, client, SELECTOR(x)); - dy = desty - readSelectorValue(segMan, client, SELECTOR(y)); - angle = getAngle(dx, dy); - - debugC(kDebugLevelBresen, "Movement (%d,%d), angle %d is %sblocked", dx, dy, angle, (s->r_acc.offset) ? " " : "not "); - - if (s->r_acc.offset) { // isBlocked() returned non-zero - int rotation = (g_sci->getRNG().getRandomBit() == 1) ? 45 : (360 - 45); // Clockwise/counterclockwise - int oldx = readSelectorValue(segMan, client, SELECTOR(x)); - int oldy = readSelectorValue(segMan, client, SELECTOR(y)); - int xstep = readSelectorValue(segMan, client, SELECTOR(xStep)); - int ystep = readSelectorValue(segMan, client, SELECTOR(yStep)); - int moves; - - debugC(kDebugLevelBresen, " avoider %04x:%04x", PRINT_REG(avoider)); - - for (moves = 0; moves < 8; moves++) { - int move_x = (int)(sin(angle * M_PI / 180.0) * (xstep)); - int move_y = (int)(-cos(angle * M_PI / 180.0) * (ystep)); - - writeSelectorValue(segMan, client, SELECTOR(x), oldx + move_x); - writeSelectorValue(segMan, client, SELECTOR(y), oldy + move_y); - - debugC(kDebugLevelBresen, "Pos (%d,%d): Trying angle %d; delta=(%d,%d)", oldx, oldy, angle, move_x, move_y); - - invokeSelector(s, client, SELECTOR(canBeHere), argc, argv); - - writeSelectorValue(segMan, client, SELECTOR(x), oldx); - writeSelectorValue(segMan, client, SELECTOR(y), oldy); - - if (s->r_acc.offset) { // We can be here - debugC(kDebugLevelBresen, "Success"); - writeSelectorValue(segMan, client, SELECTOR(heading), angle); - - return make_reg(0, angle); - } - - angle += rotation; - - if (angle > 360) - angle -= 360; - } - - error("DoAvoider failed for avoider %04x:%04x", PRINT_REG(avoider)); - } else { - int heading = readSelectorValue(segMan, client, SELECTOR(heading)); - - if (heading == -1) - return s->r_acc; // No change - - writeSelectorValue(segMan, client, SELECTOR(heading), angle); - - s->r_acc = make_reg(0, angle); - - if (looper.segment) { - reg_t params[2] = { make_reg(0, angle), client }; - invokeSelector(s, looper, SELECTOR(doit), argc, argv, 2, params); - return s->r_acc; - } else { - // No looper? Fall back to DirLoop - kDirLoopWorker(client, (uint16)angle, s, argc, argv); - } - } - - return s->r_acc; -#endif } } // End of namespace Sci |