From 434630026ceec18b47c58fc81afbde1e706f8fee Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Sun, 24 Jun 2012 21:06:02 -0500 Subject: stageActorLight and junk --- src/bonusRoom.cpp | 157 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 123 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/bonusRoom.cpp b/src/bonusRoom.cpp index 6b61f27..abb81cb 100644 --- a/src/bonusRoom.cpp +++ b/src/bonusRoom.cpp @@ -84,6 +84,107 @@ const char* SAarcNameList [] = { class dSongBlock; +/*****************************************************************************/ +// The Prize Model + +class dSongPrize: public dStageActor_c { + int onCreate(); + int onDelete(); + int onExecute(); + int beforeDraw(); + int onDraw(); + + mHeapAllocator_c allocator; + nw4r::g3d::ResFile resFile; + m3d::mdl_c bodyModel; + m3d::anmChr_c aw; + + int queue; + + HermiteKey keysX[0x10]; + unsigned int Xkey_count; + HermiteKey keysY[0x10]; + unsigned int Ykey_count; + HermiteKey keysS[0x10]; + unsigned int Skey_count; + + USING_STATES(dSongPrize); + DECLARE_STATE(Wait); + + static dSongPrize *build(); +}; + +CREATE_STATE(dSongPrize, Wait); + +dSongPrize *dSongPrize::build() { + void *buffer = AllocFromGameHeap1(sizeof(dSongPrize)); + return new(buffer) dSongPrize; +} + +int dSongPrize::onCreate() { + + // Settings + int i = this->settings & 0xF; + queue = this->settings >> 16; + scale = (Vec){ 5.0, 5.0, 5.0 }; + + int p; + p = PrizePacks[prize][i]; + + // Model creation + allocator.link(-1, GameHeaps[0], 0, 0x20); + + resFile.data = getResource(Prizes[p][0], Prizes[p][1]); + nw4r::g3d::ResMdl mdl = resFile.GetResMdl(Prizes[p][2]); + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_Item(&bodyModel, 0); // 800B42B0 + + // Animation Assignment + nw4r::g3d::ResAnmChr anmChr = resFile.GetResAnmChr("wait2"); + aw.setup(mdl, anmChr, &allocator, 0); + aw.bind(&bodyModel, anmChr, 1); + bodyModel.bindAnim(&glow, 0.0); + aw.setUpdateRate(1.0); + allocator.unlink(); + + + // Change State + doStateChange(&dSongPrize::StateID_Wait); + + return true; +} + +int dSongPrize::onDelete() { return true; } + +int dSongPrize::onExecute() { + acState.execute(); + return true; +} + + +int dSongPrize::onDraw() { + matrix.translation(pos.x, pos.y, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + bodyModel.setDrawMatrix(matrix); + Vec myScale = (Vec){scale.x * 1.0, scale.y * 1.0, scale.z * 1.0}; + bodyModel.setScale(&myScale); + bodyModel.calcWorld(false); + + bodyModel.scheduleForDrawing(); + return true; +} + +void dSongPrize::beginState_Wait() {} +void dSongPrize::endState_Wait() {} +void dSongPrize::executeState_Wait() { +} + + + +/*****************************************************************************/ +// Sing Along + class dSingAlong : public dStageActor_c { public: static dSingAlong *instance; @@ -308,17 +409,6 @@ void dSingAlong::RegisterNote(int note) { } -// Game Flow -// -// 1) Intro, maybe a banner 'Match the music' -// 2) Present the prize -// 3) Play the music -// 4) Wait for responses -// 6) If failure, make prize disappear, award banked prizes, end stage, play failure music -// 7) If successful, place the prize in the bank, and proceed to step 3 on the next segment -// 8) If all things are successful, play the victory theme and award the banked prizes, end stage - - /*****************************************************************************/ // Intro CREATE_STATE(dSingAlong, Intro); @@ -402,30 +492,9 @@ void dSingAlong::executeState_Call() { if (timer == Songs[song][chorus][currentNote][1]) { OSReport("Playing Note %d", Songs[song][chorus][currentNote][0]); - // int play = Notes[Songs[song][chorus][currentNote][0]-1]; - - // if ((currentNote > 1) && - // (Notes[Songs[song][chorus][currentNote][0]-1] == Notes[Songs[song][chorus][currentNote-1][0]-1]) && - // (Notes[Songs[song][chorus][currentNote][0]-1] == Notes[Songs[song][chorus][currentNote-2][0]-1])) - // { - // SoundPlayingClass::instance3->PlaySoundAtPosition(play, &(Vec2){pos.x,pos.y}, 0); - // } - - // else if ((currentNote > 0) && (Notes[Songs[song][chorus][currentNote][0]-1] == Notes[Songs[song][chorus][currentNote-1][0]-1])) { - // SoundPlayingClass::instance2->PlaySoundAtPosition(play, &(Vec2){pos.x,pos.y}, 0); - // } - // else { - // SoundPlayingClass::instance1->PlaySoundAtPosition(play, &(Vec2){pos.x,pos.y}, 0); - // } - - SoundPlayingClass::instance1->PlaySoundAtPosition(Notes[Songs[song][chorus][currentNote][0]-1], &(Vec2){pos.x,pos.y}, 0); - - // PlaySoundAsync(this, Notes[Songs[song][chorus][currentNote][0]-1]); - - - + PlaySoundAsync(this, Notes[Songs[song][chorus][currentNote][0]-1]); currentNote += 1; - // currentNote = song[chorus][counter]; + OSReport("Next Note %d", Songs[song][chorus][currentNote][0]); if (Songs[song][chorus][currentNote][0] == 0) { @@ -535,6 +604,7 @@ public: int onCreate(); int onDelete(); int onExecute(); + int beforeDraw(); int onDraw(); mHeapAllocator_c allocator; @@ -543,6 +613,9 @@ public: m3d::mdl_c bodyModel; m3d::anmChr_c glow; + StageActorLight light; + mHeapAllocator_c allocator2; + int note; void calledWhenUpMoveExecutes(); @@ -585,6 +658,10 @@ int dSongBlock::onCreate() { glow.setUpdateRate(1.0); allocator.unlink(); + + // light.init(&allocator2, 2); + + // Block Physics blockInit(pos.y); @@ -622,6 +699,13 @@ int dSongBlock::onExecute() { physics.update(); blockUpdate(); + // light.pos.x = pos.x; + // light.pos.y = pos.y+8.0; + // light.pos.z = pos.z; + + // light.size = 226.0; + // light.update(); + // now check zone bounds based on state if (acState.getCurrentState()->isEqual(&StateID_Wait)) { checkZoneBoundaries(0); @@ -631,6 +715,11 @@ int dSongBlock::onExecute() { } +int dSongBlock::beforeDraw() { + // light.draw(); + return dStageActor_c::beforeDraw(); +} + int dSongBlock::onDraw() { // tile.x = pos.x - 8; -- cgit v1.2.3