aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kmovement.cpp110
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