Skip to content

Commit

Permalink
Note sound accumulation
Browse files Browse the repository at this point in the history
- Off by default. Enable in settings

IsOpenGLES() storyboard function

Fixed loading UTF8-BOM SIFTrain beatmaps
  • Loading branch information
MikuAuahDark committed Jun 8, 2017
1 parent 461bba8 commit ca0e0ea
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 48 deletions.
1 change: 1 addition & 0 deletions AquaShine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ function love.load(arg)
end

AquaShine.WindowName = love.window.getTitle()
AquaShine.RendererInfo = {love.graphics.getRendererInfo()}

assert(love.filesystem.load("AquaShineFileDialog.lua"))(AquaShine)
love.resize(wx, wy)
Expand Down
11 changes: 11 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
v1.1.2
- Notes Sound Accumulation OK
- SIFTrain beatmap loading fix for UTF8-BOM OK
- Add IsOpenGLES() storyboard function OK

v2.0
- FFmpeg extension
- Unit creation
- AquaShine UI library
- NoteLoader2 (metadata loading only, beatmap verification)
- Removal of Playground TEXB Loader
9 changes: 9 additions & 0 deletions docs/Storyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ drawn by default.

> This function can only be called inside `Initialize` function.
### `bool IsOpenGLES()`

Check if current renderer is OpenGL ES. This can be used to select shader code to be used because Desktop GL shader and GLES shader
were bit different each other

Returns: `true` if running under OpenGLES, `false` otherwise

> This function returns `true` when running LOVE2D under desktop with [ANGLE](angleproject.org) renderer.
Storyboard Callback Functions
=============================

Expand Down
6 changes: 6 additions & 0 deletions livesim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ function DEPLS.StoryboardFunctions.HSL(h, s, l)
return math.ceil((r+m)*256),math.ceil((g+m)*256),math.ceil((b+m)*256)
end

--! @brief Check if current renderer is OpenGLES
--! @returns `true` if running under OpenGLES, `false` otherwise
function DEPLS.StoryboardFunctions.IsOpenGLES()
return AquaShine.RendererInfo[1] == "OpenGL ES"
end

-----------------------------
-- The Live simuator logic --
-----------------------------
Expand Down
5 changes: 3 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- Live Simulator: 2 initialization code
-- Live Simulator: 2
-- High-performance Live Simulator

--[[---------------------------------------------------------------------------
-- Copyright (c) 2038 Dark Energy Processor Corporation
Expand All @@ -22,7 +23,7 @@
-- IN THE SOFTWARE.
--]]---------------------------------------------------------------------------

DEPLS_VERSION = "1.1.1"
DEPLS_VERSION = "1.1.2"

----------------------
-- AquaShine loader --
Expand Down
131 changes: 86 additions & 45 deletions note.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ local floor = math.floor
local notes_bomb = Yohane.newFlashFromFilename("flash/live_notes_bomb.flsh", "ef_317")
local hold_effect = Yohane.newFlashFromFilename("flash/live_notes_hold_effect.flsh", "ef_326_effect")

local NoteSoundAccumulation = AquaShine.LoadConfig("NS_ACCUMULATION", 0) == 1
local NoteSoundAccumulationState = {false, false, false, false}

-- Precomputed tables
local FullRot = 2 * math.pi
local PredefinedSlideRotation = {
Expand Down Expand Up @@ -288,10 +291,13 @@ function SingleNoteObject.SetTouchID(this, touchid)
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Perfect
DEPLS.Routines.PerfectNode.Replay = true
this.ScoreMultipler = 1
this.Audio.Perfect:play()
Note.Perfect = Note.Perfect + 1
this.Delete = true

Note.Perfect = Note.Perfect + 1
if not(NoteSoundAccumulation) or NoteSoundAccumulationState[1] == false then
this.Audio.Perfect:play()
NoteSoundAccumulationState[1] = true
end

local AfterCircleTap = DEPLS.Routines.CircleTapEffect.Create(this.FirstCircle[1], this.FirstCircle[2], 255, 255, 255)
EffectPlayer.Spawn(AfterCircleTap)
Expand All @@ -315,41 +321,51 @@ function SingleNoteObject.SetTouchID(this, touchid)
if notedistance <= NoteAccuracy[4][2] then
if notedistance <= NoteAccuracy[1][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Perfect

this.ScoreMultipler = 1
this.Audio.Perfect:play()

Note.Perfect = Note.Perfect + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[1] == false then
this.Audio.Perfect:play()
NoteSoundAccumulationState[1] = true
end
elseif notedistance <= NoteAccuracy[2][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Great

this.ScoreMultipler = 0.88
this.Audio.Great:play()

Note.Great = Note.Great + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[2] == false then
this.Audio.Great:play()
NoteSoundAccumulationState[2] = true
end
elseif notedistance <= NoteAccuracy[3][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Good
DEPLS.Routines.ComboCounter.Reset = true

this.ScoreMultipler = 0.8
this.Audio.Good:play()

Note.Good = Note.Good + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[3] == false then
this.Audio.Good:play()
NoteSoundAccumulationState[3] = true
end
else
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Bad
DEPLS.Routines.ComboCounter.Reset = true

this.ScoreMultipler = 0.4
this.Audio.Bad:play()

Note.Bad = Note.Bad + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[4] == false then
this.Audio.Bad:play()
NoteSoundAccumulationState[4] = true
end
end

DEPLS.Routines.PerfectNode.Replay = true

if DEPLS.Routines.ComboCounter.Reset and this.StarImage then
local ef = NoteBombEffect.Create(this.CenterIdol[1], this.CenterIdol[2])

EffectPlayer.Spawn(ef)
this.Audio.StarExplode:play()
-- TODO: play star explode effect
end

local AfterCircleTap = DEPLS.Routines.CircleTapEffect.Create(this.FirstCircle[1], this.FirstCircle[2], 255, 255, 255)
Expand Down Expand Up @@ -524,9 +540,12 @@ function LongNoteObject.SetTouchID(this, touchid)

this.ScoreMultipler = 1
this.TouchID = touchid
this.Audio.Perfect:play()

Note.Perfect = Note.Perfect + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[1] == false then
this.Audio.Perfect:play()
NoteSoundAccumulationState[1] = true
end

storyboard_callback("LongNoteTap",
false, -- release
Expand All @@ -545,33 +564,42 @@ function LongNoteObject.SetTouchID(this, touchid)
if notedistance <= NoteAccuracy[4][2] then
if notedistance <= NoteAccuracy[1][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Perfect

this.ScoreMultipler = 1
this.Audio.Perfect:play()

Note.Perfect = Note.Perfect + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[1] == false then
this.Audio.Perfect:play()
NoteSoundAccumulationState[1] = true
end
elseif notedistance <= NoteAccuracy[2][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Great
this.ScoreMultipler = 0.88
this.Audio.Great:play()

Note.Great = Note.Great + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[2] == false then
this.Audio.Great:play()
NoteSoundAccumulationState[2] = true
end
elseif notedistance <= NoteAccuracy[3][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Good
DEPLS.Routines.ComboCounter.Reset = true

this.ScoreMultipler = 0.8
this.Audio.Good:play()

Note.Good = Note.Good + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[3] == false then
this.Audio.Good:play()
NoteSoundAccumulationState[3] = true
end
else
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Bad
DEPLS.Routines.ComboCounter.Reset = true

this.ScoreMultipler = 0.4
this.Audio.Bad:play()

Note.Bad = Note.Bad + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[4] == false then
this.Audio.Bad:play()
NoteSoundAccumulationState[4] = true
end
end

DEPLS.Routines.PerfectNode.Replay = true
Expand Down Expand Up @@ -601,47 +629,52 @@ function LongNoteObject.UnsetTouchID(this, touchid)
-- Check if perfect
if DEPLS.AutoPlay or notedistance <= NoteAccuracy[1][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Perfect
DEPLS.Routines.PerfectNode.Replay = true

this.ScoreMultipler2 = 1
this.Audio2.Perfect:play()

Note.Perfect = Note.Perfect + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[1] == false then
this.Audio2.Perfect:play()
NoteSoundAccumulationState[1] = true
end
elseif notedistance <= NoteAccuracy[2][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Great
DEPLS.Routines.PerfectNode.Replay = true

this.ScoreMultipler2 = 0.88
this.Audio2.Great:play()

Note.Great = Note.Great + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[2] == false then
this.Audio2.Great:play()
NoteSoundAccumulationState[2] = true
end
elseif notedistance <= NoteAccuracy[3][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Good
DEPLS.Routines.PerfectNode.Replay = true
DEPLS.Routines.ComboCounter.Reset = true

this.ScoreMultipler2 = 0.8
this.Audio2.Good:play()

Note.Good = Note.Good + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[3] == false then
this.Audio2.Good:play()
NoteSoundAccumulationState[3] = true
end
elseif notedistance <= NoteAccuracy[4][2] then
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Bad
DEPLS.Routines.PerfectNode.Replay = true
DEPLS.Routines.ComboCounter.Reset = true

this.ScoreMultipler2 = 0.4
this.Audio2.Bad:play()

Note.Bad = Note.Bad + 1

if not(NoteSoundAccumulation) or NoteSoundAccumulationState[4] == false then
this.Audio2.Bad:play()
NoteSoundAccumulationState[4] = true
end
else
Note.Miss = Note.Miss + 1
is_miss = true
DEPLS.Routines.PerfectNode.Image = DEPLS.Images.Miss
DEPLS.Routines.PerfectNode.Replay = true
DEPLS.Routines.ComboCounter.Reset = true
this.ScoreMultipler2 = 0
end

DEPLS.Routines.PerfectNode.Replay = true

if not(is_miss) then
local AfterCircleTap = DEPLS.Routines.CircleTapEffect.Create(this.SecondCircle[1], this.SecondCircle[2], 255, 255, 255)
EffectPlayer.Spawn(AfterCircleTap)
Expand Down Expand Up @@ -734,6 +767,14 @@ function Note.Update(deltaT)
local ElapsedTime = DEPLS.ElapsedTime
local score = 0

-- if note sound accumulation is enabled, clear state
if NoteSoundAccumulation then
NoteSoundAccumulationState[1] = false
NoteSoundAccumulationState[2] = false
NoteSoundAccumulationState[3] = false
NoteSoundAccumulationState[4] = false
end

for i = 1, 9 do
local j = 1
local noteobj = Note[i][j]
Expand Down
5 changes: 5 additions & 0 deletions noteloader/load_sift.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function SIFTrain.Load(file)
local data = love.filesystem.read(file[1]..".rs")
local out = {}

if data:sub(1, 3) == "\239\187\191" then
-- BOM. Useless in here.
data = data:sub(4)
end

-- It turns out that SIFTrain uses relaxed Javascript object notation. Damn tons of regex incoming lol
do
local music_file_pos = {data:find("music_file", 1, true)}
Expand Down
9 changes: 8 additions & 1 deletion setting_view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,17 @@ local SettingSelection = {
},
{
Name = "JUST_IN_TIME", Default = "off",
Caption = "JIT (Requires Restart)",
Caption = "JIT (Needs Restart)",
Type = "switch",
On = "on",
Off = "off"
},
{
Name = "NS_ACCUMULATION", Default = 0,
Caption = "N.S. Accumulation",
Type = "switch",
On = 1,
Off = 0
}
}

Expand Down

0 comments on commit ca0e0ea

Please sign in to comment.