Go で書き直した Ikemen
Revision | a17a9afea827b0b947846a0e8a3ccae8e73688b3 (tree) |
---|---|
Time | 2019-01-26 08:16:38 |
Author | suehiro <supersuehiro@user...> |
Commiter | suehiro |
デバッグキーでポーズがかかるタイミングをMugenと同じに修正。その他バグ修正
@@ -8,3 +8,4 @@ go get -u github.com/timshannon/go-openal/openal | ||
8 | 8 | go get -u github.com/faiface/beep |
9 | 9 | go get -u github.com/hajimehoshi/oto |
10 | 10 | go get -u github.com/hajimehoshi/go-mp3 |
11 | +go get -u github.com/pkg/errors |
@@ -2354,7 +2354,7 @@ func (c *Char) leftEdge() float32 { | ||
2354 | 2354 | return sys.cam.ScreenPos[0] / c.localscl |
2355 | 2355 | } |
2356 | 2356 | func (c *Char) lose() bool { |
2357 | - return sys.winTeam == ^c.teamside | |
2357 | + return sys.winTeam == 1^c.teamside | |
2358 | 2358 | } |
2359 | 2359 | func (c *Char) loseKO() bool { |
2360 | 2360 | return c.lose() && sys.finish == FT_KO |
@@ -4091,8 +4091,8 @@ func (c *Char) action() { | ||
4091 | 4091 | c.acttmp = -int8(Btoi(p)) * 2 |
4092 | 4092 | c.unsetSCF(SCF_guard) |
4093 | 4093 | if !(c.scf(SCF_ko) || c.ctrlOver()) && |
4094 | - (c.scf(SCF_ctrl) || c.ss.no == 52 || c.inGuardState()) && | |
4095 | - c.ss.moveType == MT_I && c.cmd != nil && | |
4094 | + ((c.scf(SCF_ctrl) || c.ss.no == 52) && | |
4095 | + c.ss.moveType == MT_I || c.inGuardState()) && c.cmd != nil && | |
4096 | 4096 | (sys.autoguard[c.playerNo] || c.cmd[0].Buffer.B > 0) && |
4097 | 4097 | (c.ss.stateType == ST_S && !c.sf(CSF_nostandguard) || |
4098 | 4098 | c.ss.stateType == ST_C && !c.sf(CSF_nocrouchguard) || |
@@ -5417,7 +5417,6 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
5417 | 5417 | cr += c.pos[0] * c.localscl |
5418 | 5418 | if gl < cr && cl < gr && (contact > 0 || |
5419 | 5419 | getter.clsnCheck(c, false, false)) { |
5420 | - drawposOvrd := true | |
5421 | 5420 | getter.pushed, c.pushed = true, true |
5422 | 5421 | tmp := getter.distX(c, getter) |
5423 | 5422 | if tmp == 0 { |
@@ -5436,7 +5435,6 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
5436 | 5435 | } |
5437 | 5436 | if getter.sf(CSF_screenbound) { |
5438 | 5437 | getter.pos[0] = MaxF(gxmin/getter.localscl, MinF(gxmax/getter.localscl, getter.pos[0])) |
5439 | - drawposOvrd = false | |
5440 | 5438 | } |
5441 | 5439 | if c.sf(CSF_screenbound) { |
5442 | 5440 | l, r := c.getEdge(c.edge[0], true), -c.getEdge(c.edge[1], true) |
@@ -5449,9 +5447,7 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
5449 | 5447 | getter.pos[0])) |
5450 | 5448 | c.pos[0] = MaxF(sys.stage.leftbound/c.localscl, MinF(sys.stage.rightbound/c.localscl, |
5451 | 5449 | c.pos[0])) |
5452 | - if drawposOvrd { | |
5453 | - getter.drawPos[0], c.drawPos[0] = getter.pos[0], c.pos[0] | |
5454 | - } | |
5450 | + getter.drawPos[0], c.drawPos[0] = getter.pos[0], c.pos[0] | |
5455 | 5451 | } |
5456 | 5452 | } |
5457 | 5453 | } |
@@ -642,10 +642,11 @@ func (s *System) nextRound() { | ||
642 | 642 | } |
643 | 643 | } |
644 | 644 | func (s *System) tickFrame() bool { |
645 | - return s.oldTickCount < s.tickCount | |
645 | + return (!s.paused || s.step) && s.oldTickCount < s.tickCount | |
646 | 646 | } |
647 | 647 | func (s *System) tickNextFrame() bool { |
648 | - return int(s.tickCountF+s.nextAddTime) > s.tickCount | |
648 | + return int(s.tickCountF+s.nextAddTime) > s.tickCount && | |
649 | + !s.paused || s.step || s.oldTickCount >= s.tickCount | |
649 | 650 | } |
650 | 651 | func (s *System) tickInterpola() float32 { |
651 | 652 | if s.tickNextFrame() { |
@@ -654,6 +655,10 @@ func (s *System) tickInterpola() float32 { | ||
654 | 655 | return s.tickCountF - s.lastTick + s.nextAddTime |
655 | 656 | } |
656 | 657 | func (s *System) addFrameTime(t float32) bool { |
658 | + if s.paused && !s.step && s.oldTickCount < s.tickCount { | |
659 | + s.oldNextAddTime = 0 | |
660 | + return true | |
661 | + } | |
657 | 662 | s.oldTickCount = s.tickCount |
658 | 663 | if int(s.tickCountF) > s.tickCount { |
659 | 664 | s.tickCount++ |
@@ -1085,11 +1090,8 @@ func (s *System) action(x, y *float32, scl float32) (leftest, rightest, | ||
1085 | 1090 | s.intro = 0 |
1086 | 1091 | } |
1087 | 1092 | } |
1088 | - if s.turbo == 0 || s.tickNextFrame() { | |
1093 | + if s.tickNextFrame() { | |
1089 | 1094 | spd := s.accel |
1090 | - if s.paused && !s.step { | |
1091 | - spd = 0 | |
1092 | - } | |
1093 | 1095 | _else := s.sf(GSF_nokoslow) || s.time == 0 |
1094 | 1096 | if !_else { |
1095 | 1097 | slowt := -(s.lifebar.ro.over_hittime + (s.lifebar.ro.slow_time+3)>>2) |