#apply
#include "../_include.txt"
#include "../../define/_vector2.txt"
#include "../../define/_const_pinball.txt"

/*
@param
機能
フリッパーID(0-1)
引数3
4
5
6
7
*/
cev[CEV_PB_FLIPPER_FUNC] .name(">>>>フリッパーの処理") {
    defv {
        a_func = TV_PB_FLIPPER_FUNC
        a_id
        a_3
        a_4
        a_5
        a_6

        ptr
        state
    }

    getFlipperPtr(ptr, a_id)
    state = v[ptr + MF_STATE]

    pseudoSwitchState(a_func,
    //------------------------
    //フリッパーを有効化する(func, id, bit, layer, x, y)
    //レイヤーはMID
    [ FL_FUNC_APPEAR, bl {
        @if state <= FL_ST_NONE bl {
            initFlipper(ptr, bl {
                $state = FL_ST_ENABLE
                $bit = a_3
                $layer = a_4
                $x = a_5 * UNIT_POS
                $y = a_6 * UNIT_POS
            } )
        }
    },
    //------------------------
    //フリッパーを消去する(func, id)
    FL_FUNC_DELETE, bl {
        @if state > FL_ST_DELETE bl {
            v[ptr + MF_STATE] = FL_ST_DELETE
        }
    } ] )
}
