[Constants]
global persist $var1 = 0
global persist $var2 = 0
global persist $var3 = 0
global persist $var4 = 0
global $active = 0

[Present]
post $active = 0

[KeySwitchVar1]
condition = $active
Key = ctrl no_shift no_alt x
type = cycle
$var1 = 0,1
; Top : Org. ->

[KeySwitchVar2]
condition = $active
Key = ctrl no_shift no_alt z
type = cycle
$var2 = 0,1,2,3
; Skirt : Org. ->

[KeySwitchVar3]
condition = $active
Key = ctrl no_shift no_alt c
type = cycle
$var3 = 0,1
; Panty : Org. -> Off

[KeySwitchVar4]
condition = $active
Key = ctrl no_shift no_alt v
type = cycle
$var4 = 0,1
; Shoes : Org. -> Off

; Jewels
[TextureOverrideJewel01]
hash = 1f00e6f1
match_first_index = 0
if ($active || $shader_type == 5)
    handling = skip
    if $var1 == 0
        vb0 = ResourceJ1BVB
        ib  = ResourceJ1BIB
        drawindexed = auto
    endif
    if $var3 == 0
        vb0 = ResourceJ1PVB
        ib  = ResourceJ1PIB
        drawindexed = auto
    endif
endif

[TextureOverrideJewel02]
hash = 8d113224
match_first_index = 0
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceJ2LVB
    ib  = ResourceJ2LIB
    drawindexed = auto    
    if $var1 == 0
        vb0 = ResourceJ2BVB
        ib  = ResourceJ2BIB
        drawindexed = auto
    endif
    if $var3 == 0
        vb0 = ResourceJ2PVB
        ib  = ResourceJ2PIB
        drawindexed = auto
    endif
endif

[TextureOverrideJewel03]
hash = c3f97f8f
match_first_index = 18633
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceJ3LVB
    ib  = ResourceJ3LIB
    drawindexed = auto    
    if $var1 == 0
        vb0 = ResourceJ3BVB
        ib  = ResourceJ3BIB
        drawindexed = auto
    endif
    if $var3 == 0
        vb0 = ResourceJ3PVB
        ib  = ResourceJ3PIB
        drawindexed = auto
    endif
endif

[TextureOverrideJewel04]
hash = c3f97f8f
match_first_index = 12273
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceJ4LVB
    ib  = ResourceJ4LIB
    drawindexed = auto    
    if $var1 == 0
        vb0 = ResourceJ4BVB
        ib  = ResourceJ4BIB
        drawindexed = auto
    endif
    if $var3 == 0
        vb0 = ResourceJ4PVB
        ib  = ResourceJ4PIB
        drawindexed = auto
    endif
endif

[TextureOverrideJewel05]
hash = e15467c5
match_first_index = 5490
if ($active || $shader_type == 5)
    handling = skip
    if $var1 == 0
        vb0 = ResourceJ5BVB
        ib  = ResourceJ5BIB
        drawindexed = auto
    endif
    if $var3 == 0
        vb0 = ResourceJ5PVB
        ib  = ResourceJ5PIB
        drawindexed = auto
    endif
endif

[TextureOverrideJewel06]
hash = e15467c5
match_first_index = 4050
if ($active || $shader_type == 5)
    handling = skip
    if $var1 == 0
        vb0 = ResourceJ6BVB
        ib  = ResourceJ6BIB
        drawindexed = auto
    endif
    if $var3 == 0
        vb0 = ResourceJ6PVB
        ib  = ResourceJ6PIB
        drawindexed = auto
    endif
endif

; Bra
[TextureOverrideBra01]
hash = c3f97f8f
match_first_index = 0
if ($active || $shader_type == 5)
    handling = skip
    if $var1 == 0
        vb0 = ResourceBra1VB
        ib  = ResourceBra1IB
        run = CommandListDrawBraPanty
    endif
    if $var3 == 0
        vb0 = ResourcePanty1VB
        ib  = ResourcePanty1IB
        run = CommandListDrawBraPanty
    endif
endif

[TextureOverrideBra02]
hash = c3f97f8f
match_first_index = 9807
if ($active || $shader_type == 5)
    handling = skip
    if $var1 == 0
        vb0 = ResourceBra2VB
        ib  = ResourceBra2IB
        drawindexed = auto
    endif
    if $var3 == 0
        vb0 = ResourcePanty2VB
        ib  = ResourcePanty2IB
        drawindexed = auto
    endif
endif

[TextureOverrideBra03]
hash = e15467c5
match_first_index = 0
if $var1 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

; Panty
[TextureOverridePanty01]
hash = c3f97f8f
match_first_index = 9111
if $var3 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverridePanty02]
hash = c3f97f8f
match_first_index = 7443
if $var3 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverridePanty03]
hash = c3f97f8f
match_first_index = 36993
if $var3 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverridePanty04]
hash = 8d113224
match_first_index = 10074
if $var3 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

; Shoes
[TextureOverrideShoes01]
hash = e15467c5
match_first_index = 1170
if $var4 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverrideShoes02]
hash = e15467c5
match_first_index = 10242
if $var4 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverrideShoes03]
hash = e15467c5
match_first_index = 19458
if $var4 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverrideShoes04]
hash = 1f00e6f1
match_first_index = 7008
if $var4 > 0 && ($active || $shader_type == 5)
    handling = skip
endif

; Body
[TextureOverrideBody]
hash = a3f55e0b
match_first_index = 0
$active = 1
handling = skip
if $var3 > 0 || $var2 > 0
    vb0 = ResourceBody1VB
    ib  = ResourceBody1IB
else
    vb0 = ResourceBody0VB
    ib  = ResourceBody0IB
endif
drawindexed = auto
if $var4 > 0
    vb0 = ResourceBodyF1VB
    ib  = ResourceBodyF1IB
else
    vb0 = ResourceBodyF0VB
    ib  = ResourceBodyF0IB
endif
drawindexed = auto

[TextureOverrideFingerNails]
hash = c3f97f8f
match_first_index = 37209
if $var4 > 0 && ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceFingerNailsVB
    ib  = ResourceFingerNailsIB
    drawindexed = auto
endif

; Resources
[ResourceBody0VB]
type = Buffer
stride = 80
filename = resources\body_0.vb
[ResourceBody0IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_0.ib

[ResourceBody1VB]
type = Buffer
stride = 80
filename = resources\body_1.vb
[ResourceBody1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_1.ib

[ResourceBodyF0VB]
type = Buffer
stride = 80
filename = resources\body_F_0.vb
[ResourceBodyF0IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_F_0.ib

[ResourceBodyF1VB]
type = Buffer
stride = 80
filename = resources\body_F_1.vb
[ResourceBodyF1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_F_1.ib

[ResourceFingerNailsVB]
type = Buffer
stride = 76
filename = resources\Finger_Nails.vb
[ResourceFingerNailsIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Finger_Nails.ib

[ResourceBra1VB]
type = Buffer
stride = 76
filename = resources\Bra_1.vb
[ResourceBra1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bra_1.ib

[ResourceBra2VB]
type = Buffer
stride = 76
filename = resources\Bra_2.vb
[ResourceBra2IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bra_2.ib

[ResourcePanty1VB]
type = Buffer
stride = 76
filename = resources\Panty_1.vb
[ResourcePanty1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Panty_1.ib

[ResourcePanty2VB]
type = Buffer
stride = 76
filename = resources\Panty_2.vb
[ResourcePanty2IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Panty_2.ib

[ResourceJ1PVB]
type = Buffer
stride = 60
filename = resources\J1P.vb
[ResourceJ1PIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J1P.ib

[ResourceJ1BVB]
type = Buffer
stride = 60
filename = resources\J1B.vb
[ResourceJ1BIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J1B.ib

[ResourceJ2PVB]
type = Buffer
stride = 60
filename = resources\J2P.vb
[ResourceJ2PIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J2P.ib

[ResourceJ2BVB]
type = Buffer
stride = 60
filename = resources\J2B.vb
[ResourceJ2BIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J2B.ib

[ResourceJ2LVB]
type = Buffer
stride = 60
filename = resources\J2L.vb
[ResourceJ2LIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J2L.ib

[ResourceJ3PVB]
type = Buffer
stride = 76
filename = resources\J3P.vb
[ResourceJ3PIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J3P.ib

[ResourceJ3BVB]
type = Buffer
stride = 76
filename = resources\J3B.vb
[ResourceJ3BIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J3B.ib

[ResourceJ3LVB]
type = Buffer
stride = 76
filename = resources\J3L.vb
[ResourceJ3LIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J3L.ib

[ResourceJ4PVB]
type = Buffer
stride = 76
filename = resources\J4P.vb
[ResourceJ4PIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J4P.ib

[ResourceJ4BVB]
type = Buffer
stride = 76
filename = resources\J4B.vb
[ResourceJ4BIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J4B.ib

[ResourceJ4LVB]
type = Buffer
stride = 76
filename = resources\J4L.vb
[ResourceJ4LIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J4L.ib

[ResourceJ5PVB]
type = Buffer
stride = 76
filename = resources\J5P.vb
[ResourceJ5PIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J5P.ib

[ResourceJ5BVB]
type = Buffer
stride = 76
filename = resources\J5B.vb
[ResourceJ5BIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J5B.ib

[ResourceJ6PVB]
type = Buffer
stride = 76
filename = resources\J6P.vb
[ResourceJ6PIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J6P.ib

[ResourceJ6BVB]
type = Buffer
stride = 76
filename = resources\J6B.vb
[ResourceJ6BIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\J6B.ib

; Transparency
[CustomShaderTransparency1]
blend[0] = ADD BLEND_FACTOR INV_BLEND_FACTOR
blend_factor[0] = 0.85
blend_factor[1] = 0.85
blend_factor[2] = 0.85
blend_factor[3] = 1
drawindexed = auto

[CustomShaderTransparency2]
blend[0] = ADD BLEND_FACTOR INV_BLEND_FACTOR
blend_factor[0] = 0.7
blend_factor[1] = 0.7
blend_factor[2] = 0.7
blend_factor[3] = 1
drawindexed = auto

[CustomShaderTransparency3]
blend[0] = ADD BLEND_FACTOR INV_BLEND_FACTOR
blend_factor[0] = 0.5
blend_factor[1] = 0.5
blend_factor[2] = 0.5
blend_factor[3] = 1
drawindexed = auto

[CommandListDrawBraPanty]
if $var2 == 0
	drawindexed = auto
elif $var2 == 1
	run = CustomShaderTransparency1
elif $var2 == 2
	run = CustomShaderTransparency2
else 
	run = CustomShaderTransparency3
endif