-
Notifications
You must be signed in to change notification settings - Fork 0
/
difficulty.odin
58 lines (44 loc) · 1.28 KB
/
difficulty.odin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import "core:fmt"
import "core:os"
import "core:strings"
import "core:strconv"
import bm "utils"
Difficulty :: struct {
HPDrainRate:u32,
CircleSize:u32,
OverallDifficulty:u32,
ApproachRate:u32,
SliderMultiplier:f32,
SliderTickRate:u32,
}
diff_init :: proc(pathfile:string,obj:^Difficulty){
file,ok := os.read_entire_file(pathfile)
if !ok{
return;
}
defer delete(file,context.allocator)
it := string(file)
for line in strings.split_lines_iterator(&it){
switch{
case strings.contains(line,"HPDrainRate"):
value,_ := strconv.parse_int(bm.cut_string(line,':'))
obj.HPDrainRate = u32(value)
case strings.contains(line,"CircleSize"):
value,_ := strconv.parse_int(bm.cut_string(line,':'))
obj.CircleSize = u32(value)
case strings.contains(line,"OverallDifficulty"):
value,_ := strconv.parse_int(bm.cut_string(line,':'))
obj.OverallDifficulty = u32(value)
case strings.contains(line,"ApproachRate"):
value,_ := strconv.parse_int(bm.cut_string(line,':'))
obj.ApproachRate = u32(value)
case strings.contains(line,"SliderMultiplier"):
value,_ := strconv.parse_f32(bm.cut_string(line,':'))
obj.SliderMultiplier = value
case strings.contains(line,"SliderTickRate"):
value,_ := strconv.parse_int(bm.cut_string(line,':'))
obj.SliderTickRate = u32(value)
}
}
}