@@ -38,7 +38,11 @@ local DEPLS = {
38
38
{569 , 465 }, {416 , 496 }, {262 , 465 },
39
39
{133 , 378 }, {46 , 249 }, {16 , 96 },
40
40
},
41
- IdolImageData = {}, -- [idol positon] = {image handle, opacity}
41
+ IdolImageData = { -- [idol positon] = {image handle, opacity}
42
+ {nil , 255 }, {nil , 255 }, {nil , 255 },
43
+ {nil , 255 }, {nil , 255 }, {nil , 255 },
44
+ {nil , 255 }, {nil , 255 }, {nil , 255 }
45
+ },
42
46
NoteAccuracy = {{16 , nil }, {40 , nil }, {64 , nil }, {112 , nil }, {128 , nil }}, -- Note accuracy
43
47
NoteManager = nil ,
44
48
NoteLoader = nil ,
@@ -647,26 +651,6 @@ function DEPLS.LoadImageSafe(path)
647
651
else return token_image end
648
652
end
649
653
650
- -- ! @brief Load configuration
651
- -- ! @param config_name The configuration name
652
- -- ! @param default_value The default value of the configuration
653
- -- ! @returns Configuration value or `default_value` (and save it as `default_value`)
654
- function DEPLS .LoadConfig (config_name , default_value )
655
- local file = love .filesystem .newFile (config_name .. " .txt" , " r" )
656
-
657
- if file == nil then
658
- file = io.open (DEPLS .SaveDirectory .. " /" .. config_name .. " .txt" , " wb" )
659
- file :write (tostring (default_value ))
660
- file :close ()
661
-
662
- return default_value
663
- end
664
-
665
- local data = file :read ()
666
-
667
- return tonumber (data ) or data
668
- end
669
-
670
654
-- ! @brief Load audio
671
655
-- ! @param path The audio path
672
656
-- ! @param noorder Force existing extension?
899
883
end
900
884
end
901
885
886
+ -- ! @brief Loads DEPLS2 image file
887
+ -- ! @param path The image path
888
+ -- ! @returns Image handle or nil on failure
889
+ function DEPLS .StoryboardFunctions .LoadDEPLSImage (path )
890
+ local _ , a = pcall (love .graphics .newImage , path )
891
+
892
+ if _ then
893
+ return a
894
+ end
895
+
896
+ return nil
897
+ end
898
+
902
899
---- -------------------------
903
900
-- The Live simuator logic --
904
901
---- -------------------------
@@ -944,14 +941,14 @@ function DEPLS.Start(argv)
944
941
love .filesystem .createDirectory (" beatmap" )
945
942
946
943
-- Load configuration
947
- local BackgroundID = DEPLS . LoadConfig (" BACKGROUND_IMAGE" , 11 )
948
- local Keys = DEPLS . LoadConfig (" IDOL_KEYS" , " a\t s\t d\t f\t space\t j\t k\t l\t ;" )
949
- local Auto = DEPLS . LoadConfig (" AUTOPLAY" , 0 )
950
- DEPLS .LiveDelay = DEPLS . LoadConfig (" LIVESIM_DELAY" , 1000 )
944
+ local BackgroundID = LoadConfig (" BACKGROUND_IMAGE" , 11 )
945
+ local Keys = LoadConfig (" IDOL_KEYS" , " a\t s\t d\t f\t space\t j\t k\t l\t ;" )
946
+ local Auto = LoadConfig (" AUTOPLAY" , 0 )
947
+ DEPLS .LiveDelay = LoadConfig (" LIVESIM_DELAY" , 1000 )
951
948
DEPLS .ElapsedTime = - DEPLS .LiveDelay
952
- DEPLS .NotesSpeed = DEPLS . LoadConfig (" NOTE_SPEED" , 800 )
953
- DEPLS .Stamina = DEPLS . LoadConfig (" STAMINA_DISPLAY" , 32 )
954
- DEPLS .ScoreBase = DEPLS . LoadConfig (" SCORE_ADD_NOTE" , 1024 )
949
+ DEPLS .NotesSpeed = LoadConfig (" NOTE_SPEED" , 800 )
950
+ DEPLS .Stamina = LoadConfig (" STAMINA_DISPLAY" , 32 )
951
+ DEPLS .ScoreBase = LoadConfig (" SCORE_ADD_NOTE" , 1024 )
955
952
DEPLS .Keys = {}
956
953
do
957
954
local i = 9
@@ -1051,14 +1048,14 @@ function DEPLS.Start(argv)
1051
1048
noteloader_data .units = noteloader_data .units or {}
1052
1049
local IdolImagePath = {}
1053
1050
do
1054
- local idol_img = DEPLS . LoadConfig (" IDOL_IMAGE" , " a.png,a.png,a.png,a.png,a.png,a.png,a.png,a.png,a.png" )
1051
+ local idol_img = LoadConfig (" IDOL_IMAGE" , " a.png,a.png,a.png,a.png,a.png,a.png,a.png,a.png,a.png" )
1055
1052
1056
1053
for w in idol_img :gmatch (" [^,]+" ) do
1057
1054
IdolImagePath [# IdolImagePath + 1 ] = w
1058
1055
end
1059
1056
end
1060
1057
for i = 1 , 9 do
1061
- DEPLS .IdolImageData [i ] = { noteloader_data .units [i ] or DEPLS .LoadUnitIcon (IdolImagePath [10 - i ]), 255 }
1058
+ DEPLS .IdolImageData [i ][ 1 ] = noteloader_data .units [i ] or DEPLS .LoadUnitIcon (IdolImagePath [10 - i ])
1062
1059
end
1063
1060
1064
1061
-- Load stamina image (bar and number)
0 commit comments