• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

Go で書き直した Ikemen


Commit MetaInfo

Revisionbf71913ba3881dad1e6a10babde2ba0f12084d88 (tree)
Zeit2016-12-21 01:45:39
AutorSUEHIRO <supersuehiro@user...>
CommiterSUEHIRO

Log Message

旧式トリガーのところを書くのが大変だった

Ändern Zusammenfassung

Diff

--- a/src/bytecode.go
+++ b/src/bytecode.go
@@ -5,7 +5,7 @@ import (
55 "unsafe"
66 )
77
8-type StateType uint32
8+type StateType int32
99
1010 const (
1111 ST_S StateType = 1 << iota
@@ -19,7 +19,7 @@ const (
1919 ST_P = ST_U
2020 )
2121
22-type AttackType uint32
22+type AttackType int32
2323
2424 const (
2525 AT_NA AttackType = 1 << (iota + 6)
@@ -33,7 +33,7 @@ const (
3333 AT_HP
3434 )
3535
36-type MoveType uint32
36+type MoveType int32
3737
3838 const (
3939 MT_I MoveType = 1 << (iota + 15)
@@ -67,6 +67,7 @@ const (
6767 OC_dup
6868 OC_swap
6969 OC_run
70+ OC_jsf8
7071 OC_jmp8
7172 OC_jz8
7273 OC_jnz8
@@ -187,7 +188,6 @@ const (
187188 OC_hitfall
188189 OC_hitvel_x
189190 OC_hitvel_y
190- OC_roundno
191191 OC_roundsexisted
192192 OC_parent
193193 OC_root
@@ -361,8 +361,10 @@ const (
361361 OC_ex_drawgame
362362 OC_ex_matchover
363363 OC_ex_matchno
364+ OC_ex_roundno
364365 OC_ex_ishometeam
365366 OC_ex_tickspersecond
367+ OC_ex_timemod
366368 )
367369
368370 type StringPool struct {
@@ -636,6 +638,16 @@ func (be BytecodeExp) run(c *Char, scpn int) BytecodeValue {
636638 orgc := c
637639 for i := 1; i <= len(be); i++ {
638640 switch be[i-1] {
641+ case OC_jsf8:
642+ if sys.bcStack.Top().IsSF() {
643+ if be[i] == 0 {
644+ i = len(be)
645+ } else {
646+ i += int(uint8(be[i])) + 1
647+ }
648+ } else {
649+ i++
650+ }
639651 case OC_jz8, OC_jnz8:
640652 if sys.bcStack.Top().ToB() == (be[i-1] == OC_jz8) {
641653 i++
@@ -749,10 +761,16 @@ func (be BytecodeExp) run(c *Char, scpn int) BytecodeValue {
749761 sys.bcStack.Push(BytecodeBool(c.alive()))
750762 case OC_random:
751763 sys.bcStack.Push(BytecodeInt(Rand(0, 999)))
764+ case OC_roundstate:
765+ sys.bcStack.Push(BytecodeInt(c.roundState()))
752766 case OC_anim:
753767 sys.bcStack.Push(BytecodeInt(c.animNo()))
754768 case OC_animtime:
755769 sys.bcStack.Push(BytecodeInt(c.animTime()))
770+ case OC_animelemtime:
771+ sys.bcStack.Push(BytecodeInt(c.animElemTime(sys.bcStack.Pop().ToI())))
772+ case OC_ex_:
773+ be.run_ex(c, scpn, &i)
756774 default:
757775 unimplemented()
758776 }
@@ -760,6 +778,13 @@ func (be BytecodeExp) run(c *Char, scpn int) BytecodeValue {
760778 }
761779 return sys.bcStack.Pop()
762780 }
781+func (be BytecodeExp) run_ex(c *Char, scpn int, i *int) {
782+ (*i)++
783+ switch be[*i-1] {
784+ case OC_ex_matchover:
785+ sys.bcStack.Push(BytecodeBool(sys.matchOver()))
786+ }
787+}
763788 func (be BytecodeExp) evalF(c *Char, scpn int) float32 {
764789 return be.run(c, scpn).ToF()
765790 }
@@ -1316,6 +1341,23 @@ func (sc ctrlSet) Run(c *Char, ps *int32) bool {
13161341 return false
13171342 }
13181343
1344+type hitDef StateControllerBase
1345+
1346+const (
1347+ hitDef_ byte = iota
1348+)
1349+
1350+func (sc hitDef) Run(c *Char, ps *int32) bool {
1351+ StateControllerBase(sc).run(c, ps, func(id byte, exp []BytecodeExp) bool {
1352+ switch id {
1353+ case hitDef_:
1354+ }
1355+ unimplemented()
1356+ return true
1357+ })
1358+ return false
1359+}
1360+
13191361 type StateBytecode struct {
13201362 stateType StateType
13211363 moveType MoveType
--- a/src/char.go
+++ b/src/char.go
@@ -296,26 +296,26 @@ func (cm *CharMovement) init() {
296296 cm.down.friction_threshold = 0.05
297297 }
298298
299-type Reaction1 int32
299+type Reaction int32
300300
301301 const (
302- AT_Light Reaction1 = iota
303- AT_Medium
304- AT_Hard
305- AT_Back
306- AT_Up
307- AT_Diagup
308- AT_Unknown
302+ RA_Light Reaction = iota
303+ RA_Medium
304+ RA_Hard
305+ RA_Back
306+ RA_Up
307+ RA_Diagup
308+ RA_Unknown
309309 )
310310
311-type Reaction2 int32
311+type HitType int32
312312
313313 const (
314- R2_None Reaction2 = iota
315- R2_High
316- R2_Low
317- R2_Trip
318- R2_Unknown
314+ HT_None HitType = iota
315+ HT_High
316+ HT_Low
317+ HT_Trip
318+ HT_Unknown
319319 )
320320
321321 type AiuchiType int32
@@ -327,7 +327,7 @@ const (
327327 )
328328
329329 type Fall struct {
330- animtype Reaction1
330+ animtype Reaction
331331 xvelocity float32
332332 yvelocity float32
333333 recover int32
@@ -341,23 +341,23 @@ type Fall struct {
341341 }
342342
343343 func (f *Fall) clear() {
344- *f = Fall{animtype: AT_Unknown, xvelocity: float32(math.NaN()),
344+ *f = Fall{animtype: RA_Unknown, xvelocity: float32(math.NaN()),
345345 yvelocity: -4.5}
346346 }
347347 func (f *Fall) setDefault() {
348- *f = Fall{animtype: AT_Unknown, xvelocity: float32(math.NaN()),
348+ *f = Fall{animtype: RA_Unknown, xvelocity: float32(math.NaN()),
349349 yvelocity: -4.5, recover: 1, recovertime: 4, kill: 1, envshake_freq: 60,
350350 envshake_ampl: -4, envshake_phase: float32(math.NaN())}
351351 }
352352
353353 type HitDef struct {
354- attr uint32
355- reversal_attr uint32
356- hitflag uint32
357- guardflag uint32
354+ attr int32
355+ reversal_attr int32
356+ hitflag int32
357+ guardflag int32
358358 affectteam int32
359- animtype Reaction1
360- air_animtype Reaction1
359+ animtype Reaction
360+ air_animtype Reaction
361361 priority int32
362362 bothhittype AiuchiType
363363 hitdamage int32
@@ -371,8 +371,8 @@ type HitDef struct {
371371 sparkxy [2]float32
372372 hitsound [2]int32
373373 guardsound [2]int32
374- ground_type Reaction2
375- air_type Reaction2
374+ ground_type HitType
375+ air_type HitType
376376 ground_slidetime int32
377377 guard_slidetime int32
378378 ground_hittime int32
@@ -432,19 +432,19 @@ type HitDef struct {
432432 snap [2]float32
433433 snapt int32
434434 fall Fall
435+ playerNo int
435436 kill bool
436437 guard_kill bool
437438 forcenofall bool
438439 lhit bool
439- playerNo int
440440 }
441441
442442 func (hd *HitDef) clear() {
443- *hd = HitDef{hitflag: uint32(ST_S | ST_C | ST_A | ST_F), affectteam: 1,
444- animtype: AT_Light, air_animtype: AT_Unknown, priority: 4,
443+ *hd = HitDef{hitflag: int32(ST_S | ST_C | ST_A | ST_F), affectteam: 1,
444+ animtype: RA_Light, air_animtype: RA_Unknown, priority: 4,
445445 bothhittype: AT_Hit, sparkno: IErr, guard_sparkno: IErr,
446446 hitsound: [2]int32{IErr, -1}, guardsound: [2]int32{IErr, -1},
447- ground_type: R2_High, air_type: R2_Unknown, air_hittime: 20,
447+ ground_type: HT_High, air_type: HT_Unknown, air_hittime: 20,
448448 yaccel: float32(math.NaN()), guard_velocity: float32(math.NaN()),
449449 airguard_velocity: [2]float32{float32(math.NaN()),
450450 float32(math.NaN())},
@@ -466,11 +466,249 @@ func (hd *HitDef) clear() {
466466 hd.fall.setDefault()
467467 }
468468 func (hd *HitDef) invalidate(stateType StateType) {
469- hd.attr = hd.attr&^(uint32(AT_NA)-1) | uint32(stateType) | 0x80000000
470- hd.reversal_attr |= 0x80000000
469+ hd.attr = hd.attr&^(int32(AT_NA)-1) | int32(stateType) | -1<<31
470+ hd.reversal_attr |= -1 << 31
471471 hd.lhit = false
472472 }
473473
474+type GetHitVar struct {
475+ hitBy [][2]int32
476+ hit1 [2]int32
477+ hit2 [2]int32
478+ attr int32
479+ _type HitType
480+ airanimtype Reaction
481+ groundanimtype Reaction
482+ airtype HitType
483+ groundtype HitType
484+ damage int32
485+ hitcount int32
486+ fallcount int32
487+ hitshaketime int32
488+ hittime int32
489+ slidetime int32
490+ ctrltime int32
491+ xvel float32
492+ yvel float32
493+ yaccel float32
494+ hitid int32
495+ xoff float32
496+ yoff float32
497+ fall Fall
498+ playerNo int
499+ fallf bool
500+ guarded bool
501+ p2getp1state bool
502+ forcestand bool
503+}
504+
505+func (ghv *GetHitVar) clear() {
506+ *ghv = GetHitVar{_type: -1, hittime: -1, yaccel: float32(math.NaN()),
507+ xoff: ghv.xoff, yoff: ghv.yoff, hitid: -1, playerNo: -1}
508+ ghv.fall.clear()
509+}
510+func (ghv *GetHitVar) clearOff() {
511+ ghv.xoff, ghv.yoff = 0, 0
512+}
513+func (ghv GetHitVar) getYaccel() float32 {
514+ if math.IsNaN(float64(ghv.yaccel)) {
515+ return 0.35
516+ }
517+ return ghv.yaccel
518+}
519+func (ghv GetHitVar) idMatch(id int32) bool {
520+ for _, v := range ghv.hitBy {
521+ if v[0] == id {
522+ return true
523+ }
524+ }
525+ return false
526+}
527+func (ghv GetHitVar) getJuggle(id, defaultJuggle int32) int32 {
528+ for _, v := range ghv.hitBy {
529+ if v[0] == id {
530+ return v[1]
531+ }
532+ }
533+ return defaultJuggle
534+}
535+func (ghv *GetHitVar) dropId(id int32) {
536+ for i, v := range ghv.hitBy {
537+ if v[0] == id {
538+ ghv.hitBy = append(ghv.hitBy[:i], ghv.hitBy[i+1:]...)
539+ break
540+ }
541+ }
542+}
543+func (ghv *GetHitVar) addId(id, juggle int32) {
544+ ghv.dropId(id)
545+ ghv.hitBy = append(ghv.hitBy, [2]int32{id, juggle})
546+}
547+
548+type HitOverride struct {
549+ attr int32
550+ stateno int32
551+ time int32
552+ playerNo int
553+ forceair bool
554+}
555+
556+func (ho *HitOverride) clear() {
557+ *ho = HitOverride{stateno: -1, playerNo: -1}
558+}
559+
560+type aimgImage struct {
561+ anim Animation
562+ pos, scl, ascl [2]float32
563+ angle float32
564+ angleset, old bool
565+}
566+
567+type AfterImage struct {
568+ time int32
569+ length int32
570+ postbright [3]int32
571+ add [3]int32
572+ mul [3]float32
573+ timegap int32
574+ framegap int32
575+ alpha [2]int32
576+ palfx []PalFX
577+ imgs [64]aimgImage
578+ imgidx int
579+ restgap int32
580+ reccount int32
581+}
582+
583+func newAfterImage() *AfterImage {
584+ ai := &AfterImage{palfx: make([]PalFX, sys.afterImageMax)}
585+ for i := range ai.palfx {
586+ ai.palfx[i].enable, ai.palfx[i].negType = true, true
587+ }
588+ ai.clear()
589+ ai.timegap = 0
590+ return ai
591+}
592+func (ai *AfterImage) clear() {
593+ ai.time = 0
594+ ai.length = 20
595+ if len(ai.palfx) > 0 {
596+ ai.palfx[0].eColor = 1
597+ ai.palfx[0].eInvertall = false
598+ ai.palfx[0].eAdd = [3]int32{30, 30, 30}
599+ ai.palfx[0].eMul = [3]int32{120, 120, 220}
600+ }
601+ ai.postbright = [3]int32{0, 0, 0}
602+ ai.add = [3]int32{10, 10, 25}
603+ ai.mul = [3]float32{0.65, 0.65, 0.75}
604+ ai.timegap = 1
605+ ai.framegap = 6
606+ ai.alpha = [2]int32{-1, 0}
607+ ai.imgidx = 0
608+ ai.restgap = 0
609+ ai.reccount = 0
610+}
611+func (ai *AfterImage) setPalColor(color int32) {
612+ if len(ai.palfx) > 0 {
613+ ai.palfx[0].eColor = float32(Max(0, Min(256, color))) / 256
614+ }
615+}
616+func (ai *AfterImage) setPalInvertall(invertall bool) {
617+ if len(ai.palfx) > 0 {
618+ ai.palfx[0].eInvertall = invertall
619+ }
620+}
621+func (ai *AfterImage) setPalBrightR(addr int32) {
622+ if len(ai.palfx) > 0 {
623+ ai.palfx[0].eAdd[0] = addr
624+ }
625+}
626+func (ai *AfterImage) setPalBrightG(addg int32) {
627+ if len(ai.palfx) > 0 {
628+ ai.palfx[0].eAdd[1] = addg
629+ }
630+}
631+func (ai *AfterImage) setPalBrightB(addb int32) {
632+ if len(ai.palfx) > 0 {
633+ ai.palfx[0].eAdd[2] = addb
634+ }
635+}
636+func (ai *AfterImage) setPalContrastR(mulr int32) {
637+ if len(ai.palfx) > 0 {
638+ ai.palfx[0].eMul[0] = mulr
639+ }
640+}
641+func (ai *AfterImage) setPalContrastG(mulg int32) {
642+ if len(ai.palfx) > 0 {
643+ ai.palfx[0].eMul[1] = mulg
644+ }
645+}
646+func (ai *AfterImage) setPalContrastB(mulb int32) {
647+ if len(ai.palfx) > 0 {
648+ ai.palfx[0].eMul[2] = mulb
649+ }
650+}
651+func (ai *AfterImage) setupPalFX() {
652+ pb := ai.postbright
653+ for i := 1; i < len(ai.palfx); i++ {
654+ ai.palfx[i].eColor = ai.palfx[i-1].eColor
655+ ai.palfx[i].eInvertall = ai.palfx[i-1].eInvertall
656+ ai.palfx[i].eAdd[0] = ai.palfx[i-1].eAdd[0] + pb[0]
657+ ai.palfx[i].eAdd[1] = ai.palfx[i-1].eAdd[1] + pb[1]
658+ ai.palfx[i].eAdd[2] = ai.palfx[i-1].eAdd[2] + pb[2]
659+ pb = [3]int32{0, 0, 0}
660+ ai.palfx[i].eMul[0] = int32(float32(ai.palfx[i-1].eMul[0]) * ai.mul[0])
661+ ai.palfx[i].eMul[1] = int32(float32(ai.palfx[i-1].eMul[1]) * ai.mul[1])
662+ ai.palfx[i].eMul[2] = int32(float32(ai.palfx[i-1].eMul[2]) * ai.mul[2])
663+ }
664+}
665+
666+type Projectile struct {
667+ hitdef HitDef
668+ id int32
669+ anim int32
670+ hitanim int32
671+ remanim int32
672+ cancelanim int32
673+ scale [2]float32
674+ clsnscale [2]float32
675+ remove bool
676+ removetime int32
677+ velocity [2]float32
678+ remvelocity [2]float32
679+ accel [2]float32
680+ velmul [2]float32
681+ hits int32
682+ misstime int32
683+ priority int32
684+ prioritypoint int32
685+ sprpriority int32
686+ edgebound int32
687+ stagebound int32
688+ heightbound [2]int32
689+ pos [2]float32
690+ facing int32
691+ shadow [3]int32
692+ supermovetime int32
693+ pausemovetime int32
694+ ani *Animation
695+ timemiss int32
696+ hitpause int32
697+ oldPos [2]float32
698+ newPos [2]float32
699+ aimg AfterImage
700+ palfx *PalFX
701+}
702+
703+func (p *Projectile) clear() {
704+ *p = Projectile{id: IErr, hitanim: -1, remanim: IErr, cancelanim: IErr,
705+ scale: [2]float32{1, 1}, clsnscale: [2]float32{1, 1}, remove: true,
706+ removetime: -1, velmul: [2]float32{1, 1}, hits: 1, priority: 1,
707+ prioritypoint: 1, sprpriority: 3, edgebound: 40, stagebound: 40,
708+ heightbound: [2]int32{-240, 1}, facing: 1}
709+ p.hitdef.clear()
710+}
711+
474712 type CharGlobalInfo struct {
475713 def string
476714 displayname string
@@ -851,6 +1089,10 @@ func (c *Char) helperInit(h *Char, st int32, pt PosType, x, y float32,
8511089 facing int32, ownpal bool) {
8521090 unimplemented()
8531091 }
1092+func (c *Char) roundState() int32 {
1093+ unimplemented()
1094+ return 0
1095+}
8541096 func (c *Char) animNo() int32 {
8551097 unimplemented()
8561098 return 0
@@ -859,3 +1101,7 @@ func (c *Char) animTime() int32 {
8591101 unimplemented()
8601102 return 0
8611103 }
1104+func (c *Char) animElemTime(e int32) int32 {
1105+ unimplemented()
1106+ return 0
1107+}
--- a/src/common.go
+++ b/src/common.go
@@ -79,7 +79,7 @@ func IsFinite(f float32) bool {
7979 func Atoi(str string) int32 {
8080 n := int32(0)
8181 str = strings.TrimSpace(str)
82- if len(str) >= 0 {
82+ if len(str) > 0 {
8383 var a string
8484 if str[0] == '-' || str[0] == '+' {
8585 a = str[1:]
--- a/src/compiler.go
+++ b/src/compiler.go
@@ -196,6 +196,25 @@ func (c *Compiler) operator(in *string) error {
196196 }
197197 return nil
198198 }
199+func (c *Compiler) integer2(in *string) (int32, error) {
200+ istr := c.token
201+ c.token = c.tokenizer(in)
202+ minus := istr == "-"
203+ if minus {
204+ istr = c.token
205+ c.token = c.tokenizer(in)
206+ }
207+ for _, c := range istr {
208+ if c < '0' || c > '9' {
209+ return 0, Error(istr + "が整数でありません")
210+ }
211+ }
212+ i := Atoi(istr)
213+ if minus {
214+ i *= -1
215+ }
216+ return i, nil
217+}
199218 func (c *Compiler) number(token string) BytecodeValue {
200219 f, err := strconv.ParseFloat(token, 64)
201220 if err != nil && f == 0 {
@@ -312,6 +331,165 @@ func (c *Compiler) kakkotojiru(in *string) error {
312331 }
313332 return nil
314333 }
334+func (c *Compiler) kyuushiki(in *string) (not bool, err error) {
335+ for {
336+ if c.token == "!=" {
337+ not = true
338+ break
339+ } else if len(c.token) > 0 {
340+ if c.token[len(c.token)-1] == '=' {
341+ break
342+ }
343+ } else {
344+ return false, Error("'='か'!='がありません")
345+ }
346+ c.token = c.tokenizer(in)
347+ }
348+ c.token = c.tokenizer(in)
349+ return
350+}
351+func (c *Compiler) intRange(in *string) (minop OpCode, maxop OpCode,
352+ min, max int32, err error) {
353+ switch c.token {
354+ case "(":
355+ minop = OC_gt
356+ case "[":
357+ minop = OC_ge
358+ default:
359+ err = Error("'['か'('がありません")
360+ return
361+ }
362+ integer := func() (int32, error) {
363+ c.token = c.tokenizer(in)
364+ minus := false
365+ for c.token == "-" || c.token == "+" {
366+ minus = minus || c.token == "-"
367+ c.token = c.tokenizer(in)
368+ }
369+ if len(c.token) == 0 || c.token[0] < '0' || c.token[0] > '9' {
370+ return 0, Error("数字の読み込みエラーです")
371+ }
372+ i := Atoi(c.token)
373+ if minus {
374+ i *= -1
375+ }
376+ return i, nil
377+ }
378+ if min, err = integer(); err != nil {
379+ return
380+ }
381+ i := strings.Index(*in, ",")
382+ if i < 0 {
383+ err = Error("','がありません")
384+ return
385+ }
386+ *in = (*in)[i+1:]
387+ if max, err = integer(); err != nil {
388+ return
389+ }
390+ i = strings.IndexAny(*in, "])")
391+ if i < 0 {
392+ err = Error("']'か')'がありません")
393+ return
394+ }
395+ if (*in)[i] == ')' {
396+ maxop = OC_lt
397+ } else {
398+ maxop = OC_le
399+ }
400+ *in = (*in)[i+1:]
401+ c.token = c.tokenizer(in)
402+ return
403+}
404+func (c *Compiler) kyuushikiThroughNeo(_range bool, in *string) {
405+ i := 0
406+ for ; i < len(*in); i++ {
407+ if (*in)[i] >= '0' && (*in)[i] <= '9' || (*in)[i] == '-' ||
408+ _range && ((*in)[i] == '[' || (*in)[i] == '(') {
409+ break
410+ }
411+ }
412+ *in = (*in)[i:]
413+ c.token = c.tokenizer(in)
414+}
415+func (c *Compiler) kyuushikiSuperDX(out *BytecodeExp, in *string,
416+ hissu bool) error {
417+ comma := c.token == ","
418+ if comma {
419+ c.token = c.tokenizer(in)
420+ }
421+ var opc OpCode
422+ switch c.token {
423+ case "<":
424+ opc = OC_lt
425+ c.kyuushikiThroughNeo(false, in)
426+ case ">":
427+ opc = OC_gt
428+ c.kyuushikiThroughNeo(false, in)
429+ case "<=":
430+ opc = OC_le
431+ c.kyuushikiThroughNeo(false, in)
432+ case ">=":
433+ opc = OC_ge
434+ c.kyuushikiThroughNeo(false, in)
435+ default:
436+ opc = OC_eq
437+ hikaku := false
438+ switch c.token {
439+ case "!=":
440+ opc = OC_ne
441+ hikaku = true
442+ case "=":
443+ hikaku = true
444+ default:
445+ if hissu && !comma {
446+ return Error("比較演算子がありません")
447+ }
448+ }
449+ if hikaku {
450+ c.kyuushikiThroughNeo(true, in)
451+ }
452+ if c.token == "[" || c.token == "(" {
453+ minop, maxop, min, max, err := c.intRange(in)
454+ if err != nil {
455+ return err
456+ }
457+ if opc == OC_ne {
458+ if minop == OC_gt {
459+ minop = OC_le
460+ } else {
461+ minop = OC_lt
462+ }
463+ if maxop == OC_lt {
464+ minop = OC_ge
465+ } else {
466+ minop = OC_gt
467+ }
468+ }
469+ out.append(OC_dup)
470+ out.appendValue(BytecodeInt(min))
471+ out.append(minop)
472+ out.append(OC_swap)
473+ out.appendValue(BytecodeInt(max))
474+ out.append(maxop)
475+ if opc == OC_ne {
476+ out.append(OC_blor)
477+ } else {
478+ out.append(OC_bland)
479+ }
480+ c.usiroOp = comma || hikaku
481+ return nil
482+ }
483+ }
484+ n, err := c.integer2(in)
485+ if err != nil {
486+ return err
487+ }
488+ out.appendValue(BytecodeInt(n))
489+ out.append(opc)
490+ c.usiroOp = true
491+ return nil
492+}
315493 func (c *Compiler) expValue(out *BytecodeExp, in *string) (BytecodeValue,
316494 error) {
317495 c.usiroOp, c.norange = true, false
@@ -325,6 +503,8 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string) (BytecodeValue,
325503 }
326504 var be1, be2, be3 BytecodeExp
327505 var bv1, bv2, bv3 BytecodeValue
506+ var n int32
507+ var be BytecodeExp
328508 var err error
329509 switch c.token {
330510 case "-":
@@ -405,10 +585,34 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string) (BytecodeValue,
405585 }
406586 case "random":
407587 out.append(OC_random)
588+ case "roundstate":
589+ out.append(OC_roundstate)
590+ case "matchover":
591+ out.append(OC_ex_, OC_ex_matchover)
408592 case "anim":
409593 out.append(OC_anim)
410594 case "animtime":
411595 out.append(OC_animtime)
596+ case "animelem":
597+ if _, err = c.kyuushiki(in); err != nil {
598+ return BytecodeSF(), err
599+ }
600+ if c.token == "-" {
601+ return BytecodeSF(), Error("マイナスが付くとエラーです")
602+ }
603+ if n, err = c.integer2(in); err != nil {
604+ return BytecodeSF(), err
605+ }
606+ if n <= 0 {
607+ return BytecodeSF(), Error("animelemのは0より大きくなければいけません")
608+ }
609+ out.appendValue(BytecodeInt(n))
610+ out.append(OC_animelemtime)
611+ if err = c.kyuushikiSuperDX(&be, in, false); err != nil {
612+ return BytecodeSF(), err
613+ }
614+ out.append(OC_jsf8, OpCode(len(be)))
615+ out.append(be...)
412616 default:
413617 println(c.token)
414618 unimplemented()
@@ -1525,6 +1729,17 @@ func (c *Compiler) ctrlSet(is IniSection, sbc *StateBytecode,
15251729 return c.paramValue(is, sc, "value", ctrlSet_value, VT_Bool, 1, true)
15261730 })
15271731 }
1732+func (c *Compiler) hitDefSub(is IniSection,
1733+ sc *StateControllerBase) error {
1734+ unimplemented()
1735+ return nil
1736+}
1737+func (c *Compiler) hitDef(is IniSection, sbc *StateBytecode,
1738+ sc *StateControllerBase) (StateController, error) {
1739+ return hitDef(*sc), c.stateSec(is, func() error {
1740+ return c.hitDefSub(is, sc)
1741+ })
1742+}
15281743 func (c *Compiler) stateCompile(bc *Bytecode, filename, def string) error {
15291744 var lines []string
15301745 if err := LoadFile(&filename, def, func(filename string) error {
@@ -1568,6 +1783,7 @@ func (c *Compiler) stateCompile(bc *Bytecode, filename, def string) error {
15681783 strings.SplitN(lines[i], ";", 2)[0]))
15691784 if len(line) < 7 || line[0] != '[' || line[len(line)-1] != ']' ||
15701785 line[1:7] != "state " {
1786+ i--
15711787 break
15721788 }
15731789 i++
@@ -1610,6 +1826,8 @@ func (c *Compiler) stateCompile(bc *Bytecode, filename, def string) error {
16101826 scf = c.powerAdd
16111827 case "ctrlset":
16121828 scf = c.ctrlSet
1829+ case "hitdef":
1830+ scf = c.hitDef
16131831 default:
16141832 println(data)
16151833 unimplemented()
--- a/src/image.go
+++ b/src/image.go
@@ -28,8 +28,16 @@ func NewTexture() (t *Texture) {
2828 }
2929
3030 type PalFX struct {
31- Time int32
32- Remap []int
31+ Time int32
32+ Remap []int
33+ Invertall bool
34+ negType bool
35+ enable bool
36+ eInvertall bool
37+ enegType bool
38+ eAdd [3]int32
39+ eMul [3]int32
40+ eColor float32
3341 }
3442
3543 func NewPalFX() *PalFX { return &PalFX{} }
--- a/src/system.go
+++ b/src/system.go
@@ -33,7 +33,8 @@ var sys = System{
3333 listenPort: "7500",
3434 loader: *newLoader(),
3535 numSimul: [2]int{2, 2},
36- numTurns: [2]int{2, 2}}
36+ numTurns: [2]int{2, 2},
37+ afterImageMax: 8}
3738
3839 type TeamMode int32
3940
@@ -80,6 +81,7 @@ type System struct {
8081 inputRemap [MaxSimul * 2]int
8182 listenPort string
8283 round int32
84+ matchWins [2]int32
8385 wins [2]int32
8486 rexisted [2]int32
8587 draws int32
@@ -95,6 +97,7 @@ type System struct {
9597 stringPool [MaxSimul * 2]StringPool
9698 bcStack BytecodeStack
9799 specialFlag GlobalSpecialFlag
100+ afterImageMax int
98101 }
99102
100103 func (s *System) init(w, h int32) *lua.LState {
@@ -190,6 +193,9 @@ func (s *System) synchronize() error {
190193 }
191194 return nil
192195 }
196+func (s *System) matchOver() bool {
197+ return s.wins[0] >= s.matchWins[0] || s.wins[1] >= s.matchWins[1]
198+}
193199
194200 type SelectChar struct {
195201 def, name string