@@ -501,6 +501,7 @@ function start.f_setStage(num, assigned)
501501 end
502502 end
503503 selectStage (num )
504+ main .f_preloadBoostStage (num )
504505 return num
505506end
506507
@@ -1699,6 +1700,9 @@ function start.f_selectMode()
16991700 start .f_selectReset (true )
17001701 while true do
17011702 -- select screen
1703+ if gameOption (' Config.BootLoadingMode' ) == 1 then
1704+ main .f_waitForPreloads ()
1705+ end
17021706 if not start .f_selectScreen () then
17031707 sndPlay (motif .Snd , motif .select_info .cancel .snd [1 ], motif .select_info .cancel .snd [2 ])
17041708 bgReset (motif [main .background ].BGDef )
@@ -1873,6 +1877,12 @@ function start.f_selectReset(hardReset, preserveProgress)
18731877 t_reservedChars = {{}, {}}
18741878 cursorActive = {}
18751879 cursorDone = {}
1880+ if main .preload ~= nil and main .preload .charHighlight ~= nil then
1881+ for _ , ref in pairs (main .preload .charHighlight ) do
1882+ queueCharPreload (ref , 1 )
1883+ end
1884+ main .preload .charHighlight = {}
1885+ end
18761886 t_portraitPriority = {1 , 1 }
18771887 if start .challenger == 0 and not preserveProgress then
18781888 start .t_roster = {}
@@ -2332,6 +2342,41 @@ end
23322342-- ;===========================================================
23332343-- ; SELECT SCREEN
23342344-- ;===========================================================
2345+ local function refreshActiveFacePortraits ()
2346+ for side = 1 , 2 do
2347+ for k , v in ipairs (start .p [side ].t_selCmd ) do
2348+ local member = main .f_tableLength (start .p [side ].t_selected ) + k
2349+ if main .coop and (side == 1 or gameMode (' versuscoop' )) then
2350+ member = k
2351+ end
2352+ local st = start .p [side ].t_selTemp [member ]
2353+ local player = v .player
2354+ local selRef = start .c [player ].selRef
2355+ if v .selectState == 0 and st ~= nil and selRef ~= nil and st .ref == selRef then
2356+ local state = getCharPreloadStatus (selRef )
2357+ if state == ' ready' then
2358+ local pn = 2 * (member - 1 ) + side
2359+ local pCfg = f_getMotifP (motif .select_info , pn , side )
2360+ local updated = false
2361+ if st .face_data == nil then
2362+ st .face_anim = pCfg .face .anim
2363+ st .face_data = start .f_animGet (selRef , side , member , pCfg .face , nil , true , st .face_data )
2364+ updated = updated or st .face_data ~= nil
2365+ end
2366+ if st .face2_data == nil then
2367+ st .face2_anim = pCfg .face2 .anim
2368+ st .face2_data = start .f_animGet (selRef , side , member , pCfg .face2 , nil , true , st .face2_data )
2369+ updated = updated or st .face2_data ~= nil
2370+ end
2371+ if updated then
2372+ start .needUpdateDrawList = true
2373+ end
2374+ end
2375+ end
2376+ end
2377+ end
2378+ end
2379+
23352380function start .updateDrawList ()
23362381 local drawList = {}
23372382
@@ -2496,6 +2541,8 @@ function start.f_selectScreen()
24962541 start .needUpdateDrawList = false
24972542
24982543 while not selScreenEnd do
2544+ main .f_preloadTick (4 )
2545+ refreshActiveFacePortraits ()
24992546 counter = counter + 1
25002547 -- draw clearcolor
25012548 clearColor (motif .selectbgdef .bgclearcolor [1 ], motif .selectbgdef .bgclearcolor [2 ], motif .selectbgdef .bgclearcolor [3 ])
@@ -2688,10 +2735,29 @@ function start.f_selectScreen()
26882735 )
26892736 end
26902737 if not stageEnd then
2691- if (getInput (- 1 , motif .select_info .done .key ) and not screenDelayInterrupted ) or timerSelect == - 1 then
2692- sndPlay (motif .Snd , motif .select_info .stage .done .snd [1 ], motif .select_info .stage .done .snd [2 ])
2693- stageTextData = motif .select_info .stage .done .TextSpriteData
2694- stageEnd = true
2738+ local canConfirmStage = (getInput (- 1 , motif .select_info .done .key ) and not screenDelayInterrupted ) or timerSelect == - 1
2739+ if canConfirmStage then
2740+ local preloadReady = true
2741+ if stageListNo > 0 then
2742+ local stageRef = main .t_selectableStages [stageListNo ]
2743+ local state = getStagePreloadStatus (stageRef )
2744+ preloadReady = state == ' ready'
2745+ if not preloadReady then
2746+ main .f_preloadBoostStage (stageRef )
2747+ else
2748+ if main .f_materializeStagePortrait (stageRef ) then
2749+ start .needUpdateDrawList = true
2750+ end
2751+ end
2752+ end
2753+ if not preloadReady and getInput (- 1 , motif .select_info .done .key ) and not screenDelayInterrupted then
2754+ sndPlay (motif .Snd , motif .select_info .cancel .snd [1 ], motif .select_info .cancel .snd [2 ])
2755+ end
2756+ if preloadReady then
2757+ sndPlay (motif .Snd , motif .select_info .stage .done .snd [1 ], motif .select_info .stage .done .snd [2 ])
2758+ stageTextData = motif .select_info .stage .done .TextSpriteData
2759+ stageEnd = true
2760+ end
26952761 elseif stageActiveCount < motif .select_info .stage .active .switchtime then -- delay change
26962762 stageActiveCount = stageActiveCount + 1
26972763 else
@@ -3281,6 +3347,7 @@ function start.f_selectMenu(side, cmd, player, member, selectState)
32813347 start .c [player ].selX , start .c [player ].selY = start .f_cellMovement (start .c [player ].selX , start .c [player ].selY , cmd , side , start .f_getCursorData (player ).cursor .move .snd )
32823348 start .c [player ].cell = start .c [player ].selX + motif .select_info .columns * start .c [player ].selY
32833349 start .c [player ].selRef = start .f_selGrid (start .c [player ].cell + 1 ).char_ref
3350+ main .f_preloadSetCharHighlight (player , start .c [player ].selRef )
32843351 -- temp data not existing yet
32853352 if start .p [side ].t_selTemp [member ] == nil then
32863353 t_portraitPriority [side ] = member
@@ -3299,6 +3366,9 @@ function start.f_selectMenu(side, cmd, player, member, selectState)
32993366 local timerExpired = motif .select_info .timer .count ~= - 1 and timerSelect == - 1
33003367 needUpdateDrawList = slotChanged
33013368 local velCopy = false
3369+ if slotChanged then
3370+ start .c [player ].selRef = start .f_selGrid (start .c [player ].cell + 1 ).char_ref
3371+ end
33023372 if timerExpired then
33033373 if start .c [player ].selRef == nil or main .t_selChars [start .c [player ].selRef + 1 ] == nil then
33043374 start .c [player ].selRef = start .f_randomChar (side )
@@ -3354,6 +3424,7 @@ function start.f_selectMenu(side, cmd, player, member, selectState)
33543424 else
33553425 start .p [side ].t_selTemp [member ].inRandom = false
33563426 end
3427+ main .f_preloadSetCharHighlight (player , start .c [player ].selRef )
33573428 -- update anim data
33583429 if updateAnim then
33593430 local face_data = velCopy and start .p [side ].t_selTemp [member ].face_data or nil
@@ -3362,7 +3433,26 @@ function start.f_selectMenu(side, cmd, player, member, selectState)
33623433 start .p [side ].t_selTemp [member ].face2_data = start .f_animGet (start .c [player ].selRef , side , member , pCfg .face2 , nil , true , face2_data )
33633434 end
33643435 -- cell selected or select screen timer reached 0
3365- if (slotSelected and start .f_selGrid (start .c [player ].cell + 1 ).char ~= nil and start .f_selGrid (start .c [player ].cell + 1 ).hidden ~= 2 ) or timerExpired then
3436+ local canConfirm = (slotSelected and start .f_selGrid (start .c [player ].cell + 1 ).char ~= nil and start .f_selGrid (start .c [player ].cell + 1 ).hidden ~= 2 ) or timerExpired
3437+ if canConfirm then
3438+ local preloadReady = true
3439+ if start .c [player ].selRef ~= nil then
3440+ local state = getCharPreloadStatus (start .c [player ].selRef )
3441+ preloadReady = state == ' ready'
3442+ if not preloadReady then
3443+ main .f_preloadBoostChar (start .c [player ].selRef )
3444+ else
3445+ main .f_materializeCharByRef (start .c [player ].selRef )
3446+ end
3447+ end
3448+ if not preloadReady then
3449+ if slotSelected then
3450+ sndPlay (motif .Snd , motif .select_info .cancel .snd [1 ], motif .select_info .cancel .snd [2 ])
3451+ end
3452+ canConfirm = false
3453+ end
3454+ end
3455+ if canConfirm then
33663456 if motif .select_info .paletteselect ~= 0 then
33673457 timerSelect = motif .select_info .timer .displaytime
33683458 end
@@ -3476,6 +3566,7 @@ function start.f_selectMenu(side, cmd, player, member, selectState)
34763566 pn = start .f_getPlayerNo (side , member ),
34773567 cursor = {start .c [player ].selX , start .c [player ].selY },
34783568 }
3569+ main .f_preloadSetCharHighlight (player , nil )
34793570 hook .run (" start.f_selectMenu.selected" , side , member , start .p [side ].t_selected [member ], start .p [side ], player )
34803571 if not gameOption (' Options.Team.Duplicates' ) then
34813572 t_reservedChars [side ][start .c [player ].selRef ] = true
@@ -3572,6 +3663,9 @@ function start.f_stageMenu()
35723663 animReset (main .t_selStages [main .t_selectableStages [stageListNo ]].anim_data )
35733664 animUpdate (main .t_selStages [main .t_selectableStages [stageListNo ]].anim_data )
35743665 end
3666+ if stageListNo > 0 then
3667+ main .f_preloadBoostStage (main .t_selectableStages [stageListNo ])
3668+ end
35753669end
35763670
35773671-- ;===========================================================
@@ -3755,6 +3849,7 @@ function start.f_selectVersus(active, t_orderSelect, loadStartArg)
37553849 end
37563850 end
37573851 while true do
3852+ main .f_preloadTick (4 )
37583853 local snd = false
37593854 -- CPU order select: randomize first, then selectChar() using randomized slot order
37603855 for side = 1 , 2 do
0 commit comments