@@ -104,9 +104,12 @@ void DayEndState::exec(SingleGameSection* game)
104
104
switch (mDayEndType ) {
105
105
case 0 :
106
106
MoviePlayArg arg (" s01_dayend" , const_cast <char *>(game->mCurrentCourseInfo ->mName ), game->mMovieFinishCallback , 0 );
107
+
108
+ // this is all wrong
107
109
int treasures = 0 ;
108
- // treasures += playData->mMainCropMemory->mItem.calcCollectedNum();
109
- // treasures += playData->mMainCropMemory->mOtakara.calcCollectedNum();
110
+ treasures += playData->mMainCropMemory ->mItem .calcCollectedNum ();
111
+ treasures += playData->mMainCropMemory ->mOtakara .calcCollectedNum ();
112
+
110
113
if (treasures == 0 ) {
111
114
arg.mStreamID = 0xc0011004 ;
112
115
} else if (treasures <= 14 ) {
@@ -115,30 +118,32 @@ void DayEndState::exec(SingleGameSection* game)
115
118
arg.mStreamID = 0xc0011003 ;
116
119
}
117
120
JUT_ASSERTLINE (222 , naviMgr->getAliveOrima (ALIVEORIMA_Active), " no alive:s01_dayend" );
118
- Navi* navi = naviMgr->getActiveNavi ();
119
- arg. mPelletName = nullptr ;
121
+ Navi* navi = naviMgr->getActiveNavi ();
122
+ int id = 0 ;
120
123
if (navi) {
121
- arg. mPelletName = ( char *) navi->mNaviIndex ;
122
- if (( int )arg. mPelletName == NAVIID_Captain2 && playData->isStoryFlag (STORY_DebtPaid)) {
123
- arg. mPelletName = ( char *) 2 ;
124
+ id = navi->mNaviIndex ;
125
+ if (id == NAVIID_Captain2 && playData->isStoryFlag (STORY_DebtPaid)) {
126
+ id++ ;
124
127
}
125
128
}
129
+ arg.mPelletName = (char *)id;
126
130
arg.mDelegateStart = game->mMovieStartCallback ;
127
131
moviePlayer->play (arg);
128
132
gameSystem->setPause (true , " s01_dayend" , 3 );
129
133
mStatus = 1 ;
130
134
break ;
131
135
case 1 : {
132
- MoviePlayArg arg ( " s06_dayend_pikminzero " , const_cast <char *>(game->mCurrentCourseInfo ->mName ), game-> mMovieFinishCallback ,
133
- 0 );
136
+ char * name = const_cast <char *>(game->mCurrentCourseInfo ->mName );
137
+ MoviePlayArg arg ( " s06_dayend_pikminzero " , name, game-> mMovieFinishCallback , 0 );
134
138
arg.mDelegateStart = game->mMovieStartCallback ;
135
139
moviePlayer->play (arg);
136
- gameSystem->setPause (1 , " s06_dayend" , 3 );
140
+ gameSystem->setPause (0 , " s06_dayend" , 3 );
137
141
mStatus = 1 ;
138
142
break ;
139
143
}
140
144
case 2 : {
141
- MoviePlayArg arg (" s04_dayend_orimadown" , const_cast <char *>(game->mCurrentCourseInfo ->mName ), game->mMovieFinishCallback , 0 );
145
+ char * name = const_cast <char *>(game->mCurrentCourseInfo ->mName );
146
+ MoviePlayArg arg (" s04_dayend_orimadown" , name, game->mMovieFinishCallback , 0 );
142
147
arg.mDelegateStart = game->mMovieStartCallback ;
143
148
moviePlayer->play (arg);
144
149
gameSystem->setPause (0 , " s04_dayend" , 3 );
@@ -485,7 +490,7 @@ void DayEndState::onMovieStart(SingleGameSection* game, MovieConfig* config, u32
485
490
PSMTXMultVec (mapMgr->getDemoMatrix ()->mMatrix .mtxView , &origin, &out);
486
491
origin = out;
487
492
488
- Piki* pikiBuffer[103 ];
493
+ Piki* pikiBuffer[100 ];
489
494
int i = 0 ;
490
495
Iterator<Piki> iterator (pikiMgr);
491
496
CI_LOOP (iterator)
@@ -509,6 +514,7 @@ void DayEndState::onMovieStart(SingleGameSection* game, MovieConfig* config, u32
509
514
JUT_ASSERTLINE (376 , navi, " no alive navi" );
510
515
PikiAI::ActFormationInitArg arg (navi);
511
516
piki->mNavi = navi;
517
+ arg._09 = 1 ;
512
518
piki->mBrain ->start (PikiAI::ACT_Formation, &arg);
513
519
piki->movie_begin (false );
514
520
}
@@ -967,32 +973,37 @@ void DayEndState::onMovieCommand(SingleGameSection* game, int id)
967
973
{
968
974
switch (id) {
969
975
case 1 :
970
- Vector3f origin (0 .0f );
976
+ Vector3f origin = (0 .0f );
971
977
if (mapMgr->getDemoMatrix ()) {
972
978
Matrixf* mtx = mapMgr->getDemoMatrix ();
973
979
Vector3f out;
974
980
PSMTXMultVec (mtx->mMatrix .mtxView , (Vec*)&origin, (Vec*)&out);
975
981
origin = out;
976
982
origin.y = mapMgr->getMinY (origin);
977
983
}
984
+
978
985
Sys::Sphere bounds (origin, 180 .0f );
979
986
generalEnemyMgr->createDayendEnemies (bounds);
980
- for (int i = 0 ; i <= 4 ; i++) {
981
- for (int j = 0 ; j <= 2 ; j++) {
982
- for (int k = 0 ; k < mLeftBehindPikis .getCount (i, j); k++) {
987
+
988
+ // Spawn all left behind Pikmin
989
+ for (int color = 0 ; color <= 4 ; color++) {
990
+ for (int happa = 0 ; happa <= 2 ; happa++) {
991
+ for (int i = 0 ; i < mLeftBehindPikis .getCount (color, happa); i++) {
983
992
Piki* piki = pikiMgr->birth ();
984
993
if (piki) {
985
994
PikiInitArg arg (PIKISTATE_Escape);
986
995
piki->init (&arg);
996
+
987
997
f32 angle = randFloat () * TAU;
988
- f32 zero = 0 .0f ;
989
- Vector3f pos ( cosf (angle) * 30 . 0f , origin. y + zero, sinf (angle) * 30 . 0f ) ;
998
+ Vector3f pos ( sinf (angle) * 30 . 0f , 0 .0f , cosf (angle) * 30 . 0f ) ;
999
+ pos += origin ;
990
1000
if (mapMgr) {
991
1001
pos.y = mapMgr->getMinY (pos);
992
1002
}
993
1003
piki->setPosition (pos, false );
994
- piki->changeShape (i);
995
- piki->changeHappa (j);
1004
+
1005
+ piki->changeShape (color);
1006
+ piki->changeHappa (happa);
996
1007
piki->movie_begin (false );
997
1008
}
998
1009
}
0 commit comments