• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Go で書き直した Ikemen


Commit MetaInfo

Révisioncdaa551a8b80624009c382ab5c52ed9fde84cf1a (tree)
l'heure2019-11-05 21:19:43
Auteurneatunsou <sisiy4excite@gmai...>
Commiterneatunsou

Message de Log

Windblade氏の更新に対応

Change Summary

Modification

Binary files /dev/null and b/script/Icons/16x16.png differ
Binary files /dev/null and b/script/Icons/24x24.png differ
Binary files /dev/null and b/script/Icons/256x256.png differ
Binary files /dev/null and b/script/Icons/32x32.png differ
Binary files /dev/null and b/script/Icons/384x384.png differ
Binary files /dev/null and b/script/Icons/48x48.png differ
Binary files /dev/null and b/script/Icons/96x96.png differ
--- a/script/localcoord.lua
+++ /dev/null
@@ -1,8 +0,0 @@
1--- Screenpack Localcoord
2-main.SP_Localcoord[0] = 320
3-main.SP_Localcoord[1] = 240
4-main.SP_Center = 0
5-
6--- Lifebar Localcoord
7-main.LB_Localcoord[0] = 320
8-main.LB_Localcoord[1] = 240
\ No newline at end of file
--- a/script/main.lua
+++ b/script/main.lua
@@ -1,3 +1,4 @@
1+-------------------------------------------------------------
12 -- Disable GC during the initial load so it does not crash.
23 SetGCPercent(-1)
34 -------------------------------------------------------------
@@ -18,18 +19,11 @@ local file = io.open("save/config.json","r")
1819 config = json.decode(file:read("*all"))
1920 file:close()
2021
21--- Int localcoord
22-require "script/screenpack"
23-main.IntLocalcoordValues()
24-require "script/localcoord"
25-main.CalculateLocalcoordValues()
26-main.IntLifebarScale()
27-main.SetScaleValues()
28-
2922 main.p1In = 1
3023 main.p2In = 2
3124 --main.inputDialog = inputDialogNew()
3225
26+-------------------------------------------------------------
3327 function main.f_setCommand(c)
3428 commandAdd(c, 'u', '$U')
3529 commandAdd(c, 'd', '$D')
@@ -75,6 +69,96 @@ function main.f_btnPalNo(cmd)
7569 return 0
7670 end
7771
72+-- Check if files exists.
73+function main.file_exists(name)
74+ local f=io.open(name,"r")
75+ if f~=nil then io.close(f) return true else return false end
76+end
77+
78+--prints "t" table content into "toFile" file
79+function main.f_printTable(t, toFile)
80+ local toFile = toFile or 'debug/table_print.txt'
81+ local txt = ''
82+ local print_t_cache = {}
83+ local function sub_print_t(t, indent)
84+ if print_t_cache[tostring(t)] then
85+ txt = txt .. indent .. '*' .. tostring(t) .. '\n'
86+ else
87+ print_t_cache[tostring(t)] = true
88+ if type(t) == 'table' then
89+ for pos, val in pairs(t) do
90+ if type(val) == 'table' then
91+ txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(t) .. ' {' .. '\n'
92+ sub_print_t(val, indent .. string.rep(' ', string.len(tostring(pos)) + 8))
93+ txt = txt .. indent .. string.rep(' ', string.len(tostring(pos)) + 6) .. '}' .. '\n'
94+ elseif type(val) == 'string' then
95+ txt = txt .. indent .. '[' .. pos .. '] => "' .. val .. '"' .. '\n'
96+ else
97+ txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(val) ..'\n'
98+ end
99+ end
100+ else
101+ txt = txt .. indent .. tostring(t) .. '\n'
102+ end
103+ end
104+ end
105+ if type(t) == 'table' then
106+ txt = txt .. tostring(t) .. ' {' .. '\n'
107+ sub_print_t(t, ' ')
108+ txt = txt .. '}' .. '\n'
109+ else
110+ sub_print_t(t, ' ')
111+ end
112+ local file = io.open(toFile,"w+")
113+ if file == nil then return end
114+ file:write(txt)
115+ file:close()
116+end
117+
118+-- Prints "v" variable into "toFile" file
119+function main.f_printVar(v, toFile)
120+ local toFile = toFile or 'debug/var_print.txt'
121+ local file = io.open(toFile,"w+")
122+ file:write(v)
123+ file:close()
124+end
125+
126+-- Split strings.
127+function main.f_strsplit(delimiter, text)
128+ local list = {}
129+ local pos = 1
130+ if string.find('', delimiter, 1) then
131+ if string.len(text) == 0 then
132+ table.insert(list, text)
133+ else
134+ for i = 1, string.len(text) do
135+ table.insert(list, string.sub(text, i, i))
136+ end
137+ end
138+ else
139+ while true do
140+ local first, last = string.find(text, delimiter, pos)
141+ if first then
142+ table.insert(list, string.sub(text, pos, first - 1))
143+ pos = last + 1
144+ else
145+ table.insert(list, string.sub(text, pos))
146+ break
147+ end
148+ end
149+ end
150+ return list
151+end
152+
153+-------------------------------------------------------------
154+-- Int localcoord
155+require "script/screenpack"
156+main.IntLocalcoordValues()
157+main.CalculateLocalcoordValues()
158+main.IntLifebarScale()
159+main.SetScaleValues()
160+-------------------------------------------------------------
161+
78162 --animDraw at specified coordinates
79163 function main.f_animPosDraw(a, x, y)
80164 animSetPos(a, x, y)
@@ -82,12 +166,6 @@ function main.f_animPosDraw(a, x, y)
82166 animDraw(a)
83167 end
84168
85--- Check if files exists.
86-function main.file_exists(name)
87- local f=io.open(name,"r")
88- if f~=nil then io.close(f) return true else return false end
89-end
90-
91169 --textImgDraw at specified coordinates
92170 function main.f_textImgPosDraw(ti, x, y, align)
93171 align = align or 0
@@ -266,7 +344,7 @@ function main.f_getName(cell)
266344 tmp = tmp:gsub('^["%s]*(.-)["%s]*$', '%1') --needed for s-size ikemen
267345 if main.t_selChars[cell + 1].hidden == 3 then
268346 tmp = 'Random'
269- elseif main.t_selChars[cell + 1].hidden == 2 then
347+ elseif main.t_selChars[cell + 1].hidden == 2 or main.t_selChars[cell + 1].hidden == 1 then
270348 tmp = ''
271349 end
272350 return tmp
@@ -314,54 +392,6 @@ function main.f_sortKeys(t, order)
314392 end
315393 end
316394
317---prints "t" table content into "toFile" file
318-function main.f_printTable(t, toFile)
319- local toFile = toFile or 'debug/table_print.txt'
320- local txt = ''
321- local print_t_cache = {}
322- local function sub_print_t(t, indent)
323- if print_t_cache[tostring(t)] then
324- txt = txt .. indent .. '*' .. tostring(t) .. '\n'
325- else
326- print_t_cache[tostring(t)] = true
327- if type(t) == 'table' then
328- for pos, val in pairs(t) do
329- if type(val) == 'table' then
330- txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(t) .. ' {' .. '\n'
331- sub_print_t(val, indent .. string.rep(' ', string.len(tostring(pos)) + 8))
332- txt = txt .. indent .. string.rep(' ', string.len(tostring(pos)) + 6) .. '}' .. '\n'
333- elseif type(val) == 'string' then
334- txt = txt .. indent .. '[' .. pos .. '] => "' .. val .. '"' .. '\n'
335- else
336- txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(val) ..'\n'
337- end
338- end
339- else
340- txt = txt .. indent .. tostring(t) .. '\n'
341- end
342- end
343- end
344- if type(t) == 'table' then
345- txt = txt .. tostring(t) .. ' {' .. '\n'
346- sub_print_t(t, ' ')
347- txt = txt .. '}' .. '\n'
348- else
349- sub_print_t(t, ' ')
350- end
351- local file = io.open(toFile,"w+")
352- if file == nil then return end
353- file:write(txt)
354- file:close()
355-end
356-
357---prints "v" variable into "toFile" file
358-function main.f_printVar(v, toFile)
359- local toFile = toFile or 'debug/var_print.txt'
360- local file = io.open(toFile,"w+")
361- file:write(v)
362- file:close()
363-end
364-
365395 --remove duplicated string pattern
366396 function main.f_uniq(str, pattern, subpattern)
367397 local out = {}
@@ -1087,9 +1117,12 @@ function main.f_addChar(line, row)
10871117 end
10881118 end
10891119 end
1090- if main.t_selChars[row].exclude == nil then
1120+ if main.t_selChars[row].hidden == nil then
10911121 main.t_selChars[row].hidden = hidden
10921122 end
1123+ if main.t_selChars[row].exclude == nil then
1124+ main.t_selChars[row].exclude = 0
1125+ end
10931126 if order then
10941127 if main.t_orderChars[main.t_selChars[row].order] == nil then
10951128 main.t_orderChars[main.t_selChars[row].order] = {}
@@ -1222,7 +1255,7 @@ end
12221255 --add Training by stupa if not included in select.def
12231256 if main.t_charDef.training == nil and main.f_fileExists('chars/training/training.def') then
12241257 chars = chars + 1
1225- main.f_addChar('training, exclude = 1', chars)
1258+ main.f_addChar('training, exclude = 1, order = 0', chars)
12261259 end
12271260
12281261 --add remaining character parameters
--- a/script/screenpack.lua
+++ b/script/screenpack.lua
@@ -1,65 +1,104 @@
11 -- Screenpack config file
22
33 function main.IntLocalcoordValues()
4+ main.SP_Localcoord = {}
5+ main.LB_Localcoord = {}
6+ main.SP_Localcoord43 = {}
7+ main.LB_Localcoord43 = {}
48
5-main.SP_Localcoord = {}
6-main.LB_Localcoord = {}
7-main.SP_Localcoord43 = {}
8-main.LB_Localcoord43 = {}
9+ main.SP_Localcoord[1] = 320
10+ main.SP_Localcoord[2] = 240
11+ main.LB_Localcoord[1] = 320
12+ main.LB_Localcoord[2] = 240
913
10-main.SP_Localcoord[0] = 320
11-main.SP_Localcoord[1] = 240
12-main.LB_Localcoord[0] = 320
13-main.LB_Localcoord[1] = 240
14+ main.LB_ScreenWidth = 320
15+ main.LB_ScreenDiference = 0
1416
15-main.LB_ScreenWidth = 320
16-main.LB_ScreenDiference = 0
17-
18-main.screenOverscan = 0
19-main.normalSpriteCenter = 0
20-
21-main.SP_Localcoord43[0] = 320
22-main.LB_Localcoord43[0] = 240
17+ main.screenOverscan = 0
18+ main.normalSpriteCenter = 0
2319
24-main.SP_Center = 0
20+ main.SP_Localcoord43[1] = 320
21+ main.LB_Localcoord43[1] = 240
2522
23+ main.SP_Center = 0
2624 end
2725
2826 function main.CalculateLocalcoordValues()
29- if main.SP_Localcoord[0] >= main.SP_Localcoord[1] then
30- main.SP_Localcoord43[0] = (main.SP_Localcoord[1] / 3) * 4
27+ -- We load the libar localcoord from the motif file
28+ main.SP_Localcoord = main.ParseDefFileValue(config.Motif, "info", "localcoord", true)
29+
30+ -- We check if what we got is valid
31+ if main.SP_Localcoord == nil then
32+ main.SP_Localcoord = {320, 240}
33+ end
34+
35+ -- We now have to search for the config file.
36+ local motifFileFolder = ""
37+ local lbFileName = main.ParseDefFileValue(config.Motif, "files", "fight", false)
38+ -- Get the morif file folder.
39+ local tempMFF = main.f_strsplit("/",config.Motif)
40+ local i = 1
41+ -- We skip the last object on the table (The file iteself) to get only the directory.
42+ while i < table.getn(tempMFF) do
43+ motifFileFolder = motifFileFolder .. tempMFF[i] .. "/"
44+ i = i + 1
45+ end
46+ tempMFF = nil
47+
48+ -- We seach for the file
49+ if main.file_exists(motifFileFolder .. lbFileName) then
50+ main.LB_Localcoord = main.ParseDefFileValue(motifFileFolder .. lbFileName, "info", "localcoord", true)
51+ elseif main.file_exists("data/" .. lbFileName) then
52+ main.LB_Localcoord = main.ParseDefFileValue("data/" .. lbFileName, "info", "localcoord", true)
53+ elseif main.file_exists(lbFileName) then
54+ main.LB_Localcoord = main.ParseDefFileValue(lbFileName, "info", "localcoord", true)
55+ else
56+ main.LB_Localcoord = main.SP_Localcoord
57+ end
58+
59+ -- We check if what we got is valid
60+ if main.LB_Localcoord == nil then
61+ main.LB_Localcoord = main.SP_Localcoord
62+ end
63+
64+ -- And we calculate some extra stuff.
65+ if main.SP_Localcoord[1] >= main.SP_Localcoord[2] then
66+ main.SP_Localcoord43[1] = (main.SP_Localcoord[2] / 3) * 4
3167 else
32- main.SP_Localcoord43[0] = (main.SP_Localcoord[0] / 4) * 3
68+ main.SP_Localcoord43[1] = (main.SP_Localcoord[1] / 4) * 3
3369 end
3470
35- if main.LB_Localcoord[0] >= main.LB_Localcoord[1] then
36- main.LB_Localcoord43[0] = (main.LB_Localcoord[1] / 3) * 4
71+ if main.LB_Localcoord[1] >= main.LB_Localcoord[2] then
72+ main.LB_Localcoord43[1] = (main.LB_Localcoord[2] / 3) * 4
3773 else
38- main.LB_Localcoord43[0] = (main.LB_Localcoord[0] / 4) * 3
74+ main.LB_Localcoord43[1] = (main.LB_Localcoord[1] / 4) * 3
3975 end
4076
41- main.SP_Localcoord_X_Dif = -math.floor( (( main.SP_Localcoord[0] / (main.SP_Localcoord43[0] / 320) ) - 320) / 2 )
77+ main.SP_Localcoord_X_Dif = -math.floor( (( main.SP_Localcoord[1] / (main.SP_Localcoord43[1] / 320) ) - 320) / 2 )
4278
4379 main.LB_ScreenWidth = config.Width / (config.Height / 240)
4480 main.LB_ScreenDiference = (main.LB_ScreenWidth - 320) / (main.LB_ScreenWidth / 320)
81+ --setLifebarPortaitScale(main.SP_Localcoord[1] / main.SP_Localcoord43[1])
4582
83+ -- TODO: Check if this calculation of 'main.SP_Center' is rigth.
84+ main.SP_Center = main.SP_Localcoord[1] - main.SP_Localcoord43[1]
4685 end
4786
4887 function main.IntLifebarScale()
4988 if config.LocalcoordScalingType == 0 then
5089 setLifebarOffsetX( - main.LB_ScreenDiference / 2)
51- setLuaLifebarScale(main.LB_ScreenWidth / main.LB_Localcoord43[0])
90+ setLuaLifebarScale(main.LB_ScreenWidth / main.LB_Localcoord43[1])
5291 else
53- setLifebarOffsetX((main.LB_Localcoord43[0] - main.LB_Localcoord[0]) / 2)
54- setLuaLifebarScale(320 / main.LB_Localcoord43[0])
92+ setLifebarOffsetX((main.LB_Localcoord43[1] - main.LB_Localcoord[1]) / 2)
93+ setLuaLifebarScale(320 / main.LB_Localcoord43[1])
5594 end
5695 end
5796
5897 function main.SetScaleValues()
59- setLuaSpriteScale(main.SP_Localcoord43[0] / 320)
98+ setLuaSpriteScale(main.SP_Localcoord43[1] / 320)
6099 setLuaSpriteOffsetX(main.SP_Localcoord_X_Dif)
61- setLuaSmallPortraitScale(main.SP_Localcoord43[0] / main.SP_Localcoord[0])
62- setLuaBigPortraitScale(main.SP_Localcoord43[0] / main.SP_Localcoord[0])
100+ setLuaSmallPortraitScale(main.SP_Localcoord43[1] / main.SP_Localcoord[1])
101+ setLuaBigPortraitScale(main.SP_Localcoord43[1] / main.SP_Localcoord[1])
63102 main.normalSpriteCenter = main.SP_Center
64103 main.screenOverscan = 0
65104 end
@@ -72,4 +111,70 @@ function main.SetDefaultScale()
72111 setLuaBigPortraitScale(1)
73112 main.normalSpriteCenter = 0
74113 main.screenOverscan = 0
114+end
115+
116+-- Edited version of the parser in motif.lua, made to parse only a single value and end once it steps outside [searchBlock]
117+function main.ParseDefFileValue(argFile, searchBlock, searchParam, isNumber)
118+ -- We use 'arg' inestead of 'config.Motif' because we also want the option to parse the lifebar
119+ local file = io.open(argFile)
120+ local weAreInInfo = 0
121+ local ret = {}
122+ local ipos = 0
123+
124+ for line in file:lines() do
125+ ipos = ipos +1
126+ if weAreInInfo ~= 2 then
127+ local line = line:gsub('%s*;.*$', '')
128+ if line:match('^%s*%[.-%s*%]%s*$') then -- matched [] group
129+ line = line:match('^%s*%[(.-)%s*%]%s*$') -- match text between []
130+ line = line:gsub('[%. ]', '_') -- change . and space to _
131+ line = line:lower() -- lowercase line
132+ local row = tostring(line:lower()) -- just in case it's a number (not really needed)
133+
134+ if row == searchBlock then -- matched info
135+ weAreInInfo = 1
136+ else
137+ if weAreInInfo == 1 then weAreInInfo = 2 end
138+ end
139+ elseif weAreInInfo == 1 then -- matched non [] line inside [Info]
140+ local param, value = line:match('^%s*([^=]-)%s*=%s*(.-)%s*$')
141+ if param ~= nil then
142+ param = param:gsub('[%. ]', '_') -- change param . and space to _
143+ param = param:lower() -- lowercase param
144+ end
145+ if param ~= nil and value ~= nil and param:match(searchParam) then -- param = value pattern matched
146+ value = value:gsub('"', '') -- remove brackets from value
147+ if value:match('.+,.+') then -- multiple values
148+ for i, c in ipairs(main.f_strsplit(',', value)) do -- split value using "," delimiter
149+ if c == nil or c == '' then
150+ ret[i] = nil
151+ else
152+ if isNumber == true then
153+ ret[i] = tonumber(c)
154+ else
155+ ret[i] = c
156+ end
157+ end
158+ end
159+ else --single value
160+ if isNumber == true then
161+ ret = tonumber(value)
162+ else
163+ ret = value
164+ end
165+ end
166+ end
167+ end
168+ end
169+ end
170+ file:close()
171+
172+ -- Let's check if the table values are valid
173+ if type(ret) == "table" and (ret[1] == nil or ret[2] == nil) then
174+ -- If not we return nil
175+ ret = nil
176+ end
177+
178+ -- Return what we parsed
179+ return ret
75180 end
\ No newline at end of file
--- a/script/select.lua
+++ b/script/select.lua
@@ -2542,12 +2542,9 @@ local txt_credits = main.f_createTextImg(
25422542 )
25432543
25442544 function select.f_continue()
2545- main.f_resetBG(motif.continue_screen, motif.continuebgdef, motif.music.continue_bgm, motif.music.continue_bgm_loop, motif.music.continue_bgm_volume, motif.music.continue_bgm_loopstart, motif.music.continue_bgm_loopend)
2546- animReset(motif.continue_screen.continue_anim_data)
2547- animUpdate(motif.continue_screen.continue_anim_data)
25482545 continue = false
2549- local text = main.f_extractText(motif.continue_screen.credits_text, main.credits)
2550- textImgSetText(txt_credits, text[1])
2546+ playBGM(motif.music.continue_bgm, true, motif.music.continue_bgm_loop, motif.music.continue_bgm_volume, motif.music.continue_bgm_loopstart or "0", motif.music.continue_bgm_loopend or "0")
2547+ --textImgSetText(txt_credits, text[1])
25512548 main.f_cmdInput()
25522549 while true do
25532550 --draw clearcolor (disabled to not cover area)
--- a/src/input.go
+++ b/src/input.go
@@ -626,7 +626,7 @@ func JoystickState(joy, button int) bool {
626626 return false
627627 }
628628 if (button == 8 || button == 10) && glfw.GetJoystickName(joystick[joy]) == "Xbox 360 Controller" { //Xbox360コントローラーのLRトリガー判定
629- return axes[button/2] > 0
629+ return axes[button/2] > sys.xinputTriggerSensitivity
630630 }
631631
632632 // Ignore trigger axis on PS4 (We already have buttons)
@@ -636,9 +636,9 @@ func JoystickState(joy, button int) bool {
636636
637637 switch button & 1 {
638638 case 0:
639- return axes[button/2] < -0.2
639+ return axes[button/2] < -sys.controllerStickSensitivity
640640 case 1:
641- return axes[button/2] > 0.2
641+ return axes[button/2] > sys.controllerStickSensitivity
642642 }
643643 }
644644 if len(btns) <= button {
--- a/src/main.go
+++ b/src/main.go
@@ -76,70 +76,84 @@ func main() {
7676 }
7777 chk(glfw.Init())
7878 defer glfw.Terminate()
79- defcfg := []byte(strings.Join(strings.Split(`{
80- "HelperMax":56,
81- "PlayerProjectileMax":256,
82- "ExplodMax":512,
83- "AfterImageMax":128,
84- "MasterVolume":80,
85- "WavVolume":80,
86- "BgmVolume":80,
87- "Attack.LifeToPowerMul":0.7,
88- "GetHit.LifeToPowerMul":0.6,
89- "Width":640,
90- "Height":480,
91- "Super.TargetDefenceMul":1.5,
92- "LifebarFontScale":1,
93- "System":"script/main.lua",
94- "KeyConfig":[{
95- "Joystick":-1,
96- "Buttons":["UP","DOWN","LEFT","RIGHT","z","x","c","a","s","d","RETURN","q","w"]
97- },{
98- "Joystick":-1,
99- "Buttons":["t","g","f","h","j","k","l","u","i","o","RSHIFT","LEFTBRACKET","RIGHTBRACKET"]
100- }],
101- "JoystickConfig":[{
102- "Joystick":0,
103- "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
104- },{
105- "Joystick":1,
106- "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
107- }],
108- "Motif":"data/system.def",
109- "CommonAir":"data/common.air",
110- "CommonCmd":"data/common.cmd",
111- "SimulMode":true,
112- "LifeMul":100,
113- "Team1VS2Life":120,
114- "TurnsRecoveryRate":300,
115- "ZoomActive":false,
116- "ZoomMin":0.75,
117- "ZoomMax":1.1,
118- "ZoomSpeed":1,
119- "RoundTime":99,
120- "SingleTeamMode":true,
121- "NumTurns":4,
122- "NumSimul":4,
123- "NumTag":4,
124- "Difficulty":8,
125- "Credits":10,
126- "ListenPort":7500,
127- "ContSelection":true,
128- "AIRandomColor":true,
129- "AIRamping":true,
130- "AutoGuard":false,
131- "TeamPowerShare":false,
132- "TeamLifeShare":false,
133- "Fullscreen":false,
134- "AudioDucking":false,
135- "QuickLaunch":0,
136- "AllowDebugKeys":true,
137- "ComboExtraFrameWindow": 1,
138- "PostProcessingShader": 0,
139- "LocalcoordScalingType": 1,
140- "MSAA": false,
141- "IP":{
142- }
79+ defcfg := []byte(strings.Join(strings.Split(
80+`{
81+ "HelperMax": 56,
82+ "PlayerProjectileMax": 256,
83+ "ExplodMax": 512,
84+ "AfterImageMax": 128,
85+ "MasterVolume": 80,
86+ "WavVolume": 80,
87+ "BgmVolume": 80,
88+ "Attack.LifeToPowerMul": 0.7,
89+ "GetHit.LifeToPowerMul": 0.6,
90+ "Width": 640,
91+ "Height": 480,
92+ "Super.TargetDefenceMul": 1.5,
93+ "LifebarFontScale": 1,
94+ "System": "script/main.lua",
95+ "KeyConfig": [
96+ {
97+ "Joystick": -1,
98+ "Buttons": ["UP", "DOWN", "LEFT", "RIGHT", "z", "x", "c", "a", "s", "d", "RETURN", "q", "w"]
99+ },
100+ {
101+ "Joystick": -1,
102+ "Buttons": ["t", "g", "f", "h", "j", "k", "l", "u", "i", "o", "RSHIFT", "LEFTBRACKET", "RIGHTBRACKET"]
103+ }
104+ ],
105+ "JoystickConfig": [
106+ {
107+ "Joystick": 1,
108+ "Buttons": ["-7", "-8", "-5", "-6", "0", "1", "4", "2", "3", "5", "7", "6", "8"]
109+ },
110+ {
111+ "Joystick": 1,
112+ "Buttons": ["-7", "-8", "-5", "-6", "0", "1", "4", "2", "3", "5", "7", "6", "8"]
113+ }
114+ ],
115+ "ControllerStickSensitivity": 0.4,
116+ "XinputTriggerSensitivity": 0,
117+ "Motif": "data/system.def",
118+ "CommonAir": "data/common.air",
119+ "CommonCmd": "data/common.cmd",
120+ "SimulMode": true,
121+ "LifeMul": 100,
122+ "Team1VS2Life": 120,
123+ "TurnsRecoveryRate": 300,
124+ "ZoomActive": false,
125+ "ZoomMin": 0.75,
126+ "ZoomMax": 1.1,
127+ "ZoomSpeed": 1,
128+ "RoundTime": 99,
129+ "SingleTeamMode": true,
130+ "NumTurns": 4,
131+ "NumSimul": 4,
132+ "NumTag": 4,
133+ "Difficulty": 8,
134+ "Credits": 10,
135+ "ListenPort": 7500,
136+ "IP": {
137+
138+ },
139+ "ContSelection": true,
140+ "AIRandomColor": true,
141+ "AIRamping": true,
142+ "AutoGuard": false,
143+ "TeamPowerShare": false,
144+ "TeamLifeShare": false,
145+ "Fullscreen": false,
146+ "AudioDucking": false,
147+ "QuickLaunch": 0,
148+ "AllowDebugKeys": true,
149+ "ComboExtraFrameWindow": 1,
150+ "PostProcessingShader": 0,
151+ "LocalcoordScalingType": 1,
152+ "MSAA": false,
153+ "WindowMainIconLocation": [
154+ "script/Icons/16x16.png",
155+ "script/Icons/24x24.png"
156+ ]
143157 }
144158 `, "\n"), "\r\n"))
145159 tmp := struct {
@@ -165,19 +179,22 @@ func main() {
165179 Joystick int
166180 Buttons []interface{}
167181 }
168- NumTag int
169- TeamLifeShare bool
170- AIRandomColor bool
171- ComboExtraFrameWindow int32
172- Fullscreen bool
173- AudioDucking bool
174- AllowDebugKeys bool
175- MSAA bool
176- PostProcessingShader int32
177- LocalcoordScalingType int32
178- CommonAir string
179- CommonCmd string
180- QuickLaunch int
182+ NumTag int
183+ TeamLifeShare bool
184+ AIRandomColor bool
185+ ComboExtraFrameWindow int32
186+ Fullscreen bool
187+ AudioDucking bool
188+ AllowDebugKeys bool
189+ MSAA bool
190+ PostProcessingShader int32
191+ LocalcoordScalingType int32
192+ CommonAir string
193+ CommonCmd string
194+ QuickLaunch int
195+ ControllerStickSensitivity float32
196+ XinputTriggerSensitivity float32
197+ WindowMainIconLocation []string
181198 }{}
182199 chk(json.Unmarshal(defcfg, &tmp))
183200 const configFile = "save/config.json"
@@ -193,6 +210,8 @@ func main() {
193210 }
194211 chk(json.Unmarshal(bytes, &tmp))
195212 }
213+ sys.controllerStickSensitivity = tmp.ControllerStickSensitivity
214+ sys.xinputTriggerSensitivity = tmp.XinputTriggerSensitivity
196215 sys.helperMax = tmp.HelperMax
197216 sys.playerProjectileMax = tmp.PlayerProjectileMax
198217 sys.explodMax = tmp.ExplodMax
@@ -203,6 +222,9 @@ func main() {
203222 sys.comboExtraFrameWindow = tmp.ComboExtraFrameWindow
204223 sys.lifebarFontScale = tmp.LifebarFontScale
205224 sys.quickLaunch = tmp.QuickLaunch
225+ sys.windowMainIconLocation = tmp.WindowMainIconLocation
226+ // For debug testing letting this here comented because it could be usefull in the future.
227+ // log.Printf("Unmarshaled: %v", tmp.WindowMainIconLocation)
206228 sys.masterVolume = tmp.MasterVolume
207229 sys.wavVolume = tmp.WavVolume
208230 sys.bgmVolume = tmp.BgmVolume
@@ -239,6 +261,7 @@ func main() {
239261 }
240262 }
241263 }
264+
242265 sys.teamLifeShare = tmp.TeamLifeShare
243266 sys.fullscreen = tmp.Fullscreen
244267 sys.PostProcessingShader = tmp.PostProcessingShader
--- a/src/system.go
+++ b/src/system.go
@@ -1,6 +1,8 @@
11 package main
22
33 import (
4+ "io"
5+ "image"
46 "bufio"
57 "fmt"
68 "io/ioutil"
@@ -29,7 +31,7 @@ const (
2931 )
3032
3133 // System vars are accessed globally through the program
32-var sys = System{
34+var sys = System {
3335 randseed: int32(time.Now().UnixNano()),
3436 scrrect: [...]int32{0, 0, 320, 240},
3537 gameWidth: 320, gameHeight: 240,
@@ -250,6 +252,10 @@ type System struct {
250252 bgmVolume int
251253 AudioDucking bool
252254 FLAC_FrameWait int
255+
256+ controllerStickSensitivity float32
257+ xinputTriggerSensitivity float32
258+
253259 // Localcoord sceenpack
254260 luaSpriteScale float64
255261 luaSmallPortraitScale float32
@@ -262,9 +268,15 @@ type System struct {
262268
263269 PostProcessingShader int32
264270 MultisampleAntialiasing bool
271+
272+ // Icon :D
273+ windowMainIcon []image.Image
274+ windowMainIconLocation []string
265275 }
266276
277+// Initialize stuff, this is called after the config int at main.go
267278 func (s *System) init(w, h int32) *lua.LState {
279+ // Create a GLWF window.
268280 glfw.WindowHint(glfw.Resizable, glfw.False)
269281 glfw.WindowHint(glfw.ContextVersionMajor, 2)
270282 glfw.WindowHint(glfw.ContextVersionMinor, 1)
@@ -300,6 +312,20 @@ func (s *System) init(w, h int32) *lua.LState {
300312 s.clsnSpr.Size, s.clsnSpr.Pal = [...]uint16{1, 1}, make([]uint32, 256)
301313 s.clsnSpr.SetPxl([]byte{0})
302314 systemScriptInit(l)
315+ // So now that we have a windo we add a icon.
316+ if len(s.windowMainIconLocation) > 0 {
317+ // First we initialize arrays.
318+ f := make([]io.ReadCloser, len(s.windowMainIconLocation) )
319+ s.windowMainIcon = make([]image.Image, len(s.windowMainIconLocation))
320+ // And then we load them.
321+ for i, iconLocation := range s.windowMainIconLocation {
322+ f[i], _ = os.Open(iconLocation)
323+ s.windowMainIcon[i], _, err = image.Decode(f[i])
324+ }
325+ s.window.SetIcon(s.windowMainIcon)
326+ chk(err)
327+ }
328+ // [Icon add end]
303329 go func() {
304330 stdin := bufio.NewScanner(os.Stdin)
305331 for stdin.Scan() {