Skip to content

Commit

Permalink
整理代码
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Apr 20, 2024
1 parent 032043f commit d3cbe31
Show file tree
Hide file tree
Showing 35 changed files with 170 additions and 170 deletions.
4 changes: 2 additions & 2 deletions assets/fmod20221/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ end

--------------------------

---@type table|fun(name:string, args:{instant?:boolean, volume?:number, pitch?:number, tune?:number, fine?:number, pos?:table<number,number>, param?:table}):FMOD.Studio.EventInstance?
---@type table|fun(name:string, args?:{instant?:boolean, volume?:number, pitch?:number, tune?:number, fine?:number, pos?:table<number,number>, param?:table}):FMOD.Studio.EventInstance?
M.music={}

---@param v number
Expand Down Expand Up @@ -216,7 +216,7 @@ setmetatable(M.music,{__call=function(_,...) playMusic(...) end})

--------------------------

---@type table|fun(name:string, args:{instant?:boolean, volume?:number, pitch?:number, tune?:number, fine?:number, pos?:table<number,number>, param?:table}):FMOD.Studio.EventInstance?
---@type table|fun(name:string, args?:{instant?:boolean, volume?:number, pitch?:number, tune?:number, fine?:number, pos?:table<number,number>, param?:table}):FMOD.Studio.EventInstance?
M.effect={}

---@param v number
Expand Down
22 changes: 11 additions & 11 deletions assets/game/gemPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ local defaultSoundFunc={
playSample('sine',{'A2',2.2-num/5},{'E3',2.2-num/5})
end
end,
move= function() FMOD.effect.play('move') end,
move_failed= function() FMOD.effect.play('move_failed') end,
swap= function() FMOD.effect.play('rotate') end,
swap_failed= function() FMOD.effect.play('tuck') end,
twist= function() FMOD.effect.play('rotate') end,
twist_failed= function() FMOD.effect.play('tuck') end,
move_back= function() FMOD.effect.play('rotate_failed') end,
touch= function() FMOD.effect.play('lock') end,
move= function() FMOD.effect('move') end,
move_failed= function() FMOD.effect('move_failed') end,
swap= function() FMOD.effect('rotate') end,
swap_failed= function() FMOD.effect('tuck') end,
twist= function() FMOD.effect('rotate') end,
twist_failed= function() FMOD.effect('tuck') end,
move_back= function() FMOD.effect('rotate_failed') end,
touch= function() FMOD.effect('lock') end,
clear=function(lines)
FMOD.effect.play(
FMOD.effect(
lines==1 and 'clear_1' or
lines==2 and 'clear_2' or
lines==3 and 'clear_3' or
Expand All @@ -88,8 +88,8 @@ local defaultSoundFunc={
end,
combo= function() end,
chain= function() end,
win= function() FMOD.effect.play('win') end,
fail= function() FMOD.effect.play('fail') end,
win= function() FMOD.effect('win') end,
fail= function() FMOD.effect('fail') end,
}
GP.scriptCmd={
}
Expand Down
2 changes: 1 addition & 1 deletion assets/game/mechanicLib/mino/stack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function stack.switch(P)
P.settings.dropDelay,P.settings.lockDelay=1e99,1e99

P.particles.boardSmoke:start()
FMOD.effect.play('music_highcut')
FMOD.effect('music_highcut')
else
if md.stack_lines>0 then
P:say{
Expand Down
66 changes: 33 additions & 33 deletions assets/game/minoPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ local defaultSoundFunc={
playSample('sine',{'A2',2.2-num/5},{'E3',2.2-num/5})
end
end,
move= function() FMOD.effect.play('move') end,
move_down= function() FMOD.effect.play('move_down') end,
move_failed= function() FMOD.effect.play('move_failed') end,
tuck= function() FMOD.effect.play('tuck') end,
rotate= function() FMOD.effect.play('rotate') end,
rotate_init= function() FMOD.effect.play('rotate_init') end,
rotate_locked= function() FMOD.effect.play('rotate_locked') end,
rotate_corners= function() FMOD.effect.play('rotate_corners') end,
rotate_failed= function() FMOD.effect.play('rotate_failed') end,
rotate_special= function() FMOD.effect.play('rotate_special') end,
hold= function() FMOD.effect.play('hold') end,
hold_init= function() FMOD.effect.play('hold_init') end,
touch= function() FMOD.effect.play('touch') end,
drop= function() FMOD.effect.play('drop') end,
lock= function() FMOD.effect.play('lock') end,
b2b= function(lv) FMOD.effect.play('b2b_'..min(lv,10)) end,
b2b_break= function() FMOD.effect.play('b2b_break') end,
move= function() FMOD.effect('move') end,
move_down= function() FMOD.effect('move_down') end,
move_failed= function() FMOD.effect('move_failed') end,
tuck= function() FMOD.effect('tuck') end,
rotate= function() FMOD.effect('rotate') end,
rotate_init= function() FMOD.effect('rotate_init') end,
rotate_locked= function() FMOD.effect('rotate_locked') end,
rotate_corners= function() FMOD.effect('rotate_corners') end,
rotate_failed= function() FMOD.effect('rotate_failed') end,
rotate_special= function() FMOD.effect('rotate_special') end,
hold= function() FMOD.effect('hold') end,
hold_init= function() FMOD.effect('hold_init') end,
touch= function() FMOD.effect('touch') end,
drop= function() FMOD.effect('drop') end,
lock= function() FMOD.effect('lock') end,
b2b= function(lv) FMOD.effect('b2b_'..min(lv,10)) end,
b2b_break= function() FMOD.effect('b2b_break') end,
clear=function(lines)
FMOD.effect.play(
FMOD.effect(
lines<=6 and 'clear_'..lines or
lines<=18 and 'clear_'..(lines-lines%2) or
lines<=22 and 'clear_'..lines or
Expand All @@ -67,12 +67,12 @@ local defaultSoundFunc={
)
end,
spin=function(lines)
if lines==0 then FMOD.effect.play('spin_0')
elseif lines==1 then FMOD.effect.play('spin_1')
elseif lines==2 then FMOD.effect.play('spin_2')
elseif lines==3 then FMOD.effect.play('spin_3')
elseif lines==4 then FMOD.effect.play('spin_4')
else FMOD.effect.play('spin_mega')
if lines==0 then FMOD.effect('spin_0')
elseif lines==1 then FMOD.effect('spin_1')
elseif lines==2 then FMOD.effect('spin_2')
elseif lines==3 then FMOD.effect('spin_3')
elseif lines==4 then FMOD.effect('spin_4')
else FMOD.effect('spin_mega')
end
end,
combo=setmetatable({
Expand Down Expand Up @@ -108,15 +108,15 @@ local defaultSoundFunc={
playSample('square',{57+phase,1-(phase/12)^2,400-10*combo,700+20*combo}) -- A5+
end
end,__metatable=true}),
frenzy= function() FMOD.effect.play('frenzy') end,
allClear= function() FMOD.effect.play('clear_all') end,
halfClear= function() FMOD.effect.play('clear_half') end,
suffocate= function() FMOD.effect.play('suffocate') end,
desuffocate= function() FMOD.effect.play('desuffocate') end,
reach= function() FMOD.effect.play('beep_rise') end,
notice= function() FMOD.effect.play('beep_notice') end,
win= function() FMOD.effect.play('win') end,
fail= function() FMOD.effect.play('fail') end,
frenzy= function() FMOD.effect('frenzy') end,
allClear= function() FMOD.effect('clear_all') end,
halfClear= function() FMOD.effect('clear_half') end,
suffocate= function() FMOD.effect('suffocate') end,
desuffocate= function() FMOD.effect('desuffocate') end,
reach= function() FMOD.effect('beep_rise') end,
notice= function() FMOD.effect('beep_notice') end,
win= function() FMOD.effect('win') end,
fail= function() FMOD.effect('fail') end,
}
MP.scriptCmd={
clearHold=function(P) P:clearHold() end,
Expand Down
6 changes: 3 additions & 3 deletions assets/game/minomap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ end
local function _selectMode(m)
selected=m
if m then
FMOD.effect.play('map_select')
FMOD.effect('map_select')
end
end
local function _enterMode(m)
if m then
if love.filesystem.getInfo('assets/game/mode/mino/exterior/'..m.name..'.lua') then
enterFX.timer=0
enterFX.x,enterFX.y,enterFX.r=m.x,m.y,m.r
FMOD.effect.play('map_enter')
FMOD.effect('map_enter')
SCN.go('game_out','fade','mino/exterior/'..m.name)
else
MSG.new('warn',"Mode file not exist")
Expand Down Expand Up @@ -343,7 +343,7 @@ function map:update(dt)
cam.x0,cam.y0=-a.x,-a.y
cam.k0,cam.a0=1,0
if TASK.lock('minomap_unlockSound',.26) then
FMOD.effect.play(a.sound)
FMOD.effect(a.sound)
end
end
else
Expand Down
38 changes: 19 additions & 19 deletions assets/game/puyoPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ local defaultSoundFunc={
playSample('sine',{'A2',2.2-num/5},{'E3',2.2-num/5})
end
end,
move= function() FMOD.effect.play('move') end,
move_down= function() FMOD.effect.play('move_down') end,
move_failed= function() FMOD.effect.play('move_failed') end,
rotate= function() FMOD.effect.play('rotate') end,
rotate_init= function() FMOD.effect.play('rotate_init') end,
rotate_failed= function() FMOD.effect.play('rotate_failed') end,
rotate_special= function() FMOD.effect.play('rotate_special') end,
touch= function() FMOD.effect.play('touch') end,
drop= function() FMOD.effect.play('drop') end,
lock= function() FMOD.effect.play('lock') end,
move= function() FMOD.effect('move') end,
move_down= function() FMOD.effect('move_down') end,
move_failed= function() FMOD.effect('move_failed') end,
rotate= function() FMOD.effect('rotate') end,
rotate_init= function() FMOD.effect('rotate_init') end,
rotate_failed= function() FMOD.effect('rotate_failed') end,
rotate_special= function() FMOD.effect('rotate_special') end,
touch= function() FMOD.effect('touch') end,
drop= function() FMOD.effect('drop') end,
lock= function() FMOD.effect('lock') end,
clear=function(lines)
FMOD.effect.play(
FMOD.effect(
lines==1 and 'clear_1' or
lines==2 and 'clear_2' or
lines==3 and 'clear_3' or
Expand Down Expand Up @@ -92,14 +92,14 @@ local defaultSoundFunc={
playSample('square',{57+phase,1-(phase/12)^2,400-10*chain,700+20*chain}) -- A5+
end
end,__metatable=true}),
frenzy= function() FMOD.effect.play('frenzy') end,
allClear= function() FMOD.effect.play('clear_all') end,
suffocate= function() FMOD.effect.play('suffocate') end,
desuffocate= function() FMOD.effect.play('desuffocate') end,
reach= function() FMOD.effect.play('beep_rise') end,
notice= function() FMOD.effect.play('beep_notice') end,
win= function() FMOD.effect.play('win') end,
fail= function() FMOD.effect.play('fail') end,
frenzy= function() FMOD.effect('frenzy') end,
allClear= function() FMOD.effect('clear_all') end,
suffocate= function() FMOD.effect('suffocate') end,
desuffocate= function() FMOD.effect('desuffocate') end,
reach= function() FMOD.effect('beep_rise') end,
notice= function() FMOD.effect('beep_notice') end,
win= function() FMOD.effect('win') end,
fail= function() FMOD.effect('fail') end,
}
PP.scriptCmd={
}
Expand Down
6 changes: 3 additions & 3 deletions assets/gamefunc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function playBgm(name,full,noProgress)
if name==_bgmPlaying then return end
if not noProgress then PROGRESS.setBgmUnlocked(name,full and 2 or 1) end
if full then
FMOD.music.play(name)
FMOD.music(name)
else
FMOD.music.play(name,{param={"intensity",0,true}})
FMOD.music(name,{param={"intensity",0,true}})
end
_bgmPlaying=name
end
Expand All @@ -38,7 +38,7 @@ function playSample(...)
local vol=l[i][2] or 1
local len=l[i][3] or 420
local rel=l[i][4] or 620
local event=FMOD.effect.play(inst,{
local event=FMOD.effect(inst,{
tune=note-33,
volume=vol,
param={'release',rel*1.0594630943592953^(note-33)},
Expand Down
2 changes: 1 addition & 1 deletion assets/progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ function PROGRESS.setModeState(style,name,state,force)
PROGRESS.save()
if state==0 and state>orgState then
if TASK.lock('minomap_unlockSound_background',2.6) then
FMOD.effect.play('map_unlock_background')
FMOD.effect('map_unlock_background')
MSG.new('check',Text.new_level_unlocked,2.6)
end
end
Expand Down
4 changes: 2 additions & 2 deletions assets/scene/app_15p.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ local function tapBoard(x,y,key)
if checkBoard(b) then
state=2
time=love.timer.getTime()-startTime
FMOD.effect.play('win')
FMOD.effect('win')
return
end
FMOD.effect.play('touch')
FMOD.effect('touch')
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions assets/scene/app_2048.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ local function newTile()

-- Die.
state=2
FMOD.effect.play(maxTile>=10 and 'win' or 'fail')
FMOD.effect(maxTile>=10 and 'win' or 'fail')
end
local function freshMaxTile()
maxTile=maxTile+1
if maxTile==12 then
skipper.cd=0
end
FMOD.effect.play('reach')
FMOD.effect('reach')
table.insert(progress,("%s - %.3fs"):format(tileName[maxTile],love.timer.getTime()-startTime))
end
local function squash(L)
Expand Down Expand Up @@ -221,9 +221,9 @@ local function skip()
skipper.cd=1024
skipper.used=true
newTile()
FMOD.effect.play('hold')
FMOD.effect('hold')
else
FMOD.effect.play('finesseError')
FMOD.effect('finesseError')
end
end
end
Expand Down Expand Up @@ -309,7 +309,7 @@ function scene.keyDown(key,isRep)
if skipper.cd and skipper.cd>0 then
skipper.cd=skipper.cd-1
if skipper.cd==0 then
FMOD.effect.play('spin_0')
FMOD.effect('spin_0')
end
end
newTile()
Expand All @@ -322,7 +322,7 @@ function scene.keyDown(key,isRep)
}
move=move+1
if not autoPressing then
FMOD.effect.play('touch')
FMOD.effect('touch')
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions assets/scene/app_AtoZ.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ function scene.keyDown(key,isRep)
style='score',
duration=.4,
}
FMOD.effect.play('touch')
FMOD.effect('touch')
if progress==2 then
state=1
startTime=love.timer.getTime()
elseif progress>#targetString then
time=love.timer.getTime()-startTime
state=2
FMOD.effect.play('reach')
FMOD.effect('reach')
end
elseif progress>1 then
mistake=mistake+1
FMOD.effect.play('finesseError')
FMOD.effect('finesseError')
end
end
elseif key=='left' or key=='right' then
Expand Down
8 changes: 4 additions & 4 deletions assets/scene/app_UTTT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,26 @@ local function full(L)
end
local function place(X,x)
board[X][x]=round
FMOD.effect.play('touch')
FMOD.effect('touch')
lastX,lastx=X,x
curX,curx=nil
placeTime=love.timer.getTime()
if checkBoard(board[X],round) then
score[X]=round
if checkBoard(score,round) then
gameover=round
FMOD.effect.play('win')
FMOD.effect('win')
return
else
if full(score) then
gameover=true
return
end
end
FMOD.effect.play('reach')
FMOD.effect('reach')
else
if full(board[X]) then
FMOD.effect.play('emit')
FMOD.effect('emit')
score[X]=true
if full(score) then
gameover=true
Expand Down
6 changes: 3 additions & 3 deletions assets/scene/app_cubefield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ local function hurt(i)
speed=speed*.5
moveDir=0
score=floor(score)
FMOD.effect.play('clear_4')
FMOD.effect('clear_4')
else
FMOD.effect.play('clear_2')
FMOD.effect('clear_2')
end
end

Expand Down Expand Up @@ -185,7 +185,7 @@ function scene.update(dt)
speed=speed+.2
end
level=level+1
FMOD.effect.play('warn_1')
FMOD.effect('warn_1')
end
sunH=sunH+.01
elseif menu==1 then
Expand Down
Loading

0 comments on commit d3cbe31

Please sign in to comment.