; ===========     ABOUT     =============
; "Ju Fufu: Tigerr" mod by Zlevir, *unknown modder*
; More mods at https://patreon.com/zlevir


; ===========      UI       =============
; I am not as kind as AGMG tool devs
; so if you use parts of my implementation of
; the interface, you are bound to credit me
; with a link :P

; ========================================
; Stuff that is safe to change
; Generally, it's only safe to change the buttons
; you press to call the menu and reset the UI position

; Button that brings up or hides the menu
[KeyMenu]
condition = $active == 1
key = no_modifiers /
type = cycle
$menu = 0,1

; If the menu does not show up or acts weird, change these
; to the game window resolution
; or to your screen resolution
; 1920x1080 by default cause it's the most common type of screens
; and most people play in fullscreen mode
[Constants]
global $window_width = 1920
global $window_height = 1080

; Resets menu position
; More specifically, it resets the mod menu widget
; position, made it in case you dragged window somewhere
; where you shouldn't and now can't get it back
; I tried to drag it into some inaccessible place myself
; but couldn't do it, but you can never trust anyone
; not to break it, hence the reset function exists
[KeyMenu.ResetPosition]
condition = $menu == 1
key = no_ctrl shift VK_RIGHT
run = CommandListResetMenuPos

; Moves menu up
[KeyMenu.Menu.UP]
condition = $menu == 1
key = no_alt no_shift ctrl VK_UP
type = hold
run = CommandListMoveMenu.UP

; Moves menu down
[KeyMenu.Menu.DOWN]
condition = $menu == 1
key = no_alt no_shift ctrl VK_DOWN
type = hold
run = CommandListMoveMenu.DOWN

; Moves menu left
[KeyMenu.Menu.LEFT]
condition = $menu == 1
key = no_alt no_shift ctrl VK_LEFT
type = hold
run = CommandListMoveMenu.LEFT

; Moves menu right
[KeyMenu.Menu.RIGHT]
condition = $menu == 1
key = no_alt no_shift ctrl VK_RIGHT
type = hold
run = CommandListMoveMenu.RIGHT

; Navigates forward through the menu (toggles/sliders)
[KeyMenu.Navigate.FORWARD]
condition = $menu == 1 && !$navigating 
key = no_ctrl no_shift no_alt VK_DOWN
type = hold
run = CommandListNavigateMenu.FORWARD

; Navigates backwards through the menu (toggles/sliders)
[KeyMenu.Navigate.BACKWARDS]
condition = $menu == 1 && !$navigating 
key = no_ctrl no_shift no_alt VK_UP
type = hold
run = CommandListNavigateMenu.BACKWARDS

; Emulates click on a selected toggle slot
; Or moves the cursor of selected slider
[KeyMenu.Navigate.PRESS.LEFT]
condition = $menu == 1
key = no_ctrl no_shift no_alt VK_LEFT
type = hold
run = CommandListNavigateMenu.Press.LEFT

[KeyMenu.Navigate.PRESS.RIGHT]
condition = $menu == 1
key = no_ctrl no_shift no_alt VK_RIGHT
type = hold
run = CommandListNavigateMenu.Press.RIGHT

; =========================================
; Below is stuff that is extremely unsafe to change.
; If you do that and the mod breaks, it's on you, not on me.
; Do it only if you know what you are doing

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

[Constants]
global persist $arms = 1
global persist $top = 1
global persist $gloves = 1
global persist $panties = 1
global persist $tail = 1
global persist $shoes = 1
global persist $dildo = 0
global persist $liquid = 0

global $active

global $menu = 0
global $menu_move = 1
global $menu_d
global $mms
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.05
global persist $my = 0.25

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

global $first_run = 1

global $dt
global $ts

global persist $AnimSpeed = 0.35
global $TargetAnimSpeed
global $Freq

global persist $BoobsSize = 0.35
global $TargetBoobsSize

global persist $ButtSize = 0.5
global $TargetButtSize

global persist $ThighsSize = 0.5
global $TargetThighsSize

[Present]
if $active
	if $first_run
	ResourceJu_Fufu_Body_Position = copy ResourceJu_Fufu_Body_Position.B
		$TargetBoobsSize = $BoobsSize
		$TargetButtSize = $ButtSize
		$TargetThighsSize = $ThighsSize
    $TargetAnimSpeed = $AnimSpeed
		run = CustomShaderComputeShapes
		$first_run = 0
	endif
	$dt = time - $ts
	$ts = time
	if $holdShape > 1 || ($dildo > 3 && !$panties)
	run = CustomShaderComputeShapes
	endif
	if $menu
		run = CommandListOutfitMenu
	endif
endif

post $active = 0

[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

[CustomShaderComputeShapes]
x88 = $BoobsSize
cs-t50 = copy ResourceJu_Fufu_Body_Position.B
cs-t51 = copy ResourceJu_Fufu_Body_Position.BOOBS
cs = ./res/Shapes.hlsl
cs-u5 = copy ResourceJu_Fufu_Body_Position.B
Dispatch = 35688, 1, 1
x88 = $ButtSize
cs-t51 = copy ResourceJu_Fufu_Body_Position.BUTT
Dispatch = 35688, 1, 1
x88 = $ThighsSize
cs-t51 = copy ResourceJu_Fufu_Body_Position.THIGHS
Dispatch = 35688, 1, 1
if !$panties && ($dildo == 1 || $dildo == 3 || $dildo == 4 || $dildo == 6)
	x88 = 1
else
	x88 = 0
endif
cs-t51 = copy ResourceJu_Fufu_Body_Position.BUTTGAPE
Dispatch = 35688, 1, 1
if !$panties && ($dildo == 2 || $dildo == 3 || $dildo == 5 || $dildo == 6)
	x88 = 1
else
	x88 = 0
endif
cs-t51 = copy ResourceJu_Fufu_Body_Position.VAGGAPE
Dispatch = 35688, 1, 1
if !$panties && ($dildo == 3 || $dildo == 6)
	x88 = 1
else
	x88 = 0
endif
cs-t51 = copy ResourceJu_Fufu_Body_Position.ANIMCORR
Dispatch = 35688, 1, 1
run = CustomShaderComputeAnim
ResourceJu_Fufu_Body_Position = ref cs-u5

cs-u5 = null
cs-t50 = null
cs-t51 = null

[CustomShaderComputeAnim]
$Freq = $Freq + ($AnimSpeed + 0.15) * $dt
if $dildo == 4 || $dildo == 6
  x88 = $Freq
  cs-t51 = copy ResourceJu_Fufu_Body_Position.BUTTANIM
  cs = ./res/anim.hlsl
  Dispatch = 35688, 1, 1
endif
if $dildo == 5 || $dildo == 6
  x88 = 2 + $Freq
  cs-t51 = copy ResourceJu_Fufu_Body_Position.VAGANIM
  Dispatch = 35688, 1, 1
endif

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

[TextureOverrideJu_Fufu_Body_Blend]
hash = c06c0417
handling = skip
vb2 = ResourceJu_Fufu_Body_Blend
if DRAW_TYPE == 1
	vb0 = ResourceJu_Fufu_Body_Position
	draw = 35688,0
endif
$active = 1

[TextureOverrideJu_Fufu_Body_Texcoord]
hash = 2e086db7
vb1 = ResourceJu_Fufu_Body_Texcoord

[TextureOverrideJu_Fufu_Body_VertexLimitRaise]
hash = 5c076ce8
override_vertex_count = 35688
override_byte_stride = 92

[TextureOverrideJu_Fufu_Body_IB]
hash = de303163
handling = skip

[TextureOverrideJu_Fufu_Body_A]
hash = de303163
match_first_index = 0
handling = skip
run = CommandListBodyIB

[CommandListBodyIB]
ib = ResourceJu_Fufu_Body_AIB
Resource\ZZMI\Diffuse = ref ResourceJu_Fufu_Body_ADiffuse
Resource\ZZMI\NormalMap = ref ResourceJu_Fufu_Body_ANormalMap
Resource\ZZMI\LightMap = ref ResourceJu_Fufu_Body_ALightMap
Resource\ZZMI\MaterialMap = ref ResourceJu_Fufu_Body_AMaterialMap
run = CommandList\ZZMI\SetTextures
drawindexed = 32964, 0, 0
; ass dildo = 1,3,4,6
;vag dildo = 2,3,5,6
if !$panties && ($dildo == 1 || $dildo == 3 || $dildo == 4 || $dildo == 6)
	drawindexed = 1554, 32964, 0
endif
if !$panties && ($dildo == 2 || $dildo == 3 || $dildo == 5 || $dildo == 6)
	drawindexed = 1554, 34518, 0
endif
if $panties
	drawindexed = 14982, 36072, 0
endif
if $liquid
	drawindexed = 4494, 51054, 0
endif
if $shoes
	drawindexed = 44244, 55548, 0
else
	drawindexed = 5520, 99792, 0
endif
if $top
	drawindexed = 10896, 105312, 0
endif
if $arms
	drawindexed = 2028, 116208, 0
else
	drawindexed = 4254, 118236, 0
endif
if $gloves
	drawindexed = 45408, 122490, 0
else
	drawindexed = 8358, 167898, 0
endif

; [TextureOverrideJu_Fufu_Body_ADiffuse]
; hash = 16e4cac1
; this = ResourceJu_Fufu_Body_ADiffuse

; [TextureOverrideJu_Fufu_Body_ANormalMap]
; hash = ebac056e
; this = ResourceJu_Fufu_Body_ANormalMap

; [TextureOverrideJu_Fufu_Body_ALightMap]
; hash = c952431f
; this = ResourceJu_Fufu_Body_ALightMap

; [TextureOverrideJu_Fufu_Body_AMaterialMap]
; hash = d555b4f8
; this = ResourceJu_Fufu_Body_AMaterialMap

[TextureOverrideJu_Fufu_Tail_Blend]
hash = c8fa66e3
handling = skip
vb2 = ResourceJu_Fufu_Tail_Blend
if DRAW_TYPE == 1
	vb0 = ResourceJu_Fufu_Tail_Position
	draw = 1423,0
endif
$active = 1

[TextureOverrideJu_Fufu_Tail_Texcoord]
hash = 9a198bcf
vb1 = ResourceJu_Fufu_Tail_Texcoord

[TextureOverrideJu_Fufu_Tail_VertexLimitRaise]
hash = c84e77d4
override_vertex_count = 1423
override_byte_stride = 92

[TextureOverrideJu_Fufu_Tail_IB]
hash = f8ab3141
handling = skip

[TextureOverrideJu_Fufu_Tail_A]
hash = f8ab3141
match_first_index = 0
ib = ResourceJu_Fufu_Tail_AIB
if $tail
	drawindexed = 3036, 0, 0
endif

[TextureOverrideClaws.1]
hash = a27835bb
if $gloves
  handling = skip
endif

[TextureOverrideClaws.2]
hash = 46e339a6
if $gloves
  handling = skip
endif


;lod1 ---------

[TextureOverrideJufufuVertexLimitRaise_d3255dde.LOD1]
hash = a21cace5
[TextureOverrideJufufuVertexLimitRaise_174736eb.LOD1]
hash = 7373e90c

[TextureOverrideJu_Fufu_Body_Texcoord.LOD1]
hash = 34a15196
vb1 = ResourceJu_Fufu_Body_Texcoord
[TextureOverrideJu_Fufu_Body_Blend.LOD1]
hash = 289ca83d
handling = skip
vb2 = ResourceJu_Fufu_Body_Blend
if DRAW_TYPE == 1
	vb0 = ResourceJu_Fufu_Body_Position
	draw = 35688,0
endif
$active = 1
[TextureOverrideJu_Fufu_Tail_Blend.LOD1]
hash = dab93177
handling = skip
vb2 = ResourceJu_Fufu_Tail_Blend
if DRAW_TYPE == 1
	vb0 = ResourceJu_Fufu_Tail_Position
	draw = 1423,0
endif
$active = 1
[TextureOverrideJu_Fufu_Tail_Texcoord.LOD1]
hash = 5eb9916a
vb1 = ResourceJu_Fufu_Tail_Texcoord

[TextureOverrideJufufubodyA.LOD1]
hash = d3255dde
match_first_index = 0
handling = skip
run = CommandListBodyIB
[TextureOverrideJu_Fufu_Tail_A.LOD1]
hash = 174736eb
match_first_index = 0
handling = skip
ib = ResourceJu_Fufu_Tail_AIB
if $tail
	drawindexed = 3036, 0, 0
endif

[TextureOverrideClaws.1.LOD1]
hash = d4f19e85
if $gloves
  handling = skip
endif
[TextureOverrideClaws.2.LOD1]
hash = 45240295
if $gloves
  handling = skip
endif


;lod2 ---------

[TextureOverrideJufufuVertexLimitRaise_Body.LOD2]
hash = 3b252d6c
[TextureOverrideJufufuVertexLimitRaise_Tail.LOD2]
hash = 9173f473

[TextureOverrideJu_Fufu_Body_Texcoord.LOD2]
hash = 2dccea29
vb1 = ResourceJu_Fufu_Body_Texcoord
[TextureOverrideJu_Fufu_Body_Blend.LOD2]
hash = 3614c25d
handling = skip
vb2 = ResourceJu_Fufu_Body_Blend
if DRAW_TYPE == 1
	vb0 = ResourceJu_Fufu_Body_Position
	draw = 35688,0
endif
$active = 1
[TextureOverrideJu_Fufu_Tail_Blend.LOD2]
hash = 4111e21b
handling = skip
vb2 = ResourceJu_Fufu_Tail_Blend
if DRAW_TYPE == 1
	vb0 = ResourceJu_Fufu_Tail_Position
	draw = 1423,0
endif
$active = 1
[TextureOverrideJu_Fufu_Tail_Texcoord.LOD2]
hash = a975e319
vb1 = ResourceJu_Fufu_Tail_Texcoord

[TextureOverrideJufufubodyA.LOD2]
hash = 9d3ffb83
match_first_index = 0
handling = skip
run = CommandListBodyIB
[TextureOverrideJu_Fufu_Tail_A.LOD2]
hash = 3ea0f780
match_first_index = 0
handling = skip
ib = ResourceJu_Fufu_Tail_AIB
if $tail
	drawindexed = 3036, 0, 0
endif

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

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

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

[CommandListResetMenuPos]
$mx = 50 / $ww
$my = 0.5 - 360 / $wh
$BoobsSize = 0
$TargetBoobsSize = 0
$ButtSize = 0
$TargetButtSize = 0
$ThighsSize = 0
$TargetThighsSize = 0
$AnimSpeed = 0.3
$TargetAnimSpeed = 0.3
run = CustomShaderComputeShapes

[CommandListMoveMenu]
$mms = $mms + (0.00025 * ($mms < 0.01))
if $menu_d == 1
  $my = $my - $mms
elif $menu_d == 2
  $my = $my + $mms
elif $menu_d == 3
  $mx = $mx - $mms
elif $menu_d == 4
  $mx = $mx + $mms
endif

if $mx < 0
  $mx = 0
elif $mx + 360 / $ww > 1
  $mx = 1 - 360 / $ww
endif

if $my < 0
  $my = 0
elif $my + 560 / $wh > 1
  $my = 1 - 560 / $wh
endif

[CommandListMoveMenu.UP]
$menu_d = 1
post $menu_d = 0
post $mms = 0

[CommandListMoveMenu.DOWN]
$menu_d = 2
post $menu_d = 0
post $mms = 0

[CommandListMoveMenu.LEFT]
$menu_d = 3
post $menu_d = 0
post $mms = 0

[CommandListMoveMenu.RIGHT]
$menu_d = 4
post $menu_d = 0
post $mms = 0

[CommandListNavigateMenu]
$navSpeed = $navSpeed + 0.085
if $navSpeed > 2
  $targetSelectedSlot = ($targetSelectedSlot + ($navDirection * $dt * 6))
  $selectedSlot = $targetSelectedSlot // 1
else
  $targetSelectedSlot = $selectedSlot
endif
if $page == 0
  if $navDirection == -1
    if $selectedSlot == 0
      $selectedSlot = -2
      $targetSelectedSlot = -1
    elif $selectedSlot == -3
      $selectedSlot = 8
      $targetSelectedSlot = 9
    endif
  elif $navDirection == 1
    if $selectedSlot == 9
      $selectedSlot = -1
      $targetSelectedSlot = -1
    elif $selectedSlot == 0
      $selectedSlot = 1
      $targetSelectedSlot = 1
    endif
  endif
else
  if $navDirection == -1
    if $selectedSlot == 0
      $selectedSlot = -2
      $targetSelectedSlot = -1
    elif $selectedSlot == -3
      $selectedSlot = 4
      $targetSelectedSlot = 5
    endif
  elif $navDirection == 1
    if $selectedSlot == 5
      $selectedSlot = -1
      $targetSelectedSlot = -1
    elif $selectedSlot == 0
      $selectedSlot = 1
      $targetSelectedSlot = 1
    endif
  endif
endif

[CommandListNavigateMenu.MoveSliderCursor]
$navSpeed = $navSpeed + (0.02 * $dt * ($navSpeed < 0.02))

if $selectedSlot == 1
  $BoobsSize = $BoobsSize + $navSpeed * $navDirection
  if $BoobsSize < 0
    $BoobsSize = 0
  elif $BoobsSize > 1
    $BoobsSize = 1
  endif
  $TargetBoobsSize = $BoobsSize
elif $selectedSlot == 2
  $ButtSize = $ButtSize + $navSpeed * $navDirection
  if $ButtSize < 0
    $ButtSize = 0
  elif $ButtSize > 1
    $ButtSize = 1
  endif
  $TargetButtSize = $ButtSize
elif $selectedSlot == 3
  $ThighsSize = $ThighsSize + $navSpeed * $navDirection
  if $ThighsSize < 0
    $ThighsSize = 0
  elif $ThighsSize > 1
    $ThighsSize = 1
  endif
  $TargetThighsSize = $ThighsSize
elif $selectedSlot == 4
  $AnimSpeed = $AnimSpeed + $navSpeed * $navDirection
  if $AnimSpeed < 0
    $AnimSpeed = 0
  elif $AnimSpeed > 1
    $AnimSpeed = 1
  endif
  $TargetAnimSpeed = $AnimSpeed
endif
run = CustomShaderComputeShapes

[CommandListNavigateMenu.FORWARD]
$navDirection = 1
$navigating = 1
$selectedSlot = $selectedSlot + 1
run = CommandListNavigateMenu
post $navDirection = 0
post $navigating = 0
post $navSpeed = 0
post $selectedSlot = $selectedSlot // 1
post $targetSelectedSlot = $selectedSlot

[CommandListNavigateMenu.BACKWARDS]
$navDirection = -1
$navigating = 1
$selectedSlot = $selectedSlot - 1
run = CommandListNavigateMenu
post $navDirection = 0
post $navigating = 0
post $navSpeed = 0
post $selectedSlot = $selectedSlot // 1
post $targetSelectedSlot = $selectedSlot

[CommandListNavigateMenu.Press.LEFT]
if $page == 1
  if $selectedSlot > 0 && $selectedSlot < 7
    $navigating = 2
    $navDirection = -1
    post $navigating = 0
    post $navDirection = 0
    post $navSpeed = 0
    run = CommandListNavigateMenu.MoveSliderCursor
  else
    run = CommandListClickedSlot
  endif
  
else
  run = CommandListClickedSlot
endif

[CommandListNavigateMenu.Press.RIGHT]
if $page == 1
  if $selectedSlot > 0 && $selectedSlot < 7
    $navigating = 2
    $navDirection = 1
    post $navigating = 0
    post $navDirection = 0
    post $navSpeed = 0
    run = CommandListNavigateMenu.MoveSliderCursor
  else
    run = CommandListClickedSlot
  endif
else
  run = CommandListClickedSlot
endif

[CommandListClickedSlot]
$clickedSlot = $hoveredSlot
if $clickedSlot == 1
	$arms = 1 - $arms
elif $clickedSlot == 2
	$top = 1 - $top
elif $clickedSlot == 3
	$gloves = 1 - $gloves
elif $clickedSlot == 4
	$panties = 1 - $panties
	run = CustomShaderComputeShapes
elif $clickedSlot == 5
	$tail = 1 - $tail
elif $clickedSlot == 6
	$shoes = 1 - $shoes
elif $clickedSlot == 7
	$liquid = 1 - $liquid
elif $clickedSlot == 8
	$dildo = $dildo + 1
	if $dildo > 6
		$dildo = 0
	endif
	run = CustomShaderComputeShapes
elif $clickedSlot == -2 || $clickedSlot == -1
  $page = 1 - $page
endif

[CommandListSlotItemImage]
x87 = 52 / $ww 
y87 = 52 / $wh
z87 = z87 + 6 / $ww
w87 = w87 + 12 / $ww
if $slot == 1
    ps-t100 = ResourceMenuItem.1
    run = CustomShaderElement
elif $slot == 2
    ps-t100 = ResourceMenuItem.2
    run = CustomShaderElement
elif $slot == 3
    ps-t100 = ResourceMenuItem.3
    run = CustomShaderElement
elif $slot == 4
    ps-t100 = ResourceMenuItem.4
    run = CustomShaderElement
elif $slot == 5
    ps-t100 = ResourceMenuItem.5
    run = CustomShaderElement
elif $slot == 6
    ps-t100 = ResourceMenuItem.6
    run = CustomShaderElement
elif $slot == 7
    ps-t100 = ResourceMenuItem.7
    run = CustomShaderElement
elif $slot == 8
    if $dildo == 4 || $dildo == 5 || $dildo == 6
      ps-t100 = ResourceMenuItem.plug.active
    else
      ps-t100 = ResourceMenuItem.plug
    endif
    run = CustomShaderElement
endif

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

[CommandListOutfitMenu]
local $bak_x87 = x87
local $bak_y87 = y87
local $bak_z87 = z87
local $bak_w87 = w87
local $bak_y88 = y88
run = CommandListDimensions
run = CommandListBackground
post x87 = $bak_x87
post y87 = $bak_y87
post z87 = $bak_z87
post w87 = $bak_w87
post y88 = $bak_y88
if $navigating == 1
  run = CommandListNavigateMenu
elif $navigating == 2
  run = CommandListNavigateMenu.MoveSliderCursor
endif
if $menu_d > 0
  run = CommandListMoveMenu
endif

[CommandListBackground]
local $cox
local $coy
ps-t100 = ResourceMenuBG
y87 = 560 / $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
if $page == 0
  run = CommandListDrawToggles
else
  run = CommandListDrawAnimControls
endif
run = CommandListDrawArrows

[CommandListDrawArrows]
$slot = -2
x87 = -48 / $ww
y87 = 48 / $wh
z87 = $mx - 5 / $ww
w87 = $my + 240 / $wh
if $cpx < z87 && $cpx > (z87+x87-0.0035) && $cpy > w87 && $cpy < (w87+y87-0.0035)
    ps-t100 = ResourceArrowHover
    $hovering = 1
    $hoveredSlot = $slot
    $selectedSlot = 0
else
  if $slot == $selectedSlot // 1
    $hoveredSlot = $slot
    ps-t100 = ResourceArrowHover
  else
    ps-t100 = ResourceArrow
  endif
endif
run = CustomShaderElement

$slot = -1
x87 = 48 / $ww
z87 = z87 + 365 / $ww
if $cpx > z87 && $cpx < (z87+x87-0.0035) && $cpy > w87 && $cpy < (w87+y87-0.0035)
    ps-t100 = ResourceArrowHover
    $hovering = 1
    $hoveredSlot = $slot
    $selectedSlot = 0
else
  if $slot == $selectedSlot // 1
    $hoveredSlot = $slot
    ps-t100 = ResourceArrowHover
  else
    ps-t100 = ResourceArrow
  endif
endif
run = CustomShaderElement

[CommandListDrawToggles]
local $z0 = z87 + 23 / $ww
local $z1 = $z0 + 125 / $ww
local $z2 = $z0 + 250 / $ww
local $wo = 84 / $wh
$hovering = 0
$slot = 0
x87 = 64 / $ww 
y87 = 64 / $wh
z87 = $z0 
w87 = w87 + 60 / $wh
run = CommandListSlot
z87 = $z1
run = CommandListSlot
z87 = $z2
run = CommandListSlot

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

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

z87 = $z1
w87 = w87 + $wo
run = CommandListSlot
z87 = $z2
w87 = w87 + $wo
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.1
    $hovering = 1
    $hoveredSlot = $slot
    $selectedSlot = 0
else
    if $slot == $selectedSlot // 1
      $hoveredSlot = $slot
      ps-t100 = ResourceItemSlotHover.1
    else
      ps-t100 = ResourceItemSlot
    endif
endif
run = CustomShaderElement
if $clickedSlot == $slot
    ps-t100 = ResourceItemSlotHover.2
    run = CustomShaderElement
    $clickedSlot = 0
endif

[CommandListDrawAnimControls]
local $z0 = z87 + 23 / $ww
local $wo = 84 / $wh
$hovering = 0
$slot = 0
x87 = 52 / $ww 
y87 = 52 / $wh
z87 = $z0
w87 = w87 + 60 / $wh
ps-t100 = ResourceItemBoobs
run = CustomShaderElement
z87 = $z0 + 80 / $ww
w87 = w87 + 25 / $wh
run = CommandListDrawSlider.Boobs

x87 = 52 / $ww 
y87 = 52 / $wh
z87 = $z0
w87 = w87 + 60 / $wh
ps-t100 = ResourceItemButt
run = CustomShaderElement
z87 = $z0 + 80 / $ww
w87 = w87 + 25 / $wh
run = CommandListDrawSlider.Butt

x87 = 52 / $ww 
y87 = 52 / $wh
z87 = $z0
w87 = w87 + 60 / $wh
ps-t100 = ResourceItemThighs
run = CustomShaderElement
z87 = $z0 + 80 / $ww
w87 = w87 + 25 / $wh
run = CommandListDrawSlider.Thighs

x87 = 52 / $ww 
y87 = 52 / $wh
z87 = $z0
w87 = w87 + 60 / $wh
if $dildo < 2
  ps-t100 = ResourceMenuItem.plug
else
  ps-t100 = ResourceMenuItem.plug.active
endif
run = CustomShaderElement
z87 = $z0 + 80 / $ww
w87 = w87 + 25 / $wh
run = CommandListDrawSlider.Anim

[CommandListDrawSlider.Boobs]
ps-t100 = ResourceSlider
x87 = 230 / $ww
y87 = 4 / $wh
run = CustomShaderElement
ps-t100 = ResourceSliderPink
x87 = $BoobsSize * x87
run = CustomShaderElement
x87 = 230 / $ww
run = CommandListCursor.Boobs

[CommandListInterpolateSpeed.Boobs]
local $td = 0.033
local $ds = ($TargetBoobsSize - $BoobsSize) / $td
$BoobsSize = $BoobsSize + $ds * $dt

[CommandListCursor.Boobs]
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
  $TargetBoobsSize = (($cpx-$x)/($xo-$x))
  if $TargetBoobsSize < 0
    $TargetBoobsSize = 0
  elif $TargetBoobsSize > 1
    $TargetBoobsSize = 1
  endif
endif
z87 = (z87 + x87 * ($BoobsSize) - 14 / $ww)
run = CommandListInterpolateSpeed.Boobs
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

[CommandListDrawSlider.Butt]
ps-t100 = ResourceSlider
x87 = 230 / $ww
y87 = 4 / $wh
run = CustomShaderElement
ps-t100 = ResourceSliderPink
x87 = $ButtSize * x87
run = CustomShaderElement
x87 = 230 / $ww
run = CommandListCursor.Butt

[CommandListInterpolateSpeed.Butt]
local $td = 0.033
local $ds = ($TargetButtSize - $ButtSize) / $td
$ButtSize = $ButtSize + $ds * $dt

[CommandListCursor.Butt]
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 = 3
        $selectedSlot = 0
    endif
endif
if $holdShape == 3
  $TargetButtSize = (($cpx-$x)/($xo-$x))
  if $TargetButtSize < 0
    $TargetButtSize = 0
  elif $TargetButtSize > 1
    $TargetButtSize = 1
  endif
endif
z87 = (z87 + x87 * ($ButtSize) - 14 / $ww)
run = CommandListInterpolateSpeed.Butt
if $hovering == 3 || $selectedSlot == 2 || $holdShape == 3
  ps-t100 = ResourceButtonHover
else
  ps-t100 = ResourceButton
endif
x87 = 32 / $ww
y87 = 32 / $wh
w87 = w87 - 13 / $wh
run = CustomShaderElement

[CommandListDrawSlider.Thighs]
ps-t100 = ResourceSlider
x87 = 230 / $ww
y87 = 4 / $wh
run = CustomShaderElement
ps-t100 = ResourceSliderPink
x87 = $ThighsSize * x87
run = CustomShaderElement
x87 = 230 / $ww
run = CommandListCursor.Thighs

[CommandListInterpolateSpeed.Thighs]
local $td = 0.033
local $ds = ($TargetThighsSize - $ThighsSize) / $td
$ThighsSize = $ThighsSize + $ds * $dt

[CommandListCursor.Thighs]
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 = 4
        $selectedSlot = 0
    endif
endif
if $holdShape == 4
  $TargetThighsSize = (($cpx-$x)/($xo-$x))
  if $TargetThighsSize < 0
    $TargetThighsSize = 0
  elif $TargetThighsSize > 1
    $TargetThighsSize = 1
  endif
endif
z87 = (z87 + x87 * ($ThighsSize) - 14 / $ww)
run = CommandListInterpolateSpeed.Thighs
if $hovering == 4 || $selectedSlot == 3 || $holdShape == 4
  ps-t100 = ResourceButtonHover
else
  ps-t100 = ResourceButton
endif
x87 = 32 / $ww
y87 = 32 / $wh
w87 = w87 - 13 / $wh
run = CustomShaderElement

[CommandListDrawSlider.Anim]
ps-t100 = ResourceSlider
x87 = 230 / $ww
y87 = 4 / $wh
run = CustomShaderElement
ps-t100 = ResourceSliderPink
x87 = $AnimSpeed * x87
run = CustomShaderElement
x87 = 230 / $ww
run = CommandListCursor.Anim

[CommandListInterpolateSpeed.Anim]
local $td = 0.033
local $ds = ($TargetAnimSpeed - $AnimSpeed) / $td
$AnimSpeed = $AnimSpeed + $ds * $dt

[CommandListCursor.Anim]
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 = 5
        $selectedSlot = 0
    endif
endif
if $holdShape == 5
  $TargetAnimSpeed = (($cpx-$x)/($xo-$x))
  if $TargetAnimSpeed < 0
    $TargetAnimSpeed = 0
  elif $TargetAnimSpeed > 1
    $TargetAnimSpeed = 1
  endif
endif
z87 = (z87 + x87 * ($AnimSpeed) - 14 / $ww)
run = CommandListInterpolateSpeed.Anim
if $hovering == 5 || $selectedSlot == 4 || $holdShape == 5
  ps-t100 = ResourceButtonHover
else
  ps-t100 = ResourceButton
endif
x87 = 32 / $ww
y87 = 32 / $wh
w87 = w87 - 13 / $wh
run = CustomShaderElement

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

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

[ResourceJu_Fufu_Body_Position]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.buf

[ResourceJu_Fufu_Body_Position.B]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.B.buf

[ResourceJu_Fufu_Body_Position.BOOBS]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.BOOBS.buf

[ResourceJu_Fufu_Body_Position.BUTT]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.BUTT.buf

[ResourceJu_Fufu_Body_Position.THIGHS]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.THIGHS.buf

[ResourceJu_Fufu_Body_Position.BUTTANIM]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.BUTTANIM.buf

[ResourceJu_Fufu_Body_Position.BUTTGAPE]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.BUTTGAPE.buf

[ResourceJu_Fufu_Body_Position.VAGANIM]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.VAGANIM.buf

[ResourceJu_Fufu_Body_Position.VAGGAPE]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.VAGGAPE.buf

[ResourceJu_Fufu_Body_Position.ANIMCORR]
type = Buffer
stride = 40
filename = Ju_Fufu_Body_Position.ANIMCORR.buf

[ResourceJu_Fufu_Body_Blend]
type = Buffer
stride = 32
filename = Ju_Fufu_Body_Blend.buf

[ResourceJu_Fufu_Body_Texcoord]
type = Buffer
stride = 20
filename = Ju_Fufu_Body_Texcoord.buf

[ResourceJu_Fufu_Body_AIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = Ju_Fufu_Body_A.ib

[ResourceJu_Fufu_Body_ADiffuse]
filename = Ju_Fufu_Body_ADiffuse.dds

[ResourceJu_Fufu_Body_ANormalMap]
filename = Ju_Fufu_Body_ANormalMap.dds

[ResourceJu_Fufu_Body_ALightMap]
filename = Ju_Fufu_Body_ALightMap.dds

[ResourceJu_Fufu_Body_AMaterialMap]
filename = Ju_Fufu_Body_AMaterialMap.dds

[ResourceJu_Fufu_Tail_Position]
type = Buffer
stride = 40
filename = Ju_Fufu_Tail_Position.buf

[ResourceJu_Fufu_Tail_Blend]
type = Buffer
stride = 32
filename = Ju_Fufu_Tail_Blend.buf

[ResourceJu_Fufu_Tail_Texcoord]
type = Buffer
stride = 20
filename = Ju_Fufu_Tail_Texcoord.buf

[ResourceJu_Fufu_Tail_AIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = Ju_Fufu_Tail_A.ib

; ==========================================

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

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

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

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

[ResourceMenuItem.1]
filename =.\res\item_arm.dds

[ResourceMenuItem.2]
filename =.\res\item_top.dds

[ResourceMenuItem.3]
filename =.\res\item_gloves.dds

[ResourceMenuItem.4]
filename =.\res\item_panties.dds

[ResourceMenuItem.5]
filename =.\res\item_tail.dds

[ResourceMenuItem.6]
filename =.\res\item_shoes.dds

[ResourceMenuItem.7]
filename =.\res\item_liquid.dds

[ResourceMenuItem.lock]
filename = .\res\item_lock.dds

[ResourceMenuItem.plug]
filename =.\res\item_plug.dds

[ResourceMenuItem.plug.active]
filename =.\res\item_plug_active.dds

[ResourceArrow]
filename = .\res\Menu_Arrow.dds

[ResourceArrowHover]
filename = .\res\Menu_Arrow_Hover.dds

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

[ResourceSliderPink]
filename = .\res\Slider_pink.dds

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

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

[ResourceItemBoobs]
filename = .\res\item_boobs.dds

[ResourceItemButt]
filename = .\res\item_butt.dds

[ResourceItemThighs]
filename = .\res\item_thighs.dds