@ECHO OFF
SET LOG=step0001.log
SET DG=..\GameDataFolder\level0_Final
ECHO LOG FILE FOR ANALYZING FLUCTUATIONS OF TRAM AND CHARACTER TXMP > %LOG%
FOR %%L IN (1 2 3 4 6 8 9 10 11 12 13 14 18 19) DO (
    FOR %%D IN (..\GameDataFolder\level%%L_Final) DO (
        IF EXIST %%D (
            ECHO Level %%L: moving local ONCC and subtrees to level 0...
            ECHO Level %%L: moving local ONCC and subtrees to level 0...>>%LOG%
            OniSplit.exe -copy %DG% %%D\ONCC*.oni >> %LOG%
            OniSplit.exe -move ..\temp\level%%L_Final\ONCC %%D\ONCC*.oni
            ECHO Level %%L: moving orphan ONCC children to level 0...
            ECHO Level %%L: moving orphan ONCC children to level 0... >> %LOG%
            OniSplit.exe -copy %DG% %%D\TRBS*.oni >> %LOG%
            OniSplit.exe -copy %DG% %%D\TRSC*.oni >> %LOG%
            OniSplit.exe -copy %DG% %%D\TRAC*.oni >> %LOG%
            OniSplit.exe -copy %DG% %%D\TRMA*.oni >> %LOG%
            OniSplit.exe -copy %DG% %%D\TRCM*.oni >> %LOG%
            OniSplit.exe -move ..\temp\level%%L_Final\ONCC %%D\TRBS*.oni
            OniSplit.exe -move ..\temp\level%%L_Final\ONCC %%D\TRSC*.oni
            OniSplit.exe -move ..\temp\level%%L_Final\ONCC %%D\TRAC*.oni
            OniSplit.exe -move ..\temp\level%%L_Final\ONCC %%D\TRMA*.oni
            OniSplit.exe -move ..\temp\level%%L_Final\ONCC %%D\TRCM*.oni
            ECHO Level %%L: moving orphan TRAC children to level 0...
            ECHO Level %%L: moving orphan TRAC children to level 0... >> %LOG%
            OniSplit.exe -copy %DG% %%D\TRAM*.oni >> %LOG%
            OniSplit.exe -move ..\temp\level%%L_Final\ONCC\TRAC %%D\TRAM*.oni
            ERASE %DG%\TRCM*.oni
        )
    )
)
