From 3268b1fab87a34897289faa8a1f5ee0679f74e19 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Wed, 26 Sep 2012 00:37:20 -0500 Subject: Player Angles, shop lakitu improvements, and shop level node corrections --- src/koopatlas/mapdata.cpp | 2 +- src/koopatlas/pathmanager.cpp | 16 +++++++++++++++- src/koopatlas/player.cpp | 2 +- src/koopatlas/shop.cpp | 36 ++++++++++++++++++++++-------------- src/koopatlas/shop.h | 3 +++ 5 files changed, 42 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index 52a7937..cbd0c69 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -71,7 +71,7 @@ void dKPNode_s::setupNodeExtra() { } // Is it a shop? - else if (level == 41) + else if (level == 99) colour = "g3d/shop.brres"; // Is it complete? diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index e1d7993..2b85aaa 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -352,6 +352,12 @@ void dWMPathManager_c::execute() { activatePoint(); if (pressedDir >= 0) { + static u16 xangles[] = {-0,0,0x1800,-0x1800}; + daWMPlayer_c::instance->rot.x = xangles[pressedDir]; + + static u16 zangles[] = {-0x1800,0x1800,0,0}; + daWMPlayer_c::instance->rot.z = zangles[pressedDir]; + if (canUseExit(currentNode->exits[pressedDir])) { startMovementTo(currentNode->exits[pressedDir]); } else { @@ -471,6 +477,12 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { player->startAnimation(Animations[id].anim, Animations[id].animParam1, Animations[id].animParam2, 0.0f); player->rot.y = (Animations[id].forceRotation != -1) ? Animations[id].forceRotation : direction; + + OSReport("Rot.y = %08x", player->rot.y); + player->rot.x = (player->rot.y < 0) ? -((player->rot.y + 0x4000) * 0x1800 / 0x8000 * 2) : (player->rot.y - 0x4000) * 0x1800 / 0x8000 * 2; + player->rot.z = (player->rot.y < 0) ? -((player->rot.y + 0x8000) * 0x1800 / 0x8000 * 2) : (player->rot.y ) * 0x1800 / 0x8000 * 2; + + moveSpeed = (Animations[id].forceSpeed >= 0.0f) ? Animations[id].forceSpeed : 3.0f; if (Animations[id].repeatEffect) { @@ -634,7 +646,7 @@ void dWMPathManager_c::activatePoint() { int w = currentNode->levelNumber[0] - 1; int l = currentNode->levelNumber[1] - 1; - if (l == 40) { + if (l == 98) { dWMShop_c::instance->LoadShopForWorld(w); dScKoopatlas_c::instance->state.setState(&dScKoopatlas_c::instance->StateID_ShopWait); return; @@ -654,6 +666,8 @@ void dWMPathManager_c::activatePoint() { MapSoundPlayer(SoundRelatedClass, SE_SYS_GAME_START, 1); daWMPlayer_c::instance->startAnimation(170, 1.2, 10.0, 0.0); daWMPlayer_c::instance->rot.y = 0; + daWMPlayer_c::instance->rot.x = -0x1800; + daWMPlayer_c::instance->rot.z = 0; isEnteringLevel = true; levelStartWait = 40; diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index 3f791b6..97b4d8d 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -14,7 +14,7 @@ int daWMPlayer_c::onCreate() { hammerSuit.setup(this->modelHandler); pos = (Vec){0.0f,0.0f,3000.0f}; - rot = (S16Vec){0,0,0}; + rot = (S16Vec){-0x1800,0,0}; scale = (Vec){1.6f,1.6f,1.6f}; current_param = 0; diff --git a/src/koopatlas/shop.cpp b/src/koopatlas/shop.cpp index eed0222..211ab49 100644 --- a/src/koopatlas/shop.cpp +++ b/src/koopatlas/shop.cpp @@ -138,6 +138,7 @@ int dWMShop_c::onCreate() { return false; currentItem = 0; + wasOff = false; static const char *brlanNames[5] = {"shop_hitButton.brlan", "shop_offButton.brlan", "shop_onButton.brlan", "shop_inWindow.brlan", "shop_outWindow.brlan"}; static const char *groupNames[20] = {"B00_Button", "B01_Button", "B02_Button", "B03_Button", "B05_Button", "B08_Button", @@ -242,20 +243,23 @@ int dWMShop_c::onDraw() { } void dWMShop_c::specialDraw1() { - if (!isHidden) { - // Vec pos = {250.0f, 170.0f, -1000.0f}; - // S16Vec rot = {0,0,0}; - // Vec scale = {1.0f, 1.0f, 1.0f}; - // matrix.translation(pos.x, pos.y, pos.z); - // matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); - - // shopkeep.setDrawMatrix(matrix); - // shopkeep.setScale(&scale); - // shopkeep.calcWorld(false); - // shopkeep.scheduleForDrawing(); - - // if(this->ska.isAnimationDone()) - // this->ska.setCurrentFrame(0.0); + if (!isHidden && !layout.isAnimOn(18) && !layout.isAnimOn(19)) { + + Vec pos = {250.0f, 170.0f, 1000.0f}; + S16Vec rot = {0,0,0}; + Vec scale = {1.0f, 1.0f, 1.0f}; + matrix.translation(pos.x, pos.y, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + shopkeep.setDrawMatrix(matrix); + shopkeep.setScale(&scale); + shopkeep.calcWorld(false); + shopkeep.scheduleForDrawing(); + + if (wasOff) { effect.spawn("Wm_ob_greencoinkira", 0, &pos, &rot, &scale); wasOff = false; } + + if(this->ska.isAnimationDone()) + this->ska.setCurrentFrame(0.0); } return; } @@ -302,6 +306,8 @@ void dWMShop_c::LoadShopForWorld(int world) { if (!isHidden) { return; } + wasOff = true; + // Handle showing it MapSoundPlayer(SoundRelatedClass, SE_SYS_DIALOGUE_IN, 1); isHidden = false; @@ -348,6 +354,8 @@ void dWMShop_c::CloseUpShop() { changeItem(currentItem, 0); currentItem = 0; + effect.spawn("Wm_ob_greencoinkira", 0, &pos, &rot, &scale); + // itemA->Delete(); // itemB->Delete(); // itemC->Delete(); diff --git a/src/koopatlas/shop.h b/src/koopatlas/shop.h index eca02d1..cf78b36 100644 --- a/src/koopatlas/shop.h +++ b/src/koopatlas/shop.h @@ -27,8 +27,11 @@ class dWMShop_c : public dActor_c { m3d::anmChr_c ska; mMtx matrix; + mEf::es2 effect; + char currentItem; bool isHidden; + bool wasOff; int world; dShopItem *itemA; -- cgit v1.2.3