; YiXuan
; CONSTANTS
[Constants]
global $creditinfo = 0
global $active = 0
global $vartemp = 0
global $swapvarAnimFrame = 0
global persist $swapvarTopC = 0
global persist $swapvarTop = 0
global persist $swapvarAltTop = 0
global persist $swapvarNeck = 0
global persist $swapvarSpines = 0
global persist $swapvarPanties = 0
global persist $swapvarShoulderPlate = 0
global persist $swapvarSleeves = 0
global persist $swapvarThighPlace = 0
global persist $swapvarLegs = 0
global persist $swapvarHeels = 0
global persist $swapvarHair = 0
global persist $swapvarHairAcc = 0
global persist $swapvarEars = 0
global persist $swapvarFace = 0
global persist $swapvarDemon = 0
global persist $swapvarColor = 0
global persist $swapvarAdditional = 0
global persist $swapvarBiggerChest = 0
global persist $swapvarSmallerChest = 0
global persist $swapvarBiggerBottom = 0
global persist $swapvarSmallerBottom = 0
global persist $swapvarAnim = 0
global persist $swapvarAnimSpeed = 0
[KeySwapswapvarTopC]
condition = $active == 1
key = no_alt no_ctrl VK_UP
type = cycle
$swapvarTopC = 0,1
[KeySwapswapvarTop]
condition = $active == 1
key = alt no_ctrl VK_UP
type = cycle
$swapvarTop = 0,1
[KeySwapswapvarAltTop]
condition = $active == 1
key = no_alt ctrl VK_UP
type = cycle
$swapvarAltTop = 0,1,2
[KeySwapswapvarNeck]
condition = $active == 1
key = alt ctrl VK_UP
type = cycle
$swapvarNeck = 0,1
[KeySwapswapvarSpines]
condition = $active == 1
key = no_alt no_ctrl VK_DOWN
type = cycle
$swapvarSpines = 0,1,2
[KeySwapswapvarPanties]
condition = $active == 1
key = alt no_ctrl VK_DOWN
type = cycle
$swapvarPanties = 0,1,2
[KeySwapswapvarShoulderPlate]
condition = $active == 1
key = no_alt ctrl VK_DOWN
type = cycle
$swapvarShoulderPlate = 0,1
[KeySwapswapvarSleeves]
condition = $active == 1
key = alt ctrl VK_DOWN
type = cycle
$swapvarSleeves = 0,1
[KeySwapswapvarThighPlace]
condition = $active == 1
key = no_alt no_ctrl VK_LEFT
type = cycle
$swapvarThighPlace = 0,1
[KeySwapswapvarLegs]
condition = $active == 1
key = alt no_ctrl VK_LEFT
type = cycle
$swapvarLegs = 0,1,2
[KeySwapswapvarHeels]
condition = $active == 1
key = no_alt ctrl VK_LEFT
type = cycle
$swapvarHeels = 0,1,2
[KeySwapswapvarHair]
condition = $active == 1
key = alt ctrl VK_LEFT
type = cycle
$swapvarHair = 0,1,2
[KeySwapswapvarHairAcc]
condition = $active == 1
key = no_alt no_ctrl VK_RIGHT
type = cycle
$swapvarHairAcc = 0,1,2,3
[KeySwapswapvarEars]
condition = $active == 1
key = alt no_ctrl VK_RIGHT
type = cycle
$swapvarEars = 0,1
[KeySwapswapvarFace]
condition = $active == 1
key = no_alt ctrl VK_RIGHT
type = cycle
$swapvarFace = 0,1
[KeySwapswapvarDemon]
condition = $active == 1
key = alt ctrl VK_RIGHT
type = cycle
$swapvarDemon = 0,1
[KeySwapswapvarColor]
condition = $active == 1
key = no_alt no_ctrl .
type = cycle
$swapvarColor = 0,1,2,3
[KeySwapswapvarAdditional]
condition = $active == 1
key = alt no_ctrl .
type = cycle
$swapvarAdditional = 0,1,2,3
[KeySwapswapvarAnim]
condition = $active == 1
key = no_alt no_ctrl ,
type = cycle
$swapvarAnim = 0,1
[KeySwapswapvarAnimSpeed]
condition = $active == 1
key = alt no_ctrl ,
type = cycle
$swapvarAnimSpeed = 0,1,2,3
[Present]
post $active = 0
run = CommandListCreditInfo
$\FNmathutils\frame\fps = 30 * $swapvarAnimSpeed
$\FNmathutils\frame\end = 29
run = commandlist\FNmathutils\frame\run
$swapvarAnimFrame = $\FNmathutils\frame\result
; OVERRIDE
[TextureOverrideYiXuanBodyBlend]
hash = 3e629c05
handling = skip
vb2 = ResourceYiXuanBodyBlend
if DRAW_TYPE == 1
	vb0 = ResourceYiXuanBodyPosition
	draw = 213651,0
endif
$active = 1
[TextureOverrideYiXuanBodyTexcoord]
hash = 7af146a0
vb1 = ResourceYiXuanBodyTexcoord
[TextureOverrideYiXuanBodyVertexLimitRaise]
hash = f922d854
override_vertex_count = 213651
override_byte_stride = 92
[TextureOverrideYiXuanJacketBlend]
hash = 0ff3af5a
handling = skip
vb2 = ResourceYiXuanJacketBlend
if DRAW_TYPE == 1
	vb0 = ResourceYiXuanJacketPosition
	draw = 0,0
endif
$active = 1
[TextureOverrideYiXuanJacketTexcoord]
hash = 9f95d565
vb1 = ResourceYiXuanJacketTexcoord
[TextureOverrideYiXuanJacketVertexLimitRaise]
hash = 73599fbb
override_vertex_count = 0
override_byte_stride = 96
[TextureOverrideYiXuanHairBlend]
hash = d7eb400e
handling = skip
vb2 = ResourceYiXuanHairBlend
if DRAW_TYPE == 1
	vb0 = ResourceYiXuanHairPosition
	draw = 32199,0
endif
$active = 1
[TextureOverrideYiXuanHairTexcoord]
hash = d4841137
vb1 = ResourceYiXuanHairTexcoord
[TextureOverrideYiXuanHairVertexLimitRaise]
hash = 36a68b27
override_vertex_count = 32199
override_byte_stride = 92
[TextureOverrideYiXuanBodyIB]
hash = 029c1f5a
handling = skip
[TextureOverrideYiXuanBodyA]
hash = 029c1f5a
match_first_index = 0
run = CommandListSkinTexture
ib = ResourceYiXuanBodyAIB
run = CommandListRunSlotFix
run = CommandListYiXuanBodyA
[TextureOverrideYiXuanJacketIB]
hash = 8c2fc05e
handling = skip
drawindexed = auto
[TextureOverrideYiXuanJacketA]
hash = 8c2fc05e
match_first_index = 0
ib = null
[TextureOverrideYiXuanHairIB]
hash = ac8e9ee3
handling = skip
[TextureOverrideYiXuanHairA]
hash = ac8e9ee3
match_first_index = 0
run = CommandListSkinTexture
ib = ResourceYiXuanHairAIB
run = CommandListRunSlotFix
run = CommandListYiXuanHairA
[TextureOverrideYiXuanHairB]
hash = ac8e9ee3
match_first_index = 21816
run = CommandListSkinTexture
ib = ResourceYiXuanHairBIB
run = CommandListRunSlotFix
run = CommandListYiXuanHairB
[CommandListYiXuanBodyA]
		; Gold
			; GChestPlate
			if $swapvarTop == 0
			    drawindexed = 7200, 0, 0
			endif
			; GChestPlate.001
			if $swapvarTop == 0
			    if $swapvarAltTop == 2 || $swapvarTopC == 0
			        drawindexed = 6000, 7200, 0
			    endif
			endif
			; GChestPlate.002
			if $swapvarTop == 0 && $swapvarAltTop == 0
			    if $swapvarTopC == 1
			        drawindexed = 6000, 13200, 0
			    endif
			endif
			; GChestPlate.003
			if $swapvarTop == 0 && $swapvarAltTop == 1
			    if $swapvarTopC == 1
			        drawindexed = 6000, 19200, 0
			    endif
			endif
			; GHeelsB
			if $swapvarHeels == 1
			    drawindexed = 12288, 25200, 0
			endif
			; GNeck
			if $swapvarNeck == 0
			    drawindexed = 3264, 37488, 0
			endif
			; GShoulderPlateA
			if $swapvarShoulderPlate == 0
			    drawindexed = 3744, 40752, 0
			endif
			; GShoulderPlateB
			if $swapvarShoulderPlate == 0
			    drawindexed = 9132, 44496, 0
			endif
			; GShoulderPlateC
			if $swapvarShoulderPlate == 0
			    drawindexed = 14040, 53628, 0
			endif
			; GShoulderPlateC.001
			if $swapvarThighPlace == 0
			    drawindexed = 6096, 67668, 0
			endif
			; GShoulderPlateD
			if $swapvarShoulderPlate == 0
			    drawindexed = 3264, 73764, 0
			endif
			; GShoulderPlateE
			if $swapvarShoulderPlate == 0
			    drawindexed = 6912, 77028, 0
			endif
			; GShoulderPlateF
			if $swapvarShoulderPlate == 0
			    drawindexed = 3120, 83940, 0
			endif
			; GShoulderPlateG
			if $swapvarShoulderPlate == 0
			    drawindexed = 4416, 87060, 0
			endif
			; GShoulderPlateG.001
			if $swapvarShoulderPlate == 0
			    drawindexed = 4416, 91476, 0
			endif
			; GShoulderPlateH
			if $swapvarShoulderPlate == 0
			    drawindexed = 1008, 95892, 0
			endif
			; GSpineB
			if $swapvarSpines == 0
			    if $swapvarAnim == 0
			        drawindexed = 46650, 96900, 0
			    endif
			endif
			; GThighPlate
			if $swapvarThighPlace == 0
			    drawindexed = 4128, 143550, 0
			endif
			; GThing_03
			if $swapvarSpines == 0 || $swapvarSpines == 1
			    if $swapvarAnim == 0
			        drawindexed = 3012, 147678, 0
			    endif
			endif
	; Feet
		; Boots
		if $swapvarHeels == 0 || $swapvarHeels == 1
		    drawindexed = 5250, 150690, 0
		endif
		; MetalToes
		if $swapvarLegs == 0
		    drawindexed = 10224, 155940, 0
		endif
	; Body
		; BreastDefault
		if $swapvarAltTop == 2 || $swapvarTopC == 0
		    drawindexed = 13200, 166164, 0
		endif
		; ElfEars
		if $swapvarEars == 0
		    drawindexed = 654, 179364, 0
		endif
		; Feet
		if $swapvarLegs != 0
		    drawindexed = 25032, 180018, 0
		endif
		; LegL
		if $swapvarLegs == 2
		    drawindexed = 10752, 205050, 0
		endif
		; LegL_Tied
		if $swapvarLegs == 1
		    drawindexed = 21504, 215802, 0
		endif
		; LegL_TiedB
		if $swapvarLegs == 1
		    drawindexed = 23328, 237306, 0
		endif
		; LegR
		if $swapvarLegs == 1 || $swapvarLegs == 2
		    drawindexed = 10752, 260634, 0
		endif
		; Neck (264)
		drawindexed = 1062, 271386, 0
		; Pussy
		if $swapvarPanties != 0 || $swapvarAnim == 1
		    drawindexed = 1848, 272448, 0
		endif
		; Thighs
		if $swapvarLegs == 2
		    drawindexed = 15552, 274296, 0
		endif
		; ThighsTied
		if $swapvarLegs == 0 || $swapvarLegs == 1
		    drawindexed = 106038, 289848, 0
		endif
		; TopBody (16464)
		drawindexed = 90813, 395886, 0
	; BlackCloth
		; BreastRopesA
		if $swapvarAltTop == 0
		    if $swapvarTopC == 1
		        drawindexed = 13200, 486699, 0
		    endif
		endif
		; BreastRopesA.001
		if $swapvarAltTop == 0
		    if $swapvarTopC == 1
		        drawindexed = 4224, 499899, 0
		    endif
		endif
		; BreastRopesB
		if $swapvarAltTop == 1
		    if $swapvarTopC == 1
		        drawindexed = 54720, 504123, 0
		    endif
		endif
		; HandRopes
		if $swapvarSleeves == 1
		    drawindexed = 25920, 558843, 0
		endif
		; HandRopesB (10327)
		drawindexed = 26784, 584763, 0
		; Necklace
		if $swapvarNeck == 1
		    drawindexed = 8640, 611547, 0
		endif
		; Panties
		if $swapvarPanties == 0
		    if $swapvarAnim == 0
		        drawindexed = 3156, 620187, 0
		    endif
		endif
		; PantiesB
		if $swapvarPanties == 0 || $swapvarPanties == 1
		    if $swapvarAnim == 0
		        drawindexed = 3456, 623343, 0
		    endif
		endif
		; Shirt
		if $swapvarAltTop == 0 || $swapvarAltTop == 1
		    drawindexed = 18372, 626799, 0
		endif
		; Sleeves
		if $swapvarSleeves == 0
		    drawindexed = 44640, 645171, 0
		endif
		; Stockings
		if $swapvarLegs == 0
		    drawindexed = 7440, 689811, 0
		endif
		; TopRopes
		if $swapvarAltTop == 0 || $swapvarAltTop == 1 || $swapvarAltTop == 2
		    if $swapvarPanties == 0
		        if $swapvarAnim == 0
		            drawindexed = 5994, 697251, 0
		        endif
		    endif
		endif
	; Top
		; Plane.039
		if $swapvarTopC == 0
		    drawindexed = 9696, 703245, 0
		endif
	; Dress
		; Plane.004
		if $swapvarDemon == 1
		    if $swapvarAdditional == 0 || $swapvarAdditional == 2
		        drawindexed = 48396, 712941, 0
		    endif
		endif
		; drapping
		if $swapvarAdditional == 0 || $swapvarAdditional == 1
		    if $swapvarAnim == 0
		        drawindexed = 82836, 761337, 0
		    endif
		endif
	$vartemp = 844173
	run = CommandListA.Anim
[CommandListYiXuanJacketA]
[CommandListYiXuanHairA]
; YiXuanHairA
	; 11Hair.001
	if $swapvarHair == 0 || $swapvarHair == 1
	    drawindexed = 15519, 0, 0
	endif
	; Accessory
	if $swapvarHairAcc == 0 || $swapvarHairAcc == 1
	    drawindexed = 31392, 15519, 0
	endif
	; GShoulderPlateA.001
	if $swapvarHair == 0
	    drawindexed = 8352, 46911, 0
	endif
	; HWings
	if $swapvarHairAcc == 0 || $swapvarHairAcc == 2
	    if $swapvarDemon == 0
	        drawindexed = 6672, 55263, 0
	    endif
	endif
	; HairBun
	if $swapvarHair != 2
	    drawindexed = 762, 61935, 0
	endif
	; HairBun.001
	if $swapvarHair == 0 || $swapvarHair == 1
	    drawindexed = 2478, 62697, 0
	endif
	; HairDefaultA
	if $swapvarHair == 2
	    drawindexed = 21816, 65175, 0
	endif
	; HairDefaultC
	if $swapvarHair == 2
	    drawindexed = 2100, 86991, 0
	endif
	; Horns
	if $swapvarHairAcc == 0 || $swapvarHairAcc == 2
	    if $swapvarDemon == 1
	        drawindexed = 4704, 89091, 0
	    endif
	endif
	; Plane.002
	if $swapvarHair == 0
	    drawindexed = 26256, 93795, 0
	endif
	; Plane.032
	if $swapvarFace == 0
	    drawindexed = 6084, 120051, 0
	endif
	; fefa
	if $swapvarHair == 0
	    drawindexed = 996, 126135, 0
	endif
[CommandListYiXuanHairB]
; YiXuanHairB
	; HairDefaultB
	if $swapvarHair == 2
	    drawindexed = 4476, 0, 0
	endif
; TEXTURES
[ResourceBase]
filename = .\Textures\BaseDiffuse.dds
[ResourceBaseDark]
filename = .\Textures\BaseDarkDiffuse.dds
[ResourceHorny]
filename = .\Textures\HornyDiffuse.dds
[ResourceHornyDark]
filename = .\Textures\HornyDarkDiffuse.dds
[ResourceDemon]
filename = .\Textures\DemonDiffuse.dds
[ResourceDemonDark]
filename = .\Textures\DemonDarkDiffuse.dds
[ResourceCum]
filename = .\Textures\CumDiffuse.dds
[ResourceCumDark]
filename = .\Textures\CumDarkDiffuse.dds
[ResourceYiXuanNormalMap]
filename = .\Textures\YiXuanNormalMap.dds
[ResourceYiXuanLightMap]
filename = .\Textures\YiXuanLightMap.dds
[ResourceYiXuanMaterialMap]
filename = .\Textures\YiXuanMaterialMap.dds
[ResourceYiXuanGlowMap]
filename = .\Textures\Emission.dds
; CREDIT FUNCTION
[CommandListCreditInfo]
if $creditinfo == 0 && $active == 1 && $disablecredits == 0
    if $lasttime == 0
    $lasttime = time
    endif
    $credits = time - $lasttime
    $credits = $credits * 20.0
    run = CommandListCreditPlateSDX
    if $credits >= 40
        $credits = 0
        $creditinfo = 1
    endif
endif
[CommandListRunSlotFix]
if $swapvarDemon == 0
    if $swapvarColor == 0
        ps-t3 = ResourceBase
    elif $swapvarColor == 1
        ps-t3 = ResourceHorny
    elif $swapvarColor == 2
        ps-t3 = ResourceDemon
    elif $swapvarColor == 3
        ps-t3 = ResourceCum
    endif
else
    if $swapvarColor == 0
        ps-t3 = ResourceBaseDark
    elif $swapvarColor == 1
        ps-t3 = ResourceHornyDark
    elif $swapvarColor == 2
        ps-t3 = ResourceDemonDark
    elif $swapvarColor == 3
        ps-t3 = ResourceCumDark
    endif
endif
ps-t4 = ResourceYiXuanNormalMap
ps-t5 = ResourceYiXuanLightMap
ps-t6 = ResourceYiXuanMaterialMap
ps-t11 = ResourceYiXuanGlowMap
; CREDIT VALUES
[Constants]
global $cmx = 0.02
global $cmy = 0.83
global $credits = 0
global persist $disablecredits = 0
global $lasttime = 0
global $ww
global $wh
global $cpx
global $cpy
global $dt
global $ts
[KeySwapDisableCredits]
condition = $active == 1
key = alt ctrl /
type = cycle
$disablecredits = 0,1
[CommandListDimensionsCredit]
if window_width != 0
  $ww = window_width
  $wh = window_height
else
  if $ww != 0
    $ww = rt_width
    $wh = rt_height
  else
    $ww = res_width
    $wh = res_height
  endif
endif
if cursor_x != 0 && cursor_y != 0
  $cpx = cursor_x
  $cpy = cursor_y
else
  if 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
endif
[CommandListCreditPlateSDX]
run = CommandListDimensionsCredit
run = CommandListCreditPlate
[CommandListCreditPlate]
local $cox
local $coy
x88 = $credits
ps-t100 = ResourceCredit
y87 = 128 / $wh
x87 = 512 / $ww
z87 = $cmx
w87 = $cmy
run = CustomShaderCredit
[CustomShaderCredit]
vs = .\UIResources\Credit\CreditRender.hlsl
ps = .\UIResources\Credit\CreditRender.hlsl
run = BuiltInCommandListUnbindAllRenderTargets
blend = ADD SRC_ALPHA INV_SRC_ALPHA
cull = none
topology = triangle_strip
o0 = set_viewport bb
Draw = 4,0
[ResourceCredit]
filename = .\UIResources\Credit\Credit.png
; MODELS
[ResourceYiXuanBodyPosition]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanBodyPosition.buf
[ResourceYiXuanBodyBlend]
type = Buffer
stride = 32
filename = .\Meshes\YiXuanBodyBlend.buf
[ResourceYiXuanBodyTexcoord]
type = Buffer
stride = 20
filename = .\Meshes\YiXuanBodyTexcoord.buf
[ResourceYiXuanJacketPosition]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanJacketPosition.buf
[ResourceYiXuanJacketBlend]
type = Buffer
stride = 32
filename = .\Meshes\YiXuanJacketBlend.buf
[ResourceYiXuanJacketTexcoord]
type = Buffer
stride = 24
filename = .\Meshes\YiXuanJacketTexcoord.buf
[ResourceYiXuanHairPosition]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanHairPosition.buf
[ResourceYiXuanHairBlend]
type = Buffer
stride = 32
filename = .\Meshes\YiXuanHairBlend.buf
[ResourceYiXuanHairTexcoord]
type = Buffer
stride = 20
filename = .\Meshes\YiXuanHairTexcoord.buf
[ResourceYiXuanBodyAIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = .\Meshes\YiXuanBodyA.ib
[ResourceYiXuanJacketAIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = .\Meshes\YiXuanJacketA.ib
[ResourceYiXuanHairAIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = .\Meshes\YiXuanHairA.ib
[ResourceYiXuanHairBIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = .\Meshes\YiXuanHairB.ib
[ResourceCreditInfo]
type = Buffer
data = "Created by FleurNaive"

;UI ------------------
[Constants]
global $menu = 0
global $hold
global $holdShape
global $drag
global $hovering
global $slot
global $hoveredSlot
global $clickedSlot
global $selectedSlot = 0
global persist $mx = 0.05
global persist $my = 0.25
global $ww
global $wh
global $cpx
global $cpy
global $dt
global $ts
global $page

global $UIfps = 11
global $UIframeStart= 0
global $UIframeEnd = 10
global persist $swapvarUIAnim = 0

[KeyShowMenuAlt]
condition = $active == 1
key = no_alt no_ctrl /
type = cycle
$menu = 0,1

[KeyShowMenuPage]
condition = $active == 1
key = alt no_ctrl /
type = cycle
$page = 0,1

[KeyMenu.ResetPosition]
condition = $menu == 1
key = \
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

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

[CommandListUIAnimation]
$swapvarUIAnim = (time * $UIfps % ($UIframeEnd - $UIframeStart + 1) + $UIframeStart) // 1
if $active
  $dt = time - $ts
  $ts = time
  if $menu
    run = CommandListOutfitMenu
  endif
endif

[Present]
post $active = 0
run = CommandListUIAnimation
[CommandListDimensions]
if window_width != 0
  $ww = window_width
  $wh = window_height
else
  if $ww != 0
    $ww = rt_width
    $wh = rt_height
  else
    $ww = res_width
    $wh = res_height
  endif
endif

if cursor_x != 0 && cursor_y != 0
  $cpx = cursor_x
  $cpy = cursor_y
else
  if 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
endif

[CommandListOutfitMenu]
run = CommandListDimensions
run = CommandListBackground

[CommandListBackground]
local $cox
local $coy

x88 = $swapvarUIAnim
ps-t100 = ResourceMenu

y87 = 768 / $wh
x87 = 256 / $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 = CustomShaderElementMenu
run = CommandListDrawToggles

[CommandListSlot]
run = CommandListSlotItemImage

if $cpx > z87 && $cpx < (z87 + x87 - 0.0035) && $cpy > w87 && $cpy < (w87 + y87 - 0.0035)
	ps-t100 = ResourceItemSlotHover.SlotHover
	$hovering = 1
	$hoveredSlot = $slot
	$selectedSlot = 0
else
	if $slot == $selectedSlot
		$hoveredSlot = $slot
		ps-t100 = ResourceItemSlotHover.SlotHover
	else
		ps-t100 = ResourceItemSlot
	endif
endif

run = CustomShaderElement

if $clickedSlot == $slot
	ps-t100 = ResourceItemSlotHover.SlotClicked
	run = CustomShaderElement
	$clickedSlot = 0
endif

[CommandListSlotOtherButtons]
run = CommandListSlotItemImage

ps-t100 = NULL

if $cpx > z87 && $cpx < (z87 + x87 - 0.0035) && $cpy > w87 && $cpy < (w87 + y87 - 0.0035)
	$hovering = 1
	$hoveredSlot = $slot
	$selectedSlot = 0
endif

if $slot == 100
	if $page != 0
		ps-t100 = ResourceItemSlot.UPage
	else
		ps-t100 = ResourceItemSlot.Page
	endif
elif $slot == 101
	if $page != 1
		ps-t100 = ResourceItemSlot.UPage
	else
		ps-t100 = ResourceItemSlot.Page
	endif
endif 

run = CustomShaderElement

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

[CustomShaderElementMenu]
vs = .\UIResources\AnimatedMenu\MenuRender.hlsl
ps = .\UIResources\AnimatedMenu\MenuRender.hlsl
run = BuiltInCommandListUnbindAllRenderTargets
blend = ADD SRC_ALPHA INV_SRC_ALPHA
cull = none
topology = triangle_strip
o0 = set_viewport bb
Draw = 4,0

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

[ResourceMenu]
filename = .\UIResources\AnimatedMenu\Menu.png

[ResourceItemSlot]
filename = .\UIResources\Slot.png

[ResourceItemSlotHover.SlotHover]
filename = .\UIResources\Slot_Hover.png

[ResourceItemSlotHover.SlotClicked]
filename = .\UIResources\Slot_Hover_2.png

[ResourceItemSlot.Page]
filename = .\UIResources\UPage.png

[ResourceItemSlot.UPage]
filename = .\UIResources\Page.png

[CommandListClickedSlot]
$clickedSlot = $hoveredSlot

if $clickedSlot == 100
$page = 0
elif $clickedSlot == 101
$page = 1
endif

if $clickedSlot == 1
  $swapvarTopC = $swapvarTopC + 1
  if $swapvarTopC > 1
    $swapvarTopC = 0
  endif
elif $clickedSlot == 2
  $swapvarTop = $swapvarTop + 1
  if $swapvarTop > 1
    $swapvarTop = 0
  endif
elif $clickedSlot == 3
  $swapvarAltTop = $swapvarAltTop + 1
  if $swapvarAltTop > 2
    $swapvarAltTop = 0
  endif
elif $clickedSlot == 4
  $swapvarNeck = $swapvarNeck + 1
  if $swapvarNeck > 1
    $swapvarNeck = 0
  endif
elif $clickedSlot == 5
  $swapvarSpines = $swapvarSpines + 1
  if $swapvarSpines > 2
    $swapvarSpines = 0
  endif
elif $clickedSlot == 6
  $swapvarPanties = $swapvarPanties + 1
  if $swapvarPanties > 2
    $swapvarPanties = 0
  endif
elif $clickedSlot == 7
  $swapvarShoulderPlate = $swapvarShoulderPlate + 1
  if $swapvarShoulderPlate > 1
    $swapvarShoulderPlate = 0
  endif
elif $clickedSlot == 8
  $swapvarSleeves = $swapvarSleeves + 1
  if $swapvarSleeves > 1
    $swapvarSleeves = 0
  endif
elif $clickedSlot == 9
  $swapvarThighPlace = $swapvarThighPlace + 1
  if $swapvarThighPlace > 1
    $swapvarThighPlace = 0
  endif
elif $clickedSlot == 10
  $swapvarLegs = $swapvarLegs + 1
  if $swapvarLegs > 2
    $swapvarLegs = 0
  endif
elif $clickedSlot == 11
  $swapvarHeels = $swapvarHeels + 1
  if $swapvarHeels > 2
    $swapvarHeels = 0
  endif
elif $clickedSlot == 12
  $swapvarHair = $swapvarHair + 1
  if $swapvarHair > 2
    $swapvarHair = 0
  endif
elif $clickedSlot == 13
  $swapvarHairAcc = $swapvarHairAcc + 1
  if $swapvarHairAcc > 3
    $swapvarHairAcc = 0
  endif
elif $clickedSlot == 14
  $swapvarEars = $swapvarEars + 1
  if $swapvarEars > 1
    $swapvarEars = 0
  endif
elif $clickedSlot == 15
  $swapvarFace = $swapvarFace + 1
  if $swapvarFace > 1
    $swapvarFace = 0
  endif
elif $clickedSlot == 16
  $swapvarDemon = $swapvarDemon + 1
  if $swapvarDemon > 1
    $swapvarDemon = 0
  endif
elif $clickedSlot == 17
  $swapvarColor = $swapvarColor + 1
  if $swapvarColor > 3
    $swapvarColor = 0
  endif
elif $clickedSlot == 18
  $swapvarAdditional = $swapvarAdditional + 1
  if $swapvarAdditional > 3
    $swapvarAdditional = 0
  endif
elif $clickedSlot == 19
    $sktop = $sktop + 1
  $done = 0
  if $sktop > 10
    $sktop = 10
  endif
elif $clickedSlot == 20
  $sktop = $sktop - 1
  $done = 0
  if $sktop < 0 
    $sktop = 0
  endif
elif $clickedSlot == 21
  $skbottom = $skbottom + 1
  $done = 0
  if $skbottom > 10
    $skbottom = 10
  endif
elif $clickedSlot == 22
  $skbottom = $skbottom - 1
  $done = 0
  if $skbottom < 0
    $skbottom = 0
  endif
elif $clickedSlot == 23
  $swapvarAnim = $swapvarAnim + 1
  if $swapvarAnim > 1
    $swapvarAnim = 0
  endif
elif $clickedSlot == 24
  $swapvarAnimSpeed = $swapvarAnimSpeed + 1
  if $swapvarAnimSpeed > 3
    $swapvarAnimSpeed = 0
  endif
endif

[CommandListDrawToggles]
local $z0 = z87 + 25 / $ww
local $z1 = $z0 + 70 / $ww

local $wo = 75 / $wh

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

local $zbase = $z1
local $wbase = w87

local $xof = 130

ps-t100 = NULL
run = CustomShaderElement

z87 = $zbase + 1.08*75 / $wh
w87 = $wbase + $xof/ $wh + 0.0*75 / $wh
$slot = 100
run = CommandListSlotOtherButtons

z87 = $zbase + 1.08*75 / $wh
w87 = $wbase + $xof/ $wh + 0.65*75 / $wh
$slot = 101
run = CommandListSlotOtherButtons

;TopC
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 0*75 / $wh
$slot = 1
run = CommandListSlot
;Top
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 1*75 / $wh
$slot = 2
run = CommandListSlot
;AltTop
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 2*75 / $wh
$slot = 3
run = CommandListSlot
;Neck
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 3*75 / $wh
$slot = 4
run = CommandListSlot
;Spines
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 4*75 / $wh
$slot = 5
run = CommandListSlot
;Panties
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 5*75 / $wh
$slot = 6
run = CommandListSlot
;ShoulderPlate
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 4*75 / $wh
$slot = 7
run = CommandListSlot
;Sleeves
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 5*75 / $wh
$slot = 8
run = CommandListSlot
;ThighPlace
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 0*75 / $wh
$slot = 9
run = CommandListSlot
;Legs
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 1*75 / $wh
$slot = 10
run = CommandListSlot
;Heels
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 2*75 / $wh
$slot = 11
run = CommandListSlot
;Hair
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 0*75 / $wh
$slot = 12
run = CommandListSlot
;HairAcc
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 1*75 / $wh
$slot = 13
run = CommandListSlot
;Ears
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 2*75 / $wh
$slot = 14
run = CommandListSlot
;Face
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 3*75 / $wh
$slot = 15
run = CommandListSlot
;Demon
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 4*75 / $wh
$slot = 16
run = CommandListSlot
;Color
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 5*75 / $wh
$slot = 17
run = CommandListSlot
;Additional
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 3*75 / $wh
$slot = 18
run = CommandListSlot
;BiggerChest
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 6*75 / $wh
$slot = 19
run = CommandListSlot
;SmallerChest
z87 = $zbase + 0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 7*75 / $wh
$slot = 20
run = CommandListSlot
;BiggerBottom
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 6*75 / $wh
$slot = 21
run = CommandListSlot
;SmallerBottom
z87 = $zbase + -0.55*75 / $wh
w87 = $wbase + $xof/ $wh + 7*75 / $wh
$slot = 22
run = CommandListSlot
;Anim
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 7*75 / $wh
$slot = 23
run = CommandListSlot
;AnimSpeed
z87 = $zbase + 0.0*75 / $wh
w87 = $wbase + $xof/ $wh + 6*75 / $wh
$slot = 24
run = CommandListSlot
[CommandListSlotItemImage]
x87 = 52 / $ww 
y87 = 52 / $wh
z87 = z87 + 6 / $ww
w87 = w87 + 10 / $ww


if $slot == 1
  ps-t100 = ResourceMenuItem.TopC
elif $slot == 2
  ps-t100 = ResourceMenuItem.Top
elif $slot == 3
  ps-t100 = ResourceMenuItem.AltTop
elif $slot == 4
  ps-t100 = ResourceMenuItem.Neck
elif $slot == 5
  ps-t100 = ResourceMenuItem.Spines
elif $slot == 6
  ps-t100 = ResourceMenuItem.Panties
elif $slot == 7
  ps-t100 = ResourceMenuItem.ShoulderPlate
elif $slot == 8
  ps-t100 = ResourceMenuItem.Sleeves
elif $slot == 9
  ps-t100 = ResourceMenuItem.ThighPlace
elif $slot == 10
  ps-t100 = ResourceMenuItem.Legs
elif $slot == 11
  ps-t100 = ResourceMenuItem.Heels
elif $slot == 12
  ps-t100 = ResourceMenuItem.Hair
elif $slot == 13
  ps-t100 = ResourceMenuItem.HairAcc
elif $slot == 14
  ps-t100 = ResourceMenuItem.Ears
elif $slot == 15
  ps-t100 = ResourceMenuItem.Face
elif $slot == 16
  ps-t100 = ResourceMenuItem.Demon
elif $slot == 17
  ps-t100 = ResourceMenuItem.Color
elif $slot == 18
  ps-t100 = ResourceMenuItem.Additional
elif $slot == 19
  ps-t100 = ResourceMenuItem.BiggerChest
elif $slot == 20
  ps-t100 = ResourceMenuItem.SmallerChest
elif $slot == 21
  ps-t100 = ResourceMenuItem.BiggerBottom
elif $slot == 22
  ps-t100 = ResourceMenuItem.SmallerBottom
elif $slot == 23
  ps-t100 = ResourceMenuItem.Anim
elif $slot == 24
  ps-t100 = ResourceMenuItem.AnimSpeed
endif
run = CustomShaderElement

x87 = 64 / $ww 
y87 = 64 / $wh
z87 = z87 - 6 / $ww
w87 = w87 - 12 / $ww


[ResourceMenuItem.TopC]
  filename = .\UIResources\TopC.png
[ResourceMenuItem.Top]
  filename = .\UIResources\Top.png
[ResourceMenuItem.AltTop]
  filename = .\UIResources\AltTop.png
[ResourceMenuItem.Neck]
  filename = .\UIResources\Neck.png
[ResourceMenuItem.Spines]
  filename = .\UIResources\Spines.png
[ResourceMenuItem.Panties]
  filename = .\UIResources\Panties.png
[ResourceMenuItem.ShoulderPlate]
  filename = .\UIResources\ShoulderPlate.png
[ResourceMenuItem.Sleeves]
  filename = .\UIResources\Sleeves.png
[ResourceMenuItem.ThighPlace]
  filename = .\UIResources\ThighPlace.png
[ResourceMenuItem.Legs]
  filename = .\UIResources\Legs.png
[ResourceMenuItem.Heels]
  filename = .\UIResources\Heels.png
[ResourceMenuItem.Hair]
  filename = .\UIResources\Hair.png
[ResourceMenuItem.HairAcc]
  filename = .\UIResources\HairAcc.png
[ResourceMenuItem.Ears]
  filename = .\UIResources\Ears.png
[ResourceMenuItem.Face]
  filename = .\UIResources\Face.png
[ResourceMenuItem.Demon]
  filename = .\UIResources\Demon.png
[ResourceMenuItem.Color]
  filename = .\UIResources\Color.png
[ResourceMenuItem.Additional]
  filename = .\UIResources\Additional.png
[ResourceMenuItem.BiggerChest]
  filename = .\UIResources\BiggerChest.png
[ResourceMenuItem.SmallerChest]
  filename = .\UIResources\SmallerChest.png
[ResourceMenuItem.BiggerBottom]
  filename = .\UIResources\BiggerBottom.png
[ResourceMenuItem.SmallerBottom]
  filename = .\UIResources\SmallerBottom.png
[ResourceMenuItem.Anim]
  filename = .\UIResources\Anim.png
[ResourceMenuItem.AnimSpeed]
  filename = .\UIResources\AnimSpeed.png
;Shapekeys ---------------------

[Constants]
global $part = 0
global $done = 0
global persist $sktop = 0
global persist $skbottom = 0

[KeySwapswapvarBiggerChest]
condition = $active == 1
key = no_alt no_ctrl 9
type = cycle
$sktop = 0,1,2,3,4,5,6,7,8,9,10
$done = 0
[KeySwapswapvarSmallerChest]
condition = $active == 1
key = alt no_ctrl 9
type = cycle
$sktop = 10,9,8,7,6,5,4,3,2,1,0
$done = 0
[KeySwapswapvarBiggerBottom]
condition = $active == 1
key = no_alt no_ctrl 0
type = cycle
$skbottom = 0,1,2,3,4,5,6,7,8,9,10
$done = 0
[KeySwapswapvarSmallerBottom]
condition = $active == 1
key = alt no_ctrl 0
type = cycle
$skbottom = 10,9,8,7,6,5,4,3,2,1,0
$done = 0

[Present]
if $active == 1
    if $done == 0
        run = CommandListComputeShapeKeys
        run = CommandListKeyBottom
        $done = 1
    endif 
endif 

[CommandListComputeShapeKeys]
ResourceYiXuanBodyPosition = copy ResourceYiXuanBodyPositionBase
run = CustomShaderKeys
cs-u5 = null
cs-t50 = null
cs-t51 = null
cs-t52 = null
cs-t53 = null
cs-t54 = null

[CommandListKeyBottom] 
   cs-t50 = copy ResourceYiXuanBodyPositionBase
   cs-t51 = copy ResourceYiXuanBodyPositionBiggerBottom
   cs-t52 = copy ResourceYiXuanBodyPositionSmallerBottom
   cs-t53 = copy ResourceYiXuanBodyPositionBiggerChest
   cs-t54 = copy ResourceYiXuanBodyPositionSmallerChest

x88 = $skbottom/10
x89 = $sktop/10
run = CustomShaderKeys

[CustomShaderKeys]
cs-u5 = copy ResourceYiXuanBodyPositionBase 

cs = Shaders/ShapeKey.hlsl
dispatch = 213651, 1, 1

ResourceYiXuanBodyPosition = copy ref cs-u5


[ResourceYiXuanBodyPositionBase]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanBodyPositionBase.buf

[ResourceYiXuanBodyPositionBiggerBottom]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanBodyPositionBiggerBottom.buf

[ResourceYiXuanBodyPositionSmallerBottom]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanBodyPositionSmallerBottom.buf

[ResourceYiXuanBodyPositionBiggerChest]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanBodyPositionBiggerChest.buf

[ResourceYiXuanBodyPositionSmallerChest]
type = Buffer
stride = 40
filename = .\Meshes\YiXuanBodyPositionSmallerChest.buf
[TextureOverrideAcc1]
hash = ddaf88bc
handling = skip

[TextureOverrideAcc2]
hash = ba017cf3
handling = skip

[TextureOverrideAcc3]
hash = d000beae
handling = skip

[TextureOverrideAcc4]
hash = 24481cb5
handling = skip

[TextureOverrideAcc5]
hash = 682d8528
handling = skip

[TextureOverrideAcc6]
hash = 05466ddf
handling = skip

















[TextureOverrideYixuanFace.1024]
hash = 9efd1605
this = ResourceYixuanFaceDiffuse

[ResourceYixuanFaceDiffuse]
filename = .\Textures\YixuanFaceDiffuse.dds



[TextureOverrideYixuanBodyADiffuse]
hash = 2a4f37a6
this = ResourceResultDiffuse

[TextureOverrideYixuanBodyANormalMap]
hash = ebac056e
this = ResourceYixuanNormalMap

[TextureOverrideYixuanBodyALightMap]
hash = 5a291e85
this = ResourceYixuanLightMap

[TextureOverrideYixuanBodyAMaterialMap]
hash = d28370ec
this = ResourceYixuanMaterialMap

[TextureOverrideYixuanHairADiffuse]
hash = 7e38b38b
this = ResourceResultDiffuse

[TextureOverrideYixuanHairALightMap]
hash = 086ac064
this = ResourceYixuanLightMap

[TextureOverrideYixuanHairAMaterialMap]
hash = 83b02982
this = ResourceYixuanMaterialMap

[TextureOverrideYixuanJacketADiffuse]
hash = e6dca725
this = ResourceResultDiffuse

[TextureOverrideYixuanJacketALightMap]
hash = 59b2daf9
this = ResourceYixuanLightMap

[TextureOverrideYixuanJacketAMaterialMap]
hash = bb581f1e
this = ResourceYixuanMaterialMap

[CommandListA.Anim]
if $swapvarAnim == 1
    drawindexed = 2916, 2916 * $swapvarAnimFrame + $vartemp, 0
endif