summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorStephen Simpson <megazig@gmail.com>2011-10-10 16:04:33 -0500
committerStephen Simpson <megazig@gmail.com>2011-10-10 16:04:33 -0500
commita61758720db96f59e0fb82aab9f326d37e186a11 (patch)
tree8df4117f3723132afa42ecd35e28189b3b69196b /src/player.cpp
parent9cde0784c0d82a4e95d7ff7195537d3a519efeb9 (diff)
downloadkamek-a61758720db96f59e0fb82aab9f326d37e186a11.tar.gz
kamek-a61758720db96f59e0fb82aab9f326d37e186a11.zip
got MountainGoomba to a working condition
added Hermite Interpolation into linker and common.h added player.cpp and player.h for some common functions removed classic controller hack from NewerProject.yaml added more PSVEC functions to linker
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/player.cpp b/src/player.cpp
new file mode 100644
index 0000000..ec638d4
--- /dev/null
+++ b/src/player.cpp
@@ -0,0 +1,35 @@
+#include "player.h"
+
+// Please set your dStageActor_c's z coordinate
+// Please check return for -1
+char NearestPlayer(dStageActor_c* actor) {
+ char nearest = -1;
+ float current = 3000000.0;
+
+ OSReport("FINDING NEAREST PLAYER\n");
+ for(char ii = 0; ii < 4; ii++) {
+ OSReport("K, let's check out Player %d\n", ii);
+ dStageActor_c* player = GetSpecificPlayerActor(ii);
+ if(!player) {
+ OSReport("Player %d is NULL\n", ii);
+ continue;
+ }
+ OSReport("Player %d is ok\n", ii);
+ OSReport("[%f,%f,%f] - [%f,%f,%f]\n",
+ actor->pos.x, actor->pos.y, actor->pos.z,
+ player->pos.x, player->pos.y, player->pos.z);
+ float distance = VECDistance(&actor->pos, &player->pos);
+ OSReport("Distance: %f [%f]\n", distance, current);
+ if(distance < current) {
+ current = distance;
+ nearest = ii;
+ OSReport("Nearest is now %d\n", ii);
+ }
+ }
+ OSReport("NearestPlayer returning %d\n", nearest);
+ if(nearest < 0) {
+ OSReport("***FIX ME IMMEDIATELY***\n***NEED Z COORDINATES FOR ACTOR***\n");
+ }
+ return nearest;
+}
+