[Scummvm-cvs-logs] SF.net SVN: scummvm:[45903] scummvm/trunk/engines/sci/engine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sat Nov 14 18:53:31 CET 2009
Revision: 45903
http://scummvm.svn.sourceforge.net/scummvm/?rev=45903&view=rev
Author: thebluegr
Date: 2009-11-14 17:53:30 +0000 (Sat, 14 Nov 2009)
Log Message:
-----------
Moved getAngle() inside kmovement.cpp, the only place where it's actually used
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kmath.cpp
scummvm/trunk/engines/sci/engine/kmovement.cpp
Modified: scummvm/trunk/engines/sci/engine/kmath.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmath.cpp 2009-11-14 16:19:25 UTC (rev 45902)
+++ scummvm/trunk/engines/sci/engine/kmath.cpp 2009-11-14 17:53:30 UTC (rev 45903)
@@ -46,26 +46,6 @@
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.
Modified: scummvm/trunk/engines/sci/engine/kmovement.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmovement.cpp 2009-11-14 16:19:25 UTC (rev 45902)
+++ scummvm/trunk/engines/sci/engine/kmovement.cpp 2009-11-14 17:53:30 UTC (rev 45903)
@@ -340,8 +340,27 @@
}
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;
reg_t avoider = argv[0];
@@ -396,7 +415,7 @@
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 ");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list