diff options
author | Filippos Karapetis | 2009-11-14 17:53:30 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-11-14 17:53:30 +0000 |
commit | b6c46c752ccc5f5239d492c9b668ef89cd606f81 (patch) | |
tree | 198b4eb3152e3b80fbab9d0295fd1e0436227934 | |
parent | 7c73bc2965e7a90e7e7a2de012b66fd321349d31 (diff) | |
download | scummvm-rg350-b6c46c752ccc5f5239d492c9b668ef89cd606f81.tar.gz scummvm-rg350-b6c46c752ccc5f5239d492c9b668ef89cd606f81.tar.bz2 scummvm-rg350-b6c46c752ccc5f5239d492c9b668ef89cd606f81.zip |
Moved getAngle() inside kmovement.cpp, the only place where it's actually used
svn-id: r45903
-rw-r--r-- | engines/sci/engine/kmath.cpp | 20 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 23 |
2 files changed, 21 insertions, 22 deletions
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index 1e97ea09b5..dbf317860f 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -46,26 +46,6 @@ reg_t kSqrt(EngineState *s, int argc, reg_t *argv) { return make_reg(0, (int16) sqrt((float) abs(argv[0].toSint16()))); } -int get_angle(int xrel, int yrel) { - if ((xrel == 0) && (yrel == 0)) - return 0; - else { - int val = (int)(180.0 / PI * atan2((double)xrel, (double) - yrel)); - if (val < 0) - val += 360; - - // Take care of OB1 differences between SSCI and - // FSCI. SCI games sometimes check for equality with - // "round" angles - if (val % 45 == 44) - val++; - else if (val % 45 == 1) - val--; - - return val; - } -} - reg_t kGetAngle(EngineState *s, int argc, reg_t *argv) { // Based on behavior observed with a test program created with // SCI Studio. diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 7c8d070d10..935b3de8d4 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -340,7 +340,26 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { } extern void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv); -extern int get_angle(int xrel, int yrel); + +int getAngle(int xrel, int yrel) { + if ((xrel == 0) && (yrel == 0)) + return 0; + else { + int val = (int)(180.0 / PI * atan2((double)xrel, (double) - yrel)); + if (val < 0) + val += 360; + + // Take care of OB1 differences between SSCI and + // FSCI. SCI games sometimes check for equality with + // "round" angles + if (val % 45 == 44) + val++; + else if (val % 45 == 1) + val--; + + return val; + } +} reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; @@ -396,7 +415,7 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { dx = destx - GET_SEL32V(segMan, client, x); dy = desty - GET_SEL32V(segMan, client, y); - angle = get_angle(dx, dy); + angle = getAngle(dx, dy); debugC(2, kDebugLevelBresen, "Movement (%d,%d), angle %d is %sblocked\n", dx, dy, angle, (s->r_acc.offset) ? " " : "not "); |