[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,3,4
; Top : Org. -> Lesser Top -> Bra (Blue) -> Bra (Red) -> Topless

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

[KeySwitchVar3]
condition = $active
Key = ctrl no_shift no_alt c
type = cycle
$var3 = 0,1
; Panty : On/Off

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

; Skirt
[TextureOverrideLowerSkirt01]
hash = 2fdd453c
match_first_index = 1242
if $var2 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideLowerSkirt02]
hash = 2fdd453c
match_first_index = 19326
if $var2 > 0 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideMidSkirt01]
hash = 2fdd453c
match_first_index = 14751
if $var2 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt01]
hash = 2fdd453c
match_first_index = 20157
if $var2 > 2 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt02]
hash = 2fdd453c
match_first_index = 966
if $var2 > 2 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt03]
hash = 2fdd453c
match_first_index = 10860
if $var2 > 2 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt04]
hash = 2fdd453c
match_first_index = 11862
if $var2 > 2 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt05]
hash = 6d980973
match_first_index = 24837
if ($active || $shader_type == 5)
	handling = skip
	if $var2 <= 2
		vb0 = ResourceSkirtFlowerVB
		ib  = ResourceSkirtFlowerIB
		drawindexed = auto
	endif
	if $var1 == 0
		vb0 = ResourceTopFlowerVB
		ib  = ResourceTopFlowerIB
		drawindexed = auto
	endif
endif

[TextureOverrideSkirt06]
hash = 2555f998
match_first_index = 3780
if $var2 > 2 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt07]
hash = 2555f998
match_first_index = 0
if $var2 > 2 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt08]
hash = 962d5948
match_first_index = 26412
if $var2 > 2 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideSkirt09]
hash = 962d5948
match_first_index = 0
if ($active || $shader_type == 5)
	handling = skip
	if $var2 <= 2
		vb0 = ResourceSkirtFlower2VB
		ib  = ResourceSkirtFlower2IB
		drawindexed = auto
	endif
	if $var1 == 0
		vb0 = ResourceTopFlower2VB
		ib  = ResourceTopFlower2IB
		drawindexed = auto
	endif
endif

; Top
[TextureOverrideTopString01]
hash = 2fdd453c
match_first_index = 0
if $var1 > 0 && ($active || $shader_type == 5)
	handling = skip	
	if ($var1 == 2 || $var1 == 3)
		ResourceBakT0 = ref ps-t0
		ResourceBakT1 = ref ps-t1
		ResourceBakT2 = ref ps-t2
		
		if $var1 == 2
			ps-t0 = ResourceTextureBraA
			ps-t1 = ResourceTextureBraAN
			ps-t2 = ResourceTextureBraAS
		else
			ps-t0 = ResourceTextureRedBraA
			ps-t1 = ResourceTextureRedBraAN
			ps-t2 = ResourceTextureRedBraAS
		endif
		vb0 = ResourceBra1VB
		ib  = ResourceBra1IB
		drawindexed = auto
		vb0 = ResourceBra2VB
		ib  = ResourceBra2IB
		drawindexed = auto
		vb0 = ResourceBra3VB
		ib  = ResourceBra3IB
		drawindexed = auto
		
		if $var1 == 2
			ps-t0 = ResourceTextureBraB
			ps-t1 = ResourceTextureBraBN
			ps-t2 = ResourceTextureBraBS		
		else
			ps-t0 = ResourceTextureRedBraB
			ps-t1 = ResourceTextureRedBraBN
			ps-t2 = ResourceTextureRedBraBS
		endif
		vb0 = ResourceBra4VB
		ib  = ResourceBra4IB
		drawindexed = auto
		vb0 = ResourceBra5VB
		ib  = ResourceBra5IB
		drawindexed = auto
		ps-t2 = ref ResourceBakT2
		ps-t1 = ref ResourceBakT1
		ps-t0 = ref ResourceBakT0
	endif
endif

[TextureOverrideTop01]
hash = 2fdd453c
match_first_index = 4089
if ($active || $shader_type == 5)
	handling = skip
	if $var1 <= 1
		vb0 = ResourceTop1VB
		ib  = ResourceTop1IB
		drawindexed = auto
	endif	
endif

[TextureOverrideTop02]
hash = 2fdd453c
match_first_index = 9960
if ($active || $shader_type == 5)
	handling = skip
	if $var1 <= 1
		vb0 = ResourceTop2VB
		ib  = ResourceTop2IB
		drawindexed = auto
	endif
endif

[TextureOverrideTop03]
hash = 2fdd453c
match_first_index = 2073
if ($active || $shader_type == 5)
	handling = skip
	if $var1 <= 1
		vb0 = ResourceTop3VB
		ib  = ResourceTop3IB
		drawindexed = auto
	endif
endif

[TextureOverrideTop04]
hash = 962d5948
match_first_index = 22830
if $var1 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideTop05]
hash = 2555f998
match_first_index = 20304
if $var1 > 1 && ($active || $shader_type == 5)
	handling = skip
endif

; Necklace
[TextureOverrideNecklace01]
hash = 6d980973
match_first_index = 55725
if ($var4 == 1 || $var4 == 3) && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideNecklace02]
hash = 6d980973
match_first_index = 2190
if ($var4 == 1 || $var4 == 3) && ($active || $shader_type == 5)
	handling = skip
endif

[TextureOverrideNecklace03]
hash = 6d980973
match_first_index = 2430
if ($var4 == 1 || $var4 == 3) && ($active || $shader_type == 5)
	handling = skip
endif

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

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

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

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

; Shoes/Stocking
[TextureOverrideStocking01]
hash = 3db32195
match_first_index = 1752
if $var4 > 1 && ($active || $shader_type == 5)
	handling = skip
	vb0 = ResourceStockingLVB
	ib  = ResourceStockingLIB
	drawindexed = auto
endif

[TextureOverrideStocking02]
hash = 6d980973
match_first_index = 3672
if $var4 > 1 && ($active || $shader_type == 5)
	handling = skip
	vb0 = ResourceStockingRVB
	ib  = ResourceStockingRIB
	drawindexed = auto
endif

[TextureOverrideShoes01]
hash = 6d980973
match_first_index = 11037
if $var4 > 1 && ($active || $shader_type == 5)
	handling = skip	
endif

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

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

; Body
[TextureOverrideBody]
hash = c93c1d58
match_first_index = 0
$active = 1
handling = skip
if $var3 > 0
	vb0 = ResourceBodyVB
	ib  = ResourceBodyIB
else
	vb0 = ResourceToplessBodyVB
	ib  = ResourceToplessBodyIB
endif
drawindexed = auto	

; Resources
[ResourceBodyVB]
type = Buffer
stride = 80
filename = resources\body.vb

[ResourceBodyIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\body.ib

[ResourceToplessBodyVB]
type = Buffer
stride = 80
filename = resources\topless_body.vb

[ResourceToplessBodyIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\topless_body.ib

[ResourceTop1VB]
type = Buffer
stride = 76
filename = resources\Top_1.vb

[ResourceTop1IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Top_1.ib

[ResourceTop2VB]
type = Buffer
stride = 76
filename = resources\Top_2.vb

[ResourceTop2IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Top_2.ib

[ResourceTop3VB]
type = Buffer
stride = 76
filename = resources\Top_3.vb

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

[ResourceBra3VB]
type = Buffer
stride = 76
filename = resources\Bra_3.vb

[ResourceBra3IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bra_3.ib

[ResourceBra4VB]
type = Buffer
stride = 76
filename = resources\Bra_4.vb

[ResourceBra4IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bra_4.ib

[ResourceBra5VB]
type = Buffer
stride = 76
filename = resources\Bra_5.vb

[ResourceBra5IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bra_5.ib

[ResourceStockingRVB]
type = Buffer
stride = 76
filename = resources\Stocking_R.vb

[ResourceStockingRIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Stocking_R.ib

[ResourceStockingLVB]
type = Buffer
stride = 76
filename = resources\Stocking_L.vb

[ResourceStockingLIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Stocking_L.ib

[ResourceSkirtFlowerVB]
type = Buffer
stride = 76
filename = resources\Skirt_Flower.vb

[ResourceSkirtFlowerIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Skirt_Flower.ib

[ResourceTopFlowerVB]
type = Buffer
stride = 76
filename = resources\Top_Flower.vb

[ResourceTopFlowerIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Top_Flower.ib

[ResourceSkirtFlower2VB]
type = Buffer
stride = 76
filename = resources\Skirt_Flower_2.vb

[ResourceSkirtFlower2IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Skirt_Flower_2.ib

[ResourceTopFlower2VB]
type = Buffer
stride = 76
filename = resources\Top_Flower_2.vb

[ResourceTopFlower2IB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Top_Flower_2.ib

[ResourceBakT0]
[ResourceBakT1]
[ResourceBakT2]

[ResourceTextureBraA]
filename = resources\texture\bra_A.dds
[ResourceTextureBraAN]
filename = resources\texture\bra_A_N.dds
[ResourceTextureBraAS]
filename = resources\texture\bra_A_S.dds

[ResourceTextureBraB]
filename = resources\texture\bra_B.dds
[ResourceTextureBraBN]
filename = resources\texture\bra_B_N.dds
[ResourceTextureBraBS]
filename = resources\texture\bra_B_S.dds

[ResourceTextureRedBraA]
filename = resources\texture\red_bra_A.dds
[ResourceTextureRedBraAN]
filename = resources\texture\bra_A_N.dds
[ResourceTextureRedBraAS]
filename = resources\texture\red_bra_A_S.dds

[ResourceTextureRedBraB]
filename = resources\texture\red_bra_B.dds
[ResourceTextureRedBraBN]
filename = resources\texture\bra_B_N.dds
[ResourceTextureRedBraBS]
filename = resources\texture\red_bra_B_S.dds