[Constants]
global persist $var1 = 2
global persist $var2 = 0
global $active = 0

[Present]
post $active = 0

[KeySwitchCostume1]
condition = $active
Key = ctrl no_shift no_alt x
type = cycle
$var1 = 0,1,2,3,4
; CTRL + X (suit) : Org. -> Lesser Transparent -> Transparent -> More Transparent -> Nude

[KeySwitchCostume2]
condition = $active
Key = ctrl no_shift no_alt z
type = cycle
$var2 = 0,1,2
; CTRL + Z (color) : Org.(Black) -> White -> Pink

; Suit
[TextureOverrideCommonSuit01]
hash = 74c3b92b
match_first_index = 0
if $active
	handling = skip
	vb0 = ResourceCommonSuitVB
	ib  = ResourceCommonSuitIB		
	run = CommandListDrawSuit
endif

[TextureOverrideCommonSuit02]
hash = fc4e87d1
match_first_index = 0
if $active
	handling = skip
endif

[TextureOverrideHonokaSuit01]
hash = 20fb8fa1
match_first_index = 0
if $active
	handling = skip
	vb0 = ResourceHonokaSuitVB
	ib  = ResourceHonokaSuitIB
	run = CommandListDrawSuit
endif

[TextureOverrideMarieSuit01]
hash = bfd420dd
match_first_index = 0
if $active
	handling = skip
	vb0 = ResourceMarieSuitVB
	ib  = ResourceMarieSuitIB
	run = CommandListDrawSuit
endif

; Body
[TextureOverrideCommonBody]
hash = 6ede6045
match_first_index = 0
$active = 1
handling = skip
vb0 = ResourceCommonBodyVB
ib = ResourceCommonBodyIB
drawindexed = auto

[TextureOverrideHonokaBody]
hash = b506048e
match_first_index = 0
$active = 1
handling = skip
vb0 = ResourceHonokaBodyVB
ib = ResourceHonokaBodyIB
drawindexed = auto

[TextureOverrideMarieBody]
hash = 4041fcee
match_first_index = 0
$active = 1
handling = skip
vb0 = ResourceMarieBodyVB
ib = ResourceMarieBodyIB
drawindexed = auto

; Resources
[ResourceCommonBodyVB]
type = Buffer
stride = 80
filename = resources\Common_body.vb

[ResourceCommonBodyIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Common_body.ib

[ResourceCommonSuitVB]
type = Buffer
stride = 76
filename = resources\Common_Suit.vb

[ResourceCommonSuitIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Common_Suit.ib

[ResourceHonokaBodyVB]
type = Buffer
stride = 80
filename = resources\Honoka_body.vb

[ResourceHonokaBodyIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Honoka_body.ib

[ResourceHonokaSuitVB]
type = Buffer
stride = 76
filename = resources\Honoka_Suit.vb

[ResourceHonokaSuitIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Honoka_Suit.ib

[ResourceMarieBodyVB]
type = Buffer
stride = 80
filename = resources\Marie_body.vb

[ResourceMarieBodyIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Marie_body.ib

[ResourceMarieSuitVB]
type = Buffer
stride = 76
filename = resources\Marie_Suit.vb

[ResourceMarieSuitIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Marie_Suit.ib

; Textures
[ResourceTexturesWhiteT0]
filename = resources\textures\white_t0.dds

[ResourceTexturesWhiteT2]
filename = resources\textures\white_t2.dds

[ResourceTexturesPinkT0]
filename = resources\textures\Pink_t0.dds

[ResourceTexturesPinkT2]
filename = resources\textures\Pink_t2.dds

; Command List
[CommandListDrawSuit]
if $var2 > 1
	ps-t0 = ResourceTexturesPinkT0
	ps-t2 = ResourceTexturesPinkT2
elif $var2 > 0
	ps-t0 = ResourceTexturesWhiteT0
	ps-t2 = ResourceTexturesWhiteT2
endif
	
if $var1 > 3 && $active
	; Do nothing
elif $var1 > 2 && $active
	run = CustomShaderTransparency3
elif $var1 > 1 && $active
	run = CustomShaderTransparency2
elif $var1 > 0 && $active
	run = CustomShaderTransparency1
elif $var1 > -1 && $active
	drawindexed = auto
endif

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

[CustomShaderTransparency2]
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

[CustomShaderTransparency1]
blend[0] = ADD BLEND_FACTOR INV_BLEND_FACTOR
blend_factor[0] = 0.75
blend_factor[1] = 0.75
blend_factor[2] = 0.75
blend_factor[3] = 1
drawindexed = auto
