This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
unpack = unpack or table.unpack
|
local musicator_markov_model = {
|
||||||
|
|
||||||
musicator_markov_model = {
|
|
||||||
model = {
|
model = {
|
||||||
["...|..."] = {
|
["...|..."] = {
|
||||||
next = {
|
next = {
|
||||||
@@ -655,7 +653,7 @@ end
|
|||||||
local function musicator_count_notes(sequence)
|
local function musicator_count_notes(sequence)
|
||||||
local result = 0
|
local result = 0
|
||||||
|
|
||||||
for i,v in ipairs(sequence) do
|
for _,v in ipairs(sequence) do
|
||||||
if not (v == "...") then
|
if not (v == "...") then
|
||||||
result = result + 1
|
result = result + 1
|
||||||
end
|
end
|
||||||
@@ -664,7 +662,7 @@ local function musicator_count_notes(sequence)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function musicator_generate_sequence(model_data, length)
|
local function musicator_generate_sequence(model_data, length)
|
||||||
local order = model_data.order
|
local order = model_data.order
|
||||||
local model = model_data.model
|
local model = model_data.model
|
||||||
|
|
||||||
@@ -704,12 +702,12 @@ function musicator_generate_sequence(model_data, length)
|
|||||||
return seq
|
return seq
|
||||||
end
|
end
|
||||||
|
|
||||||
function musicator_row_to_frame(row, bpm, spd)
|
local function musicator_row_to_frame(row, bpm, spd)
|
||||||
local frames_per_row = (150 * spd) / bpm
|
local frames_per_row = (150 * spd) / bpm
|
||||||
return math.floor(row * frames_per_row)
|
return math.floor(row * frames_per_row)
|
||||||
end
|
end
|
||||||
|
|
||||||
function musicator_note_to_direction(note)
|
local function musicator_note_to_direction(note)
|
||||||
local subnote = note:sub(1,1)
|
local subnote = note:sub(1,1)
|
||||||
|
|
||||||
local mapping = {
|
local mapping = {
|
||||||
@@ -725,7 +723,7 @@ function musicator_note_to_direction(note)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- converts generated sequence to pattern that the ddr minigame can consume
|
-- converts generated sequence to pattern that the ddr minigame can consume
|
||||||
function musicator_sequence_to_pattern(sequence, bpm, spd)
|
local function musicator_sequence_to_pattern(sequence, bpm, spd)
|
||||||
local result = {}
|
local result = {}
|
||||||
|
|
||||||
for i, note in ipairs(sequence) do
|
for i, note in ipairs(sequence) do
|
||||||
@@ -741,6 +739,6 @@ function musicator_sequence_to_pattern(sequence, bpm, spd)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function musicator_generate_pattern(length, bpm, spd)
|
local function musicator_generate_pattern(length, bpm, spd)
|
||||||
return musicator_sequence_to_pattern(musicator_generate_sequence(musicator_markov_model, length), bpm, spd)
|
return musicator_sequence_to_pattern(musicator_generate_sequence(musicator_markov_model, length), bpm, spd)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -60,11 +60,9 @@ function MinigameDDRWindow.prepareSong(song, generated_length, special_mode)
|
|||||||
current_song.end_frame = pattern[#pattern].frame
|
current_song.end_frame = pattern[#pattern].frame
|
||||||
|
|
||||||
if special_mode == "only_special" then
|
if special_mode == "only_special" then
|
||||||
local cntr = 1
|
for i, _ in ipairs(current_song.pattern) do
|
||||||
for i, v in ipairs(current_song.pattern) do
|
|
||||||
current_song.pattern[i].special = (i % 5 == 0)
|
current_song.pattern[i].special = (i % 5 == 0)
|
||||||
end
|
end
|
||||||
elseif special_mode == "" then
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -104,7 +102,7 @@ function MinigameDDRWindow.on_end(game_context)
|
|||||||
game_context.win_timer = Config.timing.minigame_win_duration
|
game_context.win_timer = Config.timing.minigame_win_duration
|
||||||
|
|
||||||
local num_special = 0
|
local num_special = 0
|
||||||
for i,v in ipairs(game_context.current_song.pattern) do
|
for _,v in ipairs(game_context.current_song.pattern) do
|
||||||
if game_context.special_mode == "only_left" then
|
if game_context.special_mode == "only_left" then
|
||||||
num_special = num_special + ((v.dir == "left" and 1) or 0)
|
num_special = num_special + ((v.dir == "left" and 1) or 0)
|
||||||
else
|
else
|
||||||
@@ -119,8 +117,6 @@ function MinigameDDRWindow.on_end(game_context)
|
|||||||
was_ok = game_context.special_mode_counter == num_special
|
was_ok = game_context.special_mode_counter == num_special
|
||||||
elseif game_context.special_mode == "only_left" then
|
elseif game_context.special_mode == "only_left" then
|
||||||
was_ok = game_context.special_mode_counter == num_special
|
was_ok = game_context.special_mode_counter == num_special
|
||||||
elseif game_context.special_mode == "only_nothing" then
|
|
||||||
-- nothing to do here :D
|
|
||||||
end
|
end
|
||||||
|
|
||||||
game_context.special_mode_condition = game_context.special_mode_condition and was_ok
|
game_context.special_mode_condition = game_context.special_mode_condition and was_ok
|
||||||
|
|||||||
Reference in New Issue
Block a user