summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-23 03:47:29 +0200
committerTreeki <treeki@gmail.com>2012-09-23 03:47:29 +0200
commit6130a0ee3efd6cc3987f2dcfcf26ad6208d22da5 (patch)
treefac09ab5c6dfb12d2293c7dd1136d8171e45d50e /src/koopatlas
parent888a7aacf0cc617739e891cb5774ec1da96803ed (diff)
downloadkamek-6130a0ee3efd6cc3987f2dcfcf26ad6208d22da5.tar.gz
kamek-6130a0ee3efd6cc3987f2dcfcf26ad6208d22da5.zip
Various fixes
Diffstat (limited to 'src/koopatlas')
-rw-r--r--src/koopatlas/pathmanager.cpp68
-rw-r--r--src/koopatlas/pathmanager.h3
2 files changed, 37 insertions, 34 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 300e628..4ae0b44 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -11,7 +11,6 @@ void dWMPathManager_c::setup() {
timer = 0.0;
currentPath = 0;
reverseThroughPath = false;
- beginWait = 120;
pathLayer = dScKoopatlas_c::instance->mapData.pathLayer;
@@ -285,11 +284,6 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
void dWMPathManager_c::execute() {
- if (beginWait > 0) {
- beginWait--;
- return;
- }
-
if (isEnteringLevel) {
if (levelStartWait > 0) {
levelStartWait--;
@@ -300,37 +294,14 @@ void dWMPathManager_c::execute() {
return;
}
- int nowPressed = Remocon_GetPressed(GetActiveRemocon());
-
- if (isMoving) {
- moveThroughPath();
- } else {
- // Left, right, up, down
- int pressedDir = -1;
- if (nowPressed & WPAD_LEFT) pressedDir = 0;
- else if (nowPressed & WPAD_RIGHT) pressedDir = 1;
- else if (nowPressed & WPAD_UP) pressedDir = 2;
- else if (nowPressed & WPAD_DOWN) pressedDir = 3;
- else if (nowPressed & WPAD_TWO)
- activatePoint();
-
- if (pressedDir >= 0) {
- if (canUseExit(currentNode->exits[pressedDir])) {
- startMovementTo(currentNode->exits[pressedDir]);
- } else {
- // TODO: maybe remove this? got to see how it looks
- static u16 directions[] = {-0x4000,0x4000,-0x7FFF,0};
- daWMPlayer_c::instance->rot.y = directions[pressedDir];
- }
- }
- }
-
// handle path fading
if (countdownToFadeIn > 0) {
countdownToFadeIn--;
if (countdownToFadeIn <= 0) {
unlockingAlpha = 0;
MapSoundPlayer(SoundRelatedClass, SE_SYS_NEW_POINT, 1);
+ } else {
+ return;
}
}
@@ -355,6 +326,39 @@ void dWMPathManager_c::execute() {
// we've reached the end
unlockingAlpha = -1;
MapSoundPlayer(SoundRelatedClass, SE_SYS_NEW_POINT_END, 1);
+ waitAfterUnlock = 15;
+ }
+
+ return;
+ }
+
+ if (waitAfterUnlock > 0) {
+ waitAfterUnlock--;
+ return;
+ }
+
+ int nowPressed = Remocon_GetPressed(GetActiveRemocon());
+
+ if (isMoving) {
+ moveThroughPath();
+ } else {
+ // Left, right, up, down
+ int pressedDir = -1;
+ if (nowPressed & WPAD_LEFT) pressedDir = 0;
+ else if (nowPressed & WPAD_RIGHT) pressedDir = 1;
+ else if (nowPressed & WPAD_UP) pressedDir = 2;
+ else if (nowPressed & WPAD_DOWN) pressedDir = 3;
+ else if (nowPressed & WPAD_TWO)
+ activatePoint();
+
+ if (pressedDir >= 0) {
+ if (canUseExit(currentNode->exits[pressedDir])) {
+ startMovementTo(currentNode->exits[pressedDir]);
+ } else {
+ // TODO: maybe remove this? got to see how it looks
+ static u16 directions[] = {-0x4000,0x4000,-0x7FFF,0};
+ daWMPlayer_c::instance->rot.y = directions[pressedDir];
+ }
}
}
}
@@ -456,7 +460,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->visible = (path->animation != dKPPath_s::INVISIBLE);
- int id = (path->animation < dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation;
+ int id = (path->animation >= dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation;
player->startAnimation(Animations[id].anim, Animations[id].animParam1, Animations[id].animParam2, 0.0f);
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index 6f2e763..9be8e86 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -19,8 +19,6 @@ class dWMPathManager_c {
return (path != 0) && (path->isAvailable);
}
- int beginWait;
-
void startMovementTo(dKPPath_s *path);
void moveThroughPath();
void activatePoint();
@@ -49,6 +47,7 @@ class dWMPathManager_c {
int unlockingAlpha; // -1 if not used
int countdownToFadeIn;
+ int waitAfterUnlock;
private:
void unlockPaths();