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 --- include/game.h | 17 ++++++ kamek_jpn.x | 6 +++ kamek_pal.x | 6 +++ src/bonusRoom.cpp | 157 ++++++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 152 insertions(+), 34 deletions(-) diff --git a/include/game.h b/include/game.h index 61042bf..abfb495 100755 --- a/include/game.h +++ b/include/game.h @@ -1589,6 +1589,23 @@ public: void CheckCountdownTimer(); }; + +class StageActorLight { +public: + + StageActorLight(); + void init(void *allocator,int); + void update(); + void draw(); + ~StageActorLight(); + + Vec pos; + float size; + long secondClass; + long firstClass; +}; + + class fBase_c { public: u32 id; diff --git a/kamek_jpn.x b/kamek_jpn.x index 48deb24..955a496 100644 --- a/kamek_jpn.x +++ b/kamek_jpn.x @@ -307,6 +307,12 @@ SECTIONS { _Z15fBase_c__DeletePv = 0x80162320; fBase_c__Delete__FPv = 0x80162320; + __vt__15StageActorLight = 0x80317680; + init__15StageActorLight_FPvi = 0x800CCA00; + update__15StageActorLight = 0x800CCAC0; + draw__15StageActorLight = 0x800CCB70; + __dt__15StageActorLight = 0x800414A0; + GetExplanationString__7dBase_cFv = 0x8006C660; __vt__15daEnBlockMain_c = 0x80301CC8; diff --git a/kamek_pal.x b/kamek_pal.x index d2fd02f..325c218 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -307,6 +307,12 @@ SECTIONS { _Z15fBase_c__DeletePv = 0x80162650; fBase_c__Delete__FPv = 0x80162650; + __vt__15StageActorLight = 0x80317B78; + init__15StageActorLight_FPvi = 0x800CCB70; + update__15StageActorLight = 0x800CCC30; + draw__15StageActorLight = 0x800CCCE0; + __dt__15StageActorLight = 0x800414A0; + GetExplanationString__7dBase_cFv = 0x8006C660; __vt__15daEnBlockMain_c = 0x803021A8; 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