Win版と1.0との互換性云々

Win版→1.0版はこれといって問題は見当たらないchikuchikugonzalezです。

ただ、困るのは1.0→Winをやろうとか考えた場合です。

なにせGameWidthとかAILevelとかのトリガーが増えたりとかしているのでいろいろ面倒なのです。

で、どうしたら少ない変更でできるかなっと考えたメモです

増えたトリガー

    • GameWidth
    • GameHeight
    • Const240p
    • Const480p
    • Const720p
    • AILevel
    • Cond
    • Const(velocity.air.gethit.groundrecover)
    • Const(velocity.air.gethit.airrecover.mul)
    • Const(velocity.air.gethit.airrecover.add)
    • Const(velocity.air.gethit.airrecover.back)
    • Const(velocity.air.gethit.airrecover.fwd)
    • Const(velocity.air.gethit.airrecover.up)
    • Const(velocity.air.gethit.airrecover.down)
    • Const(movement.stand.friction.threshold)
    • Const(movement.crouch.friction.threshold)
    • Const(movement.air.gethit.groundlevel)
    • Const(movement.air.gethit.groundrecover.ground.threshold)
    • Const(movement.air.gethit.groundrecover.groundlevel)
    • Const(movement.air.gethit.airrecover.threshold)
    • Const(movement.air.gethit.airrecover.yaccel)
    • Const(movement.air.gethit.trip.groundlevel)
    • Const(movement.down.bounce.offset)
    • Const(movement.down.bounce.yaccel)
    • Const(movement.down.bounce.groundlevel)
    • Const(movement.down.friction.threshold)

他にもあるかも。

で、こいつらを使われるとWIn版だとあっさりエラー落ちな訳でして、どうしたらいいのかっていうのを考える。するとまー次のようなことになりますね。

サイズ系の変更

    • GameWIdth => 320
    • GameHeight => 240
    • Const240p => 1.0
    • Const480p => 0.5
    • Const720p => 0.25

Condトリガー

Condトリガーは短絡評価をするIfelseなので、cond=>ifelseの単純置換でOK…とは限らなかったり。

例えば

trigger1 = cond(NumHelper(1000), Helper(1000),var(59), 0)

のような使われ方の場合は、次のようにする必要があります

trigger1 = NumHelper(1000)
trigger1 = Helper(1000),var(59)

単純ifelseで置き換えできるわけではないことに注意。この場合は単純置換すると「Has no helper」警告メッセージが出ます。

AILevel

Win版みたいに決め打ちすればいいんじゃないかな

Const系

common1.cnsで使われてたりするので、うっかりcommon1.cnsをコピーしているキャラとか上書きしているキャラはコレに引っかかる。

それぞれ1.0付属のローレゾ版kfmのkfm.cnsに書いてある値に置き換えればいいのではないかと。

互換性ファイルを作る

いろいろ置き換えるのが面倒なので、いっそのこと全部変数でやろうと考えた結果がコレ。全部で28個変数を消費することになった

5900番を置き換えます。ただし、Win版で使う場合はRemapPalを削除する必要があります。

;------------------------------------------------------------------------------;
; Initialize (at the start of the round)
;------------------------------------------------------------------------------;
[Statedef 5900]
type            = S
movetype        = I
physics         = N
velset          = 0, 0
ctrl            = 0
sprpriority     = 0
movehitpersist  = 0
hitdefpersist   = 0
hitcountpersist = 0
;-------[ Variables ]-------;
[State 5900:            Var, 1, Clear all int variables]
type     = VarRangeSet
trigger1 = !RoundsExisted
value    = 0
[State 5900:            Var, 2, Clear all float variables]
type     = VarRangeSet
trigger1 = !RoundsExisted
fvalue   = 0
;-------[ Palettes ]-------;
[State 5900:            Remap Pal, 1, Set Palette of selection palette number]
type     = RemapPal
trigger1 = 1
source   = 1, 1
dest     = 1, PalNo
;-------[ Scale Compatibilities ]-------;
[State 5900:            SysFVar, 0, Game Window Width]
type       = VarSet
trigger1   = Time >= 0
sysfvar(0) = GameWidth
[State 5900:            SysFVar, 1, Game Window Height]
type       = VarSet
trigger1   = Time >= 0
sysfvar(1) = GameHeight
[State 5900:            SysFVar, 2, QVGA Pixel Ratio]
type       = VarSet
trigger1   = Time >= 0
sysfvar(2) = Const240p(1)
[State 5900:            SysFVar, 3, VGA Pixel Ratio]
type       = VarSet
trigger1   = Time >= 0
sysfvar(3) = Const480p(1)
[State 5900:            SysFVar, 4, HDTV Pixel Ratio]
type       = VarSet
trigger1   = Time >= 0
sysfvar(4) = Const720p(1)
;-------[ Constant Compatibilities ]-------;
[State 5900:            FVar, 10, X-Velocity of ground-recover]
type     = VarSet
trigger1 = Time >= 0
fv       = 10
value    = const(velocity.air.gethit.groundrecover.x)
[State 5900:            FVar, 11, Y-Velocity of ground-recover]
type     = VarSet
trigger1 = Time >= 0
fv       = 11
value    = const(velocity.air.gethit.groundrecover.y)
[State 5900:            FVar, 12, X-Velocity of air-recover for multiply]
type     = VarSet
trigger1 = Time >= 0
fv       = 12
value    = const(velocity.air.gethit.airrecover.mul.x)
[State 5900:            FVar, 13, Y-Velocity of air-recover for multiply]
type     = VarSet
trigger1 = Time >= 0
fv       = 13
value    = const(velocity.air.gethit.airrecover.mul.y)
[State 5900:            FVar, 14, X-Velocity of air-recover for adding]
type     = VarSet
trigger1 = Time >= 0
fv       = 14
value    = const(velocity.air.gethit.airrecover.add.x)
[State 5900:            FVar, 15, Y-Velocity of air-recover for adding]
type     = VarSet
trigger1 = Time >= 0
fv       = 15
value    = const(velocity.air.gethit.airrecover.add.y)
[State 5900:            FVar, 16, Y-Velocity for Upward-air-recover]
type     = VarSet
trigger1 = Time >= 0
fv       = 16
value    = const(velocity.air.gethit.airrecover.up)
[State 5900:            FVar, 17, Y-Velocity for Downward-air-recover]
type     = VarSet
trigger1 = Time >= 0
fv       = 17
value    = const(velocity.air.gethit.airrecover.down)
[State 5900:            FVar, 18, X-Velocity for Forward-air-recover]
type     = VarSet
trigger1 = Time >= 0
fv       = 18
value    = const(velocity.air.gethit.airrecover.fwd)
[State 5900:            FVar, 19, X-Velocity for Backward-air-recover]
type     = VarSet
trigger1 = Time >= 0
fv       = 19
value    = const(velocity.air.gethit.airrecover.back)
[State 5900:            FVar, 20, Reseting velocity threshold of stand friction]
type     = VarSet
trigger1 = Time >= 0
fv       = 20
value    = const(movement.stand.friction.threshold)
[State 5900:            FVar, 21, Reseting velocity threshold of crouch friction]
type     = VarSet
trigger1 = Time >= 0
fv       = 21
value    = const(movement.crouch.friction.threshold)
[State 5900:            FVar, 22, Y-position at which a falling player is considered to hit the ground]
type     = VarSet
trigger1 = Time >= 0
fv       = 22
value    = const(movement.air.gethit.groundlevel)
[State 5900:            FVar, 23, Y-position below which falling player can use the recovery command]
type     = VarSet
trigger1 = Time >= 0
fv       = 23
value    = const(movement.air.gethit.groundrecover.ground.threshold)
[State 5900:            FVar, 24, Y-position at which player in the ground recovery state touches the ground]
type     = VarSet
trigger1 = Time >= 0
fv       = 24
value    = const(movement.air.gethit.groundrecover.groundlevel)
[State 5900:            FVar, 25, Y-velocity above which player may use the air recovery command]
type     = VarSet
trigger1 = Time >= 0
fv       = 25
value    = const(movement.air.gethit.airrecover.threshold)
[State 5900:            FVar, 26, Vertical acceleration for player in the air recovery state]
type     = VarSet
trigger1 = Time >= 0
fv       = 26
value    = const(movement.air.gethit.airrecover.yaccel)
[State 5900:            FVar, 27, Y-position at which player in the tripped state touches the ground]
type     = VarSet
trigger1 = Time >= 0
fv       = 27
value    = const(movement.air.gethit.trip.groundlevel)
[State 5900:            FVar, 28, Offset for player bouncing off the ground (X)]
type     = VarSet
trigger1 = Time >= 0
fv       = 28
value    = const(movement.down.bounce.offset.x)
[State 5900:            FVar, 29, Offset for player bouncing off the ground (Y)]
type     = VarSet
trigger1 = Time >= 0
fv       = 29
value    = const(movement.down.bounce.offset.y)
[State 5900:            FVar, 30, Vertical acceleration for player bouncing off the ground]
type     = VarSet
trigger1 = Time >= 0
fv       = 30
value    = const(movement.down.bounce.yaccel)
[State 5900:            FVar, 31, Y-position at which player bouncing off the ground touches the ground again]
type     = VarSet
trigger1 = Time >= 0
fv       = 31
value    = const(movement.down.bounce.groundlevel)
[State 5900:            FVar, 32, Reseting velocity threshold of down friction]
type     = VarSet
trigger1 = Time >= 0
fv       = 32
value    = const(movement.down.friction.threshold)
;-------[ States ]-------;
[State 5900:            State, 1, Intro for Round 1]
type     = ChangeState
trigger1 = RoundNo = 1
value    = 190
[State 5900:            State, 2, All other rounds]
type     = ChangeState
trigger1 = 1
value    = 0