; Skirk

; Constants -------------------------
[Constants]
global $active
global $pause = 0
global persist $Speed = 0.5
global persist $texswap = 0
global $TargetSpeed
global $Freq = 0
global $dt
global $ts
global $moreHeld
global $lessHeld
global $anime_state = 0
post ResourceSkirkBodyPosition = copy_desc ResourceSkirkBodyPosition.1
post ResourceSkirkEBodyPosition = copy_desc ResourceSkirkEBodyPosition.1
post ResourceSkirkLimbPosition = copy_desc ResourceSkirkLimbPosition.1
post ResourceSkirkEyePosition = copy_desc ResourceSkirkEyePosition.1
post run = CustomShaderComputeAnim
post $TargetSpeed = $Speed

global persist $menu = 0
global $hold

[KeyMenu]
key = no_ctrl no_shift alt v
type = cycle
$menu = 0,1

[KeyPause]
key = no_ctrl no_shift alt p
type = cycle
$pause = 0,1

[KeyMore]
key = no_ctrl no_shift alt right
type = hold
$moreHeld = 1

[KeyLess]
key = no_ctrl no_shift alt left
type = hold
$lessHeld = 1

[KeyAnime]
key = ]
type = cycle
$anime_state = 0,1

[KeyColor]
key = VK_RIGHT
type = cycle
$texswap = 0,1

[CommandListInreaseSpeed]
$TargetSpeed = $TargetSpeed + 0.01
if $TargetSpeed >= 0.999
    $TargetSpeed = 0.999
endif
run = CommandListInterpolateSpeed

[CommandListDecreaseSpeed]
$TargetSpeed = $TargetSpeed - 0.01
if $TargetSpeed < 0
    $TargetSpeed = 0
endif
run = CommandListInterpolateSpeed

[KeyHold]
condition = $menu == 1
key = VK_LBUTTON
type = hold
$hold = 1

[Present]
if $active
    run = CustomShaderComputeAnim
    if $lessHeld
        run = CommandListDecreaseSpeed
    else if $moreHeld
        run = CommandListInreaseSpeed
    endif
    if $menu
        run = CommandListDraw
    endif
endif
post $active = 0

[CustomShaderComputeAnim]
$dt = time - $ts
$ts = time
if $anime_state == 0
    if $pause == 0
        $Freq = $Freq + $Speed * $dt
    endif
    if $Freq > 10
        $Freq = -0.05236
        $anime_state = 1
    endif
    x88 = $Freq
    cs-t50 = copy ResourceSkirkBodyPosition.1
    cs-t51 = copy ResourceSkirkBodyPosition.2
    cs = ./res/anim.hlsl
    cs-u5 = copy ResourceSkirkBodyPosition.1
    ResourceSkirkBodyPosition = ref cs-u5
    Dispatch = 34679, 1, 1
    cs-t50 = copy ResourceSkirkEBodyPosition.1
    cs-t51 = copy ResourceSkirkEBodyPosition.2
    cs-u5 = copy ResourceSkirkEBodyPosition.1
    ResourceSkirkEBodyPosition = ref cs-u5
    Dispatch = 31308, 1, 1
    cs-t50 = copy ResourceSkirkLimbPosition.1
    cs-t51 = copy ResourceSkirkLimbPosition.2
    cs-u5 = copy ResourceSkirkLimbPosition.1
    ResourceSkirkLimbPosition = ref cs-u5
    Dispatch = 7567, 1, 1
    cs-t50 = copy ResourceSkirkEyePosition.1
    cs-t51 = copy ResourceSkirkEyePosition.2
    cs-u5 = copy ResourceSkirkEyePosition.1
    ResourceSkirkEyePosition = ref cs-u5
    Dispatch = 229, 1, 1
    cs-u5 = null
    cs-t50 = null
    cs-t51 = null
endif
if $anime_state == 1
    if $pause == 0
        $Freq = $Freq + $Speed * $dt
    endif
    if $Freq > 0.05236
        $Freq = -0.05236
	$anime_state = 2
    endif
    x88 = $Freq
    cs-t50 = copy ResourceSkirkBodyPosition.1
    cs-t51 = copy ResourceSkirkBodyPosition.3
    cs-u5 = copy ResourceSkirkBodyPosition.1
    ResourceSkirkBodyPosition = ref cs-u5
    Dispatch = 34679, 1, 1
    cs-t50 = copy ResourceSkirkEBodyPosition.1
    cs-t51 = copy ResourceSkirkEBodyPosition.3
    cs-u5 = copy ResourceSkirkEBodyPosition.1
    ResourceSkirkEBodyPosition = ref cs-u5
    Dispatch = 31308, 1, 1
    cs-t50 = copy ResourceSkirkLimbPosition.1
    cs-t51 = copy ResourceSkirkLimbPosition.3
    cs-u5 = copy ResourceSkirkLimbPosition.1
    ResourceSkirkLimbPosition = ref cs-u5
    Dispatch = 7567, 1, 1
    cs-t50 = copy ResourceSkirkEyePosition.1
    cs-t51 = copy ResourceSkirkEyePosition.3
    cs-u5 = copy ResourceSkirkEyePosition.1
    ResourceSkirkEyePosition = ref cs-u5
    Dispatch = 229, 1, 1
    cs-u5 = null
    cs-t50 = null
    cs-t51 = null
endif
if $anime_state == 2
    if $pause == 0
        $Freq = $Freq + 5 * $dt
    endif
    if $Freq > 9
        $Freq = 0.05236
	$anime_state = 3
    endif
    x88 = $Freq
    cs-t50 = copy ResourceSkirkBodyPosition.3
    cs-t51 = copy ResourceSkirkBodyPosition.4
    cs-u5 = copy ResourceSkirkBodyPosition.3
    ResourceSkirkBodyPosition = ref cs-u5
    Dispatch = 34679, 1, 1
    cs-t50 = copy ResourceSkirkEBodyPosition.3
    cs-t51 = copy ResourceSkirkEBodyPosition.4
    cs-u5 = copy ResourceSkirkEBodyPosition.3
    ResourceSkirkEBodyPosition = ref cs-u5
    Dispatch = 31308, 1, 1
    cs-t50 = copy ResourceSkirkLimbPosition.3
    cs-t51 = copy ResourceSkirkLimbPosition.4
    cs-u5 = copy ResourceSkirkLimbPosition.3
    ResourceSkirkLimbPosition = ref cs-u5
    Dispatch = 7567, 1, 1
    cs-t50 = copy ResourceSkirkEyePosition.3
    cs-t51 = copy ResourceSkirkEyePosition.4
    cs-u5 = copy ResourceSkirkEyePosition.3
    ResourceSkirkEyePosition = ref cs-u5
    Dispatch = 229, 1, 1
    cs-u5 = null
    cs-t50 = null
    cs-t51 = null
endif
if $anime_state == 3
    if $pause == 0
        $Freq = $Freq + $Speed * $dt
    endif
    if $Freq > 0.157
        $Freq = -0.05236
	$anime_state = 0
    endif
  x88 = $Freq
    cs-t50 = copy ResourceSkirkBodyPosition.1
    cs-t51 = copy ResourceSkirkBodyPosition.3
    cs-u5 = copy ResourceSkirkBodyPosition.1
    ResourceSkirkBodyPosition = ref cs-u5
    Dispatch = 34679, 1, 1
    cs-t50 = copy ResourceSkirkEBodyPosition.1
    cs-t51 = copy ResourceSkirkEBodyPosition.3
    cs-u5 = copy ResourceSkirkEBodyPosition.1
    ResourceSkirkEBodyPosition = ref cs-u5
    Dispatch = 31308, 1, 1
    cs-t50 = copy ResourceSkirkLimbPosition.1
    cs-t51 = copy ResourceSkirkLimbPosition.3
    cs-u5 = copy ResourceSkirkLimbPosition.1
    ResourceSkirkLimbPosition = ref cs-u5
    Dispatch = 7567, 1, 1
    cs-t50 = copy ResourceSkirkEyePosition.1
    cs-t51 = copy ResourceSkirkEyePosition.3
    cs-u5 = copy ResourceSkirkEyePosition.1
    ResourceSkirkEyePosition = ref cs-u5
    Dispatch = 229, 1, 1
    cs-u5 = null
    cs-t50 = null
    cs-t51 = null
endif

; Overrides -------------------------

[TextureOverrideSkirkSkirtPosition]
hash = 1795d9cb
vb0 = ResourceSkirkSkirtPosition

[TextureOverrideSkirkSkirtBlend]
hash = ef433e3b
vb1 = ResourceSkirkSkirtBlend
handling = skip
draw = 4,0 

[TextureOverrideSkirkSkirtTexcoord]
hash = bf2a349f
vb1 = ResourceSkirkSkirtTexcoord

[TextureOverrideSkirkSkirtVertexLimitRaise]
hash = efd8a950
override_vertex_count = 4
override_byte_stride = 84

[TextureOverrideSkirkBodyPosition]
hash = 9ce8105a
vb0 = ResourceSkirkBodyPosition

[TextureOverrideSkirkBodyBlend]
hash = f7cfc40f
vb1 = ResourceSkirkBodyBlend
handling = skip
draw = 34734,0 

[TextureOverrideSkirkBodyTexcoord]
hash = 0c49941e
vb1 = ResourceSkirkBodyTexcoord

[TextureOverrideSkirkBodyVertexLimitRaise]
hash = 52da0bc7
override_vertex_count = 34734
override_byte_stride = 92

[TextureOverrideSkirkLimbPosition]
hash = a788689b
vb0 = ResourceSkirkLimbPosition
$active = 1

[TextureOverrideSkirkLimbBlend]
hash = e1de8e8e
vb1 = ResourceSkirkLimbBlend
handling = skip
draw = 7569,0 

[TextureOverrideSkirkLimbTexcoord]
hash = 5979231d
vb1 = ResourceSkirkLimbTexcoord

[TextureOverrideSkirkLimbVertexLimitRaise]
hash = b8b82723
override_vertex_count = 7569
override_byte_stride = 92

[TextureOverrideSkirkEyePosition]
hash = 02c3f76e
vb0 = ResourceSkirkEyePosition

[TextureOverrideSkirkEyeBlend]
hash = 65564c8b
vb1 = ResourceSkirkEyeBlend
handling = skip
draw = 229,0 

[TextureOverrideSkirkEyeTexcoord]
hash = 02a55582
vb1 = ResourceSkirkEyeTexcoord

[TextureOverrideSkirkEyeVertexLimitRaise]
hash = 198acd39
override_vertex_count = 229
override_byte_stride = 84

[TextureOverrideSkirkForehairPosition]
hash = 1d025d3b
vb0 = ResourceSkirkForehairPosition

[TextureOverrideSkirkForehairBlend]
hash = e520d278
vb1 = ResourceSkirkForehairBlend
handling = skip
draw = 2397,0 

[TextureOverrideSkirkForehairTexcoord]
hash = 6ac3b9bf
vb1 = ResourceSkirkForehairTexcoord

[TextureOverrideSkirkForehairVertexLimitRaise]
hash = 49393f27
override_vertex_count = 2397
override_byte_stride = 84

[TextureOverrideSkirkEBodyPosition]
hash = 2711cd82
vb0 = ResourceSkirkEBodyPosition

[TextureOverrideSkirkEBodyBlend]
hash = 16298249
vb1 = ResourceSkirkEBodyBlend
handling = skip
draw = 31319,0 

[TextureOverrideSkirkEBodyTexcoord]
hash = e7027075
vb1 = ResourceSkirkEBodyTexcoord

[TextureOverrideSkirkEBodyVertexLimitRaise]
hash = 88dfbb52
override_vertex_count = 31319
override_byte_stride = 92

[TextureOverrideSkirkSkirtIB]
hash = 056da8f3
handling = skip
drawindexed = auto

[TextureOverrideSkirkSkirtHead]
hash = 056da8f3
match_first_index = 0
ib = ResourceSkirkSkirtHeadIB
ps-t0 = ResourceSkirkSkirtHeadDiffuse
ps-t1 = ResourceSkirkSkirtHeadLightMap

[TextureOverrideSkirkBodyIB]
hash = 1fbe8217
handling = skip
drawindexed = auto

[TextureOverrideSkirkBodyHead]
hash = 1fbe8217
match_first_index = 0
ib = ResourceSkirkBodyHeadIB
ps-t0 = ResourceSkirkBodyHeadDiffuse
ps-t1 = ResourceSkirkBodyHeadLightMap

[TextureOverrideSkirkLimbIB]
hash = dafe18b6
handling = skip
drawindexed = auto

[TextureOverrideSkirkLimbHead]
hash = dafe18b6
match_first_index = 0
ib = ResourceSkirkLimbHeadIB
ps-t0 = ResourceSkirkLimbHeadNormalMap
ps-t1 = ResourceSkirkLimbHeadDiffuse
ps-t2 = ResourceSkirkLimbHeadLightMap

[TextureOverrideSkirkLimbBody]
hash = dafe18b6
match_first_index = 13650
ib = ResourceSkirkLimbBodyIB
ps-t0 = ResourceSkirkLimbBodyDiffuse
ps-t1 = ResourceSkirkLimbBodyLightMap
ps-t2 = ResourceSkirkLimbBodyMaterialMap

[TextureOverrideSkirkEyeIB]
hash = a831e5b5
handling = skip
drawindexed = auto

[TextureOverrideSkirkEyeHead]
hash = a831e5b5
match_first_index = 0
ib = ResourceSkirkEyeHeadIB

[TextureOverrideSkirkForehairIB]
hash = 74811ddf
handling = skip
drawindexed = auto

[TextureOverrideSkirkForehairHead]
hash = 74811ddf
match_first_index = 0
ib = ResourceSkirkForehairHeadIB

[TextureOverrideSkirkEBodyIB]
hash = ac3db451
handling = skip
drawindexed = auto

[TextureOverrideSkirkEBodyHead]
hash = ac3db451
match_first_index = 0
ib = ResourceSkirkEBodyHeadIB
ps-t0 = ResourceSkirkEBodyHeadDiffuse
ps-t1 = ResourceSkirkEBodyHeadLightMap

[TextureOverrideSkirkEBodyBody]
hash = ac3db451
match_first_index = 34230
ib = ResourceSkirkEBodyBodyIB

[TextureOverrideSkirkEBodyDress]
hash = ac3db451
match_first_index = 35019
ib = ResourceSkirkEBodyDressIB

[TextureOverrideSkirkEBodyExtra]
hash = ac3db451
match_first_index = 37533
ib = ResourceSkirkEBodyExtraIB

[TextureOverrideSkirkFaceHeadDiffuse]
hash = 61f8c685
this = ResourceSkirkFaceHeadDiffuse

; CommandList -----------------------
[CommandListDraw]
ps-t100 = ResourceSlider
x87 = 0.09 * res_width/res_height
y87 = 0.005
z87 = 0.42
w87 = 0.897
run = CustomShaderElement

ps-t100 = ResourceSliderPink
x87 = $Speed * x87
run = CustomShaderElement

x87 = 0.09 * res_width/res_height
run = CommandListCursor

[CommandListInterpolateSpeed]
local $td = 0.033
local $ds = ($TargetSpeed - $Speed) / $td
$Speed = $Speed + $ds * $dt

[CommandListCursor]
local $x = z87
local $y = w87
local $xo = z87 + x87
local $yo = w87 + y87
z87 = (z87 + x87 * (($Speed))) - 0.0085

run = CommandListInterpolateSpeed

if cursor_x > $x && cursor_x < $xo
    if cursor_y > $y - 0.04 && cursor_y < $yo + 0.03
        if $hold
            $TargetSpeed = ((cursor_x-$x)/($xo-$x))
        endif
    endif
endif

ps-t100 = ResourceButton
x87 = 0.01 * res_width/res_height
y87 = 0.018 * res_width/res_height
w87 = 0.883
run = CustomShaderElement

[CustomShaderElement]
vs = ./res/draw_2d.hlsl
ps = ./res/draw_2d.hlsl
blend = ADD SRC_ALPHA INV_SRC_ALPHA
cull = none
topology = triangle_strip
o0 = set_viewport bb
Draw = 4,0

; Resources -------------------------

[ResourceSkirkSkirtPosition]
type = Buffer
stride = 40
filename = SkirkSkirtPosition.buf

[ResourceSkirkSkirtBlend]
type = Buffer
stride = 32
filename = SkirkSkirtBlend.buf

[ResourceSkirkSkirtTexcoord]
type = Buffer
stride = 12
filename = SkirkSkirtTexcoord.buf

;anime
[ResourceSkirkBodyPosition]

[ResourceSkirkBodyPosition.1]
type = Buffer
stride = 40
filename = SkirkBodyPosition1.buf
[ResourceSkirkBodyPosition.2]
type = Buffer
stride = 40
filename = SkirkBodyPosition2.buf
[ResourceSkirkBodyPosition.3]
type = Buffer
stride = 40
filename = SkirkBodyPosition3.buf
[ResourceSkirkBodyPosition.4]
type = Buffer
stride = 40
filename = SkirkBodyPosition4.buf

[ResourceSkirkBodyBlend]
type = Buffer
stride = 32
filename = SkirkBodyBlend.buf

[ResourceSkirkBodyTexcoord]
type = Buffer
stride = 20
filename = SkirkBodyTexcoord.buf

;anime
[ResourceSkirkLimbPosition]

[ResourceSkirkLimbPosition.1]
type = Buffer
stride = 40
filename = SkirkLimbPosition1.buf
[ResourceSkirkLimbPosition.2]
type = Buffer
stride = 40
filename = SkirkLimbPosition2.buf
[ResourceSkirkLimbPosition.3]
type = Buffer
stride = 40
filename = SkirkLimbPosition3.buf
[ResourceSkirkLimbPosition.4]
type = Buffer
stride = 40
filename = SkirkLimbPosition4.buf

[ResourceSkirkLimbBlend]
type = Buffer
stride = 32
filename = SkirkLimbBlend.buf

[ResourceSkirkLimbTexcoord]
type = Buffer
stride = 20
filename = SkirkLimbTexcoord.buf

;anime
[ResourceSkirkEyePosition]

[ResourceSkirkEyePosition.1]
type = Buffer
stride = 40
filename = SkirkEyePosition1.buf
[ResourceSkirkEyePosition.2]
type = Buffer
stride = 40
filename = SkirkEyePosition2.buf
[ResourceSkirkEyePosition.3]
type = Buffer
stride = 40
filename = SkirkEyePosition3.buf
[ResourceSkirkEyePosition.4]
type = Buffer
stride = 40
filename = SkirkEyePosition4.buf

[ResourceSkirkEyeBlend]
type = Buffer
stride = 32
filename = SkirkEyeBlend.buf

[ResourceSkirkEyeTexcoord]
type = Buffer
stride = 12
filename = SkirkEyeTexcoord.buf

[ResourceSkirkForehairPosition]
type = Buffer
stride = 40
filename = SkirkForehairPosition.buf

[ResourceSkirkForehairBlend]
type = Buffer
stride = 32
filename = SkirkForehairBlend.buf

[ResourceSkirkForehairTexcoord]
type = Buffer
stride = 12
filename = SkirkForehairTexcoord.buf

;anime
[ResourceSkirkEBodyPosition]

[ResourceSkirkEBodyPosition.1]
type = Buffer
stride = 40
filename = SkirkEBodyPosition1.buf
[ResourceSkirkEBodyPosition.2]
type = Buffer
stride = 40
filename = SkirkEBodyPosition2.buf
[ResourceSkirkEBodyPosition.3]
type = Buffer
stride = 40
filename = SkirkEBodyPosition3.buf
[ResourceSkirkEBodyPosition.4]
type = Buffer
stride = 40
filename = SkirkEBodyPosition4.buf

[ResourceSkirkEBodyBlend]
type = Buffer
stride = 32
filename = SkirkEBodyBlend.buf

[ResourceSkirkEBodyTexcoord]
type = Buffer
stride = 20
filename = SkirkEBodyTexcoord.buf

[ResourceSkirkSkirtHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkSkirtHead.ib

[ResourceSkirkBodyHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkBodyHead.ib

[ResourceSkirkLimbHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkLimbHead.ib

[ResourceSkirkLimbBodyIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkLimbBody.ib

[ResourceSkirkEyeHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkEyeHead.ib

[ResourceSkirkForehairHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkForehairHead.ib

[ResourceSkirkEBodyHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkEBodyHead.ib

[ResourceSkirkEBodyBodyIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkEBodyBody.ib

[ResourceSkirkEBodyDressIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkEBodyDress.ib

[ResourceSkirkEBodyExtraIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = SkirkEBodyExtra.ib

[ResourceSkirkSkirtHeadDiffuse]
filename = SkirkSkirtHeadDiffuse.dds

[ResourceSkirkSkirtHeadLightMap]
filename = SkirkSkirtHeadLightMap.dds

[ResourceSkirkBodyHeadDiffuse]
filename = SkirkBodyHeadDiffuse.dds

[ResourceSkirkBodyHeadLightMap]
filename = SkirkBodyHeadLightMap.dds

[ResourceSkirkLimbHeadNormalMap]
filename = SkirkLimbHeadNormalMap.dds

[ResourceSkirkLimbHeadDiffuse]
filename = SkirkLimbHeadDiffuse.dds

[ResourceSkirkLimbHeadLightMap]
filename = SkirkLimbHeadLightMap.dds

[ResourceSkirkLimbBodyDiffuse]
filename = SkirkLimbBodyDiffuse.dds

[ResourceSkirkLimbBodyLightMap]
filename = SkirkLimbBodyLightMap.dds

[ResourceSkirkLimbBodyMaterialMap]
filename = SkirkLimbBodyMaterialMap.dds

[ResourceSkirkEBodyHeadDiffuse]
filename = SkirkEBodyHeadDiffuse.dds

[ResourceSkirkEBodyHeadLightMap]
filename = SkirkEBodyHeadLightMap.dds

[ResourceButton]
filename = ./res/Button.png

[ResourceSlider]
filename = ./res/Slider.png

[ResourceSliderPink]
filename = ./res/Slider_pink.png

[ResourceSkirkFaceHeadDiffuse]
filename = SkirkFaceHeadDiffuse.dds


; .ini generated by XXMI (XX-Model-Importer)
; If you have any issues or find any bugs, please open a ticket at https://github.com/leotorrez/XXMI-Tools/issues