@@ -211,27 +211,20 @@ static const LevelSelectEntry entries[] = {
211211 },
212212};
213213
214- static const char * ttcSpeeds[] = {
215- " Slow" ,
216- " Fast" ,
217- " Random" ,
218- " Stopped"
219- };
214+ static const char * ttcSpeeds[] = { " Slow" , " Fast" , " Random" , " Stopped" };
220215
221- static const char * thiSizes[] = {
222- " Tiny" , " Huge"
223- };
216+ static const char * thiSizes[] = { " Tiny" , " Huge" };
224217
225218extern " C" void initiate_warp (s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
226219
227220s32 BetterLevelSelect_UpdateArea (s16 a, s32 b) {
228- if (self.areaChanged && self.currentAreaIndex > 0 ) {
221+ if (self.areaChanged && self.currentAreaIndex > 0 ) {
229222 LevelSelectEntry entry = entries[self.currentLevelIndex ];
230223 LevelArea area = entry.areas [self.currentAreaIndex - 1 ];
231224 change_area (area.areaId );
232225 ObjectWarpNode* warpNode = area_get_warp_node (area.warpId );
233- initiate_warp (warpNode->node .destLevel & 0x7F , warpNode->node .destArea ,
234- warpNode-> node . destNode , sDelayedWarpArg );
226+ initiate_warp (warpNode->node .destLevel & 0x7F , warpNode->node .destArea , warpNode-> node . destNode ,
227+ sDelayedWarpArg );
235228 level_set_transition (2 , NULL );
236229 self.areaChanged = false ;
237230 }
@@ -240,33 +233,34 @@ s32 BetterLevelSelect_UpdateArea(s16 a, s32 b) {
240233}
241234
242235s32 BetterLevelSelect_UpdateMenu (s16 arg, s32 b) {
243- if (self.forceReload ) {
236+ if (self.forceReload ) {
244237 self.forceReload = false ;
245238 return 1 ;
246239 }
247240
248- if (arg != LVL_INTRO_LEVEL_SELECT || CVarGetInteger (CVAR_DEVELOPER_TOOLS ( " BetterLevelSelect" ) , 1 ) == 0 ){
241+ if (arg != LVL_INTRO_LEVEL_SELECT || CVarGetInteger (" gDeveloperTools. BetterLevelSelect" , 1 ) == 0 ){
249242 return lvl_intro_update (arg, b);
250243 }
251244
252245 int count = ARRAY_COUNT (entries);
253246
254247 gCurrSaveFileNum = 4 ;
255248
256- if (gPlayer1Controller ->buttonPressed & BTN_A ) {
249+ if (gPlayer1Controller ->buttonPressed & BTN_A ) {
257250 play_sound (SOUND_MENU_STAR_SOUND , gGlobalSoundSource );
258251 gCurrActNum = self.currentActIndex + 1 ;
259252 gDialogCourseActNum = gCurrActNum ;
260253 switch (entries[self.currentLevelIndex ].levelId ) {
261254 case LEVEL_TTC :
262255 gTTCSpeedSetting = self.ttcSpeedIndex ;
263256 break ;
264- default : break ;
257+ default :
258+ break ;
265259 }
266260 return entries[self.currentLevelIndex ].levelId ;
267261 }
268262
269- if (gPlayer1Controller ->buttonDown & U_JPAD ) {
263+ if (gPlayer1Controller ->buttonDown & U_JPAD ) {
270264 if (self.lockUp ) {
271265 self.timerUp = 0 ;
272266 }
@@ -277,6 +271,10 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
277271 }
278272 }
279273
274+ if (gPlayer1Controller ->buttonDown & U_JPAD && self.timerUp == 0 ) {
275+ self.verticalInput = self.update_rate * 3 ;
276+ }
277+
280278 if (gPlayer1Controller ->buttonDown & D_JPAD ) {
281279 if (self.lockDown ) {
282280 self.timerDown = 0 ;
@@ -287,59 +285,60 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
287285 self.verticalInput = -self.update_rate ;
288286 }
289287 }
290-
291- if (self.verticalInput == 0 ) {
292- self.verticalInputAccumulator = 0 ;
293- }
294288
295289 if (gPlayer1Controller ->buttonPressed & BTN_Z ) {
296290 self.currentActIndex --;
297- if (self.currentActIndex < 0 ) {
291+ if (self.currentActIndex < 0 ) {
298292 self.currentActIndex = 5 ;
299293 }
300294 }
301295
302- if (gPlayer1Controller ->buttonPressed & BTN_R ) {
296+ if (gPlayer1Controller ->buttonPressed & BTN_R ) {
303297 self.currentActIndex ++;
304298 self.currentActIndex %= 6 ;
305299 }
306300
307301 switch (entries[self.currentLevelIndex ].levelId ) {
308302 case LEVEL_TTC : {
309- if (gPlayer1Controller ->buttonPressed & L_JPAD ) {
303+ if (gPlayer1Controller ->buttonPressed & L_JPAD ) {
310304 self.ttcSpeedIndex --;
311- if (self.ttcSpeedIndex < 0 ) {
305+ if (self.ttcSpeedIndex < 0 ) {
312306 self.ttcSpeedIndex = 3 ;
313307 }
314308 }
315309
316- if (gPlayer1Controller ->buttonPressed & R_JPAD ) {
310+ if (gPlayer1Controller ->buttonPressed & R_JPAD ) {
317311 self.ttcSpeedIndex ++;
318312 self.ttcSpeedIndex %= 4 ;
319313 }
320314 break ;
321315 }
322316
323- default : break ;
317+ default :
318+ break ;
324319 }
325320
326- if (gPlayer1Controller ->buttonPressed & BTN_CLEFT ) {
321+ if (gPlayer1Controller ->buttonPressed & BTN_CLEFT ) {
327322 self.currentAreaIndex --;
328- if (self.currentAreaIndex < 0 ) {
323+ if (self.currentAreaIndex < 0 ) {
329324 self.currentAreaIndex = 0 ;
330325 }
331326 self.areaChanged = true ;
332327 }
333328
334- if (gPlayer1Controller ->buttonPressed & BTN_CRIGHT ) {
329+ if (gPlayer1Controller ->buttonPressed & BTN_CRIGHT ) {
335330 self.currentAreaIndex ++;
336331 self.currentAreaIndex %= entries[self.currentLevelIndex ].areas .size () + 1 ;
337332 self.areaChanged = true ;
338333 }
339334
335+ if (gPlayer1Controller ->buttonDown & D_JPAD && self.timerDown == 0 ) {
336+ self.verticalInput = -self.update_rate * 3 ;
337+ }
338+
340339 self.verticalInputAccumulator += self.verticalInput ;
341340
342- if (self.verticalInputAccumulator < -7 ) {
341+ if (self.verticalInputAccumulator < -7 ) {
343342 self.verticalInput = 0 ;
344343 self.verticalInputAccumulator = 0 ;
345344
@@ -355,7 +354,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
355354 }
356355 }
357356
358- if (self.verticalInputAccumulator > 7 ) {
357+ if (self.verticalInputAccumulator > 7 ) {
359358 self.verticalInput = 0 ;
360359 self.verticalInputAccumulator = 0 ;
361360
@@ -379,26 +378,26 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
379378 self.currentLevelIndex = (self.currentLevelIndex + count) % count;
380379 self.topDisplayedLevel = (self.topDisplayedLevel + count) % count;
381380
382- if (self.timerUp != 0 ) {
381+ if (self.timerUp != 0 ) {
383382 self.timerUp --;
384383 }
385384
386- if (self.timerUp == 0 ){
385+ if (self.timerUp == 0 ) {
387386 self.lockUp = false ;
388387 }
389388
390- if (self.timerDown != 0 ) {
389+ if (self.timerDown != 0 ) {
391390 self.timerDown --;
392391 }
393392
394- if (self.timerDown == 0 ){
393+ if (self.timerDown == 0 ) {
395394 self.lockDown = false ;
396395 }
397396 return 0 ;
398397}
399398
400399Gfx* BetterLevelSelect_DrawMenu (s32 state, struct GraphNode *node, UNUSED void *context) {
401- if (state != 1 || CVarGetInteger (CVAR_DEVELOPER_TOOLS ( " BetterLevelSelect" ) , 1 ) != 1 ) {
400+ if (state != 1 || CVarGetInteger (" gDeveloperTools. BetterLevelSelect" , 1 ) != 1 ) {
402401 return NULL ;
403402 }
404403
@@ -409,54 +408,48 @@ Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *
409408 gDPSetRenderMode (head++, G_RM_OPA_SURF , G_RM_OPA_SURF2 );
410409 gDPSetCycleType (head++, G_CYC_FILL );
411410 gDPSetFillColor (head++, 0x0001 );
412- gDPFillWideRectangle (head++,
413- GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE (0 ), BORDER_HEIGHT ,
414- GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE (0 ) - 1 , SCREEN_HEIGHT - BORDER_HEIGHT - 1 );
411+ gDPFillWideRectangle (head++, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE (0 ), BORDER_HEIGHT ,
412+ GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE (0 ) - 1 , SCREEN_HEIGHT - BORDER_HEIGHT - 1 );
415413 gDPSetCycleType (gDisplayListHead ++, G_CYC_1CYCLE );
416414
417415 GfxPrint_Init (&printer);
418416
419417 GfxPrint_Open (&printer, head);
420- GfxPrint_SetColor (&printer, 255 , 255 , 255 , 255 );
421- GfxPrint_SetPos (&printer, 12 , 2 );
422- GfxPrint_Printf (&printer, " Scene Selection" );
423-
424- for (int i = 0 ; i < 20 ; i++) {
425- int idx = (self.topDisplayedLevel + i + count) % count;
426- LevelSelectEntry entry = entries[idx];
427- GfxPrint_SetPos (&printer, 3 , i + 4 );
428-
429- if (idx == self.currentLevelIndex ) {
430- GfxPrint_SetColor (&printer, 255 , 100 , 100 , 255 );
431- } else {
432- GfxPrint_SetColor (&printer, 175 , 175 , 175 , 255 );
433- }
418+ GfxPrint_SetColor (&printer, 255 , 255 , 255 , 255 );
419+ GfxPrint_SetPos (&printer, 12 , 2 );
420+ GfxPrint_Printf (&printer, " Scene Selection" );
434421
435- GfxPrint_Printf (&printer, " %3d %s" , idx, language ? entry.japaneseName : entry.englishName );
422+ for (int i = 0 ; i < 20 ; i++) {
423+ int idx = (self.topDisplayedLevel + i + count) % count;
424+ LevelSelectEntry entry = entries[idx];
425+ GfxPrint_SetPos (&printer, 3 , i + 4 );
426+
427+ if (idx == self.currentLevelIndex ) {
428+ GfxPrint_SetColor (&printer, 255 , 100 , 100 , 255 );
429+ } else {
430+ GfxPrint_SetColor (&printer, 175 , 175 , 175 , 255 );
436431 }
437432
438- std::vector<const char *> acts = language ? entries[self.currentLevelIndex ].actsJp : entries[self.currentLevelIndex ].actsEn ;
433+ GfxPrint_Printf (&printer, " %3d %s" , idx, ROM_JP ? entry.japaneseName : entry.englishName );
434+ }
435+
436+ std::vector<const char *> acts = ROM_JP ? entries[self.currentLevelIndex ].actsJp : entries[self.currentLevelIndex ].actsEn ;
439437
440438 if (!acts.empty ()) {
441- int y = 25 ;
442- GfxPrint_SetPos (&printer, 2 , y);
439+ GfxPrint_SetPos (&printer, 2 , 25 );
443440 GfxPrint_SetColor (&printer, 100 , 100 , 100 , 255 );
444- GfxPrint_Printf (&printer, " (Z/R) Act:" );
441+ GfxPrint_Printf (&printer, " (Z/R)Act:" );
445442 GfxPrint_SetColor (&printer, 200 , 200 , 50 , 255 );
446443 GfxPrint_Printf (&printer, " %s" , acts[self.currentActIndex ]);
447444
445+ GfxPrint_SetPos (&printer, 2 , 26 );
448446 auto areas = entries[self.currentLevelIndex ].areas ;
449- if (entries[self.currentLevelIndex ].levelId == LEVEL_THI ) {
450- y++;
451- GfxPrint_SetPos (&printer, 2 , y);
452- GfxPrint_SetColor (&printer, 100 , 100 , 100 , 255 );
453- GfxPrint_Printf (&printer, " (C L/R) Area:" );
454- GfxPrint_SetColor (&printer, 200 , 50 , 50 , 255 );
455- GfxPrint_Printf (&printer, " %s" , self.currentAreaIndex == 0 ? " Default" : areas[self.currentAreaIndex - 1 ].name );
456- }
447+ GfxPrint_SetColor (&printer, 100 , 100 , 100 , 255 );
448+ GfxPrint_Printf (&printer, " Area:" );
449+ GfxPrint_SetColor (&printer, 200 , 50 , 50 , 255 );
450+ GfxPrint_Printf (&printer, " %s" , self.currentAreaIndex == 0 ? " Default" : areas[self.currentAreaIndex - 1 ].name );
457451
458- y++;
459- GfxPrint_SetPos (&printer, 2 , y);
452+ GfxPrint_SetPos (&printer, 2 , 27 );
460453 GfxPrint_SetColor (&printer, 100 , 100 , 100 , 255 );
461454
462455 switch (entries[self.currentLevelIndex ].levelId ) {
@@ -467,7 +460,7 @@ Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *
467460 // break;
468461 // }
469462 case LEVEL_TTC : {
470- GfxPrint_Printf (&printer, " (Dpad L/R) Speed:" );
463+ GfxPrint_Printf (&printer, " Speed:" );
471464 GfxPrint_SetColor (&printer, 55 , 200 , 50 , 255 );
472465 GfxPrint_Printf (&printer, " %s" , ttcSpeeds[self.ttcSpeedIndex ]);
473466 break ;
@@ -483,39 +476,39 @@ Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *
483476}
484477
485478static const GeoLayout BetterLevelSelect_GeoWrapper[] = {
486- GEO_NODE_SCREEN_AREA (0 , SCREEN_WIDTH /2 , SCREEN_HEIGHT /2 , SCREEN_WIDTH /2 , SCREEN_HEIGHT /2 ),
479+ GEO_NODE_SCREEN_AREA (0 , SCREEN_WIDTH / 2 , SCREEN_HEIGHT / 2 , SCREEN_WIDTH / 2 , SCREEN_HEIGHT / 2 ),
480+ GEO_OPEN_NODE (),
481+ GEO_ZBUFFER (0 ),
482+ GEO_OPEN_NODE (),
483+ GEO_NODE_ORTHO (100 ),
487484 GEO_OPEN_NODE (),
488- GEO_ZBUFFER (0 ),
489- GEO_OPEN_NODE (),
490- GEO_NODE_ORTHO (100 ),
491- GEO_OPEN_NODE (),
492- GEO_ASM (0 , BetterLevelSelect_DrawMenu),
493- GEO_CLOSE_NODE (),
494- GEO_CLOSE_NODE (),
485+ GEO_ASM (0 , BetterLevelSelect_DrawMenu),
486+ GEO_CLOSE_NODE (),
487+ GEO_CLOSE_NODE (),
495488 GEO_CLOSE_NODE (),
496489 GEO_END (),
497490};
498491
499492static void Init () {
500493 REGISTER_LISTENER (LevelScriptBeginArea, EVENT_PRIORITY_NORMAL , [](IEvent* event) {
501- LevelScriptBeginArea* ev = (LevelScriptBeginArea*) event;
494+ LevelScriptBeginArea* ev = (LevelScriptBeginArea*)event;
502495
503- if (strcmp ((char *) *ev->geoLayoutAddr , intro_geo_000414) != 0 ) {
496+ if (strcmp ((char *)*ev->geoLayoutAddr , intro_geo_000414) != 0 ) {
504497 return ;
505498 }
506499
507- if (CVarGetInteger (CVAR_DEVELOPER_TOOLS ( " BetterLevelSelect" ) , 1 ) == 0 ){
500+ if (CVarGetInteger (" gDeveloperTools. BetterLevelSelect" , 1 ) == 0 ){
508501 *ev->geoLayoutAddr = (void *) intro_geo_000414;
509502 } else {
510- *ev->geoLayoutAddr = (void *) BetterLevelSelect_GeoWrapper;
503+ *ev->geoLayoutAddr = (void *)BetterLevelSelect_GeoWrapper;
511504 }
512505 });
513506
514507 REGISTER_LISTENER (LevelScriptCallLoop, EVENT_PRIORITY_NORMAL , [](IEvent* event) {
515- LevelScriptCallLoop* ev = (LevelScriptCallLoop*) event;
508+ LevelScriptCallLoop* ev = (LevelScriptCallLoop*)event;
516509
517- if (*ev->func == lvl_intro_update) {
518- if (*ev->arg == LVL_INTRO_LEVEL_SELECT ) {
510+ if (*ev->func == lvl_intro_update) {
511+ if (*ev->arg == LVL_INTRO_LEVEL_SELECT ) {
519512 self.loaded = true ;
520513 }
521514 *ev->func = BetterLevelSelect_UpdateMenu;
@@ -524,15 +517,15 @@ static void Init() {
524517
525518 self.loaded = false ;
526519
527- if (*ev->func == lvl_init_or_update) {
520+ if (*ev->func == lvl_init_or_update) {
528521 *ev->func = BetterLevelSelect_UpdateArea;
529522 return ;
530523 }
531524 });
532525}
533526
534527void BetterLevelSelect_HandleReload () {
535- if (!self.loaded ){
528+ if (!self.loaded ) {
536529 return ;
537530 }
538531 self.forceReload = true ;
0 commit comments