Go で書き直した Ikemen
Revision | 08f6dcd0479e4afa16d7077c5bf35f52a82a3d0a (tree) |
---|---|
Time | 2019-08-24 16:49:17 |
Author | neatunsou <sisiy4excite@gmai...> |
Commiter | neatunsou |
Hitoverrideで背後から攻撃された際のGetHitVar(Xvel)が反転していなかったのを修正
方向キーのコマンド入力の途中で~が入る処理があると入力がリセットされる場合があったのを修正
ZSSでhelperをリダイレクトした変数代入ができなかったのを修正
Loadfileで存在しないファイルを指定するとエラーではなく無視をするようにした
@@ -5966,10 +5966,10 @@ func (sc loadFile) Run(c *Char, _ []int32) bool { | ||
5966 | 5966 | }) |
5967 | 5967 | if path != "" { |
5968 | 5968 | decodeFile, err := os.Open(filepath.Dir(c.gi().def) + "/" + path) |
5969 | + defer decodeFile.Close() | |
5969 | 5970 | if err != nil { |
5970 | - panic(err) | |
5971 | + return false | |
5971 | 5972 | } |
5972 | - defer decodeFile.Close() | |
5973 | 5973 | decoder := gob.NewDecoder(decodeFile) |
5974 | 5974 | switch data { |
5975 | 5975 | case SaveData_map: |
@@ -5283,7 +5283,26 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
5283 | 5283 | return |
5284 | 5284 | } |
5285 | 5285 | getter.p1facing = 0 |
5286 | + invertXvel := func(byf float32) { | |
5287 | + if !proj { | |
5288 | + if c.p1facing != 0 { | |
5289 | + byf = c.p1facing | |
5290 | + } else { | |
5291 | + byf = c.facing | |
5292 | + } | |
5293 | + } | |
5294 | + if (getter.facing < 0) == (byf < 0) { | |
5295 | + getter.ghv.xvel *= -1 | |
5296 | + if getter.ghv.groundtype == 1 || getter.ghv.groundtype == 2 { | |
5297 | + getter.ghv.groundtype += 3 - getter.ghv.groundtype*2 | |
5298 | + } | |
5299 | + if getter.ghv.airtype == 1 || getter.ghv.airtype == 2 { | |
5300 | + getter.ghv.airtype += 3 - getter.ghv.airtype*2 | |
5301 | + } | |
5302 | + } | |
5303 | + } | |
5286 | 5304 | if getter.hoIdx >= 0 { |
5305 | + invertXvel(byf) | |
5287 | 5306 | return |
5288 | 5307 | } |
5289 | 5308 | if !proj && hd.hitonce > 0 { |
@@ -5359,22 +5378,7 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
5359 | 5378 | } |
5360 | 5379 | } |
5361 | 5380 | } |
5362 | - if !proj { | |
5363 | - if c.p1facing != 0 { | |
5364 | - byf = c.p1facing | |
5365 | - } else { | |
5366 | - byf = c.facing | |
5367 | - } | |
5368 | - } | |
5369 | - if (getter.facing < 0) == (byf < 0) { | |
5370 | - getter.ghv.xvel *= -1 | |
5371 | - if getter.ghv.groundtype == 1 || getter.ghv.groundtype == 2 { | |
5372 | - getter.ghv.groundtype += 3 - getter.ghv.groundtype*2 | |
5373 | - } | |
5374 | - if getter.ghv.airtype == 1 || getter.ghv.airtype == 2 { | |
5375 | - getter.ghv.airtype += 3 - getter.ghv.airtype*2 | |
5376 | - } | |
5377 | - } | |
5381 | + invertXvel(byf) | |
5378 | 5382 | return |
5379 | 5383 | } |
5380 | 5384 | if proj { |
@@ -7180,7 +7180,12 @@ func (c *Compiler) stateBlock(line *string, bl *StateBlock, root bool, | ||
7180 | 7180 | } |
7181 | 7181 | continue |
7182 | 7182 | default: |
7183 | - if scf, ok := c.scmap[c.token]; ok { | |
7183 | + scf, ok := c.scmap[c.token] | |
7184 | + //helperはステコンとリダイレクトの両方で使う名称なのでチェックする | |
7185 | + if c.token == "helper" && ((*line)[0] == ',' || (*line)[0] == '(') { | |
7186 | + ok = false | |
7187 | + } | |
7188 | + if ok { | |
7184 | 7189 | scname := c.token |
7185 | 7190 | c.scan(line) |
7186 | 7191 | if err := c.needToken("{"); err != nil { |
@@ -1421,7 +1421,8 @@ type cmdElem struct { | ||
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | func (ce *cmdElem) IsDirection() bool { |
1424 | - return !ce.slash && len(ce.key) == 1 && ce.key[0] < CK_a | |
1424 | + //ここで~は方向コマンドとして返さない | |
1425 | + return !ce.slash && len(ce.key) == 1 && ce.key[0] < CK_nBs && (ce.key[0] < CK_nB || ce.key[0] > CK_nUF) | |
1425 | 1426 | } |
1426 | 1427 | func (ce *cmdElem) IsDToB(next cmdElem) bool { |
1427 | 1428 | if next.slash { |