[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,2
; Bra : Org. -> Lesser Bra Frill -> No Bra

[KeySwitchVar2]
condition = $active
Key = ctrl no_shift no_alt z
type = cycle
$var2 = 0,1,2
; Arm Clothing/Middle : Org. -> No Arm Clothing -> No Middle Frill

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

[KeySwitchVar4]
condition = $active
Key = ctrl no_shift no_alt v
type = cycle
$var4 = 0,1,2,3
; Shoes/Neck : Org. -> Shoes Only -> Neck Clothing Only -> None

; Bra Frill
[TextureOverrideBraFrill01]
hash = 545efc2a
match_first_index = 3336
if $var1 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideBraFrill02]
hash = 545efc2a
match_first_index = 5130
if $var1 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideBraFrill03]
hash = 56b6441b
match_first_index = 4668
if $var1 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

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

; Bra
[TextureOverrideBra01]
hash = 56b6441b
match_first_index = 10266
if $var1 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideBra02]
hash = 56b6441b
match_first_index = 5418
if $var1 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideBra03]
hash = 545efc2a
match_first_index = 7050
if ($active || $shader_type == 5)
	handling = skip
	if $var1 <= 1
		vb0 = ResourceBraVB
		ib  = ResourceBraIB
		drawindexed = auto
	endif
	if $var3 <= 1
		vb0 = ResourcePantyStrapVB
		ib  = ResourcePantyStrapIB
		drawindexed = auto
	endif
	if $var3 <= 1 && $var1 <= 1 && $var2 <= 1
		vb0 = ResourceMidStrapVB
		ib  = ResourceMidStrapIB
		drawindexed = auto
	endif
endif

; Middle Frill
[TextureOverrideMiddleFrill01]
hash = 56b6441b
match_first_index = 3597
if ($var3 > 1 || $var1 > 1 || $var2 > 1) && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideMiddleFrill02]
hash = 56b6441b
match_first_index = 558
if ($var3 > 1 || $var1 > 1 || $var2 > 1) && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideMiddleFrill03]
hash = 56b6441b
match_first_index = 2613
if ($var3 > 1 || $var1 > 1 || $var2 > 1) && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideMiddleFrill04]
hash = 56b6441b
match_first_index = 1629
if ($var3 > 1 || $var1 > 1 || $var2 > 1) && ($active || $shader_type == 5)
	handling = skip
endif

; Panty Frill
[TextureOverridePantyFrill01]
hash = 920f023f
match_first_index = 456
if $var3 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePantyFrill02]
hash = 920f023f
match_first_index = 3723
if $var3 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePantyFrill03]
hash = 920f023f
match_first_index = 228
if $var3 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePantyFrill04]
hash = 920f023f
match_first_index = 0
if $var3 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

; Panty 
[TextureOverridePanty01]
hash = 545efc2a
match_first_index = 18708
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePanty02]
hash = 545efc2a
match_first_index = 17232
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePanty03]
hash = 545efc2a
match_first_index = 22488
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePanty04]
hash = 545efc2a
match_first_index = 16656
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePanty05]
hash = 545efc2a
match_first_index = 6924
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePanty06]
hash = 920f023f
match_first_index = 228
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePanty07]
hash = 920f023f
match_first_index = 0
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverridePanty08]
hash = 17e5e5f8
if $var3 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

; Arm Clothing
[TextureOverrideArmClothing01]
hash = 56b6441b
match_first_index = 21186
if $var2 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideArmClothing02]
hash = 56b6441b
match_first_index = 17052
if $var2 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideArmClothing03]
hash = 56b6441b
match_first_index = 19248
if $var2 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideArmClothing04]
hash = 56b6441b
match_first_index = 15114
if $var2 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

; Neck Clothing
[TextureOverrideNeckClothing01]
hash = 6d77b017
match_first_index = 3912
if ($var4 == 1 || $var4 == 3) && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideNeckClothing02]
hash = 545efc2a
match_first_index = 1668
if ($var4 == 1 || $var4 == 3) && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideNeckClothing03]
hash = 545efc2a
match_first_index = 0
if ($var4 == 1 || $var4 == 3) && ($active || $shader_type == 5)
	handling = skip
endif

; Shoes
[TextureOverrideShoes01]
hash = d523c1b8
if $var4 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideShoes02]
hash = fd93ab23
if $var4 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideShoes03]
hash = 6d77b017
match_first_index = 5340
if $var4 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

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

; Body
[TextureOverrideBody]
hash = 503394c4
match_first_index = 0
$active = 1
handling = skip
if $var1 > 1
	vb0 = ResourceBodyU1VB
	ib  = ResourceBodyU1IB
else
	vb0 = ResourceBodyU0VB
	ib  = ResourceBodyU0IB
endif
drawindexed = auto
if $var2 > 0
	vb0 = ResourceBodyA1VB
	ib  = ResourceBodyA1IB
else
	vb0 = ResourceBodyA0VB
	ib  = ResourceBodyA0IB
endif
drawindexed = auto
if $var3 > 1
	vb0 = ResourceBodyL1VB
	ib  = ResourceBodyL1IB
else
	vb0 = ResourceBodyL0VB
	ib  = ResourceBodyL0IB
endif
drawindexed = auto
if $var4 > 1
	vb0 = ResourceBodyF1VB
	ib  = ResourceBodyF1IB
else
	vb0 = ResourceBodyF0VB
	ib  = ResourceBodyF0IB
endif
drawindexed = auto

; Resources
[ResourceBodyU0VB]
type = Buffer
stride = 80
filename = resources\body_U_0.vb

[ResourceBodyU0IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_U_0.ib

[ResourceBodyL0VB]
type = Buffer
stride = 80
filename = resources\body_L_0.vb

[ResourceBodyL0IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_L_0.ib

[ResourceBodyA0VB]
type = Buffer
stride = 80
filename = resources\body_A_0.vb

[ResourceBodyA0IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_A_0.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

[ResourceBodyU1VB]
type = Buffer
stride = 80
filename = resources\body_U_1.vb

[ResourceBodyU1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_U_1.ib

[ResourceBodyL1VB]
type = Buffer
stride = 80
filename = resources\body_L_1.vb

[ResourceBodyL1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_L_1.ib

[ResourceBodyA1VB]
type = Buffer
stride = 80
filename = resources\body_A_1.vb

[ResourceBodyA1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body_A_1.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

[ResourceBraVB]
type = Buffer
stride = 76
filename = resources\Bra.vb

[ResourceBraIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bra.ib

[ResourcePantyStrapVB]
type = Buffer
stride = 76
filename = resources\Panty_Strap.vb

[ResourcePantyStrapIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Panty_Strap.ib

[ResourceMidStrapVB]
type = Buffer
stride = 76
filename = resources\Mid_Strap.vb

[ResourceMidStrapIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Mid_Strap.ib
