From e37a44245428c5809de867f20c6473c71c05b154 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 24 Nov 2012 04:51:54 +0100 Subject: removed 4P on map --- src/koopatlas/core.cpp | 12 ----- src/koopatlas/core.h | 2 - src/koopatlas/pathmanager.cpp | 2 - src/koopatlas/player.cpp | 69 ------------------------- src/koopatlas/player.h | 18 ------- src/koopatlas/subplayer.cpp | 116 ------------------------------------------ src/koopatlas/subplayer.h | 38 -------------- 7 files changed, 257 deletions(-) delete mode 100644 src/koopatlas/subplayer.cpp delete mode 100644 src/koopatlas/subplayer.h (limited to 'src/koopatlas') diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 89f315a..fd6eace 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -1,7 +1,6 @@ #include "koopatlas/core.h" #include "koopatlas/camera.h" #include "koopatlas/player.h" -#include "koopatlas/subplayer.h" #include "music.h" extern "C" void LoadMapScene(); @@ -253,12 +252,6 @@ bool WMInit_SetupExtra(void *ptr) { wm->player->modelHandler->mdlClass->setPowerup(Player_Powerup[0]); wm->player->modelHandler->mdlClass->startAnimation(0, 1.2f, 10.0f, 0.0f); - for (int i = 0; i < 3; i++) { - wm->subPlayer[i] = (daWMSubPlayer_c*)CreateParentedObject(WM_SUBPLAYER, wm, i+1, 2); - wm->subPlayer[i]->modelHandler->mdlClass->setPowerup(Player_Powerup[i+1]); - wm->subPlayer[i]->modelHandler->mdlClass->startAnimation(0, 1.2f, 10.0f, 0.0f); - } - // since we've got all the resources, set up the path data too SpammyReport("preparing path manager\n"); wm->pathManager.setup(); @@ -266,8 +259,6 @@ bool WMInit_SetupExtra(void *ptr) { // and put the player into position dKPNode_s *cNode = wm->pathManager.currentNode; wm->player->pos = (Vec){cNode->x, -cNode->y, wm->player->pos.z}; - for (int i = 0; i < 3; i++) - wm->subPlayer[i]->pos = (Vec){cNode->x, -cNode->y, wm->subPlayer[i]->pos.z}; // is last param correct? must check :/ SpammyReport("creating MAP\n"); @@ -709,9 +700,6 @@ void dScKoopatlas_c::executeState_PowerupsWait() { if (!STKI_SHOW(this->stockItem)) { player->modelHandler->mdlClass->setPowerup(Player_Powerup[0]); - for (int i = 0; i < 3; i++) - subPlayer[i]->modelHandler->mdlClass->setPowerup(Player_Powerup[i+1]); - state.setState(&StateID_Normal); } diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 2333c1a..651b628 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -40,7 +40,6 @@ void NewerMapDrawFunc(); #define WM_STARCOIN WM_GHOST class daWMPlayer_c; -class daWMSubPlayer_c; class dWMMap_c; class dWMHud_c; class dWMShop_c; @@ -101,7 +100,6 @@ class dScKoopatlas_c : public dScene_c { daWMPlayer_c *player; - daWMSubPlayer_c *subPlayer[3]; dWMHud_c *hud; dWMMap_c *map; dWMShop_c *shop; diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index cf0bd05..3463cac 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -590,13 +590,11 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { if (Animations[id].initialEffect) { SpawnEffect(Animations[id].initialEffect, 0, &player->pos, 0, &player->scale); - daWMPlayer_c::instance->nextNowEffect = Animations[id].initialEffect; } if (Animations[id].initialSound != SE_NULL) { nw4r::snd::SoundHandle something; PlaySoundWithFunctionB4(SoundRelatedClass, &something, Animations[id].initialSound, 1); - daWMPlayer_c::instance->nextNowSound = Animations[id].initialSound; if (Animations[id].initialSound == SE_PLY_JUMP) { nw4r::snd::SoundHandle something2; diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index 3a736b4..abfb329 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -1,5 +1,4 @@ #include "koopatlas/player.h" -#include "koopatlas/subplayer.h" daWMPlayer_c *daWMPlayer_c::instance; @@ -42,38 +41,6 @@ int daWMPlayer_c::onExecute() { dScKoopatlas_c::instance->pathManager.execute(); - // work out the Z positions first of all - struct ySortThing_s { - float y; int id; - }; - ySortThing_s sorts[4]; - sorts[0].y = pos.y; - sorts[0].id = 0; - for (int i = 1; i < 4; i++) { - sorts[i].y = stateHistory[i * SUBPLAYER_DISTANCE].pos.y; - sorts[i].id = i; - } - - // bubble sort it with an algorithm from wikipedia - bool swapped; - do { - swapped = false; - for (int i = 1; i < 4; i++) { - if (sorts[i-1].y > sorts[i].y) { - ySortThing_s forSwap = sorts[i-1]; - sorts[i-1] = sorts[i]; - sorts[i] = forSwap; - swapped = true; - } - } - } while (swapped); - - // then put together the positions - float chosenZPositions[4]; - for (int i = 0; i < 4; i++) - chosenZPositions[sorts[i].id] = 3100.0f - (i * 25.0f); - pos.z = chosenZPositions[0]; - this->modelHandler->update(); mMtx myMatrix; @@ -101,42 +68,6 @@ int daWMPlayer_c::onExecute() { if (timer > 12) { timer = 0; } } - if (stateHistoryBuilt) { - for (int i = STATE_COUNT - 1; i >= 1; i--) - stateHistory[i] = stateHistory[i - 1]; - } - - state_s *st = &stateHistory[0]; - st->pos = pos; - st->scale = scale; - st->rot = rot; - st->repeatedEffect = (hasEffect ? effectName : 0); - st->nowEffect = nextNowEffect; - st->repeatedSound = (hasSound ? soundName : 0); - st->nowSound = nextNowSound; - st->jumpOffset = jumpOffset; - st->anim = currentAnim; - st->animFrame = currentFrame; - st->animUnk = currentUnk; - st->animUpdateRate = currentUpdateRate; - - if (!stateHistoryBuilt) { - for (int i = 1; i < STATE_COUNT; i++) - stateHistory[i] = stateHistory[0]; - stateHistoryBuilt = true; - } - - nextNowEffect = 0; - nextNowSound = 0; - - for (int i = 0; i < 3; i++) { - daWMSubPlayer_c *sp = dScKoopatlas_c::instance->subPlayer[i]; - - state_s *st = &stateHistory[(i+1) * SUBPLAYER_DISTANCE]; - st->pos.z = chosenZPositions[i+1]; - sp->update(st); - } - return true; } diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h index 70d6bf5..db9b16a 100644 --- a/src/koopatlas/player.h +++ b/src/koopatlas/player.h @@ -37,24 +37,6 @@ class daWMPlayer_c : public dActor_c { static daWMPlayer_c *build(); static daWMPlayer_c *instance; - - struct state_s { - Vec pos, scale; - S16Vec rot; - const char *repeatedEffect, *nowEffect; - int repeatedSound, nowSound; - int anim; - float animFrame, animUnk, animUpdateRate; - float jumpOffset; - }; - - bool stateHistoryBuilt; - static const int SUBPLAYER_DISTANCE = 15; - static const int STATE_COUNT = (SUBPLAYER_DISTANCE * 3) + 1; - state_s stateHistory[STATE_COUNT]; - - int nextNowSound; - const char *nextNowEffect; }; #endif diff --git a/src/koopatlas/subplayer.cpp b/src/koopatlas/subplayer.cpp deleted file mode 100644 index 8f70299..0000000 --- a/src/koopatlas/subplayer.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "koopatlas/player.h" -#include "koopatlas/subplayer.h" - -daWMSubPlayer_c *daWMSubPlayer_c::instance; - -int daWMSubPlayer_c::onCreate() { - - this->modelHandler = new dPlayerModelHandler_c(settings); - // loadModel(u8 player_id, int powerup_id, int unk); - this->modelHandler->loadModel(settings, 3, 2); - this->modelHandler->mdlClass->startAnimation(0, 1.2, 10.0, 0.0); - this->modelHandler->setSRT((Vec){0.0,100.0,-100.0}, (S16Vec){0,0,0}, (Vec){2.0,2.0,2.0}); - this->modelHandler->draw(); - - hammerSuit.setup(this->modelHandler); - - pos = (Vec){0.0f,0.0f,3000.0f}; - rot = (S16Vec){0x1800,0,0}; - scale = (Vec){1.6f,1.6f,1.6f}; - - step = false; - timer = 0; - - return true; -} - -int daWMSubPlayer_c::onDelete() { - delete modelHandler; - - return true; -} - - -void daWMSubPlayer_c::update(daWMPlayer_c::state_s *st) { - this->modelHandler->update(); - - startAnimation(st->anim, st->animFrame, st->animUnk, st->animUpdateRate); - - pos = st->pos; - scale = st->scale; - rot = st->rot; - - mMtx myMatrix; - myMatrix.scale(scale.x, scale.y, scale.z); - myMatrix.applyTranslation(pos.x, pos.y + st->jumpOffset, pos.z); - myMatrix.applyRotationX(&rot.x); - myMatrix.applyRotationY(&rot.y); - // Z is unused for now - modelHandler->setMatrix(myMatrix); - - if (st->repeatedEffect) { - Vec effPos = {pos.x, pos.y, 3300.0f}; - effect.spawn(st->repeatedEffect, 0, &effPos, &rot, &scale); - } - - if (st->repeatedSound) { - timer++; - - if (timer == 12) { - if (step) { MapSoundPlayer(SoundRelatedClass, st->repeatedSound, 1); step = false; } - else { MapSoundPlayer(SoundRelatedClass, st->repeatedSound+1, 1); step = true; } - timer = 0; - } - - if (timer > 12) { timer = 0; } - } - - if (st->nowEffect) { - SpawnEffect(st->nowEffect, 0, &pos, 0, &scale); - } - - if (st->nowSound != SE_NULL) { - nw4r::snd::SoundHandle something; - PlaySoundWithFunctionB4(SoundRelatedClass, &something, st->nowSound, 1); - - if (st->nowSound == SE_PLY_JUMP) { - nw4r::snd::SoundHandle something2; - PlaySoundWithFunctionB4(SoundRelatedClass, &something2, SE_VOC_MA_CS_JUMP, 1); - } - } -} - -int daWMSubPlayer_c::onDraw() { - if (!visible) - return true; - - this->modelHandler->draw(); - hammerSuit.draw(); - - return true; -} - - -void daWMSubPlayer_c::startAnimation(int id, float frame, float unk, float updateRate) { - if (id == currentAnim && frame == currentFrame && unk == currentUnk && updateRate == currentUpdateRate) - return; - - currentAnim = id; - currentFrame = frame; - currentUnk = unk; - currentUpdateRate = updateRate; - this->modelHandler->mdlClass->startAnimation(id, frame, unk, updateRate); -} - - - -daWMSubPlayer_c *daWMSubPlayer_c::build() { - - void *buffer = AllocFromGameHeap1(sizeof(daWMSubPlayer_c)); - daWMSubPlayer_c *c = new(buffer) daWMSubPlayer_c; - - - instance = c; - return c; -} - diff --git a/src/koopatlas/subplayer.h b/src/koopatlas/subplayer.h deleted file mode 100644 index d9b1b20..0000000 --- a/src/koopatlas/subplayer.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __KOOPATLAS_SUBPLAYER_H -#define __KOOPATLAS_SUBPLAYER_H - -#include "koopatlas/core.h" -#include "poweruphax.h" -#include - - -class daWMSubPlayer_c : public dActor_c { - public: - dPlayerModelHandler_c *modelHandler; - - int onCreate(); - int onDelete(); - int onDraw(); - - void update(daWMPlayer_c::state_s *st); - - int currentAnim; - float currentFrame; - float currentUnk; - float currentUpdateRate; - - bool step; - - int timer; - - mEf::es2 effect; - dHammerSuitRenderer_c hammerSuit; - - void startAnimation(int id, float frame, float unk, float updateRate); - - static daWMSubPlayer_c *build(); - static daWMSubPlayer_c *instance; -}; - -#endif - -- cgit v1.2.3