@@ -164,25 +164,54 @@ public static CharacterImasMotionAsset LoadCamera([NotNull] string filePath) {
164164 }
165165
166166 public static ( IBodyAnimationSource , IBodyAnimationSource , IBodyAnimationSource ) LoadDance ( [ NotNull ] string filePath , int songPosition ) {
167- {
167+ IBodyAnimationSource danSource = null , apaSource = null , apgSource = null ;
168+ var danceAnimationLoaded = false ;
169+
170+ // About number of main dance animations and special/another appeal animations:
171+ // Most songs have 1 dance animation (i.e. animation for 1 idol, multiplied by 3/4/5 etc.) and 1 appeal animation
172+ // (i.e. for 1 idol when player completes FC before the big note). Or, n dance animation and n appeal animations
173+ // (e.g. 虹色letters [nijile], n=2 for position 1 and 2). Some songs have 1 dance animation and n appeal animations
174+ // (e.g. クルリウタ [kururi], n=3 for position 1, 2 and 3). Rarely a song has n dance animations and 1 appeal animation
175+ // (i.e. RE@DY!! [ready0], n=5). For each dance animation, there is a dan_ object; for each appeal animation, there
176+ // is an apa_ or apg_ object. So there isn't really a guarantee when dan, apa or apg is non-null.
177+
178+ if ( ! danceAnimationLoaded ) {
168179 // First try with legacy bundles
169180 var ( dan , apa , apg ) = LoadDanceLegacy ( filePath , songPosition ) ;
170181
171- if ( dan != null && apa != null && apg != null ) {
172- return ( new LegacyBodyAnimationSource ( dan ) , new LegacyBodyAnimationSource ( apa ) , new LegacyBodyAnimationSource ( apg ) ) ;
182+ if ( dan != null ) {
183+ danSource = new LegacyBodyAnimationSource ( dan ) ;
184+ danceAnimationLoaded = true ;
185+ }
186+
187+ if ( apa != null ) {
188+ apaSource = new LegacyBodyAnimationSource ( apa ) ;
189+ }
190+
191+ if ( apg != null ) {
192+ apgSource = new LegacyBodyAnimationSource ( apg ) ;
173193 }
174194 }
175195
176- {
196+ if ( ! danceAnimationLoaded ) {
177197 // If failed, try the new one (from ~mid 2018?)
178198 var ( dan , apa , apg ) = LoadDanceCompiled ( filePath , songPosition ) ;
179199
180- if ( dan != null && apa != null && apg != null ) {
181- return ( new CompiledBodyAnimationSource ( dan ) , new CompiledBodyAnimationSource ( apa ) , new CompiledBodyAnimationSource ( apg ) ) ;
200+ if ( dan != null ) {
201+ danSource = new CompiledBodyAnimationSource ( dan ) ;
202+ danceAnimationLoaded = true ;
203+ }
204+
205+ if ( apa != null ) {
206+ apaSource = new CompiledBodyAnimationSource ( apa ) ;
207+ }
208+
209+ if ( apg != null ) {
210+ apgSource = new CompiledBodyAnimationSource ( apg ) ;
182211 }
183212 }
184213
185- return ( null , null , null ) ;
214+ return ( danSource , apaSource , apgSource ) ;
186215 }
187216
188217 public static ( ScenarioObject , ScenarioObject , ScenarioObject ) LoadScenario ( [ NotNull ] string filePath ) {
0 commit comments