Skip to content

Commit

Permalink
调整注释 框架跟进
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Sep 22, 2023
1 parent 6515d65 commit c1e4690
Show file tree
Hide file tree
Showing 72 changed files with 204 additions and 129 deletions.
2 changes: 1 addition & 1 deletion Zenitha
Submodule Zenitha updated 1 files
+7 −7 gcExtend.lua
44 changes: 0 additions & 44 deletions assets/game/basePlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,7 @@ local ins,rem=table.insert,table.remove

local sign,expApproach=MATH.sign,MATH.expApproach

--- @alias Techmino.EndReason
---| 'AC' Win
---| 'WA' Block out
---| 'CE' Lock out
---| 'MLE' Top out
---| 'TLE' Time out
---| 'OLE' Finesse fault
---| 'ILE' Ran out pieces
---| 'PE' Mission failed
---| 'UKE' Other reason

--- @class Techmino.Player
--- @field gameMode Techmino.mode.playerType
--- @field id number limited to 1~1000
--- @field group number
--- @field isMain boolean
--- @field sound boolean
--- @field settings table
--- @field buffedKey table
--- @field modeData table
--- @field soundTimeHistory table
--- @field RND love.RandomGenerator
--- @field pos {x:number, y:number, k:number, a:number, dx:number, dy:number, dk:number, da:number, vx:number, vy:number, vk:number, va:number}
--- @field finished Techmino.EndReason|boolean
--- @field realTime number
--- @field time number
--- @field gameTime number
--- @field timing boolean
--- @field texts Zenitha.Text
--- @field particles Techmino.particleSystems
---
--- @field updateFrame function
--- @field scriptCmd function
--- @field decodeScript function
--- @field checkScriptSyntax function
---
--- @field hand table|false @Piece object
--- @field handX number
--- @field handY number
--- @field event table
--- @field soundEvent table
--- @field _actions table<string, {press:fun(P:Techmino.Player), release:fun(P:Techmino.Player)}>
---
--- @field receive function
--- @field render function
local P={}

--------------------------------------------------------------
Expand Down
134 changes: 134 additions & 0 deletions assets/game/classes.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
--- @alias Techmino.Player.Type 'mino'|'puyo'|'gem'
--- @alias Techmino.Mode.Setting Techmino.Mode.Setting.Mino|Techmino.Mode.Setting.Puyo|Techmino.Mode.Setting.Gem
--- @alias Techmino.EndReason
--- | 'AC' Win
--- | 'WA' Block out
--- | 'CE' Lock out
--- | 'MLE' Top out
--- | 'TLE' Time out
--- | 'OLE' Finesse fault
--- | 'ILE' Ran out pieces
--- | 'PE' Mission failed
--- | 'UKE' Other reason

--- @class Techmino.ParticleSystems
--- @field rectShade love.ParticleSystem
--- @field spinArrow table
--- @field star love.ParticleSystem
--- @field line love.ParticleSystem
--- @field hitSparkle love.ParticleSystem
--- @field cornerCheck love.ParticleSystem
--- @field tiltRect love.ParticleSystem
--- @field trail love.ParticleSystem
--- @field minoMapBack love.ParticleSystem

--- @class Techmino.Mino
--- @field name string
--- @field id number
--- @field shape boolean[][]

--- @class Techmino.Minos
--- @field Z Techmino.Mino
--- @field S Techmino.Mino
--- @field J Techmino.Mino
--- @field L Techmino.Mino
--- @field T Techmino.Mino
--- @field O Techmino.Mino
--- @field I Techmino.Mino
--- @field Z5 Techmino.Mino
--- @field S5 Techmino.Mino
--- @field P Techmino.Mino
--- @field Q Techmino.Mino
--- @field F Techmino.Mino
--- @field E Techmino.Mino
--- @field T5 Techmino.Mino
--- @field U Techmino.Mino
--- @field V Techmino.Mino
--- @field W Techmino.Mino
--- @field X Techmino.Mino
--- @field J5 Techmino.Mino
--- @field L5 Techmino.Mino
--- @field R Techmino.Mino
--- @field Y Techmino.Mino
--- @field N Techmino.Mino
--- @field H Techmino.Mino
--- @field I5 Techmino.Mino
--- @field I3 Techmino.Mino
--- @field C Techmino.Mino
--- @field I2 Techmino.Mino
--- @field O1 Techmino.Mino

--- @class Techmino.Cell
--- @field id number ascending piece number
--- @field color number 0~63
--- @field conn table<Techmino.Cell,true>
--- @field bias {expBack:number?, lineBack:number?, teleBack:number?, x:number, y:number}

--- @class Techmino.RectField
--- @field _width number
--- @field _matrix (Techmino.Cell|false|any)[][]

--- @class Techmino.Mode
--- @field initialize function Called when initializing the mode
--- @field settings table<Techmino.Player.Type, Techmino.Mode.Setting>
--- @field layout 'default' Layout mode
--- @field checkFinish function Return if the game should end when a player finishes
--- @field result function Called when the game ends
--- @field resultPage fun(time:number) Drawing the result page
--- @field name string Mode name, for debug use

--- @class Techmino.Mode.Setting.Mino
--- @class Techmino.Mode.Setting.Puyo
--- @class Techmino.Mode.Setting.Gem

--- @class Techmino.mino.clearRule
--- @field getDelay fun(P:Techmino.Player.mino, lines:number[]): number?
--- @field isFill fun(P:Techmino.Player.mino, y:number): boolean
--- @field getFill fun(P:Techmino.Player.mino): number[]?
--- @field clear fun(P:Techmino.Player.mino, lines:number[])

--- @class Techmino.Game
--- @field playing boolean
--- @field playerList table<number, Techmino.Player>|false
--- @field playerMap table<number, Techmino.Player>|false
--- @field camera Zenitha.Camera
--- @field hitWaves table
--- @field seed number|false
--- @field mode Techmino.Mode|false
--- @field mainID number|false
--- @field mainPlayer Techmino.Player|false

--- @class Techmino.Player
--- @field gameMode Techmino.Player.Type
--- @field id number limited to 1~1000
--- @field group number
--- @field isMain boolean
--- @field sound boolean
--- @field settings table
--- @field buffedKey table
--- @field modeData table
--- @field soundTimeHistory table
--- @field RND love.RandomGenerator
--- @field pos {x:number, y:number, k:number, a:number, dx:number, dy:number, dk:number, da:number, vx:number, vy:number, vk:number, va:number}
--- @field finished Techmino.EndReason|boolean
--- @field realTime number
--- @field time number
--- @field gameTime number
--- @field timing boolean
--- @field texts Zenitha.Text
--- @field particles Techmino.ParticleSystems
---
--- @field updateFrame function
--- @field scriptCmd function
--- @field decodeScript function
--- @field checkScriptSyntax function
---
--- @field hand table|false @Piece object
--- @field handX number
--- @field handY number
--- @field event table
--- @field soundEvent table
--- @field _actions table<string, {press:fun(P:Techmino.Player), release:fun(P:Techmino.Player)}>
---
--- @field receive function
--- @field render function
1 change: 1 addition & 0 deletions assets/game/gemPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ function GP:checkScriptSyntax(cmd,arg,errMsg)
end
--------------------------------------------------------------
-- Builder
--- @class Techmino.Mode.Setting.Gem
local baseEnv={
-- Size
fieldSize=8,
Expand Down
23 changes: 2 additions & 21 deletions assets/game/init.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
--- @alias Techmino.mode.playerType 'mino'|'puyo'|'gem'

--- @class Techmino.mode
--- @field initialize function Called when initializing the mode
--- @field settings table<Techmino.mode.playerType, table>
--- @field layout 'default' Layout mode
--- @field checkFinish function Return if the game should end when a player finishes
--- @field result function Called when the game ends
--- @field resultPage fun(time:number) Drawing the result page
--- @field name string Mode name, for debug use

local floor=math.floor

Minoes=require'assets.game.minoes'
Expand Down Expand Up @@ -160,16 +149,7 @@ local function task_switchToResult()
end
end

--- @class Techmino.game
--- @field playing boolean
--- @field playerList table<number, Techmino.Player>|false
--- @field playerMap table<number, Techmino.Player>|false
--- @field camera Zenitha.Camera
--- @field hitWaves table
--- @field seed number|false
--- @field mode Techmino.mode|false
--- @field mainID number|false
--- @field mainPlayer Techmino.Player|false
--- @class Techmino.Game
local GAME={
playing=false,

Expand All @@ -188,6 +168,7 @@ local GAME={

GAME.camera.moveSpeed=12

--- @return Techmino.Mode
function GAME.getMode(name)
if modeLib[name] and not love.keyboard.isDown('f5') then
return modeLib[name]
Expand Down
8 changes: 1 addition & 7 deletions assets/game/mechanicLib/mino/clearRule.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
--- @class Techmino.mino.clearRule
--- @field getDelay fun(P:Techmino.Player.mino, lines:number[]): number?
--- @field isFill fun(P:Techmino.Player.mino, y:number): boolean
--- @field getFill fun(P:Techmino.Player.mino): number[]?
--- @field clear fun(P:Techmino.Player.mino, lines:number[])

local ins,rem=table.insert,table.remove

--- @type Techmino.mino.clearRule[]
--- @type table<string,Techmino.mino.clearRule>
local clearRule={}

local function setBias(P,x,y,dx,dy,moveType,clearDelay)
Expand Down
1 change: 1 addition & 0 deletions assets/game/minoPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,7 @@ function MP:checkScriptSyntax(cmd,arg,errMsg)
end
--------------------------------------------------------------
-- Builder
--- @class Techmino.Mode.Setting.Mino
local baseEnv={
-- Size
fieldW=10,-- [WARNING] This is not the real field width, just for generate field object. Change real field size with 'self:changeFieldWidth'
Expand Down
38 changes: 1 addition & 37 deletions assets/game/minoes.lua
Original file line number Diff line number Diff line change
@@ -1,42 +1,6 @@
--- @class Techmino.mino
--- @field name string
--- @field id number
--- @field shape boolean[][]

--- @class Techmino.minos
--- @field Z Techmino.mino
--- @field S Techmino.mino
--- @field J Techmino.mino
--- @field L Techmino.mino
--- @field T Techmino.mino
--- @field O Techmino.mino
--- @field I Techmino.mino
--- @field Z5 Techmino.mino
--- @field S5 Techmino.mino
--- @field P Techmino.mino
--- @field Q Techmino.mino
--- @field F Techmino.mino
--- @field E Techmino.mino
--- @field T5 Techmino.mino
--- @field U Techmino.mino
--- @field V Techmino.mino
--- @field W Techmino.mino
--- @field X Techmino.mino
--- @field J5 Techmino.mino
--- @field L5 Techmino.mino
--- @field R Techmino.mino
--- @field Y Techmino.mino
--- @field N Techmino.mino
--- @field H Techmino.mino
--- @field I5 Techmino.mino
--- @field I3 Techmino.mino
--- @field C Techmino.mino
--- @field I2 Techmino.mino
--- @field O1 Techmino.mino

local O,_=true,false

--- @type Techmino.minos
--- @type Techmino.Minos
local minoes={
-- Tetromino
{name='Z', id=01,shape={{_,O,O},{O,O,_}}},
Expand Down
2 changes: 1 addition & 1 deletion assets/game/minomap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ local modes={
}
-- Initialize modes' graphic values
for _,m in next,modes do
m.enable=false
m.enable=1
m.state=-1
m.active=0
m.x=30*(m.pos[1]-m.pos[2])*(3^.5/2)
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/backfire_100.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/backfire_amplify_100.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/backfire_cheese_100.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/combo_practice.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/dig_100.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/dig_40.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/dig_400.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/dig_checker.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/dig_practice.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/dig_shale.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/dig_volcanics.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/hypersonic_hd.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/hypersonic_hi.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/hypersonic_lo.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/hypersonic_ti.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/marathon.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
1 change: 1 addition & 0 deletions assets/game/mode/mino/exterior/sprint_10.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'mino')
Expand Down
Loading

0 comments on commit c1e4690

Please sign in to comment.