[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
; Top : Org. ->

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

[KeySwitchVar3]
condition = $active
Key = ctrl no_shift no_alt c
type = cycle
$var3 = 0,1,2,3
; Shell : Org. -> Upper shell only -> Lower shell only -> No shell

; Swimsuit
[TextureOverrideSS01_Skirt]
hash = f64432e5
match_first_index = 0
if ($active || $shader_type == 5)
    handling = skip
    if $var2 == 0
        vb0 = ResourceSSAVB
        ib  = ResourceSSAIB
        drawindexed = auto
    endif
endif

[TextureOverrideSS02]
hash = f64432e5
match_first_index = 16767
if ($active || $shader_type == 5)
    handling = skip
    if $var1 <= 2
        vb0 = ResourceSSBVB
        ib  = ResourceSSBIB
        drawindexed = auto
    endif
endif

[TextureOverrideSS03]
hash = f64432e5
match_first_index = 7215
if ($active || $shader_type == 5)
    handling = skip
    if $var1 <= 2
        vb0 = ResourceSSCVB
        ib  = ResourceSSCIB
        if $var1 == 0
            drawindexed = auto
        elif $var1 == 1
            run = CustomShaderTransparency1
        elif $var1 == 2
            run = CustomShaderTransparency2
        endif
    endif
endif

[TextureOverrideSwimsuit98]
hash = f64432e5
if ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverrideSwimsuit99]
hash = 31702165
if ($active || $shader_type == 5)
    handling = skip
endif

; Top
[TextureOverrideTop01]
hash = 31702165
match_first_index = 89634
if ($active || $shader_type == 5)
    handling = skip
    if $var1 <= 2
        vb0 = ResourceTopAVB
        ib  = ResourceTopAIB
        drawindexed = auto
    endif
endif

[TextureOverrideTop02_Shell]
hash = 31702165
match_first_index = 6210
if ($active || $shader_type == 5)
    handling = skip
    if ($var3 == 0 || $var3 == 1)
        vb0 = ResourceTopBVB
        ib  = ResourceTopBIB
        drawindexed = auto
    endif
endif

[TextureOverrideTop03]
hash = 31702165
match_first_index = 25428
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceTopCVB
    ib  = ResourceTopCIB
    drawindexed = auto
endif

; Bot
[TextureOverrideBot01]
hash = 31702165
match_first_index = 0
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceBotAVB
    ib  = ResourceBotAIB
    drawindexed = auto
endif

[TextureOverrideBot02]
hash = 31702165
match_first_index = 11712
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceBotBVB
    ib  = ResourceBotBIB
    drawindexed = auto
endif

[TextureOverrideBot03_Shell]
hash = 31702165
match_first_index = 2070
if ($active || $shader_type == 5)
    handling = skip
    if $var3 == 0 || $var3 == 2
        vb0 = ResourceBotCVB
        ib  = ResourceBotCIB
        drawindexed = auto
    endif
endif

[TextureOverrideBot04_Shell]
hash = 65ab7ca2
match_first_index = 6075
if ($active || $shader_type == 5)
    handling = skip
    if $var3 == 0 || $var3 == 2
        vb0 = ResourceBotDVB
        ib  = ResourceBotDIB
        drawindexed = auto
    endif
endif

[TextureOverrideBot05]
hash = 65ab7ca2
match_first_index = 36615
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceBotEVB
    ib  = ResourceBotEIB
    drawindexed = auto    
endif

[TextureOverrideBot06_Shell]
hash = 65ab7ca2
match_first_index = 435
if ($active || $shader_type == 5)
    handling = skip
    if $var3 == 0 || $var3 == 2
        vb0 = ResourceBotFVB
        ib  = ResourceBotFIB
        drawindexed = auto
    endif
endif

[TextureOverrideBot07]
hash = 65ab7ca2
match_first_index = 67491
if ($active || $shader_type == 5)
    handling = skip
    vb0 = ResourceBotGVB
    ib  = ResourceBotGIB
    drawindexed = auto
endif

; Jewel
[TextureOverrideJewel01_VBH]
hash = 01b4607d
if ($active || $shader_type == 5)
    handling = skip
endif

[TextureOverrideJewel02_VBH]
hash = d723bc45
if ($active || $shader_type == 5)
    handling = skip
endif

; Body
[TextureOverrideBody]
hash = 04bcefd5
match_first_index = 0
$active = 1
handling = skip
vb0 = ResourceBodyVB
ib  = ResourceBodyIB
drawindexed = auto

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

[ResourceSSAVB]
type = Buffer
stride = 76
filename = resources\SS_A.vb
[ResourceSSAIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\SS_A.ib

[ResourceSSBVB]
type = Buffer
stride = 76
filename = resources\SS_B.vb
[ResourceSSBIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\SS_B.ib

[ResourceSSCVB]
type = Buffer
stride = 76
filename = resources\SS_C.vb
[ResourceSSCIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\SS_C.ib

[ResourceTopAVB]
type = Buffer
stride = 76
filename = resources\Top_A.vb
[ResourceTopAIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Top_A.ib

[ResourceTopBVB]
type = Buffer
stride = 76
filename = resources\Top_B.vb
[ResourceTopBIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Top_B.ib

[ResourceTopCVB]
type = Buffer
stride = 76
filename = resources\Top_C.vb
[ResourceTopCIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Top_C.ib

[ResourceBotAVB]
type = Buffer
stride = 76
filename = resources\Bot_A.vb
[ResourceBotAIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bot_A.ib

[ResourceBotBVB]
type = Buffer
stride = 76
filename = resources\Bot_B.vb
[ResourceBotBIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bot_B.ib

[ResourceBotCVB]
type = Buffer
stride = 76
filename = resources\Bot_C.vb
[ResourceBotCIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bot_C.ib

[ResourceBotDVB]
type = Buffer
stride = 76
filename = resources\Bot_D.vb
[ResourceBotDIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bot_D.ib

[ResourceBotEVB]
type = Buffer
stride = 76
filename = resources\Bot_E.vb
[ResourceBotEIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bot_E.ib

[ResourceBotFVB]
type = Buffer
stride = 76
filename = resources\Bot_F.vb
[ResourceBotFIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bot_F.ib

[ResourceBotGVB]
type = Buffer
stride = 76
filename = resources\Bot_G.vb
[ResourceBotGIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = resources\Bot_G.ib

; Transparency
[CustomShaderTransparency1]
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

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