mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-12-22 02:19:03 -06:00
Catch up to main, and push changes to sfx
This commit is contained in:
parent
0e82a8758c
commit
71ecd51cde
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
126
load/sounds.lua
126
load/sounds.lua
@ -1,63 +1,101 @@
|
||||
sounds = {
|
||||
blocks = {
|
||||
I = love.audio.newSource("res/se/piece_i.wav", "static"),
|
||||
J = love.audio.newSource("res/se/piece_j.wav", "static"),
|
||||
L = love.audio.newSource("res/se/piece_l.wav", "static"),
|
||||
O = love.audio.newSource("res/se/piece_o.wav", "static"),
|
||||
S = love.audio.newSource("res/se/piece_s.wav", "static"),
|
||||
T = love.audio.newSource("res/se/piece_t.wav", "static"),
|
||||
Z = love.audio.newSource("res/se/piece_z.wav", "static")
|
||||
I = "res/se/piece_i.wav",
|
||||
J = "res/se/piece_j.wav",
|
||||
L = "res/se/piece_l.wav",
|
||||
O = "res/se/piece_o.wav",
|
||||
S = "res/se/piece_s.wav",
|
||||
T = "res/se/piece_t.wav",
|
||||
Z = "res/se/piece_z.wav"
|
||||
},
|
||||
move = love.audio.newSource("res/se/move.wav", "static"),
|
||||
bottom = love.audio.newSource("res/se/bottom.wav", "static"),
|
||||
cursor = love.audio.newSource("res/se/cursor.wav", "static"),
|
||||
cursor_lr = love.audio.newSource("res/se/cursor_lr.wav", "static"),
|
||||
main_decide = love.audio.newSource("res/se/main_decide.wav", "static"),
|
||||
mode_decide = love.audio.newSource("res/se/mode_decide.wav", "static"),
|
||||
lock = love.audio.newSource("res/se/lock.wav", "static"),
|
||||
hold = love.audio.newSource("res/se/hold.wav", "static"),
|
||||
erase = love.audio.newSource("res/se/erase.wav", "static"),
|
||||
fall = love.audio.newSource("res/se/fall.wav", "static"),
|
||||
ready = love.audio.newSource("res/se/ready.wav", "static"),
|
||||
go = love.audio.newSource("res/se/go.wav", "static"),
|
||||
irs = love.audio.newSource("res/se/irs.wav", "static"),
|
||||
ihs = love.audio.newSource("res/se/ihs.wav", "static"),
|
||||
move = "res/se/move.wav",
|
||||
rotate = "res/se/rotate.wav",
|
||||
kick = "res/se/kick.wav",
|
||||
bottom = "res/se/bottom.wav",
|
||||
cursor = "res/se/cursor.wav",
|
||||
cursor_lr = "res/se/cursor_lr.wav",
|
||||
main_decide = "res/se/main_decide.wav",
|
||||
mode_decide = "res/se/mode_decide.wav",
|
||||
lock = "res/se/lock.wav",
|
||||
hold = "res/se/hold.wav",
|
||||
erase = {
|
||||
single = "res/se/single.wav",
|
||||
double = "res/se/double.wav",
|
||||
triple = "res/se/triple.wav",
|
||||
quad = "res/se/quad.wav"
|
||||
},
|
||||
fall = "res/se/fall.wav",
|
||||
ready = "res/se/ready.wav",
|
||||
go = "res/se/go.wav",
|
||||
irs = "res/se/irs.wav",
|
||||
ihs = "res/se/ihs.wav",
|
||||
-- a secret sound!
|
||||
welcome = love.audio.newSource("res/se/welcomeToCambridge.wav", "static"),
|
||||
welcome = "res/se/welcomeToCambridge.wav",
|
||||
}
|
||||
|
||||
-- Replace each sound effect string with its love audiosource counterpart, but only if it exists. This lets the game handle missing SFX.
|
||||
for k,v in pairs(sounds) do
|
||||
if(type(v) == "table") then
|
||||
-- list of subsounds
|
||||
for k2,v2 in pairs(v) do
|
||||
if(love.filesystem.getInfo(sounds[k][k2])) then
|
||||
-- this file exists
|
||||
sounds[k][k2] = love.audio.newSource(sounds[k][k2], "static")
|
||||
else
|
||||
sounds[k][k2] = nil
|
||||
end
|
||||
end
|
||||
else
|
||||
if(love.filesystem.getInfo(sounds[k])) then
|
||||
-- this file exists
|
||||
print("Successfully converted " .. v)
|
||||
sounds[k] = love.audio.newSource(sounds[k], "static")
|
||||
else
|
||||
sounds[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function playSE(sound, subsound)
|
||||
if sound ~= nil then
|
||||
if subsound ~= nil then
|
||||
sounds[sound][subsound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound][subsound]:isPlaying() then
|
||||
sounds[sound][subsound]:stop()
|
||||
if sounds[sound] then
|
||||
if subsound ~= nil then
|
||||
if sounds[sound][subsound] then
|
||||
sounds[sound][subsound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound][subsound]:isPlaying() then
|
||||
sounds[sound][subsound]:stop()
|
||||
end
|
||||
sounds[sound][subsound]:play()
|
||||
end
|
||||
else
|
||||
sounds[sound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound]:isPlaying() then
|
||||
sounds[sound]:stop()
|
||||
end
|
||||
sounds[sound]:play()
|
||||
end
|
||||
sounds[sound][subsound]:play()
|
||||
else
|
||||
sounds[sound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound]:isPlaying() then
|
||||
sounds[sound]:stop()
|
||||
end
|
||||
sounds[sound]:play()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function playSEOnce(sound, subsound)
|
||||
if sound ~= nil then
|
||||
if subsound ~= nil then
|
||||
sounds[sound][subsound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound][subsound]:isPlaying() then
|
||||
return
|
||||
if sounds[sound] then
|
||||
if subsound ~= nil then
|
||||
if sounds[sound][subsound] then
|
||||
sounds[sound][subsound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound][subsound]:isPlaying() then
|
||||
return
|
||||
end
|
||||
sounds[sound][subsound]:play()
|
||||
end
|
||||
else
|
||||
sounds[sound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound]:isPlaying() then
|
||||
return
|
||||
end
|
||||
sounds[sound]:play()
|
||||
end
|
||||
sounds[sound][subsound]:play()
|
||||
else
|
||||
sounds[sound]:setVolume(config.sfx_volume)
|
||||
if sounds[sound]:isPlaying() then
|
||||
return
|
||||
end
|
||||
sounds[sound]:play()
|
||||
end
|
||||
end
|
||||
end
|
BIN
res/se/double.wav
Normal file
BIN
res/se/double.wav
Normal file
Binary file not shown.
BIN
res/se/quad.wav
Normal file
BIN
res/se/quad.wav
Normal file
Binary file not shown.
BIN
res/se/single.wav
Normal file
BIN
res/se/single.wav
Normal file
Binary file not shown.
BIN
res/se/triple.wav
Normal file
BIN
res/se/triple.wav
Normal file
Binary file not shown.
@ -269,7 +269,8 @@ function GameMode:update(inputs, ruleset)
|
||||
end
|
||||
|
||||
if cleared_row_count > 0 then
|
||||
playSE("erase")
|
||||
local row_count_names = {"single","double","triple","quad"}
|
||||
playSE("erase",row_count_names[cleared_row_count] or "quad")
|
||||
self.lcd = self:getLineClearDelay()
|
||||
self.last_lcd = self.lcd
|
||||
self.are = (
|
||||
|
@ -100,10 +100,12 @@ function Ruleset:attemptRotate(new_inputs, piece, grid, initial)
|
||||
if (grid:canPlacePiece(new_piece)) then
|
||||
piece:setRelativeRotation(rot_dir)
|
||||
self:onPieceRotate(piece, grid)
|
||||
playSE("rotate")
|
||||
else
|
||||
if not(initial and self.enable_IRS_wallkicks == false) then
|
||||
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
||||
end
|
||||
playSE("kick")
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user