给录像流编码和其他游戏相关全局函数加注释
This commit is contained in:
@@ -142,7 +142,7 @@ function pasteSequence(str)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function newBoard(f)
|
function newBoard(f)--Generate a new board
|
||||||
if f then
|
if f then
|
||||||
return copyList(f)
|
return copyList(f)
|
||||||
else
|
else
|
||||||
@@ -151,7 +151,7 @@ function newBoard(f)
|
|||||||
return F
|
return F
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function copyBoard(page)
|
function copyBoard(page)--Copy the [page] board
|
||||||
local F=FIELD[page or 1]
|
local F=FIELD[page or 1]
|
||||||
local str=""
|
local str=""
|
||||||
local H=0
|
local H=0
|
||||||
@@ -177,7 +177,7 @@ function copyBoard(page)
|
|||||||
end
|
end
|
||||||
return data.encode("string","base64",data.compress("string","zlib",str))
|
return data.encode("string","base64",data.compress("string","zlib",str))
|
||||||
end
|
end
|
||||||
function pasteBoard(str,page)
|
function pasteBoard(str,page)--Paste [str] data to [page] board
|
||||||
local F=FIELD[page or 1]
|
local F=FIELD[page or 1]
|
||||||
local _,__
|
local _,__
|
||||||
|
|
||||||
@@ -339,6 +339,7 @@ function mergeStat(stat,delta)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Functions for royale mode
|
||||||
function randomTarget(P)--Return a random opponent for P
|
function randomTarget(P)--Return a random opponent for P
|
||||||
if #PLAYERS.alive>1 then
|
if #PLAYERS.alive>1 then
|
||||||
local R
|
local R
|
||||||
@@ -461,7 +462,7 @@ function applyCustomGame()
|
|||||||
GAME.modeEnv.mission=nil
|
GAME.modeEnv.mission=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function loadGame(M,ifQuickPlay)
|
function loadGame(M,ifQuickPlay)--Load a mode and go to game scene
|
||||||
freshDate()
|
freshDate()
|
||||||
if legalGameTime()then
|
if legalGameTime()then
|
||||||
if MODES[M].score then STAT.lastPlay=M end
|
if MODES[M].score then STAT.lastPlay=M end
|
||||||
@@ -474,7 +475,7 @@ function loadGame(M,ifQuickPlay)
|
|||||||
SFX.play("enter")
|
SFX.play("enter")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function resetPlayerPosition()
|
function resetPlayerPosition()--Set position & size for every players
|
||||||
local L=PLAYERS.alive
|
local L=PLAYERS.alive
|
||||||
L[1]:setPosition(340,75)
|
L[1]:setPosition(340,75)
|
||||||
if #L<=5 then
|
if #L<=5 then
|
||||||
@@ -587,7 +588,7 @@ function gameStart()
|
|||||||
P:popNext()
|
P:popNext()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scoreValid()
|
function scoreValid()--Check if any unranked mods are activated
|
||||||
for _,M in next,GAME.mod do
|
for _,M in next,GAME.mod do
|
||||||
if M.unranked then
|
if M.unranked then
|
||||||
return false
|
return false
|
||||||
@@ -595,6 +596,22 @@ function scoreValid()
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
--[[
|
||||||
|
Byte data format: (1 byte each period)
|
||||||
|
KeyID, dt, KeyID, dt, ......
|
||||||
|
KeyID range from 1 to 20, negative when release key
|
||||||
|
dt from 0 to infinity, 0~254 when 0~254, read next byte as dt(if there is an 255, add next byte to dt as well)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
1,6, -1,20, 2,0, -2,255,0, 4,255,255,255,62, ......
|
||||||
|
This means:
|
||||||
|
Press key1 at 6f
|
||||||
|
Release key1 at 26f (6+20)
|
||||||
|
Press key2 at the same time(26+0)
|
||||||
|
Release key 2 after 255+0 frame
|
||||||
|
Press key 4 after 255+255+255+62 frame
|
||||||
|
......
|
||||||
|
]]
|
||||||
function dumpRecording(list)
|
function dumpRecording(list)
|
||||||
local out=""
|
local out=""
|
||||||
local buffer=""
|
local buffer=""
|
||||||
|
|||||||
Reference in New Issue
Block a user