Compare commits
28 Commits
pre0.17.1-
...
pre1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63da1b5585 | ||
|
|
929be4faf0 | ||
|
|
59a5b52993 | ||
|
|
c412e07153 | ||
|
|
252f19c6df | ||
|
|
8264fdd4bf | ||
|
|
dfd28f2f10 | ||
|
|
5fc1257e58 | ||
|
|
5c39765f71 | ||
|
|
ca92622d5d | ||
|
|
e28902bc97 | ||
|
|
d228809a53 | ||
|
|
60f8a22dd5 | ||
|
|
db4ae56990 | ||
|
|
e95288b171 | ||
|
|
2511555eb0 | ||
|
|
4c4f01cb95 | ||
|
|
7177118f34 | ||
|
|
a6d5c4a1bf | ||
|
|
73a828d73a | ||
|
|
a7df4d6aa7 | ||
|
|
7fe4802887 | ||
|
|
7eac341b9a | ||
|
|
1fa02a18b2 | ||
|
|
b15cb64681 | ||
|
|
bf345c8655 | ||
|
|
cbdb15d658 | ||
|
|
8b4504bfa0 |
7
.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE_1.md
vendored
@@ -2,7 +2,8 @@
|
||||
name: Bug report (bluescreen crash) Bug报告 (蓝屏报错)
|
||||
about: Create a report of problems which made the crash with a bluescreen
|
||||
---
|
||||
Screenshot with crash information (*Image(s) Here*):
|
||||
Screenshot with crash information: (delete this line before submitting)
|
||||
*Image Here*
|
||||
|
||||
|
||||
If you can reproduce it, write the steps here. If you can't, try to describe the exactly time the game crash, like pressing which key or which button (*Details Here*)
|
||||
If you can reproduce it, write the steps here. If you can't, try to describe the exactly time the game crash, like pressing which key or which button: (delete this line before submitting)
|
||||
*Details Here*
|
||||
7
.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE_2.md
vendored
@@ -2,7 +2,8 @@
|
||||
name: Bug report (unintended behaviors) Bug报告 (奇怪的现象)
|
||||
about: Create a report of unintended behaviors
|
||||
---
|
||||
Screenshot with unintended behaviors (*Image(s) Here*):
|
||||
Screenshot with unintended behaviors: (delete this line before submitting)
|
||||
*Image(s) Here*
|
||||
|
||||
|
||||
If you can reproduce it, write the steps here. If you can't, try to describe the exactly time the game crash, like pressing which key or which button (*Details Here*):
|
||||
If you can reproduce it, write the steps here. If you can't, try to describe the exactly time the game crash, like pressing which key or which button: (delete this line before submitting)
|
||||
*Details Here*
|
||||
51
.github/actions/upload-artifact/action.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: "upload artifact"
|
||||
description: "upload file with webdav"
|
||||
inputs:
|
||||
WEBDAV_USERNAME:
|
||||
required: true
|
||||
description: "webdav username"
|
||||
WEBDAV_PASSWORD:
|
||||
required: true
|
||||
description: "webdav password"
|
||||
ARTIFACT_TYPE:
|
||||
required: true
|
||||
description: "file build type"
|
||||
ARTIFACT_PLATFORM:
|
||||
required: true
|
||||
description: "file platform"
|
||||
ARTIFACT_NAME:
|
||||
required: true
|
||||
description: "file name"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install Webdav 4
|
||||
shell: bash
|
||||
run: |
|
||||
pip install webdav4
|
||||
- name: Update release
|
||||
shell: python
|
||||
run: |
|
||||
import re
|
||||
from webdav4.client import Client
|
||||
|
||||
client = Client(
|
||||
"http://mc.yuhao7370.top:5212/dav",
|
||||
auth=("${{ inputs.WEBDAV_USERNAME }}", "${{ inputs.WEBDAV_PASSWORD }}"),
|
||||
timeout=None,
|
||||
)
|
||||
if '${{ inputs.ARTIFACT_TYPE }}' == 'release'
|
||||
print('Removing previous ${{ inputs.ARTIFACT_PLATFORM }} release file...')
|
||||
for file in client.ls('Techmino distribution'):
|
||||
if re.search(r'(Techmino_a[0-9]+\.[0-9]+\.[0-9]_${{ inputs.ARTIFACT_PLATFORM }}.*)', file['name']):
|
||||
client.remove(file['name'])
|
||||
print('Uploading new ${{ inputs.ARTIFACT_PLATFORM }} release file...')
|
||||
client.upload_file("${{ inputs.ARTIFACT_NAME }}", 'Techmino distribution/${{ inputs.ARTIFACT_NAME }}')
|
||||
|
||||
if '${{ inputs.ARTIFACT_TYPE }}' == 'test':
|
||||
print('Removing previous ${{ inputs.ARTIFACT_PLATFORM }} test file...')
|
||||
for file in client.ls('Techmino Snapshot'):
|
||||
if re.search(r'(Techmino_pre[0-9]+\.[0-9]+\.[0-9]_[0-9a-z]{7}_${{ inputs.ARTIFACT_PLATFORM }}.*)', file['name']):
|
||||
client.remove(file['name'])
|
||||
print('Uploading new ${{ inputs.ARTIFACT_PLATFORM }} test file...')
|
||||
client.upload_file("${{ inputs.ARTIFACT_NAME }}", 'Techmino Snapshot/${{ inputs.ARTIFACT_NAME }}')
|
||||
BIN
.github/build/macOS/backgroundImage.tiff
vendored
48
.github/workflows/release.yml
vendored
@@ -56,6 +56,14 @@ jobs:
|
||||
with:
|
||||
name: ${{ needs.get-info.outputs.updateTitle }}
|
||||
files: Techmino_a${{ needs.get-info.outputs.release }}_Win64.zip
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: release
|
||||
ARTIFACT_PLATFORM: Win64
|
||||
ARTIFACT_NAME: Techmino_a${{ needs.get-info.outputs.release }}_Win64.zip
|
||||
|
||||
build-windows-x86:
|
||||
runs-on: windows-latest
|
||||
@@ -77,6 +85,14 @@ jobs:
|
||||
with:
|
||||
name: ${{ needs.get-info.outputs.updateTitle }}
|
||||
files: Techmino_a${{ needs.get-info.outputs.release }}_Win32.zip
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: release
|
||||
ARTIFACT_PLATFORM: Win32
|
||||
ARTIFACT_NAME: Techmino_a${{ needs.get-info.outputs.release }}_Win32.zip
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -93,6 +109,14 @@ jobs:
|
||||
with:
|
||||
name: ${{ needs.get-info.outputs.updateTitle }}
|
||||
files: Techmino_a${{ needs.get-info.outputs.release }}_Linux.AppImage
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: release
|
||||
ARTIFACT_PLATFORM: Linux
|
||||
ARTIFACT_NAME: Techmino_a${{ needs.get-info.outputs.release }}_Linux.AppImage
|
||||
|
||||
build-android:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -115,6 +139,14 @@ jobs:
|
||||
with:
|
||||
name: ${{ needs.get-info.outputs.updateTitle }}
|
||||
files: Techmino_a${{ needs.get-info.outputs.release }}_Android.apk
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: release
|
||||
ARTIFACT_PLATFORM: Android
|
||||
ARTIFACT_NAME: Techmino_a${{ needs.get-info.outputs.release }}_Android.apk
|
||||
|
||||
build-macOS:
|
||||
runs-on: macos-10.15
|
||||
@@ -142,6 +174,14 @@ jobs:
|
||||
with:
|
||||
name: ${{ needs.get-info.outputs.updateTitle }}
|
||||
files: Techmino_a${{ needs.get-info.outputs.release }}_MacOS.dmg
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: release
|
||||
ARTIFACT_PLATFORM: MacOS
|
||||
ARTIFACT_NAME: Techmino_a${{ needs.get-info.outputs.release }}_MacOS.dmg
|
||||
|
||||
build-iOS:
|
||||
runs-on: macos-latest
|
||||
@@ -176,6 +216,14 @@ jobs:
|
||||
with:
|
||||
name: ${{ needs.get-info.outputs.updateTitle }}
|
||||
files: Techmino_a${{ needs.get-info.outputs.release }}_iOS.ipa
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: release
|
||||
ARTIFACT_PLATFORM: iOS
|
||||
ARTIFACT_NAME: Techmino_a${{ needs.get-info.outputs.release }}_iOS.ipa
|
||||
|
||||
Add-Release-note:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
55
.github/workflows/test.yml
vendored
@@ -49,7 +49,20 @@ jobs:
|
||||
with:
|
||||
name: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Windows
|
||||
path: love
|
||||
|
||||
- name: Pack Techmino
|
||||
run: 7z a -tzip .\Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Windows.zip .\love
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: test
|
||||
ARTIFACT_PLATFORM: Windows
|
||||
ARTIFACT_NAME: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Windows.zip
|
||||
# - name: Upload artifact to server
|
||||
# run: |
|
||||
# curl --user "${{ secrets.WEBDAV_USERNAME }}:${{ secrets.WEBDAV_PASSWORD }}" -T Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Windows.zip http://mc.yuhao7370.top:5212/dav/Techmino%20Snapshots/ -v
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: get-info
|
||||
@@ -67,6 +80,16 @@ jobs:
|
||||
with:
|
||||
name: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Linux
|
||||
path: Techmino.AppImage
|
||||
- name: Pack Techmino
|
||||
run: mv Techmino.AppImage Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Linux.AppImage
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: test
|
||||
ARTIFACT_PLATFORM: Linux
|
||||
ARTIFACT_NAME: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Linux.AppImage
|
||||
|
||||
build-android:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -92,6 +115,16 @@ jobs:
|
||||
with:
|
||||
name: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Android
|
||||
path: Techmino_Snapshot.apk
|
||||
- name: Pack Techmino
|
||||
run: mv Techmino_Snapshot.apk Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Android.apk
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: test
|
||||
ARTIFACT_PLATFORM: Android
|
||||
ARTIFACT_NAME: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_Android.apk
|
||||
|
||||
build-macOS:
|
||||
runs-on: macos-10.15
|
||||
@@ -119,6 +152,16 @@ jobs:
|
||||
with:
|
||||
name: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_MacOS
|
||||
path: Techmino.dmg
|
||||
- name: Pack Techmino
|
||||
run: mv Techmino.dmg Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_MacOS.dmg
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: test
|
||||
ARTIFACT_PLATFORM: MacOS
|
||||
ARTIFACT_NAME: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_MacOS.dmg
|
||||
|
||||
build-iOS:
|
||||
runs-on: macos-latest
|
||||
@@ -152,3 +195,13 @@ jobs:
|
||||
with:
|
||||
name: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_iOS
|
||||
path: Techmino.ipa
|
||||
- name: Pack Techmino
|
||||
run: mv Techmino.ipa Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_iOS.ipa
|
||||
- name: Upload artifact to server
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
with:
|
||||
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
|
||||
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
|
||||
ARTIFACT_TYPE: test
|
||||
ARTIFACT_PLATFORM: iOS
|
||||
ARTIFACT_NAME: Techmino_pre${{ needs.get-info.outputs.release }}_${{ needs.get-info.outputs.commit }}_iOS.ipa
|
||||
|
||||
@@ -4,9 +4,8 @@ local BGs={
|
||||
}
|
||||
local BGlist={'none'}
|
||||
local BG={
|
||||
default='none',
|
||||
locked=false,
|
||||
cur='none',
|
||||
default='none',
|
||||
init=false,
|
||||
resize=false,
|
||||
update=NULL,
|
||||
@@ -15,8 +14,6 @@ local BG={
|
||||
discard=NULL,
|
||||
}
|
||||
|
||||
function BG.lock()BG.locked=true end
|
||||
function BG.unlock()BG.locked=false end
|
||||
function BG.add(name,bg)
|
||||
BGs[name]=bg
|
||||
BGlist[#BGlist+1]=name
|
||||
@@ -24,9 +21,6 @@ end
|
||||
function BG.getList()
|
||||
return BGlist
|
||||
end
|
||||
function BG.remList(name)
|
||||
table.remove(BGlist,TABLE.find(BGlist,name))
|
||||
end
|
||||
function BG.send(...)
|
||||
if BG.event then
|
||||
BG.event(...)
|
||||
@@ -35,20 +29,20 @@ end
|
||||
function BG.setDefault(bg)
|
||||
BG.default=bg
|
||||
end
|
||||
function BG.set(name)
|
||||
name=name or BG.default
|
||||
if not BGs[name]or BG.locked then return end
|
||||
if name~=BG.cur then
|
||||
function BG.set(background)
|
||||
background=background or BG.default
|
||||
if not BGs[background]or not SETTING.bg then return end
|
||||
if background~=BG.cur then
|
||||
BG.discard()
|
||||
BG.cur=name
|
||||
local bg=BGs[name]
|
||||
BG.cur=background
|
||||
background=BGs[background]
|
||||
|
||||
BG.init= bg.init or NULL
|
||||
BG.resize= bg.resize or NULL
|
||||
BG.update= bg.update or NULL
|
||||
BG.draw= bg.draw or NULL
|
||||
BG.event= bg.event or NULL
|
||||
BG.discard=bg.discard or NULL
|
||||
BG.init= background.init or NULL
|
||||
BG.resize= background.resize or NULL
|
||||
BG.update= background.update or NULL
|
||||
BG.draw= background.draw or NULL
|
||||
BG.event= background.event or NULL
|
||||
BG.discard=background.discard or NULL
|
||||
BG.init()
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local lastLoaded={}
|
||||
local maxLoadedCount=3
|
||||
local SourceObjList={}
|
||||
local Sources={}
|
||||
local volume=1
|
||||
|
||||
local BGM={
|
||||
@@ -39,41 +37,15 @@ end
|
||||
local function check_curFadeOut(task,code,src)
|
||||
return task.code==code and task.args[1]==src
|
||||
end
|
||||
local function _tryReleaseSources()
|
||||
local n=#lastLoaded
|
||||
while #lastLoaded>maxLoadedCount do
|
||||
local name=lastLoaded[n]
|
||||
if SourceObjList[name].source:isPlaying()then
|
||||
n=n-1
|
||||
if n<=0 then return end
|
||||
else
|
||||
SourceObjList[name].source=SourceObjList[name].source:release()and nil
|
||||
table.remove(lastLoaded,n)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function BGM.setDefault(bgm)
|
||||
BGM.default=bgm
|
||||
end
|
||||
function BGM.setMaxSources(count)
|
||||
maxLoadedCount=count
|
||||
_tryReleaseSources()
|
||||
end
|
||||
function BGM.setChange(func)
|
||||
BGM.onChange=func
|
||||
end
|
||||
function BGM.setVol(v)
|
||||
assert(type(v)=='number'and v>=0 and v<=1,'Wrong volume')
|
||||
assert(type(v)=='number'and v>=0 and v<=1)
|
||||
volume=v
|
||||
if BGM.playing then
|
||||
if volume>0 then
|
||||
BGM.playing:setVolume(volume)
|
||||
BGM.playing:play()
|
||||
elseif BGM.nowPlay then
|
||||
BGM.playing:pause()
|
||||
end
|
||||
end
|
||||
end
|
||||
function BGM.init(list)
|
||||
BGM.init=nil
|
||||
@@ -81,7 +53,7 @@ function BGM.init(list)
|
||||
local simpList={}
|
||||
for _,v in next,list do
|
||||
table.insert(simpList,v.name)
|
||||
SourceObjList[v.name]={path=v.path,source=false}
|
||||
Sources[v.name]=v.path
|
||||
end
|
||||
table.sort(simpList)
|
||||
function BGM.getList()return simpList end
|
||||
@@ -89,54 +61,58 @@ function BGM.init(list)
|
||||
LOG(count.." BGM files added")
|
||||
function BGM.getCount()return count end
|
||||
|
||||
local function _tryLoad(name)
|
||||
if SourceObjList[name]then
|
||||
if SourceObjList[name].source then
|
||||
return true
|
||||
elseif love.filesystem.getInfo(SourceObjList[name].path)then
|
||||
SourceObjList[name].source=love.audio.newSource(SourceObjList[name].path,'stream')
|
||||
SourceObjList[name].source:setLooping(true)
|
||||
SourceObjList[name].source:setVolume(0)
|
||||
table.insert(lastLoaded,1,name)
|
||||
_tryReleaseSources()
|
||||
local function _load(name)
|
||||
if type(Sources[name])=='string'then
|
||||
if love.filesystem.getInfo(Sources[name])then
|
||||
Sources[name]=love.audio.newSource(Sources[name],'stream')
|
||||
Sources[name]:setLooping(true)
|
||||
Sources[name]:setVolume(0)
|
||||
return true
|
||||
else
|
||||
LOG("No BGM: "..SourceObjList[name],5)
|
||||
LOG("No BGM: "..Sources[name],5)
|
||||
end
|
||||
elseif Sources[name]then
|
||||
return true
|
||||
elseif name then
|
||||
LOG("No BGM: "..name,5)
|
||||
end
|
||||
end
|
||||
function BGM.play(name,args)
|
||||
function BGM.setVol(v)
|
||||
assert(type(v)=='number'and v>=0 and v<=1)
|
||||
volume=v
|
||||
if BGM.playing then
|
||||
if volume>0 then
|
||||
BGM.playing:setVolume(volume)
|
||||
BGM.playing:play()
|
||||
elseif BGM.nowPlay then
|
||||
BGM.playing:pause()
|
||||
end
|
||||
end
|
||||
end
|
||||
function BGM.loadAll()--Not neccessary, unless you want avoid the lag when playing something for the first time
|
||||
for name in next,Sources do
|
||||
_load(name)
|
||||
end
|
||||
end
|
||||
function BGM.play(name)
|
||||
name=name or BGM.default
|
||||
args=args or""
|
||||
if not _tryLoad(name)then return end
|
||||
if not _load(name)then return end
|
||||
if volume==0 then
|
||||
BGM.nowPlay=name
|
||||
BGM.playing=SourceObjList[name].source
|
||||
BGM.playing=Sources[name]
|
||||
return true
|
||||
end
|
||||
if name and SourceObjList[name].source then
|
||||
if name and Sources[name]then
|
||||
if BGM.nowPlay~=name then
|
||||
if BGM.nowPlay then
|
||||
if not STRING.sArg(args,'-so')then
|
||||
TASK.new(task_fadeOut,BGM.playing)
|
||||
else
|
||||
BGM.playing:pause()
|
||||
end
|
||||
TASK.new(task_fadeOut,BGM.playing)
|
||||
end
|
||||
TASK.removeTask_iterate(check_curFadeOut,task_fadeOut,SourceObjList[name].source)
|
||||
TASK.removeTask_iterate(check_curFadeOut,task_fadeOut,Sources[name])
|
||||
TASK.removeTask_code(task_fadeIn)
|
||||
|
||||
TASK.new(task_fadeIn,Sources[name])
|
||||
BGM.nowPlay=name
|
||||
BGM.playing=SourceObjList[name].source
|
||||
if not STRING.sArg(args,'-si')then
|
||||
BGM.playing:setVolume(0)
|
||||
TASK.new(task_fadeIn,BGM.playing)
|
||||
else
|
||||
BGM.playing:setVolume(volume)
|
||||
BGM.playing:play()
|
||||
end
|
||||
BGM.playing=Sources[name]
|
||||
BGM.lastPlayed=BGM.nowPlay
|
||||
BGM.playing:seek(0)
|
||||
BGM.playing:play()
|
||||
@@ -152,22 +128,17 @@ function BGM.init(list)
|
||||
end
|
||||
function BGM.continue()
|
||||
if BGM.lastPlayed then
|
||||
BGM.nowPlay,BGM.playing=BGM.lastPlayed,SourceObjList[BGM.lastPlayed].source
|
||||
TASK.removeTask_iterate(check_curFadeOut,task_fadeOut,SourceObjList[BGM.nowPlay].source)
|
||||
BGM.nowPlay,BGM.playing=BGM.lastPlayed,Sources[BGM.lastPlayed]
|
||||
TASK.removeTask_iterate(check_curFadeOut,task_fadeOut,Sources[BGM.nowPlay])
|
||||
TASK.removeTask_code(task_fadeIn)
|
||||
TASK.new(task_fadeIn,BGM.playing)
|
||||
BGM.playing:play()
|
||||
end
|
||||
end
|
||||
function BGM.stop(args)
|
||||
args=args or""
|
||||
function BGM.stop()
|
||||
TASK.removeTask_code(task_fadeIn)
|
||||
if not STRING.sArg(args,'-s')then
|
||||
if BGM.nowPlay then
|
||||
TASK.new(task_fadeOut,BGM.playing)
|
||||
end
|
||||
else
|
||||
BGM.playing:pause()
|
||||
if BGM.nowPlay then
|
||||
TASK.new(task_fadeOut,BGM.playing)
|
||||
end
|
||||
BGM.nowPlay,BGM.playing=nil
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local abs=math.abs
|
||||
local function hsv(h,s,v,a)--Color type, Color amount, Light
|
||||
if s<=0 then return v,v,v,a end
|
||||
local function hsv(h,s,v,a)
|
||||
if s<=0 then return v,v,v end
|
||||
h=h*6
|
||||
local c=v*s
|
||||
local x=abs((h-1)%2-1)*c
|
||||
@@ -16,73 +16,68 @@ end
|
||||
local COLOR={
|
||||
hsv=hsv,
|
||||
|
||||
red= {hsv(0.00, 0.89, 0.91)},
|
||||
fire= {hsv(0.04, 0.93, 0.94)},
|
||||
orange= {hsv(0.09, 0.99, 0.96)},
|
||||
yellow= {hsv(0.15, 0.82, 0.90)},
|
||||
lime= {hsv(0.20, 0.89, 0.88)},
|
||||
jade= {hsv(0.25, 1.00, 0.82)},
|
||||
green= {hsv(0.33, 1.00, 0.81)},
|
||||
aqua= {hsv(0.47, 1.00, 0.76)},
|
||||
cyan= {hsv(0.53, 1.00, 0.88)},
|
||||
navy= {hsv(0.56, 1.00, 1.00)},
|
||||
sea= {hsv(0.61, 1.00, 1.00)},
|
||||
blue= {hsv(0.64, 1.00, 0.95)},
|
||||
violet= {hsv(0.74, 1.00, 0.91)},
|
||||
purple= {hsv(0.80, 1.00, 0.81)},
|
||||
magenta= {hsv(0.86, 1.00, 0.78)},
|
||||
wine= {hsv(0.92, 0.98, 0.91)},
|
||||
red= {hsv(0, .85,.85)},
|
||||
fire= {hsv(0.0625,.85,.85)},
|
||||
orange= {hsv(0.125, .85,.85)},
|
||||
yellow= {hsv(0.1875,.85,.85)},
|
||||
lime= {hsv(0.25, .85,.85)},
|
||||
jade= {hsv(0.3125,.85,.85)},
|
||||
green= {hsv(0.375, .85,.85)},
|
||||
aqua= {hsv(0.4375,.85,.85)},
|
||||
cyan= {hsv(0.5, .85,.85)},
|
||||
navy= {hsv(0.5625,.85,.85)},
|
||||
sea= {hsv(0.625, .85,.85)},
|
||||
blue= {hsv(0.6875,.85,.85)},
|
||||
violet= {hsv(0.75, .85,.85)},
|
||||
purple= {hsv(0.8125,.85,.85)},
|
||||
magenta= {hsv(0.875, .85,.85)},
|
||||
wine= {hsv(0.9375,.85,.85)},
|
||||
|
||||
lRed= {hsv(0.00, 0.38, 0.93)},
|
||||
lFire= {hsv(0.04, 0.45, 0.91)},
|
||||
lOrange= {hsv(0.10, 0.53, 0.92)},
|
||||
lYellow= {hsv(0.14, 0.61, 0.95)},
|
||||
lLime= {hsv(0.20, 0.66, 0.92)},
|
||||
lJade= {hsv(0.26, 0.56, 0.90)},
|
||||
lGreen= {hsv(0.34, 0.49, 0.89)},
|
||||
lAqua= {hsv(0.47, 0.59, 0.86)},
|
||||
lCyan= {hsv(0.51, 0.77, 0.88)},
|
||||
lNavy= {hsv(0.54, 0.80, 0.95)},
|
||||
lSea= {hsv(0.57, 0.72, 0.97)},
|
||||
lBlue= {hsv(0.64, 0.44, 0.96)},
|
||||
lViolet= {hsv(0.72, 0.47, 0.95)},
|
||||
lPurple= {hsv(0.80, 0.62, 0.89)},
|
||||
lMagenta= {hsv(0.86, 0.61, 0.89)},
|
||||
lWine= {hsv(0.93, 0.57, 0.92)},
|
||||
lRed= {hsv(0, .5,.95)},
|
||||
lFire= {hsv(0.0625,.5,.95)},
|
||||
lOrange= {hsv(0.125, .5,.95)},
|
||||
lYellow= {hsv(0.1875,.5,.95)},
|
||||
lLime= {hsv(0.25, .5,.95)},
|
||||
lJade= {hsv(0.3125,.5,.95)},
|
||||
lGreen= {hsv(0.375, .5,.95)},
|
||||
lAqua= {hsv(0.4375,.5,.95)},
|
||||
lCyan= {hsv(0.5, .5,.95)},
|
||||
lNavy= {hsv(0.5625,.5,.95)},
|
||||
lSea= {hsv(0.625, .5,.95)},
|
||||
lBlue= {hsv(0.6875,.5,.95)},
|
||||
lViolet= {hsv(0.75, .5,.95)},
|
||||
lPurple= {hsv(0.8125,.5,.95)},
|
||||
lMagenta={hsv(0.875, .5,.95)},
|
||||
lWine= {hsv(0.9375,.5,.95)},
|
||||
|
||||
dRed= {hsv(0.00, 0.80, 0.48)},
|
||||
dFire= {hsv(0.04, 0.80, 0.34)},
|
||||
dOrange= {hsv(0.07, 0.80, 0.39)},
|
||||
dYellow= {hsv(0.12, 0.80, 0.37)},
|
||||
dLime= {hsv(0.20, 0.80, 0.26)},
|
||||
dJade= {hsv(0.29, 0.80, 0.27)},
|
||||
dGreen= {hsv(0.33, 0.80, 0.26)},
|
||||
dAqua= {hsv(0.46, 0.80, 0.24)},
|
||||
dCyan= {hsv(0.50, 0.80, 0.30)},
|
||||
dNavy= {hsv(0.58, 0.80, 0.42)},
|
||||
dSea= {hsv(0.64, 0.80, 0.40)},
|
||||
dBlue= {hsv(0.67, 0.80, 0.34)},
|
||||
dViolet= {hsv(0.71, 0.80, 0.35)},
|
||||
dPurple= {hsv(0.76, 0.80, 0.32)},
|
||||
dMagenta= {hsv(0.87, 0.80, 0.28)},
|
||||
dWine= {hsv(0.92, 0.80, 0.28)},
|
||||
dRed= {hsv(0, .9,.5)},
|
||||
dFire= {hsv(0.0625,.9,.5)},
|
||||
dOrange= {hsv(0.125, .9,.5)},
|
||||
dYellow= {hsv(0.1875,.9,.5)},
|
||||
dLime= {hsv(0.25, .9,.5)},
|
||||
dJade= {hsv(0.3125,.9,.5)},
|
||||
dGreen= {hsv(0.375, .9,.5)},
|
||||
dAqua= {hsv(0.4375,.9,.5)},
|
||||
dCyan= {hsv(0.5, .9,.5)},
|
||||
dNavy= {hsv(0.5625,.9,.5)},
|
||||
dSea= {hsv(0.625, .9,.5)},
|
||||
dBlue= {hsv(0.6875,.9,.5)},
|
||||
dViolet= {hsv(0.75, .9,.5)},
|
||||
dPurple= {hsv(0.8125,.9,.5)},
|
||||
dMagenta={hsv(0.875, .9,.5)},
|
||||
dWine= {hsv(0.9375,.9,.5)},
|
||||
|
||||
black= {hsv(0.04, 0.04, 0.14)},
|
||||
dGray= {hsv(0.02, 0.05, 0.44)},
|
||||
gray= {hsv(0.02, 0.05, 0.65)},
|
||||
lGray= {hsv(0.02, 0.06, 0.86)},
|
||||
white= {hsv(0.01, 0.02, 0.99)},
|
||||
|
||||
xGray= {hsv(0.00, 0.00, 0.35,.8)},
|
||||
lxGray= {hsv(0.00, 0.00, 0.62,.8)},
|
||||
dxGray= {hsv(0.00, 0.00, 0.16,.8)},
|
||||
black= {hsv(0,0,.05)},
|
||||
dGray= {hsv(0,0,0.3)},
|
||||
gray= {hsv(0,0,0.6)},
|
||||
lGray= {hsv(0,0,0.8)},
|
||||
white= {hsv(0,0,.97)},
|
||||
}
|
||||
for k,v in next,{
|
||||
R='red', F='fire', O='orange', Y='yellow', L='lime', J='jade', G='green', A='aqua', C='cyan', N='navy', S='sea', B='blue', V='violet', P='purple', M='magenta', W='wine',
|
||||
lR='lRed',lF='lFire',lO='lOrange',lY='lYellow',lL='lLime',lJ='lJade',lG='lGreen',lA='lAqua',lC='lCyan',lN='lNavy',lS='lSea',lB='lBlue',lV='lViolet',lP='lPurple',lM='lMagenta',lW='lWine',
|
||||
dR='dRed',dF='dFire',dO='dOrange',dY='dYellow',dL='dLime',dJ='dJade',dG='dGreen',dA='dAqua',dC='dCyan',dN='dNavy',dS='dSea',dB='dBlue',dV='dViolet',dP='dPurple',dM='dMagenta',dW='dWine',
|
||||
D='black',dH='dGray',H='gray',lH='lGray',Z='white',
|
||||
X='xGray',lX='lxGray',dX='dxGray',
|
||||
--Remain letter: EIKQTUX
|
||||
}do
|
||||
COLOR[k]=COLOR[v]
|
||||
|
||||
@@ -1,76 +1,66 @@
|
||||
local fs=love.filesystem
|
||||
local FILE={}
|
||||
function FILE.load(name,args)
|
||||
if not args then args=''end
|
||||
function FILE.load(name,mode)
|
||||
if fs.getInfo(name)then
|
||||
local F=fs.newFile(name)
|
||||
assert(F:open'r','open error')
|
||||
local s=F:read()F:close()
|
||||
local mode=
|
||||
STRING.sArg(args,'-luaon')and'luaon'or
|
||||
STRING.sArg(args,'-lua')and'lua'or
|
||||
STRING.sArg(args,'-json')and'json'or
|
||||
STRING.sArg(args,'-string')and'string'or
|
||||
s:sub(1,6)=='return{'and'luaon'or
|
||||
(s:sub(1,1)=='['and s:sub(-1)==']'or s:sub(1,1)=='{'and s:sub(-1)=='}')and'json'or
|
||||
'string'
|
||||
if mode=='luaon'then
|
||||
local func,err_mes=loadstring(s)
|
||||
if func then
|
||||
setfenv(func,{})
|
||||
local res=func()
|
||||
return assert(res,'decode error')
|
||||
if F:open'r'then
|
||||
local s=F:read()
|
||||
F:close()
|
||||
if mode=='luaon'or not mode and s:sub(1,6)=="return{"then
|
||||
s=loadstring(s)
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
return s()
|
||||
end
|
||||
elseif mode=='json'or not mode and s:sub(1,1)=="["and s:sub(-1)=="]"or s:sub(1,1)=="{"and s:sub(-1)=="}"then
|
||||
local res=JSON.decode(s)
|
||||
if res then
|
||||
return res
|
||||
end
|
||||
elseif mode=='string'or not mode then
|
||||
return s
|
||||
else
|
||||
error('decode error: '..err_mes)
|
||||
MES.new("No file loading mode called "..tostring(mode))
|
||||
end
|
||||
elseif mode=='lua'then
|
||||
local func,err_mes=loadstring(s)
|
||||
if func then
|
||||
local res=func()
|
||||
return assert(res,'run error')
|
||||
else
|
||||
error('compile error: '..err_mes)
|
||||
end
|
||||
elseif mode=='json'then
|
||||
local res=JSON.decode(s)
|
||||
if res then
|
||||
return res
|
||||
end
|
||||
error('decode error')
|
||||
elseif mode=='string'then
|
||||
return s
|
||||
else
|
||||
error('unknown mode')
|
||||
MES.new('error',name.." "..text.loadError)
|
||||
end
|
||||
else
|
||||
error('no file')
|
||||
end
|
||||
end
|
||||
function FILE.save(data,name,args)
|
||||
if not args then args=''end
|
||||
if STRING.sArg(args,'-d')and fs.getInfo(name)then
|
||||
error('duplicate')
|
||||
end
|
||||
|
||||
function FILE.save(data,name,mode)
|
||||
if not mode then mode=""end
|
||||
if type(data)=='table'then
|
||||
if STRING.sArg(args,'-luaon')then
|
||||
if mode:find'l'then
|
||||
data=TABLE.dump(data)
|
||||
if not data then
|
||||
error('encode error')
|
||||
MES.new('error',name.." "..text.saveError.."dump error")
|
||||
return
|
||||
end
|
||||
else
|
||||
data=JSON.encode(data)
|
||||
if not data then
|
||||
error('encode error')
|
||||
MES.new('error',name.." "..text.saveError.."json error")
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
data=tostring(data)
|
||||
end
|
||||
|
||||
if mode:find'd'and fs.getInfo(name)then
|
||||
MES.new('error',text.saveError_duplicate)
|
||||
return
|
||||
end
|
||||
local F=fs.newFile(name)
|
||||
assert(F:open('w'),'open error')
|
||||
F:write(data)F:flush()F:close()
|
||||
F:open'w'
|
||||
local success,mes=F:write(data)
|
||||
F:flush()F:close()
|
||||
if success then
|
||||
return true
|
||||
else
|
||||
MES.new('error',text.saveError..(mes or"unknown error"))
|
||||
MES.traceback()
|
||||
end
|
||||
end
|
||||
function FILE.clear(path)
|
||||
if fs.getRealDirectory(path)==SAVEDIR and fs.getInfo(path).type=='directory'then
|
||||
|
||||
@@ -1,60 +1,67 @@
|
||||
local gc=love.graphics
|
||||
local set=gc.setFont
|
||||
local fontFiles,fontCache={},{}
|
||||
local defaultFont,defaultFallBack
|
||||
local curFont=false--Current using font object
|
||||
local fontCache={}
|
||||
local currentFontSize
|
||||
|
||||
local FONT={}
|
||||
function FONT.setDefault(name)defaultFont=name end
|
||||
function FONT.setFallback(name)defaultFallBack=name end
|
||||
function FONT.rawget(s)
|
||||
function FONT.set(s)
|
||||
if s~=currentFontSize then
|
||||
if not fontCache[s]then
|
||||
fontCache[s]=gc.setNewFont(s,'light',gc.getDPIScale()*SCR.k*2)
|
||||
end
|
||||
set(fontCache[s])
|
||||
currentFontSize=s
|
||||
end
|
||||
end
|
||||
function FONT.get(s)
|
||||
if not fontCache[s]then
|
||||
fontCache[s]=gc.setNewFont(s,'light',gc.getDPIScale()*SCR.k*2)
|
||||
end
|
||||
return fontCache[s]
|
||||
end
|
||||
function FONT.rawset(s)
|
||||
set(fontCache[s]or FONT.rawget(s))
|
||||
function FONT.reset()
|
||||
for s in next,fontCache do
|
||||
fontCache[s]=gc.setNewFont(s,'light',gc.getDPIScale()*SCR.k*2)
|
||||
end
|
||||
end
|
||||
function FONT.load(fonts)
|
||||
for name,path in next,fonts do
|
||||
assert(love.filesystem.getInfo(path),STRING.repD("Font file $1($2) not exist!",name,path))
|
||||
fontFiles[name]=love.filesystem.newFile(path)
|
||||
fontCache[name]={}
|
||||
|
||||
function FONT.load(mainFont,secFont)
|
||||
assert(love.filesystem.getInfo(mainFont),"Font file '"..mainFont.."' not exist!")
|
||||
mainFont=love.filesystem.newFile(mainFont)
|
||||
if secFont and love.filesystem.getInfo(secFont)then
|
||||
secFont=love.filesystem.newFile(secFont)
|
||||
else
|
||||
secFont=false
|
||||
end
|
||||
function FONT.set(s)
|
||||
if s~=currentFontSize then
|
||||
if not fontCache[s]then
|
||||
fontCache[s]=gc.setNewFont(mainFont,s,'light',gc.getDPIScale()*SCR.k*2)
|
||||
if secFont then
|
||||
fontCache[s]:setFallbacks(gc.setNewFont(secFont,s,'light',gc.getDPIScale()*SCR.k*2))
|
||||
end
|
||||
end
|
||||
set(fontCache[s])
|
||||
currentFontSize=s
|
||||
end
|
||||
end
|
||||
function FONT.get(s)
|
||||
if not fontCache[s]then
|
||||
fontCache[s]=gc.setNewFont(mainFont,s,'light',gc.getDPIScale()*SCR.k*2)
|
||||
if secFont then
|
||||
fontCache[s]:setFallbacks(gc.setNewFont(secFont,s,'light',gc.getDPIScale()*SCR.k*2))
|
||||
end
|
||||
end
|
||||
return fontCache[s]
|
||||
end
|
||||
function FONT.reset()
|
||||
for s in next,fontCache do
|
||||
fontCache[s]=gc.setNewFont(mainFont,s,'light',gc.getDPIScale()*SCR.k*2)
|
||||
if secFont then
|
||||
fontCache[s]:setFallbacks(gc.setNewFont(secFont,s,'light',gc.getDPIScale()*SCR.k*2))
|
||||
end
|
||||
end
|
||||
end
|
||||
FONT.reset()
|
||||
end
|
||||
function FONT.get(size,name)
|
||||
if not name then name=defaultFont end
|
||||
local f=fontCache[name][size]
|
||||
if not f then
|
||||
f=gc.setNewFont(fontFiles[name],size,'light',gc.getDPIScale()*SCR.k*2)
|
||||
if defaultFallBack and name~=defaultFallBack then
|
||||
f:setFallbacks(FONT.get(size,defaultFallBack))
|
||||
end
|
||||
fontCache[name][size]=f
|
||||
end
|
||||
return f
|
||||
end
|
||||
function FONT.set(size,name)
|
||||
if not name then name=defaultFont end
|
||||
|
||||
local f=fontCache[name][size]
|
||||
if f~=curFont then
|
||||
curFont=f or FONT.get(size,name)
|
||||
set(curFont)
|
||||
end
|
||||
end
|
||||
function FONT.reset()
|
||||
for name,cache in next,fontCache do
|
||||
if type(cache)=='table'then
|
||||
for size in next,cache do
|
||||
cache[size]=FONT.get(size,name)
|
||||
end
|
||||
else
|
||||
fontCache[name]=FONT.rawget(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return FONT
|
||||
|
||||
@@ -95,7 +95,6 @@ do--function GC.DO(L)
|
||||
setLJ="setLineJoin",
|
||||
|
||||
print="print",
|
||||
rawFT=function(...)FONT.rawset(...)end,
|
||||
setFT=function(...)FONT.set(...)end,
|
||||
mText=GC.mStr,
|
||||
mDraw=GC.draw,
|
||||
|
||||
@@ -2,6 +2,7 @@ local IMG={}
|
||||
function IMG.init(list)
|
||||
IMG.init=nil
|
||||
|
||||
local null=love.graphics.newCanvas(1,1)
|
||||
setmetatable(IMG,{__index=function(self,name)
|
||||
if type(list[name])=='table'then
|
||||
self[name]={}
|
||||
@@ -12,7 +13,7 @@ function IMG.init(list)
|
||||
self[name]=love.graphics.newImage(list[name])
|
||||
else
|
||||
LOG("No IMG: "..name)
|
||||
self[name]=PAPER
|
||||
self[name]=null
|
||||
end
|
||||
return self[name]
|
||||
end})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
NONE={}function NULL()end PAPER=love.graphics.newCanvas(1,1)
|
||||
NONE={}function NULL()end
|
||||
EDITING=""
|
||||
LOADED=false
|
||||
ERRDATA={}
|
||||
|
||||
--Pure lua modules (basic)
|
||||
MATH= require'Zframework.mathExtend'
|
||||
COLOR= require'Zframework.color'
|
||||
TABLE= require'Zframework.tableExtend'
|
||||
STRING= require'Zframework.stringExtend'
|
||||
@@ -37,6 +37,7 @@ REQUIRE= require'Zframework.require'
|
||||
TASK= require'Zframework.task'
|
||||
WS= require'Zframework.websocket'
|
||||
LANG= require'Zframework.languages'
|
||||
THEME= require'Zframework.theme'
|
||||
|
||||
--Love-based modules (basic)
|
||||
FILE= require'Zframework.file'
|
||||
@@ -60,7 +61,6 @@ BGM= require'Zframework.bgm'
|
||||
VOC= require'Zframework.voice'
|
||||
|
||||
local ms,kb=love.mouse,love.keyboard
|
||||
local KBisDown=kb.isDown
|
||||
|
||||
local gc=love.graphics
|
||||
local gc_push,gc_pop,gc_clear,gc_discard=gc.push,gc.pop,gc.clear,gc.discard
|
||||
@@ -70,13 +70,10 @@ local gc_draw,gc_line,gc_circle,gc_print=gc.draw,gc.line,gc.circle,gc.print
|
||||
|
||||
local WIDGET,SCR,SCN=WIDGET,SCR,SCN
|
||||
local xOy=SCR.xOy
|
||||
|
||||
local ITP=xOy.inverseTransformPoint
|
||||
local max,min=math.max,math.min
|
||||
|
||||
local mx,my,mouseShow,cursorSpd=640,360,false,0
|
||||
local jsState={}--map, joystickID->axisStates: {axisName->axisVal}
|
||||
local errData={}--list, each error create {mes={errMes strings},scene=sceneNameStr}
|
||||
local mx,my,mouseShow=-20,-20,false
|
||||
joysticks={}
|
||||
|
||||
local devMode
|
||||
|
||||
@@ -129,81 +126,36 @@ local function updatePowerInfo()
|
||||
end
|
||||
-------------------------------------------------------------
|
||||
local lastX,lastY=0,0--Last click pos
|
||||
local function _updateMousePos(x,y,dx,dy)
|
||||
if SCN.swapping then return end
|
||||
dx,dy=dx/SCR.k,dy/SCR.k
|
||||
if SCN.mouseMove then SCN.mouseMove(x,y,dx,dy)end
|
||||
if ms.isDown(1)then
|
||||
WIDGET.drag(x,y,dx,dy)
|
||||
else
|
||||
WIDGET.cursorMove(x,y)
|
||||
end
|
||||
end
|
||||
local function _triggerMouseDown(x,y,k)
|
||||
if devMode==1 then
|
||||
print(("(%d,%d)<-%d,%d ~~(%d,%d)<-%d,%d"):format(
|
||||
x,y,
|
||||
x-lastX,y-lastY,
|
||||
math.floor(x/10)*10,math.floor(y/10)*10,
|
||||
math.floor((x-lastX)/10)*10,math.floor((y-lastY)/10)*10
|
||||
))
|
||||
end
|
||||
if SCN.swapping then return end
|
||||
if SCN.mouseDown then SCN.mouseDown(x,y,k)end
|
||||
WIDGET.press(x,y,k)
|
||||
lastX,lastY=x,y
|
||||
if SETTING.clickFX then SYSFX.newTap(3,x,y)end
|
||||
end
|
||||
local function mouse_update(dt)
|
||||
if not KBisDown('lctrl','rctrl')and KBisDown('up','down','left','right')then
|
||||
local dx,dy=0,0
|
||||
if KBisDown('up')then dy=dy-cursorSpd end
|
||||
if KBisDown('down')then dy=dy+cursorSpd end
|
||||
if KBisDown('left')then dx=dx-cursorSpd end
|
||||
if KBisDown('right')then dx=dx+cursorSpd end
|
||||
mx=max(min(mx+dx,1280),0)
|
||||
my=max(min(my+dy,720),0)
|
||||
if my==0 or my==720 then
|
||||
WIDGET.sel=false
|
||||
WIDGET.drag(0,0,0,-dy)
|
||||
end
|
||||
_updateMousePos(mx,my,dx,dy)
|
||||
cursorSpd=min(cursorSpd+dt*26,12.6)
|
||||
else
|
||||
cursorSpd=6
|
||||
end
|
||||
end
|
||||
local function gp_update(js,dt)
|
||||
local sx,sy=js._jsObj:getGamepadAxis('leftx'),js._jsObj:getGamepadAxis('lefty')
|
||||
if math.abs(sx)>.1 or math.abs(sy)>.1 then
|
||||
local dx,dy=0,0
|
||||
if sy<-.1 then dy=dy+2*sy*cursorSpd end
|
||||
if sy>.1 then dy=dy+2*sy*cursorSpd end
|
||||
if sx<-.1 then dx=dx+2*sx*cursorSpd end
|
||||
if sx>.1 then dx=dx+2*sx*cursorSpd end
|
||||
mx=max(min(mx+dx,1280),0)
|
||||
my=max(min(my+dy,720),0)
|
||||
if my==0 or my==720 then
|
||||
WIDGET.sel=false
|
||||
WIDGET.drag(0,0,0,-dy)
|
||||
end
|
||||
_updateMousePos(mx,my,dx,dy)
|
||||
cursorSpd=min(cursorSpd+dt*26,12.6)
|
||||
else
|
||||
cursorSpd=6
|
||||
end
|
||||
end
|
||||
function love.mousepressed(x,y,k,touch)
|
||||
if touch then return end
|
||||
mouseShow=true
|
||||
mx,my=ITP(xOy,x,y)
|
||||
_triggerMouseDown(mx,my,k)
|
||||
if devMode==1 then
|
||||
print(("(%d,%d)<-%d,%d ~~(%d,%d)<-%d,%d"):format(
|
||||
mx,my,
|
||||
mx-lastX,my-lastY,
|
||||
math.floor(mx/10)*10,math.floor(my/10)*10,
|
||||
math.floor((mx-lastX)/10)*10,math.floor((my-lastY)/10)*10
|
||||
))
|
||||
end
|
||||
if SCN.swapping then return end
|
||||
if SCN.mouseDown then SCN.mouseDown(mx,my,k)end
|
||||
WIDGET.press(mx,my,k)
|
||||
lastX,lastY=mx,my
|
||||
if SETTING.clickFX then SYSFX.newTap(3,mx,my)end
|
||||
end
|
||||
function love.mousemoved(x,y,dx,dy,touch)
|
||||
if touch then return end
|
||||
mouseShow=true
|
||||
mx,my=ITP(xOy,x,y)
|
||||
_updateMousePos(mx,my,dx,dy)
|
||||
if SCN.swapping then return end
|
||||
dx,dy=dx/SCR.k,dy/SCR.k
|
||||
if SCN.mouseMove then SCN.mouseMove(mx,my,dx,dy)end
|
||||
if ms.isDown(1)then
|
||||
WIDGET.drag(mx,my,dx/SCR.k,dy/SCR.k)
|
||||
else
|
||||
WIDGET.cursorMove(mx,my)
|
||||
end
|
||||
end
|
||||
function love.mousereleased(x,y,k,touch)
|
||||
if touch or SCN.swapping then return end
|
||||
@@ -266,31 +218,31 @@ end
|
||||
|
||||
local fnKey={NULL,NULL,NULL,NULL,NULL,NULL,NULL}
|
||||
local function noDevkeyPressed(key)
|
||||
if key=='f1'then fnKey[1]()
|
||||
elseif key=='f2'then fnKey[2]()
|
||||
elseif key=='f3'then fnKey[3]()
|
||||
elseif key=='f4'then fnKey[4]()
|
||||
elseif key=='f5'then fnKey[5]()
|
||||
elseif key=='f6'then fnKey[6]()
|
||||
elseif key=='f7'then fnKey[7]()
|
||||
elseif key=='f8'then devMode=nil MES.new('info',"DEBUG OFF",.2)
|
||||
elseif key=='f9'then devMode=1 MES.new('info',"DEBUG 1")
|
||||
elseif key=='f10'then devMode=2 MES.new('info',"DEBUG 2")
|
||||
elseif key=='f11'then devMode=3 MES.new('info',"DEBUG 3")
|
||||
elseif key=='f12'then devMode=4 MES.new('info',"DEBUG 4")
|
||||
if key=="f1"then fnKey[1]()
|
||||
elseif key=="f2"then fnKey[2]()
|
||||
elseif key=="f3"then fnKey[3]()
|
||||
elseif key=="f4"then fnKey[4]()
|
||||
elseif key=="f5"then fnKey[5]()
|
||||
elseif key=="f6"then fnKey[6]()
|
||||
elseif key=="f7"then fnKey[7]()
|
||||
elseif key=="f8"then devMode=nil MES.new('info',"DEBUG OFF",.2)
|
||||
elseif key=="f9"then devMode=1 MES.new('info',"DEBUG 1")
|
||||
elseif key=="f10"then devMode=2 MES.new('info',"DEBUG 2")
|
||||
elseif key=="f11"then devMode=3 MES.new('info',"DEBUG 3")
|
||||
elseif key=="f12"then devMode=4 MES.new('info',"DEBUG 4")
|
||||
elseif devMode==2 then
|
||||
local W=WIDGET.sel
|
||||
if W then
|
||||
if key=='left'then W.x=W.x-10
|
||||
elseif key=='right'then W.x=W.x+10
|
||||
elseif key=='up'then W.y=W.y-10
|
||||
elseif key=='down'then W.y=W.y+10
|
||||
elseif key==','then W.w=W.w-10
|
||||
elseif key=='.'then W.w=W.w+10
|
||||
elseif key=='/'then W.h=W.h-10
|
||||
elseif key=='\''then W.h=W.h+10
|
||||
elseif key=='['then W.font=W.font-5
|
||||
elseif key==']'then W.font=W.font+5
|
||||
if key=="left"then W.x=W.x-10
|
||||
elseif key=="right"then W.x=W.x+10
|
||||
elseif key=="up"then W.y=W.y-10
|
||||
elseif key=="down"then W.y=W.y+10
|
||||
elseif key==","then W.w=W.w-10
|
||||
elseif key=="."then W.w=W.w+10
|
||||
elseif key=="/"then W.h=W.h-10
|
||||
elseif key=="'"then W.h=W.h+10
|
||||
elseif key=="["then W.font=W.font-5
|
||||
elseif key=="]"then W.font=W.font+5
|
||||
else return true
|
||||
end
|
||||
else
|
||||
@@ -304,34 +256,22 @@ function love.keypressed(key,_,isRep)
|
||||
mouseShow=false
|
||||
if devMode and not noDevkeyPressed(key)then
|
||||
return
|
||||
elseif key=='f8'then
|
||||
elseif key=="f8"then
|
||||
devMode=1
|
||||
MES.new('info',"DEBUG ON",.2)
|
||||
elseif key=='f11'then
|
||||
elseif key=="f11"then
|
||||
SETTING.fullscreen=not SETTING.fullscreen
|
||||
applyFullscreen()
|
||||
saveSettings()
|
||||
elseif not SCN.swapping then
|
||||
if EDITING==""and(not SCN.keyDown or SCN.keyDown(key,isRep))then
|
||||
local W=WIDGET.sel
|
||||
if key=='escape'and not isRep then
|
||||
SCN.back()
|
||||
elseif key=='up'or key=='down'or key=='left'or key=='right'then
|
||||
mouseShow=true
|
||||
if KBisDown('lctrl','rctrl')then
|
||||
if W and W.arrowKey then W:arrowKey(key)end
|
||||
end
|
||||
elseif key=='space'or key=='return'then
|
||||
mouseShow=true
|
||||
if not isRep then
|
||||
if SETTING.clickFX then SYSFX.newTap(3,mx,my)end
|
||||
_triggerMouseDown(mx,my,1)
|
||||
end
|
||||
else
|
||||
if W and W.keypress then
|
||||
W:keypress(key)
|
||||
end
|
||||
if SCN.keyDown then
|
||||
if EDITING==""then
|
||||
SCN.keyDown(key,isRep)
|
||||
end
|
||||
elseif key=="escape"and not isRep then
|
||||
SCN.back()
|
||||
else
|
||||
WIDGET.keyPressed(key,isRep)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -347,18 +287,18 @@ function love.textinput(texts)
|
||||
WIDGET.textinput(texts)
|
||||
end
|
||||
|
||||
--analog sticks: -1, 0, 1 for neg, neutral, pos
|
||||
--triggers: 0 for released, 1 for pressed
|
||||
local jsAxisEventName={
|
||||
leftx={'leftstick_left','leftstick_right'},
|
||||
lefty={'leftstick_up','leftstick_down'},
|
||||
rightx={'rightstick_left','rightstick_right'},
|
||||
righty={'rightstick_up','rightstick_down'},
|
||||
triggerleft='triggerleft',
|
||||
triggerright='triggerright'
|
||||
}
|
||||
local gamePadKeys={'a','b','x','y','back','guide','start','leftstick','rightstick','leftshoulder','rightshoulder','dpup','dpdown','dpleft','dpright'}
|
||||
local dPadToKey={
|
||||
function love.joystickadded(JS)
|
||||
table.insert(joysticks,JS)
|
||||
MES.new('info',"Joystick added")
|
||||
end
|
||||
function love.joystickremoved(JS)
|
||||
local i=TABLE.find(joysticks,JS)
|
||||
if i then
|
||||
table.remove(joysticks,i)
|
||||
MES.new('info',"Joystick removed")
|
||||
end
|
||||
end
|
||||
local keyMirror={
|
||||
dpup='up',
|
||||
dpdown='down',
|
||||
dpleft='left',
|
||||
@@ -366,118 +306,54 @@ local dPadToKey={
|
||||
start='return',
|
||||
back='escape',
|
||||
}
|
||||
function love.joystickadded(JS)
|
||||
table.insert(jsState,{
|
||||
_id=JS:getID(),
|
||||
_jsObj=JS,
|
||||
leftx=0,lefty=0,
|
||||
rightx=0,righty=0,
|
||||
triggerleft=0,triggerright=0
|
||||
})
|
||||
MES.new('info',"Joystick added")
|
||||
end
|
||||
function love.joystickremoved(JS)
|
||||
for i=1,#jsState do
|
||||
if jsState[i]._jsObj==JS then
|
||||
for j=1,#gamePadKeys do
|
||||
if JS:isGamepadDown(gamePadKeys[j])then
|
||||
love.gamepadreleased(JS,gamePadKeys[j])
|
||||
end
|
||||
end
|
||||
love.gamepadaxis(JS,'leftx',0)
|
||||
love.gamepadaxis(JS,'lefty',0)
|
||||
love.gamepadaxis(JS,'rightx',0)
|
||||
love.gamepadaxis(JS,'righty',0)
|
||||
love.gamepadaxis(JS,'triggerleft',-1)
|
||||
love.gamepadaxis(JS,'triggerright',-1)
|
||||
MES.new('info',"Joystick removed")
|
||||
table.remove(jsState,i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function love.gamepadaxis(JS,axis,val)
|
||||
if jsState[1]and JS==jsState[1]._jsObj then
|
||||
local js=jsState[1]
|
||||
if axis=='leftx'or axis=='lefty'or axis=='rightx'or axis=='righty'then
|
||||
local newVal=--range: [0,1]
|
||||
val>.4 and 1 or
|
||||
val<-.4 and -1 or
|
||||
0
|
||||
if newVal~=js[axis]then
|
||||
if js[axis]==-1 then
|
||||
love.gamepadreleased(JS,jsAxisEventName[axis][1])
|
||||
elseif js[axis]~=0 then
|
||||
love.gamepadreleased(JS,jsAxisEventName[axis][2])
|
||||
end
|
||||
if newVal==-1 then
|
||||
love.gamepadpressed(JS,jsAxisEventName[axis][1])
|
||||
elseif newVal==1 then
|
||||
love.gamepadpressed(JS,jsAxisEventName[axis][2])
|
||||
end
|
||||
js[axis]=newVal
|
||||
end
|
||||
elseif axis=='triggerleft'or axis=='triggerright'then
|
||||
local newVal=val>.3 and 1 or 0--range: [0,1]
|
||||
if newVal~=js[axis]then
|
||||
if newVal==1 then
|
||||
love.gamepadpressed(JS,jsAxisEventName[axis])
|
||||
else
|
||||
love.gamepadreleased(JS,jsAxisEventName[axis])
|
||||
end
|
||||
js[axis]=newVal
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function love.gamepadpressed(_,key)
|
||||
function love.gamepadpressed(_,i)
|
||||
mouseShow=false
|
||||
if not SCN.swapping then
|
||||
local cursorCtrl
|
||||
if SCN.gamepadDown then
|
||||
cursorCtrl=SCN.gamepadDown(key)
|
||||
elseif SCN.keyDown then
|
||||
cursorCtrl=SCN.keyDown(dPadToKey[key]or key)
|
||||
else
|
||||
cursorCtrl=true
|
||||
end
|
||||
if cursorCtrl then
|
||||
key=dPadToKey[key]or key
|
||||
mouseShow=true
|
||||
local W=WIDGET.sel
|
||||
if key=='back'then
|
||||
SCN.back()
|
||||
elseif key=='up'or key=='down'or key=='left'or key=='right'then
|
||||
mouseShow=true
|
||||
if W and W.arrowKey then W:arrowKey(key)end
|
||||
elseif key=='return'then
|
||||
mouseShow=true
|
||||
if SETTING.clickFX then SYSFX.newTap(3,mx,my)end
|
||||
_triggerMouseDown(mx,my,1)
|
||||
else
|
||||
if W and W.keypress then
|
||||
W:keypress(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
if SCN.swapping then return end
|
||||
if SCN.gamepadDown then SCN.gamepadDown(i)
|
||||
elseif SCN.keyDown then SCN.keyDown(keyMirror[i]or i)
|
||||
elseif i=="back"then SCN.back()
|
||||
else WIDGET.gamepadPressed(keyMirror[i]or i)
|
||||
end
|
||||
end
|
||||
function love.gamepadreleased(_,i)
|
||||
if SCN.swapping then return end
|
||||
if SCN.gamepadUp then SCN.gamepadUp(i)end
|
||||
end
|
||||
--[[
|
||||
function love.joystickpressed(JS,k)
|
||||
mouseShow=false
|
||||
if SCN.swapping then return end
|
||||
if SCN.gamepadDown then SCN.gamepadDown(i)
|
||||
elseif SCN.keyDown then SCN.keyDown(keyMirror[i]or i)
|
||||
elseif i=="back"then SCN.back()
|
||||
else WIDGET.gamepadPressed(i)
|
||||
end
|
||||
end
|
||||
function love.joystickreleased(JS,k)
|
||||
if SCN.swapping then return end
|
||||
if SCN.gamepadUp then SCN.gamepadUp(i)
|
||||
end
|
||||
end
|
||||
function love.joystickaxis(JS,axis,val)
|
||||
|
||||
end
|
||||
function love.joystickhat(JS,hat,dir)
|
||||
|
||||
end
|
||||
function love.sendData(data)end
|
||||
function love.receiveData(id,data)end
|
||||
]]
|
||||
function love.filedropped(file)
|
||||
if SCN.fileDropped then SCN.fileDropped(file)end
|
||||
end
|
||||
function love.directorydropped(dir)
|
||||
if SCN.directoryDropped then SCN.directoryDropped(dir)end
|
||||
end
|
||||
local autoGCcount=0
|
||||
local lastGCtime=0
|
||||
function love.lowmemory()
|
||||
collectgarbage()
|
||||
if autoGCcount<3 then
|
||||
autoGCcount=autoGCcount+1
|
||||
if love.timer.getTime()-lastGCtime>6.26 then
|
||||
collectgarbage()
|
||||
lastGCtime=love.timer.getTime()
|
||||
MES.new('check',"[auto GC] low MEM 设备内存过低")
|
||||
end
|
||||
end
|
||||
@@ -502,7 +378,7 @@ end
|
||||
function love.errorhandler(msg)
|
||||
if type(msg)~='string'then
|
||||
msg="Unknown error"
|
||||
elseif msg:find("Invalid UTF-8")and text then
|
||||
elseif msg:find("Invaild UTF-8")and text then
|
||||
msg=text.tryAnotherBuild
|
||||
end
|
||||
|
||||
@@ -526,20 +402,20 @@ function love.errorhandler(msg)
|
||||
love.audio.stop()
|
||||
gc.reset()
|
||||
|
||||
if LOADED and #errData<3 then
|
||||
if LOADED and #ERRDATA<3 then
|
||||
BG.set('none')
|
||||
local scn=SCN and SCN.cur or"NULL"
|
||||
table.insert(errData,{mes=err,scene=scn})
|
||||
table.insert(ERRDATA,{mes=err,scene=scn})
|
||||
|
||||
--Write messages to log file
|
||||
love.filesystem.append('conf/error.log',
|
||||
os.date("%Y/%m/%d %A %H:%M:%S\n")..
|
||||
#errData.." crash(es) "..love.system.getOS().."-"..VERSION.string.." scene: "..scn.."\n"..
|
||||
#ERRDATA.." crash(es) "..love.system.getOS().."-"..VERSION.string.." scene: "..scn.."\n"..
|
||||
table.concat(err,"\n",1,c-2).."\n\n"
|
||||
)
|
||||
|
||||
--Get screencapture
|
||||
gc.captureScreenshot(function(_)errData[#errData].shot=gc.newImage(_)end)
|
||||
gc.captureScreenshot(function(_)ERRDATA[#ERRDATA].shot=gc.newImage(_)end)
|
||||
gc.present()
|
||||
|
||||
--Create a new mainLoop thread to keep game alive
|
||||
@@ -599,7 +475,7 @@ local devColor={
|
||||
}
|
||||
local WS=WS
|
||||
local WSnames={'app','user','play','stream','chat','manage'}
|
||||
local wsImg={}do
|
||||
local wsBottomImage do
|
||||
local L={78,18,
|
||||
{'clear',1,1,1,0},
|
||||
{'setCL',1,1,1,.3},
|
||||
@@ -609,23 +485,23 @@ local wsImg={}do
|
||||
table.insert(L,{'setCL',1,1,1,i*.005})
|
||||
table.insert(L,{'fRect',i,0,1,18})
|
||||
end
|
||||
wsImg.bottom=GC.DO(L)
|
||||
wsImg.dead=GC.DO{20,20,
|
||||
{'rawFT',20},
|
||||
{'setCL',1,.3,.3},
|
||||
{'mText',"X",11,-1},
|
||||
}
|
||||
wsImg.connecting=GC.DO{20,20,
|
||||
{'rawFT',20},
|
||||
{'setLW',3},
|
||||
{'mText',"C",11,-1},
|
||||
}
|
||||
wsImg.running=GC.DO{20,20,
|
||||
{'rawFT',20},
|
||||
{'setCL',.5,1,0},
|
||||
{'mText',"R",11,-1},
|
||||
}
|
||||
wsBottomImage=GC.DO(L)
|
||||
end
|
||||
local ws_deadImg=GC.DO{20,20,
|
||||
{'setFT',20},
|
||||
{'setCL',1,.3,.3},
|
||||
{'mText',"X",11,-1},
|
||||
}
|
||||
local ws_connectingImg=GC.DO{20,20,
|
||||
{'setFT',20},
|
||||
{'setLW',3},
|
||||
{'mText',"C",11,-1},
|
||||
}
|
||||
local ws_runningImg=GC.DO{20,20,
|
||||
{'setFT',20},
|
||||
{'setCL',.5,1,0},
|
||||
{'mText',"R",11,-1},
|
||||
}
|
||||
|
||||
local function drawCursor(_,x,y)
|
||||
gc_setColor(1,1,1)
|
||||
@@ -645,6 +521,7 @@ function love.run()
|
||||
local TASK_update=TASK.update
|
||||
local SYSFX_update,SYSFX_draw=SYSFX.update,SYSFX.draw
|
||||
local WIDGET_update,WIDGET_draw=WIDGET.update,WIDGET.draw
|
||||
|
||||
local STEP,WAIT=love.timer.step,love.timer.sleep
|
||||
local FPS,MINI=love.timer.getFPS,love.window.isMinimized
|
||||
local PUMP,POLL=love.event.pump,love.event.poll
|
||||
@@ -661,7 +538,7 @@ function love.run()
|
||||
--Scene Launch
|
||||
while #SCN.stack>0 do SCN.pop()end
|
||||
SCN.push('quit','slowFade')
|
||||
SCN.init(#errData==0 and'load'or'error')
|
||||
SCN.init(#ERRDATA==0 and'load'or'error')
|
||||
|
||||
return function()
|
||||
local _
|
||||
@@ -683,8 +560,6 @@ function love.run()
|
||||
|
||||
--UPDATE
|
||||
STEP()
|
||||
if mouseShow then mouse_update(dt)end
|
||||
if next(jsState)then gp_update(jsState[1],dt)end
|
||||
VOC.update()
|
||||
BG.update(dt)
|
||||
TEXT_update(dt)
|
||||
@@ -733,7 +608,7 @@ function love.run()
|
||||
end
|
||||
gc_replaceTransform(SCR.xOy_d)
|
||||
--Draw Version string
|
||||
gc_setColor(.9,.9,.9,.42)
|
||||
gc_setColor(.8,.8,.8,.4)
|
||||
FONT.set(20)
|
||||
mStr(VERSION.string,0,-30)
|
||||
gc_replaceTransform(SCR.xOy_dl)
|
||||
@@ -747,8 +622,9 @@ function love.run()
|
||||
--Left-down infos
|
||||
gc_setColor(devColor[devMode])
|
||||
gc_print("MEM "..gcinfo(),safeX+5,-40)
|
||||
gc_print("Tasks "..TASK.getCount(),safeX+5,-60)
|
||||
gc_print("Voices "..VOC.getQueueCount(),safeX+5,-80)
|
||||
gc_print("Lines "..FREEROW.getCount(),safeX+5,-60)
|
||||
gc_print("Tasks "..TASK.getCount(),safeX+5,-80)
|
||||
gc_print("Voices "..VOC.getQueueCount(),safeX+5,-100)
|
||||
|
||||
--Update & draw frame time
|
||||
table.insert(frameTimeList,1,dt)table.remove(frameTimeList,126)
|
||||
@@ -776,14 +652,14 @@ function love.run()
|
||||
for i=1,6 do
|
||||
local status=WS.status(WSnames[i])
|
||||
gc_setColor(1,1,1)
|
||||
gc.draw(wsImg.bottom,-79,20*i-139)
|
||||
gc.draw(wsBottomImage,-79,20*i-139)
|
||||
if status=='dead'then
|
||||
gc_draw(wsImg.dead,-20,20*i-140)
|
||||
gc_draw(ws_deadImg,-20,20*i-140)
|
||||
elseif status=='connecting'then
|
||||
gc_setColor(1,1,1,.5+.3*math.sin(time*6.26))
|
||||
gc_draw(wsImg.connecting,-20,20*i-140)
|
||||
gc_draw(ws_connectingImg,-20,20*i-140)
|
||||
elseif status=='running'then
|
||||
gc_draw(wsImg.running,-20,20*i-140)
|
||||
gc_draw(ws_runningImg,-20,20*i-140)
|
||||
end
|
||||
local t1,t2,t3=WS.getTimers(WSnames[i])
|
||||
gc_setColor(.9,.9,.9,t1)gc.rectangle('fill',-60,20*i-122,-16,-16)
|
||||
@@ -827,9 +703,6 @@ end
|
||||
|
||||
local Z={}
|
||||
|
||||
Z.js=jsState
|
||||
Z.errData=errData
|
||||
|
||||
function Z.setIfPowerInfo(func)showPowerInfo=func end
|
||||
|
||||
--[Warning] Color and line width is uncertain value, set it in the function.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
local MATH={}for k,v in next,math do MATH[k]=v end
|
||||
|
||||
local rnd=math.random
|
||||
|
||||
MATH.tau=2*math.pi
|
||||
|
||||
function MATH.sign(a)
|
||||
return a>0 and 1 or a<0 and -1 or 0
|
||||
end
|
||||
|
||||
function MATH.roll(chance)
|
||||
return rnd()<(chance or .5)
|
||||
end
|
||||
|
||||
function MATH.coin(a,b)
|
||||
if rnd()<.5 then
|
||||
return a
|
||||
else
|
||||
return b
|
||||
end
|
||||
end
|
||||
|
||||
return MATH
|
||||
@@ -15,8 +15,6 @@ local SCN={
|
||||
draw=false, --Swap draw func
|
||||
},
|
||||
stack={},--Scene stack
|
||||
prev=false,
|
||||
args={},--Arguments from previous scene
|
||||
|
||||
scenes=scenes,
|
||||
|
||||
@@ -54,15 +52,14 @@ function SCN.swapUpdate(dt)
|
||||
S.time=S.time-dt
|
||||
if S.time<S.changeTime and S.time+dt>=S.changeTime then
|
||||
--Scene swapped this frame
|
||||
SCN.prev=SCN.cur
|
||||
SCN.init(S.tar)
|
||||
SCN.init(S.tar,SCN.cur)
|
||||
SCN.mainTouchID=nil
|
||||
end
|
||||
if S.time<0 then
|
||||
SCN.swapping=false
|
||||
end
|
||||
end
|
||||
function SCN.init(s)
|
||||
function SCN.init(s,org)
|
||||
love.keyboard.setTextInput(false)
|
||||
|
||||
local S=scenes[s]
|
||||
@@ -92,7 +89,7 @@ function SCN.init(s)
|
||||
SCN.update=S.update
|
||||
SCN.draw=S.draw
|
||||
if S.sceneInit then
|
||||
S.sceneInit()
|
||||
S.sceneInit(org)
|
||||
end
|
||||
end
|
||||
function SCN.push(tar,style)
|
||||
@@ -168,12 +165,11 @@ local swap={
|
||||
end
|
||||
},
|
||||
}--Scene swapping animations
|
||||
function SCN.swapTo(tar,style,...)--Parallel scene swapping, cannot back
|
||||
function SCN.swapTo(tar,style)--Parallel scene swapping, cannot back
|
||||
if scenes[tar]then
|
||||
if not SCN.swapping and tar~=SCN.cur then
|
||||
style=style or'fade'
|
||||
SCN.swapping=true
|
||||
SCN.args={...}
|
||||
local S=SCN.stat
|
||||
S.tar,S.style=tar,style
|
||||
S.time=swap[style].duration
|
||||
@@ -184,15 +180,15 @@ function SCN.swapTo(tar,style,...)--Parallel scene swapping, cannot back
|
||||
MES.new('warn',"No Scene: "..tar)
|
||||
end
|
||||
end
|
||||
function SCN.go(tar,style,...)--Normal scene swapping, can back
|
||||
function SCN.go(tar,style)--Normal scene swapping, can back
|
||||
if scenes[tar]then
|
||||
SCN.push()
|
||||
SCN.swapTo(tar,style,...)
|
||||
SCN.swapTo(tar,style)
|
||||
else
|
||||
MES.new('warn',"No Scene: "..tar)
|
||||
end
|
||||
end
|
||||
function SCN.back(...)
|
||||
function SCN.back()
|
||||
if SCN.swapping then return end
|
||||
|
||||
--Leave scene
|
||||
@@ -203,7 +199,7 @@ function SCN.back(...)
|
||||
--Poll&Back to previous Scene
|
||||
local m=#SCN.stack
|
||||
if m>0 then
|
||||
SCN.swapTo(SCN.stack[m-1],SCN.stack[m],...)
|
||||
SCN.swapTo(SCN.stack[m-1],SCN.stack[m])
|
||||
SCN.stack[m],SCN.stack[m-1]=nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
local type,rem=type,table.remove
|
||||
local int,rnd=math.floor,math.random
|
||||
|
||||
local sfxList={}
|
||||
local packSetting={}
|
||||
@@ -7,7 +6,7 @@ local Sources={}
|
||||
local volume=1
|
||||
local stereo=1
|
||||
|
||||
local noteVal={
|
||||
local noteName={
|
||||
C=1,c=1,
|
||||
D=3,d=3,
|
||||
E=5,e=5,
|
||||
@@ -16,11 +15,10 @@ local noteVal={
|
||||
A=10,a=10,
|
||||
B=12,b=12,
|
||||
}
|
||||
local noteName={'C','C#','D','D#','E','F','F#','G','G#','A','A#','B'}
|
||||
local function _getTuneHeight(tune)
|
||||
local octave=tonumber(tune:sub(-1,-1))
|
||||
if octave then
|
||||
local tuneHeight=noteVal[tune:sub(1,1)]
|
||||
local tuneHeight=noteName[tune:sub(1,1)]
|
||||
if tuneHeight then
|
||||
tuneHeight=tuneHeight+(octave-1)*12
|
||||
local s=tune:sub(2,2)
|
||||
@@ -42,41 +40,29 @@ function SFX.init(list)
|
||||
end
|
||||
function SFX.load(path)
|
||||
local c=0
|
||||
local missing=0
|
||||
for i=1,#sfxList do
|
||||
local fullPath=path..sfxList[i]..'.ogg'
|
||||
if love.filesystem.getInfo(fullPath)then
|
||||
if Sources[sfxList[i]]then
|
||||
for j=1,#Sources[sfxList[i]]do
|
||||
Sources[sfxList[i]][j]:release()
|
||||
end
|
||||
end
|
||||
Sources[sfxList[i]]={love.audio.newSource(fullPath,'static')}
|
||||
c=c+1
|
||||
else
|
||||
LOG("No SFX: "..sfxList[i]..'.ogg',.1)
|
||||
missing=missing+1
|
||||
end
|
||||
end
|
||||
LOG(c.."/"..#sfxList.." SFX files loaded")
|
||||
LOG(missing.." SFX files missing")
|
||||
if missing>0 then
|
||||
MES.new('info',missing.." SFX files missing")
|
||||
end
|
||||
collectgarbage()
|
||||
end
|
||||
function SFX.loadSample(pack)
|
||||
assert(type(pack)=='table',"Usage: SFX.loadsample([table])")
|
||||
assert(pack.name,"No field: name")
|
||||
assert(pack.path,"No field: path")
|
||||
packSetting[pack.name]={
|
||||
base=(_getTuneHeight(pack.base)or 37)-1,
|
||||
}
|
||||
local num=1
|
||||
while love.filesystem.getInfo(pack.path..'/'..num..'.ogg')do
|
||||
Sources[pack.name..num]={love.audio.newSource(pack.path..'/'..num..'.ogg','static')}
|
||||
num=num+1
|
||||
end
|
||||
local base=(_getTuneHeight(pack.base)or 37)-1
|
||||
local top=base+num-1
|
||||
packSetting[pack.name]={base=base,top=top}
|
||||
LOG((num-1).." "..pack.name.." samples loaded")
|
||||
end
|
||||
|
||||
@@ -84,47 +70,31 @@ function SFX.getCount()
|
||||
return #sfxList
|
||||
end
|
||||
function SFX.setVol(v)
|
||||
assert(type(v)=='number'and v>=0 and v<=1,'Wrong volume')
|
||||
assert(type(v)=='number'and v>=0 and v<=1)
|
||||
volume=v
|
||||
end
|
||||
function SFX.setStereo(v)
|
||||
assert(type(v)=='number'and v>=0 and v<=1,'Wrong stereo')
|
||||
assert(type(v)=='number'and v>=0 and v<=1)
|
||||
stereo=v
|
||||
end
|
||||
|
||||
function SFX.getNoteName(note)
|
||||
if note<1 then
|
||||
return'---'
|
||||
else
|
||||
note=note-1
|
||||
local octave=int(note/12)+1
|
||||
return noteName[note%12+1]..octave
|
||||
end
|
||||
end
|
||||
function SFX.playSample(pack,...)--vol-1, sampSet1, vol-2, sampSet2
|
||||
function SFX.playSample(pack,...)--vol-2, sampSet1, vol-3, sampSet2, vol-1
|
||||
if ... then
|
||||
local arg={...}
|
||||
local vol
|
||||
if type(arg[#arg])=='number'then vol=rem(arg)end
|
||||
for i=1,#arg do
|
||||
local a=arg[i]
|
||||
if type(a)=='number'and a<=1 then
|
||||
vol=a
|
||||
if type(arg[i])=='number'then
|
||||
vol=arg[i]
|
||||
else
|
||||
local base=packSetting[pack].base
|
||||
local top=packSetting[pack].top
|
||||
local tune=type(a)=='string'and _getTuneHeight(a)or a--Absolute tune in number
|
||||
local playTune=tune+rnd(-2,2)
|
||||
if playTune<=base then--Too low notes
|
||||
playTune=base+1
|
||||
elseif playTune>top then--Too high notes
|
||||
playTune=top
|
||||
end
|
||||
SFX.play(pack..playTune-base,vol,nil,tune-playTune)
|
||||
local tune=arg[i]
|
||||
tune=_getTuneHeight(tune)-packSetting[pack].base
|
||||
SFX.play(pack..tune,vol)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function _play(name,vol,pos,pitch)
|
||||
function SFX.play(name,vol,pos)
|
||||
if volume==0 or vol==0 then return end
|
||||
local S=Sources[name]--Source list
|
||||
if not S then return end
|
||||
@@ -146,13 +116,32 @@ local function _play(name,vol,pos,pitch)
|
||||
S:setPosition(0,0,0)
|
||||
end
|
||||
end
|
||||
S:setVolume(vol^1.626)
|
||||
S:setPitch(pitch and 1.0594630943592953^pitch or 1)
|
||||
S:setVolume(((vol or 1)*volume)^1.626)
|
||||
S:play()
|
||||
end
|
||||
SFX.fplay=_play--Play sounds without apply module's volume setting
|
||||
function SFX.play(name,vol,pos,pitch)
|
||||
_play(name,(vol or 1)*volume,pos,pitch)
|
||||
function SFX.fplay(name,vol,pos)
|
||||
local S=Sources[name]--Source list
|
||||
if not S then return end
|
||||
local n=1
|
||||
while S[n]:isPlaying()do
|
||||
n=n+1
|
||||
if not S[n]then
|
||||
S[n]=S[1]:clone()
|
||||
S[n]:seek(0)
|
||||
break
|
||||
end
|
||||
end
|
||||
S=S[n]--AU_SRC
|
||||
if S:getChannelCount()==1 then
|
||||
if pos then
|
||||
pos=pos*stereo
|
||||
S:setPosition(pos,1-pos^2,0)
|
||||
else
|
||||
S:setPosition(0,0,0)
|
||||
end
|
||||
end
|
||||
S:setVolume(vol^1.626)
|
||||
S:play()
|
||||
end
|
||||
function SFX.reset()
|
||||
for _,L in next,Sources do
|
||||
|
||||
@@ -2,25 +2,9 @@ local data=love.data
|
||||
local STRING={}
|
||||
local assert,tostring,tonumber=assert,tostring,tonumber
|
||||
local int,format=math.floor,string.format
|
||||
local find,sub,gsub,upper=string.find,string.sub,string.gsub,string.upper
|
||||
local find,sub,upper=string.find,string.sub,string.upper
|
||||
local char,byte=string.char,string.byte
|
||||
|
||||
--"Replace dollars", replace all $n with ...
|
||||
function STRING.repD(str,...)
|
||||
local l={...}
|
||||
for i=#l,1,-1 do
|
||||
str=gsub(str,'$'..i,l[i])
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
--"Scan arg", scan if str has the arg (format of str is like "-json -q", arg is like "-q")
|
||||
function STRING.sArg(str,switch)
|
||||
if find(str.." ",switch.." ")then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
do--function STRING.shiftChar(c)
|
||||
local shiftMap={
|
||||
['1']='!',['2']='@',['3']='#',['4']='$',['5']='%',
|
||||
@@ -79,9 +63,9 @@ function STRING.time(t)
|
||||
if t<60 then
|
||||
return format("%.3f\"",t)
|
||||
elseif t<3600 then
|
||||
return format("%d'%05.2f\"",int(t/60),int(t%60*100)/100)
|
||||
return format("%d'%05.2f\"",int(t/60),t%60)
|
||||
else
|
||||
return format("%d:%.2d'%05.2f\"",int(t/3600),int(t/60%60),int(t%60*100)/100)
|
||||
return format("%d:%.2d'%05.2f\"",int(t/3600),int(t/60%60),t%60)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -169,25 +153,6 @@ function STRING.vcsDecrypt(text,key)
|
||||
end
|
||||
return result..buffer
|
||||
end
|
||||
function STRING.digezt(text)--Not powerful hash, just protect the original text
|
||||
local out={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
local seed=26
|
||||
for i=1,#text do
|
||||
local c=byte(text,i)
|
||||
seed=(seed+c)%26
|
||||
c=c+seed
|
||||
local pos=c*i%16
|
||||
local step=(c+i)%4+1
|
||||
local times=2+(c%6)
|
||||
for _=1,times do
|
||||
out[pos+1]=(out[pos+1]+c)%256
|
||||
pos=(pos+step)%16
|
||||
end
|
||||
end
|
||||
local result=""
|
||||
for i=1,16 do result=result..char(out[i])end
|
||||
return result
|
||||
end
|
||||
|
||||
function STRING.readLine(str)
|
||||
local p=str:find("\n")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
local find=string.find
|
||||
local rem=table.remove
|
||||
local next,type=next,type
|
||||
local TABLE={}
|
||||
|
||||
@@ -47,18 +46,6 @@ function TABLE.cover(new,old)
|
||||
end
|
||||
end
|
||||
|
||||
--For all things in new, push to old
|
||||
function TABLE.coverR(new,old)
|
||||
for k,v in next,new do
|
||||
if type(v)=='table'and type(old[k])=='table'then
|
||||
TABLE.coverR(v,old[k])
|
||||
else
|
||||
old[k]=v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--For all things in new if same type in old, push to old
|
||||
function TABLE.update(new,old)
|
||||
for k,v in next,new do
|
||||
@@ -84,7 +71,7 @@ function TABLE.complete(new,old)
|
||||
end
|
||||
end
|
||||
|
||||
--Remove [1~#] of table
|
||||
--Remove positive integer index of table
|
||||
function TABLE.cut(G)
|
||||
for i=1,#G do
|
||||
G[i]=nil
|
||||
@@ -98,53 +85,11 @@ function TABLE.clear(G)
|
||||
end
|
||||
end
|
||||
|
||||
--Remove duplicated value of [1~#]
|
||||
function TABLE.trimDuplicate(org)
|
||||
local cache={}
|
||||
for i=1,#org,-1 do
|
||||
if cache[org[i]]then
|
||||
rem(org,i)
|
||||
else
|
||||
cache[org[i]]=true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Discard duplicated value
|
||||
function TABLE.remDuplicate(org)
|
||||
local cache={}
|
||||
for k,v in next,org do
|
||||
if cache[v]then
|
||||
org[k]=nil
|
||||
else
|
||||
cache[v]=true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Reverse [1~#]
|
||||
function TABLE.reverse(org)
|
||||
local l=#org
|
||||
for i=1,math.floor(l/2)do
|
||||
org[i],org[l+1-i]=org[l+1-i],org[i]
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------
|
||||
|
||||
--Find value in [1~#]
|
||||
function TABLE.find(t,val)
|
||||
for i=1,#t do if t[i]==val then return i end end
|
||||
end
|
||||
|
||||
--Return next value of [1~#] (by value)
|
||||
function TABLE.next(t,val)
|
||||
for i=1,#t do if t[i]==val then return t[i%#t+1]end end
|
||||
end
|
||||
|
||||
--------------------------
|
||||
|
||||
--Find value in whole table
|
||||
function TABLE.search(t,val)
|
||||
for k,v in next,t do if v==val then return k end end
|
||||
@@ -159,8 +104,6 @@ function TABLE.reIndex(org)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------
|
||||
|
||||
--Dump a simple lua table
|
||||
do--function TABLE.dump(L,t)
|
||||
local tabs={
|
||||
|
||||
@@ -39,22 +39,21 @@ function THEME.calculate(Y,M,D)
|
||||
|
||||
--Z day
|
||||
D=='26'and(
|
||||
(M=='03'or M=='04'or M=='05'or M=='06')and'zday1'or
|
||||
(M=='07'or M=='08'or M=='09'or M=='10')and'zday2'or
|
||||
(M=='11'or M=='12'or M=='01'or M=='02')and'zday3'
|
||||
(M=='01'or M=='02'or M=='03')and'zday1'or
|
||||
(M=='04'or M=='05')and'zday2'or
|
||||
(M=='06'or M=='07')and'zday3'or
|
||||
(M=='08'or M=='09')and'zday4'or
|
||||
(M=='10'or M=='11'or M=='12')and'zday5'
|
||||
)or
|
||||
|
||||
--Normal
|
||||
(
|
||||
(M=='02'or M=='03'or M=='04')and'season1'or
|
||||
(M=='05'or M=='06'or M=='07')and'season2'or
|
||||
(M=='08'or M=='09'or M=='10')and'season3'or
|
||||
(M=='11'or M=='12'or M=='01')and'season4'
|
||||
)
|
||||
'classic'
|
||||
end
|
||||
|
||||
function THEME.set(theme)
|
||||
if theme=='xmas'then
|
||||
if theme=='classic'then
|
||||
BG.setDefault('space')
|
||||
BGM.setDefault('nil')
|
||||
elseif theme=='xmas'then
|
||||
BG.setDefault('snow')
|
||||
BGM.setDefault('xmas')
|
||||
MES.new('info',"==Merry Christmas==")
|
||||
@@ -67,25 +66,19 @@ function THEME.set(theme)
|
||||
MES.new('info',"★☆新年快乐☆★")
|
||||
elseif theme=='zday1'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault('overzero')
|
||||
BGM.setDefault('null')
|
||||
elseif theme=='zday2'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault('jazz nihilism')
|
||||
BGM.setDefault('overzero')
|
||||
elseif theme=='zday3'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault('empty')
|
||||
elseif theme=='season1'then
|
||||
BG.setDefault('space')
|
||||
BGM.setDefault('null')
|
||||
elseif theme=='season2'then
|
||||
BG.setDefault('space')
|
||||
BGM.setDefault('nil')
|
||||
elseif theme=='season3'then
|
||||
BG.setDefault('space')
|
||||
BGM.setDefault('vacuum')
|
||||
elseif theme=='season4'then
|
||||
BG.setDefault('space')
|
||||
BGM.setDefault('space')
|
||||
elseif theme=='zday4'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault('jazz nihilism')
|
||||
elseif theme=='zday5'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault('empty')
|
||||
elseif theme=='fool'then
|
||||
BG.setDefault('blockrain')
|
||||
BGM.setDefault('how feeling')
|
||||
@@ -1,7 +1,5 @@
|
||||
local rnd=math.random
|
||||
local volume=1
|
||||
local diversion=0
|
||||
local VOC={
|
||||
vol=1,
|
||||
getCount=function()return 0 end,
|
||||
getQueueCount=function()return 0 end,
|
||||
load=function()error("Cannot load before init!")end,
|
||||
@@ -9,16 +7,13 @@ local VOC={
|
||||
play=NULL,
|
||||
update=NULL,
|
||||
}
|
||||
function VOC.setDiversion(n)
|
||||
assert(type(n)=='number'and n>0 and n<12,'Wrong div')
|
||||
diversion=n
|
||||
end
|
||||
function VOC.setVol(v)
|
||||
assert(type(v)=='number'and v>=0 and v<=1,'Wrong volume')
|
||||
volume=v
|
||||
assert(type(v)=='number'and v>=0 and v<=1)
|
||||
VOC.vol=v
|
||||
end
|
||||
function VOC.init(list)
|
||||
VOC.init=nil
|
||||
local rnd=math.random
|
||||
local rem=table.remove
|
||||
local voiceQueue={free=0}
|
||||
local bank={}--{vocName1={SRC1s},vocName2={SRC2s},...}
|
||||
@@ -77,7 +72,7 @@ function VOC.init(list)
|
||||
end
|
||||
|
||||
function VOC.play(s,chn)
|
||||
if volume>0 then
|
||||
if VOC.vol>0 then
|
||||
local _=Source[s]
|
||||
if not _ then return end
|
||||
if chn then
|
||||
@@ -100,15 +95,13 @@ function VOC.init(list)
|
||||
end
|
||||
elseif Q.s==1 then--Waiting load source
|
||||
Q[1]=_getVoice(Q[1])
|
||||
Q[1]:setVolume(volume)
|
||||
Q[1]:setPitch(1.0594630943592953^(diversion*(rnd()*2-1)))
|
||||
Q[1]:setVolume(VOC.vol)
|
||||
Q[1]:play()
|
||||
Q.s=Q[2]and 2 or 4
|
||||
elseif Q.s==2 then--Playing 1,ready 2
|
||||
if Q[1]:getDuration()-Q[1]:tell()<.08 then
|
||||
Q[2]=_getVoice(Q[2])
|
||||
Q[2]:setVolume(volume)
|
||||
Q[1]:setPitch(1.0594630943592953^(diversion*(rnd()*2-1)))
|
||||
Q[2]:setVolume(VOC.vol)
|
||||
Q[2]:play()
|
||||
Q.s=3
|
||||
end
|
||||
|
||||
@@ -9,11 +9,11 @@ return function(y,key1,key2)
|
||||
trigDist=min(trigDist,0)-(-y)^1.2
|
||||
end
|
||||
while trigDist>=1 do
|
||||
love.keypressed(key1 or'up')
|
||||
love.keypressed(key1 or"up")
|
||||
trigDist=trigDist-1
|
||||
end
|
||||
while trigDist<=-1 do
|
||||
love.keypressed(key2 or'down')
|
||||
love.keypressed(key2 or"down")
|
||||
trigDist=trigDist+1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,9 +13,10 @@ local kb=love.keyboard
|
||||
local timer=love.timer.getTime
|
||||
|
||||
local next=next
|
||||
local int,ceil=math.floor,math.ceil
|
||||
local int,ceil,abs=math.floor,math.ceil,math.abs
|
||||
local max,min=math.max,math.min
|
||||
local sub,ins,rem=string.sub,table.insert,table.remove
|
||||
local mDraw,mDraw_X,mDraw_Y=GC.draw,GC.simpX,GC.simpY
|
||||
local xOy=SCR.xOy
|
||||
local FONT=FONT
|
||||
local mStr=GC.mStr
|
||||
@@ -28,7 +29,7 @@ local clearIcon=GC.DO{40,40,
|
||||
{'fRect',11,14,18,21},
|
||||
}
|
||||
local sureIcon=GC.DO{40,40,
|
||||
{'rawFT',35},
|
||||
{'setFT',35},
|
||||
{'mText',"?",20,0},
|
||||
}
|
||||
local smallerThen=GC.DO{20,20,
|
||||
@@ -72,28 +73,24 @@ function text:draw()
|
||||
if self.alpha>0 then
|
||||
local c=self.color
|
||||
gc_setColor(c[1],c[2],c[3],self.alpha)
|
||||
local w=self.obj:getWidth()
|
||||
local k=min(self.lim/self.obj:getWidth(),1)
|
||||
if self.align=='M'then
|
||||
gc_draw(self.obj,self.x,self.y,nil,k,1,w*.5,0)
|
||||
mDraw_X(self.obj,self.x,self.y)
|
||||
elseif self.align=='L'then
|
||||
gc_draw(self.obj,self.x,self.y,nil,k,1)
|
||||
gc_draw(self.obj,self.x,self.y)
|
||||
elseif self.align=='R'then
|
||||
gc_draw(self.obj,self.x,self.y,nil,k,1,w,0)
|
||||
gc_draw(self.obj,self.x-self.obj:getWidth(),self.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
function WIDGET.newText(D)--name,x,y[,lim][,fText][,color][,font=30][,fType][,align='M'][,hideF][,hide]
|
||||
function WIDGET.newText(D)--name,x,y[,fText][,color][,font=30][,align='M'][,hideF][,hide]
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
x= D.x,
|
||||
y= D.y,
|
||||
lim= D.lim or 1e99,
|
||||
|
||||
fText=D.fText,
|
||||
color=D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
||||
font= D.font or 30,
|
||||
fType=D.fType,
|
||||
align=D.align or'M',
|
||||
hideF=D.hideF,
|
||||
}
|
||||
@@ -142,7 +139,7 @@ function button:reset()
|
||||
end
|
||||
function button:setObject(obj)
|
||||
if type(obj)=='string'or type(obj)=='number'then
|
||||
self.obj=gc.newText(FONT.get(self.font,self.fType),obj)
|
||||
self.obj=gc.newText(FONT.get(self.font),obj)
|
||||
elseif obj then
|
||||
self.obj=obj
|
||||
end
|
||||
@@ -151,9 +148,9 @@ function button:isAbove(x,y)
|
||||
local ATV=self.ATV
|
||||
return
|
||||
x>self.x-ATV and
|
||||
y>self.y and
|
||||
y>self.y-ATV and
|
||||
x<self.x+self.w+2*ATV and
|
||||
y<self.y+self.h
|
||||
y<self.y+self.h+2*ATV
|
||||
end
|
||||
function button:getCenter()
|
||||
return self.x+self.w*.5,self.y+self.h*.5
|
||||
@@ -174,49 +171,45 @@ function button:draw()
|
||||
|
||||
--Button
|
||||
gc_setColor(.15+r*.7,.15+g*.7,.15+b*.7,.9)
|
||||
gc_rectangle('fill',x-ATV,y,w+2*ATV,h,4)
|
||||
gc_setLineWidth(2)
|
||||
gc_setColor(.3+r*.7,.3+g*.7,.3+b*.7)
|
||||
gc_rectangle('line',x-ATV,y,w+2*ATV,h,5)
|
||||
gc_rectangle('fill',x-ATV,y-ATV,w+2*ATV,h+2*ATV,3)
|
||||
if ATV>0 then
|
||||
gc_setLineWidth(2)
|
||||
gc_setColor(.97,.97,.97,ATV*.125)
|
||||
gc_rectangle('line',x-ATV,y,w+2*ATV,h,3)
|
||||
gc_rectangle('line',x-ATV+2,y-ATV+2,w+2*ATV-4,h+2*ATV-4,3)
|
||||
end
|
||||
|
||||
--Drawable
|
||||
local obj=self.obj
|
||||
local ox,oy=obj:getWidth()*.5,obj:getHeight()*.5
|
||||
local y0=y+h*.5
|
||||
local y0=y+h*.5-ATV*.5
|
||||
gc_setColor(1,1,1,.2+ATV*.05)
|
||||
if self.align=='M'then
|
||||
local x0=x+w*.5
|
||||
local kx=obj:type()=='Text'and min(w/ox/2,1)or 1
|
||||
gc_draw(obj,x0-1,y0-1,nil,kx,1,ox,oy)
|
||||
gc_draw(obj,x0-1,y0+1,nil,kx,1,ox,oy)
|
||||
gc_draw(obj,x0+1,y0-1,nil,kx,1,ox,oy)
|
||||
gc_draw(obj,x0+1,y0+1,nil,kx,1,ox,oy)
|
||||
mDraw(obj,x0-1,y0-1)
|
||||
mDraw(obj,x0-1,y0+1)
|
||||
mDraw(obj,x0+1,y0-1)
|
||||
mDraw(obj,x0+1,y0+1)
|
||||
gc_setColor(r*.55,g*.55,b*.55)
|
||||
gc_draw(obj,x0,y0,nil,kx,1,ox,oy)
|
||||
mDraw(obj,x0,y0)
|
||||
elseif self.align=='L'then
|
||||
local edge=self.edge
|
||||
gc_draw(obj,x+edge-1,y0-1-oy)
|
||||
gc_draw(obj,x+edge-1,y0+1-oy)
|
||||
gc_draw(obj,x+edge+1,y0-1-oy)
|
||||
gc_draw(obj,x+edge+1,y0+1-oy)
|
||||
mDraw_Y(obj,x+edge-1,y0-1)
|
||||
mDraw_Y(obj,x+edge-1,y0+1)
|
||||
mDraw_Y(obj,x+edge+1,y0-1)
|
||||
mDraw_Y(obj,x+edge+1,y0+1)
|
||||
gc_setColor(r*.55,g*.55,b*.55)
|
||||
gc_draw(obj,x+edge,y0-oy)
|
||||
mDraw_Y(obj,x+edge,y0)
|
||||
elseif self.align=='R'then
|
||||
local x0=x+w-self.edge-ox*2
|
||||
gc_draw(obj,x0-1,y0-1-oy)
|
||||
gc_draw(obj,x0-1,y0+1-oy)
|
||||
gc_draw(obj,x0+1,y0-1-oy)
|
||||
gc_draw(obj,x0+1,y0+1-oy)
|
||||
local x0=x+w-self.edge-obj:getWidth()
|
||||
mDraw_Y(obj,x0-1,y0-1)
|
||||
mDraw_Y(obj,x0-1,y0+1)
|
||||
mDraw_Y(obj,x0+1,y0-1)
|
||||
mDraw_Y(obj,x0+1,y0+1)
|
||||
gc_setColor(r*.55,g*.55,b*.55)
|
||||
gc_draw(obj,x0,y0-oy)
|
||||
mDraw_Y(obj,x0,y0)
|
||||
end
|
||||
end
|
||||
function button:getInfo()
|
||||
return("x=%d,y=%d,w=%d,h=%d,font=%d"):format(self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font,self.fType)
|
||||
return("x=%d,y=%d,w=%d,h=%d,font=%d"):format(self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font)
|
||||
end
|
||||
function button:press(_,_,k)
|
||||
self.code(k)
|
||||
@@ -224,15 +217,15 @@ function button:press(_,_,k)
|
||||
SYSFX.newRectRipple(
|
||||
6,
|
||||
self.x-ATV,
|
||||
self.y-WIDGET.scrollPos,
|
||||
self.y-ATV-WIDGET.scrollPos,
|
||||
self.w+2*ATV,
|
||||
self.h
|
||||
self.h+2*ATV
|
||||
)
|
||||
if self.sound then
|
||||
SFX.play(self.sound)
|
||||
SFX.play('button')
|
||||
end
|
||||
end
|
||||
function WIDGET.newButton(D)--name,x,y,w[,h][,fText][,color][,font=30][,fType][,sound][,align='M'][,edge=0][,code][,hideF][,hide]
|
||||
function WIDGET.newButton(D)--name,x,y,w[,h][,fText][,color][,font=30][,sound=true][,align='M'][,edge=0],code[,hideF][,hide]
|
||||
if not D.h then D.h=D.w end
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
@@ -253,21 +246,13 @@ function WIDGET.newButton(D)--name,x,y,w[,h][,fText][,color][,font=30][,fType][,
|
||||
fText=D.fText,
|
||||
color=D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
||||
font= D.font or 30,
|
||||
fType=D.fType,
|
||||
align=D.align or'M',
|
||||
edge= D.edge or 0,
|
||||
code= D.code or NULL,
|
||||
sound=D.sound~=false,
|
||||
code= D.code,
|
||||
hideF=D.hideF,
|
||||
hide= D.hide,
|
||||
}
|
||||
if D.sound==false then
|
||||
_.sound=false
|
||||
elseif type(D.sound)=='string'then
|
||||
_.sound=D.sound
|
||||
else
|
||||
_.sound='button'
|
||||
end
|
||||
|
||||
for k,v in next,button do _[k]=v end
|
||||
setmetatable(_,widgetMetatable)
|
||||
return _
|
||||
@@ -283,7 +268,7 @@ function key:reset()
|
||||
end
|
||||
function key:setObject(obj)
|
||||
if type(obj)=='string'or type(obj)=='number'then
|
||||
self.obj=gc.newText(FONT.get(self.font,self.fType),obj)
|
||||
self.obj=gc.newText(FONT.get(self.font),obj)
|
||||
elseif obj then
|
||||
self.obj=obj
|
||||
end
|
||||
@@ -313,54 +298,48 @@ function key:draw()
|
||||
local align=self.align
|
||||
local r,g,b=c[1],c[2],c[3]
|
||||
|
||||
--Frame
|
||||
if not self.noFrame then
|
||||
gc_setColor(.2+r*.8,.2+g*.8,.2+b*.8,.7)
|
||||
gc_setLineWidth(2)
|
||||
gc_rectangle('line',x,y,w,h,3)
|
||||
end
|
||||
|
||||
--Fill
|
||||
if self.fShade then
|
||||
gc_setColor(r,g,b,ATV*.25)
|
||||
if align=='M'then
|
||||
gc_draw(self.fShade,x+w*.5-self.fShade:getWidth()*.5,y+h*.5-self.fShade:getHeight()*.5)
|
||||
mDraw(self.fShade,x+w*.5,y+h*.5)
|
||||
elseif align=='L'then
|
||||
gc_draw(self.fShade,x+self.edge,y+h*.5-self.fShade:getHeight()*.5)
|
||||
mDraw_Y(self.fShade,x+self.edge,y+h*.5)
|
||||
elseif align=='R'then
|
||||
gc_draw(self.fShade,x+w-self.edge-self.fShade:getWidth(),y+h*.5-self.fShade:getHeight()*.5)
|
||||
mDraw_Y(self.fShade,x+w-self.edge-self.fShade:getWidth(),y+h*.5)
|
||||
end
|
||||
else
|
||||
--Background
|
||||
gc_setColor(0,0,0,.3)
|
||||
gc_rectangle('fill',x,y,w,h,4)
|
||||
|
||||
--Frame
|
||||
gc_setColor(.2+r*.8,.2+g*.8,.2+b*.8,.7)
|
||||
gc_setLineWidth(2)
|
||||
gc_rectangle('line',x,y,w,h,3)
|
||||
|
||||
--Shade
|
||||
gc_setColor(1,1,1,ATV*.05)
|
||||
gc_rectangle('fill',x,y,w,h,3)
|
||||
end
|
||||
|
||||
--Drawable
|
||||
local obj=self.obj
|
||||
local ox,oy=obj:getWidth()*.5,obj:getHeight()*.5
|
||||
gc_setColor(r,g,b)
|
||||
if align=='M'then
|
||||
local kx=obj:type()=='Text'and min(w/ox/2,1)or 1
|
||||
gc_draw(obj,x+w*.5,y+h*.5,nil,kx,1,ox,oy)
|
||||
mDraw(self.obj,x+w*.5,y+h*.5)
|
||||
elseif align=='L'then
|
||||
gc_draw(obj,x+self.edge,y-oy+h*.5)
|
||||
mDraw_Y(self.obj,x+self.edge,y+h*.5)
|
||||
elseif align=='R'then
|
||||
gc_draw(obj,x+w-self.edge-ox*2,y-oy+h*.5)
|
||||
mDraw_Y(self.obj,x+w-self.edge-self.obj:getWidth(),y+h*.5)
|
||||
end
|
||||
end
|
||||
function key:getInfo()
|
||||
return("x=%d,y=%d,w=%d,h=%d,font=%d"):format(self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font,self.fType)
|
||||
return("x=%d,y=%d,w=%d,h=%d,font=%d"):format(self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font)
|
||||
end
|
||||
function key:press(_,_,k)
|
||||
self.code(k)
|
||||
if self.sound then
|
||||
SFX.play(self.sound)
|
||||
SFX.play('key')
|
||||
end
|
||||
end
|
||||
function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,fShade][,color][,font=30][,fType][,sound][,align='M'][,edge=0][,code][,hideF][,hide]
|
||||
function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,fShade][,noFrame][,color][,font=30][,sound=true][,align='M'][,edge=0],code[,hideF][,hide]
|
||||
if not D.h then D.h=D.w end
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
@@ -380,22 +359,16 @@ function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,fShade][,color][,font=30][,fT
|
||||
|
||||
fText= D.fText,
|
||||
fShade= D.fShade,
|
||||
noFrame=D.noFrame,
|
||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
||||
font= D.font or 30,
|
||||
fType= D.fType,
|
||||
sound= D.sound~=false,
|
||||
align= D.align or'M',
|
||||
edge= D.edge or 0,
|
||||
code= D.code or NULL,
|
||||
code= D.code,
|
||||
hideF= D.hideF,
|
||||
hide= D.hide,
|
||||
}
|
||||
if D.sound==false then
|
||||
_.sound=false
|
||||
elseif type(D.sound)=='string'then
|
||||
_.sound=D.sound
|
||||
else
|
||||
_.sound='key'
|
||||
end
|
||||
for k,v in next,key do _[k]=v end
|
||||
setmetatable(_,widgetMetatable)
|
||||
return _
|
||||
@@ -435,10 +408,6 @@ function switch:draw()
|
||||
local x,y=self.x,self.y
|
||||
local ATV=self.ATV
|
||||
|
||||
--Background
|
||||
gc_setColor(0,0,0,.3)
|
||||
gc_rectangle('fill',x,y-25,50,50,4)
|
||||
|
||||
--Frame
|
||||
gc_setLineWidth(2)
|
||||
gc_setColor(1,1,1,.6+ATV*.1)
|
||||
@@ -461,15 +430,15 @@ function switch:draw()
|
||||
gc_draw(obj,x-12-ATV,y,nil,min(self.lim/obj:getWidth(),1),1,obj:getWidth(),obj:getHeight()*.5)
|
||||
end
|
||||
function switch:getInfo()
|
||||
return("x=%d,y=%d,font=%d"):format(self.x,self.y,self.font,self.fType)
|
||||
return("x=%d,y=%d,font=%d"):format(self.x,self.y,self.font)
|
||||
end
|
||||
function switch:press()
|
||||
self.code()
|
||||
if self.sound then
|
||||
SFX.play(self.disp()and'check'or'uncheck')
|
||||
SFX.play('touch')
|
||||
end
|
||||
end
|
||||
function WIDGET.newSwitch(D)--name,x,y[,lim][,fText][,color][,font=30][,fType][,sound=true][,disp][,code][,hideF][,hide]
|
||||
function WIDGET.newSwitch(D)--name,x,y[,lim][,fText][,color][,font=30][,sound=true][,disp],code[,hideF][,hide]
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
|
||||
@@ -484,10 +453,9 @@ function WIDGET.newSwitch(D)--name,x,y[,lim][,fText][,color][,font=30][,fType][,
|
||||
fText=D.fText,
|
||||
color=D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
||||
font= D.font or 30,
|
||||
fType=D.fType,
|
||||
sound=D.sound~=false,
|
||||
disp= D.disp,
|
||||
code= D.code or NULL,
|
||||
code= D.code,
|
||||
hideF=D.hideF,
|
||||
hide= D.hide,
|
||||
}
|
||||
@@ -625,9 +593,9 @@ function slider:scroll(n)
|
||||
end
|
||||
end
|
||||
function slider:arrowKey(k)
|
||||
self:scroll((k=='left'or k=='up')and -1 or 1)
|
||||
self:scroll((k=="left"or k=="up")and -1 or 1)
|
||||
end
|
||||
function WIDGET.newSlider(D)--name,x,y,w[,lim][,fText][,color][,unit][,smooth][,font=30][,fType][,change],disp[,show][,code],hide
|
||||
function WIDGET.newSlider(D)--name,x,y,w[,lim][,fText][,color][,unit][,smooth][,font=30][,change],disp[,show],code,hide
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
|
||||
@@ -649,10 +617,9 @@ function WIDGET.newSlider(D)--name,x,y,w[,lim][,fText][,color][,unit][,smooth][,
|
||||
unit= D.unit or 1,
|
||||
smooth=false,
|
||||
font= D.font or 30,
|
||||
fType= D.fType,
|
||||
change=D.change,
|
||||
disp= D.disp,
|
||||
code= D.code or NULL,
|
||||
code= D.code,
|
||||
hideF= D.hideF,
|
||||
hide= D.hide,
|
||||
show= false,
|
||||
@@ -724,10 +691,6 @@ function selector:draw()
|
||||
local w=self.w
|
||||
local ATV=self.ATV
|
||||
|
||||
--Background
|
||||
gc_setColor(0,0,0,.3)
|
||||
gc_rectangle('fill',x,y,w,60,4)
|
||||
|
||||
--Frame
|
||||
gc_setColor(1,1,1,.6+ATV*.1)
|
||||
gc_setLineWidth(2)
|
||||
@@ -781,7 +744,7 @@ function selector:press(x)
|
||||
self.select=s
|
||||
self.selText=self.list[s]
|
||||
if self.sound then
|
||||
SFX.play('selector')
|
||||
SFX.play('prerotate')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -801,14 +764,14 @@ function selector:scroll(n)
|
||||
self.select=s
|
||||
self.selText=self.list[s]
|
||||
if self.sound then
|
||||
SFX.play('selector')
|
||||
SFX.play('prerotate')
|
||||
end
|
||||
end
|
||||
function selector:arrowKey(k)
|
||||
self:scroll((k=='left'or k=='up')and -1 or 1)
|
||||
self:scroll((k=="left"or k=="up")and -1 or 1)
|
||||
end
|
||||
|
||||
function WIDGET.newSelector(D)--name,x,y,w[,fText][,color][,sound=true],list,disp[,code],hide
|
||||
function WIDGET.newSelector(D)--name,x,y,w[,fText][,color][,sound=true],list,disp,code,hide
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
|
||||
@@ -830,7 +793,7 @@ function WIDGET.newSelector(D)--name,x,y,w[,fText][,color][,sound=true],list,dis
|
||||
font= 30,
|
||||
list= D.list,
|
||||
disp= D.disp,
|
||||
code= D.code or NULL,
|
||||
code= D.code,
|
||||
hideF=D.hideF,
|
||||
hide= D.hide,
|
||||
}
|
||||
@@ -891,24 +854,18 @@ function inputBox:draw()
|
||||
local x,y,w,h=self.x,self.y,self.w,self.h
|
||||
local ATV=self.ATV
|
||||
|
||||
--Background
|
||||
gc_setColor(0,0,0,.4)
|
||||
gc_rectangle('fill',x,y,w,h,4)
|
||||
gc_setColor(1,1,1,ATV*.08)
|
||||
gc_rectangle('fill',x,y,w,h,3)
|
||||
|
||||
--Highlight
|
||||
gc_setColor(1,1,1,ATV*.08*(math.sin(TIME()*4.2)*.2+.8))
|
||||
gc_rectangle('fill',x,y,w,h,4)
|
||||
|
||||
--Frame
|
||||
gc_setColor(1,1,1)
|
||||
gc_setLineWidth(3)
|
||||
gc_rectangle('line',x,y,w,h,3)
|
||||
|
||||
--Drawable
|
||||
local f=self.font
|
||||
FONT.set(f,self.fType)
|
||||
FONT.set(f)
|
||||
if self.obj then
|
||||
gc_draw(self.obj,x-12-self.obj:getWidth(),y+h*.5-self.obj:getHeight()*.5)
|
||||
mDraw_Y(self.obj,x-12-self.obj:getWidth(),y+h*.5)
|
||||
end
|
||||
if self.secret then
|
||||
y=y+h*.5-f*.2
|
||||
@@ -935,21 +892,21 @@ end
|
||||
function inputBox:keypress(k)
|
||||
local t=self.value
|
||||
if #t>0 and EDITING==""then
|
||||
if k=='backspace'then
|
||||
if k=="backspace"then
|
||||
local p=#t
|
||||
while t:byte(p)>=128 and t:byte(p)<192 do
|
||||
p=p-1
|
||||
end
|
||||
t=sub(t,1,p-1)
|
||||
SFX.play('lock')
|
||||
elseif k=='delete'then
|
||||
elseif k=="delete"then
|
||||
t=""
|
||||
SFX.play('hold')
|
||||
end
|
||||
self.value=t
|
||||
end
|
||||
end
|
||||
function WIDGET.newInputBox(D)--name,x,y,w[,h][,font=30][,fType][,secret][,regex][,limit],hide
|
||||
function WIDGET.newInputBox(D)--name,x,y,w[,h][,font=30][,secret][,regex][,limit],hide
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
|
||||
@@ -965,7 +922,6 @@ function WIDGET.newInputBox(D)--name,x,y,w[,h][,font=30][,fType][,secret][,regex
|
||||
},
|
||||
|
||||
font= D.font or int(D.h/7-1)*5,
|
||||
fType= D.fType,
|
||||
secret=D.secret==true,
|
||||
regex= D.regex,
|
||||
limit= D.limit,
|
||||
@@ -1043,9 +999,9 @@ function textBox:scroll(dir)
|
||||
self:drag(nil,nil,nil,-dir*self.lineH)
|
||||
end
|
||||
function textBox:arrowKey(k)
|
||||
if k=='up'then
|
||||
if k=="up"then
|
||||
self:scroll(-1)
|
||||
elseif k=='down'then
|
||||
elseif k=="down"then
|
||||
self:scroll(-1)
|
||||
end
|
||||
end
|
||||
@@ -1057,8 +1013,8 @@ function textBox:draw()
|
||||
local lineH=self.lineH
|
||||
|
||||
--Background
|
||||
gc_setColor(0,0,0,.3)
|
||||
gc_rectangle('fill',x,y,w,h,4)
|
||||
gc_setColor(0,0,0,.4)
|
||||
gc_rectangle('fill',x,y,w,h,3)
|
||||
|
||||
--Frame
|
||||
gc_setLineWidth(2)
|
||||
@@ -1066,7 +1022,7 @@ function textBox:draw()
|
||||
gc_rectangle('line',x,y,w,h,3)
|
||||
|
||||
--Texts
|
||||
FONT.set(self.font,self.fType)
|
||||
FONT.set(self.font)
|
||||
gc_push('transform')
|
||||
gc_translate(x,y)
|
||||
|
||||
@@ -1098,7 +1054,7 @@ end
|
||||
function textBox:getInfo()
|
||||
return("x=%d,y=%d,w=%d,h=%d"):format(self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
|
||||
end
|
||||
function WIDGET.newTextBox(D)--name,x,y,w,h[,font=30][,fType][,lineH][,fix],hide
|
||||
function WIDGET.newTextBox(D)--name,x,y,w,h[,font=30][,lineH][,fix],hide
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
|
||||
@@ -1120,7 +1076,6 @@ function WIDGET.newTextBox(D)--name,x,y,w,h[,font=30][,fType][,lineH][,fix],hide
|
||||
h= D.h,
|
||||
|
||||
font= D.font or 30,
|
||||
fType=D.fType,
|
||||
fix= D.fix,
|
||||
texts={},
|
||||
hideF=D.hideF,
|
||||
@@ -1198,7 +1153,7 @@ function listBox:press(x,y)
|
||||
if self.list[y]then
|
||||
if self.selected~=y then
|
||||
self.selected=y
|
||||
SFX.play('selector',.8,0,12)
|
||||
SFX.play('click',.4)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1231,10 +1186,6 @@ function listBox:draw()
|
||||
gc_push('transform')
|
||||
gc_translate(x,y)
|
||||
|
||||
--Background
|
||||
gc_setColor(0,0,0,.4)
|
||||
gc_rectangle('fill',0,0,w,h,4)
|
||||
|
||||
--Frame
|
||||
gc_setColor(WIDGET.sel==self and COLOR.lN or COLOR.Z)
|
||||
gc_setLineWidth(2)
|
||||
@@ -1422,6 +1373,59 @@ function WIDGET.release(x,y)
|
||||
W:release(x,y+WIDGET.scrollPos)
|
||||
end
|
||||
end
|
||||
function WIDGET.keyPressed(k,isRep)
|
||||
local W=WIDGET.sel
|
||||
if k=="space"or k=="return"then
|
||||
if not isRep then
|
||||
WIDGET.press()
|
||||
end
|
||||
elseif k=="up"or k=="down"or k=="left"or k=="right"then
|
||||
if kb.isDown("lshift","lalt","lctrl")then
|
||||
--Control some widgets with arrowkeys when hold shift/ctrl/alt
|
||||
if W and W.arrowKey then W:arrowKey(k)end
|
||||
else
|
||||
if not W then
|
||||
for _,w in next,WIDGET.active do
|
||||
if not w.hide and w.isAbove then
|
||||
WIDGET.focus(w)
|
||||
return
|
||||
end
|
||||
end
|
||||
elseif W.getCenter then
|
||||
local WX,WY=W:getCenter()
|
||||
local dir=(k=="right"or k=="down")and 1 or -1
|
||||
local tar
|
||||
local minDist=1e99
|
||||
local swap_xy=k=="up"or k=="down"
|
||||
if swap_xy then WX,WY=WY,WX end--note that we do not swap them back later
|
||||
for _,W1 in ipairs(WIDGET.active)do
|
||||
if W~=W1 and W1.resCtr and not W1.hide then
|
||||
local L=W1.resCtr
|
||||
for j=1,#L,2 do
|
||||
local x,y=L[j],L[j+1]
|
||||
if swap_xy then x,y=y,x end--note that we do not swap them back later
|
||||
local dist=(x-WX)*dir
|
||||
if dist>10 then
|
||||
dist=dist+abs(y-WY)*6.26
|
||||
if dist<minDist then
|
||||
minDist=dist
|
||||
tar=W1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if tar then
|
||||
WIDGET.focus(tar)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if W and W.keypress then
|
||||
W:keypress(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
function WIDGET.textinput(texts)
|
||||
local W=WIDGET.sel
|
||||
if W and W.type=='inputBox'then
|
||||
@@ -1429,10 +1433,41 @@ function WIDGET.textinput(texts)
|
||||
WIDGET.sel.value=WIDGET.sel.value..texts
|
||||
SFX.play('touch')
|
||||
else
|
||||
SFX.play('drop_cancel')
|
||||
SFX.play('finesseError',.3)
|
||||
end
|
||||
end
|
||||
end
|
||||
local keyMirror={
|
||||
dpup="up",
|
||||
dpdown="down",
|
||||
dpleft="left",
|
||||
dpright="right",
|
||||
start="return",
|
||||
back="escape",
|
||||
}
|
||||
function WIDGET.gamepadPressed(i)
|
||||
if i=="start"then
|
||||
WIDGET.press()
|
||||
elseif i=="a"or i=="b"then
|
||||
local W=WIDGET.sel
|
||||
if W then
|
||||
if W.type=='button'or W.type=='key'then
|
||||
WIDGET.press()
|
||||
elseif W.type=='slider'then
|
||||
local p=W.disp()
|
||||
local P=i=="left"and(p>0 and p-1)or p<W.unit and p+1
|
||||
if p==P or not P then return end
|
||||
W.code(P)
|
||||
if W.change and timer()-W.lastTime>.18 then
|
||||
W.lastTime=timer()
|
||||
W.change()
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then
|
||||
WIDGET.keyPressed(keyMirror[i])
|
||||
end
|
||||
end
|
||||
|
||||
function WIDGET.update(dt)
|
||||
for _,W in next,WIDGET.active do
|
||||
|
||||
47
legals.md
@@ -1,23 +1,30 @@
|
||||
TECHMINO © 2019-2021 26F Studio. Some rights reserved.
|
||||
|
||||
TECHMINO and "26F Studio" are trademarks of 26F Studio. The TECHMINO game and source code are under a GNU Lesser General Public License Version 3.
|
||||
**TECHMINO © 2019-2021 26F Studio. Some rights reserved.**
|
||||
TECHMINO and "26F Studio" are trademarks of 26F Studio.
|
||||
The TECHMINO game and source code are under a GNU Lesser General Public License Version 3.
|
||||
|
||||
|
||||
"Tetris" is the registered trademark of The Tetris Holding, LLC, licensed to The Tetris Company, Inc. TECHMINO is not a fan game of Tetris. TECHMINO and 26F Studio are not affiliated with Tetris Holding, LLC or The Tetris Company, Inc. in any way.
|
||||
TECHMINO is not a fan game of Tetris. TECHMINO and 26F Studio are not affiliated with Tetris Holding, LLC or The Tetris Company, Inc. in any way.
|
||||
|
||||
|
||||
"Tetris" is the registered trademark of The Tetris Holding, LLC, licensed to The Tetris Company, Inc.
|
||||
|
||||
|
||||
Powered by LÖVE, © 2006-2021 LÖVE Development Team.
|
||||
|
||||
Lua is free software distributed under the terms of the MIT license. Copyright © 1994-2021 by Lua.org, PUC-Rio.
|
||||
|
||||
SIMPLE LOVE LIGHTS is under a MIT License. Created by Dylan Hunn.
|
||||
|
||||
json.lua is copyrighted by rxi. © 2021 rxi.
|
||||
|
||||
IBM Plex is copyrighted by the International Business Machines Corporation. IBM and IBM Plex are trademarks of IBM Corp, registered in many jurisdictions worldwide. IBM Plex is licensed under the SIL Open Font License, Version 1.1.
|
||||
Lua is free software distributed under the terms of the MIT license. Copyright © 1994~2021 by Lua.org, PUC-Rio.
|
||||
|
||||
|
||||
Source Han Sans is copyrighted by Adobe Inc. Source Han Sans and Adobe are registered trademarks of Adobe Inc. in United States and other countries or regions. Source Han Sans is licensed under the SIL Open Font License, Version 1.1.
|
||||
The Apple logo, "Apple Inc.," iOS, iPadOS, macOS, iPhone, and Mac are registered trademarks of Apple Inc. in the United States of America and other countries or regions.
|
||||
|
||||
|
||||
"Windows", the Windows logo, "Xbox", Xbox logo, and "Microsoft" are registered trademarks of Microsoft Corporation in the United States of America and other countries or regions.
|
||||
|
||||
|
||||
Alibaba Sans is copyrighted by Alibaba Group Holding Limited. Alibaba is a trademark of Alibaba Group Holding Limited in the People’s Republic of China and other countries or regions.
|
||||
|
||||
|
||||
IBM Plex is copyrighted by the International Business Machines Corporation. IBM and IBM Plex are trademarks of IBM Corp, registered in many jurisdictions worldwide. IBM Plex is licensed under the SIL Open Font License.
|
||||
|
||||
|
||||
JetBrains Mono is copyrighted by the JetBrains Mono Project authors. JetBrains Mono is a trademark of JetBrains s.r.o. JetBrains Mono is licensed under the SIL Open Font License, Version 1.1.
|
||||
@@ -26,26 +33,22 @@ JetBrains Mono is copyrighted by the JetBrains Mono Project authors. JetBrains M
|
||||
"PlayStation", "PS", "PlayStation Family Mark", "PS logo", "DualSense" and "Play Has No Limits" are registered trademarks or trademarks of Sony Interactive Entertainment Inc. "SONY" is a registered trademark of Sony Corporation. © 2021 Sony Interactive Entertainment LLC.
|
||||
|
||||
|
||||
"Windows", the Windows logo, "Xbox", Xbox logo, and "Microsoft" are registered trademarks of Microsoft Corporation in the United States of America and other countries or regions.
|
||||
|
||||
|
||||
The Apple logo, "Apple Inc.," iOS, iPadOS, macOS, iPhone, and Mac are registered trademarks of Apple Inc. in the United States of America and other countries or regions.
|
||||
N3TWORK is a registered trademark of N3TWORK Inc. © 2021 N3TWORK Inc.
|
||||
|
||||
|
||||
"EA" and "Electronic Arts" are registered trademarks of Electronic Arts Inc. © 2021 Electronic Arts Inc.
|
||||
|
||||
SEGA and the SEGA logo are registered trademarks of Sega Corporation. © 2021 Sega Corporation.
|
||||
|
||||
Oculus Quest is a registered trademark of Facebook Technologies, LLC. © Meta Platforms, Inc.
|
||||
Oculus Quest is a registered trademark of Facebook Technologies, LLC. © Facebook, Inc.
|
||||
|
||||
"Nintendo" is a registered trademarks of Nintendo Co., Ltd. © 2021 Nintendo Co., Ltd.
|
||||
|
||||
N3TWORK is a registered trademark of N3TWORK Inc. © 2021 N3TWORK Inc.
|
||||
|
||||
GoldWave is a registered trademark of GoldWave, Inc.
|
||||
|
||||
Linux is a registered trademark of Linus Torvalds.
|
||||
|
||||
Linux is a registered trademark of Linus Torvalds.
|
||||
|
||||
|
||||
Touhou Project © Team Shanghai Alice 2002-2021.
|
||||
|
||||
All other trademarks, logos, and copyrights are the properties of their respective owners.
|
||||
|
||||
All other trademarks are the properties of their respective owners.
|
||||
|
||||
92
main.lua
@@ -23,8 +23,7 @@ local fs=love.filesystem
|
||||
VERSION=require"version"
|
||||
TIME=love.timer.getTime
|
||||
YIELD=coroutine.yield
|
||||
SYSTEM=love.system.getOS()if SYSTEM=='OS X'then SYSTEM='macOS'end
|
||||
FNNS=true or SYSTEM:find'\79\83'--What does FNSF stand for? IDK so don't ask me lol
|
||||
SYSTEM=love.system.getOS()
|
||||
MOBILE=SYSTEM=='Android'or SYSTEM=='iOS'
|
||||
SAVEDIR=fs.getSaveDirectory()
|
||||
|
||||
@@ -50,17 +49,9 @@ local _LOADTIME_=TIME()
|
||||
|
||||
--Load modules
|
||||
Z=require'Zframework'
|
||||
FONT.load{
|
||||
norm='parts/fonts/proportional.ttf',
|
||||
mono='parts/fonts/monospaced.ttf',
|
||||
}
|
||||
FONT.setDefault('norm')
|
||||
FONT.setFallback('norm')
|
||||
|
||||
FONT.load('parts/fonts/proportional.ttf')
|
||||
SCR.setSize(1280,720)--Initialize Screen size
|
||||
BGM.setMaxSources(5)
|
||||
BGM.setChange(function(name)MES.new('music',text.nowPlaying..name,5)end)
|
||||
VOC.setDiversion(.62)
|
||||
|
||||
table.insert(_LOADTIMELIST_,("Load Zframework: %.3fs"):format(TIME()-_LOADTIME_))
|
||||
|
||||
@@ -71,8 +62,6 @@ mStr=GC.mStr
|
||||
mText=GC.simpX
|
||||
mDraw=GC.draw
|
||||
Snd=SFX.playSample
|
||||
string.repD=STRING.repD
|
||||
string.sArg=STRING.sArg
|
||||
|
||||
--Delete all naked files (from too old version)
|
||||
FILE.clear('')
|
||||
@@ -101,8 +90,7 @@ for _,v in next,fs.getDirectoryItems('parts/shaders')do
|
||||
end
|
||||
end
|
||||
|
||||
THEME= require'parts.theme'
|
||||
LINE= require'parts.line'
|
||||
FREEROW= require'parts.freeRow'
|
||||
DATA= require'parts.data'
|
||||
|
||||
TEXTURE= require'parts.texture'
|
||||
@@ -116,12 +104,6 @@ PLY= require'parts.player'
|
||||
NETPLY= require'parts.netPlayer'
|
||||
MODES= require'parts.modes'
|
||||
|
||||
setmetatable(TEXTURE,{__index=function(self,k)
|
||||
MES.new('warn',"No texture called: "..k)
|
||||
self[k]=PAPER
|
||||
return self[k]
|
||||
end})
|
||||
|
||||
table.insert(_LOADTIMELIST_,("Load Parts: %.3fs"):format(TIME()-_LOADTIME_))
|
||||
|
||||
--Init Zframework
|
||||
@@ -214,15 +196,15 @@ end
|
||||
Z.setOnQuit(destroyPlayers)
|
||||
|
||||
--Load settings and statistics
|
||||
TABLE.cover (loadFile('conf/user','-canSkip')or{},USER)
|
||||
TABLE.cover (loadFile('conf/unlock','-canSkip')or{},RANKS)
|
||||
TABLE.update(loadFile('conf/settings','-canSkip')or{},SETTING)
|
||||
TABLE.coverR(loadFile('conf/data','-canSkip')or{},STAT)
|
||||
TABLE.cover (loadFile('conf/key','-canSkip')or{},KEY_MAP)
|
||||
TABLE.cover (loadFile('conf/virtualkey','-json -canSkip')or{},VK_ORG)
|
||||
TABLE.cover (FILE.load('conf/user')or{},USER)
|
||||
TABLE.cover (FILE.load('conf/unlock')or{},RANKS)
|
||||
TABLE.update(FILE.load('conf/settings')or{},SETTING)
|
||||
TABLE.update(FILE.load('conf/data')or{},STAT)
|
||||
TABLE.cover (FILE.load('conf/key')or{},KEY_MAP)
|
||||
TABLE.cover (FILE.load('conf/virtualkey')or{},VK_ORG)
|
||||
|
||||
--Initialize fields, sequence, missions, gameEnv for cutsom game
|
||||
local fieldData=loadFile('conf/customBoards','-string -canSkip')
|
||||
local fieldData=FILE.load('conf/customBoards','string')
|
||||
if fieldData then
|
||||
fieldData=STRING.split(fieldData,"!")
|
||||
for i=1,#fieldData do
|
||||
@@ -231,15 +213,15 @@ if fieldData then
|
||||
else
|
||||
FIELD[1]=DATA.newBoard()
|
||||
end
|
||||
local sequenceData=loadFile('conf/customSequence','-string -canSkip')
|
||||
local sequenceData=FILE.load('conf/customSequence','string')
|
||||
if sequenceData then
|
||||
DATA.pasteSequence(sequenceData)
|
||||
end
|
||||
local missionData=loadFile('conf/customMissions','-string -canSkip')
|
||||
local missionData=FILE.load('conf/customMissions','string')
|
||||
if missionData then
|
||||
DATA.pasteMission(missionData)
|
||||
end
|
||||
local customData=loadFile('conf/customEnv','-canSkip')
|
||||
local customData=FILE.load('conf/customEnv')
|
||||
if customData and customData['version']==VERSION.code then
|
||||
TABLE.complete(customData,CUSTOMENV)
|
||||
end
|
||||
@@ -258,15 +240,13 @@ IMG.init{
|
||||
pay1='media/image/mess/pay1.png',
|
||||
pay2='media/image/mess/pay2.png',
|
||||
|
||||
miyaCH1='media/image/characters/miya1.png',
|
||||
miyaCH2='media/image/characters/miya2.png',
|
||||
miyaCH3='media/image/characters/miya3.png',
|
||||
miyaCH4='media/image/characters/miya4.png',
|
||||
miyaHeart='media/image/characters/miya_heart.png',
|
||||
miyaGlow='media/image/characters/miya_glow.png',
|
||||
miyaCH='media/image/characters/miya.png',
|
||||
miyaF1='media/image/characters/miya_f1.png',
|
||||
miyaF2='media/image/characters/miya_f2.png',
|
||||
miyaF3='media/image/characters/miya_f3.png',
|
||||
miyaF4='media/image/characters/miya_f4.png',
|
||||
monoCH='media/image/characters/mono.png',
|
||||
xiaoyaCH='media/image/characters/xiaoya.png',
|
||||
xiaoyaOmino='media/image/characters/xiaoya_Omino.png',
|
||||
mikuCH='media/image/characters/miku.png',
|
||||
electric='media/image/characters/electric.png',
|
||||
hbm='media/image/characters/hbm.png',
|
||||
@@ -283,7 +263,7 @@ IMG.init{
|
||||
SKIN.load{
|
||||
{name="crystal_scf",path='media/image/skin/crystal_scf.png'},
|
||||
{name="matte_mrz",path='media/image/skin/matte_mrz.png'},
|
||||
{name="shiny_chno",path='media/image/skin/shiny_chno.png'},
|
||||
{name="shiny_cho",path='media/image/skin/shiny_cho.png'},
|
||||
{name="contrast_mrz",path='media/image/skin/contrast_mrz.png'},
|
||||
{name="polkadots_scf",path='media/image/skin/polkadots_scf.png'},
|
||||
{name="toy_scf",path='media/image/skin/toy_scf.png'},
|
||||
@@ -306,7 +286,6 @@ SKIN.load{
|
||||
{name="classic",path='media/image/skin/classic_unknown.png'},
|
||||
{name="ball_shaw",path='media/image/skin/ball_shaw.png'},
|
||||
{name="retro_notypey",path='media/image/skin/retro_notypey.png'},
|
||||
{name="pixel_chno",path='media/image/skin/pixel_chno.png'},
|
||||
{name="textbone_mrz",path='media/image/skin/textbone_mrz.png'},
|
||||
{name="coloredbone_mrz",path='media/image/skin/coloredbone_mrz.png'},
|
||||
{name="wtf",path='media/image/skin/wtf_mrz.png'},
|
||||
@@ -345,13 +324,12 @@ VOC.init{
|
||||
LANG.init('zh',
|
||||
{
|
||||
zh=require'parts.language.lang_zh',
|
||||
zh_trad=require'parts.language.lang_zh_trad',
|
||||
zh_full=require'parts.language.lang_zh_full',
|
||||
zh_trad=require'parts.language.lang_zh_trad',
|
||||
en=require'parts.language.lang_en',
|
||||
fr=require'parts.language.lang_fr',
|
||||
es=require'parts.language.lang_es',
|
||||
pt=require'parts.language.lang_pt',
|
||||
id=require'parts.language.lang_id',
|
||||
zh_grass=require'parts.language.lang_zh_grass',
|
||||
zh_yygq=require'parts.language.lang_yygq',
|
||||
symbol=require'parts.language.lang_symbol',
|
||||
@@ -386,7 +364,6 @@ for _,v in next,fs.getDirectoryItems('parts/backgrounds')do
|
||||
BG.add(name,require('parts.backgrounds.'..name))
|
||||
end
|
||||
end
|
||||
BG.remList('none')BG.remList('gray')BG.remList('custom')
|
||||
--Load scene files from SOURCE ONLY
|
||||
for _,v in next,fs.getDirectoryItems('parts/scenes')do
|
||||
if isSafeFile('parts/scenes/'..v)then
|
||||
@@ -421,6 +398,7 @@ do
|
||||
local needSave
|
||||
|
||||
if not fs.getInfo('conf/data')then
|
||||
FIRSTLAUNCH=true
|
||||
needSave=true
|
||||
end
|
||||
if type(STAT.version)~='number'then
|
||||
@@ -452,6 +430,7 @@ do
|
||||
if RANKS.tsd_u then
|
||||
RANKS.tsd_u=0
|
||||
end
|
||||
needSave=true
|
||||
end
|
||||
if STAT.version==1601 then
|
||||
RANKS.round_e=nil
|
||||
@@ -465,11 +444,7 @@ do
|
||||
fs.remove('record/round_l.rec')
|
||||
fs.remove('record/round_u.rec')
|
||||
end
|
||||
if STAT.version<1700 and SETTING.dascut<5 then
|
||||
SETTING.dascut=SETTING.dascut+1
|
||||
needSave=true
|
||||
end
|
||||
if RANKS.stack_e then
|
||||
if STAT.version<1604 then
|
||||
RANKS.stack_e=nil
|
||||
RANKS.stack_h=nil
|
||||
RANKS.stack_u=nil
|
||||
@@ -485,18 +460,6 @@ do
|
||||
fs.remove('record/stack_40l.rec')
|
||||
fs.remove('record/stack_100l.rec')
|
||||
end
|
||||
if RANKS.rhythm_e then
|
||||
RANKS.rhythm_e=nil
|
||||
RANKS.rhythm_h=nil
|
||||
RANKS.rhythm_u=nil
|
||||
fs.remove('record/rhythm_e.rec')
|
||||
fs.remove('record/rhythm_h.rec')
|
||||
fs.remove('record/rhythm_u.rec')
|
||||
end
|
||||
if RANKS.bigbang then
|
||||
RANKS.clearRush,RANKS.bigbang=RANKS.bigbang
|
||||
fs.remove('record/bigbang.rec')
|
||||
end
|
||||
if STAT.version~=VERSION.code then
|
||||
for k,v in next,MODE_UPDATE_MAP do
|
||||
if RANKS[k]then
|
||||
@@ -524,8 +487,6 @@ do
|
||||
if type(SETTING.skinSet)=='number'then SETTING.skinSet='crystal_scf'end
|
||||
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then SETTING.frameMul=100 end
|
||||
if SETTING.cv then SETTING.vocPack,SETTING.cv=SETTING.cv end
|
||||
if type(SETTING.bg)~='string'then SETTING.bg='on'end
|
||||
if SETTING.skin[18]==10 then SETTING.skin[18]=4 end
|
||||
if RANKS.infinite then RANKS.infinite=0 end
|
||||
if RANKS.infinite_dig then RANKS.infinite_dig=0 end
|
||||
if not RANKS.sprint_10l then RANKS.sprint_10l=0 end
|
||||
@@ -565,8 +526,7 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
--First start
|
||||
FIRSTLAUNCH=STAT.run==0
|
||||
--First start for phones
|
||||
if FIRSTLAUNCH and MOBILE then
|
||||
SETTING.VKSwitch=true
|
||||
SETTING.powerInfo=true
|
||||
@@ -652,9 +612,9 @@ if TABLE.find(arg,'--test')then
|
||||
TASK.new(function()
|
||||
while true do
|
||||
YIELD()
|
||||
if Z.errData[1]then break end
|
||||
if ERRDATA[1]then break end
|
||||
end
|
||||
LOG("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(Z.errData[1].mes,"\n").."\27[91m\nAborting\27[0m")
|
||||
LOG("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(ERRDATA[1].mes,"\n").."\27[91m\nAborting\27[0m")
|
||||
TEST.yieldN(60)
|
||||
love.event.quit(1)
|
||||
end)
|
||||
|
||||
BIN
media/image/characters/miya.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 83 KiB |
BIN
media/image/characters/miya_f1.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
media/image/characters/miya_f2.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
media/image/characters/miya_f3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/image/characters/miya_f4.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 31 KiB |
BIN
media/music/1989.ogg
Normal file
102
parts/RSlist.lua
@@ -97,12 +97,12 @@ do
|
||||
{131,2,2, 0, 0,0},{131,2,2,-1,-1,0},{131,2,2,-1, 0,0},--S
|
||||
{131,1,2,-1, 0,0},{131,1,2, 0,-1,0},{131,1,2, 0, 0,0},--Z(misOrder)
|
||||
{313,2,2, 0, 0,0},{313,2,2,-1,-1,0},{313,2,2,-1, 0,0},--S(misOrder)
|
||||
{331,3,2, 0,-1,1},--J(farDown)
|
||||
{113,4,2,-1,-1,1},--L(farDown)
|
||||
{331,3,2, 0,-1,0},--J(farDown)
|
||||
{113,4,2,-1,-1,0},--L(farDown)
|
||||
{113,3,2,-1,-1,0},{113,3,0, 0, 0,0},--J
|
||||
{331,4,2, 0,-1,0},{331,4,0,-1, 0,0},--L
|
||||
{222,7,2,-1, 0,2},{222,7,2,-2, 0,2},{222,7,2, 0, 0,2},--I
|
||||
{222,7,0,-1, 1,1},{222,7,0,-2, 1,1},{222,7,0, 0, 1,1},--I(high)
|
||||
{222,7,2,-1, 0,2},{222,7,2,-2, 0,2},{222,7,2, 0, 0,2},--I(low)
|
||||
{121,6,0, 1,-1,2},{112,6,0, 2,-1,2},{122,6,0, 1,-2,2},--O
|
||||
{323,6,0,-1,-1,2},{332,6,0,-2,-1,2},{322,6,0,-1,-2,2},--O
|
||||
}--{keys, ID, dir, dx, dy, freeLevel (0=immovable, 1=U/D-immovable, 2=free)}
|
||||
@@ -129,10 +129,10 @@ do
|
||||
[10]={'+0+0','+1+0','+1-1','+0+2','+1-2','+1-2'},
|
||||
[03]={'+0+0','+1+0','+1+1','+0-2','+1-1','+1-2'},
|
||||
[30]={'+0+0','-1+0','-1-1','+0+2','-1+2','+0-1'},
|
||||
[12]={'+0+0','+1+0','+1-1','+0+2','+1+2','+1+1'},
|
||||
[21]={'+0+0','-1+0','-1+1','+0-2','-1-2','-1-1'},
|
||||
[32]={'+0+0','-1+0','-1-1','+0+2','-1+2','+0-1'},
|
||||
[23]={'+0+0','+1+0','+1+1','+0-2','+1-2','+0+1'},
|
||||
[12]={'+0+0','+1+0','+1-1','+0+2','+1+2'},
|
||||
[21]={'+0+0','-1+0','-1+1','+0-2','-1-2'},
|
||||
[32]={'+0+0','-1+0','-1-1','+0+2','-1+2'},
|
||||
[23]={'+0+0','+1+0','+1+1','+0-2','+1-2'},
|
||||
[02]={'+0+0','+1+0','-1+0','+0-1','+0+1'},
|
||||
[20]={'+0+0','-1+0','+1+0','+0+1','+0-1'},
|
||||
[13]={'+0+0','+0-1','+0+1','+0-2'},
|
||||
@@ -140,8 +140,8 @@ do
|
||||
},--Z
|
||||
false,--S
|
||||
{
|
||||
[01]={'+0+0','-1+0','-1+1','+0-2','+1+1','+0+1','+0-1'},
|
||||
[10]={'+0+0','+1+0','+1-1','+0+2','-1-1','+0-1','+0+1'},
|
||||
[01]={'+0+0','-1+0','-1+1','+0-2','+1+1','+0+1'},
|
||||
[10]={'+0+0','+1+0','+1-1','+0+2','-1-1','+0-1'},
|
||||
[03]={'+0+0','+1+0','+1+1','+0-2','+1-2','+1-1','+0+1'},
|
||||
[30]={'+0+0','-1+0','-1-1','+0+2','-1+2','+0-1','-1+1'},
|
||||
[12]={'+0+0','+1+0','+1-1','+1+1','-1+0','+0-1','+0+2','+1+2'},
|
||||
@@ -204,7 +204,6 @@ do
|
||||
P.spinLast=2
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
P:freshBlock('move')
|
||||
C.spinSeq=nil
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -305,8 +304,8 @@ do
|
||||
[10]={'+0+0','+0+1','+1+0','+0-2','+1-2'},
|
||||
[03]={'+0+0','+0-1','+0+1','+0+2'},
|
||||
[30]={'+0+0','+0-1','+0+1','+0-2'},
|
||||
[12]={'+0+0','+0-1','+0+1','+0+2'},
|
||||
[21]={'+0+0','+0-1','+0-2','+0-2'},
|
||||
[12]={'+0+0','+0-1','+0+1'},
|
||||
[21]={'+0+0','+0-1','+0-2'},
|
||||
[32]={'+0+0','+1+0','-1+0'},
|
||||
[23]={'+0+0','-1+0','+1+0'},
|
||||
[02]={'+0+0','-1+1','+1-1'},
|
||||
@@ -354,8 +353,8 @@ do
|
||||
[21]={'+0+0','-1+0','-1+1','+0+1','-1+2','+0+2','-1-1','+1+0','+0-2','-1-2'},
|
||||
[32]={'+0+0','-1+0','-1+1','-1-1','+1+0','+0+2','-1+2','+0-2'},
|
||||
[23]={'+0+0','+1+0','+1-1','+1+1','-1+0','+0-2','+1-2','+0+2'},
|
||||
[02]={'+0+0','+0-1','-1-1','+1-1','-1+0','+2-1'},
|
||||
[20]={'+0+0','+0+1','+1+1','-1+1','+1+0','-2+1'},
|
||||
[02]={'+0+0','+0-1','+1-1','-1+0','+2-1'},
|
||||
[20]={'+0+0','+0+1','-1+1','+1+0','-2+1'},
|
||||
[13]={'+0+0','-1+0','-1-1','+0+1','-1-2'},
|
||||
[31]={'+0+0','+1+0','+1+1','+0-1','+1+2'},
|
||||
},--J5
|
||||
@@ -376,8 +375,8 @@ do
|
||||
},--R
|
||||
false,--Y
|
||||
{
|
||||
[01]={'+0+0','-1+0','-1+1','+0+1','+1+0','+1+1','-1+2','-2+0','+0-2'},
|
||||
[10]={'+0+0','+1+0','-1+0','+0-1','-1-1','+1-1','+1-2','+2+0','+0+2'},
|
||||
[01]={'+0+0','-1+0','-1+1','+0+1','+1+0','-1+2','-2+0','+0-2'},
|
||||
[10]={'+0+0','+1+0','-1+0','+0-1','+1-1','+1-2','+2+0','+0+2'},
|
||||
[03]={'+0+0','-1+0','+1-1','+0-2','+0-3','+1+0','+1-2','+1-3','+0+1','-1+1'},
|
||||
[30]={'+0+0','-1+0','+1-1','+1-2','+1+0','+0-2','+1-3','-1+2','+0+3','-1+3'},
|
||||
[12]={'+0+0','-1+0','+1-1','-1-1','+1-2','+1+0','+0-2','+1-3','-1+2','+0+3','-1+3'},
|
||||
@@ -687,7 +686,13 @@ do
|
||||
sfx='prerotate'
|
||||
elseif P:ifoverlap(icb,x,y+1)and P:ifoverlap(icb,x-1,y)and P:ifoverlap(icb,x+1,y)then
|
||||
sfx='rotatekick'
|
||||
P:_rotateField(d)
|
||||
if P.gameEnv.shakeFX then
|
||||
if d==1 or d==3 then
|
||||
P.fieldOff.va=P.fieldOff.va+(2-d)*6e-3
|
||||
else
|
||||
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*3e-3
|
||||
end
|
||||
end
|
||||
else
|
||||
sfx='rotate'
|
||||
end
|
||||
@@ -762,68 +767,6 @@ do
|
||||
ARS_Z.kickTable[25]=upSet
|
||||
end
|
||||
|
||||
local DRS_weak
|
||||
do
|
||||
local centerPos=TABLE.copy(defaultCenterPos)
|
||||
centerPos[1]={[0]={1,1},{1,0},{1,1},{1,1}}--Z
|
||||
centerPos[2]={[0]={1,1},{1,0},{1,1},{1,1}}--S
|
||||
centerPos[3]={[0]={1,1},{1,0},{1,1},{1,1}}--L
|
||||
centerPos[4]={[0]={1,1},{1,0},{1,1},{1,1}}--J
|
||||
centerPos[5]={[0]={1,1},{1,0},{1,1},{1,1}}--T
|
||||
centerPos[7]={[0]={.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}}--I
|
||||
centerPos[10]={[0]={1,1},{1,0},{1,1},{1,0}}--P
|
||||
centerPos[11]={[0]={1,1},{1,1},{1,1},{1,1}}--Q
|
||||
centerPos[15]={[0]={1,1},{1,0},{1,1},{1,1}}--U
|
||||
centerPos[16]={[0]={1,1},{1,1},{1,1},{1,1}}--V
|
||||
centerPos[19]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--J5
|
||||
centerPos[20]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--L5
|
||||
centerPos[21]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--R
|
||||
centerPos[22]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--Y
|
||||
centerPos[23]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--N
|
||||
centerPos[24]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--H
|
||||
centerPos[26]={[0]={0,1},{0,0},{0,1},{0,0}}--I3
|
||||
centerPos[28]={[0]={0,1},{0,0},{0,1},{0,0}}--I2
|
||||
|
||||
local L={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1'}
|
||||
local R={'+0+0','+1+0','-1+0','+0-1','+1-1','-1-1'}
|
||||
|
||||
local Z={
|
||||
[01]=R,[10]=L,[03]=L,[30]=R,
|
||||
[12]=R,[21]=L,[32]=L,[23]=R,
|
||||
[02]=R,[20]=L,[13]=L,[31]=R,
|
||||
}
|
||||
local S=_reflect(Z)
|
||||
|
||||
DRS_weak={
|
||||
centerTex=GC.DO{10,10,
|
||||
{'setLW',2},
|
||||
{'dRect',1,1,8,8},
|
||||
{'fRect',3,3,4,4},
|
||||
},
|
||||
centerPos=centerPos,
|
||||
kickTable={
|
||||
Z,S,--Z,S
|
||||
Z,S,--J,L
|
||||
Z,--T
|
||||
noKickSet,--O
|
||||
Z,--I
|
||||
|
||||
Z,S,--Z5,S5
|
||||
Z,S,--P,Q
|
||||
Z,S,--F,E
|
||||
Z,Z,Z,Z,--T5,U,V,W
|
||||
noKickSet,--X
|
||||
Z,S,--J5,L5
|
||||
Z,S,--R,Y
|
||||
Z,S,--N,H
|
||||
Z,--I5
|
||||
|
||||
Z,Z,--I3,C
|
||||
Z,Z,--I2,O1
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
local ASC
|
||||
do
|
||||
local L={'+0+0','+1+0','+0-1','+1-1','+0-2','+1-2','+2+0','+2-1','+2-2','-1+0','-1-1','+0+1','+1+1','+2+1','-1-2','-2+0','+0+2','+1+2','+2+2','-2-1','-2-2'}
|
||||
@@ -997,7 +940,6 @@ local RSlist={
|
||||
SRS_X=SRS_X,
|
||||
BiRS=BiRS,
|
||||
ARS_Z=ARS_Z,
|
||||
DRS_weak=DRS_weak,
|
||||
ASC=ASC,
|
||||
ASC_plus=ASC_plus,
|
||||
C2=C2,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--blockhole
|
||||
--Blackhole
|
||||
local gc=love.graphics
|
||||
local gc_clear,gc_replaceTransform=gc.clear,gc.replaceTransform
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
@@ -51,7 +51,7 @@ function back.draw()
|
||||
gc_draw(S.texture,S.d*cos(S.ang),S.d*sin(S.ang),S.rotate,S.size*.026,nil,15,15)
|
||||
end
|
||||
|
||||
--blockhole
|
||||
--Blackhole
|
||||
gc_setColor(.07,.07,.07)
|
||||
gc_circle('fill',0,0,157)
|
||||
gc_setLineWidth(6)
|
||||
@@ -1,31 +0,0 @@
|
||||
--Secret custom background
|
||||
local gc_clear,gc_setColor=love.graphics.clear,love.graphics.setColor
|
||||
local back={}
|
||||
|
||||
local image=false
|
||||
local alpha=.26
|
||||
|
||||
local mx,my,k
|
||||
|
||||
function back.init()
|
||||
back.resize()
|
||||
end
|
||||
function back.resize()
|
||||
mx,my=SCR.w*.5,SCR.h*.5
|
||||
if image then
|
||||
k=math.max(SCR.w/image:getWidth(),SCR.h/image:getHeight())
|
||||
end
|
||||
end
|
||||
function back.draw()
|
||||
gc_clear(.1,.1,.1)
|
||||
if image then
|
||||
gc_setColor(1,1,1,alpha)
|
||||
mDraw(image,mx,my,nil,k)
|
||||
end
|
||||
end
|
||||
function back.event(a,img)
|
||||
if a then alpha=a end
|
||||
if img then image=img end
|
||||
back.resize()
|
||||
end
|
||||
return back
|
||||
@@ -12,9 +12,10 @@ local ins,rem=table.insert,table.remove
|
||||
local back={}
|
||||
|
||||
local t
|
||||
local petal
|
||||
local fan,petal
|
||||
function back.init()
|
||||
t=0
|
||||
fan=SVG_TITLE_FAN
|
||||
petal={}
|
||||
end
|
||||
function back.update()
|
||||
@@ -61,7 +62,7 @@ function back.draw()
|
||||
|
||||
gc_setLineWidth(6)
|
||||
gc_setColor(.8,.9,1,.3)
|
||||
for i=1,#SVG_TITLE_FAN do gc_polygon('line',SVG_TITLE_FAN[i])end
|
||||
for i=1,8 do gc_polygon('line',fan[i])end
|
||||
|
||||
gc_setLineWidth(2)
|
||||
gc_setColor(1,.5,.7,.3)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--Customizable grey background
|
||||
local gc=love.graphics
|
||||
local back={}
|
||||
local brightness=.26
|
||||
function back.draw()
|
||||
gc.clear(brightness,brightness,brightness)
|
||||
end
|
||||
function back.event(b)
|
||||
brightness=b
|
||||
end
|
||||
return back
|
||||
@@ -44,7 +44,8 @@ local function _ifoverlapAI(f,bk,x,y)
|
||||
end
|
||||
end end
|
||||
end
|
||||
local getRow,discardRow=LINE.new,LINE.discard
|
||||
local discardRow=FREEROW.discard
|
||||
local getRow=FREEROW.get
|
||||
local function _resetField(f0,f,start)
|
||||
for _=#f,start,-1 do
|
||||
discardRow(f[_])
|
||||
|
||||
@@ -25,8 +25,8 @@ function bot_cc:revive()
|
||||
self.P:loadAI(self.data)
|
||||
end
|
||||
function bot_cc:pushNewNext(id)
|
||||
self.ccBot:addNext(rem(self.bufferedNexts,1))
|
||||
ins(self.bufferedNexts,id)
|
||||
self.ccBot:addNext(rem(self.nexts,1))
|
||||
ins(self.nexts,id)
|
||||
end
|
||||
function bot_cc:thread()
|
||||
local P,keys=self.P,self.keys
|
||||
|
||||
@@ -12,7 +12,7 @@ local baseBot={
|
||||
function baseBot.update(bot)
|
||||
local P=bot.P
|
||||
local keys=bot.keys
|
||||
if P.control and P.cur then
|
||||
if P.control and P.waiting==-1 then
|
||||
bot.delay=bot.delay-1
|
||||
if not keys[1]then
|
||||
if bot.runningThread then
|
||||
@@ -85,7 +85,7 @@ function BOT.new(P,data)
|
||||
if data.type=="CC"then
|
||||
P:setRS('SRS')
|
||||
bot.keys={}
|
||||
bot.bufferedNexts={}
|
||||
bot.nexts={}
|
||||
bot.delay=data.delay
|
||||
bot.delay0=data.delay
|
||||
if P.gameEnv.holdCount>1 then
|
||||
@@ -109,25 +109,20 @@ function BOT.new(P,data)
|
||||
return
|
||||
self.ccBot[k]and function(_,...)self.ccBot[k](self.ccBot,...)end or
|
||||
cc_lua[k]and function(_,...)cc_lua[k](self,...)end or
|
||||
assert(baseBot[k],"No CC action called "..k)
|
||||
baseBot[k]and baseBot[k]or
|
||||
error("No actions called "..k)
|
||||
end})
|
||||
|
||||
local pushed=0
|
||||
if P.cur then
|
||||
bot:addNext(P.cur.id)
|
||||
pushed=pushed+1
|
||||
end
|
||||
for _,B in next,P.nextQueue do
|
||||
if pushed<=data.next then
|
||||
for i,B in next,P.nextQueue do
|
||||
if i<=data.next then
|
||||
bot:addNext(B.id)
|
||||
pushed=pushed+1
|
||||
else
|
||||
ins(bot.bufferedNexts,B.id)
|
||||
ins(bot.nexts,B.id)
|
||||
end
|
||||
end
|
||||
bot.runningThread=coroutine.wrap(cc_lua.thread)
|
||||
bot.runningThread(bot)
|
||||
else--if data.type=="9S"then--9s or else
|
||||
elseif data.type=="9S"or true then--9s or else
|
||||
TABLE.cover(baseBot,bot)
|
||||
TABLE.cover(require"parts.bot.bot_9s",bot)
|
||||
P:setRS('TRS')
|
||||
|
||||
@@ -6,8 +6,6 @@ return{
|
||||
lock=1e99,
|
||||
wait=0,
|
||||
fall=0,
|
||||
hang=5,
|
||||
hurry=1e99,
|
||||
|
||||
--Control
|
||||
nextCount=6,
|
||||
@@ -21,7 +19,6 @@ return{
|
||||
|
||||
--Rule
|
||||
sequence='bag',
|
||||
lockout=false,
|
||||
fieldH=20,
|
||||
heightLimit=1e99,
|
||||
bufferLimit=1e99,
|
||||
|
||||
@@ -33,7 +33,6 @@ return{
|
||||
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
|
||||
end
|
||||
end
|
||||
P:shakeField(9)
|
||||
D.wave=D.wave+1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,7 +42,6 @@ return{
|
||||
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
|
||||
end
|
||||
end
|
||||
P:shakeField(10)
|
||||
D.wave=D.wave+1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.lastPiece.atk>0 then
|
||||
P:receive(nil,P.lastPiece.atk,0,generateLine(P.holeRND:random(10)))
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.lastPiece.atk>0 then
|
||||
P:receive(nil,P.lastPiece.atk,120,generateLine(P.holeRND:random(10)))
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.lastPiece.atk>0 then
|
||||
P:receive(nil,P.lastPiece.atk,30,generateLine(P.holeRND:random(10)))
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.lastPiece.atk>0 then
|
||||
P:receive(nil,P.lastPiece.atk,60,generateLine(P.holeRND:random(10)))
|
||||
end
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
if P.lastPiece.row>0 then
|
||||
for _=1,#P.clearedRow do
|
||||
local h=#P.field
|
||||
P.field[h+1]=LINE.new(20)
|
||||
P.visTime[h+1]=LINE.new(20)
|
||||
for i=3,7 do P.field[h+1][i]=0 end
|
||||
end
|
||||
if P.combo>P.modeData.maxCombo then
|
||||
P.modeData.maxCombo=P.combo
|
||||
end
|
||||
if P.stat.row>=200 then
|
||||
P:win('finish')
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
return
|
||||
{
|
||||
drop=1,
|
||||
wait=8,
|
||||
fall=20,
|
||||
fieldH=10,
|
||||
mesDisp=function(P)
|
||||
PLY.draw.drawProgress(P.stat.row,P.modeData.target)
|
||||
PLY.draw.drawTargetLine(P,200-P.stat.row)
|
||||
end,
|
||||
task=function(P)
|
||||
local F=P.field
|
||||
for i=1,24 do
|
||||
F[i]=LINE.new(20)
|
||||
P.visTime[i]=LINE.new(20)
|
||||
for x=3,7 do F[i][x]=0 end
|
||||
end
|
||||
P.modeData.target=50
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
if P.stat.row>=P.modeData.target then
|
||||
if P.modeData.target==50 then
|
||||
P.gameEnv.drop=.5
|
||||
P.modeData.target=100
|
||||
SFX.play('reach')
|
||||
elseif P.modeData.target==100 then
|
||||
P.gameEnv.drop=.25
|
||||
P.modeData.target=150
|
||||
SFX.play('reach')
|
||||
elseif P.modeData.target==150 then
|
||||
P:set20G(true)
|
||||
P.modeData.target=200
|
||||
SFX.play('reach')
|
||||
else
|
||||
P:win('finish')
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
local dropSpeed={100,80,60,48,36,28,20,16,12,10,8,6,4,2,2,1,1,.5,.5}
|
||||
|
||||
return
|
||||
{
|
||||
drop=120,
|
||||
wait=8,
|
||||
fall=20,
|
||||
fieldH=10,
|
||||
mesDisp=function(P)
|
||||
PLY.draw.drawProgress(P.stat.row,P.modeData.target)
|
||||
PLY.draw.drawTargetLine(P,200-P.stat.row)
|
||||
end,
|
||||
task=function(P)
|
||||
local F=P.field
|
||||
for i=1,24 do
|
||||
F[i]=LINE.new(20)
|
||||
P.visTime[i]=LINE.new(20)
|
||||
for x=3,7 do F[i][x]=0 end
|
||||
end
|
||||
P.modeData.target=10
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
if P.stat.row>=P.modeData.target then
|
||||
if P.modeData.target==200 then
|
||||
P:win('finish')
|
||||
else
|
||||
P.gameEnv.drop=dropSpeed[P.modeData.target/10]
|
||||
P.modeData.target=P.modeData.target+10
|
||||
SFX.play('reach')
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -11,8 +11,8 @@ return{
|
||||
task=function(P)
|
||||
local F=P.field
|
||||
for i=1,24 do
|
||||
F[i]=LINE.new(20)
|
||||
P.visTime[i]=LINE.new(20)
|
||||
F[i]=FREEROW.get(20)
|
||||
P.visTime[i]=FREEROW.get(20)
|
||||
for x=4,7 do F[i][x]=0 end
|
||||
end
|
||||
if P.holeRND:random()<.6 then
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.lastPiece.row>0 then
|
||||
for _=1,#P.clearedRow do
|
||||
local h=#P.field
|
||||
P.field[h+1]=LINE.new(20)
|
||||
P.visTime[h+1]=LINE.new(20)
|
||||
P.field[h+1]=FREEROW.get(20)
|
||||
P.visTime[h+1]=FREEROW.get(20)
|
||||
for i=4,7 do P.field[h+1][i]=0 end
|
||||
end
|
||||
if P.combo>P.modeData.maxCombo then
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.lastPiece.row==0 then
|
||||
P:lose()
|
||||
else
|
||||
for _=1,P.lastPiece.row do
|
||||
local h=#P.field
|
||||
P.field[h+1]=LINE.new(20)
|
||||
P.visTime[h+1]=LINE.new(20)
|
||||
P.field[h+1]=FREEROW.get(20)
|
||||
P.visTime[h+1]=FREEROW.get(20)
|
||||
for i=4,7 do P.field[h+1][i]=0 end
|
||||
end
|
||||
if P.combo>P.modeData.maxCombo then
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mText(TEXTOBJ.atk,63,243)
|
||||
mText(TEXTOBJ.eff,63,363)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.atk>=100 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.garbageBeneath==0 then
|
||||
local D=P.modeData
|
||||
D.finished=D.finished+1
|
||||
if FIELD[D.finished+1]then
|
||||
P.waiting=26
|
||||
for i=#P.field,1,-1 do
|
||||
FREEROW.discard(P.field[i])
|
||||
FREEROW.discard(P.visTime[i])
|
||||
P.field[i],P.visTime[i]=nil
|
||||
end
|
||||
setField(P,D.finished+1)
|
||||
SYSFX.newShade(1.4,P.absFieldX,P.absFieldY,300*P.size,610*P.size,.6,.8,.6)
|
||||
SFX.play('warn_1')
|
||||
SFX.play('blip_1')
|
||||
else
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mStr(r,63,265)
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=10 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mStr(r,63,265)
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=100 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mStr(r,63,265)
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=1000 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mStr(r,63,265)
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=20 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mStr(r,63,265)
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=200 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mStr(r,63,265)
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=40 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
mStr(r,63,265)
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=400 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if #PLY_ALIVE>1 then
|
||||
P.control=false
|
||||
local id1=P.sid
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.piece%7==0 and #PLY_ALIVE>1 then
|
||||
P.control=false
|
||||
local id1=P.sid
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local gc_setColor=love.graphics.setColor
|
||||
return{
|
||||
das=16,arr=6,
|
||||
sddas=6,sdarr=6,
|
||||
@@ -19,37 +18,25 @@ return{
|
||||
mStr(r<10 and 9 or r<30 and r or("%02x"):format(r*10-300),63,210)
|
||||
mText(TEXTOBJ.speedLV,63,290)
|
||||
PLY.draw.drawProgress(P.stat.row,P.modeData.target)
|
||||
if P.modeData.drought>7 then
|
||||
if P.modeData.drought<=14 then
|
||||
gc_setColor(1,1,1,P.modeData.drought/7-1)
|
||||
else
|
||||
local gb=P.modeData.drought<=21 and 2-P.modeData.drought/14 or .5
|
||||
gc_setColor(1,gb,gb)
|
||||
end
|
||||
setFont(50)
|
||||
mStr(P.modeData.drought,63,130)
|
||||
mDraw(MODES.drought_l.icon,63,200,nil,.5)
|
||||
end
|
||||
end,
|
||||
task=function(P)
|
||||
P.modeData.target=10
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
local D=P.modeData
|
||||
D.drought=P.lastPiece.id==7 and 0 or D.drought+1
|
||||
if P.stat.row>=D.target then
|
||||
if D.target==110 then
|
||||
P.gameEnv.drop,P.gameEnv.lock=5,5
|
||||
P.gameEnv.sddas,P.gameEnv.sdarr=5,5
|
||||
SFX.play('warn_2',.7)
|
||||
SFX.play('blip_2',.7)
|
||||
elseif D.target==140 then
|
||||
P.gameEnv.drop,P.gameEnv.lock=4,4
|
||||
P.gameEnv.sddas,P.gameEnv.sdarr=4,4
|
||||
SFX.play('warn_2',.7)
|
||||
SFX.play('blip_2',.7)
|
||||
elseif D.target==170 then
|
||||
P.gameEnv.drop,P.gameEnv.lock=3,3
|
||||
P.gameEnv.sddas,P.gameEnv.sdarr=3,3
|
||||
SFX.play('warn_2',.7)
|
||||
SFX.play('blip_2',.7)
|
||||
elseif D.target==200 then
|
||||
P:win('finish')
|
||||
return
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local gc_setColor=love.graphics.setColor
|
||||
return{
|
||||
das=16,arr=6,
|
||||
sddas=3,sdarr=3,
|
||||
@@ -19,29 +18,17 @@ return{
|
||||
mStr(r<11 and 18 or r<22 and r+8 or("%02x"):format(r*10-220),63,210)
|
||||
mText(TEXTOBJ.speedLV,63,290)
|
||||
PLY.draw.drawProgress(P.stat.row,P.modeData.target)
|
||||
if P.modeData.drought>7 then
|
||||
if P.modeData.drought<=14 then
|
||||
gc_setColor(1,1,1,P.modeData.drought/7-1)
|
||||
else
|
||||
local gb=P.modeData.drought<=21 and 2-P.modeData.drought/14 or .5
|
||||
gc_setColor(1,gb,gb)
|
||||
end
|
||||
setFont(50)
|
||||
mStr(P.modeData.drought,63,130)
|
||||
mDraw(MODES.drought_l.icon,63,200,nil,.5)
|
||||
end
|
||||
end,
|
||||
task=function(P)
|
||||
P.modeData.target=10
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
local D=P.modeData
|
||||
D.drought=P.lastPiece.id==7 and 0 or D.drought+1
|
||||
if P.stat.row>=D.target then
|
||||
if D.target==110 then
|
||||
P.gameEnv.drop,P.gameEnv.lock=2,2
|
||||
P.gameEnv.sddas,P.gameEnv.sdarr=2,2
|
||||
SFX.play('warn_1')
|
||||
SFX.play('blip_1')
|
||||
elseif D.target==200 then
|
||||
P:win('finish')
|
||||
return
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local gc_setColor=love.graphics.setColor
|
||||
return{
|
||||
das=16,arr=6,
|
||||
sddas=1,sdarr=1,
|
||||
@@ -19,24 +18,12 @@ return{
|
||||
mStr(r==1 and 29 or("%02x"):format(r*10-20),63,210)
|
||||
mText(TEXTOBJ.speedLV,63,290)
|
||||
PLY.draw.drawProgress(P.stat.row,P.modeData.target)
|
||||
if P.modeData.drought>7 then
|
||||
if P.modeData.drought<=14 then
|
||||
gc_setColor(1,1,1,P.modeData.drought/7-1)
|
||||
else
|
||||
local gb=P.modeData.drought<=21 and 2-P.modeData.drought/14 or .5
|
||||
gc_setColor(1,gb,gb)
|
||||
end
|
||||
setFont(50)
|
||||
mStr(P.modeData.drought,63,130)
|
||||
mDraw(MODES.drought_l.icon,63,200,nil,.5)
|
||||
end
|
||||
end,
|
||||
task=function(P)
|
||||
P.modeData.target=10
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
local D=P.modeData
|
||||
D.drought=P.lastPiece.id==7 and 0 or D.drought+1
|
||||
if P.stat.row>=D.target then
|
||||
if D.target==100 then
|
||||
P:win('finish')
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
local function task_newBoard(P,init)
|
||||
local targetLine
|
||||
local F,L={},{1}
|
||||
--TODO
|
||||
P:pushNextList(L)
|
||||
|
||||
P.control=false
|
||||
if not init then for _=1,26 do YIELD()end end
|
||||
P.control=true
|
||||
|
||||
P.gameEnv.heightLimit=targetLine or #F
|
||||
P:pushLineList(F)
|
||||
end
|
||||
local function _check(P)
|
||||
P.gameEnv.heightLimit=P.gameEnv.heightLimit-P.lastPiece.row
|
||||
if P.gameEnv.heightLimit==0 then
|
||||
P.modeData.stage=P.modeData.stage+1
|
||||
if P.modeData.stage>=100 then
|
||||
P:win('finish')
|
||||
else
|
||||
P:newTask(task_newBoard)
|
||||
end
|
||||
end
|
||||
end
|
||||
return{
|
||||
sequence='none',
|
||||
RS="TRS",
|
||||
pushSpeed=5,
|
||||
mesDisp=function(P)
|
||||
setFont(60)
|
||||
mStr(P.modeData.stage,63,280)
|
||||
mText(TEXTOBJ.wave,63,350)
|
||||
end,
|
||||
hook_drop=_check,
|
||||
task=function(P)task_newBoard(P,true)P.fieldBeneath=0 end,--Just run one time at first to start first level
|
||||
}
|
||||
@@ -40,7 +40,6 @@ return{
|
||||
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
|
||||
P.dropDelay,P.gameEnv.drop=2,2
|
||||
end
|
||||
P:shakeField(3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,7 +40,6 @@ return{
|
||||
P.dropDelay,P.gameEnv.drop=5,5
|
||||
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
|
||||
end
|
||||
P:shakeField(3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ return{
|
||||
setFont(55)
|
||||
mStr(100-P.stat.dig,63,265)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
for _=1,math.min(10,100-P.stat.dig)-P.garbageBeneath do
|
||||
P:garbageRise(21,1,P:getHolePos())
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ return{
|
||||
setFont(55)
|
||||
mStr(10-P.stat.dig,63,265)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.dig==10 then
|
||||
P:win('finish')
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ return{
|
||||
setFont(55)
|
||||
mStr(400-P.stat.dig,63,265)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
for _=1,math.min(10,400-P.stat.dig)-P.garbageBeneath do
|
||||
P:garbageRise(21,1,P:getHolePos())
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ return{
|
||||
setFont(55)
|
||||
mStr(40-P.stat.dig,63,265)
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
for _=1,math.min(10,40-P.stat.dig)-P.garbageBeneath do
|
||||
P:garbageRise(21,1,P:getHolePos())
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@ return{
|
||||
task=function(P)
|
||||
P.modeData.target=10
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
local flag
|
||||
local l=P.lastPiece
|
||||
if P.combo>1 then flag=true;P:showText("2x",0,-220,40,'flicker',.3)end
|
||||
|
||||
@@ -10,7 +10,7 @@ return
|
||||
task=function(P)
|
||||
P.modeData.target=50
|
||||
end,
|
||||
hook_drop=function(P)
|
||||
dropPiece=function(P)
|
||||
if P.stat.row>=P.modeData.target then
|
||||
if P.modeData.target==50 then
|
||||
P.gameEnv.drop=.25
|
||||
|
||||