; Castorice

; Constants -------------------------

[Constants]
global $active
global $first_run = 1

; Outfits
global persist $faceveil = 0
global persist $collar = 0
global persist $nipplechain = 0
global persist $bellychain = 0

global persist $top = 0
global persist $sleeves = 0
global persist $thong = 0
global persist $loincloth = 0

global persist $heels = 0
global persist $legcloth = 0

global persist $color = 0

; Misc
global persist $tan = 0
global persist $nails = 0
global persist $pube = 0
global persist $tattoo = 0

global persist $blush = 0

; Extra
global persist $castoricecrown = 0
global persist $castoriceflower = 1
global persist $castoricecirclet = 0

; Flat
global persist $currFlat = 0.5
global $rangeFlat
post $rangeFlat = $currFlat

global $menu = 0
global $page = 0
global $hold
global $holdShape
global $drag

global $navigating
global $navSpeed
global $hovering
global $slot
global $hoveredSlot
global $clickedSlot
global $selectedSlot = 0
global $targetSelectedSlot = 0
global $navDirection = -1

global persist $mx = 0.57
global persist $my = 0.20

global $ww
global $wh
global $cpx
global $cpy

global $dt
global $ts

[KeyShowMenu1]
condition = $active == 1
key = h
type = cycle
$menu = 0,1

[KeyShowMenu2]
condition = $active == 1
key = /
type = cycle
$menu = 0,1

[KeyMenu.ResetPosition]
condition = $menu == 1
key = no_ctrl shift VK_RIGHT
run = CommandListResetMenuPos

[KeyHold]
condition = $menu == 1 && $hovering == 0
key = no_ctrl no_shift VK_LBUTTON
key = no_ctrl no_shift VK_RBUTTON
type = hold
$hold = 1

[KeyHoldShape]
condition = $menu == 1 && $hovering > 1
key = no_ctrl no_shift VK_LBUTTON
key = no_ctrl no_shift VK_RBUTTON
type = hold
run = CommandListHoldShape

[CommandListHoldShape]
$holdShape = $hovering
post $holdShape = 0

[KeyClickedSlot]
condition = $hovering == 1 && $menu == 1
key = no_ctrl no_shift VK_LBUTTON
key = no_ctrl no_shift VK_RBUTTON
run = CommandListClickedSlot

[Present]
post $active = 0
if $active
	if $first_run
		ResourceCastoriceBodyPosition = copy ResourceCastoriceBodyPosition.Base
		run = CustomShaderComputeShapes
		$first_run = 0
	endif
	run = CustomShaderComputeShapes
	$dt = time - $ts
	$ts = time
	if $menu
		run = CommandListOutfitMenu
	endif
endif

[CustomShaderComputeShapes]
x88 = $currFlat
cs-t50 = copy ResourceCastoriceBodyPosition.Base
cs-t51 = copy ResourceCastoriceBodyPosition.Flat
cs-u5 = copy ResourceCastoriceBodyPosition.Base
cs = ../toggles/Shapes.hlsl
ResourceCastoriceBodyPosition = ref cs-u5
Dispatch = 98780, 1, 1
ResourceCastoriceBodyPositionCS = ResourceCastoriceBodyPosition
cs-u5 = null
cs-t50 = null
cs-t51 = null

; Custom Menu ==========================================

[CommandListDimensions]
if window_width != 0
	$ww = window_width
	$wh = window_height
elif $ww != 0
	$ww = rt_width
	$wh = rt_height
else
	$ww = res_width
	$wh = res_height
endif

if cursor_x != 0 && cursor_y != 0
	$cpx = cursor_x
	$cpy = cursor_y
elif cursor_window_x != 0 && cursor_window_y != 0
	$cpx = cursor_window_x / $ww
	$cpy = cursor_window_y / $wh
else
	$cpx = cursor_screen_x / $ww
	$cpy = cursor_screen_y / $wh
endif

[CommandListClickedSlot]
$clickedSlot = $hoveredSlot

if $clickedSlot == 1
	$faceveil = 1 - $faceveil
elif $clickedSlot == 2
	$collar = 1 - $collar
elif $clickedSlot == 3
	$nipplechain = 1 - $nipplechain
elif $clickedSlot == 4
	$bellychain = 1 - $bellychain
elif $clickedSlot == 5
	$top = 1 - $top
elif $clickedSlot == 6
	$sleeves = $sleeves + 1
	if $sleeves > 2
		$sleeves = 0
	endif
elif $clickedSlot == 7
	$thong = 1 - $thong
elif $clickedSlot == 8
	$loincloth = 1 - $loincloth
elif $clickedSlot == 9
	$heels = 1 - $heels
elif $clickedSlot == 10
	$legcloth = $legcloth + 1
	if $legcloth > 2
		$legcloth = 0
	endif
elif $clickedSlot == 11
	$color = 1 - $color
elif $clickedSlot == 12
	$tan = $tan + 1
	if $tan > 2
		$tan = 0
	endif
elif $clickedSlot == 13
	$nails = 1 - $nails
elif $clickedSlot == 14
	$pube = 1 - $pube
elif $clickedSlot == 15
	$tattoo = 1 - $tattoo
elif $clickedSlot == 16
	$blush = 1 - $blush
elif $clickedSlot == 17
	$castoricecrown = 1 - $castoricecrown
elif $clickedSlot == 18
	$castoriceflower = 1 - $castoriceflower
elif $clickedSlot == 19
	$castoricecirclet = 1 - $castoricecirclet
endif

[CommandListSlotItemImage]
x87 = 52 / $ww 
y87 = 52 / $wh
z87 = z87 + 3 / $ww
w87 = w87 + 6 / $ww

; ========================= SLOT 1 =========================
if $slot == 1
	ps-t100 = ResourceMenuItem.1
	if $faceveil == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 2 =========================
elif $slot == 2
	ps-t100 = ResourceMenuItem.2
	if $collar == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 3 =========================
elif $slot == 3
	ps-t100 = ResourceMenuItem.3
	if $nipplechain == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 4 =========================
elif $slot == 4
	ps-t100 = ResourceMenuItem.4
	if $bellychain == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 5 =========================
elif $slot == 5
	ps-t100 = ResourceMenuItem.5
	if $top == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 6 =========================
elif $slot == 6
	ps-t100 = ResourceMenuItem.6
	if $sleeves != 2
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 7 =========================
elif $slot == 7
	ps-t100 = ResourceMenuItem.7
	if $thong == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 8 =========================
elif $slot == 8
	ps-t100 = ResourceMenuItem.8
	if $loincloth == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 9 =========================
elif $slot == 9
	ps-t100 = ResourceMenuItem.9
	if $heels == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 10 =========================
elif $slot == 10
	ps-t100 = ResourceMenuItem.10
	if $legcloth != 2
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 11 =========================
elif $slot == 11
	ps-t100 = ResourceMenuItem.11
	run = CustomShaderElement

; ========================= SLOT 12 =========================
elif $slot == 12
	ps-t100 = ResourceMenuItem.12
	run = CustomShaderElement

; ========================= SLOT 13 =========================
elif $slot == 13
	ps-t100 = ResourceMenuItem.13
	if $nails == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif
	
; ========================= SLOT 14 =========================
elif $slot == 14
	ps-t100 = ResourceMenuItem.14
	if $pube == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif

; ========================= SLOT 15 =========================
elif $slot == 15
	ps-t100 = ResourceMenuItem.15
	if $tattoo == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif
	
; ========================= SLOT 16 =========================
elif $slot == 16
	ps-t100 = ResourceMenuItem.16
	if $blush == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif
	
; ========================= SLOT 17 =========================
elif $slot == 17
	ps-t100 = ResourceMenuItem.17
	if $castoricecrown == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif
	
; ========================= SLOT 18 =========================
elif $slot == 18
	ps-t100 = ResourceMenuItem.18
	if $castoriceflower == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif
	
; ========================= SLOT 19 =========================
elif $slot == 19
	ps-t100 = ResourceMenuItem.19
	if $castoricecirclet == 0
		run = CustomShaderElement
	else
		run = CustomShaderDisabledElement
	endif
endif

x87 = 58 / $ww 
y87 = 58 / $wh
z87 = z87 - 3 / $ww
w87 = w87 - 6 / $ww

[CommandListOutfitMenu]
run = CommandListDimensions
run = CommandListBackground

[CommandListBackground]
local $cox
local $coy
ps-t100 = ResourceMenuBG
y87 = 600 / $wh
x87 = 360 / $ww
if $hovering == 0
	if $drag == 0
		if $cpx > $mx + 0.0125 && $cpx < ($mx+x87-0.0035) && $cpy > $my && $cpy < ($my+y87-0.0035)
			if $hold
				$cox = $cpx - $mx
				$coy = $cpy - $my
				$drag = 1
			endif
		endif
	else
		if $hold
			$mx = $cpx - $cox
			$my = $cpy - $coy
		else
			$drag = 0
		endif
	endif
endif
z87 = $mx
w87 = $my
run = CustomShaderElement
run = CommandListDrawToggles

[CommandListDrawToggles]
local $z0 = z87 + 15 / $ww
local $z1 = $z0 + (8 + 60) / $ww
local $z2 = $z0 + (8 + 60 + 8 + 60) / $ww
local $z3 = $z0 + (8 + 60 + 8 + 60 + 8 + 60) / $ww
local $z4 = $z0 + (8 + 60 + 8 + 60 + 8 + 60 + 8 + 60) / $ww
local $wo = (8 + 60) / $wh

local $sliderPaddingLeft = 212 / $ww

$hovering = 0
$slot = 0
x87 = 64 / $ww 
y87 = 64 / $wh

; Outfit
w87 = w87 + $wo + 34 / $ww
z87 = $z0
run = CommandListSlot
z87 = $z1
run = CommandListSlot
z87 = $z2
run = CommandListSlot
z87 = $z3
run = CommandListSlot

w87 = w87 + $wo
z87 = $z0
run = CommandListSlot
z87 = $z1
run = CommandListSlot
z87 = $z2
run = CommandListSlot
z87 = $z3
run = CommandListSlot

w87 = w87 + $wo
z87 = $z0
run = CommandListSlot
z87 = $z1
run = CommandListSlot

; Misc
w87 = w87 + $wo + 82 / $ww
z87 = $z0
run = CommandListSlot
z87 = $z1
run = CommandListSlot
z87 = $z2
run = CommandListSlot
z87 = $z3
run = CommandListSlot
z87 = $z4
run = CommandListSlot

w87 = w87 + $wo + 3 / $ww
z87 = $z0
run = CommandListSlot

z87 = $z2
x87 = 52 / $ww 
y87 = 52 / $wh
ps-t100 = ResourceMenuItem.Flat
run = CustomShaderElement
w87 = w87 + 27 / $wh
z87 = $z0 + $sliderPaddingLeft
run = CommandListDrawSlider.Flat

; Extra
w87 = w87 + $wo + 58 / $ww
z87 = $z0
run = CommandListSlot
z87 = $z1
run = CommandListSlot
z87 = $z2
run = CommandListSlot

[CommandListSlot]
$slot = $slot + 1
run = CommandListSlotItemImage
if $cpx > z87 && $cpx < (z87+x87-0.0035) && $cpy > w87 && $cpy < (w87+y87-0.0035)
	ps-t100 = ResourceItemSlotHover.2
	$hovering = 1
	$hoveredSlot = $slot
	$selectedSlot = 0
else
	if $slot == $selectedSlot // 1
		$hoveredSlot = $slot
		ps-t100 = ResourceItemSlotHover.2
	else
		ps-t100 = ResourceItemSlot
	endif
endif
run = CustomShaderElement
if $clickedSlot == $slot
	ps-t100 = ResourceItemSlotHover.1
	run = CustomShaderElement
	$clickedSlot = 0
endif

; Flat
[CommandListDrawSlider.Flat]
ps-t100 = ResourceSlider
x87 = 95 / $ww
y87 = 6 / $wh
run = CustomShaderElement
ps-t100 = ResourceSliderAfter
x87 = $currFlat * x87
run = CustomShaderElement
x87 = 95 / $ww
run = CommandListCursor.Flat

[CommandListInterpolateSpeed.Flat]
local $td = 0.033
local $ds = ($rangeFlat - $currFlat) / $td
$currFlat = $currFlat + $ds * $dt

[CommandListCursor.Flat]
local $x = z87
local $y = w87
local $xo = z87 + x87
local $yo = w87 + y87
if $cpx > $x && $cpx < $xo && $holdShape == 0
    if $cpy > $y - 15 / $wh && $cpy < $yo + 15 / $wh
        $hovering = 2
        $selectedSlot = 0
    endif
endif
if $holdShape == 2
  $rangeFlat = (($cpx-$x)/($xo-$x))
  if $rangeFlat < 0
    $rangeFlat = 0
  elif $rangeFlat > 1
    $rangeFlat = 1
  endif
endif
z87 = (z87 + x87 * ($currFlat) - 14 / $ww)
run = CommandListInterpolateSpeed.Flat
if $hovering == 2 || $selectedSlot == 1 || $holdShape == 2
  ps-t100 = ResourceButtonHover
else
  ps-t100 = ResourceButton
endif
x87 = 32 / $ww
y87 = 32 / $wh
w87 = w87 - 13 / $wh
run = CustomShaderElement

[CommandListResetMenuPos]
$mx = 50 / $ww
$my = 0.5 - 360 / $wh

[CustomShaderElement]
vs = ..\toggles\draw_2d.hlsl
ps = ..\toggles\draw_2d.hlsl
run = BuiltInCommandListUnbindAllRenderTargets
blend = ADD SRC_ALPHA INV_SRC_ALPHA
cull = none
topology = triangle_strip
o0 = set_viewport bb
Draw = 4,0

[CustomShaderDisabledElement]
vs = ..\toggles\draw_2d_disabled.hlsl
ps = ..\toggles\draw_2d_disabled.hlsl
run = BuiltInCommandListUnbindAllRenderTargets
blend = ADD SRC_ALPHA INV_SRC_ALPHA
cull = none
topology = triangle_strip
o0 = set_viewport bb
Draw = 4,0

[ResourceMenuBG]
filename = ..\toggles\Menu.dds

[ResourceItemSlot]
filename = ..\toggles\Slot.dds

[ResourceItemSlotHover.1]
filename = ..\toggles\Slot_Hover.dds

[ResourceItemSlotHover.2]
filename = ..\toggles\Slot_Hover_2.dds

[ResourceMenuItem.1]
filename =..\toggles\item_1.dds

[ResourceMenuItem.2]
filename =..\toggles\item_2.dds

[ResourceMenuItem.3]
filename =..\toggles\item_3.dds

[ResourceMenuItem.4]
filename =..\toggles\item_4.dds

[ResourceMenuItem.5]
filename = ..\toggles\item_5.dds

[ResourceMenuItem.6]
filename =..\toggles\item_6.dds

[ResourceMenuItem.7]
filename =..\toggles\item_7.dds

[ResourceMenuItem.8]
filename =..\toggles\item_8.dds

[ResourceMenuItem.9]
filename =..\toggles\item_9.dds

[ResourceMenuItem.10]
filename =..\toggles\item_10.dds

[ResourceMenuItem.11]
filename =..\toggles\item_11.dds

[ResourceMenuItem.12]
filename =..\toggles\item_12.dds

[ResourceMenuItem.13]
filename =..\toggles\item_13.dds

[ResourceMenuItem.14]
filename =..\toggles\item_14.dds

[ResourceMenuItem.15]
filename =..\toggles\item_15.dds

[ResourceMenuItem.16]
filename =..\toggles\item_16.dds

[ResourceMenuItem.17]
filename =..\toggles\item_17.dds

[ResourceMenuItem.18]
filename =..\toggles\item_18.dds

[ResourceMenuItem.19]
filename =..\toggles\item_19.dds

[ResourceMenuItem.20]
filename =..\toggles\item_20.dds

[ResourceMenuItem.21]
filename =..\toggles\item_21.dds

[ResourceMenuItem.22]
filename =..\toggles\item_22.dds

[ResourceMenuItem.23]
filename =..\toggles\item_23.dds

[ResourceMenuItem.Flat]
filename =..\toggles\item_flat.dds

[ResourceSlider]
filename = ..\toggles\Slider.dds

[ResourceSliderAfter]
filename = ..\toggles\Slider_after.dds

[ResourceButton]
filename = ..\toggles\Button.dds

[ResourceButtonHover]
filename = ..\toggles\Button_Hover.dds

; Command List -------------------------

[CommandListBodyADiffuse]
if $tan == 0 && $color == 0
	this = ResourceBodyTan.Black
elif $tan == 0 && $color == 1
	this = ResourceBodyTan.White
elif $tan == 1 && $color == 0
	this = ResourceBodyFair.Black
elif $tan == 1 && $color == 1
	this = ResourceBodyFair.White
elif $tan == 2 && $color == 0
	this = ResourceBodyPale.Black
elif $tan == 2 && $color == 1
	this = ResourceBodyPale.White
endif

[ResourceBodyTan.Black]
filename = ..\textures\body\tan\Black.dds

[ResourceBodyTan.White]
filename = ..\textures\body\tan\White.dds

[ResourceBodyFair.Black]
filename = ..\textures\body\fair\Black.dds

[ResourceBodyFair.White]
filename = ..\textures\body\fair\White.dds

[ResourceBodyPale.Black]
filename = ..\textures\body\pale\Black.dds

[ResourceBodyPale.White]
filename = ..\textures\body\pale\White.dds

[CommandListHeadADiffuse]
if $tan == 0
	if $blush == 0
		this = ResourceMakeupTan.Blush
	elif $blush == 1
		this = ResourceMakeupTan.Base
	endif
elif $tan == 1
	if $blush == 0
		this = ResourceMakeup.Blush
	elif $blush == 1
		this = ResourceMakeup.Base
	endif
elif $tan == 2
	if $blush == 0
		this = ResourceMakeupPale.Blush
	elif $blush == 1
		this = ResourceMakeupPale.Base
	endif
endif

[ResourceMakeupTan.Blush]
filename = ..\textures\head\tan\Blush.dds

[ResourceMakeupTan.Base]
filename = ..\textures\head\tan\Base.dds

[ResourceMakeup.Blush]
filename = ..\textures\head\fair\Blush.dds

[ResourceMakeup.Base]
filename = ..\textures\head\fair\Base.dds

[ResourceMakeupPale.Blush]
filename = ..\textures\head\pale\Blush.dds

[ResourceMakeupPale.Base]
filename = ..\textures\head\pale\Base.dds

; Overrides -------------------------

[TextureOverrideCastoriceHairBlend]
hash = 776a0dad
handling = skip
vb2 = ResourceCastoriceHairBlend
if DRAW_TYPE == 1
	vb0 = ResourceCastoriceHairPosition
	draw = 6513, 0
elif DRAW_TYPE == 8
	Resource\SRMI\PositionBuffer = ref ResourceCastoriceHairPositionCS
	Resource\SRMI\BlendBuffer = ref ResourceCastoriceHairBlendCS
	$\SRMI\vertex_count = 6513
endif

[TextureOverrideCastoriceHairTexcoord]
hash = 5e51291b
vb1 = ResourceCastoriceHairTexcoord

[TextureOverrideCastoriceHairDraw]
hash = e6d1f87b
override_vertex_count = 6513
override_byte_stride = 40
uav_byte_stride = 4

[TextureOverrideCastoriceHeadBlend]
hash = e7ea12e0
handling = skip
vb2 = ResourceCastoriceHeadBlend
if DRAW_TYPE == 1
	vb0 = ResourceCastoriceHeadPosition
	draw = 2890, 0
elif DRAW_TYPE == 8
	Resource\SRMI\PositionBuffer = ref ResourceCastoriceHeadPositionCS
	Resource\SRMI\BlendBuffer = ref ResourceCastoriceHeadBlendCS
	$\SRMI\vertex_count = 2890
endif

[TextureOverrideCastoriceHeadTexcoord]
hash = b731ffe4
vb1 = ResourceCastoriceHeadTexcoord

[TextureOverrideCastoriceHeadDraw]
hash = e31bfa54
override_vertex_count = 2890
override_byte_stride = 40
uav_byte_stride = 4

[TextureOverrideCastoriceBodyBlend]
hash = e79ca63a
$active = 1
handling = skip
vb2 = ResourceCastoriceBodyBlend
if DRAW_TYPE == 1
	vb0 = ResourceCastoriceBodyPosition
	draw = 98780, 0
elif DRAW_TYPE == 8
	Resource\SRMI\PositionBuffer = ref ResourceCastoriceBodyPositionCS
	Resource\SRMI\BlendBuffer = ref ResourceCastoriceBodyBlendCS
	$\SRMI\vertex_count = 98780
endif

[TextureOverrideCastoriceBodyTexcoord]
hash = dce61e19
vb1 = ResourceCastoriceBodyTexcoord

[TextureOverrideCastoriceBodyDraw]
hash = cc41f6a0
override_vertex_count = 98780
override_byte_stride = 40
uav_byte_stride = 4

[TextureOverrideCastoriceHairIB]
hash = c5794477
handling = skip

[TextureOverrideCastoriceHairA]
hash = c5794477
match_first_index = 0
ib = ResourceCastoriceHairAIB
; HairA (6513)
drawindexed = 23205, 0, 0

[TextureOverrideCastoriceHeadIB]
hash = f2584f98
handling = skip

[TextureOverrideCastoriceHeadA]
hash = f2584f98
match_first_index = 0
ib = ResourceCastoriceHeadAIB
; HeadA (62)
drawindexed = 150, 0, 0

[TextureOverrideCastoriceHeadB]
hash = f2584f98
match_first_index = 150
ib = ResourceCastoriceHeadBIB
; HeadB (2828)
drawindexed = 12258, 0, 0

[TextureOverrideCastoriceBodyIB]
hash = 3b4647d4
handling = skip

[TextureOverrideCastoriceBodyA]
hash = 3b4647d4
match_first_index = 0
ib = ResourceCastoriceBodyAIB
; BodyA (484)
drawindexed = 1428, 0, 0
; Torso
; Erect nipples (1826)
if $top == 1
drawindexed = 9300, 1428, 0
endif
; Flattened nipples (1826)
if $top == 0
drawindexed = 9300, 10728, 0
endif
; Nude (17666)
drawindexed = 95640, 20028, 0
; Pubic hair (64)
if $pube == 0
drawindexed = 294, 115668, 0
endif
; Womb tattoo (313)
if $tattoo == 0
drawindexed = 1512, 115962, 0
endif
; Arms
; Arms (8134)
drawindexed = 42372, 117474, 0
; Finger nails (190)
if $nails == 0
drawindexed = 660, 159846, 0
endif
; Legs
; Legs (2142)
drawindexed = 11946, 160506, 0
; Feet
; Feet (7036)
if $heels == 1
drawindexed = 35736, 172452, 0
endif
; Top parts
; Collar (631)
if $collar == 0
drawindexed = 2070, 208188, 0
endif
; Face veil top (186)
if $faceveil == 0
drawindexed = 720, 210258, 0
endif
; Gloves (958)
if $sleeves == 0
drawindexed = 4104, 210978, 0
endif
; Top (812)
if $top == 0
drawindexed = 4032, 215082, 0
endif
; Top connector (198)
if $top == 0 && $collar == 0
drawindexed = 960, 219114, 0
endif
; Chains
; Belly chain (7648)
if $bellychain == 0
drawindexed = 39744, 220074, 0
endif
; Belly chain connector (2304)
if $bellychain == 0 && $collar == 0
drawindexed = 11580, 259818, 0
endif
; Belly chain side (2944)
if $bellychain == 0
drawindexed = 14928, 271398, 0
endif
; Nipple chain (6886)
if $nipplechain == 0 && $top == 1
drawindexed = 34332, 286326, 0
endif
; Nipple chain w/ top (6886)
if $nipplechain == 0 && $top == 0
drawindexed = 34332, 320658, 0
endif
; Arms parts
; Arm rings (2024)
if $sleeves != 2
drawindexed = 9408, 354990, 0
endif
; Armbands (1650)
if $sleeves != 2
drawindexed = 6072, 364398, 0
endif
; Bracers (880)
if $sleeves != 2
drawindexed = 2220, 370470, 0
endif
; Bottom parts
; Back loincloth clip (898)
if $loincloth == 0
drawindexed = 2928, 372690, 0
endif
; Front loincloth clip (898)
if $loincloth == 0
drawindexed = 2928, 375618, 0
endif
; Panties (536)
if $thong == 0
drawindexed = 1782, 378546, 0
endif
; String (868)
if $thong == 0 || $loincloth == 0
drawindexed = 2076, 380328, 0
endif
; Legs parts
; Ankle rings (1300)
if $legcloth == 0
drawindexed = 6912, 382404, 0
endif
; Heels (2340)
if $heels == 0 && $legcloth != 0
drawindexed = 8010, 389316, 0
endif
; Heels w/ leg cloth (2340)
if $heels == 0 && $legcloth == 0
drawindexed = 8010, 397326, 0
endif
; Leg cloth clip (600)
if $legcloth == 0
drawindexed = 1728, 405336, 0
endif
; Thigh straps (924)
if $legcloth != 2
drawindexed = 2640, 407064, 0
endif

[TextureOverrideCastoriceBodyB]
hash = 3b4647d4
match_first_index = 14598
ib = ResourceCastoriceBodyBIB
; BodyB (268)
drawindexed = 747, 0, 0

[TextureOverrideCastoriceBodyC]
hash = 3b4647d4
match_first_index = 32934
ib = ResourceCastoriceBodyCIB
; Back loincloth (270)
if $loincloth == 0
drawindexed = 1344, 0, 0
endif
; Face veil (189)
if $faceveil == 0
drawindexed = 936, 1344, 0
endif
; Front loincloth (270)
if $loincloth == 0
drawindexed = 1344, 2280, 0
endif
; Leg cloth (5719)
if $legcloth == 0
drawindexed = 15684, 3624, 0
endif
; Sleeves (4238)
if $sleeves == 0
drawindexed = 23286, 19308, 0
endif
; Top (transparent) (936)
if $top == 0
drawindexed = 5112, 42594, 0
endif

[TextureOverrideCastoriceBodyD]
hash = 3b4647d4
match_first_index = 34857
ib = ResourceCastoriceBodyDIB
; Castorice flower (816)
if $castoriceflower == 0
drawindexed = 2700, 0, 0
endif

[TextureOverrideCastoriceBodyE]
hash = 3b4647d4
match_first_index = 44715
ib = ResourceCastoriceBodyEIB
; BodyE (804)
drawindexed = 2664, 0, 0
; Castorice cirlet (130)
if $castoricecirclet == 0
drawindexed = 186, 2664, 0
endif
; Castorice crown (748)
if $castoricecrown == 0
drawindexed = 1818, 2850, 0
endif

[TextureOverrideCastoriceHairADiffuse]
hash = e2ce4067
this = ResourceCastoriceHairADiffuse

[TextureOverrideCastoriceHeadBDiffuse]
hash = 9e27389e
run = CommandListHeadADiffuse

[TextureOverrideCastoriceBodyADiffuse]
hash = f9761bbf
run = CommandListBodyADiffuse
match_priority=2

[TextureOverrideCastoriceBodyALightMap]
hash = 87adc723
this = ResourceCastoriceBodyALightMap
match_priority=2

[TextureOverrideCastoriceBodyBDiffuse]
hash = f9761bbf
run = CommandListBodyADiffuse
match_priority=1

[TextureOverrideCastoriceBodyBLightMap]
hash = 87adc723
this = ResourceCastoriceBodyALightMap
match_priority=1

[TextureOverrideCastoriceBodyCDiffuse]
hash = f9761bbf
run = CommandListBodyADiffuse
match_priority=0

[TextureOverrideCastoriceBodyCLightMap]
hash = 87adc723
this = ResourceCastoriceBodyALightMap
match_priority=0

[TextureOverrideCastoriceBodyDDiffuse]
hash = f0226f67
run = CommandListBodyADiffuse
match_priority=1

[TextureOverrideCastoriceBodyDLightMap]
hash = 26610bd8
this = ResourceCastoriceBodyALightMap
match_priority=1

[TextureOverrideCastoriceBodyEDiffuse]
hash = f0226f67
run = CommandListBodyADiffuse
match_priority=0

[TextureOverrideCastoriceBodyELightMap]
hash = 26610bd8
this = ResourceCastoriceBodyALightMap
match_priority=0

; CommandList -----------------------


; Resources -------------------------

[ResourceCastoriceHairPosition]
type = Buffer
stride = 40
filename = CastoriceHairPosition.buf

[ResourceCastoriceHairBlend]
type = Buffer
stride = 32
filename = CastoriceHairBlend.buf

[ResourceCastoriceHairTexcoord]
type = Buffer
stride = 8
filename = CastoriceHairTexcoord.buf

[ResourceCastoriceHairPositionCS]
type = StructuredBuffer
stride = 40
filename = CastoriceHairPosition.buf

[ResourceCastoriceHairBlendCS]
type = StructuredBuffer
stride = 32
filename = CastoriceHairBlend.buf

[ResourceCastoriceHairAIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceHairA.ib

[ResourceCastoriceHeadPosition]
type = Buffer
stride = 40
filename = CastoriceHeadPosition.buf

[ResourceCastoriceHeadBlend]
type = Buffer
stride = 32
filename = CastoriceHeadBlend.buf

[ResourceCastoriceHeadTexcoord]
type = Buffer
stride = 8
filename = CastoriceHeadTexcoord.buf

[ResourceCastoriceHeadPositionCS]
type = StructuredBuffer
stride = 40
filename = CastoriceHeadPosition.buf

[ResourceCastoriceHeadBlendCS]
type = StructuredBuffer
stride = 32
filename = CastoriceHeadBlend.buf

[ResourceCastoriceHeadAIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceHeadA.ib

[ResourceCastoriceHeadBIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceHeadB.ib

[ResourceCastoriceBodyPosition]
type = Buffer
stride = 40
filename = CastoriceBodyPosition.buf

[ResourceCastoriceBodyPosition.Base]
type = Buffer
stride = 40
filename = CastoriceBodyPosition.buf

[ResourceCastoriceBodyPosition.Flat]
type = Buffer
stride = 40
filename = CastoriceBodyPositionFlat.buf

[ResourceCastoriceBodyBlend]
type = Buffer
stride = 32
filename = CastoriceBodyBlend.buf

[ResourceCastoriceBodyTexcoord]
type = Buffer
stride = 20
filename = CastoriceBodyTexcoord.buf

[ResourceCastoriceBodyPositionCS]
type = StructuredBuffer
stride = 40
filename = CastoriceBodyPosition.buf

[ResourceCastoriceBodyBlendCS]
type = StructuredBuffer
stride = 32
filename = CastoriceBodyBlend.buf

[ResourceCastoriceBodyAIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceBodyA.ib

[ResourceCastoriceBodyBIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceBodyB.ib

[ResourceCastoriceBodyCIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceBodyC.ib

[ResourceCastoriceBodyDIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceBodyD.ib

[ResourceCastoriceBodyEIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceBodyE.ib

[ResourceCastoriceBodyFIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CastoriceBodyF.ib

[ResourceCastoriceHairADiffuse]
filename = CastoriceHairADiffuse.dds

[ResourceCastoriceHairALightMap]
filename = CastoriceHairALightMap.dds

[ResourceCastoriceHeadBDiffuse]
filename = CastoriceHeadBDiffuse.dds

[ResourceCastoriceBodyADiffuse]
filename = CastoriceBodyADiffuse.dds

[ResourceCastoriceBodyALightMap]
filename = CastoriceBodyALightMap.dds

[ResourceCastoriceBodyBDiffuse]
filename = CastoriceBodyBDiffuse.dds

[ResourceCastoriceBodyBLightMap]
filename = CastoriceBodyBLightMap.dds

[ResourceCastoriceBodyCDiffuse]
filename = CastoriceBodyCDiffuse.dds

[ResourceCastoriceBodyCLightMap]
filename = CastoriceBodyCLightMap.dds

[ResourceCastoriceBodyDDiffuse]
filename = CastoriceBodyDDiffuse.dds

[ResourceCastoriceBodyDLightMap]
filename = CastoriceBodyDLightMap.dds

[ResourceCastoriceBodyEDiffuse]
filename = CastoriceBodyEDiffuse.dds

[ResourceCastoriceBodyELightMap]
filename = CastoriceBodyELightMap.dds


; .ini generated by XXMI (XX-Model-Importer) v1.8.1
; If you have any issues or find any bugs, please open a ticket at https://github.com/leotorrez/XXMI-Tools/issues
