summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-22 17:19:41 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-22 17:19:41 -0500
commit53116b7ae344edd0ed421a466fd6ae732c2d82d8 (patch)
treef582b24e4fa8a38f3c3a03f08f1068fbd6251556 /src
parenta37e9d8030a5274072cc085db74e463eb4be0a73 (diff)
downloadkamek-53116b7ae344edd0ed421a466fd6ae732c2d82d8.tar.gz
kamek-53116b7ae344edd0ed421a466fd6ae732c2d82d8.zip
Lots of world map path rendering and movement implementations and fixes.
Diffstat (limited to '')
-rw-r--r--src/bossMegaGoomba.cpp175
-rw-r--r--src/koopatlas/core.cpp1
-rw-r--r--src/koopatlas/hud.cpp2
-rw-r--r--src/koopatlas/map.cpp100
-rw-r--r--src/koopatlas/map.h4
-rw-r--r--src/koopatlas/mapdata.cpp32
-rw-r--r--src/koopatlas/mapdata.h11
-rw-r--r--src/koopatlas/pathmanager.cpp25
-rw-r--r--src/koopatlas/pathmanager.h1
-rw-r--r--src/koopatlas/player.cpp93
10 files changed, 211 insertions, 233 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp
index d06df68..3dde8a6 100644
--- a/src/bossMegaGoomba.cpp
+++ b/src/bossMegaGoomba.cpp
@@ -120,8 +120,8 @@ class daMegaGoomba_c : public dEn_c {
DECLARE_STATE(Shrink);
DECLARE_STATE(Walk);
DECLARE_STATE(Turn);
- DECLARE_STATE(Jump);
- DECLARE_STATE(Launch);
+ // DECLARE_STATE(Jump);
+ // DECLARE_STATE(Launch);
// DECLARE_STATE(Kameck);
// DECLARE_STATE(Outro);
@@ -147,8 +147,8 @@ extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
CREATE_STATE(daMegaGoomba_c, Shrink);
CREATE_STATE(daMegaGoomba_c, Walk);
CREATE_STATE(daMegaGoomba_c, Turn);
-CREATE_STATE(daMegaGoomba_c, Jump);
-CREATE_STATE(daMegaGoomba_c, Launch);
+// CREATE_STATE(daMegaGoomba_c, Jump);
+// CREATE_STATE(daMegaGoomba_c, Launch);
// CREATE_STATE(daMegaGoomba_c, Outro);
@@ -284,7 +284,6 @@ void daMegaGoomba_c::bindAnimChr_and_setUpdateRate(const char* name, int unk, fl
void daMegaGoomba_c::dieFall_Begin() {
this->dEn_c::dieFall_Begin();
}
-//TODO make this real perty like
void daMegaGoomba_c::dieFall_Execute() {
this->timer = this->timer + 1.0;
@@ -400,9 +399,9 @@ int daMegaGoomba_c::onCreate() {
// doStateChange(&StateID_Grow);
- scale.x = 5.0;
- scale.y = 5.0;
- scale.z = 5.0;
+ scale.x = 4.0;
+ scale.y = 4.0;
+ scale.z = 4.0;
setNewActivePhysicsRect(this, &this->scale);
doStateChange(&StateID_Walk);
@@ -550,93 +549,93 @@ void daMegaGoomba_c::endState_Shrink() {
// Launch State - Launches some small goombas up in arcs
-void daMegaGoomba_c::beginState_Launch() {
- this->timer = 0.0;
- rot.y = 0x0;
-}
-void daMegaGoomba_c::executeState_Launch() {
-
- if (this->timer < 120.0) {
- // 3 shakes per second, exactly 24 shakes overall
- this->rot.y = sin(this->timer * 3.14 / 5) * 4000;
-
- dStageActor_c *spawner = NULL;
- // 120ticks / 120numbers * 3cases = 3avg kuribo
- int randChoice = GenerateRandomNumber(120);
- int randChoiceX = GenerateRandomNumber(10);
- int randChoiceY = GenerateRandomNumber(7);
- switch(randChoice) {
- case 0:
- case 1:
- spawner = CreateActor(EN_KURIBO, 0, this->pos, 0, 0);
- spawner->speed.x = randChoiceX - 5.0;
- spawner->speed.y = randChoiceY + 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- break;
- case 2:
- spawner = CreateActor(EN_BEANS_KURIBO, 0, this->pos, 0, 0);
- spawner->speed.x = randChoiceX - 5.0;
- spawner->speed.y = randChoiceY + 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- break;
- case 3:
- spawner = CreateActor(EN_PATA_KURIBO, 0, this->pos, 0, 0);
- spawner->speed.x = randChoiceX - 5.0;
- spawner->speed.y = randChoiceY + 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- break;
- default:
- break;
- };
- }
+ // void daMegaGoomba_c::beginState_Launch() {
+ // this->timer = 0.0;
+ // rot.y = 0x0;
+ // }
+ // void daMegaGoomba_c::executeState_Launch() {
+
+ // if (this->timer < 120.0) {
+ // // 3 shakes per second, exactly 24 shakes overall
+ // this->rot.y = sin(this->timer * 3.14 / 5) * 4000;
+
+ // dStageActor_c *spawner = NULL;
+ // // 120ticks / 120numbers * 3cases = 3avg kuribo
+ // int randChoice = GenerateRandomNumber(120);
+ // int randChoiceX = GenerateRandomNumber(10);
+ // int randChoiceY = GenerateRandomNumber(7);
+ // switch(randChoice) {
+ // case 0:
+ // case 1:
+ // spawner = CreateActor(EN_KURIBO, 0, this->pos, 0, 0);
+ // spawner->speed.x = randChoiceX - 5.0;
+ // spawner->speed.y = randChoiceY + 6.0;
+ // spawner->scale = (Vec){1.0, 1.0, 1.0};
+ // break;
+ // case 2:
+ // spawner = CreateActor(EN_BEANS_KURIBO, 0, this->pos, 0, 0);
+ // spawner->speed.x = randChoiceX - 5.0;
+ // spawner->speed.y = randChoiceY + 6.0;
+ // spawner->scale = (Vec){1.0, 1.0, 1.0};
+ // break;
+ // case 3:
+ // spawner = CreateActor(EN_PATA_KURIBO, 0, this->pos, 0, 0);
+ // spawner->speed.x = randChoiceX - 5.0;
+ // spawner->speed.y = randChoiceY + 6.0;
+ // spawner->scale = (Vec){1.0, 1.0, 1.0};
+ // break;
+ // default:
+ // break;
+ // };
+ // }
- if (this->timer > 150.0) { doStateChange(&StateID_Walk); }
- this->timer = this->timer + 1.0;
-}
-void daMegaGoomba_c::endState_Launch() {
- //rot.y = (this->direction) ? 0xe000 : 0x2000;
-}
+ // if (this->timer > 150.0) { doStateChange(&StateID_Walk); }
+ // this->timer = this->timer + 1.0;
+ // }
+ // void daMegaGoomba_c::endState_Launch() {
+ // //rot.y = (this->direction) ? 0xe000 : 0x2000;
+ // }
// Jump State
-void daMegaGoomba_c::beginState_Jump() {
- this->timer = 1.0;
-
- //Variables for choosing a curve
- float jump_height = this->JumpHeight;
- float delta = (this->direction) ? -JumpDist : JumpDist;
- float fullTime = this->JumpTime;
- //Key count
- Xkey_count = 2;
- Ykey_count = 3;
-
- //Initial Position
- keysX[0] = (HermiteKey){ 0.0, this->pos.x, 0.0 };
- keysY[0] = (HermiteKey){ 0.0, this->pos.y, 0.8 };
-
- //Middle Position
- keysY[1] = (HermiteKey){ (fullTime/2.0), this->pos.y + jump_height, 0.0 };
-
- //End Position
- keysX[1] = (HermiteKey){ fullTime, this->pos.x + delta, 0.0 };
- keysY[2] = (HermiteKey){ fullTime, this->pos.y, 0.8 };
-
- // using this to stop walk animation
- this->animationChr.setCurrentFrame(900.0);
-}
-void daMegaGoomba_c::executeState_Jump() {
+ // void daMegaGoomba_c::beginState_Jump() {
+ // this->timer = 1.0;
+
+ // //Variables for choosing a curve
+ // float jump_height = this->JumpHeight;
+ // float delta = (this->direction) ? -JumpDist : JumpDist;
+ // float fullTime = this->JumpTime;
+ // //Key count
+ // Xkey_count = 2;
+ // Ykey_count = 3;
+
+ // //Initial Position
+ // keysX[0] = (HermiteKey){ 0.0, this->pos.x, 0.0 };
+ // keysY[0] = (HermiteKey){ 0.0, this->pos.y, 0.8 };
+
+ // //Middle Position
+ // keysY[1] = (HermiteKey){ (fullTime/2.0), this->pos.y + jump_height, 0.0 };
+
+ // //End Position
+ // keysX[1] = (HermiteKey){ fullTime, this->pos.x + delta, 0.0 };
+ // keysY[2] = (HermiteKey){ fullTime, this->pos.y, 0.8 };
+
+ // // using this to stop walk animation
+ // this->animationChr.setCurrentFrame(900.0);
+ // }
+ // void daMegaGoomba_c::executeState_Jump() {
- this->pos.x = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count);
- this->pos.y = GetHermiteCurveValue(this->timer, this->keysY, Ykey_count);
+ // this->pos.x = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count);
+ // this->pos.y = GetHermiteCurveValue(this->timer, this->keysY, Ykey_count);
- float TimerMax = JumpTime + 1.0;
- if (this->timer > TimerMax) {
- doStateChange(&StateID_Walk);
- }
+ // float TimerMax = JumpTime + 1.0;
+ // if (this->timer > TimerMax) {
+ // doStateChange(&StateID_Walk);
+ // }
- this->timer = this->timer + 1.0;
+ // this->timer = this->timer + 1.0;
-}
-void daMegaGoomba_c::endState_Jump() { }
+ // }
+ // void daMegaGoomba_c::endState_Jump() { }
// Turn State
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index b8c9083..5f06d61 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -141,6 +141,7 @@ bool WMInit_LoadSIAnims(void *ptr) {
DVD_LoadFile(GetDVDClass(), "WorldMap", "SI_propeller", 0);
DVD_LoadFile(GetDVDClass(), "WorldMap", "SI_star", 0);
DVD_LoadFile(GetDVDClass(), "Object", "I_hammer", 0);
+ DVD_LoadFile(GetDVDClass(), "WorldMap", "cobCourse", 0);
return true;
}
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index 587c2c0..cbd7ef6 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -5,7 +5,7 @@ void CharToWChar(const char *input, wchar_t *output, int length) { for (int i =
int getStarCoinCount() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
- int coinsSpent = 0;
+ int coinsSpent = save->credits_hiscore;
int coinsEarned = 0;
for (int w = 0; w < 10; w++) {
diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp
index 9a04e65..46838d9 100644
--- a/src/koopatlas/map.cpp
+++ b/src/koopatlas/map.cpp
@@ -45,9 +45,8 @@ int dWMMap_c::onCreate() {
renderer.allocator.setup(GameHeaps[0], 0x20);
bool result = renderer.setup(&renderer.allocator);
- bgMatrix.translation(1140.0f, -2910.0f, -500.0f);
- s16 rot = 0x4000;
- bgMatrix.applyRotationX(&rot);
+ bgMatrix.identity();
+ bgMatrix.translation(0.0f, 0.0f, -500.0f);
allocator.link(-1, GameHeaps[0], 0, 0x20);
nw4r::g3d::ResFile rf(dScKoopatlas_c::instance->mapData.bgLoader.buffer);
@@ -64,6 +63,25 @@ int dWMMap_c::onCreate() {
bgSrtAnm.bindEntry(&bgModel, anmRes, 0, 0);
bgModel.bindAnim(&bgSrtAnm, 0.0f);
+
+ nw4r::g3d::ResFile rg(getResource("cobCourse", "g3d/model.brres"));
+ renderer.nodeModel.setup(rg.GetResMdl("cobCourse"), &allocator, 0x224, 1, 0);
+
+ // nw4r::g3d::ResFile rg(dScKoopatlas_c::instance->mapData.nodeLoader.buffer);
+ // rg.CheckRevision();
+ // rg.Init();
+ // rg.Bind(rg);
+
+ // nw4r::g3d::ResMdl mdl = rg.GetResMdl("cobCourse");
+ // nw4r::g3d::ResAnmVis anmResVis = rg.GetResAnmVis("cobCourse");
+
+ // renderer.nodeModel.setup(mdl, &allocator, 0x224, 1, 0);
+ renderer.nodeMatrix.identity();
+ // renderer.nodeColor.setup(mdl, anmResVis, &allocator, 0);
+ // renderer.nodeColor.bind(&renderer.nodeModel, anmResVis, 0);
+ // renderer.nodeModel.bindAnim(&renderer.nodeColor, 0.0f);
+ SetupTextures_MapObj(&renderer.nodeModel, 0);
+
allocator.unlink();
return true;
@@ -81,6 +99,18 @@ int dWMMap_c::onExecute() {
}
int dWMMap_c::onDraw() {
+
+ short rz = 0x6000;
+ short rx = 0x4000;
+ short ry = 0x8000;
+ renderer.nodeMatrix.translation(384.0, -504.0 + 4.0, 498.0);
+ renderer.nodeMatrix.applyRotationYXZ(&ry, &rx, &rz);
+ renderer.nodeModel.setDrawMatrix(renderer.nodeMatrix);
+ renderer.nodeModel.setScale(0.8f, 0.8f, 0.8f);
+ renderer.nodeModel.calcWorld(false);
+
+ renderer.nodeModel.scheduleForDrawing();
+
renderer.scheduleForDrawing();
bgModel.scheduleForDrawing();
@@ -108,17 +138,36 @@ void dWMMap_c::renderer_c::drawLayers() {
beginRendering();
+ bool cont = false;
for (int iLayer = data->layerCount - 1; iLayer >= 0; iLayer--) {
dKPLayer_s *layer = data->layers[iLayer];
renderMtx[2][3] += 2.0f;
+ cont = false;
+ for (int iNodes = dataCls->pathLayer->nodeCount - 1; iNodes >= 0; iNodes--) {
+ dKPNode_s *node = dataCls->pathLayer->nodes[iNodes];
+ bool unlock = node->isUnlocked();
+ if (!unlock) {
+ if (node->tileLayer == layer) { cont = true; break; }
+ if (node->doodadLayer == layer) { cont = true; break; }
+ }
+ }
+ for (int iPaths = dataCls->pathLayer->pathCount - 1; iPaths >= 0; iPaths--) {
+ dKPPath_s *path = dataCls->pathLayer->paths[iPaths];
+ if (!path->isAvailable) {
+ if (path->tileLayer == layer) { cont = true; break; }
+ if (path->doodadLayer == layer) { cont = true; break; }
+ }
+ }
+
+ if (cont) { continue; }
TileReport("Checking layer %d with type %d\n", iLayer, layer->type);
- if (layer->type == dKPLayer_s::OBJECTS)
+ if (layer->type == dKPLayer_s::OBJECTS)
renderTileLayer(layer, data->sectors);
else if (layer->type == dKPLayer_s::DOODADS)
renderDoodadLayer(layer);
- else if (layer->type == dKPLayer_s::PATHS)
- renderPathLayer(layer);
+ else if (layer->type == dKPLayer_s::PATHS)
+ renderPathLayer(layer);
}
endRendering();
@@ -266,13 +315,24 @@ void dWMMap_c::renderer_c::renderTileLayer(dKPLayer_s *layer, dKPLayer_s::sector
float coordY1 = yMult * (tileY + 2.0f);
float coordY2 = yMult * (tileY + 26.0f);
+
+ // GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
+ // GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_S16, 0);
+
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
+ // GXColor1u32(0xFFFFFF80);
GXPosition2s16(worldX + 24, worldY - 24);
GXTexCoord2f32(coordX2, coordY2);
+
+ // GXColor1u32(0xFFFFFF80);
GXPosition2s16(worldX + 24, worldY);
GXTexCoord2f32(coordX2, coordY1);
+
+ // GXColor1u32(0xFFFFFF80);
GXPosition2s16(worldX, worldY);
GXTexCoord2f32(coordX1, coordY1);
+
+ // GXColor1u32(0xFFFFFF80);
GXPosition2s16(worldX, worldY - 24);
GXTexCoord2f32(coordX1, coordY2);
GXEnd();
@@ -421,10 +481,10 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) {
}
void dWMMap_c::renderer_c::renderPathLayer(dKPLayer_s *layer) {
- return;
+ // return;
- // for (int i = 0; i < layer->nodeCount; i++) {
- // dKPNode_s *node = layer->nodes[i];
+ for (int i = 0; i < layer->nodeCount; i++) {
+ dKPNode_s *node = layer->nodes[i];
// int world = node->levelNumber[0];
// int level = node->levelNumber[1];
@@ -459,16 +519,22 @@ void dWMMap_c::renderer_c::renderPathLayer(dKPLayer_s *layer) {
// else
// node->color.setCurrentFrame(3); // Red
- // node->matrix.translation(node->x, node->y, 500.0);
- // node->matrix.applyRotationYXZ(0, 0, 0);
- // node->model.setDrawMatrix(node->matrix);
- // node->model.setScale(1.0f, 1.0f, 1.0f);
- // node->model.calcWorld(false);
+ if (node->type == dKPNode_s::LEVEL) {
+ float nx = (float)node->x;
+ float ny = (float)node->y;
- // node->model.scheduleForDrawing();
- // }
-}
+ // OSReport("Rendering the node @ %f, %f", nx, ny);
+
+ // nodeMatrix.translation(node->x, node->y, 498.0);
+ // nodeMatrix.applyRotationYXZ(0, 0, 0);
+ // nodeModel.setDrawMatrix(nodeMatrix);
+ // nodeModel.setScale(1.0f, 1.0f, 1.0f);
+ // nodeModel.calcWorld(false);
+ // nodeModel.scheduleForDrawing();
+ }
+ }
+}
void dWMMap_c::renderer_c::endRendering() {
diff --git a/src/koopatlas/map.h b/src/koopatlas/map.h
index e951a41..9616f5c 100644
--- a/src/koopatlas/map.h
+++ b/src/koopatlas/map.h
@@ -36,6 +36,10 @@ class dWMMap_c : public dBase_c {
void drawOpa();
void drawXlu();
+ m3d::mdl_c nodeModel;
+ m3d::anmVis_c nodeColor;
+ mMtx nodeMatrix;
+
private:
void drawLayers();
diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp
index 1fb8eb6..826d478 100644
--- a/src/koopatlas/mapdata.cpp
+++ b/src/koopatlas/mapdata.cpp
@@ -13,6 +13,14 @@ dKPPath_s *dKPNode_s::getOppositeExitTo(dKPPath_s *path) {
return 0;
}
+bool dKPNode_s::isUnlocked() {
+ for (int i = 0; i < 4; i++)
+ if (exits[i])
+ if (exits[i])
+ return true;
+ return false;
+}
+
int dKPLayer_s::findNodeID(dKPNode_s *node) {
for (int i = 0; i < nodeCount; i++)
@@ -22,10 +30,6 @@ int dKPLayer_s::findNodeID(dKPNode_s *node) {
return -1;
}
-
-
-
-
dKPMapData_c::dKPMapData_c() {
data = 0;
fixedUp = false;
@@ -144,26 +148,6 @@ void dKPMapData_c::fixup() {
if (node->type == dKPNode_s::CHANGE)
fixRef(node->destMap);
- // FORWARDS COMPATIBILITY:
- // else if (node->type == dKPNode_s::LEVEL) {
- // break;
-
- // node->allocator.link(-1, GameHeaps[0], 0, 0x20);
-
- // nw4r::g3d::ResFile rf(nodeLoader.buffer);
- // rf.CheckRevision();
- // rf.Init();
- // rf.Bind(rf);
-
- // nw4r::g3d::ResMdl mdl = rf.GetResMdl("cobCourse");
- // nw4r::g3d::ResAnmVis anmRes = rf.GetResAnmVis("cobCourse");
-
- // node->model.setup(mdl, &node->allocator, 0x224, 1, 0);
- // node->color.setup(mdl, anmRes, &node->allocator, 0);
- // node->color.bind(&node->model, anmRes, 0);
- // node->model.bindAnim(&node->color, 0.0f);
- // SetupTextures_MapObj(&node->model, 0);
- // }
}
break;
}
diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h
index 8a199a6..9f40433 100644
--- a/src/koopatlas/mapdata.h
+++ b/src/koopatlas/mapdata.h
@@ -82,15 +82,9 @@ struct dKPNode_s {
return 0;
}
- dKPPath_s *getOppositeExitTo(dKPPath_s *path);
-
-
- // FORWARDS COMPATIBILITY:
+ bool isUnlocked();
- // mHeapAllocator_c allocator;
- // m3d::mdl_c model;
- // m3d::anmVis_c color;
- // mMtx matrix;
+ dKPPath_s *getOppositeExitTo(dKPPath_s *path);
};
struct dKPPath_s {
@@ -153,7 +147,6 @@ struct dKPLayer_s {
};
};
-
int findNodeID(dKPNode_s *node);
};
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 8e0edac..cfdf2b7 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -67,6 +67,7 @@ void dWMPathManager_c::setup() {
for (int i = 0; i < pathLayer->pathCount; i++) {
dKPPath_s *path = pathLayer->paths[i];
+ OSReport("Path unlocked by %d-%d, unlock type %d, is available %d", path->unlockLevelNumber[0], path->unlockLevelNumber[1], path->unlockType, path->isAvailable);
if (path->unlockType > 0) {
u32 conds = save->GetLevelCondition(path->unlockLevelNumber[0] - 1, path->unlockLevelNumber[1] - 1);
@@ -74,6 +75,8 @@ void dWMPathManager_c::setup() {
path->isAvailable = true;
else if (path->unlockType == 2 && (conds & COND_SECRET))
path->isAvailable = true;
+ else
+ path->isAvailable = false;
}
}
SpammyReport("done\n");
@@ -105,6 +108,8 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
dWMHud_c::instance->hidePointBar();
SpammyReport("point bar hidden\n");
+ if (!path->isAvailable) { return; }
+
SpammyReport("a\n");
isMoving = true;
reverseThroughPath = (path->end == currentNode);
@@ -141,6 +146,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->rot.y = direction;
player->hasSound = false;
player->hasEffect = false;
+ moveSpeed = 3.0f;
switch (path->animation) {
@@ -177,22 +183,26 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->startAnimation(jump, 1.0, 1.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
isJumping = true;
+ moveSpeed = 2.5f;
break;
case 5:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
isJumping = true;
+ moveSpeed = 2.5f;
break;
case 6:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
isJumping = true;
+ moveSpeed = 2.5f;
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);
+ moveSpeed = 2.0f;
break;
// Climbing
@@ -201,18 +211,21 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->rot.y = 0x8000;
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB;
+ moveSpeed = 1.5f;
break;
case 9:
player->startAnimation(tree_climb, 1.2, 10.0, 0.0);
player->rot.y = 0xC000;
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB;
+ moveSpeed = 1.5f;
break;
case 10:
player->startAnimation(tree_climb, 1.2, 10.0, 0.0);
player->rot.y = 0x4000;
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB;
+ moveSpeed = 1.5f;
break;
// Others
@@ -222,6 +235,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->hasEffect = true;
player->soundName = SE_PLY_SWIM;
player->effectName = "Wm_mr_waterswim";
+ moveSpeed = 2.0f;
break;
case 13:
player->startAnimation(Tjumped, 2.0, 0.0, 0.0);
@@ -230,16 +244,19 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->startAnimation(b_dash2, 3.0, 10.0, 0.0);
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_DIRT;
+ moveSpeed = 5.0f;
break;
case 15:
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x0000;
MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1);
+ moveSpeed = 1.0f;
break;
case 16:
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x8000;
MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1);
+ moveSpeed = 0.2f;
break;
default:
OSReport("No animtaion?!");
@@ -260,7 +277,7 @@ void dWMPathManager_c::moveThroughPath() {
Vec move = (Vec){to->x - from->x, to->y - from->y, 0};
VECNormalize(&move, &move);
- VECScale(&move, &move, 3.0f);
+ VECScale(&move, &move, moveSpeed);
daWMPlayer_c *player = daWMPlayer_c::instance;
@@ -270,8 +287,10 @@ void dWMPathManager_c::moveThroughPath() {
float midpoint = (from->y + to->y) / 2;
float top, len;
- if (ys > ye) { len = ys - ye; top = ys - midpoint + 4.0; }
- else { len = ye - ys; top = ye - midpoint + 4.0; }
+ if (ys > ye) { len = ys - ye; top = ys - midpoint + 10.0; }
+ else { len = ye - ys; top = ye - midpoint + 10.0; }
+
+ if (len == 0.0) { len = 2.0; }
float a;
if (timer > 0.0) { a = -timer; }
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index 66c5e3b..0138161 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -29,6 +29,7 @@ class dWMPathManager_c {
HermiteKey keysY[3];
float timer;
bool isJumping;
+ float moveSpeed;
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 32cc684..4a15f94 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -37,8 +37,8 @@ int daWMPlayer_c::onDelete() {
int daWMPlayer_c::onExecute() {
this->modelHandler->update();
- this->modelHandler->setSRT(this->pos, this->rot, this->scale);
-
+ Vec modifiedPos = {pos.x, pos.y + jumpOffset, pos.z};
+ this->modelHandler->setSRT(modifiedPos, this->rot, this->scale);
if (hasEffect) { effect.spawn(effectName, 0, &pos, &rot, &scale); }
@@ -54,99 +54,10 @@ int daWMPlayer_c::onExecute() {
if (timer > 12) { timer = 0; }
}
- // #ifdef MARIO_OPTIONS
- // // Before we leave, do the debug movement stuff
- // int heldButtons = Remocon_GetButtons(GetActiveRemocon());
- // int nowPressed = Remocon_GetPressed(GetActiveRemocon());
- // char buf[100];
- // bool updated = false;
-
- // if (nowPressed & WPAD_LEFT) {
- // current_param--;
- // updated = true;
- // }
-
- // if (nowPressed & WPAD_RIGHT) {
- // current_param++;
- // updated = true;
- // }
-
- // if (current_param < 0)
- // current_param = 8;
-
- // if (current_param > 8)
- // current_param = 0;
-
- // float pos_mod = 0.0f;
- // short rot_mod = 0.0f;
- // float scale_mod = 0.0f;
- // if (nowPressed & WPAD_ONE) {
- // pos_mod -= 5.0f;
- // rot_mod -= 0x1000;
- // scale_mod -= 0.1f;
- // updated = true;
- // } else if (nowPressed & WPAD_TWO) {
- // pos_mod += 5.0f;
- // rot_mod += 0x1000;
- // scale_mod += 0.1f;
- // updated = true;
- // }
-
- // if (!updated) return true;
-
- // if (current_param == 0) {
- // pos.x += pos_mod;
- // sprintf(buf, "X position: %f", pos.x);
- // } else if (current_param == 1) {
- // pos.y += pos_mod;
- // sprintf(buf, "Y position: %f", pos.y);
- // } else if (current_param == 2) {
- // pos.z += pos_mod;
- // sprintf(buf, "Z position: %f", pos.z);
- // } else if (current_param == 3) {
- // rot.x += rot_mod;
- // sprintf(buf, "X rotation: 0x%04x", rot.x);
- // } else if (current_param == 4) {
- // rot.y += rot_mod;
- // sprintf(buf, "Y rotation: 0x%04x", rot.y);
- // } else if (current_param == 5) {
- // rot.z += rot_mod;
- // sprintf(buf, "Z rotation: 0x%04x", rot.z);
- // } else if (current_param == 6) {
- // scale.x += scale_mod;
- // sprintf(buf, "X scale: %f", scale.x);
- // } else if (current_param == 7) {
- // scale.y += scale_mod;
- // sprintf(buf, "Y scale: %f", scale.y);
- // } else if (current_param == 8) {
- // scale.z += scale_mod;
- // sprintf(buf, "Z scale: %f", scale.z);
- // }
-
- // dScNewerWorldMap_c::instance->SetTitle(buf);
- // #endif
-
return true;
}
int daWMPlayer_c::onDraw() {
- matrix.translation(pos.x, pos.y + jumpOffset, pos.z);
- matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z);
-
-
-
-
-
- OSReport("someVector: %f", this->modelHandler->mdlClass->someVector.x);
- this->modelHandler->mdlClass->someVector = (Vec){2.0,2.0,2.0};
-
- OSReport("someVectorB: %f", this->modelHandler->mdlClass->someVectorB.x);
- this->modelHandler->mdlClass->someVectorB = (Vec){2.0,2.0,2.0};
-
- OSReport("headOffs: %f", this->modelHandler->mdlClass->headOffs.x);
- this->modelHandler->mdlClass->headOffs = (Vec){2.0,2.0,2.0};
-
- this->modelHandler->setMatrix(matrix);
this->modelHandler->draw();
return true;