Go で書き直した Ikemen
修订版 | 0c973a890d814ea7da0059bfa45e744e0a1afc3f (tree) |
---|---|
时间 | 2019-01-18 23:45:32 |
作者 | neatunsou <sisiy4excite@gmai...> |
Commiter | neatunsou |
Simulでパワーゲージを共有するとライフバーのレベル表示が動かないのを修正
Statetype=LでHitdefを受けた時ステート内で一度でもステコンでyvelかyposを変更されていると5020に移動する処理が無かったのを修正
@@ -1503,6 +1503,7 @@ type Char struct { | ||
1503 | 1503 | inguarddist bool |
1504 | 1504 | pushed bool |
1505 | 1505 | hitdefContact bool |
1506 | + movedY bool | |
1506 | 1507 | atktmp int8 |
1507 | 1508 | hittmp int8 |
1508 | 1509 | acttmp int8 |
@@ -2080,6 +2081,9 @@ func (c *Char) setXV(xv float32) { | ||
2080 | 2081 | } |
2081 | 2082 | func (c *Char) setYV(yv float32) { |
2082 | 2083 | c.vel[1] = yv |
2084 | + if yv != 0 { | |
2085 | + c.movedY = true | |
2086 | + } | |
2083 | 2087 | } |
2084 | 2088 | func (c *Char) changeAnim(animNo int32) { |
2085 | 2089 | if a := c.getAnim(animNo, false); a != nil { |
@@ -2707,6 +2711,7 @@ func (c *Char) changeStateEx(no int32, pn int, anim, ctrl int32) { | ||
2707 | 2711 | if ctrl >= 0 { |
2708 | 2712 | c.setCtrl(ctrl != 0) |
2709 | 2713 | } |
2714 | + c.movedY = false | |
2710 | 2715 | if c.stateChange1(no, pn) && sys.changeStateNest == 0 && c.minus == 0 { |
2711 | 2716 | for c.stchtmp && sys.changeStateNest < 2500 { |
2712 | 2717 | c.stateChange2() |
@@ -3015,18 +3020,27 @@ func (c *Char) setX(x float32) { | ||
3015 | 3020 | func (c *Char) setY(y float32) { |
3016 | 3021 | c.oldPos[1], c.drawPos[1] = y, y |
3017 | 3022 | c.setPosY(y) |
3023 | + if y != 0 { | |
3024 | + c.movedY = true | |
3025 | + } | |
3018 | 3026 | } |
3019 | 3027 | func (c *Char) addX(x float32) { |
3020 | 3028 | c.setX(c.pos[0] + c.facing*x) |
3021 | 3029 | } |
3022 | 3030 | func (c *Char) addY(y float32) { |
3023 | 3031 | c.setY(c.pos[1] + y) |
3032 | + if y != 0 { | |
3033 | + c.movedY = true | |
3034 | + } | |
3024 | 3035 | } |
3025 | 3036 | func (c *Char) addXV(xv float32) { |
3026 | 3037 | c.vel[0] += xv |
3027 | 3038 | } |
3028 | 3039 | func (c *Char) addYV(yv float32) { |
3029 | 3040 | c.vel[1] += yv |
3041 | + if yv != 0 { | |
3042 | + c.movedY = true | |
3043 | + } | |
3030 | 3044 | } |
3031 | 3045 | func (c *Char) mulXV(xv float32) { |
3032 | 3046 | c.vel[0] *= xv |
@@ -4473,7 +4487,11 @@ func (c *Char) tick() { | ||
4473 | 4487 | if c.stchtmp { |
4474 | 4488 | c.ss.prevno = 0 |
4475 | 4489 | } else if c.ss.stateType == ST_L { |
4476 | - c.changeStateEx(5080, pn, -1, 0) | |
4490 | + if c.movedY { | |
4491 | + c.changeStateEx(5020, pn, -1, 0) | |
4492 | + } else { | |
4493 | + c.changeStateEx(5080, pn, -1, 0) | |
4494 | + } | |
4477 | 4495 | } else if c.ghv.guarded && (c.ghv.damage < c.life || sys.sf(GSF_noko)) { |
4478 | 4496 | switch c.ss.stateType { |
4479 | 4497 | case ST_S: |
@@ -4879,7 +4897,11 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
4879 | 4897 | ghv.hittime = hd.down_hittime |
4880 | 4898 | ghv.ctrltime = hd.down_hittime |
4881 | 4899 | ghv.xvel = hd.down_velocity[0] * c.localscl / getter.localscl |
4882 | - ghv.yvel = hd.down_velocity[1] * 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 | + } | |
4883 | 4905 | if !hd.down_bounce { |
4884 | 4906 | ghv.fall.xvelocity = float32(math.NaN()) |
4885 | 4907 | ghv.fall.yvelocity = 0 |
@@ -1189,12 +1189,8 @@ func (l *Lifebar) draw(layerno int16) { | ||
1189 | 1189 | l.pb[i].bgDraw(layerno) |
1190 | 1190 | } |
1191 | 1191 | for i := range l.pb { |
1192 | - lvi := i | |
1193 | - if sys.tmode[i] == TM_Simul { | |
1194 | - lvi += 2 | |
1195 | - } | |
1196 | 1192 | l.pb[i].draw(layerno, float32(sys.chars[i][0].power)/ |
1197 | - float32(sys.chars[i][0].powerMax), sys.chars[lvi][0].power/1000, | |
1193 | + float32(sys.chars[i][0].powerMax), sys.chars[i][0].power/1000, | |
1198 | 1194 | l.fnt[:]) |
1199 | 1195 | } |
1200 | 1196 | for ti, tm := range sys.tmode { |