diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/koopatlas/core.cpp | 2 | ||||
-rw-r--r-- | src/koopatlas/map.cpp | 45 | ||||
-rw-r--r-- | src/koopatlas/map.h | 9 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 34 | ||||
-rw-r--r-- | src/koopatlas/player.cpp | 5 | ||||
-rw-r--r-- | src/koopatlas/player.h | 11 |
6 files changed, 95 insertions, 11 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 4cf1768..b67df2f 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -142,6 +142,7 @@ bool WMInit_LoadSIAnims(void *ptr) { DVD_LoadFile(GetDVDClass(), "Object", "I_kinoko_bundle", 0); DVD_LoadFile(GetDVDClass(), "Object", "lakitu", 0); DVD_LoadFile(GetDVDClass(), "Object", "star_coin", 0); + DVD_LoadFile(GetDVDClass(), "Object", "StarRing", 0); return true; } @@ -438,6 +439,7 @@ int dScKoopatlas_c::onDelete() { DVD_FreeFile(GetDVDClass2(), "I_kinoko_bundle"); DVD_FreeFile(GetDVDClass2(), "lakitu"); DVD_FreeFile(GetDVDClass2(), "star_coin"); + DVD_FreeFile(GetDVDClass2(), "StarRing"); mapListLoader.unload(); diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index da038c1..e12767e 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -68,6 +68,32 @@ int dWMMap_c::onCreate() { effectRenderers[i].setupEffectRenderer(&allocator, -1, EffectPrios[i], EffectGroups[i]); } + bool lsRotate = false; + switch (dScKoopatlas_c::instance->currentMapID) { + case 5: // Starry Sky + launchStarX = 5424.0f; launchStarY = -4416.0f; showLaunchStar = true; break; + case 11: // Sky City + launchStarX = 3216.0f; launchStarY = -3120.0f; showLaunchStar = true; break; + case 6: // Planet Koopa + lsRotate = true; + launchStarX = 2268.0f; launchStarY = -3420.0f; showLaunchStar = true; break; + } + if (showLaunchStar) { + nw4r::g3d::ResFile lsRes(getResource("StarRing", "g3d/StarRing.brres")); + nw4r::g3d::ResMdl lsMdl = lsRes.GetResMdl("StarRing"); + launchStarModel.setup(lsMdl, &allocator, 0x32C, 1, 0); + + nw4r::g3d::ResAnmChr lsAnm = lsRes.GetResAnmChr("StarRing_wait"); + launchStarAnm.setup(lsMdl, lsAnm, &allocator, 0); + + launchStarAnm.bind(&launchStarModel, lsAnm, false); + launchStarModel.bindAnim(&launchStarAnm); + + launchStarMatrix.translation(launchStarX, launchStarY, 1000.0f); + S16Vec lsRot = {0x2000, lsRotate ? 0x6200 : -0x5C00, 0}; + launchStarMatrix.applyRotationYXZ(&lsRot.x, &lsRot.y, &lsRot.z); + } + allocator.unlink(); return true; @@ -83,6 +109,14 @@ int dWMMap_c::onExecute() { doEffects(); + if (showLaunchStar) { + launchStarAnm.process(); + launchStarModel._vf1C(); + launchStarModel.setDrawMatrix(launchStarMatrix); + launchStarModel.setScale(0.035f, 0.035f, 0.035f); + launchStarModel.calcWorld(false); + } + return true; } @@ -91,6 +125,9 @@ int dWMMap_c::onDraw() { renderer.scheduleForDrawing(); bgModel.scheduleForDrawing(); + if (showLaunchStar) + launchStarModel.scheduleForDrawing(); + for (int i = 0; i < EFFECT_RENDERER_COUNT; i++) { effectRenderers[i].scheduleForDrawing(); } @@ -574,3 +611,11 @@ void dWMMap_c::doEffects() { } + +void dWMMap_c::spinLaunchStar() { + nw4r::g3d::ResFile lsRes(getResource("StarRing", "g3d/StarRing.brres")); + nw4r::g3d::ResAnmChr lsAnm = lsRes.GetResAnmChr("StarRing_shot"); + launchStarAnm.bind(&launchStarModel, lsAnm, false); + launchStarModel.bindAnim(&launchStarAnm); +} + diff --git a/src/koopatlas/map.h b/src/koopatlas/map.h index 8469afa..05833a2 100644 --- a/src/koopatlas/map.h +++ b/src/koopatlas/map.h @@ -68,7 +68,14 @@ class dWMMap_c : public dBase_c { m3d::mdl_c bgModel; m3d::anmTexSrt_c bgSrtAnm; mMtx bgMatrix; - S16Vec thing; + + bool showLaunchStar; + float launchStarX, launchStarY; + m3d::mdl_c launchStarModel; + m3d::anmChr_c launchStarAnm; + mMtx launchStarMatrix; + + void spinLaunchStar(); void renderPathLayer(dKPLayer_s *layer); diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index d55ad12..00e1bef 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -2,6 +2,7 @@ #include "koopatlas/core.h" #include "koopatlas/hud.h" #include "koopatlas/player.h" +#include "koopatlas/map.h" #include <sfx.h> #include <stage.h> @@ -821,7 +822,7 @@ void dWMPathManager_c::execute() { } 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]; + daWMPlayer_c::instance->setTargetRotY(directions[pressedDir]); } } else if (nowPressed & WPAD_TWO) { activatePoint(); @@ -881,7 +882,9 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { {jump,1.0f,1.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0}, {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0}, {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0}, - {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,"Wm_mr_waterwave_out"}, + + // Jump water (actually cannon) + {dm_notice,1.0f,10.0f, -1,-1.0f, SE_NULL,SE_VOC_MA_CANNON_SHOT, 0,0}, // Ladder up, left, right {pea_plant,1.2f,10.0f, -0x7FFF,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, @@ -904,13 +907,15 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { // Enter cave, this is handled specially {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, - {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, + + // Cannon 2 + {dm_noti_wait,1.0f,10.0f, -1,-1.0f, SE_NULL,SE_VOC_MA_CANNON_SHOT, 0,0}, // Invisible, this is handled specially {wait,2.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, }; - isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_WATER); + isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_SAND); float playerScale = 1.6f; @@ -938,16 +943,25 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { whichAnim = P_slip; } - player->startAnimation(whichAnim, updateRate, Animations[id].animParam2, 0.0f); - if (Animations[id].forceRotation != -1) { forcedRotation = true; - player->rot.y = Animations[id].forceRotation; + player->setTargetRotY(Animations[id].forceRotation); + } else if (id == dKPPath_s::JUMP_WATER || id == dKPPath_s::RESERVED_18) { + // keep the current rotation + forcedRotation = true; + PlayerAnimStates[dm_notice].playsOnce = 0; + + nw4r::snd::SoundHandle something; + PlaySoundWithFunctionB4(SoundRelatedClass, &something, SE_OBJ_WARP_CANNON_SHOT, 1); + + dWMMap_c::instance->spinLaunchStar(); } else { forcedRotation = false; - player->rot.y = direction; + player->setTargetRotY(direction); } + player->startAnimation(whichAnim, updateRate, Animations[id].animParam2, 0.0f); + moveSpeed = (Animations[id].forceSpeed >= 0.0f) ? Animations[id].forceSpeed : 3.0f; moveSpeed = path->speed * moveSpeed; if (path->animation == dKPPath_s::SWIM) { @@ -1051,7 +1065,7 @@ void dWMPathManager_c::moveThroughPath(int pressedDir) { if (allowed) { reverseThroughPath = !reverseThroughPath; if (!forcedRotation) - player->rot.y += 0x8000; + player->setTargetRotY(player->targetRotY + 0x8000); // start over with the reversed path! moveThroughPath(-1); return; @@ -1332,7 +1346,7 @@ void dWMPathManager_c::activatePoint() { PlaySoundWithFunctionB4(SoundRelatedClass, &something2, (Player_Powerup[0] == 3) ? SE_VOC_MA_PLAYER_DECIDE_MAME: SE_VOC_MA_CS_COURSE_IN, 1); daWMPlayer_c::instance->startAnimation(course_in, 1.2, 10.0, 0.0); - daWMPlayer_c::instance->rot.y = 0; + daWMPlayer_c::instance->setTargetRotY(0); isEnteringLevel = true; levelStartWait = 40; diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index a087cce..1c68222 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -68,6 +68,11 @@ int daWMPlayer_c::onExecute() { dKPMusic::playStarMusic(); } + if (spinning) + rot.y += 0xC00; + else + SmoothRotation(&rot.y, targetRotY, 0xC00); + if (dScKoopatlas_c::instance->mapIsRunning()) dScKoopatlas_c::instance->pathManager.execute(); diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h index 074c72d..1fa07b5 100644 --- a/src/koopatlas/player.h +++ b/src/koopatlas/player.h @@ -33,6 +33,17 @@ class daWMPlayer_c : public dActor_c { mEf::es2 effect; dHammerSuitRenderer_c hammerSuit; + bool spinning; + s16 targetRotY; + + void setTargetRotY(s16 value) { + targetRotY = value; + spinning = false; + } + void setSpinning() { + spinning = true; + } + mHeapAllocator_c allocator; m3d::anmTexPat_c pats[4]; void bindPats(); |