summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-20 17:49:19 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-20 17:49:19 -0500
commit228e5b26f02321bf90981879bd9781cbd91ab6a9 (patch)
tree08ab45981088abe5c5327965920b2f4dbf9e1d76 /src
parent2d39f19d92673bb9a8f12a71bbd6d86dd2166237 (diff)
downloadkamek-228e5b26f02321bf90981879bd9781cbd91ab6a9.tar.gz
kamek-228e5b26f02321bf90981879bd9781cbd91ab6a9.zip
Trying to do the damn jump code
Diffstat (limited to '')
-rw-r--r--src/bossSamurshai.cpp41
-rw-r--r--src/koopatlas/pathmanager.cpp50
-rw-r--r--src/koopatlas/pathmanager.h5
-rw-r--r--src/koopatlas/player.cpp4
4 files changed, 58 insertions, 42 deletions
diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp
index 6bcabb5..eecb799 100644
--- a/src/bossSamurshai.cpp
+++ b/src/bossSamurshai.cpp
@@ -279,7 +279,7 @@ int daSamurshai::onCreate() {
speed.x = 0.0;
speed.y = 0.0;
- XSpeed = 2.0;
+ XSpeed = 2.5;
max_speed.x = 50.0;
initialPos = pos;
topHurts = false;
@@ -419,38 +419,39 @@ void daSamurshai::updateModelMatrices() {
this->timer += 1;
OSReport("Timer: %d", timer);
- if (timer == 130) { bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 1.0); }
+ if (timer == 230) { bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 1.0); }
- if ((timer > 120) && (timer < 140)) {
+ if ((timer > 220) && (timer < 240)) {
pos.x += (224.0 / 20.0);
pos.y -= (320.0 / 20.0);
}
- if (timer == 130) {
+ if (timer == 230) {
SpawnEffect("Wm_en_hanapetal", 0, &pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5});
SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){8.0, 0.1, 1.5});
- PlaySound(this, SE_EMY_SR_KILLER_SHOT);
+ PlaySound(this, SE_OBJ_WOOD_BOX_BREAK);
+ PlaySound(this, SE_BOSS_KAMECK_DOWN);
this->Kameck->doStateChange(&daKameckDemo::StateID_DieFall);
}
- if ((timer > 130) && (timer < 190)) {
- Kameck->pos.x += (200.0 / 60.0);
- Kameck->pos.y -= (260.0 / 60.0);
+ if ((timer > 230) && (timer < 350)) {
+ Kameck->pos.x += (200.0 / 120.0);
+ Kameck->pos.y -= (260.0 / 120.0);
}
int done = 0;
- if ((timer > 260) && (done == 0)) {
+ if ((timer > 360) && (done == 0)) {
u16 amt = (this->direction == 0) ? 0x2800 : 0xD800;
done = SmoothRotation(&this->rot.y, amt, 0x2000);
}
- if (timer == 340) { bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0); }
+ if (timer == 440) { bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0); }
// if (timer == 130) { actor->Kameck->doStateChange(&daKameckDemo::StateID_DemoSt); }
// if (timer == 400) { actor->Kameck->doStateChange(&daKameckDemo::StateID_DemoSt2); }
- if (timer == 430) {
+ if (timer == 530) {
// PlaySound(this, SE_EMY_KURI_CHANGE_BIG);
doStateChange(&StateID_Walk);
}
@@ -599,7 +600,7 @@ void daSamurshai::updateModelMatrices() {
}
if(this->chrAnimation.isAnimationDone()) {
- PlaySoundAsync(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
+ PlaySoundAsync(this, SE_OBJ_WOOD_BOX_BREAK);
doStateChange(&StateID_Walk);
}
}
@@ -690,7 +691,7 @@ void daSamurshai::updateModelMatrices() {
// Uppercut State
///////////////
void daSamurshai::beginState_Uppercut() {
- bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 1.0);
+ bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 2.0);
slowDown = false;
}
void daSamurshai::executeState_Uppercut() {
@@ -706,6 +707,7 @@ void daSamurshai::updateModelMatrices() {
if (this->chrAnimation.getCurrentFrame() == 34.0) {
topHurts = true;
PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH);
+ PlaySoundAsync(this, SE_BOSS_CMN_JUMP_M);
speed.y = 4.0;
y_speed_inc = -0.1875;
@@ -733,7 +735,7 @@ void daSamurshai::updateModelMatrices() {
Knuckles.removeFromList();
}
- PlaySoundAsync(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
+ PlaySoundAsync(this, SE_OBJ_WOOD_BOX_BREAK);
topHurts = false;
}
}
@@ -817,12 +819,12 @@ void daSamurshai::updateModelMatrices() {
Knuckles.removeFromList();
SpawnEffect("Wm_ob_switch", 0, &(Vec){pos.x, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
-
+ PlaySoundAsync(this, SE_BOSS_CMN_DAMAGE_DEF);
}
void daSamurshai::executeState_Damage() {
calculateTileCollisions();
- effect.spawn("Wm_en_spindamage", 0, &(Vec){pos.x, pos.y + 24.0, 0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
+ effect.spawn("Wm_en_spindamage", 0, &(Vec){pos.x, pos.y + 40.0, 0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
if (this->chrAnimation.isAnimationDone()) {
if (timer == 0) { bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0); timer = 1; }
@@ -857,6 +859,8 @@ void daSamurshai::updateModelMatrices() {
Chuckles.removeFromList();
Knuckles.removeFromList();
+
+ PlaySoundAsync(this, SE_BOSS_CMN_DAMAGE_LAST);
}
void daSamurshai::executeState_Outro() {
@@ -870,15 +874,16 @@ void daSamurshai::updateModelMatrices() {
}
if ((chrAnimation.getCurrentFrame() == 41.0) || (chrAnimation.getCurrentFrame() == 62.0)) {
- PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH);
SpawnEffect("Wm_en_landsmoke_s", 0, &(Vec){pos.x, pos.y - 8.0, pos.z + 500.0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
}
if (chrAnimation.isAnimationDone()) {
- PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH);
SpawnEffect("Wm_ob_cmnshotstar", 0, &(Vec){pos.x + 8.0, pos.y - 8.0, pos.z + 500.0}, &(S16Vec){0,0,0}, &(Vec){1.75, 1.75, 1.75});
SpawnEffect("Wm_mr_wirehit_hit", 0, &(Vec){pos.x + 8.0, pos.y, pos.z + 500.0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
+ PlaySound(actor, STRM_BGM_SHIRO_BOSS_CLEAR);
+ MakeMarioEnterDemoMode();
+
this->dying = 1;
this->timer = 0;
}
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 6cf0750..f33bc7b 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -6,6 +6,8 @@
void dWMPathManager_c::setup() {
isMoving = false;
+ isJumping = false;
+ timer = 0.0;
currentPath = 0;
reverseThroughPath = false;
@@ -126,29 +128,15 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
SpammyReport("f\n");
daWMPlayer_c *player = daWMPlayer_c::instance;
SpammyReport("g %p\n", player);
- // path->speed
- // wait = 0,
- // walk = 1,
- // run = 2,
- // b_dash2 = 4,
-
- // jump = 5,
- // 2jmp_c_2 = 9,
- // 2jumped = 10,
-
- // tree_climb = 45,
-
- // swim_wait
- // swim_walk = 38,
+ // Consider adding these as options
// wall_walk_l = 60,
// wall_walk_r = 61,
// hang_walk_l = 65,
// hang_walk_r = 66,
- // wait, door_walk
SpammyReport("h\n");
player->rot.y = direction;
player->hasSound = false;
@@ -188,18 +176,22 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
case 4:
player->startAnimation(jump, 1.0, 1.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
break;
case 5:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
break;
case 6:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
break;
case 7:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
SpawnEffect("Wm_mr_waterwave_out", 0, &player->pos, 0, &player->scale);
break;
@@ -225,7 +217,6 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
// Others
case 12:
- OSReport("Swimming");
player->startAnimation(swim_wait, 1.2, 10.0, 0.0);
player->hasSound = true;
player->hasEffect = true;
@@ -233,23 +224,19 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->effectName = "Wm_mr_waterswim";
break;
case 13:
- OSReport("Falling");
player->startAnimation(Tjumped, 2.0, 0.0, 0.0);
break;
case 14:
- OSReport("Dashing");
player->startAnimation(b_dash2, 3.0, 10.0, 0.0);
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_DIRT;
break;
case 15:
- OSReport("Piping");
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x0000;
MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1);
break;
case 16:
- OSReport("Dooring");
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x8000;
MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1);
@@ -277,8 +264,24 @@ void dWMPathManager_c::moveThroughPath() {
daWMPlayer_c *player = daWMPlayer_c::instance;
- player->pos.x += move.x;
- player->pos.y -= move.y;
+ if (isJumping) {
+ float midpoint = (from->y + to->y) / 2;
+
+ keysY[0] = (HermiteKey){ from->y, 0.0, 1.0 };
+ keysY[1] = (HermiteKey){ midpoint, 48.0, 0.8 };
+ keysY[2] = (HermiteKey){ to->y, 0.0, 1.0 };
+
+ float modY = GetHermiteCurveValue(player->pos.y, keysY, 3);
+ OSReport("From: %f to %f, midpoint at: %f, pos at %f, Y mod: %f", from->y, to->y, midpoint, player->pos.y, modY);
+
+ player->pos.x += move.x;
+ player->pos.y -= move.y;
+ }
+
+ else {
+ player->pos.x += move.x;
+ player->pos.y -= move.y;
+ }
// Check if we've reached the end yet
if (
@@ -290,6 +293,9 @@ void dWMPathManager_c::moveThroughPath() {
player->pos.x = to->x;
player->pos.y = -to->y;
+ isJumping = false;
+ timer = 0.0;
+
SpammyReport("reached path end (%p)\n", to);
if (to->type == dKPNode_s::CHANGE) {
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index a9a04ed..66c5e3b 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -25,6 +25,11 @@ class dWMPathManager_c {
bool isMoving;
dKPNode_s *currentNode;
+ HermiteKey keysX[2];
+ HermiteKey keysY[3];
+ float timer;
+ bool isJumping;
+
dKPPath_s *currentPath;
bool reverseThroughPath; // direction we are going through the path
diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp
index c6820a0..d0ec607 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -44,13 +44,13 @@ int daWMPlayer_c::onExecute() {
if (hasSound) {
timer++;
- if (timer == 10) {
+ if (timer == 12) {
if (step) { MapSoundPlayer(SoundRelatedClass, soundName, 1); step = false; }
else { MapSoundPlayer(SoundRelatedClass, soundName+1, 1); step = true; }
timer = 0;
}
- if (timer > 10) { timer = 0; }
+ if (timer > 12) { timer = 0; }
}