Pull request: shinlucho / ikemen_go @ addalpha-dest to supersuehiro / ikemen_go @ master

This pull request cannot be merged due to branch status being changed after the request was sent.

--- a/LICENSE.txt
+++ /dev/null
@@ -1,41 +0,0 @@
1-MIT License
2-
3-Original work Copyright (c) 2016 Suehiro
4-Modified work Copyright (c) 2018 K4thos
5-
6-Permission is hereby granted, free of charge, to any person obtaining a copy
7-of this software and associated documentation files (the "Software"), to deal
8-in the Software without restriction, including without limitation the rights
9-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-copies of the Software, and to permit persons to whom the Software is
11-furnished to do so, subject to the following conditions:
12-
13-The above copyright notice and this permission notice shall be included in all
14-copies or substantial portions of the Software.
15-
16-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-SOFTWARE.
23-
24-
25-以下に定める条件に従い、本ソフトウェアおよび関連文書のファイル(以下「ソフトウェア」)
26-の複製を取得するすべての人に対し、ソフトウェアを無制限に扱うことを無償で許可します。
27-これには、ソフトウェアの複製を使用、複写、変更、結合、掲載、頒布、サブライセンス、および
28-または販売する権利、およびソフトウェアを提供する相手に同じことを許可する権利も無制限に含まれます。
29-
30-上記の著作権表示および本許諾表示を、ソフトウェアのすべての複製または重要な部分に記載するものとします。
31-
32-ソフトウェアは「現状のまま」で、明示であるか暗黙であるかを問わず、何らの保証もなく提供されます。
33-ここでいう保証とは、商品性、特定の目的への適合性、および権利非侵害についての保証も含みますが、
34-それに限定されるものではありません。 作者または著作権者は、契約行為、不法行為、またはそれ以外であろうと、
35-ソフトウェアに起因または関連し、あるいはソフトウェアの使用またはその他の扱いによって生じる一切の請求、損害、
36-その他の義務について何らの責任も負わないものとします。
37-
38-
39-※注意
40-data以下のファイル, font以下のファイルには第三者が作成したコンテンツを含んでいるため、
41-このライセンスの対象外となります。
--- a/build.bat
+++ /dev/null
@@ -1,5 +0,0 @@
1-set GOPATH=%cd%/go
2-set CGO_ENABLED=1
3-set GOOS=windows
4-go build -ldflags -H=windowsgui -o Ikemen_GO.exe ./src
5-pause
--- a/data/common.cmd
+++ /dev/null
@@ -1,10 +0,0 @@
1-
2-[Command]
3-name = "v"
4-command = v
5-time = 1
6-
7-[Command]
8-name = "w"
9-command = w
10-time = 1
--- a/get.sh
+++ b/get.sh
@@ -5,7 +5,3 @@ go get -u github.com/go-gl/glfw/v3.2/glfw
55 go get -u github.com/go-gl/gl/v2.1/gl
66 go get -u github.com/jfreymuth/go-vorbis/ogg/vorbis
77 go get -u github.com/timshannon/go-openal/openal
8-go get -u github.com/faiface/beep
9-go get -u github.com/hajimehoshi/oto
10-go get -u github.com/hajimehoshi/go-mp3
11-go get -u github.com/pkg/errors
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,4 @@
1+#!/bin/sh
2+export GOPATH=$PWD/go
3+go fmt ./src/*.go
4+go run ./src/*.go
--- /dev/null
+++ b/script/debug.lua
@@ -0,0 +1,108 @@
1+
2+addHotkey('c', true, false, false, 'toggleClsnDraw()')
3+addHotkey('d', true, false, false, 'toggleDebugDraw()')
4+addHotkey('s', true, false, false, 'changeSpeed()')
5+addHotkey('l', true, false, false, 'toggleStatusDraw()')
6+addHotkey('1', true, false, false, 'toggleAI(1)')
7+addHotkey('2', true, false, false, 'toggleAI(2)')
8+addHotkey('3', true, false, false, 'toggleAI(3)')
9+addHotkey('4', true, false, false, 'toggleAI(4)')
10+addHotkey('F1', false, false, false, 'kill(2);kill(4)')
11+addHotkey('F1', true, false, false, 'kill(1);kill(3)')
12+addHotkey('F2', false, false, false, 'kill(1,1);kill(2,1);kill(3,1);kill(4,1)')
13+addHotkey('F2', true, false, false, 'kill(1,1);kill(3,1)')
14+addHotkey('F2', false, false, true, 'kill(2,1);kill(4,1)')
15+addHotkey('F3', false, false, false, 'powMax(1);powMax(2)')
16+addHotkey('F4', false, false, false, 'roundReset()')
17+addHotkey('F4', false, false, true, 'reload()')
18+addHotkey('F5', false, false, false, 'setTime(0)')
19+addHotkey(
20+ 'SPACE', false, false, false,
21+ 'full(1);full(2);full(3);full(4);setTime(getRoundTime())')
22+addHotkey('p', false, false, false, 'togglePause()')
23+addHotkey('RETURN', false, false, false, 'step()')
24+addHotkey('i', true, false, false, 'stand(1);stand(2);stand(3);stand(4)')
25+
26+
27+speed = 1.0
28+
29+function changeSpeed()
30+ if speed >= 4 then
31+ speed = 0.25
32+ else
33+ speed = speed*2.0
34+ end
35+ setAccel(speed)
36+end
37+
38+function toggleAI(p)
39+ local oldid = id()
40+ if player(p) then
41+ if ailevel() > 0 then
42+ setAILevel(0)
43+ else
44+ setAILevel(8)
45+ end
46+ playerid(oldid)
47+ end
48+end
49+
50+function kill(p, ...)
51+ local oldid = id()
52+ if player(p) then
53+ local n = ...
54+ if not n then n = 0 end
55+ setLife(n)
56+ playerid(oldid)
57+ end
58+end
59+
60+function powMax(p)
61+ local oldid = id()
62+ if player(p) then
63+ setPower(powermax())
64+ playerid(oldid)
65+ end
66+end
67+
68+function full(p)
69+ local oldid = id()
70+ if player(p) then
71+ setLife(lifemax())
72+ setPower(powermax())
73+ playerid(oldid)
74+ end
75+end
76+
77+function stand(p)
78+ local oldid = id()
79+ if player(p) then
80+ selfState(0)
81+ playerid(oldid)
82+ end
83+end
84+
85+function info()
86+ puts(
87+ string.format(
88+ 'name:%s state:%d>%d %s move:%s physics:%s',
89+ name(), prevstateno(), stateno(), statetype(), movetype(), physics()))
90+ puts(
91+ string.format(
92+ 'anim:%d %d elem:%d %d pos:%.3f,%.3f vel:%.3f,%.3f',
93+ anim(), animtime(), animelemno(0), animelemtime(animelemno(0)),
94+ posX(), posY(), velX(), velY()))
95+end
96+
97+function status(p)
98+ local oldid = id()
99+ if not player(p) then return false end
100+ ret =
101+ string.format(
102+ 'STA:%s%s%s%6d(%d) ANI:%6d(%d)%2d LIF:%5d POW:%5d TIM:%d',
103+ statetype(), movetype(), physics(), stateno(), stateOwner(),
104+ anim(), animOwner(), animelemno(0), life(), power(), time())
105+ playerid(oldid)
106+ return ret;
107+end
108+
--- /dev/null
+++ b/script/main.lua
@@ -0,0 +1,687 @@
1+
2+setRoundTime(999 * 6)--frames
3+setLifeMul(1.0)
4+setTeam1VS2Life(1.0)
5+setTurnsRecoveryRate(1.0 / 300.0)
6+
7+setZoom(false)
8+setZoomMin(0.25)
9+setZoomMax(1.0)
10+setZoomSpeed(1.0)
11+
12+loadLifebar('data/gms_lifebar/fight.def')
13+loadDebugFont('data/gms_lifebar/font2.fnt')
14+setDebugScript('script/debug.lua')
15+
16+selectColumns = 10
17+
18+
19+require('script.randomtest')
20+
21+function addWithRefresh(addFn, text)
22+ local nextRefresh = os.clock() + 0.02
23+ for i, c
24+ in ipairs(script.randomtest.strsplit('\n',
25+ text:gsub('^%s*(.-)%s*$', '%1')))
26+ do
27+ addFn(c)
28+ if os.clock() >= nextRefresh then
29+ refresh()
30+ nextRefresh = os.clock() + 0.02
31+ end
32+ end
33+end
34+
35+orgAddChar = addChar
36+orgAddStage = addStage
37+
38+function addChar(text)
39+ addWithRefresh(orgAddChar, text)
40+end
41+
42+function addStage(text)
43+ addWithRefresh(orgAddStage, text)
44+end
45+
46+assert(loadfile('script/select.lua'))()
47+
48+
49+math.randomseed(os.time())
50+
51+------------------------------------------------------------
52+sysSff = sffNew('script/system.sff')
53+sysSnd = sndNew('script/system.snd')
54+jgFnt = fontNew('data/gms_lifebar/font2.fnt')
55+
56+bgm = ''
57+playBGM(bgm)
58+
59+------------------------------------------------------------
60+function setCommand(c)
61+ commandAdd(c, 'u', '$U')
62+ commandAdd(c, 'd', '$D')
63+ commandAdd(c, 'l', '$B')
64+ commandAdd(c, 'r', '$F')
65+ commandAdd(c, 'a', 'a')
66+ commandAdd(c, 'b', 'b')
67+ commandAdd(c, 'c', 'c')
68+ commandAdd(c, 'x', 'x')
69+ commandAdd(c, 'y', 'y')
70+ commandAdd(c, 'z', 'z')
71+ commandAdd(c, 's', 's')
72+ commandAdd(c, 'holds', '/s')
73+ commandAdd(c, 'su', '/s, U')
74+ commandAdd(c, 'sd', '/s, D')
75+end
76+
77+p1Cmd = commandNew()
78+setCommand(p1Cmd)
79+
80+p2Cmd = commandNew()
81+setCommand(p2Cmd)
82+
83+------------------------------------------------------------
84+selectRows = math.floor(selectColumns * 2 / 5.0)
85+
86+setRandomSpr(sysSff, 151, 0, 5.0/selectColumns, 5.0/selectColumns)
87+setSelColRow(selectColumns, selectRows)
88+setSelCellSize(29*5.0/selectColumns, 29*5.0/selectColumns)
89+setSelCellScale(5.0/selectColumns, 5.0/selectColumns)
90+
91+function init()
92+ p1TeamMode = 0
93+ p1NumTurns = 2
94+ p1SelOffset = 0
95+ p1SelX = 0
96+ p1SelY = 0
97+ p1Portrait = nil
98+
99+ p2TeamMode = 0
100+ p2NumTurns = 2
101+ p2SelOffset = 0
102+ p2SelX = 0
103+ p2SelY = 0
104+ p2Portrait = nil
105+
106+ stageNo = 0
107+ setStage(0)
108+end
109+
110+init()
111+
112+function noTask()
113+end
114+
115+
116+function animPosDraw(a, x, y)
117+ animSetPos(a, x, y)
118+ animDraw(a)
119+end
120+
121+function textImgPosDraw(ti, x, y)
122+ textImgSetPos(ti, x, y)
123+ textImgDraw(ti)
124+end
125+
126+function createTextImg(font, bank, aline, text, x, y)
127+ local ti = textImgNew()
128+ textImgSetFont(ti, font)
129+ textImgSetBank(ti, bank)
130+ textImgSetAlign(ti, aline)
131+ textImgSetText(ti, text)
132+ textImgSetPos(ti, x, y)
133+ return ti
134+end
135+
136+function btnPalNo(cmd)
137+ local s = 0
138+ if commandGetState(cmd, 'holds') then s = 6 end
139+ if commandGetState(cmd, 'a') then return 1 + s end
140+ if commandGetState(cmd, 'b') then return 2 + s end
141+ if commandGetState(cmd, 'c') then return 3 + s end
142+ if commandGetState(cmd, 'x') then return 4 + s end
143+ if commandGetState(cmd, 'y') then return 5 + s end
144+ if commandGetState(cmd, 'z') then return 6 + s end
145+ return 0
146+end
147+
148+------------------------------------------------------------
149+p1SelTmTxt = createTextImg(jgFnt, 0, 1, 'Team Mode', 20, 30)
150+p1SingleTxt = createTextImg(jgFnt, 0, 1, 'Single', 20, 50)
151+p1SimulTxt = createTextImg(jgFnt, 0, 1, 'Simul', 20, 65)
152+p1TurnsTxt = createTextImg(jgFnt, 0, 1, 'Turns', 20, 80)
153+
154+p1TmCursor = animNew(sysSff, [[
155+180,0, 0,0, -1
156+]])
157+
158+p1TmIcon = animNew(sysSff, [[
159+181,0, 0,0, -1
160+]])
161+
162+function p1TmSub()
163+ if commandGetState(p1Cmd, 'u') then
164+ sndPlay(sysSnd, 100, 0)
165+ p1TeamMode = p1TeamMode - 1
166+ if p1TeamMode < 0 then p1TeamMode = 2 end
167+ elseif commandGetState(p1Cmd, 'd') then
168+ sndPlay(sysSnd, 100, 0)
169+ p1TeamMode = p1TeamMode + 1
170+ if p1TeamMode > 2 then p1TeamMode = 0 end
171+ elseif p1TeamMode == 2 then
172+ if commandGetState(p1Cmd, 'l') then
173+ sndPlay(sysSnd, 100, 0)
174+ p1NumTurns = p1NumTurns - 1
175+ if p1NumTurns < 1 then p1NumTurns = 1 end
176+ elseif commandGetState(p1Cmd, 'r') then
177+ sndPlay(sysSnd, 100, 0)
178+ p1NumTurns = p1NumTurns + 1
179+ if p1NumTurns > 4 then p1NumTurns = 4 end
180+ end
181+ end
182+ textImgDraw(p1SelTmTxt)
183+ textImgDraw(p1SingleTxt)
184+ textImgDraw(p1SimulTxt)
185+ textImgDraw(p1TurnsTxt)
186+ animUpdate(p1TmIcon)
187+ animPosDraw(p1TmIcon, 80, 66)
188+ animPosDraw(p1TmIcon, 86, 66)
189+ for i = 1, p1NumTurns do
190+ animPosDraw(p1TmIcon, 74 + i*6, 81)
191+ end
192+ animUpdate(p1TmCursor)
193+ animPosDraw(p1TmCursor, 10, 47 + p1TeamMode*15)
194+ if btnPalNo(p1Cmd) > 0 then
195+ sndPlay(sysSnd, 100, 1)
196+ setTeamMode(1, p1TeamMode, p1NumTurns)
197+ p1Selected = {}
198+ p1SelEnd = false
199+ p1Task = p1SelSub
200+ end
201+end
202+
203+
204+------------------------------------------------------------
205+p2SelTmTxt = createTextImg(jgFnt, 0, -1, 'Team Mode', 300, 30)
206+p2SingleTxt = createTextImg(jgFnt, 0, -1, 'Single', 300, 50)
207+p2SimulTxt = createTextImg(jgFnt, 0, -1, 'Simul', 300, 65)
208+p2TurnsTxt = createTextImg(jgFnt, 0, -1, 'Turns', 300, 80)
209+
210+p2TmCursor = animNew(sysSff, [[
211+190,0, 0,0, -1
212+]])
213+
214+p2TmIcon = animNew(sysSff, [[
215+191,0, 0,0, -1
216+]])
217+
218+function p2TmSub()
219+ if commandGetState(p2Cmd, 'u') then
220+ sndPlay(sysSnd, 100, 0)
221+ p2TeamMode = p2TeamMode - 1
222+ if p2TeamMode < 0 then p2TeamMode = 2 end
223+ elseif commandGetState(p2Cmd, 'd') then
224+ sndPlay(sysSnd, 100, 0)
225+ p2TeamMode = p2TeamMode + 1
226+ if p2TeamMode > 2 then p2TeamMode = 0 end
227+ elseif p2TeamMode == 2 then
228+ if commandGetState(p2Cmd, 'r') then
229+ sndPlay(sysSnd, 100, 0)
230+ p2NumTurns = p2NumTurns - 1
231+ if p2NumTurns < 1 then p2NumTurns = 1 end
232+ elseif commandGetState(p2Cmd, 'l') then
233+ sndPlay(sysSnd, 100, 0)
234+ p2NumTurns = p2NumTurns + 1
235+ if p2NumTurns > 4 then p2NumTurns = 4 end
236+ end
237+ end
238+ textImgDraw(p2SelTmTxt)
239+ textImgDraw(p2SingleTxt)
240+ textImgDraw(p2SimulTxt)
241+ textImgDraw(p2TurnsTxt)
242+ animUpdate(p2TmIcon)
243+ animPosDraw(p2TmIcon, 240, 66)
244+ animPosDraw(p2TmIcon, 234, 66)
245+ for i = 1, p2NumTurns do
246+ animPosDraw(p2TmIcon, 246 - i*6, 81)
247+ end
248+ animUpdate(p2TmCursor)
249+ animPosDraw(p2TmCursor, 310, 47 + p2TeamMode*15)
250+ if btnPalNo(p2Cmd) > 0 then
251+ sndPlay(sysSnd, 100, 1)
252+ setTeamMode(2, p2TeamMode, p2NumTurns)
253+ p2Selected = {}
254+ p2SelEnd = false
255+ p2Task = p2SelSub
256+ end
257+end
258+
259+
260+------------------------------------------------------------
261+p1Cursor = animNew(sysSff, [[
262+160,0, 0,0, -1
263+]])
264+animSetScale(p1Cursor, 5.0/selectColumns, 5.0/selectColumns)
265+
266+p1NameTxt = createTextImg(jgFnt, 0, 1, '', 0, 0)
267+textImgSetScale(p1NameTxt, 0.5, 0.5)
268+
269+function p1DrawSelectName()
270+ local y = 162
271+ for i = 1, #p1Selected do
272+ textImgSetText(p1NameTxt, getCharName(p1Selected[i]))
273+ textImgPosDraw(p1NameTxt, 10, y)
274+ y = y + 7
275+ end
276+ return y
277+end
278+
279+function p1SelSub()
280+ local n = p1SelOffset + p1SelX + selectColumns*p1SelY
281+ p1Portrait = n
282+ local y = p1DrawSelectName()
283+ if not p1SelEnd then
284+ if commandGetState(p1Cmd, 'su') then
285+ sndPlay(sysSnd, 100, 0)
286+ p1SelY = p1SelY - 20
287+ elseif commandGetState(p1Cmd, 'sd') then
288+ sndPlay(sysSnd, 100, 0)
289+ p1SelY = p1SelY + 20
290+ elseif commandGetState(p1Cmd, 'u') then
291+ sndPlay(sysSnd, 100, 0)
292+ p1SelY = p1SelY - 1
293+ elseif commandGetState(p1Cmd, 'd') then
294+ sndPlay(sysSnd, 100, 0)
295+ p1SelY = p1SelY + 1
296+ elseif commandGetState(p1Cmd, 'l') then
297+ sndPlay(sysSnd, 100, 0)
298+ p1SelX = p1SelX - 1
299+ elseif commandGetState(p1Cmd, 'r') then
300+ sndPlay(sysSnd, 100, 0)
301+ p1SelX = p1SelX + 1
302+ end
303+ if p1SelY < 0 then
304+ p1SelOffset = p1SelOffset + selectColumns*p1SelY
305+ p1SelY = 0
306+ elseif p1SelY >= selectRows then
307+ p1SelOffset = p1SelOffset + selectColumns*(p1SelY - (selectRows - 1))
308+ p1SelY = selectRows - 1
309+ end
310+ if p1SelX < 0 then
311+ p1SelX = selectColumns - 1
312+ elseif p1SelX >= selectColumns then
313+ p1SelX = 0
314+ end
315+ animUpdate(p1Cursor)
316+ animPosDraw(
317+ p1Cursor, 10 + 29*p1SelX*5.0/selectColumns,
318+ 170 + 29*p1SelY*5.0/selectColumns)
319+ textImgSetText(p1NameTxt, getCharName(n))
320+ textImgPosDraw(p1NameTxt, 10, y)
321+ local selval = selectChar(1, n, btnPalNo(p1Cmd))
322+ if selval > 0 then
323+ sndPlay(sysSnd, 100, 1)
324+ p1Selected[#p1Selected+1] = n
325+ end
326+ if selval == 2 then
327+ p1SelEnd = true
328+ if p2In == 1 then
329+ p2Task = p2TmSub
330+ commandBufReset(p2Cmd)
331+ end
332+ end
333+ end
334+end
335+
336+
337+------------------------------------------------------------
338+p2Cursor = animNew(sysSff, [[
339+170,0, 0,0, -1
340+]])
341+animSetScale(p2Cursor, 5.0/selectColumns, 5.0/selectColumns)
342+
343+p2NameTxt = createTextImg(jgFnt, 0, -1, '', 0, 0)
344+textImgSetScale(p2NameTxt, 0.5, 0.5)
345+
346+function p2DrawSelectName()
347+ local y = 162
348+ for i = 1, #p2Selected do
349+ textImgSetText(p2NameTxt, getCharName(p2Selected[i]))
350+ textImgPosDraw(p2NameTxt, 310, y)
351+ y = y + 7
352+ end
353+ return y
354+end
355+
356+function p2SelSub()
357+ local n = p2SelOffset + p2SelX + selectColumns*p2SelY
358+ p2Portrait = n
359+ local y = p2DrawSelectName()
360+ if not p2SelEnd then
361+ if commandGetState(p2Cmd, 'su') then
362+ sndPlay(sysSnd, 100, 0)
363+ p2SelY = p2SelY - 20
364+ elseif commandGetState(p2Cmd, 'sd') then
365+ sndPlay(sysSnd, 100, 0)
366+ p2SelY = p2SelY + 20
367+ elseif commandGetState(p2Cmd, 'u') then
368+ sndPlay(sysSnd, 100, 0)
369+ p2SelY = p2SelY - 1
370+ elseif commandGetState(p2Cmd, 'd') then
371+ sndPlay(sysSnd, 100, 0)
372+ p2SelY = p2SelY + 1
373+ elseif commandGetState(p2Cmd, 'l') then
374+ sndPlay(sysSnd, 100, 0)
375+ p2SelX = p2SelX - 1
376+ elseif commandGetState(p2Cmd, 'r') then
377+ sndPlay(sysSnd, 100, 0)
378+ p2SelX = p2SelX + 1
379+ end
380+ if p2SelY < 0 then
381+ p2SelOffset = p2SelOffset + selectColumns*p2SelY
382+ p2SelY = 0
383+ elseif p2SelY >= selectRows then
384+ p2SelOffset = p2SelOffset + selectColumns*(p2SelY - (selectRows - 1))
385+ p2SelY = selectRows - 1
386+ end
387+ if p2SelX < 0 then
388+ p2SelX = selectColumns - 1
389+ elseif p2SelX >= selectColumns then
390+ p2SelX = 0
391+ end
392+ animUpdate(p2Cursor)
393+ animPosDraw(
394+ p2Cursor, 169 + 29*p2SelX*5.0/selectColumns,
395+ 170 + 29*p2SelY*5.0/selectColumns)
396+ textImgSetText(p2NameTxt, getCharName(n))
397+ textImgPosDraw(p2NameTxt, 310, y)
398+ local selval = selectChar(2, n, btnPalNo(p2Cmd))
399+ if selval > 0 then
400+ sndPlay(sysSnd, 100, 1)
401+ p2Selected[#p2Selected+1] = n
402+ end
403+ if selval == 2 then
404+ p2SelEnd = true
405+ if p1In == 2 then
406+ p1Task = p1TmSub
407+ commandBufReset(p1Cmd)
408+ end
409+ end
410+ end
411+end
412+
413+
414+------------------------------------------------------------
415+selStageTxt = createTextImg(jgFnt, 0, 0, '', 160, 237)
416+textImgSetScale(selStageTxt, 0.5, 0.5)
417+
418+function selStageSub()
419+ if commandGetState(p1Cmd, 'l') then
420+ sndPlay(sysSnd, 100, 0)
421+ stageNo = setStage(stageNo - 1)
422+ elseif commandGetState(p1Cmd, 'r') then
423+ sndPlay(sysSnd, 100, 0)
424+ stageNo = setStage(stageNo + 1)
425+ elseif commandGetState(p1Cmd, 'u') then
426+ sndPlay(sysSnd, 100, 0)
427+ stageNo = setStage(stageNo - 10)
428+ elseif commandGetState(p1Cmd, 'd') then
429+ sndPlay(sysSnd, 100, 0)
430+ stageNo = setStage(stageNo + 10)
431+ end
432+ textImgSetText(
433+ selStageTxt, 'Stage ' .. stageNo .. ': ' .. getStageName(stageNo))
434+ textImgDraw(selStageTxt)
435+ if btnPalNo(p1Cmd) > 0 then
436+ selectStage(stageNo)
437+ selMode = false
438+ end
439+end
440+
441+
442+------------------------------------------------------------
443+selBG = animNew(sysSff, [[
444+100,0, 0,0, -1
445+]])
446+animSetTile(selBG, 1, 1)
447+animSetColorKey(selBG, -1)
448+animSetScale(selBG, 0.5, 0.5)
449+
450+selBox = animNew(sysSff, [[
451+100,1, 0,0, -1
452+]])
453+animSetTile(selBox, 1, 0)
454+animSetColorKey(selBox, -1)
455+animSetAlpha(selBox, 1, 255)
456+animSetPos(selBox, 0, 166)
457+animSetWindow(selBox, 5, 0, 151, 240)
458+
459+selBox2 = animNew(sysSff, [[
460+100,1, 0,0, -1
461+]])
462+animSetTile(selBox2, 1, 0)
463+animSetColorKey(selBox2, -1)
464+animSetAlpha(selBox2, 1, 255)
465+animSetPos(selBox2, 0, 166)
466+animSetWindow(selBox2, 164, 0, 151, 240)
467+
468+function bgSub()
469+ animAddPos(selBG, 1, 1)
470+ animUpdate(selBG)
471+ animDraw(selBG)
472+ animAddPos(selBox, 1, 0)
473+ animUpdate(selBox)
474+ animDraw(selBox)
475+ animAddPos(selBox2, 1, 0)
476+ animUpdate(selBox2)
477+ animDraw(selBox2)
478+end
479+
480+
481+------------------------------------------------------------
482+watchMode = createTextImg(jgFnt, 0, 1, 'Watch Mode', 100, 80)
483+p1VsComTxt = createTextImg(jgFnt, 0, 1, '1P vs. Com', 100, 100)
484+p1VsP2 = createTextImg(jgFnt, 0, 1, '1P vs. 2P', 100, 120)
485+netplay = createTextImg(jgFnt, 0, 1, 'Netplay', 100, 140)
486+portChange = createTextImg(jgFnt, 0, 1, '', 100, 160)
487+replay = createTextImg(jgFnt, 0, 1, 'Replay', 100, 180)
488+comVsP1 = createTextImg(jgFnt, 0, 1, 'Com vs. 1P', 100, 200)
489+autoRandomTest = createTextImg(jgFnt, 0, 1, 'Auto Random Test', 100, 220)
490+
491+connecting = createTextImg(jgFnt, 0, 1, '', 10, 140)
492+loading = createTextImg(jgFnt, 0, 1, 'Loading...', 100, 210)
493+
494+inputdia = inputDialogNew()
495+
496+function cmdInput()
497+ commandInput(p1Cmd, p1In)
498+ commandInput(p2Cmd, p2In)
499+end
500+
501+function main()
502+ while true do
503+ p1Selected = {}
504+ p1SelEnd = false
505+ p1Portrait = nil
506+
507+ p2Selected = {}
508+ p2SelEnd = false
509+ p2Portrait = nil
510+
511+ if gameMode == 6 then
512+ p1Task = noTask
513+ p2Task = p2TmSub
514+ else
515+ p1Task = p1TmSub
516+ p2Task = noTask
517+ if gameMode > 1 then p2Task = p2TmSub end
518+ end
519+
520+ refresh()
521+
522+ commandBufReset(p1Cmd)
523+ commandBufReset(p2Cmd)
524+
525+ selMode = true
526+ selectStart()
527+
528+ ------------------------------------------------------------
529+ --メインループ
530+ ------------------------------------------------------------
531+ while selMode do
532+ if esc() then return end
533+ bgSub()
534+ if p1Portrait then drawPortrait(p1Portrait, 18, 13, 1, 1) end
535+ if p2Portrait then drawPortrait(p2Portrait, 302, 13, -1, 1) end
536+ drawFace(10, 170, p1SelOffset)
537+ drawFace(169, 170, p2SelOffset)
538+ if p1SelEnd and p2SelEnd then selStageSub() end
539+ p2Task()
540+ p1Task()
541+ cmdInput()
542+ refresh()
543+ end
544+ for i = 1, 20 do
545+ animDraw(selBG)
546+ local k = 0
547+ for j = 1, #p1Selected do
548+ local scl = 10000.0 / (10000.0 - k*i)
549+ local tmp = i*k / 20
550+ drawPortrait(p1Selected[j], 18 - tmp, 13 + tmp/3, scl, scl)
551+ k = k + 48
552+ end
553+ k = 0
554+ for j = 1, #p2Selected do
555+ local scl = 10000.0 / (10000.0 - k*i)
556+ local tmp = i*k / 20
557+ drawPortrait(p2Selected[j], 302 + tmp, 13 + tmp/3, -scl, scl)
558+ k = k + 48
559+ end
560+ p1DrawSelectName()
561+ p2DrawSelectName()
562+ textImgDraw(loading)
563+ refresh()
564+ end
565+ game()
566+ playBGM(bgm)
567+ end
568+end
569+
570+function modeSel()
571+ while true do
572+ exitNetPlay()
573+ exitReplay()
574+
575+ gameMode = 0
576+ p1In = 1
577+ p2In = 1
578+
579+ for i = 1, 8 do
580+ setCom(i, 8)
581+ end
582+ setAutoLevel(false)
583+ setMatchNo(1)
584+ setHomeTeam(1)
585+ resetRemapInput()
586+
587+ textImgSetText(portChange, 'Port Change(' .. getListenPort() .. ')')
588+
589+ refresh()
590+ commandBufReset(p1Cmd)
591+
592+ while btnPalNo(p1Cmd) <= 0 do
593+ if commandGetState(p1Cmd, 'u') then
594+ sndPlay(sysSnd, 100, 0)
595+ gameMode = gameMode - 1
596+ elseif commandGetState(p1Cmd, 'd') then
597+ sndPlay(sysSnd, 100, 0)
598+ gameMode = gameMode + 1
599+ end
600+ if gameMode < 0 then
601+ gameMode = 7
602+ elseif gameMode > 7 then
603+ gameMode = 0
604+ end
605+ textImgDraw(watchMode)
606+ textImgDraw(p1VsComTxt)
607+ textImgDraw(p1VsP2)
608+ textImgDraw(netplay)
609+ textImgDraw(portChange)
610+ textImgDraw(replay)
611+ textImgDraw(comVsP1)
612+ textImgDraw(autoRandomTest)
613+ animUpdate(p1TmCursor)
614+ animPosDraw(p1TmCursor, 95, 77 + 20*gameMode)
615+ cmdInput()
616+ refresh()
617+ end
618+ sndPlay(sysSnd, 100, 1)
619+
620+ local cancel = false
621+
622+ if gameMode == 0 then
623+ elseif gameMode == 1 then
624+ setCom(1, 0)
625+ elseif gameMode == 2 then
626+ p2In = 2
627+ setCom(1, 0)
628+ setCom(2, 0)
629+ elseif gameMode == 3 then
630+ p2In = 2
631+ setCom(1, 0)
632+ setCom(2, 0)
633+ inputDialogPopup(inputdia, 'Input Server')
634+ while not inputDialogIsDone(inputdia) do
635+ refresh()
636+ end
637+ textImgSetText(
638+ connecting,
639+ 'Now connecting.. ' .. inputDialogGetStr(inputdia)
640+ .. ' ' .. getListenPort())
641+ enterNetPlay(inputDialogGetStr(inputdia))
642+ while not connected() do
643+ if esc() then
644+ cancel = true
645+ break
646+ end
647+ textImgDraw(connecting)
648+ refresh()
649+ end
650+ if not cancel then
651+ init()
652+ synchronize()
653+ math.randomseed(sszRandom())
654+ end
655+ elseif gameMode == 4 then
656+ inputDialogPopup(inputdia, 'Input Port')
657+ while not inputDialogIsDone(inputdia) do
658+ refresh()
659+ end
660+ setListenPort(inputDialogGetStr(inputdia))
661+ cancel = true
662+ elseif gameMode == 5 then
663+ p2In = 2
664+ setCom(1, 0)
665+ setCom(2, 0)
666+ enterReplay('replay/netplay.replay')
667+ init()
668+ synchronize()
669+ math.randomseed(sszRandom())
670+ elseif gameMode == 6 then
671+ remapInput(1, 2)
672+ remapInput(2, 1)
673+ p1In = 2
674+ p2In = 2
675+ setCom(2, 0)
676+ elseif gameMode == 7 then
677+ script.randomtest.run()
678+ cancel = true
679+ end
680+ if not cancel then
681+ main()
682+ end
683+ end
684+end
685+
686+modeSel()
687+
--- /dev/null
+++ b/script/randomtest.lua
@@ -0,0 +1,291 @@
1+
2+module(..., package.seeall)
3+
4+function strsplit(delimiter, text)
5+ local list = {}
6+ local pos = 1
7+ if string.find('', delimiter, 1) then
8+ if string.len(text) == 0 then
9+ table.insert(list, text)
10+ else
11+ for i = 1, string.len(text) do
12+ table.insert(list, string.sub(text, i, i))
13+ end
14+ end
15+ else
16+ while true do
17+ local first, last = string.find(text, delimiter, pos)
18+ if first then
19+ table.insert(list, string.sub(text, pos, first-1))
20+ pos = last+1
21+ else
22+ table.insert(list, string.sub(text, pos))
23+ break
24+ end
25+ end
26+ end
27+ return list
28+end
29+
30+function strtrim(s)
31+ return string.match(s,'^()%s*$') and '' or string.match(s,'^%s*(.*%S)')
32+end
33+
34+function map(func, table)
35+ local dest = {}
36+ for k, v in pairs(table) do
37+ dest[k] = func(v)
38+ end
39+ return dest
40+end
41+
42+
43+tuyoiBorder = 0
44+juuni = 12
45+moudeta = {}
46+rank = 0
47+saikyou = false
48+roster = {}
49+debugText = ''
50+numChars = 0
51+nextChar = 1
52+
53+function addMoudeta(rank)
54+ moudeta[#moudeta + 1] = rank
55+ local max =
56+ math.floor(
57+ numChars / (math.min(numChars / (juuni*10) + 3, juuni)*juuni))
58+ while #moudeta > max do
59+ table.remove(moudeta, 1)
60+ end
61+end
62+function randRank()
63+ local r = 0
64+ while true do
65+ r = math.random(1, tuyoiBorder + juuni - 2);
66+ local notbroken = true
67+ for i = 1, #moudeta do
68+ if math.abs(moudeta[i] - r) <= math.floor(juuni/3) then
69+ notbroken = false
70+ break
71+ end
72+ end
73+ if notbroken then
74+ break
75+ end
76+ end
77+ return r
78+end
79+
80+function eachAllChars(f)
81+ for cel = 0, numSelCells()-1 do
82+ if getCharFileName(cel) ~= 'randomselect' and getCharName(cel) ~= '' then
83+ f(cel)
84+ end
85+ end
86+end
87+
88+function rakuBenry()
89+ local alf = 'autolevel.txt'
90+ local veljnz = {}
91+ local winct = {}
92+ local buf = '\239\187\191'
93+ local fp = io.open(alf, 'r')
94+ if fp then
95+ for line in fp:lines() do
96+ local tmp = strsplit(',', line)
97+ if #tmp >= 2 then
98+ for i = 1, 4 do
99+ if i == 4 then
100+ tmp[1] = string.sub(tmp[1], 4)
101+ else
102+ if string.byte(tmp[1], i) ~= string.byte(buf, i) then break end
103+ end
104+ end
105+ winct[tmp[1]] = map(tonumber, strsplit(' ', strtrim(tmp[2])))
106+ end
107+ end
108+ io.close(fp)
109+ end
110+ numChars = 0
111+ eachAllChars(function(cel)
112+ numChars = numChars + 1
113+ end)
114+ local tuyoninzu = math.floor(numChars / (juuni*10))
115+ if tuyoninzu < juuni - 1 then
116+ tuyoiBorder = math.floor(numChars / (tuyoninzu + 1))
117+ tuyoninzu = juuni - 1
118+ else
119+ tuyoiBorder = math.floor(numChars / juuni)
120+ end
121+ local total = 0
122+ local zero ={}
123+ local tsuyoshi = {}
124+ local rand = {}
125+ local kai = {}
126+ local bimyou = {}
127+ local tuyocnt = 0
128+ local ran = randRank()
129+ eachAllChars(function(cel)
130+ if #veljnz < cel*12 then
131+ for i = #veljnz + 1, cel*12 do
132+ veljnz[i] = 0
133+ end
134+ end
135+ local wins = winct[getCharFileName(cel)]
136+ local tmp = 0
137+ for j = 1, 12 do
138+ if wins and j <= #wins then
139+ total = total + wins[j]
140+ veljnz[cel*12 + j] = wins[j]
141+ tmp = tmp + wins[j]
142+ else
143+ veljnz[cel*12 + j] = 0
144+ end
145+ end
146+ if tmp >= tuyoiBorder then tuyocnt = tuyocnt + 1 end
147+ if tmp >= tuyoiBorder - juuni then table.insert(tsuyoshi, cel) end
148+ if tmp >= 1 and tmp <= juuni then table.insert(bimyou, cel) end
149+ if tmp > ran-juuni and tmp <= ran then table.insert(rand, cel) end
150+ if tmp == 0 then table.insert(zero, cel) end
151+ if tmp < 0 then table.insert(kai, cel) end
152+ end)
153+ function charAdd(cList, numAdd)
154+ if numAdd <= 0 then return end
155+ for i = 1, numAdd do
156+ if #cList == 0 then break end
157+ local cidx = math.random(1, #cList)
158+ table.insert(roster, cList[cidx])
159+ table.remove(cList, cidx)
160+ end
161+ end
162+ roster = {}
163+ nextChar = 1
164+ debugText = ''
165+ local numZero = #zero
166+ if numZero > 0 then
167+ charAdd(zero, numZero)
168+ charAdd(kai, tuyoninzu - numZero)
169+ rank = 0
170+ elseif #bimyou >= math.max(tuyoninzu*20, math.floor((numChars*3)/20)) then
171+ charAdd(bimyou, #bimyou)
172+ rank = juuni
173+ else
174+ for n = 1, 3 do
175+ if #rand >= tuyoninzu then break end
176+ rand = {}
177+ ran = randRank()
178+ eachAllChars(function(cel)
179+ local tmp = 0
180+ for j = 1, 12 do
181+ tmp = tmp + veljnz[cel*12 + j]
182+ end
183+ if tmp > ran-juuni and tmp <= ran then table.insert(rand, cel) end
184+ end)
185+ end
186+ debugText = ran .. ' ' .. #rand
187+ if #rand >= tuyoninzu then
188+ charAdd(rand, #rand)
189+ rank = ran
190+ addMoudeta(rank)
191+ elseif tuyocnt >= tuyoninzu then
192+ charAdd(tsuyoshi, #tsuyoshi)
193+ rank = tuyoiBorder+juuni-1
194+ else
195+ addMoudeta(tuyoiBorder + (juuni-2) - math.floor(juuni/3))
196+ charAdd(kai, #kai)
197+ rank = -1
198+ end
199+ end
200+ if numZero == 0 then
201+ while total ~= 0 do
202+ local i = math.random(1, #veljnz)
203+ if total > 0 then
204+ veljnz[i] = veljnz[i] - 1
205+ total = total - 1
206+ else
207+ veljnz[i] = veljnz[i] + 1
208+ total = total + 1
209+ end
210+ end
211+ end
212+ eachAllChars(function(cel)
213+ buf = buf .. getCharFileName(cel) .. ','
214+ for j = 1, 12 do
215+ buf = buf .. ' ' .. veljnz[cel*12 + j]
216+ end
217+ buf = buf .. '\r\n'
218+ end)
219+ local alv = io.open(alf, 'wb')
220+ alv:write(buf)
221+ io.close(alv)
222+end
223+
224+function randSel(pno, winner)
225+ if winner > 0 and (pno == winner) == not saikyou then return end
226+ local team
227+ if rank == 0 or rank == 12 or saikyou then
228+ team = 0
229+ elseif rank < 0 then
230+ team = math.random(0, 2)
231+ else
232+ team = math.random(0, 1)*2
233+ end
234+ setTeamMode(pno, team, math.random(1, 4))
235+ local tmp = 0
236+ while tmp < 2 do
237+ tmp = selectChar(pno, roster[nextChar], math.random(1, 12))
238+ nextChar = nextChar + 1
239+ if nextChar > #roster then nextChar = 1 end
240+ end
241+end
242+
243+function rosterTxt()
244+ local str = "Rank: " .. rank .. ' ' .. debugText
245+ for i = 1, #roster do
246+ str = str .. '\n' .. getCharFileName(roster[i])
247+ end
248+ dscr = io.open('script/randomroster.txt', 'w')
249+ dscr:write(str)
250+ io.close(dscr)
251+end
252+
253+
254+function init()
255+ for i = 1, 8 do
256+ setCom(i, 8)
257+ end
258+ setAutoLevel(true)
259+ setMatchNo(1)
260+ selectStage(0)
261+ rakuBenry()
262+ winner = 0
263+ wins = 0
264+ rosterTxt()
265+ nextChar = 1
266+ saikyou = rank == tuyoiBorder+juuni-1
267+end
268+
269+function run()
270+ init()
271+ refresh()
272+ while not esc() do
273+ randSel(1, winner)
274+ randSel(2, winner)
275+ loadStart()
276+ local oldwinner = winner
277+ winner = game()
278+ if winner < 0 or esc() then break end
279+ oldwins = wins
280+ wins = wins + 1
281+ if winner ~= oldwinner then
282+ wins = 1
283+ setHomeTeam(winner == 1 and 2 or 1)
284+ end
285+ setMatchNo(wins)
286+ if winner <= 0 or wins >= 20 or wins == oldwins then
287+ init()
288+ end
289+ refresh()
290+ end
291+end
Binary files /dev/null and b/script/system.sff differ
Binary files /dev/null and b/script/system.snd differ
--- a/src/anim.go
+++ b/src/anim.go
@@ -1,6 +1,7 @@
11 package main
22
33 import (
4+ "math"
45 "strconv"
56 "strings"
67 )
@@ -88,12 +89,14 @@ func ReadAnimFrame(line string) *AnimFrame {
8889 }
8990 if af.SrcAlpha == 1 && af.DstAlpha == 255 {
9091 af.SrcAlpha = 0
92+ } else if af.SrcAlpha == 255 && af.DstAlpha == 1 {
93+ af.DstAlpha = 0
9194 }
9295 }
9396 }
9497 }
9598 case len(a) > 0 && a[0] == 'a':
96- af.SrcAlpha, af.DstAlpha = 255, 255
99+ af.SrcAlpha, af.DstAlpha = 255, 1
97100 }
98101 if len(ary) > 1 {
99102 af.Ex = make([][]float32, 3)
@@ -113,7 +116,7 @@ func ReadAnimFrame(line string) *AnimFrame {
113116 if err != nil {
114117 f = 0
115118 }
116- af.Ex[2] = append(af.Ex[2], float32(f)) // Angle
119+ af.Ex[2] = append(af.Ex[2], float32(f*math.Pi/180)) // Angle
117120 }
118121 }
119122 }
@@ -133,34 +136,23 @@ func (af *AnimFrame) Clsn2() []float32 {
133136 }
134137
135138 type Animation struct {
136- sff *Sff
137- spr *Sprite
138- frames []AnimFrame
139- tile [4]int32
140- loopstart int32
141- interpolate_offset []int32
142- interpolate_scale []int32
143- interpolate_angle []int32
144- interpolate_blend []int32
145- current int32
146- drawidx int32
147- time int32
148- sumtime int32
149- totaltime int32
150- looptime int32
151- nazotime int32
152- mask int16
153- srcAlpha int16
154- dstAlpha int16
155- newframe bool
156- loopend bool
157- interpolate_offset_x float32
158- interpolate_offset_y float32
159- scale_x float32
160- scale_y float32
161- angle float32
162- interpolate_blend_srcalpha float32
163- interpolate_blend_dstalpha float32
139+ sff *Sff
140+ spr *Sprite
141+ frames []AnimFrame
142+ tile [4]int32
143+ loopstart int32
144+ current int32
145+ drawidx int32
146+ time int32
147+ sumtime int32
148+ totaltime int32
149+ looptime int32
150+ nazotime int32
151+ mask int16
152+ srcAlpha int16
153+ dstAlpha int16
154+ newframe bool
155+ loopend bool
164156 }
165157
166158 func newAnimation(sff *Sff) *Animation {
@@ -199,14 +191,6 @@ func ReadAnimation(sff *Sff, lines []string, i *int) *Animation {
199191 def1, def2 = true, true
200192 case len(line) >= 9 && line[:9] == "loopstart":
201193 a.loopstart = int32(len(a.frames))
202- case len(line) >= 18 && line[:18] == "interpolate offset":
203- a.interpolate_offset = append(a.interpolate_offset, int32(len(a.frames)))
204- case len(line) >= 17 && line[:17] == "interpolate scale":
205- a.interpolate_scale = append(a.interpolate_scale, int32(len(a.frames)))
206- case len(line) >= 17 && line[:17] == "interpolate angle":
207- a.interpolate_angle = append(a.interpolate_angle, int32(len(a.frames)))
208- case len(line) >= 17 && line[:17] == "interpolate blend":
209- a.interpolate_blend = append(a.interpolate_blend, int32(len(a.frames)))
210194 case len(line) >= 5 && line[:4] == "clsn":
211195 ii := strings.Index(line, ":")
212196 if ii < 0 {
@@ -460,93 +444,10 @@ func (a *Animation) UpdateSprite() {
460444 a.time, a.newframe, a.current = 0, true, 0
461445 }
462446 }
463- if a.newframe && a.sff != nil && a.frames[a.current].Time != 0 {
447+ if a.newframe && a.sff != nil {
464448 a.spr = a.sff.GetSprite(a.curFrame().Group, a.curFrame().Number)
465449 }
466450 a.newframe, a.drawidx = false, a.current
467-
468- a.scale_x = 1
469- a.scale_y = 1
470- a.angle = 0
471- a.interpolate_offset_x = 0
472- a.interpolate_offset_y = 0
473- a.interpolate_blend_srcalpha = float32(a.frames[a.drawidx].SrcAlpha)
474- a.interpolate_blend_dstalpha = float32(a.frames[a.drawidx].DstAlpha)
475-
476- if len(a.frames[a.drawidx].Ex) > 2 {
477- if len(a.frames[a.drawidx].Ex[2]) > 0 {
478- a.scale_x = a.frames[a.drawidx].Ex[2][0]
479- if len(a.frames[a.drawidx].Ex[2]) > 1 {
480- a.scale_y = a.frames[a.drawidx].Ex[2][1]
481- if len(a.frames[a.drawidx].Ex[2]) > 2 {
482- a.angle = a.frames[a.drawidx].Ex[2][2]
483- }
484- }
485- }
486- }
487- if int(a.drawidx) < len(a.frames)-1 {
488- for _, i := range a.interpolate_offset {
489- if a.drawidx+1 == i {
490- a.interpolate_offset_x = float32(a.frames[a.drawidx+1].X-a.frames[a.drawidx].X) / float32(a.curFrame().Time) * float32(a.time)
491- a.interpolate_offset_y = float32(a.frames[a.drawidx+1].Y-a.frames[a.drawidx].Y) / float32(a.curFrame().Time) * float32(a.time)
492- break
493- }
494- }
495- for _, i := range a.interpolate_scale {
496- if a.drawidx+1 == i {
497- var drawframe_scale_x, nextframe_scale_x, drawframe_scale_y, nextframe_scale_y float32 = 1, 1, 1, 1
498- if len(a.frames[a.drawidx].Ex) > 2 {
499- if len(a.frames[a.drawidx].Ex[2]) > 0 {
500- drawframe_scale_x = a.frames[a.drawidx].Ex[2][0]
501- }
502- if len(a.frames[a.drawidx].Ex[2]) > 1 {
503- drawframe_scale_y = a.frames[a.drawidx].Ex[2][1]
504- }
505- }
506- if len(a.frames[a.drawidx+1].Ex) > 2 {
507- if len(a.frames[a.drawidx+1].Ex[2]) > 0 {
508- nextframe_scale_x = a.frames[a.drawidx+1].Ex[2][0]
509- }
510- if len(a.frames[a.drawidx+1].Ex[2]) > 1 {
511- nextframe_scale_y = a.frames[a.drawidx+1].Ex[2][1]
512- }
513- }
514- a.scale_x += (nextframe_scale_x - drawframe_scale_x) / float32(a.curFrame().Time) * float32(a.time)
515- a.scale_y += (nextframe_scale_y - drawframe_scale_y) / float32(a.curFrame().Time) * float32(a.time)
516- break
517- }
518- }
519- for _, i := range a.interpolate_angle {
520- if a.drawidx+1 == i {
521- var drawframe_angle, nextframe_angle float32 = 0, 0
522- if len(a.frames[a.drawidx].Ex) > 2 {
523- if len(a.frames[a.drawidx].Ex[2]) > 2 {
524- drawframe_angle = a.frames[a.drawidx].Ex[2][2]
525- }
526- }
527- if len(a.frames[a.drawidx+1].Ex) > 2 {
528- if len(a.frames[a.drawidx+1].Ex[2]) > 2 {
529- nextframe_angle = a.frames[a.drawidx+1].Ex[2][2]
530- }
531- }
532- a.angle += (nextframe_angle - drawframe_angle) / float32(a.curFrame().Time) * float32(a.time)
533- break
534- }
535- }
536- if byte(a.interpolate_blend_srcalpha) != 1 ||
537- byte(a.interpolate_blend_dstalpha) != 255 {
538- for _, i := range a.interpolate_blend {
539- if a.drawidx+1 == i {
540- a.interpolate_blend_srcalpha += (float32(a.frames[a.drawidx+1].SrcAlpha) - a.interpolate_blend_srcalpha) / float32(a.curFrame().Time) * float32(a.time)
541- a.interpolate_blend_dstalpha += (float32(a.frames[a.drawidx+1].DstAlpha) - a.interpolate_blend_dstalpha) / float32(a.curFrame().Time) * float32(a.time)
542- if byte(a.interpolate_blend_srcalpha) == 1 && byte(a.interpolate_blend_dstalpha) == 255 {
543- a.interpolate_blend_srcalpha = 0
544- }
545- break
546- }
547- }
548- }
549- }
550451 }
551452 func (a *Animation) Action() {
552453 if len(a.frames) == 0 {
@@ -594,7 +495,7 @@ func (a *Animation) alpha() int32 {
594495 if a.srcAlpha >= 0 {
595496 sa = byte(a.srcAlpha)
596497 if a.dstAlpha < 0 {
597- da = byte((^a.dstAlpha + int16(a.interpolate_blend_dstalpha)) >> 1)
498+ da = byte((^a.dstAlpha + int16(a.frames[a.drawidx].DstAlpha)) >> 1)
598499 if sa == 1 && da == 255 {
599500 sa = 0
600501 }
@@ -602,8 +503,11 @@ func (a *Animation) alpha() int32 {
602503 da = byte(a.dstAlpha)
603504 }
604505 } else {
605- sa = byte(a.interpolate_blend_srcalpha)
606- da = byte(a.interpolate_blend_dstalpha)
506+ sa = a.frames[a.drawidx].SrcAlpha
507+ da = a.frames[a.drawidx].DstAlpha
508+ if sa == 255 && da == 1 {
509+ da = 255
510+ }
607511 }
608512 if sa == 1 && da == 255 {
609513 return -2
@@ -629,28 +533,39 @@ func (a *Animation) pal(pfx *PalFX, neg bool) (p []uint32) {
629533 if pfx != nil && len(pfx.remap) > 0 {
630534 a.sff.palList.SwapPalMap(&pfx.remap)
631535 }
632- return
536+ if len(p) == 0 {
537+ return
538+ }
539+ return pfx.getFxPal(p, neg)
633540 }
634-func (a *Animation) drawSub1(angle, facing float32) (h, v, agl float32) {
541+func (a *Animation) drawSub1(angle float32) (h, v, agl float32) {
635542 h, v = float32(a.frames[a.drawidx].H), float32(a.frames[a.drawidx].V)
636- agl = angle
637- h *= a.scale_x
638- v *= a.scale_y
639- agl += a.angle * facing
543+ agl = float32(float64(angle) * math.Pi / 180)
544+ if len(a.frames[a.drawidx].Ex) > 2 {
545+ if len(a.frames[a.drawidx].Ex[2]) > 0 {
546+ h *= a.frames[a.drawidx].Ex[2][0]
547+ if len(a.frames[a.drawidx].Ex[2]) > 1 {
548+ v *= a.frames[a.drawidx].Ex[2][1]
549+ if len(a.frames[a.drawidx].Ex[2]) > 2 {
550+ agl += a.frames[a.drawidx].Ex[2][2]
551+ }
552+ }
553+ }
554+ }
640555 return
641556 }
642557 func (a *Animation) Draw(window *[4]int32, x, y, xcs, ycs, xs, xbs, ys,
643- rxadd, angle, yangle, xangle, rcx float32, pfx *PalFX, old bool, facing float32) {
558+ rxadd, angle, rcx float32, pfx *PalFX, old bool) {
644559 if a.spr == nil || a.spr.Tex == nil {
645560 return
646561 }
647- h, v, angle := a.drawSub1(angle, facing)
562+ h, v, angle := a.drawSub1(angle)
648563 xs *= xcs * h
649564 ys *= ycs * v
650- x = xcs*x + xs*(float32(a.frames[a.drawidx].X)+a.interpolate_offset_x)*(1/a.scale_x)
651- y = ycs*y + ys*(float32(a.frames[a.drawidx].Y)+a.interpolate_offset_y)*(1/a.scale_y)
565+ x = xcs*x + xs*float32(a.frames[a.drawidx].X)
566+ y = ycs*y + ys*float32(a.frames[a.drawidx].Y)
652567 var rcy float32
653- if angle == 0 && yangle == 0 && xangle == 0 {
568+ if angle == 0 {
654569 if xs < 0 {
655570 x *= -1
656571 if old {
@@ -691,33 +606,32 @@ func (a *Animation) Draw(window *[4]int32, x, y, xcs, ycs, xs, xbs, ys,
691606 trans := a.alpha()
692607 a.spr.glDraw(a.pal(pfx, trans == -2), int32(a.mask), x*sys.widthScale,
693608 y*sys.heightScale, &a.tile, xs*sys.widthScale, xcs*xbs*h*sys.widthScale,
694- ys*sys.heightScale, xcs*rxadd*sys.widthScale/sys.heightScale, angle, yangle, xangle,
609+ ys*sys.heightScale, xcs*rxadd*sys.widthScale/sys.heightScale, angle,
695610 trans, window, rcx, rcy, pfx)
696611 }
697-func (a *Animation) ShadowDraw(x, y, xscl, yscl, vscl, angle, yangle, xangle float32,
698- pfx *PalFX, old bool, color uint32, alpha int32, facing float32) {
612+func (a *Animation) ShadowDraw(x, y, xscl, yscl, vscl, angle float32,
613+ pfx *PalFX, old bool, color uint32, alpha int32) {
699614 if a.spr == nil || a.spr.Tex == nil {
700615 return
701616 }
702- h, v, angle := a.drawSub1(angle, facing)
703- angle = -angle
704- x += xscl * h * (float32(a.frames[a.drawidx].X) + a.interpolate_offset_x)
705- y += yscl * vscl * v * (float32(a.frames[a.drawidx].Y) + a.interpolate_offset_y)
617+ h, v, angle := a.drawSub1(angle)
618+ x += xscl * h * float32(a.frames[a.drawidx].X)
619+ y += yscl * vscl * v * float32(a.frames[a.drawidx].Y)
706620 var draw func(int32)
707- if a.spr.rle <= -11 {
621+ if a.spr.rle == -12 {
708622 draw = func(trans int32) {
709623 RenderMugenFcS(*a.spr.Tex, a.spr.Size,
710624 AbsF(xscl*h)*float32(a.spr.Offset[0])*sys.widthScale,
711625 AbsF(yscl*v)*float32(a.spr.Offset[1])*sys.heightScale, &a.tile,
712626 xscl*h*sys.widthScale, xscl*h*sys.widthScale,
713- yscl*v*sys.heightScale, vscl, 0, angle, yangle, xangle, trans, &sys.scrrect,
627+ yscl*v*sys.heightScale, vscl, 0, angle, trans, &sys.scrrect,
714628 (x+float32(sys.gameWidth)/2)*sys.widthScale, y*sys.heightScale, color)
715629 }
716630 } else {
717631 var pal [256]uint32
718- if color != 0 || alpha > 0 {
632+ if color != 0 {
719633 for i := range pal {
720- pal[i] = color | 0xff000000
634+ pal[i] = color
721635 }
722636 }
723637 draw = func(trans int32) {
@@ -725,11 +639,11 @@ func (a *Animation) ShadowDraw(x, y, xscl, yscl, vscl, angle, yangle, xangle flo
725639 AbsF(xscl*h)*float32(a.spr.Offset[0])*sys.widthScale,
726640 AbsF(yscl*v)*float32(a.spr.Offset[1])*sys.heightScale, &a.tile,
727641 xscl*h*sys.widthScale, xscl*h*sys.widthScale,
728- yscl*v*sys.heightScale, vscl, 0, angle, yangle, xangle, trans, &sys.scrrect,
642+ yscl*v*sys.heightScale, vscl, 0, angle, trans, &sys.scrrect,
729643 (x+float32(sys.gameWidth)/2)*sys.widthScale, y*sys.heightScale)
730644 }
731645 }
732- if color != 0 {
646+ if int32(color) > 0 {
733647 draw(-2)
734648 }
735649 if alpha > 0 {
@@ -789,13 +703,10 @@ type SprData struct {
789703 alpha [2]int32
790704 priority int32
791705 angle float32
792- yangle float32
793- xangle float32
794706 ascl [2]float32
795707 screen bool
796708 bright bool
797709 oldVer bool
798- facing float32
799710 }
800711 type DrawList []*SprData
801712
@@ -850,7 +761,7 @@ func (dl DrawList) draw(x, y, scl float32) {
850761 (y - s.pos[1])}
851762 }
852763 s.anim.Draw(&sys.scrrect, p[0], p[1], cs, cs, s.scl[0], s.scl[0],
853- s.scl[1], 0, s.angle, s.yangle, s.xangle, float32(sys.gameWidth)/2, s.fx, s.oldVer, s.facing)
764+ s.scl[1], 0, s.angle, float32(sys.gameWidth)/2, s.fx, s.oldVer)
854765 sys.brightness = ob
855766 }
856767 }
@@ -886,9 +797,6 @@ func (sl ShadowList) draw(x, y, scl float32) {
886797 for _, s := range sl {
887798 intensity := sys.stage.sdw.intensity
888799 color, alpha := s.shadowColor, s.shadowAlpha
889- if alpha >= 255 {
890- alpha = int32(255 - s.anim.interpolate_blend_dstalpha)
891- }
892800 fend := float32(sys.stage.sdw.fadeend) * sys.stage.localscl
893801 fbgn := float32(sys.stage.sdw.fadebgn) * sys.stage.localscl
894802 if fbgn <= fend {
@@ -911,15 +819,18 @@ func (sl ShadowList) draw(x, y, scl float32) {
911819 s.anim.ShadowDraw(sys.cam.Offset[0]-(x-s.pos[0])*scl,
912820 sys.cam.GroundLevel()+sys.cam.Offset[1]-sys.envShake.getOffset()-
913821 (y+s.pos[1]*sys.stage.sdw.yscale-s.offsetY)*scl,
914- scl*s.scl[0], scl*-s.scl[1], sys.stage.sdw.yscale, s.angle, s.yangle, s.xangle,
915- &sys.bgPalFX, s.oldVer, uint32(color), intensity, s.facing)
822+ scl*s.scl[0], scl*-s.scl[1], sys.stage.sdw.yscale, -s.angle,
823+ &sys.bgPalFX, s.oldVer, uint32(color), intensity)
916824 }
917825 }
918826 func (sl ShadowList) drawReflection(x, y, scl float32) {
919827 for _, s := range sl {
920828 if s.alpha[0] < 0 {
921- s.anim.srcAlpha = int16(s.anim.interpolate_blend_srcalpha)
922- s.anim.dstAlpha = int16(s.anim.interpolate_blend_dstalpha)
829+ s.anim.srcAlpha = int16(s.anim.frames[s.anim.drawidx].SrcAlpha)
830+ s.anim.dstAlpha = int16(s.anim.frames[s.anim.drawidx].DstAlpha)
831+ if s.anim.srcAlpha == 255 && s.anim.dstAlpha == 1 {
832+ s.anim.dstAlpha = 255
833+ }
923834 } else {
924835 s.anim.srcAlpha, s.anim.dstAlpha = int16(s.alpha[0]), int16(s.alpha[1])
925836 }
@@ -935,7 +846,7 @@ func (sl ShadowList) drawReflection(x, y, scl float32) {
935846 s.anim.Draw(&sys.scrrect, sys.cam.Offset[0]/scl-(x-s.pos[0]),
936847 (sys.cam.GroundLevel()+sys.cam.Offset[1]-sys.envShake.getOffset())/scl-
937848 (y+s.pos[1]-s.offsetY), scl, scl, s.scl[0], s.scl[0], -s.scl[1], 0,
938- -s.angle, -s.yangle, -s.xangle, float32(sys.gameWidth)/2, s.fx, s.oldVer, s.facing)
849+ -s.angle, float32(sys.gameWidth)/2, s.fx, s.oldVer)
939850 }
940851 }
941852
@@ -961,8 +872,8 @@ func (a *Anim) AddPos(x, y float32) {
961872 a.x += x
962873 a.y += y
963874 }
964-func (a *Anim) SetTile(x, y, sx, sy int32) {
965- a.anim.tile[2], a.anim.tile[3], a.anim.tile[0], a.anim.tile[1] = x, y, sx, sy
875+func (a *Anim) SetTile(x, y int32) {
876+ a.anim.tile[2], a.anim.tile[3] = x, y
966877 }
967878 func (a *Anim) SetColorKey(mask int16) {
968879 a.anim.mask = mask
@@ -986,9 +897,6 @@ func (a *Anim) Draw() {
986897 if !sys.frameSkip {
987898 a.anim.Draw(&a.window, a.x+float32(sys.gameWidth-320)/2,
988899 a.y+float32(sys.gameHeight-240), 1, 1, a.xscl, a.xscl, a.yscl,
989- 0, 0, 0, 0, 0, nil, false, 1)
900+ 0, 0, 0, nil, false)
990901 }
991902 }
992-func (a *Anim) ResetFrames() {
993- a.anim.Reset()
994-}
--- a/src/bytecode.go
+++ b/src/bytecode.go
@@ -566,7 +566,12 @@ func (_ BytecodeExp) pow(v1 *BytecodeValue, v2 BytecodeValue, pn int) {
566566 if ValueType(Min(int32(v1.t), int32(v2.t))) == VT_Float {
567567 v1.SetF(Pow(v1.ToF(), v2.ToF()))
568568 } else if v2.ToF() < 0 {
569- v1.SetF(Pow(v1.ToF(), v2.ToF()))
569+ if sys.cgi[pn].ver[0] == 1 {
570+ v1.SetF(Pow(v1.ToF(), v2.ToF()))
571+ } else {
572+ f := Pow(v1.ToF(), v2.ToF())
573+ v1.SetI(*(*int32)(unsafe.Pointer(&f)) << 29)
574+ }
570575 } else {
571576 i1, i2, hb := v1.ToI(), v2.ToI(), int32(-1)
572577 for uint32(i2)>>uint(hb+1) != 0 {
@@ -986,9 +991,9 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
986991 case OC_bottomedge:
987992 sys.bcStack.PushF(c.bottomEdge())
988993 case OC_camerapos_x:
989- sys.bcStack.PushF(sys.cam.Pos[0] / oc.localscl)
994+ sys.bcStack.PushF(sys.cam.Pos[0])
990995 case OC_camerapos_y:
991- sys.bcStack.PushF(sys.cam.Pos[1] / oc.localscl)
996+ sys.bcStack.PushF(sys.cam.Pos[1])
992997 case OC_camerazoom:
993998 sys.bcStack.PushF(sys.cam.Scale)
994999 case OC_canrecover:
@@ -1008,19 +1013,11 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
10081013 case OC_frontedgedist:
10091014 sys.bcStack.PushI(int32(c.frontEdgeDist()))
10101015 case OC_gameheight:
1011- if c.gi().ver[0] == 1 && c.gi().ver[1] == 0 {
1012- sys.bcStack.PushF(sys.screenHeight() / oc.localscl)
1013- } else {
1014- sys.bcStack.PushF(c.gameHeight())
1015- }
1016+ sys.bcStack.PushF(c.gameHeight())
10161017 case OC_gametime:
10171018 sys.bcStack.PushI(sys.gameTime)
10181019 case OC_gamewidth:
1019- if c.gi().ver[0] == 1 && c.gi().ver[1] == 0 {
1020- sys.bcStack.PushF(sys.screenWidth() / oc.localscl)
1021- } else {
1022- sys.bcStack.PushF(c.gameWidth())
1023- }
1020+ sys.bcStack.PushF(c.gameWidth())
10241021 case OC_hitcount:
10251022 sys.bcStack.PushI(c.hitCount)
10261023 case OC_hitdefattr:
@@ -1035,9 +1032,9 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
10351032 case OC_hitshakeover:
10361033 sys.bcStack.PushB(c.hitShakeOver())
10371034 case OC_hitvel_x:
1038- sys.bcStack.PushF(c.hitVelX() * c.localscl / oc.localscl)
1035+ sys.bcStack.PushF(c.hitVelX())
10391036 case OC_hitvel_y:
1040- sys.bcStack.PushF(c.hitVelY() * c.localscl / oc.localscl)
1037+ sys.bcStack.PushF(c.hitVelY())
10411038 case OC_id:
10421039 sys.bcStack.PushI(c.id)
10431040 case OC_inguarddist:
@@ -1078,9 +1075,9 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
10781075 case OC_palno:
10791076 sys.bcStack.PushI(c.palno())
10801077 case OC_pos_x:
1081- sys.bcStack.PushF((c.pos[0]*c.localscl/oc.localscl - sys.cam.Pos[0]/oc.localscl))
1078+ sys.bcStack.PushF(c.pos[0] - sys.cam.Pos[0])
10821079 case OC_pos_y:
1083- sys.bcStack.PushF(c.pos[1] * c.localscl / oc.localscl)
1080+ sys.bcStack.PushF(c.pos[1])
10841081 case OC_power:
10851082 sys.bcStack.PushI(c.getPower())
10861083 case OC_powermax:
@@ -1106,13 +1103,13 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
11061103 case OC_roundstate:
11071104 sys.bcStack.PushI(c.roundState())
11081105 case OC_screenheight:
1109- sys.bcStack.PushF(sys.screenHeight() / oc.localscl)
1106+ sys.bcStack.PushF(sys.screenHeight())
11101107 case OC_screenpos_x:
1111- sys.bcStack.PushF((c.screenPosX()) / oc.localscl)
1108+ sys.bcStack.PushF(c.screenPosX())
11121109 case OC_screenpos_y:
1113- sys.bcStack.PushF((c.screenPosY()) / oc.localscl)
1110+ sys.bcStack.PushF(c.screenPosY())
11141111 case OC_screenwidth:
1115- sys.bcStack.PushF(sys.screenWidth() / oc.localscl)
1112+ sys.bcStack.PushF(sys.screenWidth())
11161113 case OC_selfanimexist:
11171114 *sys.bcStack.Top() = c.selfAnimExist(*sys.bcStack.Top())
11181115 case OC_stateno:
@@ -1121,14 +1118,10 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
11211118 sys.bcStack.PushB(c.ss.stateType == StateType(be[i]))
11221119 i++
11231120 case OC_teammode:
1124- if c.teamside == 2 {
1125- sys.bcStack.PushB(TM_Single == TeamMode(be[i]))
1126- } else {
1127- sys.bcStack.PushB(sys.tmode[c.playerNo&1] == TeamMode(be[i]))
1128- }
1121+ sys.bcStack.PushB(sys.tmode[c.playerNo&1] == TeamMode(be[i]))
11291122 i++
11301123 case OC_teamside:
1131- sys.bcStack.PushI(int32(c.teamside) + 1)
1124+ sys.bcStack.PushI(int32(c.playerNo)&1 + 1)
11321125 case OC_time:
11331126 sys.bcStack.PushI(c.time())
11341127 case OC_topedge:
@@ -1136,15 +1129,15 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
11361129 case OC_uniqhitcount:
11371130 sys.bcStack.PushI(c.uniqHitCount)
11381131 case OC_vel_x:
1139- sys.bcStack.PushF(c.vel[0] * c.localscl / oc.localscl)
1132+ sys.bcStack.PushF(c.vel[0])
11401133 case OC_vel_y:
1141- sys.bcStack.PushF(c.vel[1] * c.localscl / oc.localscl)
1134+ sys.bcStack.PushF(c.vel[1])
11421135 case OC_st_:
11431136 be.run_st(c, &i)
11441137 case OC_const_:
1145- be.run_const(c, &i, oc)
1138+ be.run_const(c, &i)
11461139 case OC_ex_:
1147- be.run_ex(c, &i, oc)
1140+ be.run_ex(c, &i)
11481141 case OC_var:
11491142 *sys.bcStack.Top() = c.varGet(sys.bcStack.Top().ToI())
11501143 case OC_sysvar:
@@ -1215,7 +1208,7 @@ func (be BytecodeExp) run_st(c *Char, i *int) {
12151208 }
12161209 }
12171210 }
1218-func (be BytecodeExp) run_const(c *Char, i *int, oc *Char) {
1211+func (be BytecodeExp) run_const(c *Char, i *int) {
12191212 (*i)++
12201213 switch be[*i-1] {
12211214 case OC_const_data_life:
@@ -1247,158 +1240,158 @@ func (be BytecodeExp) run_const(c *Char, i *int, oc *Char) {
12471240 case OC_const_size_yscale:
12481241 sys.bcStack.PushF(c.size.yscale)
12491242 case OC_const_size_ground_back:
1250- sys.bcStack.PushF(c.size.ground.back * (320 / float32(c.localcoord)) / oc.localscl)
1243+ sys.bcStack.PushI(c.size.ground.back)
12511244 case OC_const_size_ground_front:
1252- sys.bcStack.PushF(c.size.ground.front * (320 / float32(c.localcoord)) / oc.localscl)
1245+ sys.bcStack.PushI(c.size.ground.front)
12531246 case OC_const_size_air_back:
1254- sys.bcStack.PushF(c.size.air.back * (320 / float32(c.localcoord)) / oc.localscl)
1247+ sys.bcStack.PushI(c.size.air.back)
12551248 case OC_const_size_air_front:
1256- sys.bcStack.PushF(c.size.air.front * (320 / float32(c.localcoord)) / oc.localscl)
1249+ sys.bcStack.PushI(c.size.air.front)
12571250 case OC_const_size_z_width:
1258- sys.bcStack.PushF(c.size.z.width * (320 / float32(c.localcoord)) / oc.localscl)
1251+ sys.bcStack.PushI(c.size.z.width)
12591252 case OC_const_size_height:
1260- sys.bcStack.PushF(c.size.height * (320 / float32(c.localcoord)) / oc.localscl)
1253+ sys.bcStack.PushI(c.size.height)
12611254 case OC_const_size_attack_dist:
1262- sys.bcStack.PushF(c.size.attack.dist * (320 / float32(c.localcoord)) / oc.localscl)
1255+ sys.bcStack.PushI(c.size.attack.dist)
12631256 case OC_const_size_attack_z_width_back:
1264- sys.bcStack.PushF(c.size.attack.z.width[1] * (320 / float32(c.localcoord)) / oc.localscl)
1257+ sys.bcStack.PushI(c.size.attack.z.width[1])
12651258 case OC_const_size_attack_z_width_front:
1266- sys.bcStack.PushF(c.size.attack.z.width[0] * (320 / float32(c.localcoord)) / oc.localscl)
1259+ sys.bcStack.PushI(c.size.attack.z.width[0])
12671260 case OC_const_size_proj_attack_dist:
1268- sys.bcStack.PushF(c.size.proj.attack.dist * (320 / float32(c.localcoord)) / oc.localscl)
1261+ sys.bcStack.PushI(c.size.proj.attack.dist)
12691262 case OC_const_size_proj_doscale:
12701263 sys.bcStack.PushI(c.size.proj.doscale)
12711264 case OC_const_size_head_pos_x:
1272- sys.bcStack.PushF(c.size.head.pos[0] * (320 / float32(c.localcoord)) / oc.localscl)
1265+ sys.bcStack.PushI(c.size.head.pos[0])
12731266 case OC_const_size_head_pos_y:
1274- sys.bcStack.PushF(c.size.head.pos[1] * (320 / float32(c.localcoord)) / oc.localscl)
1267+ sys.bcStack.PushI(c.size.head.pos[1])
12751268 case OC_const_size_mid_pos_x:
1276- sys.bcStack.PushF(c.size.mid.pos[0] * (320 / float32(c.localcoord)) / oc.localscl)
1269+ sys.bcStack.PushI(c.size.mid.pos[0])
12771270 case OC_const_size_mid_pos_y:
1278- sys.bcStack.PushF(c.size.mid.pos[1] * (320 / float32(c.localcoord)) / oc.localscl)
1271+ sys.bcStack.PushI(c.size.mid.pos[1])
12791272 case OC_const_size_shadowoffset:
1280- sys.bcStack.PushF(c.size.shadowoffset * (320 / float32(c.localcoord)) / oc.localscl)
1273+ sys.bcStack.PushI(c.size.shadowoffset)
12811274 case OC_const_size_draw_offset_x:
1282- sys.bcStack.PushF(c.size.draw.offset[0] * (320 / float32(c.localcoord)) / oc.localscl)
1275+ sys.bcStack.PushI(c.size.draw.offset[0])
12831276 case OC_const_size_draw_offset_y:
1284- sys.bcStack.PushF(c.size.draw.offset[1] * (320 / float32(c.localcoord)) / oc.localscl)
1277+ sys.bcStack.PushI(c.size.draw.offset[1])
12851278 case OC_const_velocity_walk_fwd_x:
1286- sys.bcStack.PushF(c.gi().velocity.walk.fwd * (320 / float32(c.localcoord)) / oc.localscl)
1279+ sys.bcStack.PushF(c.gi().velocity.walk.fwd)
12871280 case OC_const_velocity_walk_back_x:
1288- sys.bcStack.PushF(c.gi().velocity.walk.back * (320 / float32(c.localcoord)) / oc.localscl)
1281+ sys.bcStack.PushF(c.gi().velocity.walk.back)
12891282 case OC_const_velocity_walk_up_x:
1290- sys.bcStack.PushF(c.gi().velocity.walk.up.x * (320 / float32(c.localcoord)) / oc.localscl)
1283+ sys.bcStack.PushF(c.gi().velocity.walk.up.x)
12911284 case OC_const_velocity_walk_down_x:
1292- sys.bcStack.PushF(c.gi().velocity.walk.down.x * (320 / float32(c.localcoord)) / oc.localscl)
1285+ sys.bcStack.PushF(c.gi().velocity.walk.down.x)
12931286 case OC_const_velocity_run_fwd_x:
1294- sys.bcStack.PushF(c.gi().velocity.run.fwd[0] * (320 / float32(c.localcoord)) / oc.localscl)
1287+ sys.bcStack.PushF(c.gi().velocity.run.fwd[0])
12951288 case OC_const_velocity_run_fwd_y:
1296- sys.bcStack.PushF(c.gi().velocity.run.fwd[1] * (320 / float32(c.localcoord)) / oc.localscl)
1289+ sys.bcStack.PushF(c.gi().velocity.run.fwd[1])
12971290 case OC_const_velocity_run_back_x:
1298- sys.bcStack.PushF(c.gi().velocity.run.back[0] * (320 / float32(c.localcoord)) / oc.localscl)
1291+ sys.bcStack.PushF(c.gi().velocity.run.back[0])
12991292 case OC_const_velocity_run_back_y:
1300- sys.bcStack.PushF(c.gi().velocity.run.back[1] * (320 / float32(c.localcoord)) / oc.localscl)
1293+ sys.bcStack.PushF(c.gi().velocity.run.back[1])
13011294 case OC_const_velocity_run_up_x:
1302- sys.bcStack.PushF(c.gi().velocity.run.up.x * (320 / float32(c.localcoord)) / oc.localscl)
1295+ sys.bcStack.PushF(c.gi().velocity.run.up.x)
13031296 case OC_const_velocity_run_up_y:
1304- sys.bcStack.PushF(c.gi().velocity.run.up.y * (320 / float32(c.localcoord)) / oc.localscl)
1297+ sys.bcStack.PushF(c.gi().velocity.run.up.y)
13051298 case OC_const_velocity_run_down_x:
1306- sys.bcStack.PushF(c.gi().velocity.run.down.x * (320 / float32(c.localcoord)) / oc.localscl)
1299+ sys.bcStack.PushF(c.gi().velocity.run.down.x)
13071300 case OC_const_velocity_run_down_y:
1308- sys.bcStack.PushF(c.gi().velocity.run.down.y * (320 / float32(c.localcoord)) / oc.localscl)
1301+ sys.bcStack.PushF(c.gi().velocity.run.down.y)
13091302 case OC_const_velocity_jump_y:
1310- sys.bcStack.PushF(c.gi().velocity.jump.neu[1] * (320 / float32(c.localcoord)) / oc.localscl)
1303+ sys.bcStack.PushF(c.gi().velocity.jump.neu[1])
13111304 case OC_const_velocity_jump_neu_x:
1312- sys.bcStack.PushF(c.gi().velocity.jump.neu[0] * (320 / float32(c.localcoord)) / oc.localscl)
1305+ sys.bcStack.PushF(c.gi().velocity.jump.neu[0])
13131306 case OC_const_velocity_jump_back_x:
1314- sys.bcStack.PushF(c.gi().velocity.jump.back * (320 / float32(c.localcoord)) / oc.localscl)
1307+ sys.bcStack.PushF(c.gi().velocity.jump.back)
13151308 case OC_const_velocity_jump_fwd_x:
1316- sys.bcStack.PushF(c.gi().velocity.jump.fwd * (320 / float32(c.localcoord)) / oc.localscl)
1309+ sys.bcStack.PushF(c.gi().velocity.jump.fwd)
13171310 case OC_const_velocity_jump_up_x:
1318- sys.bcStack.PushF(c.gi().velocity.jump.up.x * (320 / float32(c.localcoord)) / oc.localscl)
1311+ sys.bcStack.PushF(c.gi().velocity.jump.up.x)
13191312 case OC_const_velocity_jump_down_x:
1320- sys.bcStack.PushF(c.gi().velocity.jump.down.x * (320 / float32(c.localcoord)) / oc.localscl)
1313+ sys.bcStack.PushF(c.gi().velocity.jump.down.x)
13211314 case OC_const_velocity_runjump_back_x:
1322- sys.bcStack.PushF(c.gi().velocity.runjump.back[0] * (320 / float32(c.localcoord)) / oc.localscl)
1315+ sys.bcStack.PushF(c.gi().velocity.runjump.back[0])
13231316 case OC_const_velocity_runjump_back_y:
1324- sys.bcStack.PushF(c.gi().velocity.runjump.back[1] * (320 / float32(c.localcoord)) / oc.localscl)
1317+ sys.bcStack.PushF(c.gi().velocity.runjump.back[1])
13251318 case OC_const_velocity_runjump_y:
1326- sys.bcStack.PushF(c.gi().velocity.runjump.fwd[1] * (320 / float32(c.localcoord)) / oc.localscl)
1319+ sys.bcStack.PushF(c.gi().velocity.runjump.fwd[1])
13271320 case OC_const_velocity_runjump_fwd_x:
1328- sys.bcStack.PushF(c.gi().velocity.runjump.fwd[0] * (320 / float32(c.localcoord)) / oc.localscl)
1321+ sys.bcStack.PushF(c.gi().velocity.runjump.fwd[0])
13291322 case OC_const_velocity_runjump_up_x:
1330- sys.bcStack.PushF(c.gi().velocity.runjump.up.x * (320 / float32(c.localcoord)) / oc.localscl)
1323+ sys.bcStack.PushF(c.gi().velocity.runjump.up.x)
13311324 case OC_const_velocity_runjump_down_x:
1332- sys.bcStack.PushF(c.gi().velocity.runjump.down.x * (320 / float32(c.localcoord)) / oc.localscl)
1325+ sys.bcStack.PushF(c.gi().velocity.runjump.down.x)
13331326 case OC_const_velocity_airjump_y:
1334- sys.bcStack.PushF(c.gi().velocity.airjump.neu[1] * (320 / float32(c.localcoord)) / oc.localscl)
1327+ sys.bcStack.PushF(c.gi().velocity.airjump.neu[1])
13351328 case OC_const_velocity_airjump_neu_x:
1336- sys.bcStack.PushF(c.gi().velocity.airjump.neu[0] * (320 / float32(c.localcoord)) / oc.localscl)
1329+ sys.bcStack.PushF(c.gi().velocity.airjump.neu[0])
13371330 case OC_const_velocity_airjump_back_x:
1338- sys.bcStack.PushF(c.gi().velocity.airjump.back * (320 / float32(c.localcoord)) / oc.localscl)
1331+ sys.bcStack.PushF(c.gi().velocity.airjump.back)
13391332 case OC_const_velocity_airjump_fwd_x:
1340- sys.bcStack.PushF(c.gi().velocity.airjump.fwd * (320 / float32(c.localcoord)) / oc.localscl)
1333+ sys.bcStack.PushF(c.gi().velocity.airjump.fwd)
13411334 case OC_const_velocity_airjump_up_x:
1342- sys.bcStack.PushF(c.gi().velocity.airjump.up.x * (320 / float32(c.localcoord)) / oc.localscl)
1335+ sys.bcStack.PushF(c.gi().velocity.airjump.up.x)
13431336 case OC_const_velocity_airjump_down_x:
1344- sys.bcStack.PushF(c.gi().velocity.airjump.down.x * (320 / float32(c.localcoord)) / oc.localscl)
1337+ sys.bcStack.PushF(c.gi().velocity.airjump.down.x)
13451338 case OC_const_velocity_air_gethit_groundrecover_x:
1346- sys.bcStack.PushF(c.gi().velocity.air.gethit.groundrecover[0] * (320 / float32(c.localcoord)) / oc.localscl)
1339+ sys.bcStack.PushF(c.gi().velocity.air.gethit.groundrecover[0])
13471340 case OC_const_velocity_air_gethit_groundrecover_y:
1348- sys.bcStack.PushF(c.gi().velocity.air.gethit.groundrecover[1] * (320 / float32(c.localcoord)) / oc.localscl)
1341+ sys.bcStack.PushF(c.gi().velocity.air.gethit.groundrecover[1])
13491342 case OC_const_velocity_air_gethit_airrecover_mul_x:
13501343 sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.mul[0])
13511344 case OC_const_velocity_air_gethit_airrecover_mul_y:
13521345 sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.mul[1])
13531346 case OC_const_velocity_air_gethit_airrecover_add_x:
1354- sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.add[0] * (320 / float32(c.localcoord)) / oc.localscl)
1347+ sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.add[0])
13551348 case OC_const_velocity_air_gethit_airrecover_add_y:
1356- sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.add[1] * (320 / float32(c.localcoord)) / oc.localscl)
1349+ sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.add[1])
13571350 case OC_const_velocity_air_gethit_airrecover_back:
1358- sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.back * (320 / float32(c.localcoord)) / oc.localscl)
1351+ sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.back)
13591352 case OC_const_velocity_air_gethit_airrecover_fwd:
1360- sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.fwd * (320 / float32(c.localcoord)) / oc.localscl)
1353+ sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.fwd)
13611354 case OC_const_velocity_air_gethit_airrecover_up:
1362- sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.up * (320 / float32(c.localcoord)) / oc.localscl)
1355+ sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.up)
13631356 case OC_const_velocity_air_gethit_airrecover_down:
1364- sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.down * (320 / float32(c.localcoord)) / oc.localscl)
1357+ sys.bcStack.PushF(c.gi().velocity.air.gethit.airrecover.down)
13651358 case OC_const_movement_airjump_num:
13661359 sys.bcStack.PushI(c.gi().movement.airjump.num)
13671360 case OC_const_movement_airjump_height:
1368- sys.bcStack.PushI(int32(float32(c.gi().movement.airjump.height) * (320 / float32(c.localcoord)) / oc.localscl))
1361+ sys.bcStack.PushI(c.gi().movement.airjump.height)
13691362 case OC_const_movement_yaccel:
1370- sys.bcStack.PushF(c.gi().movement.yaccel * (320 / float32(c.localcoord)) / oc.localscl)
1363+ sys.bcStack.PushF(c.gi().movement.yaccel)
13711364 case OC_const_movement_stand_friction:
13721365 sys.bcStack.PushF(c.gi().movement.stand.friction)
13731366 case OC_const_movement_crouch_friction:
13741367 sys.bcStack.PushF(c.gi().movement.crouch.friction)
13751368 case OC_const_movement_stand_friction_threshold:
1376- sys.bcStack.PushF(c.gi().movement.stand.friction_threshold * (320 / float32(c.localcoord)) / oc.localscl)
1369+ sys.bcStack.PushF(c.gi().movement.stand.friction_threshold)
13771370 case OC_const_movement_crouch_friction_threshold:
1378- sys.bcStack.PushF(c.gi().movement.crouch.friction_threshold * (320 / float32(c.localcoord)) / oc.localscl)
1371+ sys.bcStack.PushF(c.gi().movement.crouch.friction_threshold)
13791372 case OC_const_movement_air_gethit_groundlevel:
1380- sys.bcStack.PushF(c.gi().movement.air.gethit.groundlevel * (320 / float32(c.localcoord)) / oc.localscl)
1373+ sys.bcStack.PushF(c.gi().movement.air.gethit.groundlevel)
13811374 case OC_const_movement_air_gethit_groundrecover_ground_threshold:
13821375 sys.bcStack.PushF(
1383- c.gi().movement.air.gethit.groundrecover.ground.threshold * (320 / float32(c.localcoord)) / oc.localscl)
1376+ c.gi().movement.air.gethit.groundrecover.ground.threshold)
13841377 case OC_const_movement_air_gethit_groundrecover_groundlevel:
1385- sys.bcStack.PushF(c.gi().movement.air.gethit.groundrecover.groundlevel * (320 / float32(c.localcoord)) / oc.localscl)
1378+ sys.bcStack.PushF(c.gi().movement.air.gethit.groundrecover.groundlevel)
13861379 case OC_const_movement_air_gethit_airrecover_threshold:
1387- sys.bcStack.PushF(c.gi().movement.air.gethit.airrecover.threshold * (320 / float32(c.localcoord)) / oc.localscl)
1380+ sys.bcStack.PushF(c.gi().movement.air.gethit.airrecover.threshold)
13881381 case OC_const_movement_air_gethit_airrecover_yaccel:
1389- sys.bcStack.PushF(c.gi().movement.air.gethit.airrecover.yaccel * (320 / float32(c.localcoord)) / oc.localscl)
1382+ sys.bcStack.PushF(c.gi().movement.air.gethit.airrecover.yaccel)
13901383 case OC_const_movement_air_gethit_trip_groundlevel:
1391- sys.bcStack.PushF(c.gi().movement.air.gethit.trip.groundlevel * (320 / float32(c.localcoord)) / oc.localscl)
1384+ sys.bcStack.PushF(c.gi().movement.air.gethit.trip.groundlevel)
13921385 case OC_const_movement_down_bounce_offset_x:
1393- sys.bcStack.PushF(c.gi().movement.down.bounce.offset[0] * (320 / float32(c.localcoord)) / oc.localscl)
1386+ sys.bcStack.PushF(c.gi().movement.down.bounce.offset[0])
13941387 case OC_const_movement_down_bounce_offset_y:
1395- sys.bcStack.PushF(c.gi().movement.down.bounce.offset[1] * (320 / float32(c.localcoord)) / oc.localscl)
1388+ sys.bcStack.PushF(c.gi().movement.down.bounce.offset[1])
13961389 case OC_const_movement_down_bounce_yaccel:
1397- sys.bcStack.PushF(c.gi().movement.down.bounce.yaccel * (320 / float32(c.localcoord)) / oc.localscl)
1390+ sys.bcStack.PushF(c.gi().movement.down.bounce.yaccel)
13981391 case OC_const_movement_down_bounce_groundlevel:
1399- sys.bcStack.PushF(c.gi().movement.down.bounce.groundlevel * (320 / float32(c.localcoord)) / oc.localscl)
1392+ sys.bcStack.PushF(c.gi().movement.down.bounce.groundlevel)
14001393 case OC_const_movement_down_friction_threshold:
1401- sys.bcStack.PushF(c.gi().movement.down.friction_threshold * (320 / float32(c.localcoord)) / oc.localscl)
1394+ sys.bcStack.PushF(c.gi().movement.down.friction_threshold)
14021395 case OC_const_authorname:
14031396 sys.bcStack.PushB(c.gi().authorLow ==
14041397 sys.stringPool[sys.workingState.playerNo].List[*(*int32)(
@@ -1448,13 +1441,13 @@ func (be BytecodeExp) run_const(c *Char, i *int, oc *Char) {
14481441 c.panic()
14491442 }
14501443 }
1451-func (be BytecodeExp) run_ex(c *Char, i *int, oc *Char) {
1444+func (be BytecodeExp) run_ex(c *Char, i *int) {
14521445 (*i)++
14531446 switch be[*i-1] {
14541447 case OC_ex_drawgame:
14551448 sys.bcStack.PushB(c.drawgame())
14561449 case OC_ex_ishometeam:
1457- sys.bcStack.PushB(c.teamside == sys.home)
1450+ sys.bcStack.PushB(c.playerNo&1 == sys.home)
14581451 case OC_ex_lose:
14591452 sys.bcStack.PushB(c.lose())
14601453 case OC_ex_loseko:
@@ -1478,19 +1471,19 @@ func (be BytecodeExp) run_ex(c *Char, i *int, oc *Char) {
14781471 case OC_ex_winperfect:
14791472 sys.bcStack.PushB(c.winPerfect())
14801473 case OC_ex_p2dist_x:
1481- sys.bcStack.Push(c.rdDistX(c.p2(), oc))
1474+ sys.bcStack.Push(c.rdDistX(c.p2()))
14821475 case OC_ex_p2dist_y:
1483- sys.bcStack.Push(c.rdDistY(c.p2(), oc))
1476+ sys.bcStack.Push(c.rdDistY(c.p2()))
14841477 case OC_ex_p2bodydist_x:
1485- sys.bcStack.Push(c.p2BodyDistX(oc))
1478+ sys.bcStack.Push(c.p2BodyDistX())
14861479 case OC_ex_rootdist_x:
1487- sys.bcStack.Push(c.rdDistX(c.root(), oc))
1480+ sys.bcStack.Push(c.rdDistX(c.root()))
14881481 case OC_ex_rootdist_y:
1489- sys.bcStack.Push(c.rdDistY(c.root(), oc))
1482+ sys.bcStack.Push(c.rdDistY(c.root()))
14901483 case OC_ex_parentdist_x:
1491- sys.bcStack.Push(c.rdDistX(c.parent(), oc))
1484+ sys.bcStack.Push(c.rdDistX(c.parent()))
14921485 case OC_ex_parentdist_y:
1493- sys.bcStack.Push(c.rdDistY(c.parent(), oc))
1486+ sys.bcStack.Push(c.rdDistY(c.parent()))
14941487 case OC_ex_gethitvar_animtype:
14951488 sys.bcStack.PushI(int32(c.gethitAnimtype()))
14961489 case OC_ex_gethitvar_airtype:
@@ -1514,15 +1507,15 @@ func (be BytecodeExp) run_ex(c *Char, i *int, oc *Char) {
15141507 case OC_ex_gethitvar_recovertime:
15151508 sys.bcStack.PushI(c.recoverTime)
15161509 case OC_ex_gethitvar_xoff:
1517- sys.bcStack.PushF(c.ghv.xoff * c.localscl / oc.localscl)
1510+ sys.bcStack.PushF(c.ghv.xoff)
15181511 case OC_ex_gethitvar_yoff:
1519- sys.bcStack.PushF(c.ghv.yoff * c.localscl / oc.localscl)
1512+ sys.bcStack.PushF(c.ghv.yoff)
15201513 case OC_ex_gethitvar_xvel:
1521- sys.bcStack.PushF(c.ghv.xvel * c.facing * c.localscl / oc.localscl)
1514+ sys.bcStack.PushF(c.ghv.xvel * c.facing)
15221515 case OC_ex_gethitvar_yvel:
1523- sys.bcStack.PushF(c.ghv.yvel * c.localscl / oc.localscl)
1516+ sys.bcStack.PushF(c.ghv.yvel)
15241517 case OC_ex_gethitvar_yaccel:
1525- sys.bcStack.PushF(c.ghv.getYaccel(oc) * c.localscl / oc.localscl)
1518+ sys.bcStack.PushF(c.ghv.getYaccel())
15261519 case OC_ex_gethitvar_chainid:
15271520 sys.bcStack.PushI(c.ghv.chainId())
15281521 case OC_ex_gethitvar_guarded:
@@ -1534,9 +1527,9 @@ func (be BytecodeExp) run_ex(c *Char, i *int, oc *Char) {
15341527 case OC_ex_gethitvar_fall_damage:
15351528 sys.bcStack.PushI(c.ghv.fall.damage)
15361529 case OC_ex_gethitvar_fall_xvel:
1537- sys.bcStack.PushF(c.ghv.fall.xvel() * c.localscl / oc.localscl)
1530+ sys.bcStack.PushF(c.ghv.fall.xvel())
15381531 case OC_ex_gethitvar_fall_yvel:
1539- sys.bcStack.PushF(c.ghv.fall.yvelocity * c.localscl / oc.localscl)
1532+ sys.bcStack.PushF(c.ghv.fall.yvelocity)
15401533 case OC_ex_gethitvar_fall_recover:
15411534 sys.bcStack.PushB(c.ghv.fall.recover)
15421535 case OC_ex_gethitvar_fall_time:
@@ -1550,9 +1543,9 @@ func (be BytecodeExp) run_ex(c *Char, i *int, oc *Char) {
15501543 case OC_ex_gethitvar_fall_envshake_freq:
15511544 sys.bcStack.PushF(c.ghv.fall.envshake_freq)
15521545 case OC_ex_gethitvar_fall_envshake_ampl:
1553- sys.bcStack.PushI(int32(float32(c.ghv.fall.envshake_ampl) * c.localscl / oc.localscl))
1546+ sys.bcStack.PushI(c.ghv.fall.envshake_ampl)
15541547 case OC_ex_gethitvar_fall_envshake_phase:
1555- sys.bcStack.PushF(c.ghv.fall.envshake_phase * c.localscl / oc.localscl)
1548+ sys.bcStack.PushF(c.ghv.fall.envshake_phase)
15561549 case OC_ex_majorversion:
15571550 sys.bcStack.PushI(int32(c.gi().ver[0]))
15581551 case OC_ex_drawpalno:
@@ -1799,7 +1792,7 @@ func (sc stateDef) Run(c *Char) {
17991792 case stateDef_sprpriority:
18001793 c.setSprPriority(exp[0].evalI(c))
18011794 case stateDef_facep2:
1802- if exp[0].evalB(c) && c.rdDistX(c.p2(), c).ToF() < 0 {
1795+ if exp[0].evalB(c) && c.rdDistX(c.p2()).ToF() < 0 {
18031796 c.setFacing(-c.facing)
18041797 }
18051798 case stateDef_juggle:
@@ -1829,28 +1822,20 @@ const (
18291822 hitBy_value byte = iota
18301823 hitBy_value2
18311824 hitBy_time
1832- hitBy_redirectid
18331825 )
18341826
18351827 func (sc hitBy) Run(c *Char, _ []int32) bool {
18361828 time := int32(1)
1837- crun := c
18381829 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
18391830 switch id {
18401831 case hitBy_time:
18411832 time = exp[0].evalI(c)
18421833 case hitBy_value:
1843- crun.hitby[0].time = time
1844- crun.hitby[0].flag = exp[0].evalI(c)
1834+ c.hitby[0].time = time
1835+ c.hitby[0].flag = exp[0].evalI(c)
18451836 case hitBy_value2:
1846- crun.hitby[1].time = time
1847- crun.hitby[1].flag = exp[0].evalI(c)
1848- case hitBy_redirectid:
1849- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
1850- crun = rid
1851- } else {
1852- return false
1853- }
1837+ c.hitby[1].time = time
1838+ c.hitby[1].flag = exp[0].evalI(c)
18541839 }
18551840 return true
18561841 })
@@ -1861,24 +1846,16 @@ type notHitBy hitBy
18611846
18621847 func (sc notHitBy) Run(c *Char, _ []int32) bool {
18631848 time := int32(1)
1864- crun := c
18651849 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
18661850 switch id {
18671851 case hitBy_time:
18681852 time = exp[0].evalI(c)
18691853 case hitBy_value:
1870- crun.hitby[0].time = time
1871- crun.hitby[0].flag = ^exp[0].evalI(c)
1854+ c.hitby[0].time = time
1855+ c.hitby[0].flag = ^exp[0].evalI(c)
18721856 case hitBy_value2:
1873- crun.hitby[1].time = time
1874- crun.hitby[1].flag = ^exp[0].evalI(c)
1875-
1876- case hitBy_redirectid:
1877- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
1878- crun = rid
1879- } else {
1880- return false
1881- }
1857+ c.hitby[1].time = time
1858+ c.hitby[1].flag = ^exp[0].evalI(c)
18821859 }
18831860 return true
18841861 })
@@ -1890,23 +1867,15 @@ type assertSpecial StateControllerBase
18901867 const (
18911868 assertSpecial_flag byte = iota
18921869 assertSpecial_flag_g
1893- assertSpecial_redirectid
18941870 )
18951871
18961872 func (sc assertSpecial) Run(c *Char, _ []int32) bool {
1897- crun := c
18981873 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
18991874 switch id {
19001875 case assertSpecial_flag:
1901- crun.setSF(CharSpecialFlag(exp[0].evalI(c)))
1876+ c.setSF(CharSpecialFlag(exp[0].evalI(c)))
19021877 case assertSpecial_flag_g:
19031878 sys.setSF(GlobalSpecialFlag(exp[0].evalI(c)))
1904- case assertSpecial_redirectid:
1905- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
1906- crun = rid
1907- } else {
1908- return false
1909- }
19101879 }
19111880 return true
19121881 })
@@ -1924,11 +1893,9 @@ const (
19241893 playSnd_volume
19251894 playSnd_freqmul
19261895 playSnd_loop
1927- playSnd_redirectid
19281896 )
19291897
19301898 func (sc playSnd) Run(c *Char, _ []int32) bool {
1931- crun := c
19321899 f, lw, lp := false, false, false
19331900 var g, n, ch, vo int32 = -1, 0, -1, 0
19341901 if c.gi().ver[0] == 1 {
@@ -1959,16 +1926,10 @@ func (sc playSnd) Run(c *Char, _ []int32) bool {
19591926 fr = exp[0].evalF(c)
19601927 case playSnd_loop:
19611928 lp = exp[0].evalB(c)
1962- case playSnd_redirectid:
1963- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
1964- crun = rid
1965- } else {
1966- return false
1967- }
19681929 }
19691930 return true
19701931 })
1971- crun.playSound(f, lw, lp, g, n, ch, vo, p, fr, x)
1932+ c.playSound(f, lw, lp, g, n, ch, vo, p, fr, x)
19721933 return false
19731934 }
19741935
@@ -1978,11 +1939,9 @@ const (
19781939 changeState_value byte = iota
19791940 changeState_ctrl
19801941 changeState_anim
1981- changeState_redirectid
19821942 )
19831943
19841944 func (sc changeState) Run(c *Char, _ []int32) bool {
1985- crun := c
19861945 var v, a, ctrl int32 = -1, -1, -1
19871946 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
19881947 switch id {
@@ -1992,23 +1951,16 @@ func (sc changeState) Run(c *Char, _ []int32) bool {
19921951 ctrl = exp[0].evalI(c)
19931952 case changeState_anim:
19941953 a = exp[0].evalI(c)
1995- case changeState_redirectid:
1996- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
1997- crun = rid
1998- } else {
1999- return false
2000- }
20011954 }
20021955 return true
20031956 })
2004- crun.changeState(v, a, ctrl)
1957+ c.changeState(v, a, ctrl)
20051958 return true
20061959 }
20071960
20081961 type selfState changeState
20091962
20101963 func (sc selfState) Run(c *Char, _ []int32) bool {
2011- crun := c
20121964 var v, a, ctrl int32 = -1, -1, -1
20131965 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
20141966 switch id {
@@ -2018,16 +1970,10 @@ func (sc selfState) Run(c *Char, _ []int32) bool {
20181970 ctrl = exp[0].evalI(c)
20191971 case changeState_anim:
20201972 a = exp[0].evalI(c)
2021- case changeState_redirectid:
2022- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2023- crun = rid
2024- } else {
2025- return false
2026- }
20271973 }
20281974 return true
20291975 })
2030- crun.selfState(v, a, ctrl)
1976+ c.selfState(v, a, ctrl)
20311977 return true
20321978 }
20331979
@@ -2036,12 +1982,13 @@ type tagIn StateControllerBase
20361982 const (
20371983 tagIn_stateno = iota
20381984 tagIn_partnerstateno
2039- tagIn_redirectid
20401985 )
20411986
20421987 func (sc tagIn) Run(c *Char, _ []int32) bool {
20431988 p := c.partner(0)
2044- crun := c
1989+ if p == nil {
1990+ return false
1991+ }
20451992 sn := int32(-1)
20461993 ret := false
20471994 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
@@ -2049,12 +1996,9 @@ func (sc tagIn) Run(c *Char, _ []int32) bool {
20491996 case tagIn_stateno:
20501997 sn = exp[0].evalI(c)
20511998 case tagIn_partnerstateno:
2052- if p == nil {
2053- return false
2054- }
20551999 if psn := exp[0].evalI(c); psn >= 0 {
20562000 if sn >= 0 {
2057- crun.changeState(sn, -1, -1)
2001+ c.changeState(sn, -1, -1)
20582002 }
20592003 p.unsetSCF(SCF_standby)
20602004 p.changeState(psn, -1, -1)
@@ -2062,16 +2006,6 @@ func (sc tagIn) Run(c *Char, _ []int32) bool {
20622006 } else {
20632007 return false
20642008 }
2065- case tagIn_redirectid:
2066- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2067- crun = rid
2068- p = crun.partner(0)
2069- if p == nil {
2070- return false
2071- }
2072- } else {
2073- return false
2074- }
20752009 }
20762010 return true
20772011 })
@@ -2082,21 +2016,13 @@ type tagOut StateControllerBase
20822016
20832017 const (
20842018 tagOut_ = iota
2085- tagOut_redirectid
20862019 )
20872020
20882021 func (sc tagOut) Run(c *Char, _ []int32) bool {
2089- crun := c
20902022 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
20912023 switch id {
20922024 case tagOut_:
2093- crun.setSCF(SCF_standby)
2094- case tagOut_redirectid:
2095- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2096- crun = rid
2097- } else {
2098- return false
2099- }
2025+ c.setSCF(SCF_standby)
21002026 }
21012027 return true
21022028 })
@@ -2108,11 +2034,9 @@ type destroySelf StateControllerBase
21082034 const (
21092035 destroySelf_recursive = iota
21102036 destroySelf_removeexplods
2111- destroySelf_redirectid
21122037 )
21132038
21142039 func (sc destroySelf) Run(c *Char, _ []int32) bool {
2115- crun := c
21162040 rec, rem := false, false
21172041 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
21182042 switch id {
@@ -2120,16 +2044,10 @@ func (sc destroySelf) Run(c *Char, _ []int32) bool {
21202044 rec = exp[0].evalB(c)
21212045 case destroySelf_removeexplods:
21222046 rem = exp[0].evalB(c)
2123- case destroySelf_redirectid:
2124- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2125- crun = rid
2126- } else {
2127- return false
2128- }
21292047 }
21302048 return true
21312049 })
2132- return crun.destroySelf(rec, rem)
2050+ return c.destroySelf(rec, rem)
21332051 }
21342052
21352053 type changeAnim StateControllerBase
@@ -2137,11 +2055,9 @@ type changeAnim StateControllerBase
21372055 const (
21382056 changeAnim_elem byte = iota
21392057 changeAnim_value
2140- changeAnim_redirectid
21412058 )
21422059
21432060 func (sc changeAnim) Run(c *Char, _ []int32) bool {
2144- crun := c
21452061 var elem int32
21462062 setelem := false
21472063 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
@@ -2150,15 +2066,9 @@ func (sc changeAnim) Run(c *Char, _ []int32) bool {
21502066 elem = exp[0].evalI(c)
21512067 setelem = true
21522068 case changeAnim_value:
2153- crun.changeAnim(exp[0].evalI(c))
2069+ c.changeAnim(exp[0].evalI(c))
21542070 if setelem {
2155- crun.setAnimElem(elem)
2156- }
2157- case changeAnim_redirectid:
2158- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2159- crun = rid
2160- } else {
2161- return false
2071+ c.setAnimElem(elem)
21622072 }
21632073 }
21642074 return true
@@ -2169,7 +2079,6 @@ func (sc changeAnim) Run(c *Char, _ []int32) bool {
21692079 type changeAnim2 changeAnim
21702080
21712081 func (sc changeAnim2) Run(c *Char, _ []int32) bool {
2172- crun := c
21732082 var elem int32
21742083 setelem := false
21752084 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
@@ -2178,15 +2087,9 @@ func (sc changeAnim2) Run(c *Char, _ []int32) bool {
21782087 elem = exp[0].evalI(c)
21792088 setelem = true
21802089 case changeAnim_value:
2181- crun.changeAnim2(exp[0].evalI(c))
2090+ c.changeAnim2(exp[0].evalI(c))
21822091 if setelem {
2183- crun.setAnimElem(elem)
2184- }
2185- case changeAnim_redirectid:
2186- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2187- crun = rid
2188- } else {
2189- return false
2092+ c.setAnimElem(elem)
21902093 }
21912094 }
21922095 return true
@@ -2219,34 +2122,18 @@ const (
22192122 helper_facing
22202123 helper_pausemovetime
22212124 helper_supermovetime
2222- helper_redirectid
22232125 )
22242126
22252127 func (sc helper) Run(c *Char, _ []int32) bool {
2226- crun := c
2227- var lclscround float32 = 1.0
2228- var h *Char
2128+ h := c.newHelper()
2129+ if h == nil {
2130+ return false
2131+ }
22292132 pt := PT_P1
22302133 var f, st int32 = 1, 0
22312134 op := false
22322135 var x, y float32 = 0, 0
22332136 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
2234- if h == nil {
2235- if id == helper_redirectid {
2236- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2237- crun = rid
2238- lclscround = c.localscl / crun.localscl
2239- h = crun.newHelper()
2240- } else {
2241- return false
2242- }
2243- } else {
2244- h = c.newHelper()
2245- }
2246- }
2247- if h == nil {
2248- return false
2249- }
22502137 switch id {
22512138 case helper_helpertype:
22522139 h.player = exp[0].evalB(c)
@@ -2261,29 +2148,29 @@ func (sc helper) Run(c *Char, _ []int32) bool {
22612148 case helper_size_yscale:
22622149 h.size.yscale = exp[0].evalF(c)
22632150 case helper_size_ground_back:
2264- h.size.ground.back = exp[0].evalF(c)
2151+ h.size.ground.back = exp[0].evalI(c)
22652152 case helper_size_ground_front:
2266- h.size.ground.front = exp[0].evalF(c)
2153+ h.size.ground.front = exp[0].evalI(c)
22672154 case helper_size_air_back:
2268- h.size.air.back = exp[0].evalF(c)
2155+ h.size.air.back = exp[0].evalI(c)
22692156 case helper_size_air_front:
2270- h.size.air.front = exp[0].evalF(c)
2157+ h.size.air.front = exp[0].evalI(c)
22712158 case helper_size_height:
2272- h.size.height = exp[0].evalF(c)
2159+ h.size.height = exp[0].evalI(c)
22732160 case helper_size_proj_doscale:
22742161 h.size.proj.doscale = exp[0].evalI(c)
22752162 case helper_size_head_pos:
2276- h.size.head.pos[0] = exp[0].evalF(c)
2163+ h.size.head.pos[0] = exp[0].evalI(c)
22772164 if len(exp) > 1 {
2278- h.size.head.pos[1] = exp[1].evalF(c)
2165+ h.size.head.pos[1] = exp[1].evalI(c)
22792166 }
22802167 case helper_size_mid_pos:
2281- h.size.mid.pos[0] = exp[0].evalF(c)
2168+ h.size.mid.pos[0] = exp[0].evalI(c)
22822169 if len(exp) > 1 {
2283- h.size.mid.pos[1] = exp[1].evalF(c)
2170+ h.size.mid.pos[1] = exp[1].evalI(c)
22842171 }
22852172 case helper_size_shadowoffset:
2286- h.size.shadowoffset = exp[0].evalF(c)
2173+ h.size.shadowoffset = exp[0].evalI(c)
22872174 case helper_stateno:
22882175 st = exp[0].evalI(c)
22892176 case helper_keyctrl:
@@ -2291,9 +2178,9 @@ func (sc helper) Run(c *Char, _ []int32) bool {
22912178 case helper_id:
22922179 h.helperId = exp[0].evalI(c)
22932180 case helper_pos:
2294- x = exp[0].evalF(c) * lclscround
2181+ x = exp[0].evalF(c)
22952182 if len(exp) > 1 {
2296- y = exp[1].evalF(c) * lclscround
2183+ y = exp[1].evalF(c)
22972184 }
22982185 case helper_facing:
22992186 f = exp[0].evalI(c)
@@ -2304,17 +2191,7 @@ func (sc helper) Run(c *Char, _ []int32) bool {
23042191 }
23052192 return true
23062193 })
2307- if h == nil {
2308- return false
2309- }
2310- if crun.minus == -2 {
2311- h.localscl = (320 / float32(crun.localcoord))
2312- h.localcoord = crun.localcoord
2313- } else {
2314- h.localscl = crun.localscl
2315- h.localcoord = crun.localcoord
2316- }
2317- crun.helperInit(h, st, pt, x, y, f, op)
2194+ c.helperInit(h, st, pt, x, y, f, op)
23182195 return false
23192196 }
23202197
@@ -2322,21 +2199,13 @@ type ctrlSet StateControllerBase
23222199
23232200 const (
23242201 ctrlSet_value byte = iota
2325- ctrlSet_redirectid
23262202 )
23272203
23282204 func (sc ctrlSet) Run(c *Char, _ []int32) bool {
2329- crun := c
23302205 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
23312206 switch id {
23322207 case ctrlSet_value:
2333- crun.setCtrl(exp[0].evalB(c))
2334- case ctrlSet_redirectid:
2335- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2336- crun = rid
2337- } else {
2338- return false
2339- }
2208+ c.setCtrl(exp[0].evalB(c))
23402209 }
23412210 return true
23422211 })
@@ -2373,46 +2242,16 @@ const (
23732242 explod_yangle
23742243 explod_xangle
23752244 explod_ignorehitpause
2376- explod_bindid
2377- explod_space
2378- explod_redirectid
23792245 )
23802246
23812247 func (sc explod) Run(c *Char, _ []int32) bool {
2382- crun := c
2383- var lclscround float32 = 1.0
2384- var e *Explod
2385- var i int
2386- //e, i := crun.newExplod()
2248+ e, i := c.newExplod()
2249+ if e == nil {
2250+ return false
2251+ }
2252+ e.id = 0
23872253 rp := [...]int32{-1, 0}
23882254 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
2389- if e == nil {
2390- if id == explod_redirectid {
2391- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2392- crun = rid
2393- lclscround = c.localscl / crun.localscl
2394- e, i = crun.newExplod()
2395- if e == nil {
2396- return false
2397- }
2398- e.id = 0
2399- if crun.stCgi().ver[0] == 1 && crun.stCgi().ver[1] == 1 {
2400- e.postype = PT_N
2401- }
2402- } else {
2403- return false
2404- }
2405- } else {
2406- e, i = crun.newExplod()
2407- if e == nil {
2408- return false
2409- }
2410- e.id = 0
2411- if crun.stCgi().ver[0] == 1 && crun.stCgi().ver[1] == 1 {
2412- e.postype = PT_N
2413- }
2414- }
2415- }
24162255 switch id {
24172256 case explod_ownpal:
24182257 e.ownpal = exp[0].evalB(c)
@@ -2436,30 +2275,28 @@ func (sc explod) Run(c *Char, _ []int32) bool {
24362275 e.vfacing = 1
24372276 }
24382277 case explod_pos:
2439- e.offset[0] = exp[0].evalF(c) * lclscround
2278+ e.offset[0] = exp[0].evalF(c)
24402279 if len(exp) > 1 {
2441- e.offset[1] = exp[1].evalF(c) * lclscround
2280+ e.offset[1] = exp[1].evalF(c)
24422281 }
24432282 case explod_random:
2444- rndx := exp[0].evalF(c) * lclscround
2445- e.offset[0] += RandF(-rndx, rndx-2) * .5
2283+ rndx := exp[0].evalF(c)
2284+ e.offset[0] += RandF(-rndx, rndx)
24462285 if len(exp) > 1 {
2447- rndy := exp[1].evalF(c) * lclscround
2448- e.offset[1] += RandF(-rndy, rndy-2) * .5
2286+ rndy := exp[1].evalF(c)
2287+ e.offset[1] += RandF(-rndy, rndy)
24492288 }
24502289 case explod_postype:
24512290 e.postype = PosType(exp[0].evalI(c))
2452- case explod_space:
2453- e.space = Space(exp[0].evalI(c))
24542291 case explod_velocity:
2455- e.velocity[0] = exp[0].evalF(c) * lclscround
2292+ e.velocity[0] = exp[0].evalF(c)
24562293 if len(exp) > 1 {
2457- e.velocity[1] = exp[1].evalF(c) * lclscround
2294+ e.velocity[1] = exp[1].evalF(c)
24582295 }
24592296 case explod_accel:
2460- e.accel[0] = exp[0].evalF(c) * lclscround
2297+ e.accel[0] = exp[0].evalF(c)
24612298 if len(exp) > 1 {
2462- e.accel[1] = exp[1].evalF(c) * lclscround
2299+ e.accel[1] = exp[1].evalF(c)
24632300 }
24642301 case explod_scale:
24652302 e.scale[0] = exp[0].evalF(c)
@@ -2511,38 +2348,26 @@ func (sc explod) Run(c *Char, _ []int32) bool {
25112348 }
25122349 }
25132350 case explod_anim:
2514- e.anim = crun.getAnim(exp[1].evalI(c), exp[0].evalB(c))
2351+ e.anim = c.getAnim(exp[1].evalI(c), exp[0].evalB(c))
25152352 case explod_angle:
25162353 e.angle = exp[0].evalF(c)
25172354 case explod_yangle:
2518- e.yangle = exp[0].evalF(c)
2355+ exp[0].run(c)
25192356 case explod_xangle:
2520- e.xangle = exp[0].evalF(c)
2357+ exp[0].run(c)
25212358 case explod_ignorehitpause:
25222359 e.ignorehitpause = exp[0].evalB(c)
2523- case explod_bindid:
2524- e.bindId = exp[0].evalI(c)
25252360 }
25262361 return true
25272362 })
2528- if e == nil {
2529- return false
2530- }
2531- if c.minus == -2 {
2532- e.localscl = (320 / float32(crun.localcoord))
2533- } else {
2534- e.localscl = crun.localscl
2535- }
2536- e.setPos(crun)
2537- crun.insertExplodEx(i, rp)
2363+ e.setPos(c)
2364+ c.insertExplodEx(i, rp)
25382365 return false
25392366 }
25402367
25412368 type modifyExplod explod
25422369
25432370 func (sc modifyExplod) Run(c *Char, _ []int32) bool {
2544- crun := c
2545- var lclscround float32 = 1.0
25462371 eid := int32(-1)
25472372 var expls []*Explod
25482373 rp := [...]int32{-1, 0}
@@ -2553,13 +2378,6 @@ func (sc modifyExplod) Run(c *Char, _ []int32) bool {
25532378 }
25542379 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
25552380 switch id {
2556- case explod_redirectid:
2557- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2558- crun = rid
2559- lclscround = c.localscl / crun.localscl
2560- } else {
2561- return false
2562- }
25632381 case explod_remappal:
25642382 rp[0] = exp[0].evalI(c)
25652383 if len(exp) > 1 {
@@ -2569,13 +2387,13 @@ func (sc modifyExplod) Run(c *Char, _ []int32) bool {
25692387 eid = exp[0].evalI(c)
25702388 default:
25712389 if len(expls) == 0 {
2572- expls = crun.getExplods(eid)
2390+ expls = c.getExplods(eid)
25732391 if len(expls) == 0 {
25742392 return false
25752393 }
25762394 eachExpl(func(e *Explod) {
25772395 if e.ownpal {
2578- crun.remapPal(e.palfx, [...]int32{1, 1}, rp)
2396+ c.remapPal(e.palfx, [...]int32{1, 1}, rp)
25792397 }
25802398 })
25812399 }
@@ -2593,18 +2411,18 @@ func (sc modifyExplod) Run(c *Char, _ []int32) bool {
25932411 eachExpl(func(e *Explod) { e.vfacing = 1 })
25942412 }
25952413 case explod_pos:
2596- x := exp[0].evalF(c) * lclscround
2414+ x := exp[0].evalF(c)
25972415 eachExpl(func(e *Explod) { e.offset[0] = x })
25982416 if len(exp) > 1 {
2599- y := exp[1].evalF(c) * lclscround
2417+ y := exp[1].evalF(c)
26002418 eachExpl(func(e *Explod) { e.offset[1] = y })
26012419 }
26022420 case explod_random:
2603- rndx := exp[0].evalF(c) * lclscround
2421+ rndx := exp[0].evalF(c)
26042422 rndx = RandF(-rndx, rndx)
26052423 eachExpl(func(e *Explod) { e.offset[0] += rndx })
26062424 if len(exp) > 1 {
2607- rndy := exp[1].evalF(c) * lclscround
2425+ rndy := exp[1].evalF(c)
26082426 rndy = RandF(-rndy, rndy)
26092427 eachExpl(func(e *Explod) { e.offset[1] += rndy })
26102428 }
@@ -2615,17 +2433,17 @@ func (sc modifyExplod) Run(c *Char, _ []int32) bool {
26152433 e.setPos(c)
26162434 })
26172435 case explod_velocity:
2618- x := exp[0].evalF(c) * lclscround
2436+ x := exp[0].evalF(c)
26192437 eachExpl(func(e *Explod) { e.velocity[0] = x })
26202438 if len(exp) > 1 {
2621- y := exp[1].evalF(c) * lclscround
2439+ y := exp[1].evalF(c)
26222440 eachExpl(func(e *Explod) { e.velocity[1] = y })
26232441 }
26242442 case explod_accel:
2625- x := exp[0].evalF(c) * lclscround
2443+ x := exp[0].evalF(c)
26262444 eachExpl(func(e *Explod) { e.accel[0] = x })
26272445 if len(exp) > 1 {
2628- y := exp[1].evalF(c) * lclscround
2446+ y := exp[1].evalF(c)
26292447 eachExpl(func(e *Explod) { e.accel[1] = y })
26302448 }
26312449 case explod_scale:
@@ -2696,14 +2514,9 @@ func (sc modifyExplod) Run(c *Char, _ []int32) bool {
26962514 a := exp[0].evalF(c)
26972515 eachExpl(func(e *Explod) { e.angle = a })
26982516 case explod_yangle:
2699- ya := exp[0].evalF(c)
2700- eachExpl(func(e *Explod) { e.yangle = ya })
2517+ exp[0].run(c)
27012518 case explod_xangle:
2702- xa := exp[0].evalF(c)
2703- eachExpl(func(e *Explod) { e.xangle = xa })
2704- case explod_bindid:
2705- b := exp[0].evalI(c)
2706- eachExpl(func(e *Explod) { e.bindId = b })
2519+ exp[0].run(c)
27072520 }
27082521 }
27092522 return true
@@ -2718,63 +2531,39 @@ const (
27182531 gameMakeAnim_random
27192532 gameMakeAnim_under
27202533 gameMakeAnim_anim
2721- gameMakeAnim_redirectid
27222534 )
27232535
27242536 func (sc gameMakeAnim) Run(c *Char, _ []int32) bool {
2725- crun := c
2726- var e *Explod
2727- var i int
2728-
2537+ e, i := c.newExplod()
2538+ if e == nil {
2539+ return false
2540+ }
2541+ e.ontop, e.sprpriority, e.ownpal = true, math.MinInt32, true
27292542 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
2730- if e == nil {
2731- if id == gameMakeAnim_redirectid {
2732- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2733- crun = rid
2734- e, i = crun.newExplod()
2735- if e == nil {
2736- return false
2737- }
2738- e.id = 0
2739- } else {
2740- return false
2741- }
2742- } else {
2743- e, i = crun.newExplod()
2744- if e == nil {
2745- return false
2746- }
2747- e.id = 0
2748- }
2749- }
27502543 switch id {
27512544 case gameMakeAnim_pos:
2752- e.offset[0] = exp[0].evalF(c) * c.localscl / crun.localscl
2545+ e.offset[0] = exp[0].evalF(c)
27532546 if len(exp) > 1 {
2754- e.offset[1] = exp[1].evalF(c) * c.localscl / crun.localscl
2547+ e.offset[1] = exp[1].evalF(c)
27552548 }
27562549 case gameMakeAnim_random:
27572550 rndx := exp[0].evalF(c)
2758- e.offset[0] += RandF(-rndx, rndx) * c.localscl / crun.localscl
2551+ e.offset[0] += RandF(-rndx, rndx)
27592552 if len(exp) > 1 {
27602553 rndy := exp[1].evalF(c)
2761- e.offset[1] += RandF(-rndy, rndy) * c.localscl / crun.localscl
2554+ e.offset[1] += RandF(-rndy, rndy)
27622555 }
27632556 case gameMakeAnim_under:
27642557 e.ontop = !exp[0].evalB(c)
27652558 case gameMakeAnim_anim:
2766- e.anim = crun.getAnim(exp[1].evalI(c), exp[0].evalB(c))
2559+ e.anim = c.getAnim(exp[1].evalI(c), exp[0].evalB(c))
27672560 }
27682561 return true
27692562 })
2770- if e == nil {
2771- return false
2772- }
2773- e.ontop, e.sprpriority, e.ownpal = true, math.MinInt32, true
2774- e.offset[0] -= float32(crun.size.draw.offset[0])
2775- e.offset[1] -= float32(crun.size.draw.offset[1])
2776- e.setPos(crun)
2777- crun.insertExplod(i)
2563+ e.offset[0] -= float32(c.size.draw.offset[0])
2564+ e.offset[1] -= float32(c.size.draw.offset[1])
2565+ e.setPos(c)
2566+ c.insertExplod(i)
27782567 return false
27792568 }
27802569
@@ -2784,27 +2573,17 @@ const (
27842573 posSet_x byte = iota
27852574 posSet_y
27862575 posSet_z
2787- posSet_redirectid
27882576 )
27892577
27902578 func (sc posSet) Run(c *Char, _ []int32) bool {
2791- crun := c
2792- var lclscround float32 = 1.0
27932579 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
27942580 switch id {
27952581 case posSet_x:
2796- crun.setX(sys.cam.Pos[0]/crun.localscl + exp[0].evalF(c)*lclscround)
2582+ c.setX(sys.cam.Pos[0] + exp[0].evalF(c))
27972583 case posSet_y:
2798- crun.setY(exp[0].evalF(c) * lclscround)
2584+ c.setY(exp[0].evalF(c))
27992585 case posSet_z:
28002586 exp[0].run(c)
2801- case posSet_redirectid:
2802- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2803- crun = rid
2804- lclscround = c.localscl / crun.localscl
2805- } else {
2806- return false
2807- }
28082587 }
28092588 return true
28102589 })
@@ -2814,23 +2593,14 @@ func (sc posSet) Run(c *Char, _ []int32) bool {
28142593 type posAdd posSet
28152594
28162595 func (sc posAdd) Run(c *Char, _ []int32) bool {
2817- crun := c
2818- var lclscround float32 = 1.0
28192596 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
28202597 switch id {
28212598 case posSet_x:
2822- crun.addX(exp[0].evalF(c) * lclscround)
2599+ c.addX(exp[0].evalF(c))
28232600 case posSet_y:
2824- crun.addY(exp[0].evalF(c) * lclscround)
2601+ c.addY(exp[0].evalF(c))
28252602 case posSet_z:
28262603 exp[0].run(c)
2827- case posSet_redirectid:
2828- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2829- crun = rid
2830- lclscround = c.localscl / crun.localscl
2831- } else {
2832- return false
2833- }
28342604 }
28352605 return true
28362606 })
@@ -2840,23 +2610,14 @@ func (sc posAdd) Run(c *Char, _ []int32) bool {
28402610 type velSet posSet
28412611
28422612 func (sc velSet) Run(c *Char, _ []int32) bool {
2843- crun := c
2844- var lclscround float32 = 1.0
28452613 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
28462614 switch id {
28472615 case posSet_x:
2848- crun.setXV(exp[0].evalF(c) * lclscround)
2616+ c.setXV(exp[0].evalF(c))
28492617 case posSet_y:
2850- crun.setYV(exp[0].evalF(c) * lclscround)
2618+ c.setYV(exp[0].evalF(c))
28512619 case posSet_z:
28522620 exp[0].run(c)
2853- case posSet_redirectid:
2854- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2855- crun = rid
2856- lclscround = c.localscl / crun.localscl
2857- } else {
2858- return false
2859- }
28602621 }
28612622 return true
28622623 })
@@ -2866,23 +2627,14 @@ func (sc velSet) Run(c *Char, _ []int32) bool {
28662627 type velAdd posSet
28672628
28682629 func (sc velAdd) Run(c *Char, _ []int32) bool {
2869- crun := c
2870- var lclscround float32 = 1.0
28712630 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
28722631 switch id {
28732632 case posSet_x:
2874- crun.addXV(exp[0].evalF(c) * lclscround)
2633+ c.addXV(exp[0].evalF(c))
28752634 case posSet_y:
2876- crun.addYV(exp[0].evalF(c) * lclscround)
2635+ c.addYV(exp[0].evalF(c))
28772636 case posSet_z:
28782637 exp[0].run(c)
2879- case posSet_redirectid:
2880- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2881- crun = rid
2882- lclscround = c.localscl / crun.localscl
2883- } else {
2884- return false
2885- }
28862638 }
28872639 return true
28882640 })
@@ -2892,21 +2644,14 @@ func (sc velAdd) Run(c *Char, _ []int32) bool {
28922644 type velMul posSet
28932645
28942646 func (sc velMul) Run(c *Char, _ []int32) bool {
2895- crun := c
28962647 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
28972648 switch id {
28982649 case posSet_x:
2899- crun.mulXV(exp[0].evalF(c))
2650+ c.mulXV(exp[0].evalF(c))
29002651 case posSet_y:
2901- crun.mulYV(exp[0].evalF(c))
2652+ c.mulYV(exp[0].evalF(c))
29022653 case posSet_z:
29032654 exp[0].run(c)
2904- case posSet_redirectid:
2905- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2906- crun = rid
2907- } else {
2908- return false
2909- }
29102655 }
29112656 return true
29122657 })
@@ -2923,7 +2668,6 @@ const (
29232668 palFX_sinadd
29242669 palFX_invertall
29252670 palFX_last = iota - 1
2926- palFX_redirectid
29272671 )
29282672
29292673 func (sc palFX) runSub(c *Char, pfd *PalFXDef,
@@ -2956,25 +2700,12 @@ func (sc palFX) runSub(c *Char, pfd *PalFXDef,
29562700 return true
29572701 }
29582702 func (sc palFX) Run(c *Char, _ []int32) bool {
2959- crun := c
2960- pf := crun.palfx
2703+ pf := c.palfx
29612704 if pf == nil {
29622705 pf = newPalFX()
29632706 }
29642707 pf.clear2(true)
29652708 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
2966- if id == palFX_redirectid {
2967- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
2968- crun = rid
2969- pf = crun.palfx
2970- if pf == nil {
2971- pf = newPalFX()
2972- }
2973- pf.clear2(true)
2974- } else {
2975- return false
2976- }
2977- }
29782709 sc.runSub(c, &pf.PalFXDef, id, exp)
29792710 return true
29802711 })
@@ -3019,7 +2750,6 @@ const (
30192750 afterImage_paladd
30202751 afterImage_palmul
30212752 afterImage_last = iota + palFX_last + 1 - 1
3022- afterImage_redirectid
30232753 )
30242754
30252755 func (sc afterImage) runSub(c *Char, ai *AfterImage,
@@ -3082,23 +2812,13 @@ func (sc afterImage) runSub(c *Char, ai *AfterImage,
30822812 }
30832813 }
30842814 func (sc afterImage) Run(c *Char, _ []int32) bool {
3085- crun := c
3086- crun.aimg.clear()
3087- crun.aimg.time = 1
2815+ c.aimg.clear()
2816+ c.aimg.time = 1
30882817 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
3089- if id == afterImage_redirectid {
3090- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3091- crun = rid
3092- crun.aimg.clear()
3093- crun.aimg.time = 1
3094- } else {
3095- return false
3096- }
3097- }
3098- sc.runSub(c, &crun.aimg, id, exp)
2818+ sc.runSub(c, &c.aimg, id, exp)
30992819 return true
31002820 })
3101- crun.aimg.setupPalFX()
2821+ c.aimg.setupPalFX()
31022822 return false
31032823 }
31042824
@@ -3106,25 +2826,16 @@ type afterImageTime StateControllerBase
31062826
31072827 const (
31082828 afterImageTime_time byte = iota
3109- afterImageTime_redirectid
31102829 )
31112830
31122831 func (sc afterImageTime) Run(c *Char, _ []int32) bool {
3113- crun := c
31142832 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
3115- if id == afterImageTime_redirectid {
3116- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3117- crun = rid
3118- } else {
3119- return false
3120- }
3121- }
3122- if crun.aimg.timegap <= 0 {
2833+ if c.aimg.timegap <= 0 {
31232834 return false
31242835 }
31252836 switch id {
31262837 case afterImageTime_time:
3127- crun.aimg.time = exp[0].evalI(c)
2838+ c.aimg.time = exp[0].evalI(c)
31282839 }
31292840 return true
31302841 })
@@ -3143,7 +2854,6 @@ const (
31432854 hitDef_air_animtype
31442855 hitDef_fall_animtype
31452856 hitDef_affectteam
3146- hitDef_teamside
31472857 hitDef_id
31482858 hitDef_chainid
31492859 hitDef_nochainid
@@ -3216,7 +2926,6 @@ const (
32162926 hitDef_fall_envshake_phase
32172927 hitDef_fall_envshake_freq
32182928 hitDef_last = iota + afterImage_last + 1 - 1
3219- hitDef_redirectid
32202929 )
32212930
32222931 func (sc hitDef) runSub(c *Char, hd *HitDef, id byte, exp []BytecodeExp) bool {
@@ -3239,15 +2948,6 @@ func (sc hitDef) runSub(c *Char, hd *HitDef, id byte, exp []BytecodeExp) bool {
32392948 hd.fall.animtype = Reaction(exp[0].evalI(c))
32402949 case hitDef_affectteam:
32412950 hd.affectteam = exp[0].evalI(c)
3242- case hitDef_teamside:
3243- n := exp[0].evalI(c)
3244- if n > 3 {
3245- hd.teamside = 3
3246- } else if n < 1 {
3247- hd.teamside = 1
3248- } else {
3249- hd.teamside = int(n)
3250- }
32512951 case hitDef_id:
32522952 hd.id = Max(0, exp[0].evalI(c))
32532953 case hitDef_chainid:
@@ -3493,27 +3193,15 @@ func (sc hitDef) runSub(c *Char, hd *HitDef, id byte, exp []BytecodeExp) bool {
34933193 return true
34943194 }
34953195 func (sc hitDef) Run(c *Char, _ []int32) bool {
3496- crun := c
3497- crun.hitdef.clear()
3498- crun.hitdef.playerNo = sys.workingState.playerNo
3499- crun.hitdef.sparkno = ^c.gi().data.sparkno
3500- crun.hitdef.guard_sparkno = ^c.gi().data.guard.sparkno
3196+ c.hitdef.clear()
3197+ c.hitdef.playerNo = sys.workingState.playerNo
3198+ c.hitdef.sparkno = ^c.gi().data.sparkno
3199+ c.hitdef.guard_sparkno = ^c.gi().data.guard.sparkno
35013200 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
3502- if id == hitDef_redirectid {
3503- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3504- crun = rid
3505- crun.hitdef.clear()
3506- crun.hitdef.playerNo = sys.workingState.playerNo
3507- crun.hitdef.sparkno = ^c.gi().data.sparkno
3508- crun.hitdef.guard_sparkno = ^c.gi().data.guard.sparkno
3509- } else {
3510- return false
3511- }
3512- }
3513- sc.runSub(c, &crun.hitdef, id, exp)
3201+ sc.runSub(c, &c.hitdef, id, exp)
35143202 return true
35153203 })
3516- crun.setHitdefDefault(&crun.hitdef, false)
3204+ c.setHitdefDefault(&c.hitdef, false)
35173205 return false
35183206 }
35193207
@@ -3521,31 +3209,21 @@ type reversalDef hitDef
35213209
35223210 const (
35233211 reversalDef_reversal_attr = iota + hitDef_last + 1
3524- reversalDef_redirectid
35253212 )
35263213
35273214 func (sc reversalDef) Run(c *Char, _ []int32) bool {
3528- crun := c
3529- crun.hitdef.clear()
3530- crun.hitdef.playerNo = sys.workingState.playerNo
3215+ c.hitdef.clear()
3216+ c.hitdef.playerNo = sys.workingState.playerNo
35313217 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
35323218 switch id {
35333219 case reversalDef_reversal_attr:
3534- crun.hitdef.reversal_attr = exp[0].evalI(c)
3535- case reversalDef_redirectid:
3536- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3537- crun = rid
3538- crun.hitdef.clear()
3539- crun.hitdef.playerNo = sys.workingState.playerNo
3540- } else {
3541- return false
3542- }
3220+ c.hitdef.reversal_attr = exp[0].evalI(c)
35433221 default:
3544- hitDef(sc).runSub(c, &crun.hitdef, id, exp)
3222+ hitDef(sc).runSub(c, &c.hitdef, id, exp)
35453223 }
35463224 return true
35473225 })
3548- crun.setHitdefDefault(&crun.hitdef, false)
3226+ c.setHitdefDefault(&c.hitdef, false)
35493227 return false
35503228 }
35513229
@@ -3578,40 +3256,19 @@ const (
35783256 projectile_pausemovetime
35793257 projectile_ownpal
35803258 projectile_remappal
3581- projectile_redirectid
35823259 )
35833260
35843261 func (sc projectile) Run(c *Char, _ []int32) bool {
3585- crun := c
3586- var lclscround float32 = 1.0
3587- var p *Projectile
3262+ p := c.newProj()
3263+ if p == nil {
3264+ return false
3265+ }
3266+ p.hitdef.playerNo = sys.workingState.playerNo
35883267 pt := PT_P1
35893268 var x, y float32 = 0, 0
35903269 op := false
35913270 rp := [...]int32{-1, 0}
35923271 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
3593- if p == nil {
3594- if id == projectile_redirectid {
3595- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3596- crun = rid
3597- lclscround = c.localscl / crun.localscl
3598- p = crun.newProj()
3599- if p == nil {
3600- return false
3601- }
3602- p.hitdef.playerNo = sys.workingState.playerNo
3603-
3604- } else {
3605- return false
3606- }
3607- } else {
3608- p = crun.newProj()
3609- if p == nil {
3610- return false
3611- }
3612- p.hitdef.playerNo = sys.workingState.playerNo
3613- }
3614- }
36153272 switch id {
36163273 case projectile_postype:
36173274 pt = PosType(exp[0].evalI(c))
@@ -3642,9 +3299,9 @@ func (sc projectile) Run(c *Char, _ []int32) bool {
36423299 case projectile_projcancelanim:
36433300 p.cancelanim = Max(-1, exp[0].evalI(c))
36443301 case projectile_velocity:
3645- p.velocity[0] = exp[0].evalF(c) * lclscround
3302+ p.velocity[0] = exp[0].evalF(c)
36463303 if len(exp) > 1 {
3647- p.velocity[1] = exp[1].evalF(c) * lclscround
3304+ p.velocity[1] = exp[1].evalF(c)
36483305 }
36493306 case projectile_velmul:
36503307 p.velmul[0] = exp[0].evalF(c)
@@ -3652,14 +3309,14 @@ func (sc projectile) Run(c *Char, _ []int32) bool {
36523309 p.velmul[1] = exp[1].evalF(c)
36533310 }
36543311 case projectile_remvelocity:
3655- p.remvelocity[0] = exp[0].evalF(c) * lclscround
3312+ p.remvelocity[0] = exp[0].evalF(c)
36563313 if len(exp) > 1 {
3657- p.remvelocity[1] = exp[1].evalF(c) * lclscround
3314+ p.remvelocity[1] = exp[1].evalF(c)
36583315 }
36593316 case projectile_accel:
3660- p.accel[0] = exp[0].evalF(c) * lclscround
3317+ p.accel[0] = exp[0].evalF(c)
36613318 if len(exp) > 1 {
3662- p.accel[1] = exp[1].evalF(c) * lclscround
3319+ p.accel[1] = exp[1].evalF(c)
36633320 }
36643321 case projectile_projscale:
36653322 p.scale[0] = exp[0].evalF(c)
@@ -3667,20 +3324,20 @@ func (sc projectile) Run(c *Char, _ []int32) bool {
36673324 p.scale[1] = exp[1].evalF(c)
36683325 }
36693326 case projectile_offset:
3670- x = exp[0].evalF(c) * lclscround
3327+ x = exp[0].evalF(c)
36713328 if len(exp) > 1 {
3672- y = exp[1].evalF(c) * lclscround
3329+ y = exp[1].evalF(c)
36733330 }
36743331 case projectile_projsprpriority:
36753332 p.sprpriority = exp[0].evalI(c)
36763333 case projectile_projstagebound:
3677- p.stagebound = int32(float32(exp[0].evalI(c)) * lclscround)
3334+ p.stagebound = exp[0].evalI(c)
36783335 case projectile_projedgebound:
3679- p.edgebound = int32(float32(exp[0].evalI(c)) * lclscround)
3336+ p.edgebound = exp[0].evalI(c)
36803337 case projectile_projheightbound:
3681- p.heightbound[0] = int32(float32(exp[0].evalI(c)) * lclscround)
3338+ p.heightbound[0] = exp[0].evalI(c)
36823339 if len(exp) > 1 {
3683- p.heightbound[1] = int32(float32(exp[1].evalI(c)) * lclscround)
3340+ p.heightbound[1] = exp[1].evalI(c)
36843341 }
36853342 case projectile_projanim:
36863343 p.anim = exp[0].evalI(c)
@@ -3702,10 +3359,7 @@ func (sc projectile) Run(c *Char, _ []int32) bool {
37023359 }
37033360 return true
37043361 })
3705- if p == nil {
3706- return false
3707- }
3708- crun.setHitdefDefault(&p.hitdef, true)
3362+ c.setHitdefDefault(&p.hitdef, true)
37093363 if p.remanim == IErr {
37103364 p.remanim = p.hitanim
37113365 }
@@ -3715,12 +3369,7 @@ func (sc projectile) Run(c *Char, _ []int32) bool {
37153369 if p.aimg.time != 0 {
37163370 p.aimg.setupPalFX()
37173371 }
3718- if crun.minus == -2 {
3719- p.localscl = (320 / float32(crun.localcoord))
3720- } else {
3721- p.localscl = crun.localscl
3722- }
3723- crun.projInit(p, pt, x, y, op, rp[0], rp[1])
3372+ c.projInit(p, pt, x, y, op, rp[0], rp[1])
37243373 return false
37253374 }
37263375
@@ -3730,39 +3379,29 @@ const (
37303379 width_edge byte = iota
37313380 width_player
37323381 width_value
3733- width_redirectid
37343382 )
37353383
37363384 func (sc width) Run(c *Char, _ []int32) bool {
3737- crun := c
3738- var lclscround float32 = 1.0
37393385 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
37403386 switch id {
37413387 case width_edge:
3742- crun.setFEdge(exp[0].evalF(c) * lclscround)
3388+ c.setFEdge(exp[0].evalF(c))
37433389 if len(exp) > 1 {
3744- crun.setBEdge(exp[1].evalF(c) * lclscround)
3390+ c.setBEdge(exp[1].evalF(c))
37453391 }
37463392 case width_player:
3747- crun.setFWidth(exp[0].evalF(c) * lclscround)
3393+ c.setFWidth(exp[0].evalF(c))
37483394 if len(exp) > 1 {
3749- crun.setBWidth(exp[1].evalF(c) * lclscround)
3395+ c.setBWidth(exp[1].evalF(c))
37503396 }
37513397 case width_value:
3752- v1 := exp[0].evalF(c) * lclscround
3753- crun.setFEdge(v1)
3754- crun.setFWidth(v1)
3398+ v1 := exp[0].evalF(c)
3399+ c.setFEdge(v1)
3400+ c.setFWidth(v1)
37553401 if len(exp) > 1 {
3756- v2 := exp[1].evalF(c) * lclscround
3757- crun.setBEdge(v2)
3758- crun.setBWidth(v2)
3759- }
3760- case width_redirectid:
3761- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3762- crun = rid
3763- lclscround = (320 / float32(c.localcoord)) / (320 / float32(crun.localcoord))
3764- } else {
3765- return false
3402+ v2 := exp[1].evalF(c)
3403+ c.setBEdge(v2)
3404+ c.setBWidth(v2)
37663405 }
37673406 }
37683407 return true
@@ -3774,21 +3413,13 @@ type sprPriority StateControllerBase
37743413
37753414 const (
37763415 sprPriority_value byte = iota
3777- sprPriority_redirectid
37783416 )
37793417
37803418 func (sc sprPriority) Run(c *Char, _ []int32) bool {
3781- crun := c
37823419 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
37833420 switch id {
37843421 case sprPriority_value:
3785- crun.setSprPriority(exp[0].evalI(c))
3786- case sprPriority_redirectid:
3787- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3788- crun = rid
3789- } else {
3790- return false
3791- }
3422+ c.setSprPriority(exp[0].evalI(c))
37923423 }
37933424 return true
37943425 })
@@ -3799,21 +3430,13 @@ type varSet StateControllerBase
37993430
38003431 const (
38013432 varSet_ byte = iota
3802- varSet_redirectid
38033433 )
38043434
38053435 func (sc varSet) Run(c *Char, _ []int32) bool {
3806- crun := c
38073436 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
38083437 switch id {
38093438 case varSet_:
3810- exp[0].run(crun)
3811- case varSet_redirectid:
3812- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3813- crun = rid
3814- } else {
3815- return false
3816- }
3439+ exp[0].run(c)
38173440 }
38183441 return true
38193442 })
@@ -3824,21 +3447,13 @@ type turn StateControllerBase
38243447
38253448 const (
38263449 turn_ byte = iota
3827- turn_redirectid
38283450 )
38293451
38303452 func (sc turn) Run(c *Char, _ []int32) bool {
3831- crun := c
38323453 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
38333454 switch id {
38343455 case turn_:
3835- crun.setFacing(-crun.facing)
3836- case turn_redirectid:
3837- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3838- crun = rid
3839- } else {
3840- return false
3841- }
3456+ c.setFacing(-c.facing)
38423457 }
38433458 return true
38443459 })
@@ -3850,41 +3465,25 @@ type targetFacing StateControllerBase
38503465 const (
38513466 targetFacing_id byte = iota
38523467 targetFacing_value
3853- targetFacing_redirectid
38543468 )
38553469
38563470 func (sc targetFacing) Run(c *Char, _ []int32) bool {
3857- crun := c
3858- tar := crun.getTarget(-1)
3471+ tar := c.getTarget(-1)
3472+ if len(tar) == 0 {
3473+ return false
3474+ }
38593475 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
38603476 switch id {
38613477 case targetFacing_id:
3478+ tar = c.getTarget(exp[0].evalI(c))
38623479 if len(tar) == 0 {
38633480 return false
38643481 }
3865- tar = crun.getTarget(exp[0].evalI(c))
38663482 case targetFacing_value:
3867- if len(tar) == 0 {
3868- return false
3869- }
3870- crun.targetFacing(tar, exp[0].evalI(c))
3871- case targetFacing_redirectid:
3872- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3873- crun = rid
3874- tar = crun.getTarget(-1)
3875- if len(tar) == 0 {
3876- return false
3877- }
3878- } else {
3879- return false
3880- }
3881-
3483+ c.targetFacing(tar, exp[0].evalI(c))
38823484 }
38833485 return true
38843486 })
3885- if len(tar) == 0 {
3886- return false
3887- }
38883487 return false
38893488 }
38903489
@@ -3894,48 +3493,33 @@ const (
38943493 targetBind_id byte = iota
38953494 targetBind_time
38963495 targetBind_pos
3897- targetBind_redirectid
38983496 )
38993497
39003498 func (sc targetBind) Run(c *Char, _ []int32) bool {
3901- crun := c
3902- var lclscround float32 = 1.0
3903- tar := crun.getTarget(-1)
3499+ tar := c.getTarget(-1)
3500+ if len(tar) == 0 {
3501+ return false
3502+ }
39043503 t := int32(1)
39053504 var x, y float32 = 0, 0
39063505 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
39073506 switch id {
39083507 case targetBind_id:
3508+ tar = c.getTarget(exp[0].evalI(c))
39093509 if len(tar) == 0 {
39103510 return false
39113511 }
3912- tar = crun.getTarget(exp[0].evalI(c))
39133512 case targetBind_time:
39143513 t = exp[0].evalI(c)
39153514 case targetBind_pos:
3916- x = exp[0].evalF(c) * lclscround
3515+ x = exp[0].evalF(c)
39173516 if len(exp) > 1 {
3918- y = exp[1].evalF(c) * lclscround
3919- }
3920- case targetBind_redirectid:
3921- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3922- crun = rid
3923- lclscround = c.localscl / crun.localscl
3924- tar = crun.getTarget(-1)
3925- if len(tar) == 0 {
3926- return false
3927- }
3928- } else {
3929- return false
3517+ y = exp[1].evalF(c)
39303518 }
3931-
39323519 }
39333520 return true
39343521 })
3935- if len(tar) == 0 {
3936- return false
3937- }
3938- crun.targetBind(tar, t, x, y)
3522+ c.targetBind(tar, t, x, y)
39393523 return false
39403524 }
39413525
@@ -3945,49 +3529,35 @@ const (
39453529 bindToTarget_id byte = iota
39463530 bindToTarget_time
39473531 bindToTarget_pos
3948- bindToTarget_redirectid
39493532 )
39503533
39513534 func (sc bindToTarget) Run(c *Char, _ []int32) bool {
3952- crun := c
3953- var lclscround float32 = 1.0
3954- tar := crun.getTarget(-1)
3535+ tar := c.getTarget(-1)
3536+ if len(tar) == 0 {
3537+ return false
3538+ }
39553539 t, x, y, hmf := int32(1), float32(0), float32(math.NaN()), HMF_F
39563540 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
39573541 switch id {
39583542 case bindToTarget_id:
3543+ tar = c.getTarget(exp[0].evalI(c))
39593544 if len(tar) == 0 {
39603545 return false
39613546 }
3962- tar = crun.getTarget(exp[0].evalI(c))
39633547 case bindToTarget_time:
39643548 t = exp[0].evalI(c)
39653549 case bindToTarget_pos:
3966- x = exp[0].evalF(c) * lclscround
3550+ x = exp[0].evalF(c)
39673551 if len(exp) > 1 {
3968- y = exp[1].evalF(c) * lclscround
3552+ y = exp[1].evalF(c)
39693553 if len(exp) > 2 {
39703554 hmf = HMF(exp[2].evalI(c))
39713555 }
39723556 }
3973- case bindToTarget_redirectid:
3974- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
3975- crun = rid
3976- lclscround = c.localscl / crun.localscl
3977- tar = crun.getTarget(-1)
3978- if len(tar) == 0 {
3979- return false
3980- }
3981- } else {
3982- return false
3983- }
39843557 }
39853558 return true
39863559 })
3987- if len(tar) == 0 {
3988- return false
3989- }
3990- crun.bindToTarget(tar, t, x, y, hmf)
3560+ c.bindToTarget(tar, t, x, y, hmf)
39913561 return false
39923562 }
39933563
@@ -3998,38 +3568,26 @@ const (
39983568 targetLifeAdd_absolute
39993569 targetLifeAdd_kill
40003570 targetLifeAdd_value
4001- targetLifeAdd_redirectid
40023571 )
40033572
40043573 func (sc targetLifeAdd) Run(c *Char, _ []int32) bool {
4005- crun := c
4006- tar, a, k := crun.getTarget(-1), false, true
3574+ tar, a, k := c.getTarget(-1), false, true
3575+ if len(tar) == 0 {
3576+ return false
3577+ }
40073578 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
40083579 switch id {
40093580 case targetLifeAdd_id:
3581+ tar = c.getTarget(exp[0].evalI(c))
40103582 if len(tar) == 0 {
40113583 return false
40123584 }
4013- tar = crun.getTarget(exp[0].evalI(c))
40143585 case targetLifeAdd_absolute:
40153586 a = exp[0].evalB(c)
40163587 case targetLifeAdd_kill:
40173588 k = exp[0].evalB(c)
40183589 case targetLifeAdd_value:
4019- if len(tar) == 0 {
4020- return false
4021- }
4022- crun.targetLifeAdd(tar, exp[0].evalI(c), k, a)
4023- case targetLifeAdd_redirectid:
4024- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4025- crun = rid
4026- tar = crun.getTarget(-1)
4027- if len(tar) == 0 {
4028- return false
4029- }
4030- } else {
4031- return false
4032- }
3590+ c.targetLifeAdd(tar, exp[0].evalI(c), k, a)
40333591 }
40343592 return true
40353593 })
@@ -4041,34 +3599,22 @@ type targetState StateControllerBase
40413599 const (
40423600 targetState_id byte = iota
40433601 targetState_value
4044- targetState_redirectid
40453602 )
40463603
40473604 func (sc targetState) Run(c *Char, _ []int32) bool {
4048- crun := c
4049- tar := crun.getTarget(-1)
3605+ tar := c.getTarget(-1)
3606+ if len(tar) == 0 {
3607+ return false
3608+ }
40503609 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
40513610 switch id {
40523611 case targetState_id:
3612+ tar = c.getTarget(exp[0].evalI(c))
40533613 if len(tar) == 0 {
40543614 return false
40553615 }
4056- tar = crun.getTarget(exp[0].evalI(c))
40573616 case targetState_value:
4058- if len(tar) == 0 {
4059- return false
4060- }
4061- crun.targetState(tar, exp[0].evalI(c))
4062- case targetState_redirectid:
4063- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4064- crun = rid
4065- tar = crun.getTarget(-1)
4066- if len(tar) == 0 {
4067- return false
4068- }
4069- } else {
4070- return false
4071- }
3617+ c.targetState(tar, exp[0].evalI(c))
40723618 }
40733619 return true
40743620 })
@@ -4081,41 +3627,24 @@ const (
40813627 targetVelSet_id byte = iota
40823628 targetVelSet_x
40833629 targetVelSet_y
4084- targetVelSet_redirectid
40853630 )
40863631
40873632 func (sc targetVelSet) Run(c *Char, _ []int32) bool {
4088- crun := c
4089- var lclscround float32 = 1.0
4090- tar := crun.getTarget(-1)
3633+ tar := c.getTarget(-1)
3634+ if len(tar) == 0 {
3635+ return false
3636+ }
40913637 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
40923638 switch id {
40933639 case targetVelSet_id:
3640+ tar = c.getTarget(exp[0].evalI(c))
40943641 if len(tar) == 0 {
40953642 return false
40963643 }
4097- tar = crun.getTarget(exp[0].evalI(c))
40983644 case targetVelSet_x:
4099- if len(tar) == 0 {
4100- return false
4101- }
4102- crun.targetVelSetX(tar, exp[0].evalF(c)*lclscround)
3645+ c.targetVelSetX(tar, exp[0].evalF(c))
41033646 case targetVelSet_y:
4104- if len(tar) == 0 {
4105- return false
4106- }
4107- crun.targetVelSetY(tar, exp[0].evalF(c)*lclscround)
4108- case targetVelSet_redirectid:
4109- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4110- crun = rid
4111- lclscround = c.localscl / crun.localscl
4112- tar = crun.getTarget(-1)
4113- if len(tar) == 0 {
4114- return false
4115- }
4116- } else {
4117- return false
4118- }
3647+ c.targetVelSetY(tar, exp[0].evalF(c))
41193648 }
41203649 return true
41213650 })
@@ -4128,41 +3657,24 @@ const (
41283657 targetVelAdd_id byte = iota
41293658 targetVelAdd_x
41303659 targetVelAdd_y
4131- targetVelAdd_redirectid
41323660 )
41333661
41343662 func (sc targetVelAdd) Run(c *Char, _ []int32) bool {
4135- crun := c
4136- var lclscround float32 = 1.0
4137- tar := crun.getTarget(-1)
3663+ tar := c.getTarget(-1)
3664+ if len(tar) == 0 {
3665+ return false
3666+ }
41383667 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
41393668 switch id {
41403669 case targetVelAdd_id:
3670+ tar = c.getTarget(exp[0].evalI(c))
41413671 if len(tar) == 0 {
41423672 return false
41433673 }
4144- tar = crun.getTarget(exp[0].evalI(c))
41453674 case targetVelAdd_x:
4146- if len(tar) == 0 {
4147- return false
4148- }
4149- crun.targetVelAddX(tar, exp[0].evalF(c)*lclscround)
3675+ c.targetVelAddX(tar, exp[0].evalF(c))
41503676 case targetVelAdd_y:
4151- if len(tar) == 0 {
4152- return false
4153- }
4154- crun.targetVelAddY(tar, exp[0].evalF(c)*lclscround)
4155- case targetVelAdd_redirectid:
4156- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4157- crun = rid
4158- lclscround = c.localscl / crun.localscl
4159- tar = crun.getTarget(-1)
4160- if len(tar) == 0 {
4161- return false
4162- }
4163- } else {
4164- return false
4165- }
3677+ c.targetVelAddY(tar, exp[0].evalF(c))
41663678 }
41673679 return true
41683680 })
@@ -4174,34 +3686,22 @@ type targetPowerAdd StateControllerBase
41743686 const (
41753687 targetPowerAdd_id byte = iota
41763688 targetPowerAdd_value
4177- targetPowerAdd_redirectid
41783689 )
41793690
41803691 func (sc targetPowerAdd) Run(c *Char, _ []int32) bool {
4181- crun := c
4182- tar := crun.getTarget(-1)
3692+ tar := c.getTarget(-1)
3693+ if len(tar) == 0 {
3694+ return false
3695+ }
41833696 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
41843697 switch id {
41853698 case targetPowerAdd_id:
3699+ tar = c.getTarget(exp[0].evalI(c))
41863700 if len(tar) == 0 {
41873701 return false
41883702 }
4189- tar = crun.getTarget(exp[0].evalI(c))
41903703 case targetPowerAdd_value:
4191- if len(tar) == 0 {
4192- return false
4193- }
4194- crun.targetPowerAdd(tar, exp[0].evalI(c))
4195- case targetPowerAdd_redirectid:
4196- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4197- crun = rid
4198- tar = crun.getTarget(-1)
4199- if len(tar) == 0 {
4200- return false
4201- }
4202- } else {
4203- return false
4204- }
3704+ c.targetPowerAdd(tar, exp[0].evalI(c))
42053705 }
42063706 return true
42073707 })
@@ -4213,35 +3713,23 @@ type targetDrop StateControllerBase
42133713 const (
42143714 targetDrop_excludeid byte = iota
42153715 targetDrop_keepone
4216- targetDrop_redirectid
42173716 )
42183717
42193718 func (sc targetDrop) Run(c *Char, _ []int32) bool {
4220- crun := c
4221- tar, eid, ko := crun.getTarget(-1), int32(-1), true
3719+ tar, eid, ko := c.getTarget(-1), int32(-1), true
3720+ if len(tar) == 0 {
3721+ return false
3722+ }
42223723 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
42233724 switch id {
42243725 case targetDrop_excludeid:
42253726 eid = exp[0].evalI(c)
42263727 case targetDrop_keepone:
42273728 ko = exp[0].evalB(c)
4228- case targetDrop_redirectid:
4229- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4230- crun = rid
4231- tar = crun.getTarget(-1)
4232- if len(tar) == 0 {
4233- return false
4234- }
4235- } else {
4236- return false
4237- }
42383729 }
42393730 return true
42403731 })
4241- if len(tar) == 0 {
4242- return false
4243- }
4244- crun.targetDrop(eid, ko)
3732+ c.targetDrop(eid, ko)
42453733 return false
42463734 }
42473735
@@ -4251,12 +3739,10 @@ const (
42513739 lifeAdd_absolute byte = iota
42523740 lifeAdd_kill
42533741 lifeAdd_value
4254- lifeAdd_redirectid
42553742 )
42563743
42573744 func (sc lifeAdd) Run(c *Char, _ []int32) bool {
42583745 a, k := false, true
4259- crun := c
42603746 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
42613747 switch id {
42623748 case lifeAdd_absolute:
@@ -4264,13 +3750,7 @@ func (sc lifeAdd) Run(c *Char, _ []int32) bool {
42643750 case lifeAdd_kill:
42653751 k = exp[0].evalB(c)
42663752 case lifeAdd_value:
4267- crun.lifeAdd(float64(exp[0].evalI(c)), k, a)
4268- case lifeAdd_redirectid:
4269- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4270- crun = rid
4271- } else {
4272- return false
4273- }
3753+ c.lifeAdd(float64(exp[0].evalI(c)), k, a)
42743754 }
42753755 return true
42763756 })
@@ -4281,21 +3761,13 @@ type lifeSet StateControllerBase
42813761
42823762 const (
42833763 lifeSet_value byte = iota
4284- lifeSet_redirectid
42853764 )
42863765
42873766 func (sc lifeSet) Run(c *Char, _ []int32) bool {
4288- crun := c
42893767 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
42903768 switch id {
42913769 case lifeSet_value:
4292- crun.lifeSet(exp[0].evalI(c))
4293- case lifeSet_redirectid:
4294- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4295- crun = rid
4296- } else {
4297- return false
4298- }
3770+ c.lifeSet(exp[0].evalI(c))
42993771 }
43003772 return true
43013773 })
@@ -4306,21 +3778,13 @@ type powerAdd StateControllerBase
43063778
43073779 const (
43083780 powerAdd_value byte = iota
4309- powerAdd_redirectid
43103781 )
43113782
43123783 func (sc powerAdd) Run(c *Char, _ []int32) bool {
4313- crun := c
43143784 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
43153785 switch id {
43163786 case powerAdd_value:
4317- crun.powerAdd(exp[0].evalI(c))
4318- case powerAdd_redirectid:
4319- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4320- crun = rid
4321- } else {
4322- return false
4323- }
3787+ c.powerAdd(exp[0].evalI(c))
43243788 }
43253789 return true
43263790 })
@@ -4331,21 +3795,13 @@ type powerSet StateControllerBase
43313795
43323796 const (
43333797 powerSet_value byte = iota
4334- powerSet_redirectid
43353798 )
43363799
43373800 func (sc powerSet) Run(c *Char, _ []int32) bool {
4338- crun := c
43393801 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
43403802 switch id {
43413803 case powerSet_value:
4342- crun.powerSet(exp[0].evalI(c))
4343- case powerSet_redirectid:
4344- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4345- crun = rid
4346- } else {
4347- return false
4348- }
3804+ c.powerSet(exp[0].evalI(c))
43493805 }
43503806 return true
43513807 })
@@ -4357,26 +3813,18 @@ type hitVelSet StateControllerBase
43573813 const (
43583814 hitVelSet_x byte = iota
43593815 hitVelSet_y
4360- hitVelSet_redirectid
43613816 )
43623817
43633818 func (sc hitVelSet) Run(c *Char, _ []int32) bool {
4364- crun := c
43653819 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
43663820 switch id {
43673821 case hitVelSet_x:
43683822 if exp[0].evalB(c) {
4369- crun.hitVelSetX()
3823+ c.hitVelSetX()
43703824 }
43713825 case hitVelSet_y:
43723826 if exp[0].evalB(c) {
4373- crun.hitVelSetY()
4374- }
4375- case hitVelSet_redirectid:
4376- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4377- crun = rid
4378- } else {
4379- return false
3827+ c.hitVelSetY()
43803828 }
43813829 }
43823830 return true
@@ -4389,38 +3837,30 @@ type screenBound StateControllerBase
43893837 const (
43903838 screenBound_value byte = iota
43913839 screenBound_movecamera
4392- screenBound_redirectid
43933840 )
43943841
43953842 func (sc screenBound) Run(c *Char, _ []int32) bool {
4396- crun := c
43973843 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
43983844 switch id {
43993845 case screenBound_value:
44003846 if exp[0].evalB(c) {
4401- crun.setSF(CSF_screenbound)
3847+ c.setSF(CSF_screenbound)
44023848 } else {
4403- crun.unsetSF(CSF_screenbound)
3849+ c.unsetSF(CSF_screenbound)
44043850 }
44053851 case screenBound_movecamera:
44063852 if exp[0].evalB(c) {
4407- crun.setSF(CSF_movecamera_x)
3853+ c.setSF(CSF_movecamera_x)
44083854 } else {
4409- crun.unsetSF(CSF_movecamera_x)
3855+ c.unsetSF(CSF_movecamera_x)
44103856 }
44113857 if len(exp) > 1 {
44123858 if exp[1].evalB(c) {
4413- crun.setSF(CSF_movecamera_y)
3859+ c.setSF(CSF_movecamera_y)
44143860 } else {
4415- crun.unsetSF(CSF_movecamera_y)
3861+ c.unsetSF(CSF_movecamera_y)
44163862 }
44173863 }
4418- case screenBound_redirectid:
4419- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4420- crun = rid
4421- } else {
4422- return false
4423- }
44243864 }
44253865 return true
44263866 })
@@ -4431,22 +3871,14 @@ type posFreeze StateControllerBase
44313871
44323872 const (
44333873 posFreeze_value byte = iota
4434- posFreeze_redirectid
44353874 )
44363875
44373876 func (sc posFreeze) Run(c *Char, _ []int32) bool {
4438- crun := c
44393877 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
44403878 switch id {
44413879 case posFreeze_value:
44423880 if exp[0].evalB(c) {
4443- crun.setSF(CSF_posfreeze)
4444- }
4445- case posFreeze_redirectid:
4446- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4447- crun = rid
4448- } else {
4449- return false
3881+ c.setSF(CSF_posfreeze)
44503882 }
44513883 }
44523884 return true
@@ -4470,9 +3902,9 @@ func (sc envShake) Run(c *Char, _ []int32) bool {
44703902 case envShake_time:
44713903 sys.envShake.time = exp[0].evalI(c)
44723904 case envShake_ampl:
4473- sys.envShake.ampl = int32(float32(exp[0].evalI(c)) * c.localscl)
3905+ sys.envShake.ampl = exp[0].evalI(c)
44743906 case envShake_phase:
4475- sys.envShake.phase = MaxF(0, exp[0].evalF(c)*float32(math.Pi)/180) * c.localscl
3907+ sys.envShake.phase = MaxF(0, exp[0].evalF(c)*float32(math.Pi)/180)
44763908 case envShake_freq:
44773909 sys.envShake.freq = exp[0].evalF(c)
44783910 }
@@ -4490,11 +3922,9 @@ const (
44903922 hitOverride_stateno
44913923 hitOverride_time
44923924 hitOverride_forceair
4493- hitOverride_redirectid
44943925 )
44953926
44963927 func (sc hitOverride) Run(c *Char, _ []int32) bool {
4497- crun := c
44983928 var a, s, st, t int32 = 0, 0, -1, 1
44993929 f := false
45003930 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
@@ -4515,21 +3945,14 @@ func (sc hitOverride) Run(c *Char, _ []int32) bool {
45153945 }
45163946 case hitOverride_forceair:
45173947 f = exp[0].evalB(c)
4518- case hitOverride_redirectid:
4519- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4520- crun = rid
4521- } else {
4522- return false
4523- }
45243948 }
45253949 return true
45263950 })
45273951 if st < 0 {
45283952 t = 0
45293953 }
4530- pn := crun.playerNo
4531- crun.ho[s] = HitOverride{attr: a, stateno: st, time: t, forceair: f,
4532- playerNo: pn}
3954+ c.ho[s] = HitOverride{attr: a, stateno: st, time: t, forceair: f,
3955+ playerNo: sys.workingState.playerNo}
45333956 return false
45343957 }
45353958
@@ -4540,11 +3963,9 @@ const (
45403963 pause_movetime
45413964 pause_pausebg
45423965 pause_endcmdbuftime
4543- pause_redirectid
45443966 )
45453967
45463968 func (sc pause) Run(c *Char, _ []int32) bool {
4547- crun := c
45483969 var t, mt int32 = 0, 0
45493970 sys.pausebg, sys.pauseendcmdbuftime = true, 0
45503971 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
@@ -4557,16 +3978,10 @@ func (sc pause) Run(c *Char, _ []int32) bool {
45573978 sys.pausebg = exp[0].evalB(c)
45583979 case pause_endcmdbuftime:
45593980 sys.pauseendcmdbuftime = exp[0].evalI(c)
4560- case pause_redirectid:
4561- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4562- crun = rid
4563- } else {
4564- return false
4565- }
45663981 }
45673982 return true
45683983 })
4569- crun.setPauseTime(t, mt)
3984+ c.setPauseTime(t, mt)
45703985 return false
45713986 }
45723987
@@ -4584,15 +3999,13 @@ const (
45843999 superPause_poweradd
45854000 superPause_unhittable
45864001 superPause_sound
4587- superPause_redirectid
45884002 )
45894003
45904004 func (sc superPause) Run(c *Char, _ []int32) bool {
4591- crun := c
4592- var t, mt int32 = 30, 0
4005+ var t, mt int32 = 0, 0
45934006 uh := true
4594- sys.superanim, sys.superpmap.remap = crun.getAnim(30, true), nil
4595- sys.superpos, sys.superfacing = [...]float32{crun.pos[0] * crun.localscl, crun.pos[1] * crun.localscl}, crun.facing
4007+ sys.superanim, sys.superpmap.remap = c.getAnim(30, true), nil
4008+ sys.superpos, sys.superfacing = c.pos, c.facing
45964009 sys.superpausebg, sys.superendcmdbuftime, sys.superdarken = true, 0, true
45974010 sys.superp2defmul = sys.super_TargetDefenceMul
45984011 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
@@ -4609,17 +4022,17 @@ func (sc superPause) Run(c *Char, _ []int32) bool {
46094022 sys.superdarken = exp[0].evalB(c)
46104023 case superPause_anim:
46114024 f := exp[0].evalB(c)
4612- if sys.superanim = crun.getAnim(exp[1].evalI(c), f); sys.superanim != nil {
4025+ if sys.superanim = c.getAnim(exp[1].evalI(c), f); sys.superanim != nil {
46134026 if f {
46144027 sys.superpmap.remap = nil
46154028 } else {
4616- sys.superpmap.remap = crun.getPalMap()
4029+ sys.superpmap.remap = c.getPalMap()
46174030 }
46184031 }
46194032 case superPause_pos:
4620- sys.superpos[0] += crun.facing * exp[0].evalF(c) * c.localscl
4033+ sys.superpos[0] += c.facing * exp[0].evalF(c)
46214034 if len(exp) > 1 {
4622- sys.superpos[1] += exp[1].evalF(c) * c.localscl
4035+ sys.superpos[1] += exp[1].evalF(c)
46234036 }
46244037 case superPause_p2defmul:
46254038 sys.superp2defmul = exp[0].evalF(c)
@@ -4627,7 +4040,7 @@ func (sc superPause) Run(c *Char, _ []int32) bool {
46274040 sys.superp2defmul = sys.super_TargetDefenceMul
46284041 }
46294042 case superPause_poweradd:
4630- crun.powerAdd(exp[0].evalI(c))
4043+ c.powerAdd(exp[0].evalI(c))
46314044 case superPause_unhittable:
46324045 uh = exp[0].evalB(c)
46334046 case superPause_sound:
@@ -4639,20 +4052,12 @@ func (sc superPause) Run(c *Char, _ []int32) bool {
46394052 if c.gi().ver[0] == 1 {
46404053 vo = 100
46414054 }
4642- crun.playSound(exp[0].evalB(c), false, false, exp[1].evalI(c), n, -1,
4643- vo, 0, 1, &crun.pos[0])
4644- case superPause_redirectid:
4645- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4646- crun = rid
4647- sys.superanim, sys.superpmap.remap = crun.getAnim(30, true), nil
4648- sys.superpos, sys.superfacing = [...]float32{crun.pos[0] * crun.localscl, crun.pos[1] * crun.localscl}, crun.facing
4649- } else {
4650- return false
4651- }
4055+ c.playSound(exp[0].evalB(c), false, false, exp[1].evalI(c), n, -1,
4056+ vo, 0, 1, &c.pos[0])
46524057 }
46534058 return true
46544059 })
4655- crun.setSuperPauseTime(t, mt, uh)
4060+ c.setSuperPauseTime(t, mt, uh)
46564061 return false
46574062 }
46584063
@@ -4660,36 +4065,27 @@ type trans StateControllerBase
46604065
46614066 const (
46624067 trans_trans byte = iota
4663- trans_redirectid
46644068 )
46654069
46664070 func (sc trans) Run(c *Char, _ []int32) bool {
4667- crun := c
4668- crun.alpha[1] = 255
46694071 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
46704072 switch id {
46714073 case trans_trans:
4672- crun.alpha[0] = exp[0].evalI(c)
4673- crun.alpha[1] = exp[1].evalI(c)
4074+ c.alpha[0] = exp[0].evalI(c)
4075+ c.alpha[1] = exp[1].evalI(c)
46744076 if len(exp) >= 3 {
4675- crun.alpha[0] = Max(0, Min(255, crun.alpha[0]))
4676- crun.alpha[1] = Max(0, Min(255, crun.alpha[1]))
4077+ c.alpha[0] = Max(0, Min(255, c.alpha[0]))
4078+ c.alpha[1] = Max(0, Min(255, c.alpha[1]))
46774079 if len(exp) >= 4 {
4678- crun.alpha[1] = ^crun.alpha[1]
4679- } else if crun.alpha[0] == 1 && crun.alpha[1] == 255 {
4680- crun.alpha[0] = 0
4080+ c.alpha[1] = ^c.alpha[1]
4081+ } else if c.alpha[0] == 1 && c.alpha[1] == 255 {
4082+ c.alpha[0] = 0
46814083 }
46824084 }
4683- case trans_redirectid:
4684- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4685- crun = rid
4686- } else {
4687- return false
4688- }
46894085 }
46904086 return true
46914087 })
4692- crun.setSF(CSF_trans)
4088+ c.setSF(CSF_trans)
46934089 return false
46944090 }
46954091
@@ -4697,24 +4093,16 @@ type playerPush StateControllerBase
46974093
46984094 const (
46994095 playerPush_value byte = iota
4700- playerPush_redirectid
47014096 )
47024097
47034098 func (sc playerPush) Run(c *Char, _ []int32) bool {
4704- crun := c
47054099 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
47064100 switch id {
47074101 case playerPush_value:
47084102 if exp[0].evalB(c) {
4709- crun.setSF(CSF_playerpush)
4103+ c.setSF(CSF_playerpush)
47104104 } else {
4711- crun.unsetSF(CSF_playerpush)
4712- }
4713- case playerPush_redirectid:
4714- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4715- crun = rid
4716- } else {
4717- return false
4105+ c.unsetSF(CSF_playerpush)
47184106 }
47194107 }
47204108 return true
@@ -4728,25 +4116,17 @@ const (
47284116 stateTypeSet_statetype byte = iota
47294117 stateTypeSet_movetype
47304118 stateTypeSet_physics
4731- stateTypeSet_redirectid
47324119 )
47334120
47344121 func (sc stateTypeSet) Run(c *Char, _ []int32) bool {
4735- crun := c
47364122 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
47374123 switch id {
47384124 case stateTypeSet_statetype:
4739- crun.ss.stateType = StateType(exp[0].evalI(c))
4125+ c.ss.stateType = StateType(exp[0].evalI(c))
47404126 case stateTypeSet_movetype:
4741- crun.ss.moveType = MoveType(exp[0].evalI(c))
4127+ c.ss.moveType = MoveType(exp[0].evalI(c))
47424128 case stateTypeSet_physics:
4743- crun.ss.physics = StateType(exp[0].evalI(c))
4744- case stateTypeSet_redirectid:
4745- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4746- crun = rid
4747- } else {
4748- return false
4749- }
4129+ c.ss.physics = StateType(exp[0].evalI(c))
47504130 }
47514131 return true
47524132 })
@@ -4758,30 +4138,22 @@ type angleDraw StateControllerBase
47584138 const (
47594139 angleDraw_value byte = iota
47604140 angleDraw_scale
4761- angleDraw_redirectid
47624141 )
47634142
47644143 func (sc angleDraw) Run(c *Char, _ []int32) bool {
4765- crun := c
4144+ c.setSF(CSF_angledraw)
47664145 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
47674146 switch id {
47684147 case angleDraw_value:
4769- crun.angleSet(exp[0].evalF(c))
4148+ c.angleSet(exp[0].evalF(c))
47704149 case angleDraw_scale:
4771- crun.angleScalse[0] *= exp[0].evalF(c)
4150+ c.angleScalse[0] *= exp[0].evalF(c)
47724151 if len(exp) > 1 {
4773- crun.angleScalse[1] *= exp[1].evalF(c)
4774- }
4775- case angleDraw_redirectid:
4776- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4777- crun = rid
4778- } else {
4779- return false
4152+ c.angleScalse[1] *= exp[1].evalF(c)
47804153 }
47814154 }
47824155 return true
47834156 })
4784- crun.setSF(CSF_angledraw)
47854157 return false
47864158 }
47874159
@@ -4789,21 +4161,13 @@ type angleSet StateControllerBase
47894161
47904162 const (
47914163 angleSet_value byte = iota
4792- angleSet_redirectid
47934164 )
47944165
47954166 func (sc angleSet) Run(c *Char, _ []int32) bool {
4796- crun := c
47974167 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
47984168 switch id {
47994169 case angleSet_value:
4800- crun.angleSet(exp[0].evalF(c))
4801- case angleSet_redirectid:
4802- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4803- crun = rid
4804- } else {
4805- return false
4806- }
4170+ c.angleSet(exp[0].evalF(c))
48074171 }
48084172 return true
48094173 })
@@ -4814,21 +4178,13 @@ type angleAdd StateControllerBase
48144178
48154179 const (
48164180 angleAdd_value byte = iota
4817- angleAdd_redirectid
48184181 )
48194182
48204183 func (sc angleAdd) Run(c *Char, _ []int32) bool {
4821- crun := c
48224184 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
48234185 switch id {
48244186 case angleAdd_value:
4825- crun.angleSet(crun.angle + exp[0].evalF(c))
4826- case angleAdd_redirectid:
4827- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4828- crun = rid
4829- } else {
4830- return false
4831- }
4187+ c.angleSet(c.angle + exp[0].evalF(c))
48324188 }
48334189 return true
48344190 })
@@ -4839,21 +4195,13 @@ type angleMul StateControllerBase
48394195
48404196 const (
48414197 angleMul_value byte = iota
4842- angleMul_redirectid
48434198 )
48444199
48454200 func (sc angleMul) Run(c *Char, _ []int32) bool {
4846- crun := c
48474201 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
48484202 switch id {
48494203 case angleMul_value:
4850- crun.angleSet(crun.angle * exp[0].evalF(c))
4851- case angleMul_redirectid:
4852- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4853- crun = rid
4854- } else {
4855- return false
4856- }
4204+ c.angleSet(c.angle * exp[0].evalF(c))
48574205 }
48584206 return true
48594207 })
@@ -4963,16 +4311,14 @@ const (
49634311 makeDust_spacing byte = iota
49644312 makeDust_pos
49654313 makeDust_pos2
4966- makeDust_redirectid
49674314 )
49684315
49694316 func (sc makeDust) Run(c *Char, _ []int32) bool {
4970- crun := c
49714317 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
49724318 switch id {
49734319 case makeDust_spacing:
49744320 s := Max(1, exp[0].evalI(c))
4975- if crun.time()%s != s-1 {
4321+ if c.time()%s != s-1 {
49764322 return false
49774323 }
49784324 case makeDust_pos:
@@ -4980,21 +4326,15 @@ func (sc makeDust) Run(c *Char, _ []int32) bool {
49804326 if len(exp) > 1 {
49814327 y = exp[1].evalF(c)
49824328 }
4983- crun.makeDust(x-float32(crun.size.draw.offset[0]),
4984- y-float32(crun.size.draw.offset[1]))
4329+ c.makeDust(x-float32(c.size.draw.offset[0]),
4330+ y-float32(c.size.draw.offset[1]))
49854331 case makeDust_pos2:
49864332 x, y := exp[0].evalF(c), float32(0)
49874333 if len(exp) > 1 {
49884334 y = exp[1].evalF(c)
49894335 }
4990- crun.makeDust(x-float32(crun.size.draw.offset[0]),
4991- y-float32(crun.size.draw.offset[1]))
4992- case makeDust_redirectid:
4993- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
4994- crun = rid
4995- } else {
4996- return false
4997- }
4336+ c.makeDust(x-float32(c.size.draw.offset[0]),
4337+ y-float32(c.size.draw.offset[1]))
49984338 }
49994339 return true
50004340 })
@@ -5005,23 +4345,13 @@ type attackDist StateControllerBase
50054345
50064346 const (
50074347 attackDist_value byte = iota
5008- attackDist_redirectid
50094348 )
50104349
50114350 func (sc attackDist) Run(c *Char, _ []int32) bool {
5012- crun := c
5013- var lclscround float32 = 1.0
50144351 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
50154352 switch id {
50164353 case attackDist_value:
5017- crun.attackDist = exp[0].evalF(c) * lclscround
5018- case attackDist_redirectid:
5019- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5020- crun = rid
5021- lclscround = c.localscl / crun.localscl
5022- } else {
5023- return false
5024- }
4354+ c.attackDist = exp[0].evalF(c)
50254355 }
50264356 return true
50274357 })
@@ -5032,21 +4362,13 @@ type attackMulSet StateControllerBase
50324362
50334363 const (
50344364 attackMulSet_value byte = iota
5035- attackMulSet_redirectid
50364365 )
50374366
50384367 func (sc attackMulSet) Run(c *Char, _ []int32) bool {
5039- crun := c
50404368 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
50414369 switch id {
50424370 case attackMulSet_value:
5043- crun.attackMul = float32(crun.gi().data.attack) / 100 * exp[0].evalF(c)
5044- case attackMulSet_redirectid:
5045- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5046- crun = rid
5047- } else {
5048- return false
5049- }
4371+ c.attackMul = float32(c.gi().data.attack) / 100 * exp[0].evalF(c)
50504372 }
50514373 return true
50524374 })
@@ -5057,21 +4379,13 @@ type defenceMulSet StateControllerBase
50574379
50584380 const (
50594381 defenceMulSet_value byte = iota
5060- defenceMulSet_redirectid
50614382 )
50624383
50634384 func (sc defenceMulSet) Run(c *Char, _ []int32) bool {
5064- crun := c
50654385 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
50664386 switch id {
50674387 case defenceMulSet_value:
5068- crun.defenceMul = float32(crun.gi().data.defence) / (exp[0].evalF(c) * 100)
5069- case defenceMulSet_redirectid:
5070- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5071- crun = rid
5072- } else {
5073- return false
5074- }
4388+ c.defenceMul = float32(c.gi().data.defence) / (exp[0].evalF(c) * 100)
50754389 }
50764390 return true
50774391 })
@@ -5082,24 +4396,16 @@ type fallEnvShake StateControllerBase
50824396
50834397 const (
50844398 fallEnvShake_ byte = iota
5085- fallEnvShake_redirectid
50864399 )
50874400
50884401 func (sc fallEnvShake) Run(c *Char, _ []int32) bool {
5089- crun := c
50904402 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
50914403 switch id {
50924404 case fallEnvShake_:
5093- sys.envShake = EnvShake{time: crun.ghv.fall.envshake_time,
5094- freq: crun.ghv.fall.envshake_freq * math.Pi / 180,
5095- ampl: crun.ghv.fall.envshake_ampl, phase: crun.ghv.fall.envshake_phase}
4405+ sys.envShake = EnvShake{time: c.ghv.fall.envshake_time,
4406+ freq: c.ghv.fall.envshake_freq * math.Pi / 180,
4407+ ampl: c.ghv.fall.envshake_ampl, phase: c.ghv.fall.envshake_phase}
50964408 sys.envShake.setDefPhase()
5097- case fallEnvShake_redirectid:
5098- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5099- crun = rid
5100- } else {
5101- return false
5102- }
51034409 }
51044410 return true
51054411 })
@@ -5110,21 +4416,13 @@ type hitFallDamage StateControllerBase
51104416
51114417 const (
51124418 hitFallDamage_ byte = iota
5113- hitFallDamage_redirectid
51144419 )
51154420
51164421 func (sc hitFallDamage) Run(c *Char, _ []int32) bool {
5117- crun := c
51184422 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
51194423 switch id {
51204424 case hitFallDamage_:
5121- crun.hitFallDamage()
5122- case hitFallDamage_redirectid:
5123- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5124- crun = rid
5125- } else {
5126- return false
5127- }
4425+ c.hitFallDamage()
51284426 }
51294427 return true
51304428 })
@@ -5135,21 +4433,13 @@ type hitFallVel StateControllerBase
51354433
51364434 const (
51374435 hitFallVel_ byte = iota
5138- hitFallVel_redirectid
51394436 )
51404437
51414438 func (sc hitFallVel) Run(c *Char, _ []int32) bool {
5142- crun := c
51434439 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
51444440 switch id {
51454441 case hitFallVel_:
5146- crun.hitFallVel()
5147- case hitFallVel_redirectid:
5148- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5149- crun = rid
5150- } else {
5151- return false
5152- }
4442+ c.hitFallVel()
51534443 }
51544444 return true
51554445 })
@@ -5162,33 +4452,25 @@ const (
51624452 hitFallSet_value byte = iota
51634453 hitFallSet_xvel
51644454 hitFallSet_yvel
5165- hitFallSet_redirectid
51664455 )
51674456
51684457 func (sc hitFallSet) Run(c *Char, _ []int32) bool {
5169- crun := c
51704458 f, xv, yv := int32(-1), float32(math.NaN()), float32(math.NaN())
51714459 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
51724460 switch id {
51734461 case hitFallSet_value:
51744462 f = exp[0].evalI(c)
5175- if len(crun.ghv.hitBy) == 0 {
4463+ if len(c.ghv.hitBy) == 0 {
51764464 return false
51774465 }
51784466 case hitFallSet_xvel:
51794467 xv = exp[0].evalF(c)
51804468 case hitFallSet_yvel:
51814469 yv = exp[0].evalF(c)
5182- case hitFallSet_redirectid:
5183- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5184- crun = rid
5185- } else {
5186- return false
5187- }
51884470 }
51894471 return true
51904472 })
5191- crun.hitFallSet(f, xv, yv)
4473+ c.hitFallSet(f, xv, yv)
51924474 return false
51934475 }
51944476
@@ -5199,11 +4481,9 @@ const (
51994481 varRangeSet_last
52004482 varRangeSet_value
52014483 varRangeSet_fvalue
5202- varRangeSet_redirectid
52034484 )
52044485
52054486 func (sc varRangeSet) Run(c *Char, _ []int32) bool {
5206- crun := c
52074487 var first, last int32 = 0, 0
52084488 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
52094489 switch id {
@@ -5215,22 +4495,16 @@ func (sc varRangeSet) Run(c *Char, _ []int32) bool {
52154495 v := exp[0].evalI(c)
52164496 if first >= 0 && last < int32(NumVar) {
52174497 for i := first; i <= last; i++ {
5218- crun.ivar[i] = v
4498+ c.ivar[i] = v
52194499 }
52204500 }
52214501 case varRangeSet_fvalue:
52224502 fv := exp[0].evalF(c)
52234503 if first >= 0 && last < int32(NumFvar) {
52244504 for i := first; i <= last; i++ {
5225- crun.fvar[i] = fv
4505+ c.fvar[i] = fv
52264506 }
52274507 }
5228- case varRangeSet_redirectid:
5229- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5230- crun = rid
5231- } else {
5232- return false
5233- }
52344508 }
52354509 return true
52364510 })
@@ -5242,11 +4516,9 @@ type remapPal StateControllerBase
52424516 const (
52434517 remapPal_source byte = iota
52444518 remapPal_dest
5245- remapPal_redirectid
52464519 )
52474520
52484521 func (sc remapPal) Run(c *Char, _ []int32) bool {
5249- crun := c
52504522 src := [...]int32{-1, -1}
52514523 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
52524524 switch id {
@@ -5255,22 +4527,12 @@ func (sc remapPal) Run(c *Char, _ []int32) bool {
52554527 if len(exp) > 1 {
52564528 src[1] = exp[1].evalI(c)
52574529 }
5258- if src[0] == -1 {
5259- src[0] = 1
5260- src[1] = 1
5261- }
52624530 case remapPal_dest:
52634531 dst := [...]int32{exp[0].evalI(c), -1}
52644532 if len(exp) > 1 {
52654533 dst[1] = exp[1].evalI(c)
52664534 }
5267- crun.remapPal(crun.getPalfx(), src, dst)
5268- case remapPal_redirectid:
5269- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5270- crun = rid
5271- } else {
5272- return false
5273- }
4535+ c.remapPal(c.getPalfx(), src, dst)
52744536 }
52754537 return true
52764538 })
@@ -5281,24 +4543,16 @@ type stopSnd StateControllerBase
52814543
52824544 const (
52834545 stopSnd_channel byte = iota
5284- stopSnd_redirectid
52854546 )
52864547
52874548 func (sc stopSnd) Run(c *Char, _ []int32) bool {
5288- crun := c
52894549 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
52904550 switch id {
52914551 case stopSnd_channel:
52924552 if ch := Min(255, exp[0].evalI(c)); ch < 0 {
52934553 sys.stopAllSound()
5294- } else if int(ch) < len(crun.sounds) {
5295- crun.sounds[ch].sound = nil
5296- }
5297- case stopSnd_redirectid:
5298- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5299- crun = rid
5300- } else {
5301- return false
4554+ } else if int(ch) < len(c.sounds) {
4555+ c.sounds[ch].sound = nil
53024556 }
53034557 }
53044558 return true
@@ -5312,12 +4566,10 @@ const (
53124566 sndPan_channel byte = iota
53134567 sndPan_pan
53144568 sndPan_abspan
5315- sndPan_redirectid
53164569 )
53174570
53184571 func (sc sndPan) Run(c *Char, _ []int32) bool {
5319- crun := c
5320- ch, pan, x := int32(-1), float32(0), &crun.pos[0]
4572+ ch, pan, x := int32(-1), float32(0), &c.pos[0]
53214573 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
53224574 switch id {
53234575 case sndPan_channel:
@@ -5327,18 +4579,11 @@ func (sc sndPan) Run(c *Char, _ []int32) bool {
53274579 case sndPan_abspan:
53284580 pan = exp[0].evalF(c)
53294581 x = nil
5330- case sndPan_redirectid:
5331- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5332- crun = rid
5333- x = &crun.pos[0]
5334- } else {
5335- return false
5336- }
53374582 }
53384583 return true
53394584 })
5340- if ch <= 0 && int(ch) < len(crun.sounds) {
5341- crun.sounds[ch].SetPan(pan, x)
4585+ if ch <= 0 && int(ch) < len(c.sounds) {
4586+ c.sounds[ch].SetPan(pan, x)
53424587 }
53434588 return false
53444589 }
@@ -5348,32 +4593,23 @@ type varRandom StateControllerBase
53484593 const (
53494594 varRandom_v byte = iota
53504595 varRandom_range
5351- varRandom_redirectid
53524596 )
53534597
53544598 func (sc varRandom) Run(c *Char, _ []int32) bool {
5355- crun := c
53564599 var v int32
5357- var min, max int32 = 0, 1000
53584600 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
53594601 switch id {
53604602 case varRandom_v:
53614603 v = exp[0].evalI(c)
53624604 case varRandom_range:
5363- min, max = 0, exp[0].evalI(c)
4605+ var min, max int32 = 0, exp[0].evalI(c)
53644606 if len(exp) > 1 {
53654607 min, max = max, exp[1].evalI(c)
53664608 }
5367- case varRandom_redirectid:
5368- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5369- crun = rid
5370- } else {
5371- return false
5372- }
4609+ c.varSet(v, RandI(min, max))
53734610 }
53744611 return true
53754612 })
5376- crun.varSet(v, RandI(min, max))
53774613 return false
53784614 }
53794615
@@ -5381,21 +4617,13 @@ type gravity StateControllerBase
53814617
53824618 const (
53834619 gravity_ byte = iota
5384- gravity_redirectid
53854620 )
53864621
53874622 func (sc gravity) Run(c *Char, _ []int32) bool {
5388- crun := c
53894623 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
53904624 switch id {
53914625 case gravity_:
5392- crun.gravity()
5393- case gravity_redirectid:
5394- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5395- crun = rid
5396- } else {
5397- return false
5398- }
4626+ c.gravity()
53994627 }
54004628 return true
54014629 })
@@ -5408,92 +4636,63 @@ const (
54084636 bindToParent_time byte = iota
54094637 bindToParent_facing
54104638 bindToParent_pos
5411- bindToParent_redirectid
54124639 )
54134640
54144641 func (sc bindToParent) Run(c *Char, _ []int32) bool {
5415- crun := c
5416- var lclscround float32 = 1.0
5417- p := crun.parent()
5418- var x, y float32 = 0, 0
5419- var time int32 = 1
4642+ p := c.parent()
4643+ if p == nil {
4644+ return false
4645+ }
4646+ c.bindTime, c.bindPos = 1, [2]float32{}
4647+ c.setBindToId(p)
54204648 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
54214649 switch id {
54224650 case bindToParent_time:
5423- time = exp[0].evalI(c)
4651+ c.setBindTime(exp[0].evalI(c))
54244652 case bindToParent_facing:
54254653 if f := exp[0].evalI(c); f < 0 {
5426- crun.bindFacing = -1
4654+ c.bindFacing = -1
54274655 } else if f > 0 {
5428- crun.bindFacing = 1
4656+ c.bindFacing = 1
54294657 }
54304658 case bindToParent_pos:
5431- x = exp[0].evalF(c) * lclscround
4659+ c.bindPos[0] = exp[0].evalF(c)
54324660 if len(exp) > 1 {
5433- y = exp[1].evalF(c) * lclscround
5434- }
5435- case bindToParent_redirectid:
5436- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5437- crun = rid
5438- lclscround = c.localscl / crun.localscl
5439- p = crun.parent()
5440- } else {
5441- return false
4661+ c.bindPos[1] = exp[1].evalF(c)
54424662 }
54434663 }
54444664 return true
54454665 })
5446- if p == nil {
5447- return false
5448- }
5449- crun.bindPos[0] = x
5450- crun.bindPos[1] = y
5451- crun.setBindTime(time)
5452- crun.setBindToId(p)
54534666 return false
54544667 }
54554668
54564669 type bindToRoot bindToParent
54574670
54584671 func (sc bindToRoot) Run(c *Char, _ []int32) bool {
5459- crun := c
5460- var lclscround float32 = 1.0
5461- r := crun.root()
5462- var x, y float32 = 0, 0
5463- var time int32 = 1
4672+ r := c.root()
4673+ if r == nil {
4674+ return false
4675+ }
4676+ c.bindTime, c.bindPos = 1, [2]float32{}
4677+ c.setBindToId(r)
54644678 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
54654679 switch id {
54664680 case bindToParent_time:
5467- time = exp[0].evalI(c)
4681+ c.setBindTime(exp[0].evalI(c))
54684682 case bindToParent_facing:
54694683 if f := exp[0].evalI(c); f < 0 {
5470- crun.bindFacing = -1
4684+ c.bindFacing = -1
54714685 } else if f > 0 {
5472- crun.bindFacing = 1
4686+ c.bindFacing = 1
54734687 }
54744688 case bindToParent_pos:
5475- x = exp[0].evalF(c) * lclscround
4689+ c.bindPos[0] = exp[0].evalF(c)
54764690 if len(exp) > 1 {
5477- y = exp[1].evalF(c) * lclscround
5478- }
5479- case bindToParent_redirectid:
5480- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5481- crun = rid
5482- lclscround = c.localscl / crun.localscl
5483- r = crun.root()
5484- } else {
5485- return false
4691+ c.bindPos[1] = exp[1].evalF(c)
54864692 }
54874693 }
54884694 return true
54894695 })
5490- if r == nil {
5491- return false
5492- }
5493- crun.bindPos[0] = x
5494- crun.bindPos[1] = y
5495- crun.setBindTime(time)
5496- crun.setBindToId(r)
54974696 return false
54984697 }
54994698
@@ -5501,21 +4700,13 @@ type removeExplod StateControllerBase
55014700
55024701 const (
55034702 removeExplod_id byte = iota
5504- removeExplod_redirectid
55054703 )
55064704
55074705 func (sc removeExplod) Run(c *Char, _ []int32) bool {
5508- crun := c
55094706 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
55104707 switch id {
55114708 case removeExplod_id:
5512- crun.removeExplod(exp[0].evalI(c))
5513- case removeExplod_redirectid:
5514- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5515- crun = rid
5516- } else {
5517- return false
5518- }
4709+ c.removeExplod(exp[0].evalI(c))
55194710 }
55204711 return true
55214712 })
@@ -5527,11 +4718,9 @@ type explodBindTime StateControllerBase
55274718 const (
55284719 explodBindTime_id byte = iota
55294720 explodBindTime_time
5530- explodBindTime_redirectid
55314721 )
55324722
55334723 func (sc explodBindTime) Run(c *Char, _ []int32) bool {
5534- crun := c
55354724 var eid, time int32 = -1, 0
55364725 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
55374726 switch id {
@@ -5539,16 +4728,10 @@ func (sc explodBindTime) Run(c *Char, _ []int32) bool {
55394728 eid = exp[0].evalI(c)
55404729 case explodBindTime_time:
55414730 time = exp[0].evalI(c)
5542- case explodBindTime_redirectid:
5543- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5544- crun = rid
5545- } else {
5546- return false
5547- }
55484731 }
55494732 return true
55504733 })
5551- crun.explodBindTime(eid, time)
4734+ c.explodBindTime(eid, time)
55524735 return false
55534736 }
55544737
@@ -5556,21 +4739,13 @@ type moveHitReset StateControllerBase
55564739
55574740 const (
55584741 moveHitReset_ byte = iota
5559- moveHitReset_redirectid
55604742 )
55614743
55624744 func (sc moveHitReset) Run(c *Char, _ []int32) bool {
5563- crun := c
55644745 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
55654746 switch id {
55664747 case moveHitReset_:
5567- crun.clearMoveHit()
5568- case moveHitReset_redirectid:
5569- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5570- crun = rid
5571- } else {
5572- return false
5573- }
4748+ c.clearMoveHit()
55744749 }
55754750 return true
55764751 })
@@ -5581,21 +4756,13 @@ type hitAdd StateControllerBase
55814756
55824757 const (
55834758 hitAdd_value byte = iota
5584- hitAdd_redirectid
55854759 )
55864760
55874761 func (sc hitAdd) Run(c *Char, _ []int32) bool {
5588- crun := c
55894762 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
55904763 switch id {
55914764 case hitAdd_value:
5592- crun.hitAdd(exp[0].evalI(c))
5593- case hitAdd_redirectid:
5594- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5595- crun = rid
5596- } else {
5597- return false
5598- }
4765+ c.hitAdd(exp[0].evalI(c))
55994766 }
56004767 return true
56014768 })
@@ -5607,23 +4774,15 @@ type offset StateControllerBase
56074774 const (
56084775 offset_x byte = iota
56094776 offset_y
5610- offset_redirectid
56114777 )
56124778
56134779 func (sc offset) Run(c *Char, _ []int32) bool {
5614- crun := c
56154780 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
56164781 switch id {
56174782 case offset_x:
5618- crun.offset[0] = exp[0].evalF(c)
4783+ c.offset[0] = exp[0].evalF(c)
56194784 case offset_y:
5620- crun.offset[1] = exp[0].evalF(c)
5621- case offset_redirectid:
5622- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5623- crun = rid
5624- } else {
5625- return false
5626- }
4785+ c.offset[1] = exp[0].evalF(c)
56274786 }
56284787 return true
56294788 })
@@ -5634,21 +4793,13 @@ type victoryQuote StateControllerBase
56344793
56354794 const (
56364795 victoryQuote_value byte = iota
5637- victoryQuote_redirectid
56384796 )
56394797
56404798 func (sc victoryQuote) Run(c *Char, _ []int32) bool {
5641- crun := c
56424799 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
56434800 switch id {
56444801 case victoryQuote_value:
56454802 exp[0].evalI(c)
5646- case victoryQuote_redirectid:
5647- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5648- crun = rid
5649- } else {
5650- return false
5651- }
56524803 }
56534804 return true
56544805 })
@@ -5660,27 +4811,19 @@ type zoom StateControllerBase
56604811 const (
56614812 zoom_pos byte = iota
56624813 zoom_scale
5663- zoom_redirectid
56644814 )
56654815
56664816 func (sc zoom) Run(c *Char, _ []int32) bool {
5667- crun := c
56684817 sys.drawScale = sys.cam.Scale
56694818 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
56704819 switch id {
56714820 case zoom_pos:
5672- sys.zoomPos[0] = exp[0].evalF(c) / sys.cam.Scale
4821+ sys.zoomPos[0] = exp[0].evalF(c)
56734822 if len(exp) > 1 {
5674- sys.zoomPos[1] = exp[1].evalF(c) / sys.cam.Scale
4823+ sys.zoomPos[1] = exp[1].evalF(c)
56754824 }
56764825 case zoom_scale:
5677- sys.drawScale = exp[0].evalF(c) * sys.cam.Scale
5678- case zoom_redirectid:
5679- if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
5680- crun = rid
5681- } else {
5682- return false
5683- }
4826+ sys.drawScale = exp[0].evalF(c)
56844827 }
56854828 return true
56864829 })
--- a/src/camera.go
+++ b/src/camera.go
@@ -16,13 +16,12 @@ type stageCamera struct {
1616 zoffset int32
1717 ztopscale float32
1818 drawOffsetY float32
19- mugen_zoomout float32
2019 }
2120
2221 func newStageCamera() *stageCamera {
2322 return &stageCamera{verticalfollow: 0.2, tension: 50,
2423 localcoord: [...]int32{320, 240}, localscl: float32(sys.gameWidth / 320),
25- mugen_zoomout: 1, ztopscale: 1}
24+ ztopscale: 1}
2625 }
2726
2827 type Camera struct {
@@ -43,8 +42,8 @@ func newCamera() *Camera {
4342 return &Camera{ZoomMin: 5.0 / 6, ZoomMax: 15.0 / 14, ZoomSpeed: 12}
4443 }
4544 func (c *Camera) Init() {
46- c.boundL = float32(c.boundleft-c.startx)*c.localscl - ((1-c.mugen_zoomout)*100*c.mugen_zoomout)*(1/c.mugen_zoomout)*(1/c.mugen_zoomout)*1.6
47- c.boundR = float32(c.boundright-c.startx)*c.localscl + ((1-c.mugen_zoomout)*100*c.mugen_zoomout)*(1/c.mugen_zoomout)*(1/c.mugen_zoomout)*1.6
45+ c.boundL = float32(c.boundleft-c.startx) * c.localscl
46+ c.boundR = float32(c.boundright-c.startx) * c.localscl
4847 c.halfWidth = float32(sys.gameWidth) / 2
4948 c.XMin = c.boundL - c.halfWidth/c.BaseScale()
5049 c.XMax = c.boundR + c.halfWidth/c.BaseScale()
@@ -82,14 +81,9 @@ func (c *Camera) Update(scl, x, y float32) {
8281 c.Pos[0] = x
8382 c.Pos[1] = y
8483 }
85-func (c *Camera) ScaleBound(scl, sclmul float32) float32 {
84+func (c *Camera) ScaleBound(scl float32) float32 {
8685 if c.ZoomEnable {
87- if sys.debugPaused() {
88- sclmul = 1
89- } else if sys.turbo < 1 {
90- sclmul = Pow(sclmul, sys.turbo)
91- }
92- return MaxF(c.MinScale, MinF(c.ZoomMax, scl*sclmul))
86+ return MaxF(c.MinScale, MinF(c.ZoomMax, scl))
9387 }
9488 return 1
9589 }
@@ -133,11 +127,7 @@ func (c *Camera) action(x, y *float32, leftest, rightest, lowest, highest,
133127 vx += vel
134128 }
135129 }
136- if sys.debugPaused() {
137- vx = 0
138- } else {
139- vx *= MinF(1, sys.turbo)
140- }
130+ vx *= MinF(1, sys.turbo)
141131 if vx < 0 {
142132 tmp = MaxF(leftest+tension, tmp)
143133 if vx < tmp {
@@ -180,10 +170,9 @@ func (c *Camera) action(x, y *float32, leftest, rightest, lowest, highest,
180170 sclMul = MinF(4.0/3, Pow((Pow(2, c.ZoomSpeed)+3)/Pow(2, c.ZoomSpeed)-
181171 sclMul, 64))
182172 }
183- //if pause {
184- // sclMul = 1
185- //} else if sclMul > 1 {
186- if sclMul > 1 {
173+ if pause {
174+ sclMul = 1
175+ } else if sclMul > 1 {
187176 sclMul = (sclMul-1)*Pow(c.zoomdelay, 8) + 1
188177 if tmp*sclMul > sys.xmax-sys.xmin {
189178 sclMul = (sys.xmax - sys.xmin) / tmp
--- a/src/char.go
+++ b/src/char.go
@@ -9,7 +9,6 @@ import (
99 )
1010
1111 const MaxPalNo = 12
12-const MaxQuotes = 100
1312
1413 type SystemCharFlag uint32
1514
@@ -81,14 +80,6 @@ const (
8180 PT_N
8281 )
8382
84-type Space int32
85-
86-const (
87- Space_none Space = iota
88- Space_stage
89- Space_screen
90-)
91-
9283 type ClsnRect [][4]float32
9384
9485 func (cr *ClsnRect) Add(clsn []float32, x, y, xs, ys float32) {
@@ -113,7 +104,7 @@ func (cr ClsnRect) draw(trans int32) {
113104 for _, c := range cr {
114105 RenderMugen(*sys.clsnSpr.Tex, sys.clsnSpr.Pal, -1, sys.clsnSpr.Size,
115106 -c[0]*sys.widthScale, -c[1]*sys.heightScale, &notiling,
116- c[2]*sys.widthScale, c[2]*sys.widthScale, c[3]*sys.heightScale, 1, 0, 0, 0, 0,
107+ c[2]*sys.widthScale, c[2]*sys.widthScale, c[3]*sys.heightScale, 1, 0, 0,
117108 trans, &sys.scrrect, 0, 0)
118109 }
119110 }
@@ -163,38 +154,38 @@ type CharSize struct {
163154 xscale float32
164155 yscale float32
165156 ground struct {
166- back float32
167- front float32
157+ back int32
158+ front int32
168159 }
169160 air struct {
170- back float32
171- front float32
161+ back int32
162+ front int32
172163 }
173- height float32
164+ height int32
174165 attack struct {
175- dist float32
166+ dist int32
176167 z struct {
177- width [2]float32
168+ width [2]int32
178169 }
179170 }
180171 proj struct {
181172 attack struct {
182- dist float32
173+ dist int32
183174 }
184175 doscale int32
185176 }
186177 head struct {
187- pos [2]float32
178+ pos [2]int32
188179 }
189180 mid struct {
190- pos [2]float32
181+ pos [2]int32
191182 }
192- shadowoffset float32
183+ shadowoffset int32
193184 draw struct {
194- offset [2]float32
185+ offset [2]int32
195186 }
196187 z struct {
197- width float32
188+ width int32
198189 }
199190 }
200191
@@ -210,12 +201,12 @@ func (cs *CharSize) init() {
210201 cs.attack.dist = 160
211202 cs.proj.attack.dist = 90
212203 cs.proj.doscale = 0
213- cs.head.pos = [...]float32{-5, -90}
214- cs.mid.pos = [...]float32{-5, -60}
204+ cs.head.pos = [...]int32{-5, -90}
205+ cs.mid.pos = [...]int32{-5, -60}
215206 cs.shadowoffset = 0
216- cs.draw.offset = [...]float32{0, 0}
207+ cs.draw.offset = [...]int32{0, 0}
217208 cs.z.width = 3
218- cs.attack.z.width = [...]float32{4, 4}
209+ cs.attack.z.width = [...]int32{4, 4}
219210 }
220211
221212 type CharVelocity struct {
@@ -428,7 +419,6 @@ type HitDef struct {
428419 hitflag int32
429420 guardflag int32
430421 affectteam int32
431- teamside int
432422 animtype Reaction
433423 air_animtype Reaction
434424 priority int32
@@ -581,9 +571,9 @@ func (ghv *GetHitVar) clear() {
581571 func (ghv *GetHitVar) clearOff() {
582572 ghv.xoff, ghv.yoff = 0, 0
583573 }
584-func (ghv GetHitVar) getYaccel(c *Char) float32 {
574+func (ghv GetHitVar) getYaccel() float32 {
585575 if math.IsNaN(float64(ghv.yaccel)) {
586- return 0.35 / c.localscl
576+ return 0.35
587577 }
588578 return ghv.yaccel
589579 }
@@ -642,8 +632,6 @@ type aimgImage struct {
642632 anim Animation
643633 pos, scl, ascl [2]float32
644634 angle float32
645- yangle float32
646- xangle float32
647635 oldVer bool
648636 }
649637
@@ -764,8 +752,6 @@ func (ai *AfterImage) recAfterImg(sd *SprData) {
764752 img.pos = sd.pos
765753 img.scl = sd.scl
766754 img.angle = sd.angle
767- img.yangle = sd.yangle
768- img.xangle = sd.xangle
769755 img.ascl = sd.ascl
770756 img.oldVer = sd.oldVer
771757 ai.imgidx = (ai.imgidx + 1) & 63
@@ -788,8 +774,8 @@ func (ai *AfterImage) recAndCue(sd *SprData, rec bool) {
788774 for i := ai.framegap; i <= end; i += ai.framegap {
789775 img := &ai.imgs[(ai.imgidx-i)&63]
790776 sys.sprites.add(&SprData{&img.anim, &ai.palfx[i/ai.framegap-1], img.pos,
791- img.scl, ai.alpha, sd.priority - 2, img.angle, img.yangle, img.xangle, img.ascl,
792- false, sd.bright, sd.oldVer, sd.facing}, 0, 0, 0, 0)
777+ img.scl, ai.alpha, sd.priority - 2, img.angle, img.ascl,
778+ false, sd.bright, sd.oldVer}, 0, 0, 0, 0)
793779 }
794780 if rec {
795781 ai.recAfterImg(sd)
@@ -807,7 +793,6 @@ type Explod struct {
807793 accel [2]float32
808794 sprpriority int32
809795 postype PosType
810- space Space
811796 offset [2]float32
812797 relativef int32
813798 pos [2]float32
@@ -824,17 +809,14 @@ type Explod struct {
824809 bindId int32
825810 ignorehitpause bool
826811 angle float32
827- yangle float32
828- xangle float32
829812 oldPos [2]float32
830813 newPos [2]float32
831814 palfx *PalFX
832- localscl float32
833815 }
834816
835817 func (e *Explod) clear() {
836818 *e = Explod{id: IErr, scale: [...]float32{1, 1}, removetime: -2,
837- postype: PT_P1, relativef: 1, facing: 1, vfacing: 1, localscl: 1, space: Space_none,
819+ postype: PT_P1, relativef: 1, facing: 1, vfacing: 1,
838820 alpha: [...]int32{-1, 0}, playerId: -1, bindId: -1, ignorehitpause: true}
839821 }
840822 func (e *Explod) setX(x float32) {
@@ -847,78 +829,56 @@ func (e *Explod) setPos(c *Char) {
847829 pPos := func(c *Char) {
848830 e.bindId, e.facing = c.id, c.facing*float32(e.relativef)
849831 e.offset[0] *= c.facing
850- e.setX(c.pos[0]*c.localscl/e.localscl + c.offsetX()*c.localscl/e.localscl + e.offset[0])
851- e.setY(c.pos[1]*c.localscl/e.localscl + c.offsetY()*c.localscl/e.localscl + e.offset[1])
832+ e.setX(c.pos[0] + c.offsetX() + e.offset[0])
833+ e.setY(c.pos[1] + c.offsetY() + e.offset[1])
852834 if e.bindtime == 0 {
853835 e.bindtime = 1
854836 }
855837 }
856838 lPos := func() {
857- e.setX(sys.cam.ScreenPos[0]/e.localscl + e.offset[0]/sys.cam.Scale)
858- e.setY(sys.cam.ScreenPos[1]/e.localscl + e.offset[1]/sys.cam.Scale)
859- if e.bindtime == 0 {
860- e.bindtime = 1
861- }
839+ e.setX(sys.cam.ScreenPos[0] + e.offset[0]/sys.cam.Scale)
840+ e.setY(sys.cam.ScreenPos[1] + e.offset[1]/sys.cam.Scale)
862841 }
863842 rPos := func() {
864- e.setX(sys.cam.ScreenPos[0]/e.localscl +
865- (float32(sys.gameWidth)/e.localscl + e.offset[0]/sys.cam.Scale))
866- e.setY(sys.cam.ScreenPos[1]/e.localscl + e.offset[1]/sys.cam.Scale)
867- if e.bindtime == 0 {
868- e.bindtime = 1
869- }
843+ e.setX(sys.cam.ScreenPos[0] +
844+ (float32(sys.gameWidth)+e.offset[0])/sys.cam.Scale)
845+ e.setY(sys.cam.ScreenPos[1] + e.offset[1]/sys.cam.Scale)
870846 }
871- if e.space >= Space_stage {
872- e.postype = PT_N
873- }
874- if e.space <= Space_none {
875- switch e.postype {
876- case PT_P1:
877- pPos(c)
878- case PT_P2:
879- if p2 := sys.charList.enemyNear(c, 0, true); p2 != nil {
880- pPos(p2)
847+ switch e.postype {
848+ case PT_P1:
849+ pPos(c)
850+ case PT_P2:
851+ if p2 := sys.charList.enemyNear(c, 0, true); p2 != nil {
852+ pPos(p2)
853+ }
854+ case PT_F, PT_B:
855+ e.facing = c.facing * float32(e.relativef)
856+ // front と back はバインドの都合で left か right になおす
857+ if c.facing > 0 && e.postype == PT_F || c.facing < 0 && e.postype == PT_B {
858+ if e.postype == PT_B {
859+ e.offset[0] *= -1
881860 }
882- case PT_F, PT_B:
883- e.facing = c.facing * float32(e.relativef)
884- // front と back はバインドの都合で left か right になおす
885- if c.facing > 0 && e.postype == PT_F || c.facing < 0 && e.postype == PT_B {
886- if e.postype == PT_B {
887- e.offset[0] *= -1
888- }
889- e.postype = PT_R
890- rPos()
891- } else {
892- // explod の postype = front はキャラの向きで pos が反転しない
893- //if e.postype == PT_F && c.gi().ver[0] != 1 {
861+ e.postype = PT_R
862+ rPos()
863+ } else {
864+ // explod の postype = front はキャラの向きで pos が反転しない
865+ if e.postype == PT_F && c.gi().ver[0] != 1 {
894866 // 旧バージョンだと front は キャラの向きが facing に反映されない
895- // 1.1でも反映されてない模様
896867 e.facing = float32(e.relativef)
897- //}
898- e.postype = PT_L
899- lPos()
900868 }
901- case PT_L:
902- e.facing = float32(e.relativef)
903- lPos()
904- case PT_R:
905- e.facing = float32(e.relativef)
906- rPos()
907- case PT_N:
908- e.facing = float32(e.relativef)
909- e.setX(e.offset[0])
910- e.setY(e.offset[1])
911- }
912- } else {
913- switch e.space {
914- case Space_screen:
915- e.facing = float32(e.relativef)
869+ e.postype = PT_L
916870 lPos()
917- case Space_stage:
918- e.facing = float32(e.relativef)
919- e.setX(e.offset[0])
920- e.setY(e.offset[1])
921871 }
872+ case PT_L:
873+ e.facing = float32(e.relativef)
874+ lPos()
875+ case PT_R:
876+ e.facing = float32(e.relativef)
877+ rPos()
878+ case PT_N:
879+ e.facing = float32(e.relativef)
880+ e.setX(e.offset[0])
881+ e.setY(e.offset[1])
922882 }
923883 }
924884 func (e *Explod) matchId(eid, pid int32) bool {
@@ -936,11 +896,6 @@ func (e *Explod) update(oldVer bool, playerNo int) {
936896 if !e.ignorehitpause || e.removeongethit {
937897 c = sys.playerID(e.playerId)
938898 }
939- if sys.tickNextFrame() &&
940- c != nil && e.removeongethit && c.sf(CSF_gethit) {
941- e.id, e.anim = IErr, nil
942- return
943- }
944899 p := false
945900 if sys.super > 0 {
946901 p = e.supermovetime >= 0 && e.time >= e.supermovetime
@@ -952,37 +907,28 @@ func (e *Explod) update(oldVer bool, playerNo int) {
952907 act = c == nil || c.acttmp%2 >= 0
953908 }
954909 if sys.tickFrame() {
955- if e.removetime >= 0 && e.time >= e.removetime ||
910+ if c != nil && e.removeongethit && c.ss.moveType == MT_H ||
911+ e.removetime >= 0 && e.time >= e.removetime ||
956912 act && e.removetime < -1 && e.anim.loopend {
957913 e.id, e.anim = IErr, nil
958914 return
959915 }
960916 }
961917 screen := false
962- if e.space == Space_screen || e.postype >= PT_L && e.postype != PT_N {
963- screen = true
964- }
965918 if e.bindtime != 0 {
966- if e.space == Space_screen {
967- e.pos[0] = e.offset[0]
968- e.pos[1] = e.offset[1]
969- e.pos[0] -= float32(sys.gameWidth) / e.localscl / 2
970- } else if e.postype == PT_N && e.bindId < 0 {
971- e.pos[0] = e.offset[0]
972- e.pos[1] = e.offset[1]
973- e.bindtime = 0
974- } else if e.postype >= PT_L && e.postype != PT_N {
975- e.pos[0] = e.offset[0]
976- e.pos[1] = e.offset[1]
919+ if e.postype == PT_N {
920+ e.pos = e.offset
921+ } else if e.postype >= PT_L {
922+ e.pos, screen = e.offset, true
977923 if e.postype == PT_L {
978- e.pos[0] -= float32(sys.gameWidth) / e.localscl / 2
924+ e.pos[0] -= float32(sys.gameWidth) / 2
979925 } else {
980- e.pos[0] += float32(sys.gameWidth) / e.localscl / 2
926+ e.pos[0] += float32(sys.gameWidth) / 2
981927 }
982928 } else {
983929 if c := sys.playerID(e.bindId); c != nil {
984- e.pos[0] = c.drawPos[0]*c.localscl/e.localscl + c.offsetX()*c.localscl/e.localscl + e.offset[0]
985- e.pos[1] = c.drawPos[1]*c.localscl/e.localscl + c.offsetY()*c.localscl/e.localscl + e.offset[1]
930+ e.pos[0] = c.drawPos[0] + c.offsetX() + e.offset[0]
931+ e.pos[1] = c.drawPos[1] + c.offsetY() + e.offset[1]
986932 } else {
987933 e.bindtime = 0
988934 }
@@ -1013,44 +959,33 @@ func (e *Explod) update(oldVer bool, playerNo int) {
1013959 alp[0] = -1
1014960 }
1015961 agl := e.angle
1016- yagl := e.yangle
1017- xagl := e.xangle
1018962 if (e.facing < 0) != (e.vfacing < 0) {
1019963 agl *= -1
1020- yagl *= -1
1021964 }
1022-
1023- sdwalp := 255 - alp[1]
965+ sdwalp := alp[0]
1024966 if sdwalp < 0 {
1025967 sdwalp = 256
1026968 }
1027- var epos = [2]float32{e.pos[0] * e.localscl, e.pos[1] * e.localscl}
1028- sprs.add(&SprData{e.anim, pfx, epos, [...]float32{e.facing * e.scale[0] * e.localscl,
1029- e.vfacing * e.scale[1] * e.localscl}, alp, e.sprpriority, agl, yagl, xagl, [...]float32{1, 1},
1030- screen, playerNo == sys.superplayer, oldVer, e.facing},
969+ sprs.add(&SprData{e.anim, pfx, e.pos, [...]float32{e.facing * e.scale[0],
970+ e.vfacing * e.scale[1]}, alp, e.sprpriority, agl, [...]float32{1, 1},
971+ screen, playerNo == sys.superplayer, oldVer},
1031972 e.shadow[0]<<16|e.shadow[1]&0xff<<8|e.shadow[0]&0xff, sdwalp, 0, 0)
1032973 if sys.tickNextFrame() {
1033974 if e.bindtime > 0 {
1034975 e.bindtime--
976+ if screen && e.bindtime == 0 {
977+ switch e.postype {
978+ case PT_L:
979+ for i := range e.pos {
980+ e.pos[i] = sys.cam.ScreenPos[i] + e.offset[i]/sys.cam.Scale
981+ }
982+ case PT_R:
983+ e.pos[0] = sys.cam.ScreenPos[0] +
984+ (float32(sys.gameWidth)+e.offset[0])/sys.cam.Scale
985+ e.pos[1] = sys.cam.ScreenPos[1] + e.offset[1]/sys.cam.Scale
986+ }
987+ }
1035988 }
1036- //if screen && e.bindtime == 0 {
1037- // if e.space <= Space_none {
1038- // switch e.postype {
1039- // case PT_L:
1040- // for i := range e.pos {
1041- // e.pos[i] = sys.cam.ScreenPos[i] + e.offset[i]/sys.cam.Scale
1042- // }
1043- // case PT_R:
1044- // e.pos[0] = sys.cam.ScreenPos[0] +
1045- // (float32(sys.gameWidth)+e.offset[0])/sys.cam.Scale
1046- // e.pos[1] = sys.cam.ScreenPos[1] + e.offset[1]/sys.cam.Scale
1047- // }
1048- // } else if e.space == Space_screen {
1049- // for i := range e.pos {
1050- // e.pos[i] = sys.cam.ScreenPos[i] + e.offset[i]/sys.cam.Scale
1051- // }
1052- // }
1053- //}
1054989 if act {
1055990 if e.bindtime == 0 {
1056991 e.oldPos = e.pos
@@ -1104,7 +1039,6 @@ type Projectile struct {
11041039 newPos [2]float32
11051040 aimg AfterImage
11061041 palfx *PalFX
1107- localscl float32
11081042 }
11091043
11101044 func newProjectile() *Projectile {
@@ -1114,7 +1048,7 @@ func newProjectile() *Projectile {
11141048 }
11151049 func (p *Projectile) clear() {
11161050 *p = Projectile{id: IErr, hitanim: -1, remanim: IErr, cancelanim: IErr,
1117- scale: [...]float32{1, 1}, clsnScale: [...]float32{1, 1}, remove: true, localscl: 1,
1051+ scale: [...]float32{1, 1}, clsnScale: [...]float32{1, 1}, remove: true,
11181052 removetime: -1, velmul: [...]float32{1, 1}, hits: 1, priority: 1,
11191053 prioritypoint: 1, sprpriority: 3, edgebound: 40, stagebound: 40,
11201054 heightbound: [...]int32{-240, 1}, facing: 1, aimg: *newAfterImage()}
@@ -1149,12 +1083,12 @@ func (p *Projectile) update(playerNo int) {
11491083 } else if p.cancelanim != p.anim {
11501084 p.ani = sys.chars[playerNo][0].getAnim(p.cancelanim, false)
11511085 }
1152- } else if p.pos[0] < sys.xmin/p.localscl-float32(p.edgebound) ||
1153- p.pos[0] > sys.xmax/p.localscl+float32(p.edgebound) ||
1086+ } else if p.pos[0] < sys.xmin-float32(p.edgebound) ||
1087+ p.pos[0] > sys.xmax+float32(p.edgebound) ||
11541088 p.velocity[0]*p.facing < 0 &&
1155- p.pos[0] < sys.cam.XMin/p.localscl-float32(p.stagebound) ||
1089+ p.pos[0] < sys.cam.XMin-float32(p.stagebound) ||
11561090 p.velocity[0]*p.facing > 0 &&
1157- p.pos[0] > sys.cam.XMax/p.localscl+float32(p.stagebound) ||
1091+ p.pos[0] > sys.cam.XMax+float32(p.stagebound) ||
11581092 p.velocity[1] > 0 && p.pos[1] > float32(p.heightbound[1]) ||
11591093 p.velocity[1] < 0 && p.pos[1] < float32(p.heightbound[0]) ||
11601094 p.removetime == 0 ||
@@ -1189,6 +1123,7 @@ func (p *Projectile) update(playerNo int) {
11891123 return
11901124 }
11911125 if sys.tickFrame() {
1126+ p.oldPos = p.pos
11921127 p.newPos = [...]float32{p.pos[0] + p.velocity[0]*p.facing,
11931128 p.pos[1] + p.velocity[1]}
11941129 }
@@ -1197,7 +1132,6 @@ func (p *Projectile) update(playerNo int) {
11971132 p.pos[i] = np - (np-p.oldPos[i])*(1-ti)
11981133 }
11991134 if sys.tickNextFrame() {
1200- p.oldPos = p.pos
12011135 for i := range p.velocity {
12021136 p.velocity[i] += p.accel[i]
12031137 p.velocity[i] *= p.velmul[i]
@@ -1236,17 +1170,15 @@ func (p *Projectile) clsn(playerNo int) {
12361170 }
12371171 for i := 0; i < playerNo && p.hits >= 0; i++ {
12381172 for j, pr := range sys.projs[i] {
1239- if pr.hits < 0 || pr.id < 0 || (pr.hitdef.affectteam != 0 &&
1240- (p.hitdef.teamside-1 != pr.hitdef.teamside-1) != (pr.hitdef.affectteam > 0)) ||
1173+ if pr.hits < 0 || pr.id < 0 || pr.hitdef.affectteam != 0 &&
1174+ (playerNo&1 != i&1) != (pr.hitdef.affectteam > 0) ||
12411175 pr.ani == nil || len(pr.ani.frames) == 0 {
12421176 continue
12431177 }
12441178 clsn1 := pr.ani.CurrentFrame().Clsn2()
12451179 clsn2 := p.ani.CurrentFrame().Clsn2()
1246- if sys.clsnHantei(clsn1, [...]float32{pr.clsnScale[0] * pr.localscl, pr.clsnScale[1] * pr.localscl},
1247- [...]float32{pr.pos[0] * pr.localscl, pr.pos[1] * pr.localscl}, pr.facing,
1248- clsn2, [...]float32{p.clsnScale[0] * p.localscl, p.clsnScale[1] * p.localscl},
1249- [...]float32{p.pos[0] * p.localscl, p.pos[1] * p.localscl}, p.facing) {
1180+ if sys.clsnHantei(clsn1, pr.clsnScale, pr.pos, pr.facing,
1181+ clsn2, p.clsnScale, p.pos, p.facing) {
12501182 opp, pp := &sys.projs[i][j], p.prioritypoint
12511183 cancel(&p.prioritypoint, p.priority, &p.hits, opp.prioritypoint)
12521184 cancel(&opp.prioritypoint, opp.priority, &opp.hits, pp)
@@ -1293,12 +1225,12 @@ func (p *Projectile) cueDraw(oldVer bool, playerNo int) {
12931225 }
12941226 if sys.clsnDraw && p.ani != nil {
12951227 if frm := p.ani.drawFrame(); frm != nil {
1296- xs := p.facing * p.clsnScale[0] * p.localscl
1228+ xs := p.facing * p.clsnScale[0]
12971229 if clsn := frm.Clsn1(); len(clsn) > 0 {
1298- sys.drawc1.Add(clsn, p.pos[0]*p.localscl, p.pos[1]*p.localscl, xs, p.clsnScale[1]*p.localscl)
1230+ sys.drawc1.Add(clsn, p.pos[0], p.pos[1], xs, p.clsnScale[1])
12991231 }
13001232 if clsn := frm.Clsn2(); len(clsn) > 0 {
1301- sys.drawc2.Add(clsn, p.pos[0]*p.localscl, p.pos[1]*p.localscl, xs, p.clsnScale[1]*p.localscl)
1233+ sys.drawc2.Add(clsn, p.pos[0], p.pos[1], xs, p.clsnScale[1])
13021234 }
13031235 }
13041236 }
@@ -1318,10 +1250,10 @@ func (p *Projectile) cueDraw(oldVer bool, playerNo int) {
13181250 }
13191251 }
13201252 if p.ani != nil {
1321- sd := &SprData{p.ani, p.palfx, [...]float32{p.pos[0] * p.localscl, p.pos[1] * p.localscl},
1322- [...]float32{p.facing * p.scale[0] * p.localscl, p.scale[1] * p.localscl}, [2]int32{-1},
1323- p.sprpriority, 0, 0, 0, [...]float32{1, 1}, false, playerNo == sys.superplayer,
1324- sys.cgi[playerNo].ver[0] != 1, p.facing}
1253+ sd := &SprData{p.ani, p.palfx, p.pos,
1254+ [...]float32{p.facing * p.scale[0], p.scale[1]}, [2]int32{-1},
1255+ p.sprpriority, 0, [...]float32{1, 1}, false, playerNo == sys.superplayer,
1256+ sys.cgi[playerNo].ver[0] != 1}
13251257 p.aimg.recAndCue(sd, sys.tickNextFrame() && notpause)
13261258 sys.sprites.add(sd,
13271259 p.shadow[0]<<16|p.shadow[1]&255<<8|p.shadow[2]&255, 256, 0, 0)
@@ -1367,8 +1299,6 @@ type CharGlobalInfo struct {
13671299 pctype ProjContact
13681300 pctime, pcid int32
13691301 unhittable int32
1370- quotes [MaxQuotes]string
1371- portraitscale float32
13721302 }
13731303
13741304 func (cgi *CharGlobalInfo) clearPCTime() {
@@ -1458,7 +1388,6 @@ type Char struct {
14581388 helperIndex int32
14591389 parentIndex int32
14601390 playerNo int
1461- teamside int
14621391 keyctrl bool
14631392 player bool
14641393 animPN int
@@ -1469,9 +1398,6 @@ type Char struct {
14691398 powerMax int32
14701399 juggle int32
14711400 fallTime int32
1472- localcoord int32
1473- localscl float32
1474- oldLocalscl float32
14751401 size CharSize
14761402 clsnScale [2]float32
14771403 hitdef HitDef
@@ -1503,14 +1429,10 @@ type Char struct {
15031429 inguarddist bool
15041430 pushed bool
15051431 hitdefContact bool
1506- movedY bool
15071432 atktmp int8
15081433 hittmp int8
15091434 acttmp int8
15101435 minus int8
1511- winquote int32
1512- memberNo int
1513- selectNo int
15141436 }
15151437
15161438 func newChar(n int, idx int32) (c *Char) {
@@ -1529,7 +1451,6 @@ func (c *Char) panic() {
15291451 func (c *Char) init(n int, idx int32) {
15301452 c.clear1()
15311453 c.playerNo, c.helperIndex = n, idx
1532- c.animPN = c.playerNo
15331454 if c.helperIndex == 0 {
15341455 c.keyctrl, c.player = true, true
15351456 }
@@ -1578,11 +1499,10 @@ func (c *Char) clear1() {
15781499 c.p1facing = 0
15791500 c.pushed = false
15801501 c.atktmp, c.hittmp, c.acttmp, c.minus = 0, 0, 0, 2
1581- c.winquote = -1
15821502 }
15831503 func (c *Char) copyParent(p *Char) {
15841504 c.parentIndex = p.helperIndex
1585- c.name, c.key, c.size, c.teamside = p.name+"'s helper", p.key, p.size, p.teamside
1505+ c.name, c.key, c.size = p.name+"'s helper", p.key, p.size
15861506 c.life, c.lifeMax, c.power, c.powerMax = p.lifeMax, p.lifeMax, 0, p.powerMax
15871507 c.clear2()
15881508 }
@@ -1630,7 +1550,7 @@ func (c *Char) stCgi() *CharGlobalInfo {
16301550 }
16311551 func (c *Char) load(def string) error {
16321552 gi := &sys.cgi[c.playerNo]
1633- gi.def, gi.displayname, gi.author, gi.sff, gi.snd, gi.quotes = def, "", "", nil, nil, [MaxQuotes]string{}
1553+ gi.def, gi.displayname, gi.author, gi.sff, gi.snd = def, "", "", nil, nil
16341554 gi.anim = NewAnimationTable()
16351555 for i := range gi.palkeymap {
16361556 gi.palkeymap[i] = int32(i)
@@ -1642,8 +1562,6 @@ func (c *Char) load(def string) error {
16421562 lines, i := SplitAndTrim(str, "\n"), 0
16431563 cns, sprite, anim, sound := "", "", "", ""
16441564 info, files, keymap := true, true, true
1645- c.localcoord = 320
1646- c.localscl = 1
16471565 for i < len(lines) {
16481566 is, name, subname := ReadIniSection(lines, &i)
16491567 switch name {
@@ -1659,10 +1577,6 @@ func (c *Char) load(def string) error {
16591577 gi.author, _, _ = is.getText("author")
16601578 gi.authorLow = strings.ToLower(gi.author)
16611579 gi.nameLow = strings.ToLower(c.name)
1662- is.ReadI32("localcoord", &c.localcoord)
1663- c.localscl = 320 / float32(c.localcoord)
1664- gi.portraitscale = c.localscl
1665- is.ReadF32("portraitscale", &gi.portraitscale)
16661580 }
16671581 case "files":
16681582 if files {
@@ -1702,74 +1616,18 @@ func (c *Char) load(def string) error {
17021616 }
17031617 gi.data.init()
17041618 c.size.init()
1705- c.size.ground.back = c.size.ground.back / c.localscl
1706- c.size.ground.front = c.size.ground.front / c.localscl
1707- c.size.air.back = c.size.air.back / c.localscl
1708- c.size.air.front = c.size.air.front / c.localscl
1709- c.size.height = c.size.height / c.localscl
1710- c.size.attack.dist = c.size.attack.dist / c.localscl
1711- c.size.proj.attack.dist = c.size.proj.attack.dist / c.localscl
1712- c.size.head.pos[0] = c.size.head.pos[0] / c.localscl
1713- c.size.head.pos[1] = c.size.head.pos[1] / c.localscl
1714- c.size.mid.pos[0] = c.size.mid.pos[0] / c.localscl
1715- c.size.mid.pos[1] = c.size.mid.pos[1] / c.localscl
1716- c.size.shadowoffset = c.size.shadowoffset / c.localscl
1717- c.size.draw.offset[0] = c.size.draw.offset[0] / c.localscl
1718- c.size.draw.offset[1] = c.size.draw.offset[1] / c.localscl
1719- c.size.z.width = c.size.z.width / c.localscl
1720- c.size.attack.z.width[0] = c.size.attack.z.width[0] / c.localscl
1721- c.size.attack.z.width[1] = c.size.attack.z.width[1] / c.localscl
1722-
17231619 gi.velocity.init()
1724-
1725- gi.velocity.air.gethit.groundrecover[0] /= c.localscl
1726- gi.velocity.air.gethit.groundrecover[1] /= c.localscl
1727- gi.velocity.air.gethit.airrecover.add[0] /= c.localscl
1728- gi.velocity.air.gethit.airrecover.add[1] /= c.localscl
1729- gi.velocity.air.gethit.airrecover.back /= c.localscl
1730- gi.velocity.air.gethit.airrecover.fwd /= c.localscl
1731- gi.velocity.air.gethit.airrecover.up /= c.localscl
1732- gi.velocity.air.gethit.airrecover.down /= c.localscl
1733-
17341620 gi.movement.init()
1735-
1736- gi.movement.airjump.height = int32(float32(gi.movement.airjump.height) / c.localscl)
1737- gi.movement.yaccel /= c.localscl
1738- gi.movement.stand.friction_threshold /= c.localscl
1739- gi.movement.crouch.friction_threshold /= c.localscl
1740- gi.movement.air.gethit.groundlevel /= c.localscl
1741- gi.movement.air.gethit.groundrecover.ground.threshold /= c.localscl
1742- gi.movement.air.gethit.groundrecover.groundlevel /= c.localscl
1743- gi.movement.air.gethit.airrecover.threshold /= c.localscl
1744- gi.movement.air.gethit.airrecover.yaccel /= c.localscl
1745- gi.movement.air.gethit.trip.groundlevel /= c.localscl
1746- gi.movement.down.bounce.offset[0] /= c.localscl
1747- gi.movement.down.bounce.offset[1] /= c.localscl
1748- gi.movement.down.bounce.yaccel /= c.localscl
1749- gi.movement.down.bounce.groundlevel /= c.localscl
1750- gi.movement.down.friction_threshold /= c.localscl
1751-
1752- data, size, velocity, movement, quotes := true, true, true, true, true
1621+ data, size, velocity, movement := true, true, true, true
17531622 for i < len(lines) {
17541623 is, name, _ := ReadIniSection(lines, &i)
17551624 switch name {
17561625 case "data":
17571626 if data {
17581627 data = false
1759- var tmp int32
1760- tmp = Atoi(sys.cmdFlags[fmt.Sprintf("-p%v.life", c.playerNo+1)])
1761- if tmp != 0 {
1762- gi.data.life = tmp
1763- } else {
1764- is.ReadI32("life", &gi.data.life)
1765- }
1628+ is.ReadI32("life", &gi.data.life)
17661629 c.lifeMax = gi.data.life
1767- tmp = Atoi(sys.cmdFlags[fmt.Sprintf("-p%v.power", c.playerNo+1)])
1768- if tmp != 0 {
1769- gi.data.power = tmp
1770- } else {
1771- is.ReadI32("power", &gi.data.power)
1772- }
1630+ is.ReadI32("power", &gi.data.power)
17731631 c.powerMax = gi.data.power
17741632 is.ReadI32("attack", &gi.data.attack)
17751633 is.ReadI32("defence", &gi.data.defence)
@@ -1803,24 +1661,23 @@ func (c *Char) load(def string) error {
18031661 case "size":
18041662 if size {
18051663 size = false
1806-
18071664 is.ReadF32("xscale", &c.size.xscale)
18081665 is.ReadF32("yscale", &c.size.yscale)
1809- is.ReadF32("ground.back", &c.size.ground.back)
1810- is.ReadF32("ground.front", &c.size.ground.front)
1811- is.ReadF32("air.back", &c.size.air.back)
1812- is.ReadF32("air.front", &c.size.air.front)
1813- is.ReadF32("height", &c.size.height)
1814- is.ReadF32("attack.dist", &c.size.attack.dist)
1815- is.ReadF32("proj.attack.dist", &c.size.proj.attack.dist)
1666+ is.ReadI32("ground.back", &c.size.ground.back)
1667+ is.ReadI32("ground.front", &c.size.ground.front)
1668+ is.ReadI32("air.back", &c.size.air.back)
1669+ is.ReadI32("air.front", &c.size.air.front)
1670+ is.ReadI32("height", &c.size.height)
1671+ is.ReadI32("attack.dist", &c.size.attack.dist)
1672+ is.ReadI32("proj.attack.dist", &c.size.proj.attack.dist)
18161673 is.ReadI32("proj.doscale", &c.size.proj.doscale)
1817- is.ReadF32("head.pos", &c.size.head.pos[0], &c.size.head.pos[1])
1818- is.ReadF32("mid.pos", &c.size.mid.pos[0], &c.size.mid.pos[1])
1819- is.ReadF32("shadowoffset", &c.size.shadowoffset)
1820- is.ReadF32("draw.offset",
1674+ is.ReadI32("head.pos", &c.size.head.pos[0], &c.size.head.pos[1])
1675+ is.ReadI32("mid.pos", &c.size.mid.pos[0], &c.size.mid.pos[1])
1676+ is.ReadI32("shadowoffset", &c.size.shadowoffset)
1677+ is.ReadI32("draw.offset",
18211678 &c.size.draw.offset[0], &c.size.draw.offset[1])
1822- is.ReadF32("z.width", &c.size.z.width)
1823- is.ReadF32("attack.z.width",
1679+ is.ReadI32("z.width", &c.size.z.width)
1680+ is.ReadI32("attack.z.width",
18241681 &c.size.attack.z.width[0], &c.size.attack.z.width[1])
18251682 }
18261683 case "velocity":
@@ -1906,15 +1763,6 @@ func (c *Char) load(def string) error {
19061763 is.ReadF32("down.friction.threshold",
19071764 &gi.movement.down.friction_threshold)
19081765 }
1909- case "quotes":
1910- if quotes {
1911- quotes = false
1912- for i := 0; i < MaxQuotes; i++ {
1913- if is[fmt.Sprintf("victory%v", i)] != "" {
1914- gi.quotes[i], _, _ = is.getText(fmt.Sprintf("victory%v", i))
1915- }
1916- }
1917- }
19181766 }
19191767 }
19201768 if LoadFile(&sprite, def, func(filename string) error {
@@ -1929,7 +1777,6 @@ func (c *Char) load(def string) error {
19291777 if err != nil {
19301778 return err
19311779 }
1932- str = str + sys.commonAir
19331780 lines, i := SplitAndTrim(str, "\n"), 0
19341781 gi.anim = ReadAnimationTable(gi.sff, lines, &i)
19351782 return nil
@@ -1966,7 +1813,7 @@ func (c *Char) loadPallet() {
19661813 if _, err = io.ReadFull(f, rgb[:]); err != nil {
19671814 break
19681815 }
1969- pl[i] = uint32(255)<<24 | uint32(rgb[2])<<16 | uint32(rgb[1])<<8 | uint32(rgb[0])
1816+ pl[i] = uint32(rgb[2])<<16 | uint32(rgb[1])<<8 | uint32(rgb[0])
19701817 }
19711818 chk(f.Close())
19721819 if err == nil {
@@ -2081,9 +1928,6 @@ func (c *Char) setXV(xv float32) {
20811928 }
20821929 func (c *Char) setYV(yv float32) {
20831930 c.vel[1] = yv
2084- if yv != 0 {
2085- c.movedY = true
2086- }
20871931 }
20881932 func (c *Char) changeAnim(animNo int32) {
20891933 if a := c.getAnim(animNo, false); a != nil {
@@ -2186,7 +2030,7 @@ func (c *Char) partner(n int32) *Char {
21862030 p += 2
21872031 }
21882032 }
2189- if len(sys.chars[p]) > 0 && sys.chars[p][0].teamside < 2 {
2033+ if len(sys.chars[p]) > 0 {
21902034 return sys.chars[p][0]
21912035 }
21922036 return nil
@@ -2195,9 +2039,6 @@ func (c *Char) enemy(n int32) *Char {
21952039 if n < 0 || n >= c.numEnemy() {
21962040 return nil
21972041 }
2198- if c.teamside == 3-1 {
2199- return sys.chars[n][0]
2200- }
22012042 return sys.chars[n*2+int32(^c.playerNo&1)][0]
22022043 }
22032044 func (c *Char) enemyNear(n int32) *Char {
@@ -2257,12 +2098,12 @@ func (c *Char) backEdgeBodyDist() float32 {
22572098 }
22582099 func (c *Char) backEdgeDist() float32 {
22592100 if c.facing < 0 {
2260- return sys.xmax/c.localscl - c.pos[0]
2101+ return sys.xmax - c.pos[0]
22612102 }
2262- return c.pos[0] - sys.xmin/c.localscl
2103+ return c.pos[0] - sys.xmin
22632104 }
22642105 func (c *Char) bottomEdge() float32 {
2265- return sys.cam.ScreenPos[1]/c.localscl + c.gameHeight()
2106+ return sys.cam.ScreenPos[1] + c.gameHeight()
22662107 }
22672108 func (c *Char) canRecover() bool {
22682109 return c.ghv.fall.recover && c.fallTime >= c.ghv.fall.recovertime
@@ -2273,6 +2114,9 @@ func (c *Char) command(pn, i int) bool {
22732114 }
22742115 cl := c.cmd[pn].At(i)
22752116 if len(cl) > 0 && c.key < 0 {
2117+ if c.gi().ver[0] == 1 && c.helperIndex != 0 {
2118+ return false
2119+ }
22762120 if c.helperIndex != 0 || len(cl[0].cmd) != 1 || len(cl[0].cmd[0].key) !=
22772121 1 || int(Btoi(cl[0].cmd[0].slash)) != len(cl[0].hold) {
22782122 return i == int(c.cpucmd)
@@ -2312,15 +2156,15 @@ func (c *Char) frontEdgeBodyDist() float32 {
23122156 }
23132157 func (c *Char) frontEdgeDist() float32 {
23142158 if c.facing > 0 {
2315- return sys.xmax/c.localscl - c.pos[0]
2159+ return sys.xmax - c.pos[0]
23162160 }
2317- return c.pos[0] - sys.xmin/c.localscl
2161+ return c.pos[0] - sys.xmin
23182162 }
23192163 func (c *Char) gameHeight() float32 {
2320- return 240 / c.localscl / sys.cam.Scale
2164+ return 240 / sys.cam.Scale
23212165 }
23222166 func (c *Char) gameWidth() float32 {
2323- return float32(sys.gameWidth) / c.localscl / sys.cam.Scale
2167+ return float32(sys.gameWidth) / sys.cam.Scale
23242168 }
23252169 func (c *Char) hitDefAttr(attr int32) bool {
23262170 return c.ss.moveType == MT_A && c.hitdef.testAttr(attr)
@@ -2351,10 +2195,10 @@ func (c *Char) isHelper(hid BytecodeValue) BytecodeValue {
23512195 return BytecodeBool(c.helperIndex != 0 && (id <= 0 || c.helperId == id))
23522196 }
23532197 func (c *Char) leftEdge() float32 {
2354- return sys.cam.ScreenPos[0] / c.localscl
2198+ return sys.cam.ScreenPos[0]
23552199 }
23562200 func (c *Char) lose() bool {
2357- return sys.winTeam == 1^c.teamside
2201+ return sys.winTeam == ^c.playerNo&1
23582202 }
23592203 func (c *Char) loseKO() bool {
23602204 return c.lose() && sys.finish == FT_KO
@@ -2390,9 +2234,6 @@ func (c *Char) numEnemy() int32 {
23902234 if sys.tmode[^c.playerNo&1] != TM_Simul {
23912235 return 1
23922236 }
2393- if c.teamside == 3-1 {
2394- return sys.numSimul[0] + sys.numSimul[1]
2395- }
23962237 return sys.numSimul[^c.playerNo&1]
23972238 }
23982239 func (c *Char) numExplod(eid BytecodeValue) BytecodeValue {
@@ -2420,7 +2261,7 @@ func (c *Char) numHelper(hid BytecodeValue) BytecodeValue {
24202261 return BytecodeInt(n)
24212262 }
24222263 func (c *Char) numPartner() int32 {
2423- if sys.tmode[c.playerNo&1] != TM_Simul || c.teamside >= 2 {
2264+ if sys.tmode[c.playerNo&1] != TM_Simul {
24242265 return 0
24252266 }
24262267 return sys.numSimul[c.playerNo&1] - 1
@@ -2472,7 +2313,7 @@ func (c *Char) palno() int32 {
24722313 return c.gi().palno
24732314 }
24742315 func (c *Char) getPower() int32 {
2475- if sys.powerShare[c.playerNo&1] && c.teamside < 2 {
2316+ if sys.powerShare[c.playerNo&1] {
24762317 return sys.chars[c.playerNo&1][0].power
24772318 }
24782319 return sys.chars[c.playerNo][0].power
@@ -2518,12 +2359,9 @@ func (c *Char) projHitTime(pid BytecodeValue) BytecodeValue {
25182359 return BytecodeInt(c.gi().pctime)
25192360 }
25202361 func (c *Char) rightEdge() float32 {
2521- return sys.cam.ScreenPos[0]/c.localscl + c.gameWidth()
2362+ return sys.cam.ScreenPos[0] + c.gameWidth()
25222363 }
25232364 func (c *Char) roundsExisted() int32 {
2524- if c.teamside >= 2 {
2525- return sys.round - 1
2526- }
25272365 return sys.roundsExisted[c.playerNo&1]
25282366 }
25292367 func (c *Char) roundState() int32 {
@@ -2543,10 +2381,10 @@ func (c *Char) roundState() int32 {
25432381 }
25442382 }
25452383 func (c *Char) screenPosX() float32 {
2546- return (c.pos[0]*c.localscl - sys.cam.ScreenPos[0]) // * sys.cam.Scale
2384+ return (c.pos[0] - sys.cam.ScreenPos[0]) * sys.cam.Scale
25472385 }
25482386 func (c *Char) screenPosY() float32 {
2549- return (c.pos[1]*c.localscl - sys.cam.ScreenPos[1]) // * sys.cam.Scale
2387+ return (c.pos[1] - sys.cam.ScreenPos[1]) * sys.cam.Scale
25502388 }
25512389 func (c *Char) selfAnimExist(anim BytecodeValue) BytecodeValue {
25522390 if anim.IsSF() {
@@ -2558,12 +2396,9 @@ func (c *Char) time() int32 {
25582396 return c.ss.time
25592397 }
25602398 func (c *Char) topEdge() float32 {
2561- return sys.cam.ScreenPos[1] / c.localscl
2399+ return sys.cam.ScreenPos[1]
25622400 }
25632401 func (c *Char) win() bool {
2564- if c.teamside >= 2 {
2565- return false
2566- }
25672402 return sys.winTeam == c.playerNo&1
25682403 }
25692404 func (c *Char) winKO() bool {
@@ -2573,9 +2408,6 @@ func (c *Char) winTime() bool {
25732408 return c.win() && sys.finish == FT_TO
25742409 }
25752410 func (c *Char) winPerfect() bool {
2576- if c.teamside >= 2 {
2577- return false
2578- }
25792411 return c.win() && sys.winType[c.playerNo&1] >= WT_PN
25802412 }
25812413 func (c *Char) newChannel(ch int32, lowpriority bool) *Sound {
@@ -2646,7 +2478,7 @@ func (c *Char) playSound(f, lowpriority, loop bool, g, n, chNo, vol int32,
26462478 }
26472479 func (c *Char) furimuki() {
26482480 if c.scf(SCF_ctrl) && c.helperIndex == 0 {
2649- if c.rdDistX(sys.charList.enemyNear(c, 0, true), c).ToF() < 0 {
2481+ if c.rdDistX(sys.charList.enemyNear(c, 0, true)).ToF() < 0 {
26502482 switch c.ss.stateType {
26512483 case ST_S:
26522484 c.changeAnim(5)
@@ -2667,23 +2499,6 @@ func (c *Char) stateChange1(no int32, pn int) bool {
26672499 if c.ss.sb.playerNo != c.playerNo && pn != c.ss.sb.playerNo {
26682500 c.enemyExplodsRemove(c.ss.sb.playerNo)
26692501 }
2670- if newLs := 320 / float32(sys.chars[pn][0].localcoord); c.localscl != newLs {
2671- lsRatio := c.localscl / newLs
2672- c.pos[0] *= lsRatio
2673- c.pos[1] *= lsRatio
2674- c.oldPos = c.pos
2675-
2676- c.vel[0] *= lsRatio
2677- c.vel[1] *= lsRatio
2678-
2679- c.ghv.xvel *= lsRatio
2680- c.ghv.yvel *= lsRatio
2681- c.ghv.fall.xvelocity *= lsRatio
2682- c.ghv.fall.yvelocity *= lsRatio
2683- c.ghv.yaccel *= lsRatio
2684-
2685- c.localscl = newLs
2686- }
26872502 var ok bool
26882503 if c.ss.sb, ok = sys.cgi[pn].states[no]; !ok {
26892504 sys.errLog.Printf("存在しないステート: P%v:%v\n", pn+1, no)
@@ -2711,7 +2526,6 @@ func (c *Char) changeStateEx(no int32, pn int, anim, ctrl int32) {
27112526 if ctrl >= 0 {
27122527 c.setCtrl(ctrl != 0)
27132528 }
2714- c.movedY = false
27152529 if c.stateChange1(no, pn) && sys.changeStateNest == 0 && c.minus == 0 {
27162530 for c.stchtmp && sys.changeStateNest < 2500 {
27172531 c.stateChange2()
@@ -2799,30 +2613,26 @@ func (c *Char) newHelper() (h *Char) {
27992613 return
28002614 }
28012615 func (c *Char) helperPos(pt PosType, pos [2]float32, facing int32,
2802- dstFacing *float32, localscl float32, isProj bool) (p [2]float32) {
2616+ dstFacing *float32) (p [2]float32) {
28032617 if facing < 0 {
28042618 *dstFacing *= -1
28052619 }
28062620 switch pt {
28072621 case PT_P1:
2808- p[0] = c.pos[0]*c.localscl/localscl + pos[0]*c.facing
2809- p[1] = c.pos[1]*c.localscl/localscl + pos[1]
2622+ p[0] = c.pos[0] + pos[0]*c.facing
2623+ p[1] = c.pos[1] + pos[1]
28102624 *dstFacing *= c.facing
28112625 case PT_P2:
28122626 if p2 := sys.charList.enemyNear(c, 0, true); p2 != nil {
2813- p[0] = p2.pos[0]*p2.localscl/localscl + pos[0]*p2.facing
2814- p[1] = p2.pos[1]*p2.localscl/localscl + pos[1]
2815- if isProj {
2816- *dstFacing *= c.facing
2817- } else {
2818- *dstFacing *= p2.facing
2819- }
2627+ p[0] = p2.pos[0] + pos[0]*p2.facing
2628+ p[1] = p2.pos[1] + pos[1]
2629+ *dstFacing *= p2.facing
28202630 }
28212631 case PT_F, PT_B:
28222632 if c.facing > 0 && pt == PT_F || c.facing < 0 && pt == PT_B {
2823- p[0] = c.rightEdge() * c.localscl / localscl
2633+ p[0] = c.rightEdge()
28242634 } else {
2825- p[0] = c.leftEdge() * c.localscl / localscl
2635+ p[0] = c.leftEdge()
28262636 }
28272637 if c.facing > 0 {
28282638 p[0] += pos[0]
@@ -2832,10 +2642,10 @@ func (c *Char) helperPos(pt PosType, pos [2]float32, facing int32,
28322642 p[1] = pos[1]
28332643 *dstFacing *= c.facing
28342644 case PT_L:
2835- p[0] = c.leftEdge()*c.localscl/localscl + pos[0]
2645+ p[0] = c.leftEdge() + pos[0]
28362646 p[1] = pos[1]
28372647 case PT_R:
2838- p[0] = c.rightEdge()*c.localscl/localscl + pos[0]
2648+ p[0] = c.rightEdge() + pos[0]
28392649 p[1] = pos[1]
28402650 case PT_N:
28412651 p = pos
@@ -2844,7 +2654,7 @@ func (c *Char) helperPos(pt PosType, pos [2]float32, facing int32,
28442654 }
28452655 func (c *Char) helperInit(h *Char, st int32, pt PosType, x, y float32,
28462656 facing int32, ownpal bool) {
2847- p := c.helperPos(pt, [...]float32{x, y}, facing, &h.facing, h.localscl, false)
2657+ p := c.helperPos(pt, [...]float32{x, y}, facing, &h.facing)
28482658 h.setX(p[0])
28492659 h.setY(p[1])
28502660 h.vel = [2]float32{}
@@ -3001,14 +2811,9 @@ func (c *Char) setPosY(y float32) {
30012811 c.pos[1] = y
30022812 }
30032813 func (c *Char) posReset() {
3004- if c.teamside >= 2 {
3005- c.facing = 1
3006- c.setX(0)
3007- } else {
3008- c.facing = 1 - 2*float32(c.playerNo&1)
3009- c.setX((float32(sys.stage.p[c.playerNo&1].startx-sys.cam.startx)*
3010- sys.stage.localscl - c.facing*float32(c.playerNo>>1)*P1P3Dist) / c.localscl)
3011- }
2814+ c.facing = 1 - 2*float32(c.playerNo&1)
2815+ c.setX(float32(sys.stage.p[c.playerNo&1].startx-sys.cam.startx)*
2816+ sys.stage.localscl - c.facing*float32(c.playerNo>>1)*P1P3Dist)
30122817 c.setY(0)
30132818 c.setXV(0)
30142819 c.setYV(0)
@@ -3020,27 +2825,18 @@ func (c *Char) setX(x float32) {
30202825 func (c *Char) setY(y float32) {
30212826 c.oldPos[1], c.drawPos[1] = y, y
30222827 c.setPosY(y)
3023- if y != 0 {
3024- c.movedY = true
3025- }
30262828 }
30272829 func (c *Char) addX(x float32) {
30282830 c.setX(c.pos[0] + c.facing*x)
30292831 }
30302832 func (c *Char) addY(y float32) {
30312833 c.setY(c.pos[1] + y)
3032- if y != 0 {
3033- c.movedY = true
3034- }
30352834 }
30362835 func (c *Char) addXV(xv float32) {
30372836 c.vel[0] += xv
30382837 }
30392838 func (c *Char) addYV(yv float32) {
30402839 c.vel[1] += yv
3041- if yv != 0 {
3042- c.movedY = true
3043- }
30442840 }
30452841 func (c *Char) mulXV(xv float32) {
30462842 c.vel[0] *= xv
@@ -3075,7 +2871,7 @@ func (c *Char) newProj() *Projectile {
30752871 }
30762872 func (c *Char) projInit(p *Projectile, pt PosType, x, y float32,
30772873 op bool, rpg, rpn int32) {
3078- p.setPos(c.helperPos(pt, [...]float32{x, y}, 1, &p.facing, p.localscl, true))
2874+ p.setPos(c.helperPos(pt, [...]float32{x, y}, 1, &p.facing))
30792875 if p.anim < -1 {
30802876 p.anim = 0
30812877 }
@@ -3148,9 +2944,6 @@ func (c *Char) setHitdefDefault(hd *HitDef, proj bool) {
31482944 if hd.air_animtype == RA_Unknown {
31492945 hd.air_animtype = hd.animtype
31502946 }
3151- if hd.animtype == RA_Back {
3152- hd.animtype = RA_Hard
3153- }
31542947 if hd.air_type == HT_Unknown {
31552948 if hd.ground_type == HT_Trip {
31562949 hd.air_type = HT_High
@@ -3182,9 +2975,6 @@ func (c *Char) setHitdefDefault(hd *HitDef, proj bool) {
31822975 if !math.IsNaN(float64(hd.snap[1])) {
31832976 hd.maxdist[1], hd.mindist[1] = hd.snap[1], hd.snap[1]
31842977 }
3185- if hd.teamside == 0 {
3186- hd.teamside = c.teamside + 1
3187- }
31882978 hd.playerNo = c.ss.sb.playerNo
31892979 }
31902980 func (c *Char) setFEdge(fe float32) {
@@ -3196,11 +2986,11 @@ func (c *Char) setBEdge(be float32) {
31962986 c.setSF(CSF_backedge)
31972987 }
31982988 func (c *Char) setFWidth(fw float32) {
3199- c.width[0] = c.defFW()*(320/float32(c.localcoord))/c.localscl + fw
2989+ c.width[0] = c.defFW() + fw
32002990 c.setSF(CSF_frontwidth)
32012991 }
32022992 func (c *Char) setBWidth(bw float32) {
3203- c.width[1] = c.defBW()*(320/float32(c.localcoord))/c.localscl + bw
2993+ c.width[1] = c.defBW() + bw
32042994 c.setSF(CSF_backwidth)
32052995 }
32062996 func (c *Char) gethitAnimtype() Reaction {
@@ -3362,8 +3152,6 @@ func (c *Char) targetBind(tar []int32, time int32, x, y float32) {
33623152 t.setBindToId(c)
33633153 t.setBindTime(time)
33643154 t.bindFacing = 0
3365- x *= c.localscl / t.localscl
3366- y *= c.localscl / t.localscl
33673155 t.bindPos = [...]float32{x, y}
33683156 }
33693157 }
@@ -3385,7 +3173,7 @@ func (c *Char) bindToTarget(tar []int32, time int32, x, y float32, hmf HMF) {
33853173 if !math.IsNaN(float64(y)) {
33863174 c.setY(t.pos[1] + y)
33873175 }
3388- c.targetBind(tar[:1], time, c.facing*c.distX(t, c), (t.pos[1]*t.localscl/c.localscl)-(c.pos[1]*c.localscl/t.localscl))
3176+ c.targetBind(tar[:1], time, c.facing*c.distX(t), t.pos[1]-c.pos[1])
33893177 }
33903178 }
33913179 }
@@ -3400,7 +3188,7 @@ func (c *Char) targetLifeAdd(tar []int32, add int32, kill, absolute bool) {
34003188 func (c *Char) targetState(tar []int32, state int32) {
34013189 if state >= 0 {
34023190 pn := c.ss.sb.playerNo
3403- if c.minus == -2 || c.minus == -20 {
3191+ if c.minus == -2 {
34043192 pn = c.playerNo
34053193 }
34063194 for _, tid := range tar {
@@ -3414,7 +3202,6 @@ func (c *Char) targetState(tar []int32, state int32) {
34143202 func (c *Char) targetVelSetX(tar []int32, x float32) {
34153203 for _, tid := range tar {
34163204 if t := sys.playerID(tid); t != nil {
3417- x *= c.localscl / t.localscl
34183205 t.setXV(x)
34193206 }
34203207 }
@@ -3422,7 +3209,6 @@ func (c *Char) targetVelSetX(tar []int32, x float32) {
34223209 func (c *Char) targetVelSetY(tar []int32, y float32) {
34233210 for _, tid := range tar {
34243211 if t := sys.playerID(tid); t != nil {
3425- y *= c.localscl / t.localscl
34263212 t.setYV(y)
34273213 }
34283214 }
@@ -3430,7 +3216,6 @@ func (c *Char) targetVelSetY(tar []int32, y float32) {
34303216 func (c *Char) targetVelAddX(tar []int32, x float32) {
34313217 for _, tid := range tar {
34323218 if t := sys.playerID(tid); t != nil {
3433- x *= c.localscl / t.localscl
34343219 t.vel[0] += x
34353220 }
34363221 }
@@ -3438,7 +3223,6 @@ func (c *Char) targetVelAddX(tar []int32, x float32) {
34383223 func (c *Char) targetVelAddY(tar []int32, y float32) {
34393224 for _, tid := range tar {
34403225 if t := sys.playerID(tid); t != nil {
3441- y *= c.localscl / t.localscl
34423226 t.vel[1] += y
34433227 }
34443228 }
@@ -3521,7 +3305,7 @@ func (c *Char) lifeAdd(add float64, kill, absolute bool) {
35213305 }
35223306 func (c *Char) lifeSet(life int32) {
35233307 if c.life = Max(0, Min(c.lifeMax, life)); c.life == 0 {
3524- if c.player && c.teamside < 2 {
3308+ if c.player {
35253309 if c.alive() && c.helperIndex == 0 {
35263310 if c.ss.moveType != MT_H {
35273311 if c.playerNo == c.ss.sb.playerNo {
@@ -3556,56 +3340,55 @@ func (c *Char) setPower(pow int32) {
35563340 }
35573341 }
35583342 func (c *Char) powerAdd(add int32) {
3559- if sys.powerShare[c.playerNo&1] && c.teamside < 2 {
3343+ if sys.powerShare[c.playerNo&1] {
35603344 sys.chars[c.playerNo&1][0].setPower(c.getPower() + add)
35613345 } else {
35623346 sys.chars[c.playerNo][0].setPower(c.getPower() + add)
35633347 }
35643348 }
35653349 func (c *Char) powerSet(pow int32) {
3566- if sys.powerShare[c.playerNo&1] && c.teamside < 2 {
3350+ if sys.powerShare[c.playerNo&1] {
35673351 sys.chars[c.playerNo&1][0].setPower(pow)
35683352 } else {
35693353 sys.chars[c.playerNo][0].setPower(pow)
35703354 }
35713355 }
3572-func (c *Char) distX(opp *Char, oc *Char) float32 {
3573- return (opp.pos[0]*opp.localscl - c.pos[0]*c.localscl) / oc.localscl
3356+func (c *Char) distX(opp *Char) float32 {
3357+ return opp.pos[0] - c.pos[0]
35743358 }
3575-func (c *Char) bodyDistX(opp *Char, oc *Char) float32 {
3576- dist := c.distX(opp, oc)
3359+func (c *Char) bodyDistX(opp *Char) float32 {
3360+ dist := c.distX(opp)
35773361 var oppw float32
35783362 if dist == 0 || (dist < 0) != (opp.facing < 0) {
3579- oppw = opp.facing * opp.width[0] * (320 / float32(opp.localcoord)) / oc.localscl
3363+ oppw = opp.facing * opp.width[0]
35803364 } else {
3581- oppw = -opp.facing * opp.width[1] * (320 / float32(opp.localcoord)) / oc.localscl
3365+ oppw = -opp.facing * opp.width[1]
35823366 }
35833367 return dist + oppw - c.facing*c.width[0]
35843368 }
3585-func (c *Char) rdDistX(rd *Char, oc *Char) BytecodeValue {
3369+func (c *Char) rdDistX(rd *Char) BytecodeValue {
35863370 if rd == nil {
35873371 return BytecodeSF()
35883372 }
3589- dist := c.facing * c.distX(rd, oc)
3373+ dist := c.facing * c.distX(rd)
35903374 if c.stCgi().ver[0] != 1 {
3591- dist = float32(int32(dist)) //旧バージョンでは小数点切り捨て
3375+ dist = float32(int32(dist))
35923376 }
35933377 return BytecodeFloat(dist)
35943378 }
3595-func (c *Char) rdDistY(rd *Char, oc *Char) BytecodeValue {
3379+func (c *Char) rdDistY(rd *Char) BytecodeValue {
35963380 if rd == nil {
35973381 return BytecodeSF()
35983382 }
3599- dist := (rd.pos[1]*rd.localscl - c.pos[1]*c.localscl) / oc.localscl
3600- return BytecodeFloat(dist)
3383+ return BytecodeFloat(rd.pos[1] - c.pos[1])
36013384 }
3602-func (c *Char) p2BodyDistX(oc *Char) BytecodeValue {
3385+func (c *Char) p2BodyDistX() BytecodeValue {
36033386 if p2 := c.p2(); p2 == nil {
36043387 return BytecodeSF()
36053388 } else {
3606- dist := c.facing * c.bodyDistX(p2, oc)
3389+ dist := c.facing * c.bodyDistX(p2)
36073390 if c.stCgi().ver[0] != 1 {
3608- dist = float32(int32(dist)) //旧バージョンでは小数点切り捨て
3391+ dist = float32(int32(dist))
36093392 }
36103393 return BytecodeFloat(dist)
36113394 }
@@ -3726,7 +3509,6 @@ func (c *Char) makeDust(x, y float32) {
37263509 func (c *Char) hitFallDamage() {
37273510 if c.ss.moveType == MT_H {
37283511 c.lifeAdd(-float64(c.ghv.fall.damage), c.ghv.fall.kill, false)
3729- c.ghv.fall.damage = 0
37303512 }
37313513 }
37323514 func (c *Char) hitFallVel() {
@@ -3825,7 +3607,6 @@ func (c *Char) posUpdate() {
38253607 if AbsF(c.veloff) < 1 {
38263608 c.veloff = 0
38273609 }
3828- c.oldLocalscl = c.localscl
38293610 }
38303611 func (c *Char) addTarget(id int32) {
38313612 if !c.hasTarget(id) {
@@ -3915,9 +3696,9 @@ func (c *Char) xScreenBound() {
39153696 if c.facing > 0 {
39163697 min, max = -max, -min
39173698 }
3918- x = MaxF(min+sys.xmin/c.localscl, MinF(max+sys.xmax/c.localscl, x))
3699+ x = MaxF(min+sys.xmin, MinF(max+sys.xmax, x))
39193700 }
3920- x = MaxF(sys.stage.leftbound/c.localscl, MinF(sys.stage.rightbound/c.localscl, x))
3701+ x = MaxF(sys.stage.leftbound, MinF(sys.stage.rightbound, x))
39213702 c.setPosX(x)
39223703 }
39233704 func (c *Char) gethitBindClear() {
@@ -3967,11 +3748,9 @@ func (c *Char) projClsnCheck(p *Projectile, gethit bool) bool {
39673748 } else {
39683749 clsn1, clsn2 = frm.Clsn2(), c.curFrame.Clsn1()
39693750 }
3970- return sys.clsnHantei(clsn1, [...]float32{p.clsnScale[0] * p.localscl, p.clsnScale[1] * p.localscl},
3971- [...]float32{p.pos[0] * p.localscl, p.pos[1] * p.localscl}, p.facing,
3972- clsn2, [...]float32{c.clsnScale[0] * (320 / float32(sys.chars[c.animPN][0].localcoord)), c.clsnScale[1] * (320 / float32(sys.chars[c.animPN][0].localcoord))},
3973- [...]float32{c.pos[0]*c.localscl + c.offsetX()*c.localscl,
3974- c.pos[1]*c.localscl + c.offsetY()*c.localscl}, c.facing)
3751+ return sys.clsnHantei(clsn1, p.clsnScale, p.pos, p.facing,
3752+ clsn2, c.clsnScale,
3753+ [...]float32{c.pos[0] + c.offsetX(), c.pos[1] + c.offsetY()}, c.facing)
39753754 }
39763755 func (c *Char) clsnCheck(atk *Char, c1atk, c1slf bool) bool {
39773756 if atk.curFrame == nil || c.curFrame == nil {
@@ -3988,12 +3767,10 @@ func (c *Char) clsnCheck(atk *Char, c1atk, c1slf bool) bool {
39883767 } else {
39893768 clsn2 = c.curFrame.Clsn2()
39903769 }
3991- return sys.clsnHantei(clsn1, [...]float32{sys.chars[atk.animPN][0].clsnScale[0] * (320 / float32(sys.chars[atk.animPN][0].localcoord)), sys.chars[atk.animPN][0].clsnScale[1] * (320 / float32(sys.chars[atk.animPN][0].localcoord))},
3992- [...]float32{atk.pos[0]*atk.localscl + atk.offsetX()*atk.localscl,
3993- atk.pos[1]*atk.localscl + atk.offsetY()*atk.localscl},
3994- atk.facing, clsn2, [...]float32{sys.chars[c.animPN][0].clsnScale[0] * (320 / float32(sys.chars[c.animPN][0].localcoord)), sys.chars[c.animPN][0].clsnScale[1] * (320 / float32(sys.chars[c.animPN][0].localcoord))},
3995- [...]float32{c.pos[0]*c.localscl + c.offsetX()*c.localscl,
3996- c.pos[1]*c.localscl + c.offsetY()*c.localscl}, c.facing)
3770+ return sys.clsnHantei(clsn1, atk.clsnScale,
3771+ [...]float32{atk.pos[0] + atk.offsetX(), atk.pos[1] + atk.offsetY()},
3772+ atk.facing, clsn2, c.clsnScale, [...]float32{c.pos[0] + c.offsetX(),
3773+ c.pos[1] + c.offsetY()}, c.facing)
39973774 }
39983775 func (c *Char) hitCheck(e *Char) bool {
39993776 return c.clsnCheck(e, true, e.hitdef.reversal_attr > 0)
@@ -4090,9 +3867,8 @@ func (c *Char) action() {
40903867 }
40913868 c.acttmp = -int8(Btoi(p)) * 2
40923869 c.unsetSCF(SCF_guard)
4093- if !(c.scf(SCF_ko) || c.ctrlOver()) &&
4094- ((c.scf(SCF_ctrl) || c.ss.no == 52) &&
4095- c.ss.moveType == MT_I || c.inGuardState()) && c.cmd != nil &&
3870+ if !(c.scf(SCF_ko) || c.ctrlOver()) && (c.scf(SCF_ctrl) || c.ss.no == 52) &&
3871+ c.ss.moveType == MT_I && c.cmd != nil &&
40963872 (sys.autoguard[c.playerNo] || c.cmd[0].Buffer.B > 0) &&
40973873 (c.ss.stateType == ST_S && !c.sf(CSF_nostandguard) ||
40983874 c.ss.stateType == ST_C && !c.sf(CSF_nocrouchguard) ||
@@ -4210,24 +3986,6 @@ func (c *Char) action() {
42103986 c.angleScalse = [...]float32{1, 1}
42113987 c.offset = [2]float32{}
42123988 }
4213- c.minus = -30
4214- if c.ss.sb.playerNo == c.playerNo && c.player {
4215- if sb, ok := c.gi().states[-30]; ok {
4216- sb.run(c)
4217- }
4218- }
4219- c.minus = -20
4220- if c.player {
4221- if sb, ok := c.gi().states[-20]; ok {
4222- sb.run(c)
4223- }
4224- }
4225- c.minus = -10
4226- if c.keyctrl && c.ss.sb.playerNo == c.playerNo {
4227- if sb, ok := c.gi().states[-10]; ok {
4228- sb.run(c)
4229- }
4230- }
42313989 c.minus = -3
42323990 if c.ss.sb.playerNo == c.playerNo && c.player {
42333991 if sb, ok := c.gi().states[-3]; ok {
@@ -4301,10 +4059,10 @@ func (c *Char) action() {
43014059 int8(Btoi(c.hitPause()))
43024060 if !c.hitPause() {
43034061 if !c.sf(CSF_frontwidth) {
4304- c.width[0] = c.defFW() * (320 / float32(c.localcoord)) / c.localscl
4062+ c.width[0] = c.defFW()
43054063 }
43064064 if !c.sf(CSF_backwidth) {
4307- c.width[1] = c.defBW() * (320 / float32(c.localcoord)) / c.localscl
4065+ c.width[1] = c.defBW()
43084066 }
43094067 if !c.sf(CSF_frontedge) {
43104068 c.edge[0] = 0
@@ -4411,20 +4169,20 @@ func (c *Char) update(cvmin, cvmax,
44114169 min, max = -max, -min
44124170 }
44134171 if c.sf(CSF_screenbound) {
4414- c.drawPos[0] = MaxF(min+sys.xmin/c.localscl, MinF(max+sys.xmax/c.localscl, c.drawPos[0]))
4172+ c.drawPos[0] = MaxF(min+sys.xmin, MinF(max+sys.xmax, c.drawPos[0]))
44154173 }
44164174 if c.sf(CSF_movecamera_x) {
4417- *leftest = MaxF(sys.xmin, MinF(c.drawPos[0]*c.localscl-min*c.localscl, *leftest))
4418- *rightest = MinF(sys.xmax, MaxF(c.drawPos[0]*c.localscl-max*c.localscl, *rightest))
4175+ *leftest = MaxF(sys.xmin, MinF(c.drawPos[0]-min, *leftest))
4176+ *rightest = MinF(sys.xmax, MaxF(c.drawPos[0]-max, *rightest))
44194177 if c.acttmp > 0 && !c.sf(CSF_posfreeze) &&
44204178 (c.bindTime == 0 || math.IsNaN(float64(c.bindPos[0]))) {
4421- *cvmin = MinF(*cvmin, c.vel[0]*c.localscl*c.facing)
4422- *cvmax = MaxF(*cvmax, c.vel[0]*c.localscl*c.facing)
4179+ *cvmin = MinF(*cvmin, c.vel[0]*c.facing)
4180+ *cvmax = MaxF(*cvmax, c.vel[0]*c.facing)
44234181 }
44244182 }
44254183 if c.sf(CSF_movecamera_y) {
4426- *highest = MinF(c.drawPos[1]*c.localscl, *highest)
4427- *lowest = MinF(0, MaxF(c.drawPos[1]*c.localscl, *lowest))
4184+ *highest = MinF(c.drawPos[1], *highest)
4185+ *lowest = MinF(0, MaxF(c.drawPos[1], *lowest))
44284186 }
44294187 }
44304188 func (c *Char) tick() {
@@ -4487,11 +4245,7 @@ func (c *Char) tick() {
44874245 if c.stchtmp {
44884246 c.ss.prevno = 0
44894247 } else if c.ss.stateType == ST_L {
4490- if c.movedY {
4491- c.changeStateEx(5020, pn, -1, 0)
4492- } else {
4493- c.changeStateEx(5080, pn, -1, 0)
4494- }
4248+ c.changeStateEx(5080, pn, -1, 0)
44954249 } else if c.ghv.guarded && (c.ghv.damage < c.life || sys.sf(GSF_noko)) {
44964250 switch c.ss.stateType {
44974251 case ST_S:
@@ -4571,8 +4325,8 @@ func (c *Char) cueDraw() {
45714325 return
45724326 }
45734327 if sys.clsnDraw && c.curFrame != nil {
4574- x, y := c.pos[0]*c.oldLocalscl+c.offsetX()*c.oldLocalscl, c.pos[1]*c.oldLocalscl+c.offsetY()*c.oldLocalscl
4575- xs, ys := c.facing*c.clsnScale[0]*(320/float32(sys.chars[c.animPN][0].localcoord)), c.clsnScale[1]*(320/float32(sys.chars[c.animPN][0].localcoord))
4328+ x, y := c.pos[0]+c.offsetX(), c.pos[1]+c.offsetY()
4329+ xs, ys := c.facing*c.clsnScale[0], c.clsnScale[1]
45764330 if clsn := c.curFrame.Clsn1(); len(clsn) > 0 && c.atktmp != 0 {
45774331 sys.drawc1.Add(clsn, x, y, xs, ys)
45784332 }
@@ -4593,13 +4347,13 @@ func (c *Char) cueDraw() {
45934347 }
45944348 }
45954349 if c.sf(CSF_playerpush) {
4596- sys.drawwh.Add([]float32{-c.width[1] * c.oldLocalscl, -c.height() * (320 / float32(c.localcoord)), c.width[0] * c.oldLocalscl, 0},
4597- c.pos[0]*c.oldLocalscl, c.pos[1]*c.oldLocalscl, c.facing, 1)
4350+ sys.drawwh.Add([]float32{-c.width[1], -c.height(), c.width[0], 0},
4351+ c.pos[0], c.pos[1], c.facing, 1)
45984352 }
45994353 }
46004354 if c.anim != nil {
4601- pos := [...]float32{c.drawPos[0]*c.oldLocalscl + c.offsetX()*c.oldLocalscl, c.drawPos[1]*c.oldLocalscl + c.offsetY()*c.oldLocalscl}
4602- scl := [...]float32{c.facing * c.size.xscale * (320 / float32(c.localcoord)), c.size.yscale * (320 / float32(c.localcoord))}
4355+ pos := [...]float32{c.drawPos[0] + c.offsetX(), c.drawPos[1] + c.offsetY()}
4356+ scl := [...]float32{c.facing * c.size.xscale, c.size.yscale}
46034357 agl := float32(0)
46044358 if c.sf(CSF_angledraw) {
46054359 agl = c.angle
@@ -4612,8 +4366,8 @@ func (c *Char) cueDraw() {
46124366 rec := sys.tickNextFrame() && c.acttmp > 0
46134367 sdf := func() *SprData {
46144368 sd := &SprData{c.anim, c.getPalfx(), pos,
4615- scl, c.alpha, c.sprPriority, agl, 0, 0, c.angleScalse, false,
4616- c.playerNo == sys.superplayer, c.gi().ver[0] != 1, c.facing}
4369+ scl, c.alpha, c.sprPriority, agl, c.angleScalse, false,
4370+ c.playerNo == sys.superplayer, c.gi().ver[0] != 1}
46174371 if !c.sf(CSF_trans) {
46184372 sd.alpha[0] = -1
46194373 }
@@ -4624,10 +4378,10 @@ func (c *Char) cueDraw() {
46244378 c.aimg.recAfterImg(sdf())
46254379 }
46264380 } else {
4627- //if c.gi().ver[0] != 1 && c.sf(CSF_angledraw) && !c.sf(CSF_trans) {
4628- // c.setSF(CSF_trans)
4629- // c.alpha = [...]int32{255, 0}
4630- //}
4381+ if c.gi().ver[0] != 1 && c.sf(CSF_angledraw) && !c.sf(CSF_trans) {
4382+ c.setSF(CSF_trans)
4383+ c.alpha = [...]int32{255, 0}
4384+ }
46314385 sd := sdf()
46324386 c.aimg.recAndCue(sd, rec)
46334387 if c.ghv.hitshaketime > 0 && c.ss.time&1 != 0 {
@@ -4638,7 +4392,7 @@ func (c *Char) cueDraw() {
46384392 sc = 0
46394393 }
46404394 if c.sf(CSF_trans) {
4641- sa = 255 - c.alpha[1]
4395+ sa = c.alpha[0]
46424396 }
46434397 sys.sprites.add(sd, sc, sa, float32(c.size.shadowoffset), c.offsetY())
46444398 }
@@ -4647,16 +4401,13 @@ func (c *Char) cueDraw() {
46474401 if c.roundState() == 4 {
46484402 c.exitTarget(false)
46494403 }
4650- if sys.supertime < 0 && c.teamside != sys.superplayer&1 {
4404+ if sys.supertime < 0 && c.playerNo&1 != sys.superplayer&1 {
46514405 c.defenceMul *= sys.superp2defmul
46524406 }
46534407 c.minus = 2
46544408 c.oldPos = c.pos
46554409 }
46564410 }
4657-func (c *Char) victoryQuote(v int32) {
4658- c.winquote = v
4659-}
46604411
46614412 type CharList struct {
46624413 runOrder, drawOrder []*Char
@@ -4853,9 +4604,7 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
48534604 ghv.forcestand = hd.forcestand != 0
48544605 ghv.fall = hd.fall
48554606 getter.fallTime = 0
4856- ghv.fall.xvelocity = hd.fall.xvelocity * c.localscl / getter.localscl
4857- ghv.fall.yvelocity = hd.fall.yvelocity * c.localscl / getter.localscl
4858- ghv.yaccel = hd.yaccel * c.localscl / getter.localscl
4607+ ghv.yaccel = hd.yaccel
48594608 if hd.forcenofall {
48604609 fall = false
48614610 }
@@ -4875,12 +4624,12 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
48754624 ghv.guarded = true
48764625 if getter.ss.stateType == ST_A {
48774626 ghv.ctrltime = hd.airguard_ctrltime
4878- ghv.xvel = hd.airguard_velocity[0] * c.localscl / getter.localscl
4879- ghv.yvel = hd.airguard_velocity[1] * c.localscl / getter.localscl
4627+ ghv.xvel = hd.airguard_velocity[0]
4628+ ghv.yvel = hd.airguard_velocity[1]
48804629 } else {
48814630 ghv.ctrltime = hd.guard_ctrltime
4882- ghv.xvel = hd.guard_velocity * c.localscl / getter.localscl
4883- ghv.yvel = hd.ground_velocity[1] * c.localscl / getter.localscl
4631+ ghv.xvel = hd.guard_velocity
4632+ ghv.yvel = hd.ground_velocity[1]
48844633 }
48854634 absdamage = hd.guarddamage
48864635 ghv.hitcount = hc
@@ -4890,35 +4639,24 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
48904639 if getter.ss.stateType == ST_A {
48914640 ghv.hittime = hd.air_hittime
48924641 ghv.ctrltime = hd.air_hittime
4893- ghv.xvel = hd.air_velocity[0] * c.localscl / getter.localscl
4894- ghv.yvel = hd.air_velocity[1] * c.localscl / getter.localscl
4642+ ghv.xvel = hd.air_velocity[0]
4643+ ghv.yvel = hd.air_velocity[1]
48954644 ghv.fallf = hd.air_fall
48964645 } else if getter.ss.stateType == ST_L {
48974646 ghv.hittime = hd.down_hittime
48984647 ghv.ctrltime = hd.down_hittime
4899- ghv.xvel = hd.down_velocity[0] * c.localscl / getter.localscl
4900- if getter.movedY {
4901- ghv.yvel = hd.air_velocity[1] * c.localscl / getter.localscl
4902- } else {
4903- ghv.yvel = hd.down_velocity[1] * c.localscl / getter.localscl
4904- }
4648+ ghv.xvel = hd.down_velocity[0]
4649+ ghv.yvel = hd.down_velocity[1]
49054650 if !hd.down_bounce {
49064651 ghv.fall.xvelocity = float32(math.NaN())
49074652 ghv.fall.yvelocity = 0
49084653 }
49094654 } else {
4655+ ghv.hittime = hd.ground_hittime
49104656 ghv.ctrltime = hd.ground_hittime
4911- ghv.xvel = hd.ground_velocity[0] * c.localscl / getter.localscl
4912- ghv.yvel = hd.ground_velocity[1] * c.localscl / getter.localscl
4657+ ghv.xvel = hd.ground_velocity[0]
4658+ ghv.yvel = hd.ground_velocity[1]
49134659 ghv.fallf = hd.ground_fall
4914- if ghv.fallf && ghv.yvel == 0 {
4915- ghv.yvel = -0.001 * c.localscl / getter.localscl //新MUGENだとウィンドウサイズを大きくするとここに入る数値が小さくなるが、再現しないほうがよいと思う。
4916- }
4917- if ghv.yvel != 0 {
4918- ghv.hittime = hd.air_hittime
4919- } else {
4920- ghv.hittime = hd.ground_hittime
4921- }
49224660 }
49234661 if ghv.hittime < 0 {
49244662 ghv.hittime = 0
@@ -4952,45 +4690,45 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
49524690 }
49534691 if !math.IsNaN(float64(hd.maxdist[0])) {
49544692 if byf < 0 {
4955- if getter.pos[0]*getter.localscl/c.localscl < byPos[0]-hd.maxdist[0] {
4693+ if getter.pos[0] < byPos[0]-hd.maxdist[0] {
49564694 snap[0] = byPos[0] - hd.maxdist[0]
49574695 }
49584696 } else {
4959- if getter.pos[0]*getter.localscl/c.localscl > byPos[0]+hd.maxdist[0] {
4697+ if getter.pos[0] > byPos[0]+hd.maxdist[0] {
49604698 snap[0] = byPos[0] + hd.maxdist[0]
49614699 }
49624700 }
49634701 }
49644702 if hitType == 1 || getter.ss.stateType == ST_A {
49654703 if !math.IsNaN(float64(hd.mindist[1])) {
4966- if getter.pos[1]*getter.localscl/c.localscl < byPos[1]+hd.mindist[1] {
4704+ if getter.pos[1] < byPos[1]+hd.mindist[1] {
49674705 snap[1] = byPos[1] + hd.mindist[1]
49684706 }
49694707 }
49704708 if !math.IsNaN(float64(hd.maxdist[1])) {
4971- if getter.pos[1]*getter.localscl/c.localscl > byPos[1]+hd.maxdist[1] {
4709+ if getter.pos[1] > byPos[1]+hd.maxdist[1] {
49724710 snap[1] = byPos[1] + hd.maxdist[1]
49734711 }
49744712 }
49754713 }
49764714 if !math.IsNaN(float64(snap[0])) {
4977- ghv.xoff = snap[0]*c.localscl/getter.localscl - getter.pos[0]
4715+ ghv.xoff = snap[0] - getter.pos[0]
49784716 }
49794717 if !math.IsNaN(float64(snap[1])) {
4980- ghv.yoff = snap[1]*c.localscl/getter.localscl - getter.pos[1]
4718+ ghv.yoff = snap[1] - getter.pos[1]
49814719 }
49824720 if hd.snapt != 0 && getter.hoIdx < 0 {
49834721 getter.setBindToId(c)
49844722 getter.setBindTime(hd.snapt + Btoi(hd.snapt > 0 && !c.pause()))
49854723 getter.bindFacing = 0
49864724 if !math.IsNaN(float64(snap[0])) {
4987- getter.bindPos[0] = hd.mindist[0] * c.localscl / getter.localscl
4725+ getter.bindPos[0] = hd.mindist[0]
49884726 } else {
49894727 getter.bindPos[0] = float32(math.NaN())
49904728 }
49914729 if !math.IsNaN(float64(snap[1])) &&
49924730 (hitType == 1 || getter.ss.stateType == ST_A) {
4993- getter.bindPos[1] = hd.mindist[1] * c.localscl / getter.localscl
4731+ getter.bindPos[1] = hd.mindist[1]
49944732 } else {
49954733 getter.bindPos[1] = float32(math.NaN())
49964734 }
@@ -5025,12 +4763,12 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
50254763 }
50264764 if getter.ss.stateType == ST_A {
50274765 if getter.ghv.xvel < 0 {
5028- getter.ghv.xvel -= 2 / c.localscl * getter.localscl
4766+ getter.ghv.xvel -= 2
50294767 }
50304768 if getter.ghv.yvel <= 0 {
5031- getter.ghv.yvel -= 2 / c.localscl * getter.localscl
4769+ getter.ghv.yvel -= 2
50324770 if getter.ghv.yvel > -3 {
5033- getter.ghv.yvel = -3 / c.localscl * getter.localscl
4771+ getter.ghv.yvel = -3
50344772 }
50354773 }
50364774 } else {
@@ -5038,12 +4776,12 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
50384776 getter.ghv.xvel *= 0.66
50394777 }
50404778 if getter.ghv.xvel < 0 {
5041- getter.ghv.xvel -= 2.5 / c.localscl * getter.localscl
4779+ getter.ghv.xvel -= 2.5
50424780 }
50434781 if getter.ghv.yvel <= 0 {
5044- getter.ghv.yvel -= 2 / c.localscl * getter.localscl
4782+ getter.ghv.yvel -= 2
50454783 if getter.ghv.yvel > -6 {
5046- getter.ghv.yvel = -6 / c.localscl * getter.localscl
4784+ getter.ghv.yvel = -6
50474785 }
50484786 }
50494787 }
@@ -5060,24 +4798,22 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
50604798 }
50614799 off := pos
50624800 if !proj {
5063- off[0] = p2.pos[0]*p2.localscl - p1.pos[0]*p1.localscl
4801+ off[0] = p2.pos[0] - p1.pos[0]
50644802 if (p1.facing < 0) != (p2.facing < 0) {
5065- off[0] += p2.facing * p2.width[0] * p2.localscl
4803+ off[0] += p2.facing * p2.width[0]
50664804 } else {
5067- off[0] -= p2.facing * p2.width[1] * p2.localscl
4805+ off[0] -= p2.facing * p2.width[1]
50684806 }
50694807 }
50704808 off[0] *= p1.facing
50714809 if proj {
5072- off[0] *= c.localscl
5073- off[1] *= c.localscl
5074- off[0] += hd.sparkxy[0] * projf * p1.facing * c.localscl
4810+ off[0] += hd.sparkxy[0] * projf * p1.facing
50754811 } else {
5076- off[0] -= hd.sparkxy[0] * c.localscl
4812+ off[0] -= hd.sparkxy[0]
50774813 }
5078- off[1] += hd.sparkxy[1] * c.localscl
4814+ off[1] += hd.sparkxy[1]
50794815 if c.id != p1.id {
5080- off[1] += p1.hitdef.sparkxy[1] * c.localscl
4816+ off[1] += p1.hitdef.sparkxy[1]
50814817 }
50824818 if e, i := c.newExplod(); e != nil {
50834819 e.anim = c.getAnim(animNo, ffx)
@@ -5087,10 +4823,6 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
50874823 e.offset = off
50884824 e.supermovetime = -1
50894825 e.pausemovetime = -1
5090- e.localscl = 1
5091- if !ffx {
5092- e.scale = [...]float32{c.localscl, c.localscl}
5093- }
50944826 e.setPos(p1)
50954827 c.insertExplod(i)
50964828 }
@@ -5198,8 +4930,8 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
51984930 if hd.envshake_time > 0 {
51994931 sys.envShake.time = hd.envshake_time
52004932 sys.envShake.freq = hd.envshake_freq * float32(math.Pi) / 180
5201- sys.envShake.ampl = int32(float32(hd.envshake_ampl) * c.localscl)
5202- sys.envShake.phase = hd.envshake_phase * c.localscl
4933+ sys.envShake.ampl = hd.envshake_ampl
4934+ sys.envShake.phase = hd.envshake_phase
52034935 sys.envShake.setDefPhase()
52044936 }
52054937 getter.getcombo += hd.numhits * hits
@@ -5256,18 +4988,18 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
52564988 for j := range pr {
52574989 p := &pr[j]
52584990 if p.id < 0 || p.hits < 0 || p.hitdef.affectteam != 0 &&
5259- (getter.teamside != p.hitdef.teamside-1) != (p.hitdef.affectteam > 0) {
4991+ (getter.playerNo&1 != i&1) != (p.hitdef.affectteam > 0) {
52604992 continue
52614993 }
5262- if dist := (getter.pos[0]*getter.localscl - p.pos[0]*p.localscl) * p.facing; dist >= 0 &&
5263- dist <= float32(c.size.proj.attack.dist)*c.localscl {
4994+ if dist := (getter.pos[0] - p.pos[0]) * p.facing; dist >= 0 &&
4995+ dist <= float32(c.size.proj.attack.dist) {
52644996 getter.inguarddist = true
52654997 }
52664998 if p.hits == 0 {
52674999 continue
52685000 }
52695001 if getter.atktmp != 0 && (getter.hitdef.affectteam == 0 ||
5270- (p.hitdef.teamside-1 != getter.teamside) == (getter.hitdef.affectteam > 0)) &&
5002+ (i&1 != getter.playerNo&1) == (getter.hitdef.affectteam > 0)) &&
52715003 getter.hitdef.hitflag&int32(ST_P) != 0 &&
52725004 getter.projClsnCheck(p, false) {
52735005 p.hits = -2
@@ -5286,7 +5018,7 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
52865018 if getter.sf(CSF_gethit) {
52875019 getter.hittmp = int8(Btoi(getter.ghv.fallf)) + 1
52885020 }
5289- if dist := -getter.distX(c, getter) * c.facing; dist >= 0 &&
5021+ if dist := -getter.distX(c) * c.facing; dist >= 0 &&
52905022 dist <= float32(p.hitdef.guard_dist) {
52915023 getter.inguarddist = true
52925024 }
@@ -5295,8 +5027,8 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
52955027 if p.misstime > 0 {
52965028 hits = 1
52975029 }
5298- if ht := hit(c, &p.hitdef, [...]float32{p.pos[0] - c.pos[0]*c.localscl/p.localscl,
5299- p.pos[1] - c.pos[1]*c.localscl/p.localscl}, p.facing, hits); ht != 0 {
5030+ if ht := hit(c, &p.hitdef, [...]float32{p.pos[0] - c.pos[0],
5031+ p.pos[1] - c.pos[1]}, p.facing, hits); ht != 0 {
53005032 p.timemiss = ^Max(0, p.misstime)
53015033 if Abs(ht) == 1 {
53025034 sys.cgi[i].pctype = PC_Hit
@@ -5326,18 +5058,18 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
53265058 gxmax += sys.xmax
53275059 getter.inguarddist = false
53285060 getter.unsetSF(CSF_gethit)
5329- gl, gr := -getter.width[0]*getter.localscl, getter.width[1]*getter.localscl
5061+ gl, gr := -getter.width[0], getter.width[1]
53305062 if getter.facing > 0 {
53315063 gl, gr = -gr, -gl
53325064 }
5333- gl += getter.pos[0] * getter.localscl
5334- gr += getter.pos[0] * getter.localscl
5065+ gl += getter.pos[0]
5066+ gr += getter.pos[0]
53355067 getter.enemyNearClear()
53365068 for _, c := range cl.runOrder {
53375069 contact := 0
53385070 if c.atktmp != 0 && c.id != getter.id && (c.hitdef.affectteam == 0 ||
5339- (getter.teamside != c.hitdef.teamside-1) == (c.hitdef.affectteam > 0)) {
5340- dist := -getter.distX(c, getter) * c.facing
5071+ (getter.playerNo&1 != c.playerNo&1) == (c.hitdef.affectteam > 0)) {
5072+ dist := -getter.distX(c) * c.facing
53415073 if c.ss.moveType == MT_A && dist >= 0 && dist <= c.attackDist {
53425074 getter.inguarddist = true
53435075 }
@@ -5405,47 +5137,47 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
54055137 }
54065138 }
54075139 }
5408- if getter.teamside != c.teamside && getter.sf(CSF_playerpush) &&
5140+ if getter.playerNo&1 != c.playerNo&1 && getter.sf(CSF_playerpush) &&
54095141 c.sf(CSF_playerpush) && (getter.ss.stateType == ST_A ||
5410- getter.pos[1]*getter.localscl-c.pos[1]*c.localscl < getter.height()*c.localscl) &&
5411- (c.ss.stateType == ST_A || c.pos[1]*c.localscl-getter.pos[1]*getter.localscl < c.height()*(320/float32(c.localcoord))) {
5412- cl, cr := -c.width[0]*c.localscl, c.width[1]*c.localscl
5142+ getter.pos[1]-c.pos[1] < getter.height()) &&
5143+ (c.ss.stateType == ST_A || c.pos[1]-getter.pos[1] < c.height()) {
5144+ cl, cr := -c.width[0], c.width[1]
54135145 if c.facing > 0 {
54145146 cl, cr = -cr, -cl
54155147 }
5416- cl += c.pos[0] * c.localscl
5417- cr += c.pos[0] * c.localscl
5148+ cl += c.pos[0]
5149+ cr += c.pos[0]
54185150 if gl < cr && cl < gr && (contact > 0 ||
54195151 getter.clsnCheck(c, false, false)) {
54205152 getter.pushed, c.pushed = true, true
5421- tmp := getter.distX(c, getter)
5153+ tmp := getter.distX(c)
54225154 if tmp == 0 {
5423- if getter.pos[1]*getter.localscl > c.pos[1]*c.localscl {
5155+ if getter.pos[1] > c.pos[1] {
54245156 tmp = getter.facing
54255157 } else {
54265158 tmp = -c.facing
54275159 }
54285160 }
54295161 if tmp > 0 {
5430- getter.pos[0] -= ((gr - cl) * 0.5) / getter.localscl
5431- c.pos[0] += ((gr - cl) * 0.5) / c.localscl
5162+ getter.pos[0] -= (gr - cl) * 0.5
5163+ c.pos[0] += (gr - cl) * 0.5
54325164 } else {
5433- getter.pos[0] += ((cr - gl) * 0.5) / getter.localscl
5434- c.pos[0] -= ((cr - gl) * 0.5) / c.localscl
5165+ getter.pos[0] += (cr - gl) * 0.5
5166+ c.pos[0] -= (cr - gl) * 0.5
54355167 }
54365168 if getter.sf(CSF_screenbound) {
5437- getter.pos[0] = MaxF(gxmin/getter.localscl, MinF(gxmax/getter.localscl, getter.pos[0]))
5169+ getter.pos[0] = MaxF(gxmin, MinF(gxmax, getter.pos[0]))
54385170 }
54395171 if c.sf(CSF_screenbound) {
54405172 l, r := c.getEdge(c.edge[0], true), -c.getEdge(c.edge[1], true)
54415173 if c.facing > 0 {
54425174 l, r = -r, -l
54435175 }
5444- c.pos[0] = MaxF(l+sys.xmin/c.localscl, MinF(r+sys.xmax/c.localscl, c.pos[0]))
5176+ c.pos[0] = MaxF(l+sys.xmin, MinF(r+sys.xmax, c.pos[0]))
54455177 }
5446- getter.pos[0] = MaxF(sys.stage.leftbound/getter.localscl, MinF(sys.stage.rightbound/getter.localscl,
5178+ getter.pos[0] = MaxF(sys.stage.leftbound, MinF(sys.stage.rightbound,
54475179 getter.pos[0]))
5448- c.pos[0] = MaxF(sys.stage.leftbound/c.localscl, MinF(sys.stage.rightbound/c.localscl,
5180+ c.pos[0] = MaxF(sys.stage.leftbound, MinF(sys.stage.rightbound,
54495181 c.pos[0]))
54505182 getter.drawPos[0], c.drawPos[0] = getter.pos[0], c.pos[0]
54515183 }
@@ -5501,15 +5233,17 @@ func (cl *CharList) enemyNear(c *Char, n int32, p2 bool) *Char {
55015233 *cache = append(*cache, e)
55025234 return
55035235 }
5504- if AbsF(c.distX(e, c)) < AbsF(c.distX((*cache)[i], c)) {
5236+ if p2 && !e.scf(SCF_ko_round_middle) &&
5237+ (*cache)[i].scf(SCF_ko_round_middle) || (!p2 ||
5238+ e.scf(SCF_ko_round_middle) == (*cache)[i].scf(SCF_ko_round_middle)) &&
5239+ AbsF(c.distX(e)) < AbsF(c.distX((*cache)[i])) {
55055240 add((*cache)[i], i+1)
55065241 (*cache)[i] = e
55075242 }
55085243 }
55095244 }
55105245 for _, e := range cl.runOrder {
5511- if e.player && e.teamside != c.teamside &&
5512- (p2 && !e.scf(SCF_ko_round_middle) || !p2 && e.helperIndex == 0) {
5246+ if e.player && e.playerNo&1 != c.playerNo&1 {
55135247 add(e, 0)
55145248 }
55155249 }
--- a/src/common.go
+++ b/src/common.go
@@ -245,7 +245,7 @@ func LoadFile(file *string, deffile string, load func(string) error) error {
245245 var fp string
246246 *file = strings.Replace(*file, "\\", "/", -1)
247247 defdir := filepath.Dir(strings.Replace(deffile, "\\", "/", -1))
248- if defdir == "." || strings.Contains(*file, ":/") {
248+ if defdir == "." {
249249 fp = *file
250250 } else if defdir == "/" {
251251 fp = "/" + *file
@@ -514,16 +514,6 @@ func (is IniSection) getText(name string) (str string, ok bool, err error) {
514514 str = str[1 : len(str)-1]
515515 return
516516 }
517-func (is IniSection) getString(name string) (str string, ok bool) {
518- str, ok = is[name]
519- if !ok {
520- return
521- }
522- if len(str) >= 2 && str[0] == '"' && str[len(str)-1] == '"' {
523- str = str[1 : len(str)-1]
524- }
525- return
526-}
527517
528518 type Layout struct {
529519 offset [2]float32
@@ -562,7 +552,7 @@ func (l *Layout) Read(pre string, is IniSection) {
562552 l.layerno = I32ToI16(Min(2, ln))
563553 is.ReadF32(pre+"scale", &l.scale[0], &l.scale[1])
564554 }
565-func (l *Layout) DrawSprite(x, y float32, ln int16, s *Sprite, fx *PalFX, fscale float32) {
555+func (l *Layout) DrawSprite(x, y float32, ln int16, s *Sprite, fx *PalFX) {
566556 if l.layerno == ln && s != nil {
567557 if l.facing < 0 {
568558 x += sys.lifebarFontScale
@@ -570,8 +560,12 @@ func (l *Layout) DrawSprite(x, y float32, ln int16, s *Sprite, fx *PalFX, fscale
570560 if l.vfacing < 0 {
571561 y += sys.lifebarFontScale
572562 }
563+ pal := s.Pal
564+ if pal != nil {
565+ pal = fx.getFxPal(pal, false)
566+ }
573567 s.Draw(x+l.offset[0], y+l.offset[1],
574- l.scale[0]*float32(l.facing)*fscale, l.scale[1]*float32(l.vfacing)*fscale, s.Pal, fx)
568+ l.scale[0]*float32(l.facing), l.scale[1]*float32(l.vfacing), pal)
575569 }
576570 }
577571 func (l *Layout) DrawAnim(r *[4]int32, x, y, scl float32, ln int16,
@@ -586,7 +580,7 @@ func (l *Layout) DrawAnim(r *[4]int32, x, y, scl float32, ln int16,
586580 a.Draw(r, x+l.offset[0], y+l.offset[1]+float32(sys.gameHeight-240),
587581 scl, scl, l.scale[0]*float32(l.facing), l.scale[0]*float32(l.facing),
588582 l.scale[1]*float32(l.vfacing),
589- 0, 0, 0, 0, float32(sys.gameWidth-320)/2, nil, false, 1)
583+ 0, 0, float32(sys.gameWidth-320)/2, nil, false)
590584 }
591585 }
592586 func (l *Layout) DrawText(x, y, scl float32, ln int16,
--- a/src/compiler.go
+++ b/src/compiler.go
@@ -2762,26 +2762,6 @@ func (c *Compiler) paramPostye(is IniSection, sc *StateControllerBase,
27622762 return nil
27632763 })
27642764 }
2765-
2766-func (c *Compiler) paramSpace(is IniSection, sc *StateControllerBase,
2767- id byte) error {
2768- return c.stateParam(is, "space", func(data string) error {
2769- if len(data) <= 1 {
2770- return Error("値が指定されていません")
2771- }
2772- var sp Space
2773- if len(data) >= 2 {
2774- if strings.ToLower(data[:2]) == "st" {
2775- sp = Space_stage
2776- } else if strings.ToLower(data[:2]) == "sc" {
2777- sp = Space_screen
2778- }
2779- }
2780- sc.add(id, sc.iToExp(int32(sp)))
2781- return nil
2782- })
2783-}
2784-
27852765 func (c *Compiler) paramTrans(is IniSection, sc *StateControllerBase,
27862766 prefix string, id byte, afterImage bool) error {
27872767 return c.stateParam(is, prefix+"trans", func(data string) error {
@@ -2823,7 +2803,7 @@ func (c *Compiler) paramTrans(is IniSection, sc *StateControllerBase,
28232803 }
28242804 var exp []BytecodeExp
28252805 b := false
2826- if !afterImage || sys.cgi[c.playerNo].ver[0] == 1 {
2806+ if !afterImage {
28272807 if err := c.stateParam(is, prefix+"alpha", func(data string) error {
28282808 b = true
28292809 bes, err := c.exprs(data, VT_Int, 2)
@@ -2851,7 +2831,7 @@ func (c *Compiler) paramTrans(is IniSection, sc *StateControllerBase,
28512831 }
28522832 if len(bes) > 1 {
28532833 exp[1] = bes[1]
2854- if tt != TT_alpha && tt != TT_add1 && !(tt == TT_add && sys.cgi[c.playerNo].ver[0] == 1) {
2834+ if tt != TT_alpha && tt != TT_add1 {
28552835 exp[1].append(OC_pop)
28562836 }
28572837 }
@@ -2860,15 +2840,7 @@ func (c *Compiler) paramTrans(is IniSection, sc *StateControllerBase,
28602840 if len(bes) <= 1 {
28612841 exp[1].appendValue(BytecodeInt(255))
28622842 }
2863- case TT_add:
2864- if sys.cgi[c.playerNo].ver[0] == 1 {
2865- if len(bes) <= 1 {
2866- exp[1].appendValue(BytecodeInt(255))
2867- }
2868- } else {
2869- exp[1].appendValue(BytecodeInt(255))
2870- }
2871- case TT_sub:
2843+ case TT_add, TT_sub:
28722844 exp[1].appendValue(BytecodeInt(255))
28732845 default:
28742846 exp[1].appendValue(BytecodeInt(0))
@@ -3066,10 +3038,6 @@ func (c *Compiler) hitBySub(is IniSection, sc *StateControllerBase) error {
30663038 func (c *Compiler) hitBy(is IniSection, sc *StateControllerBase,
30673039 _ int8) (StateController, error) {
30683040 ret, err := (*hitBy)(sc), c.stateSec(is, func() error {
3069- if err := c.paramValue(is, sc, "redirectid",
3070- hitBy_redirectid, VT_Int, 1, false); err != nil {
3071- return err
3072- }
30733041 return c.hitBySub(is, sc)
30743042 })
30753043 return *ret, err
@@ -3077,10 +3045,6 @@ func (c *Compiler) hitBy(is IniSection, sc *StateControllerBase,
30773045 func (c *Compiler) notHitBy(is IniSection, sc *StateControllerBase,
30783046 _ int8) (StateController, error) {
30793047 ret, err := (*notHitBy)(sc), c.stateSec(is, func() error {
3080- if err := c.paramValue(is, sc, "redirectid",
3081- hitBy_redirectid, VT_Int, 1, false); err != nil {
3082- return err
3083- }
30843048 return c.hitBySub(is, sc)
30853049 })
30863050 return *ret, err
@@ -3088,10 +3052,6 @@ func (c *Compiler) notHitBy(is IniSection, sc *StateControllerBase,
30883052 func (c *Compiler) assertSpecial(is IniSection, sc *StateControllerBase,
30893053 _ int8) (StateController, error) {
30903054 ret, err := (*assertSpecial)(sc), c.stateSec(is, func() error {
3091- if err := c.paramValue(is, sc, "redirectid",
3092- assertSpecial_redirectid, VT_Int, 1, false); err != nil {
3093- return err
3094- }
30953055 foo := func(data string) error {
30963056 switch strings.ToLower(data) {
30973057 case "nostandguard":
@@ -3166,10 +3126,6 @@ func (c *Compiler) assertSpecial(is IniSection, sc *StateControllerBase,
31663126 func (c *Compiler) playSnd(is IniSection, sc *StateControllerBase,
31673127 _ int8) (StateController, error) {
31683128 ret, err := (*playSnd)(sc), c.stateSec(is, func() error {
3169- if err := c.paramValue(is, sc, "redirectid",
3170- playSnd_redirectid, VT_Int, 1, false); err != nil {
3171- return err
3172- }
31733129 f := false
31743130 if err := c.stateParam(is, "value", func(data string) error {
31753131 f = true
@@ -3231,10 +3187,6 @@ func (c *Compiler) playSnd(is IniSection, sc *StateControllerBase,
32313187 }
32323188 func (c *Compiler) changeStateSub(is IniSection,
32333189 sc *StateControllerBase) error {
3234- if err := c.paramValue(is, sc, "redirectid",
3235- changeState_redirectid, VT_Int, 1, false); err != nil {
3236- return err
3237- }
32383190 if err := c.paramValue(is, sc, "value",
32393191 changeState_value, VT_Int, 1, true); err != nil {
32403192 return err
@@ -3270,10 +3222,6 @@ func (c *Compiler) selfState(is IniSection, sc *StateControllerBase,
32703222 func (c *Compiler) tagIn(is IniSection, sc *StateControllerBase,
32713223 _ int8) (StateController, error) {
32723224 ret, err := (*tagIn)(sc), c.stateSec(is, func() error {
3273- if err := c.paramValue(is, sc, "redirectid",
3274- tagIn_redirectid, VT_Int, 1, false); err != nil {
3275- return err
3276- }
32773225 if err := c.paramValue(is, sc, "stateno",
32783226 tagIn_stateno, VT_Int, 1, true); err != nil {
32793227 return err
@@ -3299,10 +3247,6 @@ func (c *Compiler) tagIn(is IniSection, sc *StateControllerBase,
32993247 func (c *Compiler) tagOut(is IniSection, sc *StateControllerBase,
33003248 _ int8) (StateController, error) {
33013249 ret, err := (*tagOut)(sc), c.stateSec(is, func() error {
3302- if err := c.paramValue(is, sc, "redirectid",
3303- tagOut_redirectid, VT_Int, 1, false); err != nil {
3304- return err
3305- }
33063250 sc.add(tagOut_, nil)
33073251 return nil
33083252 })
@@ -3315,10 +3259,6 @@ func (c *Compiler) tagOut(is IniSection, sc *StateControllerBase,
33153259 func (c *Compiler) destroySelf(is IniSection, sc *StateControllerBase,
33163260 _ int8) (StateController, error) {
33173261 ret, err := (*destroySelf)(sc), c.stateSec(is, func() error {
3318- if err := c.paramValue(is, sc, "redirectid",
3319- destroySelf_redirectid, VT_Int, 1, false); err != nil {
3320- return err
3321- }
33223262 if err := c.paramValue(is, sc, "recursive",
33233263 destroySelf_recursive, VT_Bool, 1, false); err != nil {
33243264 return err
@@ -3333,10 +3273,6 @@ func (c *Compiler) destroySelf(is IniSection, sc *StateControllerBase,
33333273 }
33343274 func (c *Compiler) changeAnimSub(is IniSection,
33353275 sc *StateControllerBase) error {
3336- if err := c.paramValue(is, sc, "redirectid",
3337- changeAnim_redirectid, VT_Int, 1, false); err != nil {
3338- return err
3339- }
33403276 if err := c.paramValue(is, sc, "elem",
33413277 changeAnim_elem, VT_Int, 1, false); err != nil {
33423278 return err
@@ -3364,10 +3300,6 @@ func (c *Compiler) changeAnim2(is IniSection, sc *StateControllerBase,
33643300 func (c *Compiler) helper(is IniSection, sc *StateControllerBase,
33653301 _ int8) (StateController, error) {
33663302 ret, err := (*helper)(sc), c.stateSec(is, func() error {
3367- if err := c.paramValue(is, sc, "redirectid",
3368- helper_redirectid, VT_Int, 1, false); err != nil {
3369- return err
3370- }
33713303 if err := c.stateParam(is, "helpertype", func(data string) error {
33723304 if len(data) == 0 {
33733305 return Error("値が指定されていません")
@@ -3478,10 +3410,6 @@ func (c *Compiler) helper(is IniSection, sc *StateControllerBase,
34783410 func (c *Compiler) ctrlSet(is IniSection, sc *StateControllerBase,
34793411 _ int8) (StateController, error) {
34803412 ret, err := (*ctrlSet)(sc), c.stateSec(is, func() error {
3481- if err := c.paramValue(is, sc, "redirectid",
3482- ctrlSet_redirectid, VT_Int, 1, false); err != nil {
3483- return err
3484- }
34853413 return c.paramValue(is, sc, "value", ctrlSet_value, VT_Bool, 1, true)
34863414 })
34873415 return *ret, err
@@ -3515,9 +3443,6 @@ func (c *Compiler) explodSub(is IniSection,
35153443 if err := c.paramPostye(is, sc, explod_postype); err != nil {
35163444 return err
35173445 }
3518- if err := c.paramSpace(is, sc, explod_space); err != nil {
3519- return err
3520- }
35213446 f := false
35223447 if err := c.stateParam(is, "vel", func(data string) error {
35233448 f = true
@@ -3563,10 +3488,6 @@ func (c *Compiler) explodSub(is IniSection,
35633488 explod_sprpriority, VT_Int, 1, false); err != nil {
35643489 return err
35653490 }
3566- if err := c.paramValue(is, sc, "bindid",
3567- explod_bindid, VT_Int, 1, false); err != nil {
3568- return err
3569- }
35703491 if err := c.stateParam(is, "ontop", func(data string) error {
35713492 if err := c.scAdd(sc, explod_ontop, data, VT_Bool, 1); err != nil {
35723493 return err
@@ -3594,10 +3515,6 @@ func (c *Compiler) explodSub(is IniSection,
35943515 func (c *Compiler) explod(is IniSection, sc *StateControllerBase,
35953516 ihp int8) (StateController, error) {
35963517 ret, err := (*explod)(sc), c.stateSec(is, func() error {
3597- if err := c.paramValue(is, sc, "redirectid",
3598- explod_redirectid, VT_Int, 1, false); err != nil {
3599- return err
3600- }
36013518 if err := c.paramValue(is, sc, "ownpal",
36023519 explod_ownpal, VT_Bool, 1, false); err != nil {
36033520 return err
@@ -3638,10 +3555,6 @@ func (c *Compiler) explod(is IniSection, sc *StateControllerBase,
36383555 func (c *Compiler) modifyExplod(is IniSection, sc *StateControllerBase,
36393556 _ int8) (StateController, error) {
36403557 ret, err := (*modifyExplod)(sc), c.stateSec(is, func() error {
3641- if err := c.paramValue(is, sc, "redirectid",
3642- explod_redirectid, VT_Int, 1, false); err != nil {
3643- return err
3644- }
36453558 if err := c.explodSub(is, sc); err != nil {
36463559 return err
36473560 }
@@ -3664,10 +3577,6 @@ func (c *Compiler) modifyExplod(is IniSection, sc *StateControllerBase,
36643577 func (c *Compiler) gameMakeAnim(is IniSection, sc *StateControllerBase,
36653578 _ int8) (StateController, error) {
36663579 ret, err := (*gameMakeAnim)(sc), c.stateSec(is, func() error {
3667- if err := c.paramValue(is, sc, "redirectid",
3668- gameMakeAnim_redirectid, VT_Int, 1, false); err != nil {
3669- return err
3670- }
36713580 if err := c.paramValue(is, sc, "pos",
36723581 gameMakeAnim_pos, VT_Float, 2, false); err != nil {
36733582 return err
@@ -3726,10 +3635,6 @@ func (c *Compiler) posSetSub(is IniSection,
37263635 func (c *Compiler) posSet(is IniSection, sc *StateControllerBase,
37273636 _ int8) (StateController, error) {
37283637 ret, err := (*posSet)(sc), c.stateSec(is, func() error {
3729- if err := c.paramValue(is, sc, "redirectid",
3730- posSet_redirectid, VT_Int, 1, false); err != nil {
3731- return err
3732- }
37333638 return c.posSetSub(is, sc)
37343639 })
37353640 return *ret, err
@@ -3737,10 +3642,6 @@ func (c *Compiler) posSet(is IniSection, sc *StateControllerBase,
37373642 func (c *Compiler) posAdd(is IniSection, sc *StateControllerBase,
37383643 _ int8) (StateController, error) {
37393644 ret, err := (*posAdd)(sc), c.stateSec(is, func() error {
3740- if err := c.paramValue(is, sc, "redirectid",
3741- posSet_redirectid, VT_Int, 1, false); err != nil {
3742- return err
3743- }
37443645 return c.posSetSub(is, sc)
37453646 })
37463647 return *ret, err
@@ -3748,10 +3649,6 @@ func (c *Compiler) posAdd(is IniSection, sc *StateControllerBase,
37483649 func (c *Compiler) velSet(is IniSection, sc *StateControllerBase,
37493650 _ int8) (StateController, error) {
37503651 ret, err := (*velSet)(sc), c.stateSec(is, func() error {
3751- if err := c.paramValue(is, sc, "redirectid",
3752- posSet_redirectid, VT_Int, 1, false); err != nil {
3753- return err
3754- }
37553652 return c.posSetSub(is, sc)
37563653 })
37573654 return *ret, err
@@ -3759,10 +3656,6 @@ func (c *Compiler) velSet(is IniSection, sc *StateControllerBase,
37593656 func (c *Compiler) velAdd(is IniSection, sc *StateControllerBase,
37603657 _ int8) (StateController, error) {
37613658 ret, err := (*velAdd)(sc), c.stateSec(is, func() error {
3762- if err := c.paramValue(is, sc, "redirectid",
3763- posSet_redirectid, VT_Int, 1, false); err != nil {
3764- return err
3765- }
37663659 return c.posSetSub(is, sc)
37673660 })
37683661 return *ret, err
@@ -3770,10 +3663,6 @@ func (c *Compiler) velAdd(is IniSection, sc *StateControllerBase,
37703663 func (c *Compiler) velMul(is IniSection, sc *StateControllerBase,
37713664 _ int8) (StateController, error) {
37723665 ret, err := (*velMul)(sc), c.stateSec(is, func() error {
3773- if err := c.paramValue(is, sc, "redirectid",
3774- posSet_redirectid, VT_Int, 1, false); err != nil {
3775- return err
3776- }
37773666 return c.posSetSub(is, sc)
37783667 })
37793668 return *ret, err
@@ -3836,10 +3725,6 @@ func (c *Compiler) palFXSub(is IniSection,
38363725 func (c *Compiler) palFX(is IniSection, sc *StateControllerBase,
38373726 _ int8) (StateController, error) {
38383727 ret, err := (*palFX)(sc), c.stateSec(is, func() error {
3839- if err := c.paramValue(is, sc, "redirectid",
3840- palFX_redirectid, VT_Int, 1, false); err != nil {
3841- return err
3842- }
38433728 return c.palFXSub(is, sc, "")
38443729 })
38453730 return *ret, err
@@ -3860,10 +3745,6 @@ func (c *Compiler) bgPalFX(is IniSection, sc *StateControllerBase,
38603745 }
38613746 func (c *Compiler) afterImageSub(is IniSection,
38623747 sc *StateControllerBase, prefix string) error {
3863- if err := c.paramValue(is, sc, "redirectid",
3864- afterImage_redirectid, VT_Int, 1, false); err != nil {
3865- return err
3866- }
38673748 if err := c.paramTrans(is, sc, prefix,
38683749 afterImage_trans, true); err != nil {
38693750 return err
@@ -3924,10 +3805,6 @@ func (c *Compiler) afterImage(is IniSection, sc *StateControllerBase,
39243805 func (c *Compiler) afterImageTime(is IniSection, sc *StateControllerBase,
39253806 _ int8) (StateController, error) {
39263807 ret, err := (*afterImageTime)(sc), c.stateSec(is, func() error {
3927- if err := c.paramValue(is, sc, "redirectid",
3928- afterImageTime_redirectid, VT_Int, 1, false); err != nil {
3929- return err
3930- }
39313808 b := false
39323809 if err := c.stateParam(is, "time", func(data string) error {
39333810 b = true
@@ -4088,10 +3965,6 @@ func (c *Compiler) hitDefSub(is IniSection,
40883965 }); err != nil {
40893966 return err
40903967 }
4091- if err := c.paramValue(is, sc, "teamside",
4092- hitDef_teamside, VT_Int, 1, false); err != nil {
4093- return err
4094- }
40953968 if err := c.paramValue(is, sc, "id",
40963969 hitDef_id, VT_Int, 1, false); err != nil {
40973970 return err
@@ -4459,10 +4332,6 @@ func (c *Compiler) hitDefSub(is IniSection,
44594332 func (c *Compiler) hitDef(is IniSection, sc *StateControllerBase,
44604333 _ int8) (StateController, error) {
44614334 ret, err := (*hitDef)(sc), c.stateSec(is, func() error {
4462- if err := c.paramValue(is, sc, "redirectid",
4463- hitDef_redirectid, VT_Int, 1, false); err != nil {
4464- return err
4465- }
44664335 return c.hitDefSub(is, sc)
44674336 })
44684337 return *ret, err
@@ -4472,10 +4341,6 @@ func (c *Compiler) reversalDef(is IniSection, sc *StateControllerBase,
44724341 ret, err := (*reversalDef)(sc), c.stateSec(is, func() error {
44734342 attr := int32(-1)
44744343 var err error
4475- if err := c.paramValue(is, sc, "redirectid",
4476- reversalDef_redirectid, VT_Int, 1, false); err != nil {
4477- return err
4478- }
44794344 if err = c.stateParam(is, "reversal.attr", func(data string) error {
44804345 attr, err = c.attr(data, false)
44814346 return err
@@ -4493,10 +4358,6 @@ func (c *Compiler) reversalDef(is IniSection, sc *StateControllerBase,
44934358 func (c *Compiler) projectile(is IniSection, sc *StateControllerBase,
44944359 _ int8) (StateController, error) {
44954360 ret, err := (*projectile)(sc), c.stateSec(is, func() error {
4496- if err := c.paramValue(is, sc, "redirectid",
4497- projectile_redirectid, VT_Int, 1, false); err != nil {
4498- return err
4499- }
45004361 if err := c.paramPostye(is, sc, projectile_postype); err != nil {
45014362 return err
45024363 }
@@ -4616,10 +4477,6 @@ func (c *Compiler) projectile(is IniSection, sc *StateControllerBase,
46164477 func (c *Compiler) width(is IniSection, sc *StateControllerBase,
46174478 _ int8) (StateController, error) {
46184479 ret, err := (*width)(sc), c.stateSec(is, func() error {
4619- if err := c.paramValue(is, sc, "redirectid",
4620- width_redirectid, VT_Int, 1, false); err != nil {
4621- return err
4622- }
46234480 b := false
46244481 if err := c.stateParam(is, "edge", func(data string) error {
46254482 b = true
@@ -4652,10 +4509,6 @@ func (c *Compiler) width(is IniSection, sc *StateControllerBase,
46524509 func (c *Compiler) sprPriority(is IniSection, sc *StateControllerBase,
46534510 _ int8) (StateController, error) {
46544511 ret, err := (*sprPriority)(sc), c.stateSec(is, func() error {
4655- if err := c.paramValue(is, sc, "redirectid",
4656- sprPriority_redirectid, VT_Int, 1, false); err != nil {
4657- return err
4658- }
46594512 return c.paramValue(is, sc, "value",
46604513 sprPriority_value, VT_Int, 1, false)
46614514 })
@@ -4911,10 +4764,6 @@ func (c *Compiler) varSetSub(is IniSection,
49114764 func (c *Compiler) varSet(is IniSection, sc *StateControllerBase,
49124765 _ int8) (StateController, error) {
49134766 ret, err := (*varSet)(sc), c.stateSec(is, func() error {
4914- if err := c.paramValue(is, sc, "redirectid",
4915- varSet_redirectid, VT_Int, 1, false); err != nil {
4916- return err
4917- }
49184767 return c.varSetSub(is, sc, OC_rdreset, OC_st_var)
49194768 })
49204769 return *ret, err
@@ -4922,10 +4771,6 @@ func (c *Compiler) varSet(is IniSection, sc *StateControllerBase,
49224771 func (c *Compiler) varAdd(is IniSection, sc *StateControllerBase,
49234772 _ int8) (StateController, error) {
49244773 ret, err := (*varSet)(sc), c.stateSec(is, func() error {
4925- if err := c.paramValue(is, sc, "redirectid",
4926- varSet_redirectid, VT_Int, 1, false); err != nil {
4927- return err
4928- }
49294774 return c.varSetSub(is, sc, OC_rdreset, OC_st_varadd)
49304775 })
49314776 return *ret, err
@@ -4933,10 +4778,6 @@ func (c *Compiler) varAdd(is IniSection, sc *StateControllerBase,
49334778 func (c *Compiler) parentVarSet(is IniSection, sc *StateControllerBase,
49344779 _ int8) (StateController, error) {
49354780 ret, err := (*varSet)(sc), c.stateSec(is, func() error {
4936- if err := c.paramValue(is, sc, "redirectid",
4937- varSet_redirectid, VT_Int, 1, false); err != nil {
4938- return err
4939- }
49404781 return c.varSetSub(is, sc, OC_parent, OC_st_var)
49414782 })
49424783 return *ret, err
@@ -4944,10 +4785,6 @@ func (c *Compiler) parentVarSet(is IniSection, sc *StateControllerBase,
49444785 func (c *Compiler) parentVarAdd(is IniSection, sc *StateControllerBase,
49454786 _ int8) (StateController, error) {
49464787 ret, err := (*varSet)(sc), c.stateSec(is, func() error {
4947- if err := c.paramValue(is, sc, "redirectid",
4948- varSet_redirectid, VT_Int, 1, false); err != nil {
4949- return err
4950- }
49514788 return c.varSetSub(is, sc, OC_parent, OC_st_varadd)
49524789 })
49534790 return *ret, err
@@ -4955,10 +4792,6 @@ func (c *Compiler) parentVarAdd(is IniSection, sc *StateControllerBase,
49554792 func (c *Compiler) turn(is IniSection, sc *StateControllerBase,
49564793 _ int8) (StateController, error) {
49574794 ret, err := (*turn)(sc), c.stateSec(is, func() error {
4958- if err := c.paramValue(is, sc, "redirectid",
4959- turn_redirectid, VT_Int, 1, false); err != nil {
4960- return err
4961- }
49624795 sc.add(turn_, nil)
49634796 return nil
49644797 })
@@ -4967,10 +4800,6 @@ func (c *Compiler) turn(is IniSection, sc *StateControllerBase,
49674800 func (c *Compiler) targetFacing(is IniSection, sc *StateControllerBase,
49684801 _ int8) (StateController, error) {
49694802 ret, err := (*targetFacing)(sc), c.stateSec(is, func() error {
4970- if err := c.paramValue(is, sc, "redirectid",
4971- targetFacing_redirectid, VT_Int, 1, false); err != nil {
4972- return err
4973- }
49744803 if err := c.paramValue(is, sc, "id",
49754804 targetFacing_id, VT_Int, 1, false); err != nil {
49764805 return err
@@ -4986,10 +4815,6 @@ func (c *Compiler) targetFacing(is IniSection, sc *StateControllerBase,
49864815 func (c *Compiler) targetBind(is IniSection, sc *StateControllerBase,
49874816 _ int8) (StateController, error) {
49884817 ret, err := (*targetBind)(sc), c.stateSec(is, func() error {
4989- if err := c.paramValue(is, sc, "redirectid",
4990- targetBind_redirectid, VT_Int, 1, false); err != nil {
4991- return err
4992- }
49934818 if err := c.paramValue(is, sc, "id",
49944819 targetBind_id, VT_Int, 1, false); err != nil {
49954820 return err
@@ -5009,10 +4834,6 @@ func (c *Compiler) targetBind(is IniSection, sc *StateControllerBase,
50094834 func (c *Compiler) bindToTarget(is IniSection, sc *StateControllerBase,
50104835 _ int8) (StateController, error) {
50114836 ret, err := (*bindToTarget)(sc), c.stateSec(is, func() error {
5012- if err := c.paramValue(is, sc, "redirectid",
5013- bindToTarget_redirectid, VT_Int, 1, false); err != nil {
5014- return err
5015- }
50164837 if err := c.paramValue(is, sc, "id",
50174838 bindToTarget_id, VT_Int, 1, false); err != nil {
50184839 return err
@@ -5062,10 +4883,6 @@ func (c *Compiler) bindToTarget(is IniSection, sc *StateControllerBase,
50624883 func (c *Compiler) targetLifeAdd(is IniSection, sc *StateControllerBase,
50634884 _ int8) (StateController, error) {
50644885 ret, err := (*targetLifeAdd)(sc), c.stateSec(is, func() error {
5065- if err := c.paramValue(is, sc, "redirectid",
5066- targetLifeAdd_redirectid, VT_Int, 1, false); err != nil {
5067- return err
5068- }
50694886 if err := c.paramValue(is, sc, "id",
50704887 targetLifeAdd_id, VT_Int, 1, false); err != nil {
50714888 return err
@@ -5089,10 +4906,6 @@ func (c *Compiler) targetLifeAdd(is IniSection, sc *StateControllerBase,
50894906 func (c *Compiler) targetState(is IniSection, sc *StateControllerBase,
50904907 _ int8) (StateController, error) {
50914908 ret, err := (*targetState)(sc), c.stateSec(is, func() error {
5092- if err := c.paramValue(is, sc, "redirectid",
5093- targetState_redirectid, VT_Int, 1, false); err != nil {
5094- return err
5095- }
50964909 if err := c.paramValue(is, sc, "id",
50974910 targetState_id, VT_Int, 1, false); err != nil {
50984911 return err
@@ -5108,10 +4921,6 @@ func (c *Compiler) targetState(is IniSection, sc *StateControllerBase,
51084921 func (c *Compiler) targetVelSet(is IniSection, sc *StateControllerBase,
51094922 _ int8) (StateController, error) {
51104923 ret, err := (*targetVelSet)(sc), c.stateSec(is, func() error {
5111- if err := c.paramValue(is, sc, "redirectid",
5112- targetVelSet_redirectid, VT_Int, 1, false); err != nil {
5113- return err
5114- }
51154924 if err := c.paramValue(is, sc, "id",
51164925 targetVelSet_id, VT_Int, 1, false); err != nil {
51174926 return err
@@ -5131,10 +4940,6 @@ func (c *Compiler) targetVelSet(is IniSection, sc *StateControllerBase,
51314940 func (c *Compiler) targetVelAdd(is IniSection, sc *StateControllerBase,
51324941 _ int8) (StateController, error) {
51334942 ret, err := (*targetVelAdd)(sc), c.stateSec(is, func() error {
5134- if err := c.paramValue(is, sc, "redirectid",
5135- targetVelAdd_redirectid, VT_Int, 1, false); err != nil {
5136- return err
5137- }
51384943 if err := c.paramValue(is, sc, "id",
51394944 targetVelAdd_id, VT_Int, 1, false); err != nil {
51404945 return err
@@ -5154,10 +4959,6 @@ func (c *Compiler) targetVelAdd(is IniSection, sc *StateControllerBase,
51544959 func (c *Compiler) targetPowerAdd(is IniSection, sc *StateControllerBase,
51554960 _ int8) (StateController, error) {
51564961 ret, err := (*targetPowerAdd)(sc), c.stateSec(is, func() error {
5157- if err := c.paramValue(is, sc, "redirectid",
5158- targetPowerAdd_redirectid, VT_Int, 1, false); err != nil {
5159- return err
5160- }
51614962 if err := c.paramValue(is, sc, "id",
51624963 targetPowerAdd_id, VT_Int, 1, false); err != nil {
51634964 return err
@@ -5173,10 +4974,6 @@ func (c *Compiler) targetPowerAdd(is IniSection, sc *StateControllerBase,
51734974 func (c *Compiler) targetDrop(is IniSection, sc *StateControllerBase,
51744975 _ int8) (StateController, error) {
51754976 ret, err := (*targetDrop)(sc), c.stateSec(is, func() error {
5176- if err := c.paramValue(is, sc, "redirectid",
5177- targetDrop_redirectid, VT_Int, 1, false); err != nil {
5178- return err
5179- }
51804977 if err := c.paramValue(is, sc, "excludeid",
51814978 targetDrop_excludeid, VT_Int, 1, false); err != nil {
51824979 return err
@@ -5192,10 +4989,6 @@ func (c *Compiler) targetDrop(is IniSection, sc *StateControllerBase,
51924989 func (c *Compiler) lifeAdd(is IniSection, sc *StateControllerBase,
51934990 _ int8) (StateController, error) {
51944991 ret, err := (*lifeAdd)(sc), c.stateSec(is, func() error {
5195- if err := c.paramValue(is, sc, "redirectid",
5196- lifeAdd_redirectid, VT_Int, 1, false); err != nil {
5197- return err
5198- }
51994992 if err := c.paramValue(is, sc, "absolute",
52004993 lifeAdd_absolute, VT_Bool, 1, false); err != nil {
52014994 return err
@@ -5215,10 +5008,6 @@ func (c *Compiler) lifeAdd(is IniSection, sc *StateControllerBase,
52155008 func (c *Compiler) lifeSet(is IniSection, sc *StateControllerBase,
52165009 _ int8) (StateController, error) {
52175010 ret, err := (*lifeSet)(sc), c.stateSec(is, func() error {
5218- if err := c.paramValue(is, sc, "redirectid",
5219- lifeSet_redirectid, VT_Int, 1, false); err != nil {
5220- return err
5221- }
52225011 return c.paramValue(is, sc, "value", lifeSet_value, VT_Int, 1, true)
52235012 })
52245013 return *ret, err
@@ -5226,10 +5015,6 @@ func (c *Compiler) lifeSet(is IniSection, sc *StateControllerBase,
52265015 func (c *Compiler) powerAdd(is IniSection, sc *StateControllerBase,
52275016 _ int8) (StateController, error) {
52285017 ret, err := (*powerAdd)(sc), c.stateSec(is, func() error {
5229- if err := c.paramValue(is, sc, "redirectid",
5230- powerAdd_redirectid, VT_Int, 1, false); err != nil {
5231- return err
5232- }
52335018 return c.paramValue(is, sc, "value", powerAdd_value, VT_Int, 1, true)
52345019 })
52355020 return *ret, err
@@ -5237,10 +5022,6 @@ func (c *Compiler) powerAdd(is IniSection, sc *StateControllerBase,
52375022 func (c *Compiler) powerSet(is IniSection, sc *StateControllerBase,
52385023 _ int8) (StateController, error) {
52395024 ret, err := (*powerSet)(sc), c.stateSec(is, func() error {
5240- if err := c.paramValue(is, sc, "redirectid",
5241- powerSet_redirectid, VT_Int, 1, false); err != nil {
5242- return err
5243- }
52445025 return c.paramValue(is, sc, "value", powerSet_value, VT_Int, 1, true)
52455026 })
52465027 return *ret, err
@@ -5248,10 +5029,6 @@ func (c *Compiler) powerSet(is IniSection, sc *StateControllerBase,
52485029 func (c *Compiler) hitVelSet(is IniSection, sc *StateControllerBase,
52495030 _ int8) (StateController, error) {
52505031 ret, err := (*hitVelSet)(sc), c.stateSec(is, func() error {
5251- if err := c.paramValue(is, sc, "redirectid",
5252- hitVelSet_redirectid, VT_Int, 1, false); err != nil {
5253- return err
5254- }
52555032 if err := c.paramValue(is, sc, "x",
52565033 hitVelSet_x, VT_Bool, 1, false); err != nil {
52575034 return err
@@ -5267,10 +5044,6 @@ func (c *Compiler) hitVelSet(is IniSection, sc *StateControllerBase,
52675044 func (c *Compiler) screenBound(is IniSection, sc *StateControllerBase,
52685045 _ int8) (StateController, error) {
52695046 ret, err := (*screenBound)(sc), c.stateSec(is, func() error {
5270- if err := c.paramValue(is, sc, "redirectid",
5271- screenBound_redirectid, VT_Int, 1, false); err != nil {
5272- return err
5273- }
52745047 b := false
52755048 if err := c.stateParam(is, "value", func(data string) error {
52765049 b = true
@@ -5298,10 +5071,6 @@ func (c *Compiler) screenBound(is IniSection, sc *StateControllerBase,
52985071 func (c *Compiler) posFreeze(is IniSection, sc *StateControllerBase,
52995072 _ int8) (StateController, error) {
53005073 ret, err := (*posFreeze)(sc), c.stateSec(is, func() error {
5301- if err := c.paramValue(is, sc, "redirectid",
5302- posFreeze_redirectid, VT_Int, 1, false); err != nil {
5303- return err
5304- }
53055074 b := false
53065075 if err := c.stateParam(is, "value", func(data string) error {
53075076 b = true
@@ -5342,10 +5111,6 @@ func (c *Compiler) envShake(is IniSection, sc *StateControllerBase,
53425111 func (c *Compiler) hitOverride(is IniSection, sc *StateControllerBase,
53435112 _ int8) (StateController, error) {
53445113 ret, err := (*hitOverride)(sc), c.stateSec(is, func() error {
5345- if err := c.paramValue(is, sc, "redirectid",
5346- hitOverride_redirectid, VT_Int, 1, false); err != nil {
5347- return err
5348- }
53495114 if err := c.stateParam(is, "attr", func(data string) error {
53505115 attr, err := c.attr(data, false)
53515116 if err != nil {
@@ -5379,10 +5144,6 @@ func (c *Compiler) hitOverride(is IniSection, sc *StateControllerBase,
53795144 func (c *Compiler) pause(is IniSection, sc *StateControllerBase,
53805145 _ int8) (StateController, error) {
53815146 ret, err := (*pause)(sc), c.stateSec(is, func() error {
5382- if err := c.paramValue(is, sc, "redirectid",
5383- pause_redirectid, VT_Int, 1, false); err != nil {
5384- return err
5385- }
53865147 if err := c.paramValue(is, sc, "time",
53875148 pause_time, VT_Int, 1, false); err != nil {
53885149 return err
@@ -5406,10 +5167,6 @@ func (c *Compiler) pause(is IniSection, sc *StateControllerBase,
54065167 func (c *Compiler) superPause(is IniSection, sc *StateControllerBase,
54075168 _ int8) (StateController, error) {
54085169 ret, err := (*superPause)(sc), c.stateSec(is, func() error {
5409- if err := c.paramValue(is, sc, "redirectid",
5410- superPause_redirectid, VT_Int, 1, false); err != nil {
5411- return err
5412- }
54135170 if err := c.paramValue(is, sc, "time",
54145171 superPause_time, VT_Int, 1, false); err != nil {
54155172 return err
@@ -5485,10 +5242,6 @@ func (c *Compiler) superPause(is IniSection, sc *StateControllerBase,
54855242 func (c *Compiler) trans(is IniSection, sc *StateControllerBase,
54865243 _ int8) (StateController, error) {
54875244 ret, err := (*trans)(sc), c.stateSec(is, func() error {
5488- if err := c.paramValue(is, sc, "redirectid",
5489- trans_redirectid, VT_Int, 1, false); err != nil {
5490- return err
5491- }
54925245 return c.paramTrans(is, sc, "", trans_trans, false)
54935246 })
54945247 return *ret, err
@@ -5496,10 +5249,6 @@ func (c *Compiler) trans(is IniSection, sc *StateControllerBase,
54965249 func (c *Compiler) playerPush(is IniSection, sc *StateControllerBase,
54975250 _ int8) (StateController, error) {
54985251 ret, err := (*playerPush)(sc), c.stateSec(is, func() error {
5499- if err := c.paramValue(is, sc, "redirectid",
5500- playerPush_redirectid, VT_Int, 1, false); err != nil {
5501- return err
5502- }
55035252 b := false
55045253 if err := c.stateParam(is, "value", func(data string) error {
55055254 b = true
@@ -5517,10 +5266,6 @@ func (c *Compiler) playerPush(is IniSection, sc *StateControllerBase,
55175266 func (c *Compiler) stateTypeSet(is IniSection, sc *StateControllerBase,
55185267 _ int8) (StateController, error) {
55195268 ret, err := (*stateTypeSet)(sc), c.stateSec(is, func() error {
5520- if err := c.paramValue(is, sc, "redirectid",
5521- stateTypeSet_redirectid, VT_Int, 1, false); err != nil {
5522- return err
5523- }
55245269 statetype := func(data string) error {
55255270 if len(data) == 0 {
55265271 return Error("値が指定されていません")
@@ -5604,10 +5349,6 @@ func (c *Compiler) stateTypeSet(is IniSection, sc *StateControllerBase,
56045349 func (c *Compiler) angleDraw(is IniSection, sc *StateControllerBase,
56055350 _ int8) (StateController, error) {
56065351 ret, err := (*angleDraw)(sc), c.stateSec(is, func() error {
5607- if err := c.paramValue(is, sc, "redirectid",
5608- angleDraw_redirectid, VT_Int, 1, false); err != nil {
5609- return err
5610- }
56115352 if err := c.paramValue(is, sc, "value",
56125353 angleDraw_value, VT_Float, 1, false); err != nil {
56135354 return err
@@ -5623,10 +5364,6 @@ func (c *Compiler) angleDraw(is IniSection, sc *StateControllerBase,
56235364 func (c *Compiler) angleSet(is IniSection, sc *StateControllerBase,
56245365 _ int8) (StateController, error) {
56255366 ret, err := (*angleSet)(sc), c.stateSec(is, func() error {
5626- if err := c.paramValue(is, sc, "redirectid",
5627- angleSet_redirectid, VT_Int, 1, false); err != nil {
5628- return err
5629- }
56305367 if err := c.paramValue(is, sc, "value",
56315368 angleSet_value, VT_Float, 1, false); err != nil {
56325369 return err
@@ -5638,10 +5375,6 @@ func (c *Compiler) angleSet(is IniSection, sc *StateControllerBase,
56385375 func (c *Compiler) angleAdd(is IniSection, sc *StateControllerBase,
56395376 _ int8) (StateController, error) {
56405377 ret, err := (*angleAdd)(sc), c.stateSec(is, func() error {
5641- if err := c.paramValue(is, sc, "redirectid",
5642- angleAdd_redirectid, VT_Int, 1, false); err != nil {
5643- return err
5644- }
56455378 if err := c.paramValue(is, sc, "value",
56465379 angleAdd_value, VT_Float, 1, false); err != nil {
56475380 return err
@@ -5653,10 +5386,6 @@ func (c *Compiler) angleAdd(is IniSection, sc *StateControllerBase,
56535386 func (c *Compiler) angleMul(is IniSection, sc *StateControllerBase,
56545387 _ int8) (StateController, error) {
56555388 ret, err := (*angleMul)(sc), c.stateSec(is, func() error {
5656- if err := c.paramValue(is, sc, "redirectid",
5657- angleMul_redirectid, VT_Int, 1, false); err != nil {
5658- return err
5659- }
56605389 if err := c.paramValue(is, sc, "value",
56615390 angleMul_value, VT_Float, 1, false); err != nil {
56625391 return err
@@ -5757,10 +5486,6 @@ func (c *Compiler) clearClipboard(is IniSection, sc *StateControllerBase,
57575486 func (c *Compiler) makeDust(is IniSection, sc *StateControllerBase,
57585487 _ int8) (StateController, error) {
57595488 ret, err := (*makeDust)(sc), c.stateSec(is, func() error {
5760- if err := c.paramValue(is, sc, "redirectid",
5761- makeDust_redirectid, VT_Int, 1, false); err != nil {
5762- return err
5763- }
57645489 b := false
57655490 if err := c.stateParam(is, "spacing", func(data string) error {
57665491 b = true
@@ -5792,10 +5517,6 @@ func (c *Compiler) makeDust(is IniSection, sc *StateControllerBase,
57925517 func (c *Compiler) attackDist(is IniSection, sc *StateControllerBase,
57935518 _ int8) (StateController, error) {
57945519 ret, err := (*attackDist)(sc), c.stateSec(is, func() error {
5795- if err := c.paramValue(is, sc, "redirectid",
5796- attackDist_redirectid, VT_Int, 1, false); err != nil {
5797- return err
5798- }
57995520 if err := c.paramValue(is, sc, "value",
58005521 attackDist_value, VT_Float, 1, true); err != nil {
58015522 return err
@@ -5807,10 +5528,6 @@ func (c *Compiler) attackDist(is IniSection, sc *StateControllerBase,
58075528 func (c *Compiler) attackMulSet(is IniSection, sc *StateControllerBase,
58085529 _ int8) (StateController, error) {
58095530 ret, err := (*attackMulSet)(sc), c.stateSec(is, func() error {
5810- if err := c.paramValue(is, sc, "redirectid",
5811- attackMulSet_redirectid, VT_Int, 1, false); err != nil {
5812- return err
5813- }
58145531 if err := c.paramValue(is, sc, "value",
58155532 attackMulSet_value, VT_Float, 1, true); err != nil {
58165533 return err
@@ -5822,10 +5539,6 @@ func (c *Compiler) attackMulSet(is IniSection, sc *StateControllerBase,
58225539 func (c *Compiler) defenceMulSet(is IniSection, sc *StateControllerBase,
58235540 _ int8) (StateController, error) {
58245541 ret, err := (*defenceMulSet)(sc), c.stateSec(is, func() error {
5825- if err := c.paramValue(is, sc, "redirectid",
5826- defenceMulSet_redirectid, VT_Int, 1, false); err != nil {
5827- return err
5828- }
58295542 if err := c.paramValue(is, sc, "value",
58305543 defenceMulSet_value, VT_Float, 1, true); err != nil {
58315544 return err
@@ -5837,10 +5550,6 @@ func (c *Compiler) defenceMulSet(is IniSection, sc *StateControllerBase,
58375550 func (c *Compiler) fallEnvShake(is IniSection, sc *StateControllerBase,
58385551 _ int8) (StateController, error) {
58395552 ret, err := (*fallEnvShake)(sc), c.stateSec(is, func() error {
5840- if err := c.paramValue(is, sc, "redirectid",
5841- fallEnvShake_redirectid, VT_Int, 1, false); err != nil {
5842- return err
5843- }
58445553 sc.add(fallEnvShake_, nil)
58455554 return nil
58465555 })
@@ -5849,10 +5558,6 @@ func (c *Compiler) fallEnvShake(is IniSection, sc *StateControllerBase,
58495558 func (c *Compiler) hitFallDamage(is IniSection, sc *StateControllerBase,
58505559 _ int8) (StateController, error) {
58515560 ret, err := (*hitFallDamage)(sc), c.stateSec(is, func() error {
5852- if err := c.paramValue(is, sc, "redirectid",
5853- hitFallDamage_redirectid, VT_Int, 1, false); err != nil {
5854- return err
5855- }
58565561 sc.add(hitFallDamage_, nil)
58575562 return nil
58585563 })
@@ -5861,10 +5566,6 @@ func (c *Compiler) hitFallDamage(is IniSection, sc *StateControllerBase,
58615566 func (c *Compiler) hitFallVel(is IniSection, sc *StateControllerBase,
58625567 _ int8) (StateController, error) {
58635568 ret, err := (*hitFallVel)(sc), c.stateSec(is, func() error {
5864- if err := c.paramValue(is, sc, "redirectid",
5865- hitFallVel_redirectid, VT_Int, 1, false); err != nil {
5866- return err
5867- }
58685569 sc.add(hitFallVel_, nil)
58695570 return nil
58705571 })
@@ -5873,10 +5574,6 @@ func (c *Compiler) hitFallVel(is IniSection, sc *StateControllerBase,
58735574 func (c *Compiler) hitFallSet(is IniSection, sc *StateControllerBase,
58745575 _ int8) (StateController, error) {
58755576 ret, err := (*hitFallSet)(sc), c.stateSec(is, func() error {
5876- if err := c.paramValue(is, sc, "redirectid",
5877- hitFallSet_redirectid, VT_Int, 1, false); err != nil {
5878- return err
5879- }
58805577 b := false
58815578 if err := c.stateParam(is, "value", func(data string) error {
58825579 b = true
@@ -5902,10 +5599,6 @@ func (c *Compiler) hitFallSet(is IniSection, sc *StateControllerBase,
59025599 func (c *Compiler) varRangeSet(is IniSection, sc *StateControllerBase,
59035600 _ int8) (StateController, error) {
59045601 ret, err := (*varRangeSet)(sc), c.stateSec(is, func() error {
5905- if err := c.paramValue(is, sc, "redirectid",
5906- varRangeSet_redirectid, VT_Int, 1, false); err != nil {
5907- return err
5908- }
59095602 if err := c.paramValue(is, sc, "first",
59105603 varRangeSet_first, VT_Int, 1, false); err != nil {
59115604 return err
@@ -5948,10 +5641,6 @@ func (c *Compiler) varRangeSet(is IniSection, sc *StateControllerBase,
59485641 func (c *Compiler) remapPal(is IniSection, sc *StateControllerBase,
59495642 _ int8) (StateController, error) {
59505643 ret, err := (*remapPal)(sc), c.stateSec(is, func() error {
5951- if err := c.paramValue(is, sc, "redirectid",
5952- remapPal_redirectid, VT_Int, 1, false); err != nil {
5953- return err
5954- }
59555644 if err := c.paramValue(is, sc, "source",
59565645 remapPal_source, VT_Int, 2, false); err != nil {
59575646 return err
@@ -5967,10 +5656,6 @@ func (c *Compiler) remapPal(is IniSection, sc *StateControllerBase,
59675656 func (c *Compiler) stopSnd(is IniSection, sc *StateControllerBase,
59685657 _ int8) (StateController, error) {
59695658 ret, err := (*stopSnd)(sc), c.stateSec(is, func() error {
5970- if err := c.paramValue(is, sc, "redirectid",
5971- stopSnd_redirectid, VT_Int, 1, false); err != nil {
5972- return err
5973- }
59745659 if err := c.paramValue(is, sc, "channel",
59755660 stopSnd_channel, VT_Int, 1, true); err != nil {
59765661 return err
@@ -5982,10 +5667,6 @@ func (c *Compiler) stopSnd(is IniSection, sc *StateControllerBase,
59825667 func (c *Compiler) sndPan(is IniSection, sc *StateControllerBase,
59835668 _ int8) (StateController, error) {
59845669 ret, err := (*sndPan)(sc), c.stateSec(is, func() error {
5985- if err := c.paramValue(is, sc, "redirectid",
5986- sndPan_redirectid, VT_Int, 1, false); err != nil {
5987- return err
5988- }
59895670 if err := c.paramValue(is, sc, "channel",
59905671 sndPan_channel, VT_Int, 1, true); err != nil {
59915672 return err
@@ -6005,10 +5686,6 @@ func (c *Compiler) sndPan(is IniSection, sc *StateControllerBase,
60055686 func (c *Compiler) varRandom(is IniSection, sc *StateControllerBase,
60065687 _ int8) (StateController, error) {
60075688 ret, err := (*varRandom)(sc), c.stateSec(is, func() error {
6008- if err := c.paramValue(is, sc, "redirectid",
6009- varRandom_redirectid, VT_Int, 1, false); err != nil {
6010- return err
6011- }
60125689 if err := c.paramValue(is, sc, "v",
60135690 varRandom_v, VT_Int, 1, true); err != nil {
60145691 return err
@@ -6024,10 +5701,6 @@ func (c *Compiler) varRandom(is IniSection, sc *StateControllerBase,
60245701 func (c *Compiler) gravity(is IniSection, sc *StateControllerBase,
60255702 _ int8) (StateController, error) {
60265703 ret, err := (*gravity)(sc), c.stateSec(is, func() error {
6027- if err := c.paramValue(is, sc, "redirectid",
6028- gravity_redirectid, VT_Int, 1, false); err != nil {
6029- return err
6030- }
60315704 sc.add(gravity_, nil)
60325705 return nil
60335706 })
@@ -6035,10 +5708,6 @@ func (c *Compiler) gravity(is IniSection, sc *StateControllerBase,
60355708 }
60365709 func (c *Compiler) bindToParentSub(is IniSection,
60375710 sc *StateControllerBase) error {
6038- if err := c.paramValue(is, sc, "redirectid",
6039- bindToParent_redirectid, VT_Int, 1, false); err != nil {
6040- return err
6041- }
60425711 if err := c.paramValue(is, sc, "time",
60435712 bindToParent_time, VT_Int, 1, false); err != nil {
60445713 return err
@@ -6070,10 +5739,6 @@ func (c *Compiler) bindToRoot(is IniSection, sc *StateControllerBase,
60705739 func (c *Compiler) removeExplod(is IniSection, sc *StateControllerBase,
60715740 _ int8) (StateController, error) {
60725741 ret, err := (*removeExplod)(sc), c.stateSec(is, func() error {
6073- if err := c.paramValue(is, sc, "redirectid",
6074- removeExplod_redirectid, VT_Int, 1, false); err != nil {
6075- return err
6076- }
60775742 b := false
60785743 if err := c.stateParam(is, "id", func(data string) error {
60795744 b = true
@@ -6091,10 +5756,6 @@ func (c *Compiler) removeExplod(is IniSection, sc *StateControllerBase,
60915756 func (c *Compiler) explodBindTime(is IniSection, sc *StateControllerBase,
60925757 _ int8) (StateController, error) {
60935758 ret, err := (*explodBindTime)(sc), c.stateSec(is, func() error {
6094- if err := c.paramValue(is, sc, "redirectid",
6095- explodBindTime_redirectid, VT_Int, 1, false); err != nil {
6096- return err
6097- }
60985759 if err := c.paramValue(is, sc, "id",
60995760 explodBindTime_id, VT_Int, 1, false); err != nil {
61005761 return err
@@ -6119,10 +5780,6 @@ func (c *Compiler) explodBindTime(is IniSection, sc *StateControllerBase,
61195780 func (c *Compiler) moveHitReset(is IniSection, sc *StateControllerBase,
61205781 _ int8) (StateController, error) {
61215782 ret, err := (*moveHitReset)(sc), c.stateSec(is, func() error {
6122- if err := c.paramValue(is, sc, "redirectid",
6123- moveHitReset_redirectid, VT_Int, 1, false); err != nil {
6124- return err
6125- }
61265783 sc.add(moveHitReset_, nil)
61275784 return nil
61285785 })
@@ -6131,10 +5788,6 @@ func (c *Compiler) moveHitReset(is IniSection, sc *StateControllerBase,
61315788 func (c *Compiler) hitAdd(is IniSection, sc *StateControllerBase,
61325789 _ int8) (StateController, error) {
61335790 ret, err := (*hitAdd)(sc), c.stateSec(is, func() error {
6134- if err := c.paramValue(is, sc, "redirectid",
6135- hitAdd_redirectid, VT_Int, 1, false); err != nil {
6136- return err
6137- }
61385791 if err := c.paramValue(is, sc, "value",
61395792 hitAdd_value, VT_Int, 1, true); err != nil {
61405793 return err
@@ -6146,10 +5799,6 @@ func (c *Compiler) hitAdd(is IniSection, sc *StateControllerBase,
61465799 func (c *Compiler) offset(is IniSection, sc *StateControllerBase,
61475800 _ int8) (StateController, error) {
61485801 ret, err := (*offset)(sc), c.stateSec(is, func() error {
6149- if err := c.paramValue(is, sc, "redirectid",
6150- offset_redirectid, VT_Int, 1, false); err != nil {
6151- return err
6152- }
61535802 if err := c.paramValue(is, sc, "x",
61545803 offset_x, VT_Float, 1, false); err != nil {
61555804 return err
@@ -6165,10 +5814,6 @@ func (c *Compiler) offset(is IniSection, sc *StateControllerBase,
61655814 func (c *Compiler) victoryQuote(is IniSection, sc *StateControllerBase,
61665815 _ int8) (StateController, error) {
61675816 ret, err := (*victoryQuote)(sc), c.stateSec(is, func() error {
6168- if err := c.paramValue(is, sc, "redirectid",
6169- victoryQuote_redirectid, VT_Int, 1, false); err != nil {
6170- return err
6171- }
61725817 if err := c.paramValue(is, sc, "value",
61735818 victoryQuote_value, VT_Int, 1, false); err != nil {
61745819 return err
@@ -6180,10 +5825,6 @@ func (c *Compiler) victoryQuote(is IniSection, sc *StateControllerBase,
61805825 func (c *Compiler) zoom(is IniSection, sc *StateControllerBase,
61815826 _ int8) (StateController, error) {
61825827 ret, err := (*zoom)(sc), c.stateSec(is, func() error {
6183- if err := c.paramValue(is, sc, "redirectid",
6184- zoom_redirectid, VT_Int, 1, false); err != nil {
6185- return err
6186- }
61875828 if err := c.paramValue(is, sc, "pos",
61885829 zoom_pos, VT_Float, 2, false); err != nil {
61895830 return err
@@ -7208,14 +6849,13 @@ func (c *Compiler) Compile(pn int, def string) (map[int32]StateBytecode,
72086849 if err != nil {
72096850 return err
72106851 }
7211- str = str + sys.commonCmd
72126852 lines, i = SplitAndTrim(str, "\n"), 0
72136853 return nil
72146854 }); err != nil {
72156855 return nil, err
72166856 }
72176857 if sys.chars[pn][0].cmd == nil {
7218- sys.chars[pn][0].cmd = make([]CommandList, MaxSimul*2+MaxAttachedChar)
6858+ sys.chars[pn][0].cmd = make([]CommandList, MaxSimul*2)
72196859 b := NewCommandBuffer()
72206860 for i := range sys.chars[pn][0].cmd {
72216861 sys.chars[pn][0].cmd[i] = *NewCommandList(b)
@@ -7246,10 +6886,6 @@ func (c *Compiler) Compile(pn int, def string) (map[int32]StateBytecode,
72466886 *k, *nk = CK_c, CK_nc
72476887 case "s":
72486888 *k, *nk = CK_s, CK_ns
7249- case "v":
7250- *k, *nk = CK_v, CK_nv
7251- case "w":
7252- *k, *nk = CK_w, CK_nw
72536889 }
72546890 }
72556891 rm("x", &ckr.x, &ckr.nx)
@@ -7259,8 +6895,6 @@ func (c *Compiler) Compile(pn int, def string) (map[int32]StateBytecode,
72596895 rm("b", &ckr.b, &ckr.nb)
72606896 rm("c", &ckr.c, &ckr.nc)
72616897 rm("s", &ckr.s, &ckr.ns)
7262- rm("v", &ckr.v, &ckr.nv)
7263- rm("w", &ckr.w, &ckr.nw)
72646898 }
72656899 case "defaults":
72666900 if defaults {
--- a/src/font.go
+++ b/src/font.go
@@ -2,12 +2,11 @@ package main
22
33 import (
44 "encoding/binary"
5+ "github.com/go-gl/gl/v2.1/gl"
56 "os"
67 "regexp"
78 "strings"
89 "unsafe"
9-
10- "github.com/go-gl/gl/v2.1/gl"
1110 )
1211
1312 type FntCharImage struct {
@@ -77,7 +76,7 @@ func loadFnt(filename string) (*Fnt, error) {
7776 if err := read(rgb[:]); err != nil {
7877 return nil, err
7978 }
80- spr.Pal[i] = uint32(255)<<24 | uint32(rgb[2])<<16 | uint32(rgb[1])<<8 | uint32(rgb[0])
79+ spr.Pal[i] = uint32(rgb[2])<<16 | uint32(rgb[1])<<8 | uint32(rgb[0])
8180 }
8281 px = spr.RlePcxDecode(px)
8382 fp.Seek(int64(txtDataOffset), 0)
@@ -134,12 +133,7 @@ func loadFnt(filename string) (*Fnt, error) {
134133 fci := &FntCharImage{ofs: ofs}
135134 f.images[c] = fci
136135 if len(cap[3]) > 0 {
137- w := Atoi(cap[3])
138- if w < 0 {
139- ofs = I32ToU16(int32(ofs) - w)
140- w = -w
141- }
142- fci.w = I32ToU16(w)
136+ fci.w = I32ToU16(Atoi(cap[3]))
143137 ofs += fci.w - f.Size[0]
144138 } else {
145139 fci.w = f.Size[0]
@@ -245,7 +239,8 @@ func (f *Fnt) getCharSpr(c rune, bank int32) *Sprite {
245239 }
246240 return &fci.img[bank]
247241 }
248-func (f *Fnt) drawChar(x, y, xscl, yscl float32, bank int32, c rune) float32 {
242+func (f *Fnt) drawChar(x, y, xscl, yscl float32, bank int32, c rune,
243+ paltex uint32) float32 {
249244 if c == ' ' {
250245 return float32(f.Size[0]) * xscl
251246 }
@@ -253,10 +248,10 @@ func (f *Fnt) drawChar(x, y, xscl, yscl float32, bank int32, c rune) float32 {
253248 if spr == nil || spr.Tex == nil {
254249 return 0
255250 }
256- RenderMugenPal(*spr.Tex, 0, spr.Size, -x*sys.widthScale,
251+ RenderMugenPal(*spr.Tex, paltex, 0, spr.Size, -x*sys.widthScale,
257252 -y*sys.heightScale, &notiling, xscl*sys.widthScale, xscl*sys.widthScale,
258- yscl*sys.heightScale, 1, 0, 0, 0, 0, sys.brightness*255>>8|1<<9, &sys.scrrect,
259- 0, 0, false, 1, &[3]float32{0, 0, 0}, &[3]float32{1, 1, 1})
253+ yscl*sys.heightScale, 1, 0, 0, sys.brightness*255>>8|1<<9, &sys.scrrect,
254+ 0, 0)
260255 return float32(spr.Size[0]) * xscl
261256 }
262257 func (f *Fnt) DrawText(txt string, x, y, xscl, yscl float32,
@@ -288,7 +283,8 @@ func (f *Fnt) DrawText(txt string, x, y, xscl, yscl float32,
288283 gl.TexParameteri(gl.TEXTURE_1D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
289284 gl.TexParameteri(gl.TEXTURE_1D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
290285 for _, c := range txt {
291- x += f.drawChar(x, y, xscl, yscl, bank, c) + xscl*float32(f.Spacing[0])
286+ x += f.drawChar(x, y, xscl, yscl, bank, c, paltex) +
287+ xscl*float32(f.Spacing[0])
292288 }
293289 gl.DeleteTextures(1, &paltex)
294290 gl.Disable(gl.TEXTURE_1D)
--- a/src/image.go
+++ b/src/image.go
@@ -3,6 +3,7 @@ package main
33 import (
44 "encoding/binary"
55 "fmt"
6+ "github.com/go-gl/gl/v2.1/gl"
67 "image"
78 "image/draw"
89 "image/png"
@@ -11,8 +12,6 @@ import (
1112 "os"
1213 "runtime"
1314 "unsafe"
14-
15- "github.com/go-gl/gl/v2.1/gl"
1615 )
1716
1817 type TransType int32
@@ -130,8 +129,7 @@ func (pf *PalFX) getFxPal(pal []uint32, neg bool) []uint32 {
130129 (((c>>8&0xff)+uint32(a[1]))*uint32(m[1])>>8)<<8
131130 tmp = (tmp|uint32(-Btoi(tmp&0xff0000 != 0)<<8))&0xffff |
132131 (((c>>16&0xff)+uint32(a[2]))*uint32(m[2])>>8)<<16
133- sys.workpal[i] = tmp | uint32(-Btoi(tmp&0xff000000 != 0)<<16) |
134- 0xff000000
132+ sys.workpal[i] = tmp | uint32(-Btoi(tmp&0xff000000 != 0)<<16)
135133 }
136134 return sys.workpal
137135 }
@@ -150,7 +148,7 @@ func (pf *PalFX) getFcPalFx(transNeg bool) (neg bool, color float32,
150148 return
151149 }
152150 neg = p.eInvertall
153- color = p.eColor
151+ color = p.color
154152 if !p.eNegType {
155153 transNeg = false
156154 }
@@ -352,42 +350,11 @@ type Sprite struct {
352350 Offset [2]int16
353351 palidx int
354352 rle int
355- paltemp []uint32
356- PalTex *Texture
357353 }
358354
359355 func newSprite() *Sprite {
360356 return &Sprite{palidx: -1}
361357 }
362-func selectablePalettes(filename string) ([]int32, error) {
363- var pal []int32
364- f, err := os.Open(filename)
365- if err != nil {
366- return pal, err
367- }
368- defer func() { chk(f.Close()) }()
369- h := &SffHeader{}
370- var lofs, tofs uint32
371- if err := h.Read(f, &lofs, &tofs); err != nil {
372- return pal, err
373- }
374- read := func(x interface{}) error {
375- return binary.Read(f, binary.LittleEndian, x)
376- }
377- if h.Ver0 != 1 {
378- for i := 0; i < int(h.NumberOfPalettes); i++ {
379- f.Seek(int64(h.FirstPaletteHeaderOffset)+int64(i*16), 0)
380- var gn_ [3]int16
381- if err := read(gn_[:]); err != nil {
382- return pal, err
383- }
384- if gn_[0] == 1 && gn_[1] <= MaxPalNo {
385- pal = append(pal, int32(gn_[1]))
386- }
387- }
388- }
389- return pal, err
390-}
391358 func loadFromSff(filename string, g, n int16) (*Sprite, error) {
392359 s := newSprite()
393360 f, err := os.Open(filename)
@@ -475,7 +442,7 @@ func loadFromSff(filename string, g, n int16) (*Sprite, error) {
475442 s.palidx = -1
476443 return s, nil
477444 }
478- if s.rle > -11 {
445+ if s.rle != -12 {
479446 read := func(x interface{}) error {
480447 return binary.Read(f, binary.LittleEndian, x)
481448 }
@@ -503,7 +470,7 @@ func loadFromSff(filename string, g, n int16) (*Sprite, error) {
503470 if err := read(rgba[:]); err != nil {
504471 return nil, err
505472 }
506- s.Pal[i] = uint32(rgba[3])<<24 | uint32(rgba[2])<<16 | uint32(rgba[1])<<8 | uint32(rgba[0])
473+ s.Pal[i] = uint32(rgba[2])<<16 | uint32(rgba[1])<<8 | uint32(rgba[0])
507474 }
508475 s.palidx = -1
509476 }
@@ -516,7 +483,7 @@ func (s *Sprite) shareCopy(src *Sprite) {
516483 s.palidx = src.palidx
517484 }
518485 func (s *Sprite) GetPal(pl *PaletteList) []uint32 {
519- if s.Pal != nil || s.rle <= -11 {
486+ if s.Pal != nil || s.rle == -12 {
520487 return s.Pal
521488 }
522489 return pl.Get(int(s.palidx))
@@ -684,7 +651,7 @@ func (s *Sprite) read(f *os.File, sh *SffHeader, offset int64, datasize uint32,
684651 if err := read(rgb[:]); err != nil {
685652 return err
686653 }
687- pal[i] = uint32(255)<<24 | uint32(rgb[2])<<16 | uint32(rgb[1])<<8 | uint32(rgb[0])
654+ pal[i] = uint32(rgb[2])<<16 | uint32(rgb[1])<<8 | uint32(rgb[0])
688655 }
689656 }
690657 s.SetPxl(s.RlePcxDecode(px))
@@ -938,8 +905,8 @@ func (s *Sprite) readV2(f *os.File, offset int64, datasize uint32) error {
938905 unsafe.Pointer(&rgba.Pix[0]))
939906 gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
940907 gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
941- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
942- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
908+ gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP)
909+ gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP)
943910 gl.Disable(gl.TEXTURE_2D)
944911 }
945912 return nil
@@ -951,61 +918,21 @@ func (s *Sprite) readV2(f *os.File, offset int64, datasize uint32) error {
951918 return nil
952919 }
953920 func (s *Sprite) glDraw(pal []uint32, mask int32, x, y float32, tile *[4]int32,
954- xts, xbs, ys, rxadd, agl, yagl, xagl float32, trans int32, window *[4]int32,
921+ xts, xbs, ys, rxadd, agl float32, trans int32, window *[4]int32,
955922 rcx, rcy float32, pfx *PalFX) {
956923 if s.Tex == nil {
957924 return
958925 }
959- neg, color, padd, pmul := pfx.getFcPalFx(trans == -2)
960- if trans == -2 {
961- padd[0] *= -1
962- padd[1] *= -1
963- padd[2] *= -1
964- }
965-
966- if s.rle <= -11 {
967- RenderMugenFc(*s.Tex, s.Size, x, y, tile, xts, xbs, ys, 1, rxadd, agl, yagl, xagl,
926+ if s.rle == -12 {
927+ neg, color, padd, pmul := pfx.getFcPalFx(trans == -2)
928+ RenderMugenFc(*s.Tex, s.Size, x, y, tile, xts, xbs, ys, 1, rxadd, agl,
968929 trans, window, rcx, rcy, neg, color, &padd, &pmul)
969930 } else {
970- PalEqual := true
971- if len(pal) != len(s.paltemp) {
972- PalEqual = false
973- } else {
974- for i := range pal {
975- if pal[i] != s.paltemp[i] {
976- PalEqual = false
977- break
978- }
979- }
980- }
981- if PalEqual == true {
982- if s.PalTex == nil {
983- return
984- }
985- gl.ActiveTexture(gl.TEXTURE1)
986- gl.BindTexture(gl.TEXTURE_1D, uint32(*s.PalTex))
987- RenderMugenPal(*s.Tex, mask, s.Size, x, y, tile, xts, xbs, ys, 1,
988- rxadd, agl, yagl, xagl, trans, window, rcx, rcy, neg, color, &padd, &pmul)
989- gl.Disable(gl.TEXTURE_1D)
990- } else {
991- gl.Enable(gl.TEXTURE_1D)
992- gl.ActiveTexture(gl.TEXTURE1)
993- s.PalTex = newTexture()
994- gl.BindTexture(gl.TEXTURE_1D, uint32(*s.PalTex))
995- gl.PixelStorei(gl.UNPACK_ALIGNMENT, 1)
996- gl.TexImage1D(gl.TEXTURE_1D, 0, gl.RGBA, 256, 0, gl.RGBA, gl.UNSIGNED_BYTE,
997- unsafe.Pointer(&pal[0]))
998- gl.TexParameteri(gl.TEXTURE_1D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
999- gl.TexParameteri(gl.TEXTURE_1D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
1000- tmp := append([]uint32{}, pal...)
1001- s.paltemp = tmp
1002- RenderMugenPal(*s.Tex, mask, s.Size, x, y, tile, xts, xbs, ys, 1,
1003- rxadd, agl, yagl, xagl, trans, window, rcx, rcy, neg, color, &padd, &pmul)
1004- gl.Disable(gl.TEXTURE_1D)
1005- }
931+ RenderMugen(*s.Tex, pal, mask, s.Size, x, y, tile, xts, xbs, ys, 1,
932+ rxadd, agl, trans, window, rcx, rcy)
1006933 }
1007934 }
1008-func (s *Sprite) Draw(x, y, xscale, yscale float32, pal []uint32, fx *PalFX) {
935+func (s *Sprite) Draw(x, y, xscale, yscale float32, pal []uint32) {
1009936 x += float32(sys.gameWidth-320)/2 - xscale*float32(s.Offset[0])
1010937 y += float32(sys.gameHeight-240) - yscale*float32(s.Offset[1])
1011938 if xscale < 0 {
@@ -1015,8 +942,8 @@ func (s *Sprite) Draw(x, y, xscale, yscale float32, pal []uint32, fx *PalFX) {
1015942 y *= -1
1016943 }
1017944 s.glDraw(pal, 0, -x*sys.widthScale, -y*sys.heightScale, &notiling,
1018- xscale*sys.widthScale, xscale*sys.widthScale, yscale*sys.heightScale, 0, 0, 0, 0,
1019- sys.brightness*255>>8|1<<9, &sys.scrrect, 0, 0, fx)
945+ xscale*sys.widthScale, xscale*sys.widthScale, yscale*sys.heightScale, 0, 0,
946+ sys.brightness*255>>8|1<<9, &sys.scrrect, 0, 0, nil)
1020947 }
1021948
1022949 type Sff struct {
@@ -1078,10 +1005,7 @@ func loadSff(filename string, char bool) (*Sff, error) {
10781005 if err := read(rgba[:]); err != nil {
10791006 return nil, err
10801007 }
1081- if s.header.Ver2 == 0 {
1082- rgba[3] = 255
1083- }
1084- pal[i] = uint32(rgba[3])<<24 | uint32(rgba[2])<<16 | uint32(rgba[1])<<8 | uint32(rgba[0])
1008+ pal[i] = uint32(rgba[2])<<16 | uint32(rgba[1])<<8 | uint32(rgba[0])
10851009 }
10861010 idx = i
10871011 }
--- a/src/input.go
+++ b/src/input.go
@@ -2,12 +2,11 @@ package main
22
33 import (
44 "encoding/binary"
5+ "github.com/go-gl/glfw/v3.2/glfw"
56 "net"
67 "os"
78 "strings"
89 "time"
9-
10- "github.com/go-gl/glfw/v3.2/glfw"
1110 )
1211
1312 type CommandKey byte
@@ -52,8 +51,6 @@ const (
5251 CK_y
5352 CK_z
5453 CK_s
55- CK_v
56- CK_w
5754 CK_na
5855 CK_nb
5956 CK_nc
@@ -61,9 +58,7 @@ const (
6158 CK_ny
6259 CK_nz
6360 CK_ns
64- CK_nv
65- CK_nw
66- CK_Last = CK_nw
61+ CK_Last = CK_ns
6762 )
6863
6964 type NetState int
@@ -316,246 +311,6 @@ func StringToKey(s string) glfw.Key {
316311 return glfw.KeyUnknown
317312 }
318313
319-func KeyToString(k glfw.Key) string {
320- switch k {
321- case glfw.KeyEnter:
322- return "RETURN"
323- case glfw.KeyEscape:
324- return "ESCAPE"
325- case glfw.KeyBackspace:
326- return "BACKSPACE"
327- case glfw.KeyTab:
328- return "TAB"
329- case glfw.KeySpace:
330- return "SPACE"
331- case glfw.KeyApostrophe:
332- return "QUOTE"
333- case glfw.KeyComma:
334- return "COMMA"
335- case glfw.KeyMinus:
336- return "MINUS"
337- case glfw.KeyPeriod:
338- return "PERIOD"
339- case glfw.KeySlash:
340- return "SLASH"
341- case glfw.Key0:
342- return "0"
343- case glfw.Key1:
344- return "1"
345- case glfw.Key2:
346- return "2"
347- case glfw.Key3:
348- return "3"
349- case glfw.Key4:
350- return "4"
351- case glfw.Key5:
352- return "5"
353- case glfw.Key6:
354- return "6"
355- case glfw.Key7:
356- return "7"
357- case glfw.Key8:
358- return "8"
359- case glfw.Key9:
360- return "9"
361- case glfw.KeySemicolon:
362- return "SEMICOLON"
363- case glfw.KeyEqual:
364- return "EQUALS"
365- case glfw.KeyLeftBracket:
366- return "LEFTBRACKET"
367- case glfw.KeyBackslash:
368- return "BACKSLASH"
369- case glfw.KeyRightBracket:
370- return "RIGHTBRACKET"
371- case glfw.KeyGraveAccent:
372- return "BACKQUOTE"
373- case glfw.KeyA:
374- return "a"
375- case glfw.KeyB:
376- return "b"
377- case glfw.KeyC:
378- return "c"
379- case glfw.KeyD:
380- return "d"
381- case glfw.KeyE:
382- return "e"
383- case glfw.KeyF:
384- return "f"
385- case glfw.KeyG:
386- return "g"
387- case glfw.KeyH:
388- return "h"
389- case glfw.KeyI:
390- return "i"
391- case glfw.KeyJ:
392- return "j"
393- case glfw.KeyK:
394- return "k"
395- case glfw.KeyL:
396- return "l"
397- case glfw.KeyM:
398- return "m"
399- case glfw.KeyN:
400- return "n"
401- case glfw.KeyO:
402- return "o"
403- case glfw.KeyP:
404- return "p"
405- case glfw.KeyQ:
406- return "q"
407- case glfw.KeyR:
408- return "r"
409- case glfw.KeyS:
410- return "s"
411- case glfw.KeyT:
412- return "t"
413- case glfw.KeyU:
414- return "u"
415- case glfw.KeyV:
416- return "v"
417- case glfw.KeyW:
418- return "w"
419- case glfw.KeyX:
420- return "x"
421- case glfw.KeyY:
422- return "y"
423- case glfw.KeyZ:
424- return "z"
425- case glfw.KeyCapsLock:
426- return "CAPSLOCK"
427- case glfw.KeyF1:
428- return "F1"
429- case glfw.KeyF2:
430- return "F2"
431- case glfw.KeyF3:
432- return "F3"
433- case glfw.KeyF4:
434- return "F4"
435- case glfw.KeyF5:
436- return "F5"
437- case glfw.KeyF6:
438- return "F6"
439- case glfw.KeyF7:
440- return "F7"
441- case glfw.KeyF8:
442- return "F8"
443- case glfw.KeyF9:
444- return "F9"
445- case glfw.KeyF10:
446- return "F10"
447- case glfw.KeyF11:
448- return "F11"
449- case glfw.KeyF12:
450- return "F12"
451- case glfw.KeyPrintScreen:
452- return "PRINTSCREEN"
453- case glfw.KeyScrollLock:
454- return "SCROLLLOCK"
455- case glfw.KeyPause:
456- return "PAUSE"
457- case glfw.KeyInsert:
458- return "INSERT"
459- case glfw.KeyHome:
460- return "HOME"
461- case glfw.KeyPageUp:
462- return "PAGEUP"
463- case glfw.KeyDelete:
464- return "DELETE"
465- case glfw.KeyEnd:
466- return "END"
467- case glfw.KeyPageDown:
468- return "PAGEDOWN"
469- case glfw.KeyRight:
470- return "RIGHT"
471- case glfw.KeyLeft:
472- return "LEFT"
473- case glfw.KeyDown:
474- return "DOWN"
475- case glfw.KeyUp:
476- return "UP"
477- case glfw.KeyNumLock:
478- return "NUMLOCKCLEAR"
479- case glfw.KeyKPDivide:
480- return "KP_DIVIDE"
481- case glfw.KeyKPMultiply:
482- return "KP_MULTIPLY"
483- case glfw.KeyKPSubtract:
484- return "KP_MINUS"
485- case glfw.KeyKPAdd:
486- return "KP_PLUS"
487- case glfw.KeyKPEnter:
488- return "KP_ENTER"
489- case glfw.KeyKP1:
490- return "KP_1"
491- case glfw.KeyKP2:
492- return "KP_2"
493- case glfw.KeyKP3:
494- return "KP_3"
495- case glfw.KeyKP4:
496- return "KP_4"
497- case glfw.KeyKP5:
498- return "KP_5"
499- case glfw.KeyKP6:
500- return "KP_6"
501- case glfw.KeyKP7:
502- return "KP_7"
503- case glfw.KeyKP8:
504- return "KP_8"
505- case glfw.KeyKP9:
506- return "KP_9"
507- case glfw.KeyKP0:
508- return "KP_0"
509- case glfw.KeyKPDecimal:
510- return "KP_PERIOD"
511- case glfw.KeyKPEqual:
512- return "KP_EQUALS"
513- case glfw.KeyF13:
514- return "F13"
515- case glfw.KeyF14:
516- return "F14"
517- case glfw.KeyF15:
518- return "F15"
519- case glfw.KeyF16:
520- return "F16"
521- case glfw.KeyF17:
522- return "F17"
523- case glfw.KeyF18:
524- return "F18"
525- case glfw.KeyF19:
526- return "F19"
527- case glfw.KeyF20:
528- return "F20"
529- case glfw.KeyF21:
530- return "F21"
531- case glfw.KeyF22:
532- return "F22"
533- case glfw.KeyF23:
534- return "F23"
535- case glfw.KeyF24:
536- return "F24"
537- case glfw.KeyMenu:
538- return "MENU"
539- case glfw.KeyLeftControl:
540- return "LCTRL"
541- case glfw.KeyLeftShift:
542- return "LSHIFT"
543- case glfw.KeyLeftAlt:
544- return "LALT"
545- case glfw.KeyLeftSuper:
546- return "LGUI"
547- case glfw.KeyRightControl:
548- return "RCTRL"
549- case glfw.KeyRightShift:
550- return "RSHIFT"
551- case glfw.KeyRightAlt:
552- return "RALT"
553- case glfw.KeyRightSuper:
554- return "RGUI"
555- }
556- return ""
557-}
558-
559314 type ShortcutScript struct {
560315 Activate bool
561316 Script string
@@ -589,11 +344,8 @@ func keyCallback(_ *glfw.Window, key glfw.Key, _ int,
589344 switch action {
590345 case glfw.Release:
591346 sys.keySatate[key] = false
592- sys.keyInput = glfw.KeyUnknown
593- sys.keyString = ""
594347 case glfw.Press:
595348 sys.keySatate[key] = true
596- sys.keyInput = key
597349 sys.esc = sys.esc ||
598350 key == glfw.KeyEscape && mk&(glfw.ModControl|glfw.ModAlt) == 0
599351 for k, v := range sys.shortcutScripts {
@@ -601,9 +353,6 @@ func keyCallback(_ *glfw.Window, key glfw.Key, _ int,
601353 }
602354 }
603355 }
604-func charCallback(_ *glfw.Window, char rune, mk glfw.ModifierKey) {
605- sys.keyString = string(char)
606-}
607356
608357 var joystick = [...]glfw.Joystick{glfw.Joystick1, glfw.Joystick2,
609358 glfw.Joystick3, glfw.Joystick4, glfw.Joystick5, glfw.Joystick6,
@@ -618,30 +367,27 @@ func JoystickState(joy, button int) bool {
618367 if joy >= len(joystick) {
619368 return false
620369 }
621- btns := glfw.GetJoystickButtons(joystick[joy])
622370 if button < 0 {
623371 button = -button - 1
624372 axes := glfw.GetJoystickAxes(joystick[joy])
625373 if len(axes)*2 <= button {
626374 return false
627375 }
628- if (button == 8 || button == 10) && len(axes) == 6 && len(btns) == 14 { //XboxコントローラーのLRトリガー判定(glfwがバージョンアップすればもっとちゃんと判別できるようになるはず)
629- return axes[button/2] > 0
630- }
631376 switch button & 1 {
632377 case 0:
633- return axes[button/2] < -0.2
378+ return axes[button/2] < -0.1
634379 case 1:
635- return axes[button/2] > 0.2
380+ return axes[button/2] > 0.1
636381 }
637382 }
383+ btns := glfw.GetJoystickButtons(joystick[joy])
638384 if len(btns) <= button {
639385 return false
640386 }
641387 return btns[button] != 0
642388 }
643389
644-type KeyConfig struct{ Joy, u, d, l, r, a, b, c, x, y, z, s, v, w int }
390+type KeyConfig struct{ Joy, u, d, l, r, a, b, c, x, y, z, s int }
645391
646392 func (kc KeyConfig) U() bool { return JoystickState(kc.Joy, kc.u) }
647393 func (kc KeyConfig) D() bool { return JoystickState(kc.Joy, kc.d) }
@@ -654,8 +400,6 @@ func (kc KeyConfig) X() bool { return JoystickState(kc.Joy, kc.x) }
654400 func (kc KeyConfig) Y() bool { return JoystickState(kc.Joy, kc.y) }
655401 func (kc KeyConfig) Z() bool { return JoystickState(kc.Joy, kc.z) }
656402 func (kc KeyConfig) S() bool { return JoystickState(kc.Joy, kc.s) }
657-func (kc KeyConfig) V() bool { return JoystickState(kc.Joy, kc.v) }
658-func (kc KeyConfig) W() bool { return JoystickState(kc.Joy, kc.w) }
659403
660404 type InputBits int32
661405
@@ -671,9 +415,7 @@ const (
671415 IB_Y
672416 IB_Z
673417 IB_S
674- IB_V
675- IB_W
676- IB_anybutton = IB_A | IB_B | IB_C | IB_X | IB_Y | IB_Z | IB_V | IB_W
418+ IB_anybutton = IB_A | IB_B | IB_C | IB_X | IB_Y | IB_Z
677419 )
678420
679421 func (ib *InputBits) SetInput(in int) {
@@ -683,8 +425,7 @@ func (ib *InputBits) SetInput(in int) {
683425 Btoi(sys.keyConfig[in].R())<<3 | Btoi(sys.keyConfig[in].A())<<4 |
684426 Btoi(sys.keyConfig[in].B())<<5 | Btoi(sys.keyConfig[in].C())<<6 |
685427 Btoi(sys.keyConfig[in].X())<<7 | Btoi(sys.keyConfig[in].Y())<<8 |
686- Btoi(sys.keyConfig[in].Z())<<9 | Btoi(sys.keyConfig[in].S())<<10 |
687- Btoi(sys.keyConfig[in].V())<<11 | Btoi(sys.keyConfig[in].W())<<12)
428+ Btoi(sys.keyConfig[in].Z())<<9 | Btoi(sys.keyConfig[in].S())<<10)
688429 }
689430 }
690431 func (ib InputBits) GetInput(cb *CommandBuffer, facing int32) {
@@ -695,23 +436,23 @@ func (ib InputBits) GetInput(cb *CommandBuffer, facing int32) {
695436 b, f = ib&IB_L != 0, ib&IB_R != 0
696437 }
697438 cb.Input(b, ib&IB_D != 0, f, ib&IB_U != 0, ib&IB_A != 0, ib&IB_B != 0,
698- ib&IB_C != 0, ib&IB_X != 0, ib&IB_Y != 0, ib&IB_Z != 0, ib&IB_S != 0, ib&IB_V != 0, ib&IB_W != 0)
439+ ib&IB_C != 0, ib&IB_X != 0, ib&IB_Y != 0, ib&IB_Z != 0, ib&IB_S != 0)
699440 }
700441
701442 type CommandKeyRemap struct {
702- a, b, c, x, y, z, s, v, w, na, nb, nc, nx, ny, nz, ns, nv, nw CommandKey
443+ a, b, c, x, y, z, s, na, nb, nc, nx, ny, nz, ns CommandKey
703444 }
704445
705446 func NewCommandKeyRemap() *CommandKeyRemap {
706- return &CommandKeyRemap{CK_a, CK_b, CK_c, CK_x, CK_y, CK_z, CK_s, CK_v, CK_w,
707- CK_na, CK_nb, CK_nc, CK_nx, CK_ny, CK_nz, CK_ns, CK_nv, CK_nw}
447+ return &CommandKeyRemap{CK_a, CK_b, CK_c, CK_x, CK_y, CK_z, CK_s,
448+ CK_na, CK_nb, CK_nc, CK_nx, CK_ny, CK_nz, CK_ns}
708449 }
709450
710451 type CommandBuffer struct {
711- Bb, Db, Fb, Ub int32
712- ab, bb, cb, xb, yb, zb, sb, vb, wb int32
713- B, D, F, U int8
714- a, b, c, x, y, z, s, v, w int8
452+ Bb, Db, Fb, Ub int32
453+ ab, bb, cb, xb, yb, zb, sb int32
454+ B, D, F, U int8
455+ a, b, c, x, y, z, s int8
715456 }
716457
717458 func NewCommandBuffer() (c *CommandBuffer) {
@@ -721,9 +462,9 @@ func NewCommandBuffer() (c *CommandBuffer) {
721462 }
722463 func (__ *CommandBuffer) Reset() {
723464 *__ = CommandBuffer{B: -1, D: -1, F: -1, U: -1,
724- a: -1, b: -1, c: -1, x: -1, y: -1, z: -1, s: -1, v: -1, w: -1}
465+ a: -1, b: -1, c: -1, x: -1, y: -1, z: -1, s: -1}
725466 }
726-func (__ *CommandBuffer) Input(B, D, F, U, a, b, c, x, y, z, s, v, w bool) {
467+func (__ *CommandBuffer) Input(B, D, F, U, a, b, c, x, y, z, s bool) {
727468 if (B && !F) != (__.B > 0) {
728469 __.Bb = 0
729470 __.B *= -1
@@ -779,16 +520,6 @@ func (__ *CommandBuffer) Input(B, D, F, U, a, b, c, x, y, z, s, v, w bool) {
779520 __.s *= -1
780521 }
781522 __.sb += int32(__.s)
782- if v != (__.v > 0) {
783- __.vb = 0
784- __.v *= -1
785- }
786- __.vb += int32(__.v)
787- if w != (__.w > 0) {
788- __.wb = 0
789- __.w *= -1
790- }
791- __.wb += int32(__.w)
792523 }
793524 func (__ *CommandBuffer) InputBits(ib InputBits, f int32) {
794525 var B, F bool
@@ -798,7 +529,7 @@ func (__ *CommandBuffer) InputBits(ib InputBits, f int32) {
798529 B, F = ib&IB_L != 0, ib&IB_R != 0
799530 }
800531 __.Input(B, ib&IB_D != 0, F, ib&IB_U != 0, ib&IB_A != 0, ib&IB_B != 0,
801- ib&IB_C != 0, ib&IB_X != 0, ib&IB_Y != 0, ib&IB_Z != 0, ib&IB_S != 0, ib&IB_V != 0, ib&IB_W != 0)
532+ ib&IB_C != 0, ib&IB_X != 0, ib&IB_Y != 0, ib&IB_Z != 0, ib&IB_S != 0)
802533 }
803534 func (__ *CommandBuffer) State(ck CommandKey) int32 {
804535 switch ck {
@@ -848,10 +579,6 @@ func (__ *CommandBuffer) State(ck CommandKey) int32 {
848579 return __.zb
849580 case CK_s:
850581 return __.sb
851- case CK_v:
852- return __.vb
853- case CK_w:
854- return __.wb
855582 case CK_nB:
856583 return -Min(-Max(__.Db, __.Ub), __.Bb)
857584 case CK_nD:
@@ -898,10 +625,6 @@ func (__ *CommandBuffer) State(ck CommandKey) int32 {
898625 return -__.zb
899626 case CK_ns:
900627 return -__.sb
901- case CK_nv:
902- return -__.vb
903- case CK_nw:
904- return -__.wb
905628 }
906629 return 0
907630 }
@@ -982,7 +705,7 @@ func (__ *CommandBuffer) LastDirectionTime() int32 {
982705 }
983706 func (__ *CommandBuffer) LastChangeTime() int32 {
984707 return Min(__.LastDirectionTime(), Abs(__.ab), Abs(__.bb), Abs(__.cb),
985- Abs(__.xb), Abs(__.yb), Abs(__.zb), Abs(__.sb), Abs(__.vb), Abs(__.wb))
708+ Abs(__.xb), Abs(__.yb), Abs(__.zb), Abs(__.sb))
986709 }
987710
988711 type NetBuffer struct {
@@ -1011,7 +734,7 @@ type NetInput struct {
1011734 st NetState
1012735 sendEnd chan bool
1013736 recvEnd chan bool
1014- buf [MaxSimul*2 + MaxAttachedChar]NetBuffer
737+ buf [MaxSimul * 2]NetBuffer
1015738 locIn int
1016739 remIn int
1017740 time int32
@@ -1329,14 +1052,13 @@ func (fi *FileInput) Update() bool {
13291052 }
13301053
13311054 type AiInput struct {
1332- dir, dt, at, bt, ct, xt, yt, zt, st, vt, wt int32
1055+ dir, dt, at, bt, ct, xt, yt, zt, st int32
13331056 }
13341057
13351058 func (__ *AiInput) Update() {
13361059 if sys.intro != 0 {
13371060 __.dt, __.at, __.bt, __.ct = 0, 0, 0, 0
13381061 __.xt, __.yt, __.zt, __.st = 0, 0, 0, 0
1339- __.vt, __.wt = 0, 0
13401062 return
13411063 }
13421064 var osu, hanasu int32 = 15, 60
@@ -1361,8 +1083,6 @@ func (__ *AiInput) Update() {
13611083 dec(&__.xt)
13621084 dec(&__.yt)
13631085 dec(&__.zt)
1364- dec(&__.vt)
1365- dec(&__.wt)
13661086 osu = 3600
13671087 dec(&__.st)
13681088 }
@@ -1399,12 +1119,6 @@ func (__ *AiInput) Z() bool {
13991119 func (__ *AiInput) S() bool {
14001120 return __.st != 0
14011121 }
1402-func (__ *AiInput) V() bool {
1403- return __.vt != 0
1404-}
1405-func (__ *AiInput) W() bool {
1406- return __.wt != 0
1407-}
14081122
14091123 type cmdElem struct {
14101124 key []CommandKey
@@ -1591,7 +1305,7 @@ func ReadCommand(name, cmdstr string, kr *CommandKeyRemap) (*Command, error) {
15911305 tilde = false
15921306 case 'x':
15931307 if tilde {
1594- ce.key = append(ce.key, kr.nx)
1308+ ce.key = append(ce.key, kr.x)
15951309 } else {
15961310 ce.key = append(ce.key, kr.x)
15971311 }
@@ -1617,20 +1331,6 @@ func ReadCommand(name, cmdstr string, kr *CommandKeyRemap) (*Command, error) {
16171331 ce.key = append(ce.key, kr.s)
16181332 }
16191333 tilde = false
1620- case 'v':
1621- if tilde {
1622- ce.key = append(ce.key, kr.nv)
1623- } else {
1624- ce.key = append(ce.key, kr.v)
1625- }
1626- tilde = false
1627- case 'w':
1628- if tilde {
1629- ce.key = append(ce.key, kr.nw)
1630- } else {
1631- ce.key = append(ce.key, kr.w)
1632- }
1633- tilde = false
16341334 case '$':
16351335 switch nextChar() {
16361336 case 'B':
@@ -1916,7 +1616,7 @@ func (cl *CommandList) Input(i int, facing int32) bool {
19161616 _else = true
19171617 }
19181618 if _else {
1919- var l, r, u, d, a, b, c, x, y, z, s, v, w bool
1619+ var l, r, u, d, a, b, c, x, y, z, s bool
19201620 if i < 0 {
19211621 i = ^i
19221622 if i < len(sys.aiInput) {
@@ -1931,14 +1631,12 @@ func (cl *CommandList) Input(i int, facing int32) bool {
19311631 y = sys.aiInput[i].Y()
19321632 z = sys.aiInput[i].Z()
19331633 s = sys.aiInput[i].S()
1934- v = sys.aiInput[i].V()
1935- w = sys.aiInput[i].W()
19361634 }
19371635 } else if i < len(sys.inputRemap) {
19381636 in := sys.inputRemap[i]
19391637 if in < len(sys.keyConfig) {
19401638 joy := sys.keyConfig[in].Joy
1941- if joy == -1 {
1639+ if joy >= -1 {
19421640 l = sys.keyConfig[in].L()
19431641 r = sys.keyConfig[in].R()
19441642 u = sys.keyConfig[in].U()
@@ -1950,52 +1648,6 @@ func (cl *CommandList) Input(i int, facing int32) bool {
19501648 y = sys.keyConfig[in].Y()
19511649 z = sys.keyConfig[in].Z()
19521650 s = sys.keyConfig[in].S()
1953- v = sys.keyConfig[in].V()
1954- w = sys.keyConfig[in].W()
1955- }
1956- }
1957- if in < len(sys.JoystickConfig) {
1958- joyS := sys.JoystickConfig[in].Joy
1959- if joyS >= 0 {
1960- if l == false {
1961- l = sys.JoystickConfig[in].L()
1962- }
1963- if r == false {
1964- r = sys.JoystickConfig[in].R()
1965- }
1966- if u == false {
1967- u = sys.JoystickConfig[in].U()
1968- }
1969- if d == false {
1970- d = sys.JoystickConfig[in].D()
1971- }
1972- if a == false {
1973- a = sys.JoystickConfig[in].A()
1974- }
1975- if b == false {
1976- b = sys.JoystickConfig[in].B()
1977- }
1978- if c == false {
1979- c = sys.JoystickConfig[in].C()
1980- }
1981- if x == false {
1982- x = sys.JoystickConfig[in].X()
1983- }
1984- if y == false {
1985- y = sys.JoystickConfig[in].Y()
1986- }
1987- if z == false {
1988- z = sys.JoystickConfig[in].Z()
1989- }
1990- if s == false {
1991- s = sys.JoystickConfig[in].S()
1992- }
1993- if v == false {
1994- v = sys.JoystickConfig[in].V()
1995- }
1996- if w == false {
1997- w = sys.JoystickConfig[in].W()
1998- }
19991651 }
20001652 }
20011653 }
@@ -2005,7 +1657,7 @@ func (cl *CommandList) Input(i int, facing int32) bool {
20051657 } else {
20061658 B, F = l, r
20071659 }
2008- cl.Buffer.Input(B, d, F, u, a, b, c, x, y, z, s, v, w)
1660+ cl.Buffer.Input(B, d, F, u, a, b, c, x, y, z, s)
20091661 }
20101662 return step
20111663 }
--- a/src/lifebar.go
+++ b/src/lifebar.go
@@ -268,12 +268,10 @@ type LifeBarFace struct {
268268 teammate_face []*Sprite
269269 teammate_face_lay Layout
270270 numko int32
271- scale float32
272- teammate_scale []float32
273271 }
274272
275273 func newLifeBarFace() *LifeBarFace {
276- return &LifeBarFace{face_spr: [2]int32{-1}, teammate_face_spr: [2]int32{-1}, scale: 1}
274+ return &LifeBarFace{face_spr: [2]int32{-1}, teammate_face_spr: [2]int32{-1}}
277275 }
278276 func readLifeBarFace(pre string, is IniSection,
279277 sff *Sff, at AnimationTable) *LifeBarFace {
@@ -311,7 +309,7 @@ func (f *LifeBarFace) draw(layerno int16, fx *PalFX, superplayer bool) {
311309 sys.brightness = 256
312310 }
313311 f.face_lay.DrawSprite(float32(f.pos[0]), float32(f.pos[1]), layerno,
314- f.face, fx, f.scale)
312+ f.face, fx)
315313 sys.brightness = ob
316314 i := int32(len(f.teammate_face)) - 1
317315 x := float32(f.teammate_pos[0] + f.teammate_spacing[0]*(i-1))
@@ -319,7 +317,7 @@ func (f *LifeBarFace) draw(layerno int16, fx *PalFX, superplayer bool) {
319317 for ; i >= 0; i-- {
320318 if i != f.numko {
321319 f.teammate_bg.Draw(x, y, layerno)
322- f.teammate_face_lay.DrawSprite(x, y, layerno, f.teammate_face[i], nil, f.teammate_scale[i])
320+ f.teammate_face_lay.DrawSprite(x, y, layerno, f.teammate_face[i], nil)
323321 if i < f.numko {
324322 f.teammate_ko.Draw(x, y, layerno)
325323 }
@@ -655,7 +653,6 @@ type LifeBarRound struct {
655653 cur int32
656654 wt, swt, dt [2]int32
657655 fnt []*Fnt
658- timerActive bool
659656 }
660657
661658 func newLifeBarRound(snd *Snd, fnt []*Fnt) *LifeBarRound {
@@ -669,12 +666,7 @@ func readLifeBarRound(is IniSection,
669666 r := newLifeBarRound(snd, fnt)
670667 var tmp int32
671668 is.ReadI32("pos", &r.pos[0], &r.pos[1])
672- tmp = Atoi(sys.cmdFlags["-rounds"])
673- if tmp > 0 {
674- r.match_wins = tmp
675- } else {
676- is.ReadI32("match.wins", &r.match_wins)
677- }
669+ is.ReadI32("match.wins", &r.match_wins)
678670 is.ReadI32("match.maxdrawgames", &r.match_maxdrawgames)
679671 if is.ReadI32("start.waittime", &tmp) {
680672 r.start_waittime = Max(1, tmp)
@@ -720,8 +712,6 @@ func readLifeBarRound(is IniSection,
720712 func (r *LifeBarRound) callFight() {
721713 r.fight.Reset()
722714 r.cur, r.wt[0], r.swt[0], r.dt[0] = 1, r.fight_time, r.fight_sndtime, 0
723- sys.timerCount = append(sys.timerCount, sys.gameTime)
724- r.timerActive = true
725715 }
726716 func (r *LifeBarRound) act() bool {
727717 if sys.intro > r.ctrl_time {
@@ -774,14 +764,6 @@ func (r *LifeBarRound) act() bool {
774764 r.wt[0]--
775765 }
776766 } else if r.cur == 2 && (sys.finish != FT_NotYet || sys.time == 0) {
777- if r.timerActive {
778- if sys.gameTime-sys.timerCount[sys.round-1] > 0 {
779- sys.timerCount[sys.round-1] = sys.gameTime - sys.timerCount[sys.round-1]
780- } else {
781- sys.timerCount[sys.round-1] = 0
782- }
783- r.timerActive = false
784- }
785767 f := func(ats *AnimTextSnd, t int) {
786768 if r.swt[t] == 0 {
787769 r.snd.play(ats.snd)
@@ -983,8 +965,6 @@ func loadLifebar(deffile string) (*Lifebar, error) {
983965 }
984966 }
985967 }
986- case "fonts":
987- is.ReadF32("scale", &sys.lifebarFontScale)
988968 case "lifebar":
989969 if l.hb[0][0] == nil {
990970 l.hb[0][0] = readHealthBar("p1.", is, sff, at)
@@ -1189,8 +1169,12 @@ func (l *Lifebar) draw(layerno int16) {
11891169 l.pb[i].bgDraw(layerno)
11901170 }
11911171 for i := range l.pb {
1172+ lvi := i
1173+ if sys.tmode[i] == TM_Simul {
1174+ lvi += 2
1175+ }
11921176 l.pb[i].draw(layerno, float32(sys.chars[i][0].power)/
1193- float32(sys.chars[i][0].powerMax), sys.chars[i][0].power/1000,
1177+ float32(sys.chars[i][0].powerMax), sys.chars[lvi][0].power/1000,
11941178 l.fnt[:])
11951179 }
11961180 for ti, tm := range sys.tmode {
--- a/src/main.go
+++ b/src/main.go
@@ -2,16 +2,12 @@ package main
22
33 import (
44 "encoding/json"
5- "fmt"
5+ "github.com/go-gl/glfw/v3.2/glfw"
6+ "github.com/yuin/gopher-lua"
67 "io/ioutil"
78 "os"
8- "regexp"
99 "runtime"
10- "strconv"
1110 "strings"
12-
13- "github.com/go-gl/glfw/v3.2/glfw"
14- "github.com/yuin/gopher-lua"
1511 )
1612
1713 func init() {
@@ -22,111 +18,39 @@ func chk(err error) {
2218 panic(err)
2319 }
2420 }
25-func createLog(p string) *os.File {
26- //fmt.Println("Creating log")
27- f, err := os.Create(p)
28- if err != nil {
29- panic(err)
30- }
31- return f
32-}
33-func closeLog(f *os.File) {
34- //fmt.Println("Closing log")
35- f.Close()
36-}
3721 func main() {
38- if len(os.Args[1:]) > 0 {
39- sys.cmdFlags = make(map[string]string)
40- key := ""
41- player := 1
42- for _, a := range os.Args[1:] {
43- match, _ := regexp.MatchString("^-", a)
44- if match {
45- help, _ := regexp.MatchString("^-[h%?]", a)
46- if help {
47- fmt.Println("I.K.E.M.E.N\nOptions (case sensitive):")
48- fmt.Println(" -h -? Help")
49- fmt.Println(" -log <logfile> Records match data to <logfile>")
50- fmt.Println(" -r <sysfile> Loads motif <sysfile>. eg. -r motifdir or -r motifdir/system.def")
51- fmt.Println("\nQuick VS Options:")
52- fmt.Println(" -p<n> <playername> Loads player n, eg. -p3 kfm")
53- fmt.Println(" -p<n>.ai <level> Set player n's AI to <level>, eg. -p1.ai 8")
54- fmt.Println(" -p<n>.color <col> Set player n's color to <col>")
55- fmt.Println(" -p<n>.life <life> Sets player n's life to <life>")
56- fmt.Println(" -p<n>.power <power> Sets player n's power to <power>")
57- fmt.Println(" -rounds <num> Plays for <num> rounds, and then quits")
58- fmt.Println(" -s <stagename> Loads stage <stagename>")
59- fmt.Println("\nPress ENTER to exit.")
60- var s string
61- fmt.Scanln(&s)
62- os.Exit(0)
63- }
64- sys.cmdFlags[a] = ""
65- key = a
66- } else if key == "" {
67- sys.cmdFlags[fmt.Sprintf("-p%v", player)] = a
68- player += 1
69- } else {
70- sys.cmdFlags[key] = a
71- key = ""
72- }
73- }
74- }
7522 chk(glfw.Init())
7623 defer glfw.Terminate()
7724 defcfg := []byte(strings.Join(strings.Split(`{
78- "HelperMax":56,
79- "PlayerProjectileMax":256,
80- "ExplodMax":512,
81- "AfterImageMax":128,
82- "Attack.LifeToPowerMul":0.7,
83- "GetHit.LifeToPowerMul":0.6,
84- "Width":640,
85- "Height":480,
86- "Super.TargetDefenceMul":1.5,
87- "LifebarFontScale":1,
88- "System":"script/main.lua",
89- "KeyConfig":[{
90- "Joystick":-1,
91- "Buttons":["UP","DOWN","LEFT","RIGHT","z","x","c","a","s","d","RETURN","q","w"]
92- },{
93- "Joystick":-1,
94- "Buttons":["t","g","f","h","j","k","l","u","i","o","RSHIFT","LEFTBRACKET","RIGHTBRACKET"]
95- }],
96- "JoystickConfig":[{
97- "Joystick":0,
98- "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
99- },{
100- "Joystick":1,
101- "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
102- }],
103- "Motif":"data/system.def",
104- "CommonAir":"data/common.air",
105- "CommonCmd":"data/common.cmd",
106- "SimulMode":true,
107- "LifeMul":100,
108- "Team1VS2Life":120,
109- "TurnsRecoveryRate":300,
110- "ZoomActive":true,
111- "ZoomMin":0.75,
112- "ZoomMax":1.1,
113- "ZoomSpeed":1,
114- "RoundTime":99,
115- "NumTurns":4,
116- "NumSimul":4,
117- "NumTag":4,
118- "Difficulty":8,
119- "Credits":10,
120- "ListenPort":7500,
121- "ContSelection":true,
122- "AIRandomColor":true,
123- "AIRamping":true,
124- "AutoGuard":false,
125- "TeamPowerShare":false,
126- "TeamLifeShare":false,
127- "Fullscreen":false,
128- "AllowDebugKeys":true,
129- "IP":{
25+ "HelperMax": 56,
26+ "PlayerProjectileMax": 50,
27+ "ExplodMax": 256,
28+ "AfterImageMax": 8,
29+ "Attack.LifeToPowerMul": 0.7,
30+ "GetHit.LifeToPowerMul": 0.6,
31+ "Width": 640,
32+ "Height": 480,
33+ "Super.TargetDefenceMul": 1.5,
34+ "LifebarFontScale": 0.5,
35+ "System": "script/main.lua",
36+ "KeyConfig": [
37+ {
38+ "Joystick": -1,
39+ "Buttons": ["UP", "DOWN", "LEFT", "RIGHT",
40+ "z", "x", "c", "a", "s", "d",
41+ "RETURN"]
42+ }
43+ ],
44+ "_comment": {
45+ "_comment": "ジョイスティック (0番) の場合の KeyConfig",
46+ "KeyConfig": [
47+ {
48+ "Joystick": 0,
49+ "Buttons": [-3, -4, -1, -2,
50+ 1, 2, 7, 0, 3, 5,
51+ 9]
52+ }
53+ ]
13054 }
13155 }
13256 `, "\n"), "\r\n"))
@@ -146,21 +70,9 @@ func main() {
14670 Joystick int
14771 Buttons []interface{}
14872 }
149- JoystickConfig []struct {
150- Joystick int
151- Buttons []interface{}
152- }
153- NumTag int
154- TeamLifeShare bool
155- AIRandomColor bool
156- Fullscreen bool
157- AllowDebugKeys bool
158- CommonAir string
159- CommonCmd string
160- QuickLaunch bool
16173 }{}
16274 chk(json.Unmarshal(defcfg, &tmp))
163- const configFile = "data/config.json"
75+ const configFile = "script/config.json"
16476 if bytes, err := ioutil.ReadFile(configFile); err != nil {
16577 f, err := os.Create(configFile)
16678 chk(err)
@@ -181,59 +93,29 @@ func main() {
18193 sys.getHit_LifeToPowerMul = tmp.GetHit_LifeToPowerMul
18294 sys.super_TargetDefenceMul = tmp.Super_TargetDefenceMul
18395 sys.lifebarFontScale = tmp.LifebarFontScale
184- sys.quickLaunch = tmp.QuickLaunch
18596 stoki := func(key string) int {
18697 return int(StringToKey(key))
18798 }
188- Atoi := func(key string) int {
189- var i int
190- i, _ = strconv.Atoi(key)
191- return i
192- }
193- for a := 0; a < tmp.NumTag; a++ {
194- for _, kc := range tmp.KeyConfig {
195- b := kc.Buttons
196- if kc.Joystick < 0 {
197- sys.keyConfig = append(sys.keyConfig, KeyConfig{kc.Joystick,
198- stoki(b[0].(string)), stoki(b[1].(string)),
199- stoki(b[2].(string)), stoki(b[3].(string)),
200- stoki(b[4].(string)), stoki(b[5].(string)), stoki(b[6].(string)),
201- stoki(b[7].(string)), stoki(b[8].(string)), stoki(b[9].(string)),
202- stoki(b[10].(string)), stoki(b[11].(string)), stoki(b[12].(string))})
203- }
99+ for _, kc := range tmp.KeyConfig {
100+ b := kc.Buttons
101+ if kc.Joystick >= 0 {
102+ sys.keyConfig = append(sys.keyConfig, KeyConfig{kc.Joystick,
103+ int(b[0].(float64)), int(b[1].(float64)),
104+ int(b[2].(float64)), int(b[3].(float64)),
105+ int(b[4].(float64)), int(b[5].(float64)), int(b[6].(float64)),
106+ int(b[7].(float64)), int(b[8].(float64)), int(b[9].(float64)),
107+ int(b[10].(float64))})
108+ } else {
109+ sys.keyConfig = append(sys.keyConfig, KeyConfig{kc.Joystick,
110+ stoki(b[0].(string)), stoki(b[1].(string)),
111+ stoki(b[2].(string)), stoki(b[3].(string)),
112+ stoki(b[4].(string)), stoki(b[5].(string)), stoki(b[6].(string)),
113+ stoki(b[7].(string)), stoki(b[8].(string)), stoki(b[9].(string)),
114+ stoki(b[10].(string))})
204115 }
205- for _, jc := range tmp.JoystickConfig {
206- b := jc.Buttons
207- if jc.Joystick >= 0 {
208- sys.JoystickConfig = append(sys.JoystickConfig, KeyConfig{jc.Joystick,
209- Atoi(b[0].(string)), Atoi(b[1].(string)),
210- Atoi(b[2].(string)), Atoi(b[3].(string)),
211- Atoi(b[4].(string)), Atoi(b[5].(string)), Atoi(b[6].(string)),
212- Atoi(b[7].(string)), Atoi(b[8].(string)), Atoi(b[9].(string)),
213- Atoi(b[10].(string)), Atoi(b[11].(string)), Atoi(b[12].(string))})
214- }
215- }
216- }
217- sys.teamLifeShare = tmp.TeamLifeShare
218- sys.fullscreen = tmp.Fullscreen
219- sys.aiRandomColor = tmp.AIRandomColor
220- sys.allowDebugKeys = tmp.AllowDebugKeys
221- air, err := ioutil.ReadFile(tmp.CommonAir)
222- if err != nil {
223- fmt.Print(err)
224- }
225- sys.commonAir = string("\n") + string(air)
226- cmd, err := ioutil.ReadFile(tmp.CommonCmd)
227- if err != nil {
228- fmt.Print(err)
229116 }
230- sys.commonCmd = string("\n") + string(cmd)
231- os.Mkdir("debug", os.ModeSticky|0755)
232- log := createLog("debug/log.txt")
233- defer closeLog(log)
234117 l := sys.init(tmp.Width, tmp.Height)
235118 if err := l.DoFile(tmp.System); err != nil {
236- fmt.Fprintln(log, err)
237119 switch err.(type) {
238120 case *lua.ApiError:
239121 errstr := strings.Split(err.Error(), "\n")[0]
--- a/src/render.go
+++ b/src/render.go
@@ -1,14 +1,14 @@
11 package main
22
33 import (
4- "unsafe"
5-
64 "github.com/go-gl/gl/v2.1/gl"
5+ "math"
6+ "unsafe"
77 )
88
99 var notiling = [4]int32{0, 0, 0, 0}
1010 var mugenShader uintptr
11-var uniformA, uniformPal, uniformMsk, uniformPalNeg, uniformPalGray, uniformPalAdd, uniformPalMul int32
11+var uniformA, uniformPal, uniformMsk int32
1212 var mugenShaderFc uintptr
1313 var uniformFcA, uniformNeg, uniformGray, uniformAdd, uniformMul int32
1414 var mugenShaderFcS uintptr
@@ -23,20 +23,12 @@ func RenderInit() {
2323 "uniform sampler2D tex;" +
2424 "uniform sampler1D pal;" +
2525 "uniform int msk;" +
26- "uniform bool neg;" +
27- "uniform float gray;" +
28- "uniform vec3 add;" +
29- "uniform vec3 mul;" +
3026 "void main(void){" +
3127 "float r = texture2D(tex, gl_TexCoord[0].st).r;" +
32- "if(int(255.25*r) == msk){" +
33- " gl_FragColor = vec4(0.0);" +
34- "}else{" +
35- " vec4 c = texture1D(pal, r*0.9961);" +
36- " if(neg) c.rgb = vec3(1.0) - c.rgb;" +
37- " c.rgb += (vec3((c.r + c.g + c.b) / 3.0) - c.rgb) * gray + add;" +
38- " gl_FragColor = vec4(c.rgb * mul, c.a * a);" +
39- "}" +
28+ "vec4 c;" +
29+ "gl_FragColor =" +
30+ "int(255.0*r) == msk ? vec4(0.0)" +
31+ ": (c = texture1D(pal, r*0.9961), vec4(c.rgb, a));" +
4032 "}\x00"
4133 fragShaderFc := "uniform float a;" +
4234 "uniform sampler2D tex;" +
@@ -104,10 +96,6 @@ func RenderInit() {
10496 uniformA = gl.GetUniformLocationARB(mugenShader, gl.Str("a\x00"))
10597 uniformPal = gl.GetUniformLocationARB(mugenShader, gl.Str("pal\x00"))
10698 uniformMsk = gl.GetUniformLocationARB(mugenShader, gl.Str("msk\x00"))
107- uniformPalNeg = gl.GetUniformLocationARB(mugenShader, gl.Str("neg\x00"))
108- uniformPalGray = gl.GetUniformLocationARB(mugenShader, gl.Str("gray\x00"))
109- uniformPalAdd = gl.GetUniformLocationARB(mugenShader, gl.Str("add\x00"))
110- uniformPalMul = gl.GetUniformLocationARB(mugenShader, gl.Str("mul\x00"))
11199 gl.DeleteObjectARB(fragObj)
112100 fragObj = compile(gl.FRAGMENT_SHADER, fragShaderFc)
113101 mugenShaderFc = link(vertObj, fragObj)
@@ -124,7 +112,28 @@ func RenderInit() {
124112 gl.DeleteObjectARB(fragObj)
125113 gl.DeleteObjectARB(vertObj)
126114 }
127-func drawQuads(x1, y1, x2, y2, x3, y3, x4, y4, pers float32) {
115+func kaiten(x, y *float32, angle float64, rcx, rcy, vscl float32) {
116+ temp := (*y - rcy) / vscl
117+ length := math.Sqrt(float64((*x-rcx)*(*x-rcx) + temp*temp))
118+ if *x-rcx == 0 {
119+ if *y-rcy > 0 {
120+ angle += math.Pi / 2
121+ } else {
122+ angle -= math.Pi / 2
123+ }
124+ *x = rcx + float32(length*math.Cos(angle))
125+ *y = rcy + float32(length*math.Sin(angle))*vscl
126+ return
127+ }
128+ kakudo := math.Atan(float64(temp/(*x-rcx))) + angle
129+ if *x-rcx < 0 {
130+ kakudo += math.Pi
131+ }
132+ *x = rcx + float32(length*math.Cos(kakudo))
133+ *y = rcy + float32(length*math.Sin(kakudo))*vscl
134+}
135+func drawQuads(x1, y1, x2, y2, x3, y3, x4, y4, r, g, b, a, pers float32) {
136+ gl.Color4f(r, g, b, a)
128137 gl.Begin(gl.TRIANGLE_STRIP)
129138 gl.TexCoord2f(0, 1)
130139 gl.Vertex2f(x1, y1)
@@ -149,7 +158,7 @@ func drawQuads(x1, y1, x2, y2, x3, y3, x4, y4, pers float32) {
149158 gl.End()
150159 }
151160 func rmTileHSub(x1, y1, x2, y2, x3, y3, x4, y4, xtw, xbw, xts, xbs float32,
152- tl *[4]int32, rcx, pers float32) {
161+ tl *[4]int32, rcx, r, g, b, a, pers float32) {
153162 topdist := xtw + xts*float32((*tl)[0])
154163 if AbsF(topdist) >= 0.01 {
155164 botdist := xbw + xbs*float32((*tl)[0])
@@ -176,7 +185,7 @@ func rmTileHSub(x1, y1, x2, y2, x3, y3, x4, y4, xtw, xbw, xts, xbs float32,
176185 (x1d < float32(sys.scrrect[2]) || x2d < float32(sys.scrrect[2])) ||
177186 (0 < x3d || 0 < x4d) &&
178187 (x3d < float32(sys.scrrect[2]) || x4d < float32(sys.scrrect[2])) {
179- drawQuads(x1d, y1, x2d, y2, x3d, y3, x4d, y4, pers)
188+ drawQuads(x1d, y1, x2d, y2, x3d, y3, x4d, y4, r, g, b, a, pers)
180189 }
181190 }
182191 }
@@ -195,7 +204,7 @@ func rmTileHSub(x1, y1, x2, y2, x3, y3, x4, y4, xtw, xbw, xts, xbs float32,
195204 (x1 < float32(sys.scrrect[2]) || x2 < float32(sys.scrrect[2])) ||
196205 (0 < x3 || 0 < x4) &&
197206 (x3 < float32(sys.scrrect[2]) || x4 < float32(sys.scrrect[2])) {
198- drawQuads(x1, y1, x2, y2, x3, y3, x4, y4, pers)
207+ drawQuads(x1, y1, x2, y2, x3, y3, x4, y4, r, g, b, a, pers)
199208 }
200209 if (*tl)[2] != 1 && n != 0 {
201210 n--
@@ -210,7 +219,7 @@ func rmTileHSub(x1, y1, x2, y2, x3, y3, x4, y4, xtw, xbw, xts, xbs float32,
210219 }
211220 }
212221 func rmTileSub(w, h uint16, x, y float32, tl *[4]int32,
213- xts, xbs, ys, vs, rxadd, agl, yagl, xagl, rcx, rcy float32) {
222+ xts, xbs, ys, vs, rxadd, agl, rcx, rcy, r, g, b, a float32) {
214223 x1, y1 := x+rxadd*ys*float32(h), rcy+((y-ys*float32(h))-rcy)*vs
215224 x2, y2 := x1+xbs*float32(w), y1
216225 x3, y3 := x+xts*float32(w), rcy+(y-rcy)*vs
@@ -221,24 +230,12 @@ func rmTileSub(w, h uint16, x, y float32, tl *[4]int32,
221230 } else {
222231 pers = AbsF(xbs) / AbsF(xts)
223232 }
224- if agl != 0 || yagl != 0 || xagl != 0 {
225- // kaiten(&x1, &y1, float64(agl), rcx, rcy, vs)
226- // kaiten(&x2, &y2, float64(agl), rcx, rcy, vs)
227- // kaiten(&x3, &y3, float64(agl), rcx, rcy, vs)
228- // kaiten(&x4, &y4, float64(agl), rcx, rcy, vs)
229- if vs != 1 {
230- y1 = rcy + ((y - ys*float32(h)) - rcy)
231- y2 = y1
232- y3 = rcy + (y - rcy)
233- y4 = y3
234- }
235- gl.Translated(float64(rcx), float64(rcy), 0)
236- gl.Scaled(1, float64(vs), 1)
237- gl.Rotated(float64(xagl), 1.0, 0.0, 0.0)
238- gl.Rotated(float64(-yagl), 0.0, 1.0, 0.0)
239- gl.Rotated(float64(agl), 0.0, 0.0, 1.0)
240- gl.Translated(float64(-rcx), float64(-rcy), 0)
241- drawQuads(x1, y1, x2, y2, x3, y3, x4, y4, pers)
233+ if agl != 0 {
234+ kaiten(&x1, &y1, float64(agl), rcx, rcy, vs)
235+ kaiten(&x2, &y2, float64(agl), rcx, rcy, vs)
236+ kaiten(&x3, &y3, float64(agl), rcx, rcy, vs)
237+ kaiten(&x4, &y4, float64(agl), rcx, rcy, vs)
238+ drawQuads(x1, y1, x2, y2, x3, y3, x4, y4, r, g, b, a, pers)
242239 return
243240 }
244241 if (*tl)[3] == 1 && xbs != 0 {
@@ -264,7 +261,7 @@ func rmTileSub(w, h uint16, x, y float32, tl *[4]int32,
264261 (y1d > float32(-sys.scrrect[3]) || y4d > float32(-sys.scrrect[3])) {
265262 rmTileHSub(x1d, y1d, x2d, y2d, x3d, y3d, x4d, y4d, x3d-x4d, x2d-x1d,
266263 (x3d-x4d)/float32(w), (x2d-x1d)/float32(w), tl,
267- rcx, pers)
264+ rcx, r, g, b, a, pers)
268265 }
269266 }
270267 }
@@ -281,7 +278,7 @@ func rmTileSub(w, h uint16, x, y float32, tl *[4]int32,
281278 if (0 > y1 || 0 > y4) &&
282279 (y1 > float32(-sys.scrrect[3]) || y4 > float32(-sys.scrrect[3])) {
283280 rmTileHSub(x1, y1, x2, y2, x3, y3, x4, y4, x3-x4, x2-x1,
284- (x3-x4)/float32(w), (x2-x1)/float32(w), tl, rcx, pers)
281+ (x3-x4)/float32(w), (x2-x1)/float32(w), tl, rcx, r, g, b, a, pers)
285282 }
286283 if (*tl)[3] != 1 && n != 0 {
287284 n--
@@ -302,12 +299,11 @@ func rmTileSub(w, h uint16, x, y float32, tl *[4]int32,
302299 }
303300 }
304301 func rmMainSub(a int32, size [2]uint16, x, y float32, tl *[4]int32,
305- xts, xbs, ys, vs, rxadd, agl, yagl, xagl float32, trans int32, rcx, rcy float32, neg bool, color float32,
306- padd, pmul *[3]float32) {
302+ xts, xbs, ys, vs, rxadd, agl float32, trans int32, rcx, rcy float32) {
307303 gl.MatrixMode(gl.PROJECTION)
308304 gl.PushMatrix()
309305 gl.LoadIdentity()
310- gl.Ortho(0, float64(sys.scrrect[2]), 0, float64(sys.scrrect[3]), -65535, 65535)
306+ gl.Ortho(0, float64(sys.scrrect[2]), 0, float64(sys.scrrect[3]), -1, 1)
311307 gl.MatrixMode(gl.MODELVIEW)
312308 gl.PushMatrix()
313309 gl.Translated(0, float64(sys.scrrect[3]), 0)
@@ -315,50 +311,37 @@ func rmMainSub(a int32, size [2]uint16, x, y float32, tl *[4]int32,
315311 case trans == -1:
316312 gl.Uniform1fARB(a, 1)
317313 gl.BlendFunc(gl.SRC_ALPHA, gl.ONE)
318- gl.BlendEquation(gl.FUNC_ADD)
319314 rmTileSub(size[0], size[1], x, y, tl, xts, xbs, ys, vs, rxadd,
320- agl, yagl, xagl, rcx, rcy)
315+ agl, rcx, rcy, 1, 1, 1, 1)
321316 case trans == -2:
322317 gl.Uniform1fARB(a, 1)
323- gl.BlendFunc(gl.ONE, gl.ONE)
324- gl.BlendEquation(gl.FUNC_REVERSE_SUBTRACT)
318+ gl.BlendFunc(gl.ZERO, gl.ONE_MINUS_SRC_COLOR)
325319 rmTileSub(size[0], size[1], x, y, tl, xts, xbs, ys, vs, rxadd,
326- agl, yagl, xagl, rcx, rcy)
320+ agl, rcx, rcy, 1, 1, 1, 1)
327321 case trans <= 0:
328322 case trans < 255:
329323 gl.Uniform1fARB(a, float32(trans)/255)
330324 gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
331- gl.BlendEquation(gl.FUNC_ADD)
332325 rmTileSub(size[0], size[1], x, y, tl, xts, xbs, ys, vs, rxadd,
333- agl, yagl, xagl, rcx, rcy)
326+ agl, rcx, rcy, 1, 1, 1, float32(trans)/255)
334327 case trans < 512:
335328 gl.Uniform1fARB(a, 1)
336329 gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
337- gl.BlendEquation(gl.FUNC_ADD)
338330 rmTileSub(size[0], size[1], x, y, tl, xts, xbs, ys, vs, rxadd,
339- agl, yagl, xagl, rcx, rcy)
331+ agl, rcx, rcy, 1, 1, 1, 1)
340332 default:
341333 src, dst := trans&0xff, trans>>10&0xff
342- aglOver := 0
343334 if dst < 255 {
344335 gl.Uniform1fARB(a, 1-float32(dst)/255)
345336 gl.BlendFunc(gl.ZERO, gl.ONE_MINUS_SRC_ALPHA)
346- gl.BlendEquation(gl.FUNC_ADD)
347337 rmTileSub(size[0], size[1], x, y, tl, xts, xbs, ys, vs, rxadd,
348- agl, yagl, xagl, rcx, rcy)
349- aglOver++
338+ agl, rcx, rcy, 1, 1, 1, 1-float32(trans)/255)
350339 }
351340 if src > 0 {
352- if aglOver != 0 {
353- agl = 0
354- yagl = 0
355- xagl = 0
356- }
357341 gl.Uniform1fARB(a, float32(src)/255)
358342 gl.BlendFunc(gl.SRC_ALPHA, gl.ONE)
359- gl.BlendEquation(gl.FUNC_ADD)
360343 rmTileSub(size[0], size[1], x, y, tl, xts, xbs, ys, vs, rxadd,
361- agl, yagl, xagl, rcx, rcy)
344+ agl, rcx, rcy, 1, 1, 1, float32(trans)/255)
362345 }
363346 }
364347 gl.PopMatrix()
@@ -366,13 +349,12 @@ func rmMainSub(a int32, size [2]uint16, x, y float32, tl *[4]int32,
366349 gl.PopMatrix()
367350 }
368351 func rmInitSub(size [2]uint16, x, y *float32, tile *[4]int32, xts float32,
369- ys, vs, agl, yagl, xagl *float32, window *[4]int32, rcx float32, rcy *float32) (
352+ ys, vs, agl *float32, window *[4]int32, rcx float32, rcy *float32) (
370353 tl [4]int32) {
371354 if *vs < 0 {
372355 *vs *= -1
373356 *ys *= -1
374357 *agl *= -1
375- *xagl *= -1
376358 }
377359 tl = *tile
378360 if tl[2] == 0 {
@@ -401,36 +383,27 @@ func rmInitSub(size [2]uint16, x, y *float32, tile *[4]int32, xts float32,
401383 (*window)[2], (*window)[3])
402384 return
403385 }
404-func RenderMugenPal(tex Texture, mask int32, size [2]uint16,
405- x, y float32, tile *[4]int32, xts, xbs, ys, vs, rxadd, agl, yagl, xagl float32,
406- trans int32, window *[4]int32, rcx, rcy float32, neg bool, color float32,
407- padd, pmul *[3]float32) {
386+func RenderMugenPal(tex Texture, paltex uint32, mask int32, size [2]uint16,
387+ x, y float32, tile *[4]int32, xts, xbs, ys, vs, rxadd, agl float32,
388+ trans int32, window *[4]int32, rcx, rcy float32) {
408389 if tex == 0 || !IsFinite(x+y+xts+xbs+ys+vs+rxadd+agl+rcx+rcy) {
409390 return
410391 }
411- tl := rmInitSub(size, &x, &y, tile, xts, &ys, &vs, &agl, &yagl, &xagl, window, rcx, &rcy)
412- ineg := int32(0)
413- if neg {
414- ineg = 1
415- }
392+ tl := rmInitSub(size, &x, &y, tile, xts, &ys, &vs, &agl, window, rcx, &rcy)
416393 gl.UseProgramObjectARB(mugenShader)
417394 gl.Uniform1iARB(uniformPal, 1)
418395 gl.Uniform1iARB(uniformMsk, mask)
419- gl.Uniform1iARB(uniformPalNeg, ineg)
420- gl.Uniform1fARB(uniformPalGray, 1-color)
421- gl.Uniform3fARB(uniformPalAdd, (*padd)[0], (*padd)[1], (*padd)[2])
422- gl.Uniform3fARB(uniformPalMul, (*pmul)[0], (*pmul)[1], (*pmul)[2])
423396 gl.ActiveTexture(gl.TEXTURE0)
424397 gl.BindTexture(gl.TEXTURE_2D, uint32(tex))
425- rmMainSub(uniformA, size, x, y, &tl, xts, xbs, ys, vs, rxadd, agl, yagl, xagl,
426- trans, rcx, rcy, neg, color, padd, pmul)
398+ rmMainSub(uniformA, size, x, y, &tl, xts, xbs, ys, vs, rxadd, agl,
399+ trans, rcx, rcy)
427400 gl.UseProgramObjectARB(0)
428401 gl.Disable(gl.SCISSOR_TEST)
429402 gl.Disable(gl.TEXTURE_2D)
430403 gl.Disable(gl.BLEND)
431404 }
432405 func RenderMugen(tex Texture, pal []uint32, mask int32, size [2]uint16,
433- x, y float32, tile *[4]int32, xts, xbs, ys, vs, rxadd, agl, yagl, xagl float32,
406+ x, y float32, tile *[4]int32, xts, xbs, ys, vs, rxadd, agl float32,
434407 trans int32, window *[4]int32, rcx, rcy float32) {
435408 gl.Enable(gl.TEXTURE_1D)
436409 gl.ActiveTexture(gl.TEXTURE1)
@@ -442,19 +415,19 @@ func RenderMugen(tex Texture, pal []uint32, mask int32, size [2]uint16,
442415 unsafe.Pointer(&pal[0]))
443416 gl.TexParameteri(gl.TEXTURE_1D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
444417 gl.TexParameteri(gl.TEXTURE_1D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
445- RenderMugenPal(tex, mask, size, x, y, tile, xts, xbs, ys, vs, rxadd,
446- agl, yagl, xagl, trans, window, rcx, rcy, false, 1, &[3]float32{0, 0, 0}, &[3]float32{1, 1, 1})
418+ RenderMugenPal(tex, paltex, mask, size, x, y, tile, xts, xbs, ys, vs, rxadd,
419+ agl, trans, window, rcx, rcy)
447420 gl.DeleteTextures(1, &paltex)
448421 gl.Disable(gl.TEXTURE_1D)
449422 }
450423 func RenderMugenFc(tex Texture, size [2]uint16, x, y float32,
451- tile *[4]int32, xts, xbs, ys, vs, rxadd, agl, yagl, xagl float32, trans int32,
424+ tile *[4]int32, xts, xbs, ys, vs, rxadd, agl float32, trans int32,
452425 window *[4]int32, rcx, rcy float32, neg bool, color float32,
453426 padd, pmul *[3]float32) {
454427 if tex == 0 || !IsFinite(x+y+xts+xbs+ys+vs+rxadd+agl+rcx+rcy) {
455428 return
456429 }
457- tl := rmInitSub(size, &x, &y, tile, xts, &ys, &vs, &agl, &yagl, &xagl, window, rcx, &rcy)
430+ tl := rmInitSub(size, &x, &y, tile, xts, &ys, &vs, &agl, window, rcx, &rcy)
458431 gl.UseProgramObjectARB(mugenShaderFc)
459432 ineg := int32(0)
460433 if neg {
@@ -465,27 +438,27 @@ func RenderMugenFc(tex Texture, size [2]uint16, x, y float32,
465438 gl.Uniform3fARB(uniformAdd, (*padd)[0], (*padd)[1], (*padd)[2])
466439 gl.Uniform3fARB(uniformMul, (*pmul)[0], (*pmul)[1], (*pmul)[2])
467440 gl.BindTexture(gl.TEXTURE_2D, uint32(tex))
468- rmMainSub(uniformFcA, size, x, y, &tl, xts, xbs, ys, vs, rxadd, agl, yagl, xagl,
469- trans, rcx, rcy, neg, color, padd, pmul)
441+ rmMainSub(uniformFcA, size, x, y, &tl, xts, xbs, ys, vs, rxadd, agl,
442+ trans, rcx, rcy)
470443 gl.UseProgramObjectARB(0)
471444 gl.Disable(gl.SCISSOR_TEST)
472445 gl.Disable(gl.TEXTURE_2D)
473446 gl.Disable(gl.BLEND)
474447 }
475448 func RenderMugenFcS(tex Texture, size [2]uint16, x, y float32,
476- tile *[4]int32, xts, xbs, ys, vs, rxadd, agl, yagl, xagl float32, trans int32,
449+ tile *[4]int32, xts, xbs, ys, vs, rxadd, agl float32, trans int32,
477450 window *[4]int32, rcx, rcy float32, color uint32) {
478451 if tex == 0 || !IsFinite(x+y+xts+xbs+ys+vs+rxadd+agl+rcx+rcy) {
479452 return
480453 }
481- tl := rmInitSub(size, &x, &y, tile, xts, &ys, &vs, &agl, &yagl, &xagl, window, rcx, &rcy)
454+ tl := rmInitSub(size, &x, &y, tile, xts, &ys, &vs, &agl, window, rcx, &rcy)
482455 gl.UseProgramObjectARB(mugenShaderFcS)
483456 gl.Uniform3fARB(
484457 uniformColor, float32(color>>16&0xff)/255, float32(color>>8&0xff)/255,
485458 float32(color&0xff)/255)
486459 gl.BindTexture(gl.TEXTURE_2D, uint32(tex))
487- rmMainSub(uniformFcSA, size, x, y, &tl, xts, xbs, ys, vs, rxadd, agl, yagl, xagl,
488- trans, rcx, rcy, false, 1, &[3]float32{0, 0, 0}, &[3]float32{1, 1, 1})
460+ rmMainSub(uniformFcSA, size, x, y, &tl, xts, xbs, ys, vs, rxadd, agl,
461+ trans, rcx, rcy)
489462 gl.UseProgramObjectARB(0)
490463 gl.Disable(gl.SCISSOR_TEST)
491464 gl.Disable(gl.TEXTURE_2D)
@@ -508,7 +481,7 @@ func FillRect(rect [4]int32, color uint32, trans int32) {
508481 gl.MatrixMode(gl.PROJECTION)
509482 gl.PushMatrix()
510483 gl.LoadIdentity()
511- gl.Ortho(0, float64(sys.scrrect[2]), 0, float64(sys.scrrect[3]), -65535, 65535)
484+ gl.Ortho(0, float64(sys.scrrect[2]), 0, float64(sys.scrrect[3]), -1, 1)
512485 gl.MatrixMode(gl.MODELVIEW)
513486 gl.PushMatrix()
514487 gl.Translated(0, float64(sys.scrrect[3]), 0)
--- a/src/script.go
+++ b/src/script.go
@@ -2,13 +2,10 @@ package main
22
33 import (
44 "fmt"
5- "math/rand"
6- "runtime"
7- "strconv"
8- "strings"
9-
105 "github.com/go-gl/glfw/v3.2/glfw"
116 "github.com/yuin/gopher-lua"
7+ "runtime"
8+ "strings"
129 )
1310
1411 func luaRegister(l *lua.LState, name string, f func(*lua.LState) int) {
@@ -207,7 +204,7 @@ func scriptCommonInit(l *lua.LState) {
207204 })
208205 luaRegister(l, "setAutoguard", func(l *lua.LState) int {
209206 pn := int(numArg(l, 1))
210- if pn < 1 || pn > MaxSimul*2+MaxAttachedChar {
207+ if pn < 1 || pn > MaxSimul*2 {
211208 l.RaiseError("プレイヤー番号(%v)が不正です。", pn)
212209 }
213210 sys.autoguard[pn-1] = boolArg(l, 2)
@@ -241,10 +238,6 @@ func scriptCommonInit(l *lua.LState) {
241238 sys.match = int32(numArg(l, 1))
242239 return 0
243240 })
244- luaRegister(l, "setLifeShare", func(l *lua.LState) int {
245- sys.teamLifeShare = boolArg(l, 1)
246- return 0
247- })
248241 }
249242
250243 // System Script
@@ -349,16 +342,7 @@ func systemScriptInit(l *lua.LState) {
349342 if !ok {
350343 userDataError(l, 1, a)
351344 }
352- var sx, sy int32 = 0, 0
353- if l.GetTop() >= 4 {
354- sx = int32(numArg(l, 4))
355- if l.GetTop() >= 5 {
356- sy = int32(numArg(l, 5))
357- } else {
358- sy = sx
359- }
360- }
361- a.SetTile(int32(numArg(l, 2)), int32(numArg(l, 3)), sx, sy)
345+ a.SetTile(int32(numArg(l, 2)), int32(numArg(l, 3)))
362346 return 0
363347 })
364348 luaRegister(l, "animSetColorKey", func(*lua.LState) int {
@@ -410,14 +394,6 @@ func systemScriptInit(l *lua.LState) {
410394 a.Draw()
411395 return 0
412396 })
413- luaRegister(l, "animReset", func(*lua.LState) int {
414- a, ok := toUserData(l, 1).(*Anim)
415- if !ok {
416- userDataError(l, 1, a)
417- }
418- a.ResetFrames()
419- return 0
420- })
421397 luaRegister(l, "enterNetPlay", func(*lua.LState) int {
422398 if sys.netInput != nil {
423399 l.RaiseError("すでに通信中です。")
@@ -454,7 +430,7 @@ func systemScriptInit(l *lua.LState) {
454430 })
455431 luaRegister(l, "setCom", func(*lua.LState) int {
456432 pn := int(numArg(l, 1))
457- if pn < 1 || pn > MaxSimul*2+MaxAttachedChar {
433+ if pn < 1 || pn > MaxSimul*2 {
458434 l.RaiseError("プレイヤー番号(%v)が不正です。", pn)
459435 }
460436 sys.com[pn-1] = Max(0, int32(numArg(l, 2)))
@@ -617,11 +593,7 @@ func systemScriptInit(l *lua.LState) {
617593 if !sys.frameSkip {
618594 c := sys.sel.GetChar(n)
619595 if c != nil && c.lportrait != nil {
620- if c.portrait_scale != 1 {
621- xscl *= c.portrait_scale
622- yscl *= c.portrait_scale
623- }
624- c.lportrait.Draw(x, y, xscl, yscl, c.lportrait.Pal, nil)
596+ c.lportrait.Draw(x, y, xscl, yscl, c.lportrait.Pal)
625597 }
626598 }
627599 return 0
@@ -640,12 +612,12 @@ func systemScriptInit(l *lua.LState) {
640612 if c != nil {
641613 if c.sportrait != nil {
642614 c.sportrait.Draw(x+float32(i)*sys.sel.cellsize[0],
643- y+float32(j)*sys.sel.cellsize[1], sys.sel.cellscale[0]*c.portrait_scale,
644- sys.sel.cellscale[1]*c.portrait_scale, c.sportrait.Pal, nil)
615+ y+float32(j)*sys.sel.cellsize[1], sys.sel.cellscale[0],
616+ sys.sel.cellscale[1], c.sportrait.Pal)
645617 } else if c.def == "randomselect" && sys.sel.randomspr != nil {
646618 sys.sel.randomspr.Draw(x+float32(i)*sys.sel.cellsize[0],
647619 y+float32(j)*sys.sel.cellsize[1], sys.sel.randomscl[0],
648- sys.sel.randomscl[1], sys.sel.randomspr.Pal, nil)
620+ sys.sel.randomscl[1], sys.sel.randomspr.Pal)
649621 }
650622 }
651623 }
@@ -724,8 +696,6 @@ func systemScriptInit(l *lua.LState) {
724696 return 0
725697 })
726698 luaRegister(l, "game", func(l *lua.LState) int {
727- tbl := l.NewTable()
728- tbl_chars := l.NewTable()
729699 load := func() error {
730700 sys.loader.runTread()
731701 for sys.loader.state != LS_Complete {
@@ -741,10 +711,7 @@ func systemScriptInit(l *lua.LState) {
741711 fa := sys.lifebar.fa[sys.tmode[i&1]][i]
742712 fa.face = sys.cgi[i].sff.getOwnPalSprite(
743713 int16(fa.face_spr[0]), int16(fa.face_spr[1]))
744-
745- fa.scale = sys.cgi[i].portraitscale
746714 }
747-
748715 }
749716 runtime.GC()
750717 return nil
@@ -823,29 +790,6 @@ func systemScriptInit(l *lua.LState) {
823790 if w1 != w2 {
824791 winp = Btoi(w1) + Btoi(w2)*2
825792 }
826- tbl_roundNo := l.NewTable()
827- for _, p := range sys.chars {
828- if len(p) > 0 {
829- tmp := l.NewTable()
830- tmp.RawSetString("name", lua.LString(p[0].name))
831- tmp.RawSetString("memberNo", lua.LNumber(p[0].memberNo))
832- tmp.RawSetString("selectNo", lua.LNumber(p[0].selectNo))
833- tmp.RawSetString("life", lua.LNumber(p[0].life))
834- tmp.RawSetString("lifeMax", lua.LNumber(p[0].lifeMax))
835- tmp.RawSetString("winquote", lua.LNumber(p[0].winquote))
836- tmp.RawSetString("aiLevel", lua.LNumber(p[0].aiLevel()))
837- tmp.RawSetString("palno", lua.LNumber(p[0].palno()))
838- tmp.RawSetString("win", lua.LBool(p[0].win()))
839- tmp.RawSetString("winKO", lua.LBool(p[0].winKO()))
840- tmp.RawSetString("winTime", lua.LBool(p[0].winTime()))
841- tmp.RawSetString("winPerfect", lua.LBool(p[0].winPerfect()))
842- tmp.RawSetString("drawgame", lua.LBool(p[0].drawgame()))
843- tmp.RawSetString("ko", lua.LBool(p[0].scf(SCF_ko)))
844- tmp.RawSetString("ko_round_middle", lua.LBool(p[0].scf(SCF_ko_round_middle)))
845- tbl_roundNo.RawSetInt(p[0].playerNo+1, tmp)
846- }
847- }
848- tbl_chars.RawSetInt(int(sys.round-1), tbl_roundNo)
849793 }
850794 return winp, nil
851795 }
@@ -872,285 +816,10 @@ func systemScriptInit(l *lua.LState) {
872816 sys.loader.reset()
873817 }
874818 if winp != -2 {
875- time := int32(0)
876- tbl_time := l.NewTable()
877- for k, v := range sys.timerCount {
878- tbl_time.RawSetInt(k+1, lua.LNumber(v))
879- time = time + v
880- }
881- tbl.RawSetString("chars", tbl_chars)
882- tbl.RawSetString("time_rounds", tbl_time)
883- tbl.RawSetString("time", lua.LNumber(time))
884- tbl.RawSetString("roundTime", lua.LNumber(sys.roundTime))
885- tbl.RawSetString("winTeam", lua.LNumber(sys.winTeam))
886- tbl.RawSetString("lastRound", lua.LNumber(sys.round-1))
887- tbl.RawSetString("draws", lua.LNumber(sys.draws))
888- tbl.RawSetString("P1wins", lua.LNumber(sys.wins[0]))
889- tbl.RawSetString("P2wins", lua.LNumber(sys.wins[1]))
890- tbl.RawSetString("P1tmode", lua.LNumber(sys.tmode[0]))
891- tbl.RawSetString("P2tmode", lua.LNumber(sys.tmode[1]))
892- sys.timerCount = []int32{}
893819 l.Push(lua.LNumber(winp))
894- l.Push(tbl)
895- return 2
896- }
897- }
898- })
899- luaRegister(l, "getCharVar", func(*lua.LState) int {
900- for _, p := range sys.chars {
901- if len(p) > 0 && p[0].playerNo+1 == int(numArg(l, 1)) {
902- if strArg(l, 2) == "varGet" {
903- l.Push(lua.LNumber(p[0].varGet(int32(numArg(l, 3))).ToI()))
904- } else if strArg(l, 2) == "fvarGet" {
905- l.Push(lua.LNumber(p[0].fvarGet(int32(numArg(l, 3))).ToI()))
906- } else if strArg(l, 2) == "sysVarGet" {
907- l.Push(lua.LNumber(p[0].sysVarGet(int32(numArg(l, 3))).ToI()))
908- } else if strArg(l, 2) == "sysFvarGet" {
909- l.Push(lua.LNumber(p[0].sysFvarGet(int32(numArg(l, 3))).ToI()))
910- }
911- break
912- }
913- }
914- return 1
915- })
916- luaRegister(l, "getCharVictoryQuote", func(*lua.LState) int {
917- v := int(-1)
918- for _, p := range sys.chars {
919- if len(p) > 0 && p[0].playerNo+1 == int(numArg(l, 1)) {
920- if l.GetTop() >= 2 {
921- v = int(numArg(l, 2))
922- } else {
923- v = int(p[0].winquote)
924- }
925- if v < 0 || v >= MaxQuotes {
926- t := []string{}
927- for i, q := range sys.cgi[p[0].playerNo].quotes {
928- if sys.cgi[p[0].playerNo].quotes[i] != "" {
929- t = append(t, q)
930- }
931- }
932- if len(t) > 0 {
933- v = rand.Int() % len(t)
934- } else {
935- v = -1
936- }
937- }
938- if len(sys.cgi[p[0].playerNo].quotes) == MaxQuotes && v != -1 {
939- l.Push(lua.LString(sys.cgi[p[0].playerNo].quotes[v]))
940- } else {
941- l.Push(lua.LString(""))
942- }
943- break
944- }
945- }
946- return 1
947- })
948- luaRegister(l, "getCommandLineFlags", func(*lua.LState) int {
949- tbl := l.NewTable()
950- for k, v := range sys.cmdFlags {
951- tbl.RawSetString(k, lua.LString(v))
952- }
953- l.Push(tbl)
954- return 1
955- })
956- luaRegister(l, "getCommandLineValue", func(*lua.LState) int {
957- l.Push(lua.LString(sys.cmdFlags[strArg(l, 1)]))
958- return 1
959- })
960- luaRegister(l, "setPortrait", func(*lua.LState) int {
961- p := int(numArg(l, 3))
962- if p == 1 {
963- sys.sel.lportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
964- } else if p == 2 {
965- sys.sel.sportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
966- } else if p == 3 {
967- sys.sel.vsportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
968- } else if p == 4 {
969- sys.sel.vportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
970- }
971- return 0
972- })
973- luaRegister(l, "drawSmallPortrait", func(l *lua.LState) int {
974- n, x, y := int(numArg(l, 1)), float32(numArg(l, 2)), float32(numArg(l, 3))
975- var xscl, yscl float32 = 1, 1
976- if l.GetTop() >= 4 {
977- xscl = float32(numArg(l, 4))
978- if l.GetTop() >= 5 {
979- yscl = float32(numArg(l, 5))
980- }
981- }
982- if !sys.frameSkip {
983- c := sys.sel.GetChar(n)
984- if c != nil && c.sportrait != nil {
985- if c.portrait_scale != 1 {
986- xscl *= c.portrait_scale
987- yscl *= c.portrait_scale
988- }
989- c.sportrait.Draw(x, y, xscl, yscl, c.sportrait.Pal, nil)
990- }
991- }
992- return 0
993- })
994- luaRegister(l, "drawVersusPortrait", func(l *lua.LState) int {
995- n, x, y := int(numArg(l, 1)), float32(numArg(l, 2)), float32(numArg(l, 3))
996- var xscl, yscl float32 = 1, 1
997- if l.GetTop() >= 4 {
998- xscl = float32(numArg(l, 4))
999- if l.GetTop() >= 5 {
1000- yscl = float32(numArg(l, 5))
1001- }
1002- }
1003- if !sys.frameSkip {
1004- c := sys.sel.GetChar(n)
1005- if c != nil && c.vsportrait != nil {
1006- if c.portrait_scale != 1 {
1007- xscl *= c.portrait_scale
1008- yscl *= c.portrait_scale
1009- }
1010- c.vsportrait.Draw(x, y, xscl, yscl, c.vsportrait.Pal, nil)
1011- }
1012- }
1013- return 0
1014- })
1015- luaRegister(l, "drawVictoryPortrait", func(l *lua.LState) int {
1016- n, x, y := int(numArg(l, 1)), float32(numArg(l, 2)), float32(numArg(l, 3))
1017- var xscl, yscl float32 = 1, 1
1018- if l.GetTop() >= 4 {
1019- xscl = float32(numArg(l, 4))
1020- if l.GetTop() >= 5 {
1021- yscl = float32(numArg(l, 5))
1022- }
1023- }
1024- if !sys.frameSkip {
1025- c := sys.sel.GetChar(n)
1026- if c != nil && c.vportrait != nil {
1027- if c.portrait_scale != 1 {
1028- xscl *= c.portrait_scale
1029- yscl *= c.portrait_scale
1030- }
1031- c.vportrait.Draw(x, y, xscl, yscl, c.vportrait.Pal, nil)
1032- }
1033- }
1034- return 0
1035- })
1036- luaRegister(l, "getCharIntro", func(*lua.LState) int {
1037- c := sys.sel.GetChar(int(numArg(l, 1)))
1038- l.Push(lua.LString(c.intro_storyboard))
1039- return 1
1040- })
1041- luaRegister(l, "getCharEnding", func(*lua.LState) int {
1042- c := sys.sel.GetChar(int(numArg(l, 1)))
1043- l.Push(lua.LString(c.ending_storyboard))
1044- return 1
1045- })
1046- luaRegister(l, "getCharPalettes", func(*lua.LState) int {
1047- c := sys.sel.GetChar(int(numArg(l, 1)))
1048- tbl := l.NewTable()
1049- var pal []int32
1050- if sys.aiRandomColor {
1051- pal = c.pal
1052- } else {
1053- pal = c.pal_defaults
1054- }
1055- if len(pal) > 0 {
1056- for k, v := range pal {
1057- tbl.RawSetInt(k+1, lua.LNumber(v))
1058- }
1059- } else {
1060- tbl.RawSetInt(1, lua.LNumber(1))
1061- }
1062- l.Push(tbl)
1063- return 1
1064- })
1065- luaRegister(l, "getCharRandomPalette", func(*lua.LState) int {
1066- c := sys.sel.GetChar(int(numArg(l, 1)))
1067- if len(c.pal) > 0 {
1068- n := rand.Int() % len(c.pal)
1069- l.Push(lua.LNumber(c.pal[n]))
1070- } else {
1071- l.Push(lua.LNumber(1))
1072- }
1073- return 1
1074- })
1075- luaRegister(l, "getStageInfo", func(*lua.LState) int {
1076- a, b, c, d := sys.sel.GetStageInfo(int(numArg(l, 1)))
1077- l.Push(lua.LString(a))
1078- l.Push(lua.LString(b))
1079- l.Push(lua.LString(c))
1080- l.Push(lua.LString(d))
1081- return 4
1082- })
1083- luaRegister(l, "getKey", func(*lua.LState) int {
1084- s := ""
1085- if sys.keyInput != glfw.KeyUnknown {
1086- s = KeyToString(sys.keyInput)
1087- }
1088-
1089- for j := 0; j < 2; j++ {
1090- if glfw.JoystickPresent(joystick[j]) {
1091- axes := glfw.GetJoystickAxes(joystick[j])
1092- btns := glfw.GetJoystickButtons(joystick[j])
1093- for i := range axes {
1094- if i > 3 && len(axes) == 6 && len(btns) == 14 { //Xboxコントローラー判定(glfwがバージョンアップすればもっとちゃんと判別できるようになるはず)
1095- if axes[i] > 0 {
1096- s = strconv.Itoa(-i*2 - 1)
1097- }
1098- } else {
1099- if axes[i] < -0.2 {
1100- s = strconv.Itoa(-i*2 - 1)
1101- } else if axes[i] > 0.2 {
1102- s = strconv.Itoa(-i*2 - 2)
1103- }
1104- }
1105- }
1106- for i := range btns {
1107- if btns[i] > 0 {
1108- s = strconv.Itoa(i)
1109- }
1110- }
820+ return 1
1111821 }
1112822 }
1113-
1114- l.Push(lua.LString(s))
1115- return 1
1116- })
1117- luaRegister(l, "getKeyText", func(*lua.LState) int {
1118- s := ""
1119- if sys.keyInput != glfw.KeyUnknown {
1120- if sys.keyInput == glfw.KeyInsert {
1121- s, _ = sys.window.GetClipboardString()
1122- } else {
1123- s = sys.keyString
1124- }
1125- }
1126- l.Push(lua.LString(s))
1127- return 1
1128- })
1129- luaRegister(l, "resetKey", func(*lua.LState) int {
1130- sys.keyInput = glfw.KeyUnknown
1131- sys.keyString = ""
1132- return 0
1133- })
1134- luaRegister(l, "getSpriteInfo", func(*lua.LState) int {
1135- var s *Sprite
1136- var err error
1137- def := strArg(l, 1)
1138- err = LoadFile(&def, "", func(file string) error {
1139- s, err = loadFromSff(file, int16(numArg(l, 2)), int16(numArg(l, 3)))
1140- return err
1141- })
1142- if err != nil {
1143- l.Push(lua.LNumber(0))
1144- l.Push(lua.LNumber(0))
1145- l.Push(lua.LNumber(0))
1146- l.Push(lua.LNumber(0))
1147- return 4
1148- }
1149- l.Push(lua.LNumber(s.Size[0]))
1150- l.Push(lua.LNumber(s.Size[1]))
1151- l.Push(lua.LNumber(s.Offset[0]))
1152- l.Push(lua.LNumber(s.Offset[1]))
1153- return 4
1154823 })
1155824 }
1156825
@@ -1590,7 +1259,7 @@ func triggerScriptInit(l *lua.LState) {
15901259 case "yvel":
15911260 ln = lua.LNumber(c.ghv.yvel)
15921261 case "yaccel":
1593- ln = lua.LNumber(c.ghv.getYaccel(c))
1262+ ln = lua.LNumber(c.ghv.getYaccel())
15941263 case "hitid", "chainid":
15951264 ln = lua.LNumber(c.ghv.chainId())
15961265 case "guarded":
@@ -1713,7 +1382,7 @@ func triggerScriptInit(l *lua.LState) {
17131382 return 1
17141383 })
17151384 luaRegister(l, "ishometeam", func(*lua.LState) int {
1716- l.Push(lua.LBool(sys.debugWC.teamside == sys.home))
1385+ l.Push(lua.LBool(sys.debugWC.playerNo&1 == sys.home))
17171386 return 1
17181387 })
17191388 luaRegister(l, "leftedge", func(*lua.LState) int {
@@ -2136,9 +1805,5 @@ func debugScriptInit(l *lua.LState, file string) error {
21361805 }
21371806 return 0
21381807 })
2139- luaRegister(l, "getAllowDebugKeys", func(*lua.LState) int {
2140- l.Push(lua.LBool(sys.allowDebugKeys))
2141- return 1
2142- })
21431808 return l.DoFile(file)
21441809 }
--- a/src/sound.go
+++ b/src/sound.go
@@ -3,18 +3,11 @@ package main
33 import (
44 "encoding/binary"
55 "fmt"
6+ "github.com/jfreymuth/go-vorbis/ogg/vorbis"
7+ "github.com/timshannon/go-openal/openal"
68 "io"
79 "math"
810 "os"
9- "path/filepath"
10- "time"
11-
12- "github.com/jfreymuth/go-vorbis/ogg/vorbis"
13- "github.com/timshannon/go-openal/openal"
14-
15- "github.com/faiface/beep"
16- "github.com/faiface/beep/mp3"
17- "github.com/faiface/beep/speaker"
1811 )
1912
2013 const (
@@ -22,11 +15,6 @@ const (
2215 audioFrequency = 48000
2316 )
2417
25-// ------------------------------------------------------------------
26-// Audio Source
27-
28-// AudioSource structure.
29-// It contains OpenAl's sound destination and buffer
3018 type AudioSource struct {
3119 Src openal.Source
3220 bufs openal.Buffers
@@ -52,9 +40,6 @@ func (s *AudioSource) Delete() {
5240 s.Src.Delete()
5341 }
5442
55-// ------------------------------------------------------------------
56-// Mixer
57-
5843 type Mixer struct {
5944 buf [audioOutLen * 2]float32
6045 sendBuf []int16
@@ -165,9 +150,6 @@ func (m *Mixer) Mix(wav []byte, fidx float64, bytesPerSample, channels int,
165150 return float64(len(wav))
166151 }
167152
168-// ------------------------------------------------------------------
169-// Normalizer
170-
171153 type Normalizer struct {
172154 mul float64
173155 l, r *NormalizerLR
@@ -228,9 +210,6 @@ func (n *NormalizerLR) process(bai float64, sam *float32) float64 {
228210 return bai
229211 }
230212
231-// ------------------------------------------------------------------
232-// Vorbis
233-
234213 type Vorbis struct {
235214 dec *vorbis.Vorbis
236215 fp *os.File
@@ -243,12 +222,9 @@ type Vorbis struct {
243222 func newVorbis() *Vorbis {
244223 return &Vorbis{openReq: make(chan string, 1), normalizer: NewNormalizer()}
245224 }
246-
247-// Opens a file asynchronously
248225 func (v *Vorbis) Open(file string) {
249226 v.openReq <- file
250227 }
251-
252228 func (v *Vorbis) openFile(file string) bool {
253229 v.clear()
254230 var err error
@@ -257,7 +233,6 @@ func (v *Vorbis) openFile(file string) bool {
257233 }
258234 return v.restart()
259235 }
260-
261236 func (v *Vorbis) restart() bool {
262237 if v.fp == nil {
263238 return false
@@ -271,7 +246,6 @@ func (v *Vorbis) restart() bool {
271246 v.buf = nil
272247 return true
273248 }
274-
275249 func (v *Vorbis) clear() {
276250 if v.dec != nil {
277251 v.dec = nil
@@ -281,7 +255,6 @@ func (v *Vorbis) clear() {
281255 v.fp = nil
282256 }
283257 }
284-
285258 func (v *Vorbis) samToAudioOut(buf [][]float32) (out []int16) {
286259 var o1i int
287260 if len(buf) == 1 {
@@ -303,7 +276,6 @@ func (v *Vorbis) samToAudioOut(buf [][]float32) (out []int16) {
303276 v.bufi -= float64(int(v.bufi))
304277 return
305278 }
306-
307279 func (v *Vorbis) read() []int16 {
308280 select {
309281 case file := <-v.openReq:
@@ -330,67 +302,6 @@ func (v *Vorbis) read() []int16 {
330302 return sys.nullSndBuf[:]
331303 }
332304
333-// ------------------------------------------------------------------
334-// Bgm
335-
336-type Bgm struct {
337- filename string
338- vorbis *Vorbis
339- ctrlmp3 *beep.Ctrl
340-}
341-
342-func newBgm() *Bgm {
343- return &Bgm{
344- vorbis: newVorbis(),
345- }
346-}
347-
348-func (bgm *Bgm) IsVorbis() bool {
349- return filepath.Ext(bgm.filename) == ".ogg"
350-}
351-
352-func (bgm *Bgm) IsMp3() bool {
353- return filepath.Ext(bgm.filename) == ".mp3"
354-}
355-
356-func (bgm *Bgm) Open(filename string) {
357- if filepath.Base(bgm.filename) != filepath.Base(filename) {
358- bgm.filename = filename
359- speaker.Clear()
360-
361- if bgm.IsVorbis() {
362- bgm.vorbis.Open(filename)
363- } else if bgm.IsMp3() {
364- bgm.ReadMp3()
365- }
366- }
367-}
368-
369-func (bgm *Bgm) ReadMp3() {
370- f, _ := os.Open(bgm.filename)
371- s, format, err := mp3.Decode(f)
372- if err != nil {
373- return
374- }
375- streamer := beep.Loop(-1, s)
376- bgm.ctrlmp3 = &beep.Ctrl{Streamer: streamer}
377- speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/20))
378- speaker.Play(bgm.ctrlmp3)
379- return
380-}
381-func (bgm *Bgm) Mp3Paused() {
382- speaker.Lock()
383- bgm.ctrlmp3.Paused = true
384- speaker.Unlock()
385- return
386-}
387-func (bgm *Bgm) ReadVorbis() []int16 {
388- return bgm.vorbis.read()
389-}
390-
391-// ------------------------------------------------------------------
392-// Wave
393-
394305 type Wave struct {
395306 SamplesPerSec uint32
396307 Channels uint16
@@ -489,18 +400,12 @@ func ReadWave(f *os.File, ofs int64) (*Wave, error) {
489400 return &w, nil
490401 }
491402
492-// ------------------------------------------------------------------
493-// Snd
494-
495403 type Snd struct {
496404 table map[[2]int32]*Wave
497405 ver, ver2 uint16
498406 }
499407
500-func newSnd() *Snd {
501- return &Snd{table: make(map[[2]int32]*Wave)}
502-}
503-
408+func newSnd() *Snd { return &Snd{table: make(map[[2]int32]*Wave)} }
504409 func LoadSnd(filename string) (*Snd, error) {
505410 s := newSnd()
506411 f, err := os.Open(filename)
@@ -573,9 +478,6 @@ func (s *Snd) play(gn [2]int32) bool {
573478 return c.sound != nil
574479 }
575480
576-// ------------------------------------------------------------------
577-// Sound
578-
579481 type Sound struct {
580482 sound *Wave
581483 volume int16
--- a/src/stage.go
+++ b/src/stage.go
@@ -83,41 +83,34 @@ func (bga *bgAction) action() {
8383 }
8484
8585 type backGround struct {
86- anim Animation
87- bga bgAction
88- id int32
89- start [2]float32
90- xofs float32
91- camstartx float32
92- delta [2]float32
93- xscale [2]float32
94- rasterx [2]float32
95- yscalestart float32
96- yscaledelta float32
97- actionno int32
98- startv [2]float32
99- startrad [2]float32
100- startsint [2]int32
101- startsinlt [2]int32
102- visible bool
103- active bool
104- positionlink bool
105- toplayer bool
106- autoresizeparallax bool
107- notmaskwindow int32
108- startrect [4]int32
109- windowdelta [2]float32
110- scalestart [2]float32
111- scaledelta [2]float32
112- zoomdelta [2]float32
113- zoomscaledelta [2]float32
114- xbottomzoomdelta float32
86+ anim Animation
87+ bga bgAction
88+ id int32
89+ start [2]float32
90+ xofs float32
91+ camstartx float32
92+ delta [2]float32
93+ xscale [2]float32
94+ rasterx [2]float32
95+ yscalestart float32
96+ yscaledelta float32
97+ actionno int32
98+ startv [2]float32
99+ startrad [2]float32
100+ startsint [2]int32
101+ startsinlt [2]int32
102+ visible bool
103+ active bool
104+ positionlink bool
105+ toplayer bool
106+ startrect [4]int32
107+ windowdelta [2]float32
115108 }
116109
117110 func newBackGround(sff *Sff) *backGround {
118- return &backGround{anim: *newAnimation(sff), delta: [...]float32{1, 1}, zoomdelta: [...]float32{math.MaxFloat32, math.MaxFloat32},
119- xscale: [...]float32{1, 1}, rasterx: [...]float32{1, 1}, yscalestart: 100, scalestart: [...]float32{1, 1}, xbottomzoomdelta: math.MaxFloat32,
120- zoomscaledelta: [...]float32{1, 1}, actionno: -1, visible: true, active: true, autoresizeparallax: true,
111+ return &backGround{anim: *newAnimation(sff), delta: [...]float32{1, 1},
112+ xscale: [...]float32{1, 1}, rasterx: [...]float32{1, 1}, yscalestart: 100,
113+ actionno: -1, visible: true, active: true,
121114 startrect: [...]int32{-32768, -32768, 65535, 65535}}
122115 }
123116 func readBackGround(is IniSection, link *backGround,
@@ -166,17 +159,8 @@ func readBackGround(is IniSection, link *backGround,
166159 bg.startv = link.startv
167160 bg.delta = link.delta
168161 }
169- is.ReadBool("autoresizeparallax", &bg.autoresizeparallax)
170162 is.readF32ForStage("start", &bg.start[0], &bg.start[1])
171163 is.readF32ForStage("delta", &bg.delta[0], &bg.delta[1])
172- is.readF32ForStage("scalestart", &bg.scalestart[0], &bg.scalestart[1])
173- is.readF32ForStage("scaledelta", &bg.scaledelta[0], &bg.scaledelta[1])
174- is.readF32ForStage("xbottomzoomdelta", &bg.xbottomzoomdelta)
175- is.readF32ForStage("zoomscaledelta", &bg.zoomscaledelta[0], &bg.zoomscaledelta[1])
176- is.readF32ForStage("zoomdelta", &bg.zoomdelta[0], &bg.zoomdelta[1])
177- if bg.zoomdelta[0] != math.MaxFloat32 && bg.zoomdelta[1] == math.MaxFloat32 {
178- bg.zoomdelta[1] = bg.zoomdelta[0]
179- }
180164 if t != 1 {
181165 if is.ReadI32("mask", &tmp) {
182166 if tmp != 0 {
@@ -185,46 +169,38 @@ func readBackGround(is IniSection, link *backGround,
185169 bg.anim.mask = -1
186170 }
187171 }
188- }
189- switch strings.ToLower(is["trans"]) {
190- case "add":
191- bg.anim.mask = 0
192- bg.anim.srcAlpha = 255
193- bg.anim.dstAlpha = 255
194- s, d := int32(bg.anim.srcAlpha), int32(bg.anim.dstAlpha)
195- if is.readI32ForStage("alpha", &s, &d) {
196- bg.anim.srcAlpha = int16(Max(0, Min(255, s)))
197- bg.anim.dstAlpha = int16(Max(0, Min(255, d)))
198- if bg.anim.srcAlpha == 1 && bg.anim.dstAlpha == 255 {
199- bg.anim.srcAlpha = 0
200- }
201- }
202- case "add1":
203- bg.anim.mask = 0
204- bg.anim.srcAlpha = 255
205- bg.anim.dstAlpha = ^255
206- var s, d int32 = 255, 255
207- if is.readI32ForStage("alpha", &s, &d) {
208- bg.anim.srcAlpha = int16(Min(255, s))
209- bg.anim.dstAlpha = ^int16(Max(0, Min(255, d)))
210- }
211- case "addalpha":
212- bg.anim.mask = 0
213- s, d := int32(bg.anim.srcAlpha), int32(bg.anim.dstAlpha)
214- if is.readI32ForStage("alpha", &s, &d) {
215- bg.anim.srcAlpha = int16(Max(0, Min(255, s)))
216- bg.anim.dstAlpha = int16(Max(0, Min(255, d)))
217- if bg.anim.srcAlpha == 1 && bg.anim.dstAlpha == 255 {
218- bg.anim.srcAlpha = 0
219- }
220- }
221- case "sub":
222- bg.anim.mask = 0
223- bg.anim.srcAlpha = 1
224- bg.anim.dstAlpha = 255
225- case "none":
226- bg.anim.srcAlpha = -1
227- bg.anim.dstAlpha = 0
172+ switch strings.ToLower(is["trans"]) {
173+ case "add":
174+ bg.anim.mask = 0
175+ bg.anim.srcAlpha = 255
176+ bg.anim.dstAlpha = 255
177+ case "add1":
178+ bg.anim.mask = 0
179+ bg.anim.srcAlpha = 255
180+ bg.anim.dstAlpha = ^255
181+ var s, d int32 = 255, 255
182+ if is.readI32ForStage("alpha", &s, &d) {
183+ bg.anim.srcAlpha = int16(Min(255, s))
184+ bg.anim.dstAlpha = ^int16(Max(0, Min(255, s)))
185+ }
186+ case "addalpha":
187+ bg.anim.mask = 0
188+ s, d := int32(bg.anim.srcAlpha), int32(bg.anim.dstAlpha)
189+ if is.readI32ForStage("alpha", &s, &d) {
190+ bg.anim.srcAlpha = int16(Max(0, Min(255, s)))
191+ bg.anim.dstAlpha = int16(Max(0, Min(255, d)))
192+ if bg.anim.srcAlpha == 1 && bg.anim.dstAlpha == 255 {
193+ bg.anim.srcAlpha = 0
194+ }
195+ }
196+ case "sub":
197+ bg.anim.mask = 0
198+ bg.anim.srcAlpha = 1
199+ bg.anim.dstAlpha = 255
200+ case "none":
201+ bg.anim.srcAlpha = -1
202+ bg.anim.dstAlpha = 0
203+ }
228204 }
229205 if is.readI32ForStage("tile", &bg.anim.tile[2], &bg.anim.tile[3]) {
230206 if t == 2 {
@@ -262,13 +238,6 @@ func readBackGround(is IniSection, link *backGround,
262238 &bg.startrect[2], &bg.startrect[3]) {
263239 bg.startrect[2] = Max(0, bg.startrect[2]+1-bg.startrect[0])
264240 bg.startrect[3] = Max(0, bg.startrect[3]+1-bg.startrect[1])
265- bg.notmaskwindow = 1
266- }
267- if is.readI32ForStage("maskwindow", &bg.startrect[0], &bg.startrect[1],
268- &bg.startrect[2], &bg.startrect[3]) {
269- bg.startrect[2] = Max(0, bg.startrect[2]-bg.startrect[0])
270- bg.startrect[3] = Max(0, bg.startrect[3]-bg.startrect[1])
271- bg.notmaskwindow = 0
272241 }
273242 is.readF32ForStage("windowdelta", &bg.windowdelta[0], &bg.windowdelta[1])
274243 is.ReadI32("id", &bg.id)
@@ -315,30 +284,16 @@ func (bg backGround) draw(pos [2]float32, scl, bgscl, lclscl float32,
315284 xras := (bg.rasterx[1] - bg.rasterx[0]) / bg.rasterx[0]
316285 xbs, dx := bg.xscale[1], MaxF(0, bg.delta[0]*bgscl)
317286 sclx := MaxF(0, scl+(1-scl)*(1-dx))
318- scly := MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.delta[1]*bgscl)))
319- var sclx_recip float32 = 1
320287 lscl := [...]float32{lclscl * stgscl[0], lclscl * stgscl[1]}
321- if sclx != 0 && bg.autoresizeparallax == true {
288+ if sclx != 0 {
322289 tmp := 1 / sclx
323- if bg.xbottomzoomdelta != math.MaxFloat32 {
324- xbs *= MaxF(0, scl+(1-scl)*(1-bg.xbottomzoomdelta*(xbs/bg.xscale[0]))) * tmp
325- } else {
326- xbs *= MaxF(0, scl+(1-scl)*(1-dx*(xbs/bg.xscale[0]))) * tmp
327- }
290+ xbs *= MaxF(0, scl+(1-scl)*(1-dx*(xbs/bg.xscale[0]))) * tmp
328291 tmp *= MaxF(0, scl+(1-scl)*(1-dx*(xras+1)))
329292 xras -= tmp - 1
330293 xbs *= tmp
331294 }
332- if bg.zoomdelta[0] != math.MaxFloat32 {
333- sclx = scl + (1-scl)*(1-bg.zoomdelta[0])
334- scly = scl + (1-scl)*(1-bg.zoomdelta[1])
335- if bg.autoresizeparallax == false {
336- sclx_recip = (1 + bg.zoomdelta[0]*((1/(sclx*lscl[0])*lscl[0])-1))
337- }
338- }
339-
340- scly *= lclscl
341295 sclx *= lscl[0]
296+ scly := MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.delta[1]*bgscl))) * lclscl
342297 x := bg.start[0] + bg.xofs - (pos[0]/stgscl[0]+bg.camstartx)*bg.delta[0] +
343298 bg.bga.offset[0]
344299 y := bg.start[1] - (pos[1]/stgscl[1])*bg.delta[1] + bg.bga.offset[1]
@@ -352,33 +307,27 @@ func (bg backGround) draw(pos [2]float32, scl, bgscl, lclscl float32,
352307 }
353308 }
354309 ys := (100 - pos[1]*bg.yscaledelta) * bgscl / bg.yscalestart
355- ys2 := bg.scaledelta[1] * pos[1] * bg.delta[1] * bgscl
356- xs := bg.scaledelta[0] * pos[0] * bg.delta[0] * bgscl
357- xs3 := 1 + (1-scl)*(1-bg.zoomscaledelta[0])
358- ys3 := 1 + (1-scl)*(1-bg.zoomscaledelta[1])
359310 x *= bgscl
360311 y = y*bgscl + ((float32(sys.gameHeight)-shakeY)/scly-240)/stgscl[1]
361312 scly *= stgscl[1]
362313 rect := bg.startrect
363314 var wscl [2]float32
364315 for i := range wscl {
365- if bg.zoomdelta[i] != math.MaxFloat32 {
366- wscl[i] = MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.zoomdelta[i]))) *
367- bgscl * lscl[i]
368- } else {
369- wscl[i] = MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.windowdelta[i]*bgscl))) *
370- bgscl * lscl[i]
371- }
372- }
373- startrect0 := (float32(rect[0]) - (pos[0]+bg.camstartx)*bg.windowdelta[0] + (float32(sys.gameWidth)/2/sclx - float32(bg.notmaskwindow)*160*(1/lscl[0]))) * sys.widthScale * wscl[0]
374- startrect1 := ((float32(rect[1])-pos[1]*bg.windowdelta[1]+(float32(sys.gameHeight)/scly-240))*wscl[1] - shakeY) * sys.heightScale
375- rect[0] = int32(math.Floor(float64(startrect0)))
376- rect[1] = int32(math.Floor(float64(startrect1)))
377- rect[2] = int32(math.Floor(float64(startrect0 + (float32(rect[2]) * sys.widthScale * wscl[0]) - float32(rect[0]))))
378- rect[3] = int32(math.Floor(float64(startrect1 + (float32(rect[3]) * sys.heightScale * wscl[1]) - float32(rect[1]))))
379- bg.anim.Draw(&rect, x, y, sclx, scly, bg.xscale[0]*bgscl*(bg.scalestart[0]+xs)*xs3, xbs*bgscl*(bg.scalestart[0]+xs)*xs3, ys*(bg.scalestart[1]+ys2)*ys3,
380- xras*x/(AbsF(ys*ys3)*lscl[1]*float32(bg.anim.spr.Size[1]))*sclx_recip,
381- +0, 0, 0, float32(sys.gameWidth)/2, &sys.bgPalFX, true, 1)
316+ wscl[i] = MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.windowdelta[i]*bgscl))) *
317+ bgscl * lscl[i]
318+ }
319+ rect[0] = int32(math.Floor(float64((float32(rect[0]) -
320+ (pos[0]+bg.camstartx)*bg.windowdelta[0]) * sys.widthScale * wscl[0])))
321+ rect[1] = int32(math.Floor(float64(((float32(rect[1])-
322+ pos[1]*bg.windowdelta[1])*wscl[1] - shakeY + float32(sys.gameHeight-240)) *
323+ sys.heightScale)))
324+ rect[2] = int32(math.Ceil(float64(float32(rect[2]) * sys.widthScale *
325+ wscl[0])))
326+ rect[3] = int32(math.Ceil(float64(float32(rect[3]) * sys.heightScale *
327+ wscl[1])))
328+ bg.anim.Draw(&rect, x, y, sclx, scly, bg.xscale[0]*bgscl, xbs*bgscl, ys,
329+ xras*x/(AbsF(ys)*lscl[1]*float32(bg.anim.spr.Size[1])),
330+ 0, float32(sys.gameWidth)/2, &sys.bgPalFX, true)
382331 }
383332
384333 type bgCtrl struct {
@@ -633,7 +582,6 @@ func loadStage(def string) (*Stage, error) {
633582 sec[0].ReadI32("tension", &sys.cam.tension)
634583 sec[0].ReadI32("floortension", &sys.cam.floortension)
635584 sec[0].ReadI32("overdrawlow", &sys.cam.overdrawlow)
636- sec[0].ReadF32("zoomout", &sys.cam.mugen_zoomout)
637585 }
638586 if sec := defmap["playerinfo"]; len(sec) > 0 {
639587 sec[0].ReadI32("p1startx", &s.p[0].startx)
@@ -660,14 +608,6 @@ func loadStage(def string) (*Stage, error) {
660608 sec[0].ReadF32("xscale", &s.scale[0])
661609 sec[0].ReadF32("yscale", &s.scale[1])
662610 }
663- if s.hires {
664- if s.scale[0] != 1 {
665- s.scale[0] *= 2
666- }
667- if s.scale[1] != 1 {
668- s.scale[1] *= 2
669- }
670- }
671611 reflect := true
672612 if sec := defmap["shadow"]; len(sec) > 0 {
673613 var tmp int32
@@ -709,7 +649,7 @@ func loadStage(def string) (*Stage, error) {
709649 }
710650 var bglink *backGround
711651 for _, bgsec := range defmap["bg"] {
712- if len(s.bg) > 0 && !s.bg[len(s.bg)-1].positionlink {
652+ if len(s.bg) > 0 && s.bg[len(s.bg)-1].positionlink {
713653 bglink = s.bg[len(s.bg)-1]
714654 }
715655 s.bg = append(s.bg, readBackGround(bgsec, bglink,
@@ -812,16 +752,8 @@ func (s *Stage) runBgCtrl(bgc *bgCtrl) {
812752 a := s.at.get(bgc.v[0])
813753 if a != nil {
814754 for i := range bgc.bg {
815- masktemp := bgc.bg[i].anim.mask
816- srcAlphatemp := bgc.bg[i].anim.srcAlpha
817- dstAlphatemp := bgc.bg[i].anim.dstAlpha
818- tiletmp := bgc.bg[i].anim.tile
819755 bgc.bg[i].actionno = bgc.v[0]
820756 bgc.bg[i].anim = *a
821- bgc.bg[i].anim.tile = tiletmp
822- bgc.bg[i].anim.dstAlpha = dstAlphatemp
823- bgc.bg[i].anim.srcAlpha = srcAlphatemp
824- bgc.bg[i].anim.mask = masktemp
825757 }
826758 }
827759 case BT_Visible:
--- a/src/stdout_windows.go
+++ /dev/null
@@ -1,20 +0,0 @@
1-// +build windows
2-package main
3-
4-import (
5- "os"
6- "syscall"
7-)
8-
9-func init() {
10- modkernel32 := syscall.NewLazyDLL("kernel32.dll")
11- procAllocConsole := modkernel32.NewProc("AllocConsole")
12- syscall.Syscall(procAllocConsole.Addr(), 0, 0, 0, 0)
13- hout, err1 := syscall.GetStdHandle(syscall.STD_OUTPUT_HANDLE)
14- hin, err2 := syscall.GetStdHandle(syscall.STD_INPUT_HANDLE)
15- if err1 != nil || err2 != nil { // nowhere to print the message
16- syscall.Exit(2)
17- }
18- os.Stdout = os.NewFile(uintptr(hout), "/dev/stdout")
19- os.Stdin = os.NewFile(uintptr(hin), "/dev/stdin")
20-}
--- a/src/system.go
+++ b/src/system.go
@@ -3,6 +3,10 @@ package main
33 import (
44 "bufio"
55 "fmt"
6+ "github.com/go-gl/gl/v2.1/gl"
7+ "github.com/go-gl/glfw/v3.2/glfw"
8+ "github.com/timshannon/go-openal/openal"
9+ "github.com/yuin/gopher-lua"
610 "io/ioutil"
711 "log"
812 "math"
@@ -11,18 +15,12 @@ import (
1115 "strings"
1216 "sync"
1317 "time"
14-
15- "github.com/go-gl/gl/v2.1/gl"
16- "github.com/go-gl/glfw/v3.2/glfw"
17- "github.com/timshannon/go-openal/openal"
18- "github.com/yuin/gopher-lua"
1918 )
2019
2120 const (
22- MaxSimul = 4
23- MaxAttachedChar = 2
24- FPS = 60
25- P1P3Dist = 25
21+ MaxSimul = 4
22+ FPS = 60
23+ P1P3Dist = 25
2624 )
2725
2826 var sys = System{
@@ -35,7 +33,7 @@ var sys = System{
3533 lifeMul: 1, team1VS2Life: 1,
3634 turnsRecoveryRate: 1.0 / 300,
3735 mixer: *newMixer(),
38- bgm: *newBgm(),
36+ bgm: *newVorbis(),
3937 sounds: newSounds(16),
4038 allPalFX: *newPalFX(),
4139 bgPalFX: *newPalFX(),
@@ -57,8 +55,6 @@ var sys = System{
5755 workpal: make([]uint32, 256),
5856 errLog: log.New(os.Stderr, "", 0),
5957 audioClose: make(chan bool, 1),
60- keyInput: glfw.KeyUnknown,
61- keyString: "",
6258 }
6359
6460 type TeamMode int32
@@ -87,7 +83,7 @@ type System struct {
8783 debugScript string
8884 debugDraw bool
8985 mixer Mixer
90- bgm Bgm
86+ bgm Vorbis
9187 audioContext *openal.Context
9288 nullSndBuf [audioOutLen * 2]int16
9389 sounds Sounds
@@ -97,15 +93,14 @@ type System struct {
9793 keySatate map[glfw.Key]bool
9894 netInput *NetInput
9995 fileInput *FileInput
100- aiInput [MaxSimul*2 + MaxAttachedChar]AiInput
96+ aiInput [MaxSimul * 2]AiInput
10197 keyConfig []KeyConfig
102- JoystickConfig []KeyConfig
103- com [MaxSimul*2 + MaxAttachedChar]int32
98+ com [MaxSimul * 2]int32
10499 autolevel bool
105100 home int
106101 gameTime int32
107102 match int32
108- inputRemap [MaxSimul*2 + MaxAttachedChar]int
103+ inputRemap [MaxSimul * 2]int
109104 listenPort string
110105 round int32
111106 intro int32
@@ -116,15 +111,15 @@ type System struct {
116111 roundsExisted [2]int32
117112 draws int32
118113 loader Loader
119- chars [MaxSimul*2 + MaxAttachedChar][]*Char
114+ chars [MaxSimul * 2][]*Char
120115 charList CharList
121- cgi [MaxSimul*2 + MaxAttachedChar]CharGlobalInfo
116+ cgi [MaxSimul * 2]CharGlobalInfo
122117 tmode [2]TeamMode
123118 numSimul, numTurns [2]int32
124119 esc bool
125120 loadMutex sync.Mutex
126121 ignoreMostErrors bool
127- stringPool [MaxSimul*2 + MaxAttachedChar]StringPool
122+ stringPool [MaxSimul * 2]StringPool
128123 bcStack, bcVarStack BytecodeStack
129124 bcVar []BytecodeValue
130125 workingChar *Char
@@ -154,7 +149,7 @@ type System struct {
154149 envcol [3]int32
155150 envcol_time int32
156151 envcol_under bool
157- clipboardText [MaxSimul*2 + MaxAttachedChar][]string
152+ clipboardText [MaxSimul * 2][]string
158153 stage *Stage
159154 helperMax int32
160155 nextCharId int32
@@ -184,10 +179,10 @@ type System struct {
184179 finish FinishType
185180 waitdown int32
186181 shuttertime int32
187- projs [MaxSimul*2 + MaxAttachedChar][]Projectile
188- explods [MaxSimul*2 + MaxAttachedChar][]Explod
189- explDrawlist [MaxSimul*2 + MaxAttachedChar][]int
190- topexplDrawlist [MaxSimul*2 + MaxAttachedChar][]int
182+ projs [MaxSimul * 2][]Projectile
183+ explods [MaxSimul * 2][]Explod
184+ explDrawlist [MaxSimul * 2][]int
185+ topexplDrawlist [MaxSimul * 2][]int
191186 changeStateNest int32
192187 sprites DrawList
193188 topSprites DrawList
@@ -197,7 +192,7 @@ type System struct {
197192 drawc2sp ClsnRect
198193 drawc2mtk ClsnRect
199194 drawwh ClsnRect
200- autoguard [MaxSimul*2 + MaxAttachedChar]bool
195+ autoguard [MaxSimul * 2]bool
201196 clsnDraw bool
202197 accel float32
203198 statusDraw bool
@@ -210,17 +205,6 @@ type System struct {
210205 audioClose chan bool
211206 nomusic bool
212207 workBe []BytecodeExp
213- teamLifeShare bool
214- fullscreen bool
215- aiRandomColor bool
216- allowDebugKeys bool
217- commonAir string
218- commonCmd string
219- keyInput glfw.Key
220- keyString string
221- timerCount []int32
222- cmdFlags map[string]string
223- quickLaunch bool
224208 }
225209
226210 func (s *System) init(w, h int32) *lua.LState {
@@ -229,17 +213,11 @@ func (s *System) init(w, h int32) *lua.LState {
229213 glfw.WindowHint(glfw.ContextVersionMinor, 1)
230214 s.setWindowSize(w, h)
231215 var err error
232- if s.fullscreen {
233- s.window, err = glfw.CreateWindow(int(s.scrrect[2]), int(s.scrrect[3]),
234- "Ikemen GO", glfw.GetPrimaryMonitor(), nil)
235- } else {
236- s.window, err = glfw.CreateWindow(int(s.scrrect[2]), int(s.scrrect[3]),
237- "Ikemen GO", nil, nil)
238- }
216+ s.window, err = glfw.CreateWindow(int(s.scrrect[2]), int(s.scrrect[3]),
217+ "Ikemen GO", nil, nil)
239218 chk(err)
240219 s.window.MakeContextCurrent()
241220 s.window.SetKeyCallback(keyCallback)
242- s.window.SetCharModsCallback(charCallback)
243221 glfw.SwapInterval(1)
244222 chk(gl.Init())
245223 RenderInit()
@@ -392,15 +370,7 @@ func (s *System) soundWrite() {
392370 if bgmSrc.Src.BuffersProcessed() > 0 {
393371 out := s.nullSndBuf[:]
394372 if !s.nomusic {
395- if s.bgm.IsVorbis() {
396- out = s.bgm.ReadVorbis()
397- } else if s.bgm.IsMp3() && s.bgm.ctrlmp3 != nil {
398- s.bgm.ctrlmp3.Paused = false
399- }
400- } else {
401- if s.bgm.IsMp3() && s.bgm.ctrlmp3 != nil {
402- s.bgm.Mp3Paused()
403- }
373+ out = s.bgm.read()
404374 }
405375 buf := bgmSrc.Src.UnqueueBuffer()
406376 buf.SetDataInt16(openal.FormatStereo16, out, audioFrequency)
@@ -456,11 +426,6 @@ func (s *System) anyHardButton() bool {
456426 return true
457427 }
458428 }
459- for _, kc := range s.JoystickConfig {
460- if kc.A() || kc.B() || kc.C() || kc.X() || kc.Y() || kc.Z() {
461- return true
462- }
463- }
464429 return false
465430 }
466431 func (s *System) anyButton() bool {
@@ -641,15 +606,11 @@ func (s *System) nextRound() {
641606 }
642607 }
643608 }
644-func (s *System) debugPaused() bool {
645- return s.paused && !s.step && s.oldTickCount < s.tickCount
646-}
647609 func (s *System) tickFrame() bool {
648- return (!s.paused || s.step) && s.oldTickCount < s.tickCount
610+ return s.oldTickCount < s.tickCount
649611 }
650612 func (s *System) tickNextFrame() bool {
651- return int(s.tickCountF+s.nextAddTime) > s.tickCount &&
652- !s.paused || s.step || s.oldTickCount >= s.tickCount
613+ return int(s.tickCountF+s.nextAddTime) > s.tickCount
653614 }
654615 func (s *System) tickInterpola() float32 {
655616 if s.tickNextFrame() {
@@ -658,10 +619,6 @@ func (s *System) tickInterpola() float32 {
658619 return s.tickCountF - s.lastTick + s.nextAddTime
659620 }
660621 func (s *System) addFrameTime(t float32) bool {
661- if s.debugPaused() {
662- s.oldNextAddTime = 0
663- return true
664- }
665622 s.oldTickCount = s.tickCount
666623 if int(s.tickCountF) > s.tickCount {
667624 s.tickCount++
@@ -818,8 +775,8 @@ func (s *System) action(x, y *float32, scl float32) (leftest, rightest,
818775 s.lifebar.step()
819776 if s.superanim != nil {
820777 s.topSprites.add(&SprData{s.superanim, &s.superpmap, s.superpos,
821- [...]float32{s.superfacing, 1}, [2]int32{-1}, 5, 0, 0, 0, [2]float32{},
822- false, true, s.cgi[s.superplayer].ver[0] != 1, 1}, 0, 0, 0, 0)
778+ [...]float32{s.superfacing, 1}, [2]int32{-1}, 5, 0, [2]float32{},
779+ false, true, s.cgi[s.superplayer].ver[0] != 1}, 0, 0, 0, 0)
823780 if s.superanim.loopend {
824781 s.superanim = nil
825782 }
@@ -927,7 +884,7 @@ func (s *System) action(x, y *float32, scl float32) (leftest, rightest,
927884 ko := [...]bool{true, true}
928885 for ii := range ko {
929886 for i := ii; i < len(s.chars); i += 2 {
930- if len(s.chars[i]) > 0 && s.chars[i][0].alive() && s.chars[i][0].teamside < 2 {
887+ if len(s.chars[i]) > 0 && s.chars[i][0].alive() {
931888 ko[ii] = false
932889 break
933890 }
@@ -1093,8 +1050,11 @@ func (s *System) action(x, y *float32, scl float32) (leftest, rightest,
10931050 s.intro = 0
10941051 }
10951052 }
1096- if s.tickNextFrame() {
1053+ if s.turbo == 0 || s.tickNextFrame() {
10971054 spd := s.accel
1055+ if s.paused && !s.step {
1056+ spd = 0
1057+ }
10981058 _else := s.sf(GSF_nokoslow) || s.time == 0
10991059 if !_else {
11001060 slowt := -(s.lifebar.ro.over_hittime + (s.lifebar.ro.slow_time+3)>>2)
@@ -1227,15 +1187,15 @@ func (s *System) draw(x, y, scl float32) {
12271187 }
12281188 s.brightness = ob
12291189 if s.clsnDraw {
1230- s.clsnSpr.Pal[0] = 0xff0000ff
1190+ s.clsnSpr.Pal[0] = 0x0000ff
12311191 s.drawc1.draw(0x3feff)
1232- s.clsnSpr.Pal[0] = 0xffff0000
1192+ s.clsnSpr.Pal[0] = 0xff0000
12331193 s.drawc2.draw(0x3feff)
1234- s.clsnSpr.Pal[0] = 0xff00ff00
1194+ s.clsnSpr.Pal[0] = 0x00ff00
12351195 s.drawc2sp.draw(0x3feff)
1236- s.clsnSpr.Pal[0] = 0xff002000
1196+ s.clsnSpr.Pal[0] = 0x002000
12371197 s.drawc2mtk.draw(0x3feff)
1238- s.clsnSpr.Pal[0] = 0xff404040
1198+ s.clsnSpr.Pal[0] = 0x404040
12391199 s.drawwh.draw(0x3feff)
12401200 }
12411201 }
@@ -1401,7 +1361,7 @@ func (s *System) fight() (reload bool) {
14011361 case TM_Simul:
14021362 lm *= s.team1VS2Life
14031363 case TM_Turns:
1404- if s.numTurns[(i+1)&1] < s.matchWins[(i+1)&1] && sys.teamLifeShare {
1364+ if s.numTurns[(i+1)&1] < s.matchWins[(i+1)&1] {
14051365 lm = lm * float32(s.numTurns[(i+1)&1]) /
14061366 float32(s.matchWins[(i+1)&1])
14071367 }
@@ -1409,33 +1369,31 @@ func (s *System) fight() (reload bool) {
14091369 case TM_Simul:
14101370 switch s.tmode[(i+1)&1] {
14111371 case TM_Simul:
1412- if s.numSimul[(i+1)&1] < s.numSimul[i&1] && sys.teamLifeShare {
1372+ if s.numSimul[(i+1)&1] < s.numSimul[i&1] {
14131373 lm = lm * float32(s.numSimul[(i+1)&1]) / float32(s.numSimul[i&1])
14141374 }
14151375 case TM_Turns:
1416- if s.numTurns[(i+1)&1] < s.numSimul[i&1]*s.matchWins[(i+1)&1] && sys.teamLifeShare {
1376+ if s.numTurns[(i+1)&1] < s.numSimul[i&1]*s.matchWins[(i+1)&1] {
14171377 lm = lm * float32(s.numTurns[(i+1)&1]) /
14181378 float32(s.numSimul[i&1]*s.matchWins[(i+1)&1])
14191379 }
14201380 default:
1421- if sys.teamLifeShare {
1422- lm /= float32(s.numSimul[i&1])
1423- }
1381+ lm /= float32(s.numSimul[i&1])
14241382 }
14251383 case TM_Turns:
14261384 switch s.tmode[(i+1)&1] {
14271385 case TM_Single:
1428- if s.matchWins[i&1] < s.numTurns[i&1] && sys.teamLifeShare {
1386+ if s.matchWins[i&1] < s.numTurns[i&1] {
14291387 lm = lm * float32(s.matchWins[i&1]) / float32(s.numTurns[i&1])
14301388 }
14311389 case TM_Simul:
1432- if s.numSimul[(i+1)&1]*s.matchWins[i&1] < s.numTurns[i&1] && sys.teamLifeShare {
1390+ if s.numSimul[(i+1)&1]*s.matchWins[i&1] < s.numTurns[i&1] {
14331391 lm = lm * s.team1VS2Life *
14341392 float32(s.numSimul[(i+1)&1]*s.matchWins[i&1]) /
14351393 float32(s.numTurns[i&1])
14361394 }
14371395 case TM_Turns:
1438- if s.numTurns[(i+1)&1] < s.numTurns[i&1] && sys.teamLifeShare {
1396+ if s.numTurns[(i+1)&1] < s.numTurns[i&1] {
14391397 lm = lm * float32(s.numTurns[(i+1)&1]) / float32(s.numTurns[i&1])
14401398 }
14411399 }
@@ -1532,7 +1490,10 @@ func (s *System) fight() (reload bool) {
15321490 break
15331491 }
15341492 }
1535- scl = s.cam.ScaleBound(scl, sclmul)
1493+ if s.turbo < 1 {
1494+ sclmul = Pow(sclmul, s.turbo)
1495+ }
1496+ scl = s.cam.ScaleBound(scl * sclmul)
15361497 tmp := (float32(s.gameWidth) / 2) / scl
15371498 if AbsF((l+r)-(newx-x)*2) >= tmp/2 {
15381499 tmp = MaxF(0, MinF(tmp, MaxF((newx-x)-l, r-(newx-x))))
@@ -1683,14 +1644,11 @@ func (wm wincntMap) getLevel(p int) int32 {
16831644 }
16841645
16851646 type SelectChar struct {
1686- def, name, sprite, intro_storyboard, ending_storyboard string
1687- pal_defaults []int32
1688- pal []int32
1689- portrait_scale float32
1690- sportrait, lportrait, vsportrait, vportrait *Sprite
1647+ def, name, sprite string
1648+ sportrait, lportrait *Sprite
16911649 }
16921650 type SelectStage struct {
1693- def, name, zoomout, zoomin, bgmusic, bgmvolume, attachedchardef string
1651+ def, name string
16941652 }
16951653 type Select struct {
16961654 columns, rows int
@@ -1703,17 +1661,12 @@ type Select struct {
17031661 curStageNo int
17041662 selected [2][][2]int
17051663 selectedStageNo int
1706- sportrait [2]int16
1707- lportrait [2]int16
1708- vsportrait [2]int16
1709- vportrait [2]int16
17101664 }
17111665
17121666 func newSelect() *Select {
17131667 return &Select{columns: 5, rows: 2, randomscl: [...]float32{1, 1},
17141668 cellsize: [...]float32{29, 29}, cellscale: [...]float32{1, 1},
1715- selectedStageNo: -1, sportrait: [...]int16{9000, 0}, lportrait: [...]int16{9000, 1},
1716- vsportrait: [...]int16{9000, 1}, vportrait: [...]int16{9000, 2}}
1669+ selectedStageNo: -1}
17171670 }
17181671 func (s *Select) GetCharNo(i int) int {
17191672 n := i
@@ -1750,13 +1703,6 @@ func (s *Select) GetStageName(n int) string {
17501703 }
17511704 return s.stagelist[n-1].name
17521705 }
1753-func (s *Select) GetStageInfo(n int) (zoomin, zoomout, bgmusic, bgmvolume string) {
1754- n %= len(s.stagelist) + 1
1755- if n < 0 {
1756- n += len(s.stagelist) + 1
1757- }
1758- return s.stagelist[n-1].zoomin, s.stagelist[n-1].zoomout, s.stagelist[n-1].bgmusic, s.stagelist[n-1].bgmvolume
1759-}
17601706 func (s *Select) addCahr(def string) {
17611707 s.charlist = append(s.charlist, SelectChar{})
17621708 sc := &s.charlist[len(s.charlist)-1]
@@ -1776,7 +1722,7 @@ func (s *Select) addCahr(def string) {
17761722 } else {
17771723 def += ".def"
17781724 }
1779- if strings.ToLower(def[0:6]) != "chars/" && strings.ToLower(def[1:3]) != ":/" && (def[0] != '/' || idx > 0 && strings.Index(def[:idx], ":") < 0) {
1725+ if def[0] != '/' || idx > 0 && strings.Index(def[:idx], ":") < 0 {
17801726 def = "chars/" + def
17811727 }
17821728 if def = FileExist(def); len(def) == 0 {
@@ -1787,7 +1733,7 @@ func (s *Select) addCahr(def string) {
17871733 return
17881734 }
17891735 sc.def = def
1790- lines, i, info, files, arcade, sprite := SplitAndTrim(str, "\n"), 0, true, true, true, ""
1736+ lines, i, info, files, sprite := SplitAndTrim(str, "\n"), 0, true, true, ""
17911737 for i < len(lines) {
17921738 is, name, _ := ReadIniSection(lines, &i)
17931739 switch name {
@@ -1799,55 +1745,25 @@ func (s *Select) addCahr(def string) {
17991745 if !ok {
18001746 sc.name, _, _ = is.getText("name")
18011747 }
1802- sc.pal_defaults = is.readI32CsvForStage("pal.defaults")
1803- ok = is.ReadF32("localcoord", &sc.portrait_scale)
1804- if !ok {
1805- sc.portrait_scale = 1
1806- } else {
1807- sc.portrait_scale = (320 / sc.portrait_scale)
1808- }
1809- is.ReadF32("portraitscale", &sc.portrait_scale)
18101748 }
18111749 case "files":
18121750 if files {
18131751 files = false
18141752 sprite = is["sprite"]
1815- for i := 1; i <= MaxPalNo; i++ {
1816- if is[fmt.Sprintf("pal%v", i)] != "" {
1817- sc.pal = append(sc.pal, int32(i))
1818- }
1819- }
1820- }
1821- case "arcade":
1822- if arcade {
1823- arcade = false
1824- sc.intro_storyboard, _ = is.getString("intro.storyboard")
1825- sc.ending_storyboard, _ = is.getString("ending.storyboard")
18261753 }
18271754 }
18281755 }
18291756 sc.sprite = sprite
18301757 LoadFile(&sprite, def, func(file string) error {
18311758 var err error
1832- sc.sportrait, err = loadFromSff(file, sys.sel.sportrait[0], sys.sel.sportrait[1])
1833- if sys.quickLaunch {
1834- sc.lportrait = sc.sportrait
1835- sc.vsportrait, sc.vportrait = sc.lportrait, sc.lportrait
1836- } else {
1837- sc.lportrait, err = loadFromSff(file, sys.sel.lportrait[0], sys.sel.lportrait[1])
1838- sc.vsportrait, err = loadFromSff(file, sys.sel.vsportrait[0], sys.sel.vsportrait[1])
1839- if err != nil {
1840- sc.vsportrait = sc.lportrait
1841- }
1842- sc.vportrait, err = loadFromSff(file, sys.sel.vportrait[0], sys.sel.vportrait[1])
1843- if err != nil {
1844- sc.vportrait = sc.lportrait
1845- }
1846- }
1847- if len(sc.pal) == 0 {
1848- sc.pal, _ = selectablePalettes(file)
1849- }
1850- return nil
1759+ sc.sportrait, err = loadFromSff(file, 9000, 0)
1760+ return err
1761+ })
1762+ sprite = sc.sprite
1763+ LoadFile(&sprite, def, func(file string) error {
1764+ var err error
1765+ sc.lportrait, err = loadFromSff(file, 9000, 1)
1766+ return err
18511767 })
18521768 }
18531769 func (s *Select) AddStage(def string) error {
@@ -1862,7 +1778,7 @@ func (s *Select) AddStage(def string) error {
18621778 }); err != nil {
18631779 return err
18641780 }
1865- i, info, camera, music := 0, true, true, true
1781+ i, info := 0, true
18661782 s.stagelist = append(s.stagelist, SelectStage{})
18671783 ss := &s.stagelist[len(s.stagelist)-1]
18681784 ss.def = def
@@ -1880,33 +1796,6 @@ func (s *Select) AddStage(def string) error {
18801796 ss.name = def
18811797 }
18821798 }
1883- ss.attachedchardef, ok = is.getString("attachedchar")
1884- }
1885- case "camera":
1886- if camera {
1887- camera = false
1888- var ok bool
1889- ss.zoomout, ok = is.getString("setzoommax")
1890- if !ok {
1891- ss.zoomout = ""
1892- }
1893- ss.zoomin, ok = is.getString("setzoommin")
1894- if !ok {
1895- ss.zoomin = ""
1896- }
1897- }
1898- case "music":
1899- if music {
1900- music = false
1901- var ok bool
1902- ss.bgmusic, ok = is.getString("bgmusic")
1903- if !ok {
1904- ss.bgmusic = "100"
1905- }
1906- ss.bgmvolume, ok = is.getString("bgmvolume")
1907- if !ok {
1908- ss.bgmvolume = "100"
1909- }
19101799 }
19111800 }
19121801 }
@@ -1999,13 +1888,7 @@ func (l *Loader) loadChar(pn int) int {
19991888 } else {
20001889 p = newChar(pn, 0)
20011890 sys.cgi[pn].sff = nil
2002- if len(sys.chars[pn]) > 0 {
2003- p.power = sys.chars[pn][0].power
2004- }
20051891 }
2006- p.memberNo = memberNo
2007- p.selectNo = sys.sel.selected[pn&1][memberNo][0]
2008- p.teamside = p.playerNo & 1
20091892 sys.chars[pn] = make([]*Char, 1)
20101893 sys.chars[pn][0] = p
20111894 if sys.cgi[pn].sff == nil {
@@ -2025,67 +1908,26 @@ func (l *Loader) loadChar(pn int) int {
20251908 if pn < len(sys.lifebar.fa[sys.tmode[pn&1]]) &&
20261909 sys.tmode[pn&1] == TM_Turns && sys.round == 1 {
20271910 fa := sys.lifebar.fa[sys.tmode[pn&1]][pn]
2028- fa.numko, fa.teammate_face, fa.teammate_scale = 0, make([]*Sprite, nsel), make([]float32, nsel)
1911+ fa.numko, fa.teammate_face = 0, make([]*Sprite, nsel)
20291912 for i, ci := range idx {
20301913 sprite := sys.sel.charlist[ci].sprite
20311914 LoadFile(&sprite, sys.sel.charlist[ci].def, func(file string) error {
20321915 var err error
20331916 fa.teammate_face[i], err = loadFromSff(file,
20341917 int16(fa.teammate_face_spr[0]), int16(fa.teammate_face_spr[1]))
2035- fa.teammate_scale[i] = sys.sel.charlist[ci].portrait_scale
20361918 return err
20371919 })
20381920 }
20391921 }
20401922 return 1
20411923 }
2042-
2043-func (l *Loader) loadAttachedChar(atcpn int, def string) int {
2044- pn := atcpn + MaxSimul*2
2045- cdef := def
2046- var p *Char
2047- if len(sys.chars[pn]) > 0 && cdef == sys.cgi[pn].def {
2048- p = sys.chars[pn][0]
2049- p.key = -pn
2050- } else {
2051- p = newChar(pn, 0)
2052- sys.cgi[pn].sff = nil
2053- if len(sys.chars[pn]) > 0 {
2054- p.power = sys.chars[pn][0].power
2055- }
2056- }
2057- p.memberNo = -atcpn
2058- p.selectNo = -atcpn
2059- p.teamside = 2
2060- sys.com[pn] = 8
2061- sys.chars[pn] = make([]*Char, 1)
2062- sys.chars[pn][0] = p
2063- if sys.cgi[pn].sff == nil {
2064- if sys.cgi[pn].states, l.err =
2065- newCompiler().Compile(p.playerNo, cdef); l.err != nil {
2066- sys.chars[pn] = nil
2067- return -1
2068- }
2069- if l.err = p.load(cdef); l.err != nil {
2070- sys.chars[pn] = nil
2071- return -1
2072- }
2073- }
2074- if sys.roundsExisted[pn&1] == 0 {
2075- sys.cgi[pn].palno = 1
2076- }
2077- return 1
2078-}
2079-
20801924 func (l *Loader) loadStage() bool {
20811925 if sys.round == 1 {
20821926 var def string
20831927 if sys.sel.selectedStageNo == 0 {
2084- randomstageno := Rand(0, int32(len(sys.sel.stagelist))-1)
2085- def = sys.sel.stagelist[randomstageno].def
1928+ def = sys.sel.stagelist[Rand(0, int32(len(sys.sel.stagelist))-1)].def
20861929 } else {
20871930 def = sys.sel.stagelist[sys.sel.selectedStageNo-1].def
2088- l.loadAttachedChar(0, sys.sel.stagelist[sys.sel.selectedStageNo-1].attachedchardef)
20891931 }
20901932 if sys.stage != nil && sys.stage.def == def {
20911933 return true