code:
;-------------------------------------------------
;カテゴリータイトル
;　ARGS:0=表示するテキスト（全角３文字まで）
;-------------------------------------------------
@SMALL_TITLE(ARGS:0, ARG:1 = -1)
#DIM ARGSLEN
ARGSLEN = STRLENS(ARGS:0)
SETCOLOR カラー_シルバー
;テキスト表示に半角4マス
;左右に2スペースで総半角8マス
PRINTFORM %TOSTR_SPACE(LIMIT(6 - ARGSLEN, 0, 2))%
IF ARG:1 == -1
	PRINTFORM %ARGS:0, MAX(ARGSLEN, 4), LEFT%
ELSE
	PRINTBUTTON @"%ARGS:0, MAX(ARGSLEN, 4), LEFT%", ARG:1
ENDIF
PRINTFORM %TOSTR_SPACE(2 - ABS(MIN(6 - ARGSLEN, 0)))%
RESETCOLOR
RETURN

;-------------------------------------------------
;カテゴリータイトルに対応するインデント
;　ARG:0=1　ABLやEXPなどの間に入れるスペース
;-------------------------------------------------
@SMALL_TITLE_SPACE(ARG:0)
#FUNCTIONS
IF ARG:0 == 1
	PRINTFORM %TOSTR_SPACE(4)%
ELSE
	PRINTFORM %TOSTR_SPACE(8)%
ENDIF
RETURNF

;-------------------------------------------------
;グラデーションバー（三角矢印型・好みのユニコードに変えてください）
;　GBAR_NOW			現在値　BASE:(ARG:0):気力など
;　GBAR_MAX			最大値　MAXBASE:(ARG:0):気力など
;　GBAR_MAX_SQUARE	バーの幅（ユニコードの個数）
;　GBAR_ONCOLOR		オンの色（グラデーションは自動的にかける）
;　GBAR_OFFCOLOR	オフの色・指定不要（オフの色はそのまま表示・デフォルトで0x222222）
;　GBAR_ANGLE		色相をどちらの角度に動かすか・指定不要（0=プラス 1=マイナス デフォルト0）
;					そのままでは自然な色相にならないとき用
;-------------------------------------------------
@PRINT_GRADATIONBAR(GBAR_NOW, GBAR_MAX, GBAR_MAX_SQUARE, GBAR_ONCOLOR, GBAR_OFFCOLOR, GBAR_ANGLE)
#DIM GBAR_NOW
#DIM GBAR_MAX
#DIM GBAR_MIN
#DIM GBAR_MAX_SQUARE
#DIM GBAR_ONCOLOR
#DIM GBAR_OFFCOLOR
#DIM GBAR_ANGLE
#DIM GBAR_H
#DIM GBAR_S
#DIM GBAR_V
#DIM GBAR_ONE_SQUARE
#DIM GBAR_NOW_SQUARE

;バーの初期値調整
;最小値はデフォルトで０
GBAR_MIN = 0
GBAR_ONE_SQUARE = 0
GBAR_NOW_SQUARE = 0

IF !GBAR_OFFCOLOR
	GBAR_OFFCOLOR = 0x222222
ENDIF

;カラー初期値調整
GBAR_H = RGB_TO_H(GBAR_ONCOLOR) - (GBAR_MAX_SQUARE / 2)
GBAR_S = RGB_TO_S(GBAR_ONCOLOR) - GBAR_MAX_SQUARE * 2
GBAR_V = RGB_TO_V(GBAR_ONCOLOR)
IF GBAR_H <= 3
	GBAR_H = 359
ENDIF
IF GBAR_S <= 10
	GBAR_S = 10
ENDIF
IF GBAR_V >= 80
	GBAR_V = 80
ENDIF

;もしバーのGBAR_MAX（最大値）がBAR_MAX_SQUARE（バー幅・ユニコード個数）より小さいなら
IF GBAR_MAX < GBAR_MAX_SQUARE
	;最大値はユニコード個数で上書き
	GBAR_MAX = GBAR_MAX_SQUARE
ENDIF

;GBAR_ONE_SQUARE（ひとつのマスに色をつけるにつき、数値いくつ分増えたとみなすのか）を求める
GBAR_ONE_SQUARE = GBAR_MAX / GBAR_MAX_SQUARE

;１未満になってしまうなら１
IF GBAR_ONE_SQUARE < 1
	GBAR_ONE_SQUARE = 1
ENDIF

;GBAR_NOW（現在値）は何マス分かを求める
GBAR_NOW_SQUARE = GBAR_NOW / GBAR_ONE_SQUARE

;もし現在値が１未満なら０
IF GBAR_NOW_SQUARE < 1
	GBAR_NOW_SQUARE = 0
ENDIF

;GBAR_MAX_SQUARE（バーの幅・ユニコード個数）まで繰り返し
FOR LOCAL:0, 0, GBAR_MAX_SQUARE
	;GBAR_NOW_SQUARE（現在値のマス数）以下ならオンカラー（色付け）
	IF LOCAL:0 < GBAR_NOW_SQUARE
		SETCOLOR HSV_TO_RGB(LIMIT(GBAR_H, 0, 359), LIMIT(GBAR_S, 0, 100), LIMIT(GBAR_V, 0, 100))
		PRINTFORM %UNICODE(0x25B6)%
		;マスを表示するたびに色相・彩度・輝度を動かしてグラデーションをかける
		IF GBAR_ANGLE
			GBAR_H -= 3
			GBAR_V -= 2
			GBAR_S += 2
			IF GBAR_H <= 2
				GBAR_H = 359
			ENDIF
			IF GBAR_S >= 100
				GBAR_S = 100
			ENDIF
		ELSE
			GBAR_H += 3
			GBAR_V -= 2
			GBAR_S += 2
			IF GBAR_H >= 358
				GBAR_H = 1
			ENDIF
			IF GBAR_S >= 100
				GBAR_S = 100
			ENDIF
		ENDIF
		;GBAR_NOW_SQUARE（現在値のマス数）以上ならオフカラー（グレー）
	ELSE
		SETCOLOR GBAR_OFFCOLOR
		PRINTFORM %UNICODE(0x25B6)%
	ENDIF
NEXT
RESETCOLOR

RETURN 0

;-------------------------------------------------
;向かい合う矢印を表示するバー　グラデーションはしない
;GBAR_LEFT 左側矢印に用いる数値
;GBAR_RIGHT 右側矢印に用いる数値
;GBAR_MAX_SQUARE 合計の矢印数
;GBAR_LEFT/RIGHTCOLOR それぞれ矢印に用いる色
;-------------------------------------------------
@PRINT_VERSUSBAR(GBAR_LEFT, GBAR_RIGHT, GBAR_MAX_SQUARE, GBAR_LEFTCOLOR, GBAR_RIGHTCOLOR)
#DIM GBAR_LEFT
#DIM GBAR_RIGHT
#DIM GBAR_LEFT_SQUARE
#DIM GBAR_MAX_SQUARE
#DIM GBAR_LEFTCOLOR
#DIM GBAR_RIGHTCOLOR
#DIM GBAR_ONE_SQUARE

;両方ゼロならともに最大に
IF ALLSAMES(0, GBAR_LEFT, GBAR_RIGHT)
	GBAR_LEFT = GBAR_MAX_SQUARE
	GBAR_RIGHT = GBAR_MAX_SQUARE
ENDIF

;もし左右の値の合計が三角形合計より小さければ、GBAR_MAX_SQUAREをかけることで無理やりええかんじにする
IF GBAR_LEFT + GBAR_RIGHT < GBAR_MAX_SQUARE
	GBAR_LEFT = GBAR_LEFT * GBAR_MAX_SQUARE
	GBAR_RIGHT = GBAR_RIGHT * GBAR_MAX_SQUARE
ENDIF

;GBAR_ONE_SQUARE（ひとつのマスに色をつけるにつき、数値いくつ分増えたとみなすのか）を求める
GBAR_ONE_SQUARE = (GBAR_LEFT + GBAR_RIGHT) / GBAR_MAX_SQUARE

;１未満になってしまうなら１
IF GBAR_ONE_SQUARE < 1
	GBAR_ONE_SQUARE = 1
ENDIF

;GBAR_LEFT（現在値）は何マス分かを求める
GBAR_LEFT_SQUARE = GBAR_LEFT / GBAR_ONE_SQUARE

;もし現在値が１未満なら０
IF GBAR_LEFT_SQUARE < 1
	GBAR_LEFT_SQUARE = 0
ENDIF

;GBAR_MAX_SQUARE（バーの幅・ユニコード個数）まで繰り返し
FOR LOCAL:0, 0, GBAR_MAX_SQUARE
	;GBAR_NOW_SQUARE（現在値のマス数）以下ならオンカラー（色付け）
	IF LOCAL:0 < GBAR_LEFT_SQUARE
		SETCOLOR GBAR_LEFTCOLOR
		PRINTFORM %UNICODE(0x25B6)%
	ELSE
		SETCOLOR GBAR_RIGHTCOLOR
		PRINTFORM %UNICODE(0x25C0)%
	ENDIF
NEXT
RESETCOLOR

RETURN 0

;-------------------------------------------------
;ARG:0番のキャラの性別情報を表示（右詰め）
;ARG:1が真なら一文字表示
;ARG:2は詰め方向(FALSE = 左, TRUE = 右)
;ARG:3は詰め字数
;-------------------------------------------------
@PRINT_SEX(ARG:0, ARG:1 = 0, ARG:2 = 0, ARG:3 = 0)
LOCAL:0 = GETCOLOR()

SELECTCASE TALENT:(ARG:0):性別
	CASE 1
		SETCOLOR カラー_女
		IF IS_ANIMAL(ARG:0)
			LOCALS:1 = \@(!ARG:1) ? メス # 雌\@
		ELSE
			LOCALS:1 = \@(!ARG:1) ? 女性 # 女\@
		ENDIF
	CASE 0
		SETCOLOR カラー_男
		IF IS_ANIMAL(ARG:0)
			LOCALS:1 = \@(!ARG:1) ? オス # 雄\@
		ELSE
			LOCALS:1 = \@(!ARG:1) ? 男性 # 男\@
		ENDIF
	CASE 2
		SETCOLOR カラー_女双
		LOCALS:1 = \@(!ARG:1) ? 女性(双) # 双\@
	CASE 3
		SETCOLOR カラー_男双
		LOCALS:1 = \@(!ARG:1) ? 男性(双) # 双\@
	CASE 4
		SETCOLOR カラー_男の娘
		LOCALS:1 = \@(!ARG:1) ? 男の娘 # 男\@
	CASE 5
		SETCOLOR カラー_男の娘双
		LOCALS:1 = \@(!ARG:1) ? 男娘(双) # 双\@
	CASEELSE
		SETCOLOR カラー_性別不明
		LOCALS:1 = \@(!ARG:1) ? 不明 # ？\@
ENDSELECT

CALL SETCOLORBYSEX(ARG:0)
IF !ARG:2
	PRINTFORM %LOCALS:1, ARG:3, LEFT%
ELSE
	PRINTFORM %LOCALS:1, ARG:3, RIGHT%
ENDIF

SETCOLOR LOCAL:0

;-------------------------------------------------
;ARG:0番のキャラの性別情報を返却
;------------------------------------------------
@GET_STR_SEX(ARG:0, ARG:1 = 0)
#DIM F_COL

SELECTCASE TALENT:(ARG:0):性別
	CASE 1
		F_COL = カラー_女
		IF IS_ANIMAL(ARG:0)
			LOCALS:1 = \@(!ARG:1) ? メス # 雌\@
		ELSE
			LOCALS:1 = \@(!ARG:1) ? 女性 # 女\@
		ENDIF
	CASE 0
		F_COL = カラー_男
		IF IS_ANIMAL(ARG:0)
			LOCALS:1 = \@(!ARG:1) ? オス # 雄\@
		ELSE
			LOCALS:1 = \@(!ARG:1) ? 男性 # 男\@
		ENDIF
	CASE 2
		F_COL = カラー_女双
		LOCALS:1 = \@(!ARG:1) ? 女性(双) # 双\@
	CASE 3
		F_COL = カラー_男双
		LOCALS:1 = \@(!ARG:1) ? 男性(双) # 双\@
	CASE 4
		F_COL = カラー_男の娘
		LOCALS:1 = \@(!ARG:1) ? 男の娘 # 男\@
	CASE 5
		F_COL = カラー_男の娘双
		LOCALS:1 = \@(!ARG:1) ? 男娘(双) # 双\@
	CASEELSE
		F_COL = カラー_性別不明
		LOCALS:1 = \@(!ARG:1) ? 不明 # ？\@
ENDSELECT

;非省略表示のときのみ、ＴＳ経験がある場合は元性別の表記を追加
IF TS_IS_O(ARG:0) && ARG:1 == 0
	LOCALS:1 += " / "
	IF TS_IS_O(ARG:0, 1)
		SELECTCASE TALENT:(ARG:0):元性別
			CASE 11
				IF IS_ANIMAL(ARG:0)
					LOCALS:1 += "元メス"
				ELSE
					LOCALS:1 += "元女性"
				ENDIF
			CASE 10
				IF IS_ANIMAL(ARG:0)
					LOCALS:1 += "元オス"
				ELSE
					LOCALS:1 += "元男性"
				ENDIF
			CASE 12
				LOCALS:1 += "元女性(双)"
			CASE 13
				LOCALS:1 += "元男性(双)"
			CASE 14
				LOCALS:1 += "元男の娘"
			CASE 15
				LOCALS:1 += "元男娘(双)"
			CASEELSE
				LOCALS:1 += "元性別不明"
		ENDSELECT
	ELSE
		SELECTCASE TALENT:(ARG:0):元性別
			CASE 10, 11, 14
				LOCALS:1 += "ふたなり化"
			CASE 12, 13, 15
				LOCALS:1 += "元ふたなり"
			CASEELSE
				LOCALS:1 += "元性別不明"
		ENDSELECT
	ENDIF
ENDIF

RESULTS '= @"@C:{F_COL}@%LOCALS:1%@/C@"
RESULTS:1 '= @"%LOCALS:1%"

RETURN


code:
;-------------------------------------------------
; ARG:0番のキャラの口上編集オプション
;-------------------------------------------------
@SHOW_CHARACTER_KOJO_EDIT_MENU(ARG:0)
#DIM FIRST_LINE
#DIM KOJO_NO
#DIM ITER_I
#DIM ITER_J
#DIM パーツ分類
#DIM パーツ番号
FIRST_LINE = LINECOUNT

DRAWLINE
PRINTFORML %ANAME(ARG:0)%口上編集
DRAWLINE

;口上
CALL SINGLE_DRAWLINE("―", カラー_選択不可)
RESETCOLOR
IF !IS_UNIQUE_CHARA(ARG) || ARG == MASTER
	CALLF TAG_PRINT(@"@S:1@<口上>@/C@", 1)
	PRINTL
	IF ARG != MASTER
		FOR KOJO_NO, 1001, 2000
			TRYCCALLFORM KOJO_DEFINE_NAME_K{KOJO_NO}
				LOCALS '= @"　@C:{CFLAG:(ARG:0):汎用口上パターン == KOJO_NO ? カラー_選択中 # カラー_白}@@B:{10000 + KOJO_NO}@[%RESULTS%]@/B@@/C@"
				CALLF TAG_PRINT(@"%LOCALS%", 4)
				SIF (KOJO_NO - 1000) % 5 == 0
					PRINTL
			CATCH
			ENDCATCH
		NEXT
	ELSE
		FOR KOJO_NO, 5000, 6000
			TRYCALLFORM KOJO_DEFINE_K{KOJO_NO}_IS_MASTER_KOJO
			IF !RESULT
				CONTINUE
			ENDIF
			TRYCCALLFORM KOJO_DEFINE_NAME_K{KOJO_NO}
				LOCALS '= @"　@C:{CFLAG:(ARG:0):汎用口上パターン == KOJO_NO ? カラー_選択中 # カラー_白}@@B:{10000 + KOJO_NO}@[%RESULTS%]@/B@@/C@"
				CALLF TAG_PRINT(@"%LOCALS%", 4)
				SIF (KOJO_NO - 1000) % 5 == 0
					PRINTL
			CATCH
			ENDCATCH
		NEXT
	ENDIF
	PRINTL
	PRINTL
	CALLF TAG_PRINT(@"@B:10000@[口上を使用しない]@/B@", 5)
	PRINTL
	PRINTFORML
ENDIF
CALLF TAG_PRINT(@"@S:1@<口上設定色>@/C@")
CALLF TAG_PRINT(@"　(現在の設定色:@C:{CFLAG:(ARG:0):口上カラーコード}@%UNICODE(0x2588) * 6%@/C@)", 5)
PRINTL
CALLF TAG_PRINT(@"@B:20000@[口上色を変更する]@/B@　@B:20001@[髪色から自動設定する]@/B@", 5)
PRINTL
;ポートレイト表示
CALL DRAW_PORTRAIT((ARG:0), "[サイズ:200px][POS_Y:-200px][POS_X:6500]")
CALL SINGLE_DRAWLINE("―", カラー_選択不可)
PRINTL
PRINTBUTTON "[99] 完了", 99

REDRAW 1
ONEINPUT
CLEARLINE 1
PRINTL

IF RESULT == 99
	FLAG:能力表示モード = 0
	RETURN
ELSEIF INRANGE(RESULT, 10000, 16000)
	KOJO_NO = RESULT - 10000
	IF EXISTFUNCTION(@"KOJO_DEFINE_KOJO_INFO_K{KOJO_NO}")
		PRINTL
		DRAWLINE
		TRYCALLFORM KOJO_DEFINE_KOJO_INFO_K{KOJO_NO}(ARG:0)
		DRAWLINE
	ENDIF
	CALL ASK_YN("この口上を適用する", "変更しない")
	IF !RESULT
		CFLAG:(ARG:0):汎用口上パターン = KOJO_NO
		CALL COLOR_PRINTW(@"%ANAME(ARG:0)%の口上を変更しました", カラー_注意)
	ENDIF
ELSEIF INRANGE(RESULT, 20000, 20001)
	IF RESULT == 20000
		CALL COLOR_PICKER(CFLAG:(ARG:0):口上カラーコード)
		CFLAG:(ARG:0):口上カラーコード = RESULT
	ELSE
		CALL KOJO_SET_COLOR_FROM_HAIR_COLOR(ARG:0)
	ENDIF
ENDIF

REDRAW 0
CLEARLINE LINECOUNT - FIRST_LINE
RESTART

repo_name: pervysquirrelz/erafl

license: unknown


code:
;-------------------------------------------------
; ARG:0番のキャラの口上、ポートレイト編集オプション
;-------------------------------------------------
@SHOW_CHARACTER_PORTRAIT_EDIT_MENU(ARG:0, CALL_FROM = "PORTRAIT_EDIT")
#DIMS CALL_FROM
#DIM  DYNAMIC FIRST_LINE
#DIM  DYNAMIC KOJO_NO
#DIM  DYNAMIC ITER_I
#DIM  DYNAMIC ITER_J
#DIM  DYNAMIC パーツ分類
#DIM  DYNAMIC パーツ番号
#DIM  DYNAMIC COL
#DIM  DYNAMIC ROW
#DIM  CONST THUMB_SIZE = 75
#DIM  CONST MAX_COL_THUMB = 16
#DIMS DYNAMIC INPUT_VALUES
#DIM  DYNAMIC PRESET_IDX
#DIMS DIC_FACE_EXPRESSION = "[目:通常][眉:通常][口:通常]"
#DIMS CONST EXPRESSION_PARTS = "目", "眉", "口", "OVL_表情", "OVL_表情2", "OVL_表情3", "OVL_漫符", "OVL_漫符2"
#DIM EXPRESSION_PARTS_IDX, 8
#DIM DYNAMIC EXPRESSION_PARTS_NUM, 8
#DIMS DYNAMIC TEMP_ARRAY_EXPRESSION_PARTS, 100
#DIMS DYNAMIC LIST_OFFSET

FIRST_LINE = LINECOUNT
PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET

SIF PARTS_OFFSET_VALUE == 0
	PARTS_OFFSET_VALUE = 1

FOR LOCAL, 0, VARSIZE("EXPRESSION_PARTS")
	EXPRESSION_PARTS_NUM:LOCAL = VARSIZE(@"IMG_%EXPRESSION_PARTS:LOCAL%_パターン")
NEXT

CALL RESET_FACE_SPRITE(ARG:0)
CALL HO_SET_PORTRAIT_SPRITE(ARG:0)

IF CALL_FROM == "PORTRAIT_EDIT"
	CLOTH_DRAWER_SELECT_PRESET = 0
	PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET

	IF CSTR:(ARG:0):キャラ顔グラ == ""
		CSTR:(ARG:0):キャラ顔グラ '= "FACE_DUMMY"
	ENDIF

	DRAWLINE
	PRINTFORML %ANAME(ARG:0)%のポートレイト編集
	DRAWLINE

	;顔グラの編集
	IF !IS_UNIQUE_CHARA(ARG) || ARG:0 == MASTER
		CALLF TAG_PRINT(@"@S:1@<ポートレイト>@/S@", 1)
		PRINTFORM 表示の有無:
		CALL PRINT_SELECT_BUTTON(@"[表示しない] ", 3000, CSTR:(ARG:0):キャラ顔グラ == "FACE_DUMMY")
		CALL PRINT_SELECT_BUTTON(@"[表示する]", 3001, CSTR:(ARG:0):キャラ顔グラ != "FACE_DUMMY")
		PRINTL
		PRINTL
		CALLF TAG_PRINT(@"@S:1@<ポートレイトの表示タイプ>@/S@", 1)
		CALL PRINT_SELECT_BUTTON(@"[パーツ生成] ", 4000, CFLAG:(ARG:0):ポートレイト画像タイプ == 0)
		;CALL PRINT_SELECT_BUTTON(@"[表情差分] ", 4001, CFLAG:(ARG:0):ポートレイト画像タイプ == 1)
		;PRINTFORM [表情差分(未実装)]
		CALL PRINT_SELECT_BUTTON(@"[固定画像] ", 4002, CFLAG:(ARG:0):ポートレイト画像タイプ == 2)
	ENDIF
	PRINTL
	CALL DRAW_LINE()
ENDIF

IF CFLAG:(ARG:0):ポートレイト画像タイプ == 0 && CSTR:(ARG:0):キャラ顔グラ != "FACE_DUMMY"
	CALLF TAG_PRINT(@"@S:1@<編集パーツカテゴリ>@/S@", 1)
	IF (!IS_UNIQUE_CHARA(ARG:0) || ARG:0 == MASTER) && CALL_FROM == "PORTRAIT_EDIT"
		{
			LOCALS '= ""
				+ @"@C:{PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_顔 ? カラー_選択中 # カラー_白}@@B:[MODE:{PORTRAIT_EDIT_MODE_顔}]@[顔]　@/B@@/C@"
				+ @"@C:{PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_髪 ? カラー_選択中 # カラー_白}@@B:[MODE:{PORTRAIT_EDIT_MODE_髪}]@[髪]　@/B@@/C@"
		}
	ELSE
		LOCALS '= ""
		IF PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_顔 || PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_髪
			PORTRAIT_EDIT_MODE = PORTRAIT_EDIT_MODE_服
		ENDIF
	ENDIF
	{
		LOCALS += ""
			+ @"@C:{PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_服 ? カラー_選択中 # カラー_白}@@B:[MODE:{PORTRAIT_EDIT_MODE_服}]@[服]　@/B@@/C@"
			+ @"@C:{PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_帽子 ? カラー_選択中 # カラー_白}@@B:[MODE:{PORTRAIT_EDIT_MODE_帽子}]@[帽子]　@/B@@/C@"
			+ @"@C:{PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_装飾 ? カラー_選択中 # カラー_白}@@B:[MODE:{PORTRAIT_EDIT_MODE_装飾}]@[装飾・首飾]　@/B@@/C@"
			+ @"@C:{PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_眼鏡 ? カラー_選択中 # カラー_白}@@B:[MODE:{PORTRAIT_EDIT_MODE_眼鏡}]@[その他]　@/B@@/C@"
			+ @"@C:{PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_位置調整 ? カラー_選択中 # カラー_白}@@B:[MODE:{PORTRAIT_EDIT_MODE_位置調整}]@[位置調整・入出力]　@/B@@/C@"
	}
	CALLF TAG_PRINT(LOCALS, 1)
	PRINTL
	SELECTCASE PORTRAIT_EDIT_MODE
		CASE PORTRAIT_EDIT_MODE_顔
			PRINTFORM < 輪郭 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS(ARG:0, "顔")
			PRINTFORM < 身体 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS(ARG:0, "身体")
			PRINTFORM <  目  >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_FACE(ARG:0, "目")
			PRINTFORM <  眉  >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_FACE(ARG:0, "眉")
			PRINTFORM <  鼻  >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_FACE(ARG:0, "鼻")
			PRINTFORM <  口  >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_FACE(ARG:0, "口")
			PRINTFORM <頭部位>
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "頭部位")
			IF CALL_FROM == "PORTRAIT_EDIT"
				PRINTFORML 表情テスト(デバッグコンソールからコピペ可)
				FOR LOCAL, 0, VARSIZE("EXPRESSION_PARTS")
					ARRAYCOPY @"IMG_%EXPRESSION_PARTS:LOCAL%_パターン", "TEMP_ARRAY_EXPRESSION_PARTS"
					LOCALS '= ""
					LOCALS += @"@B:[PREV_PARTS:%TOSTR(LOCAL)%]@[◀]@/B@"
					LOCALS += @"@B:[NEXT_PARTS:%TOSTR(LOCAL)%]@[▶]@/B@"
					LOCALS += @"%EXPRESSION_PARTS:LOCAL%: "
					LOCALS += TEMP_ARRAY_EXPRESSION_PARTS:(EXPRESSION_PARTS_IDX:LOCAL)
					CALLF TAG_PRINT(TAG_PRINT_SHAPE(LOCALS, 30, 1))
					SIF LOCAL != 0 && (LOCAL + 1) % 4 == 0
						PRINTL
				NEXT
				PRINTL
			ENDIF
		CASE PORTRAIT_EDIT_MODE_髪
			PRINTFORM < 前髪 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS(ARG:0, "前髪")
			PRINTFORM < 後髪 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS(ARG:0, "後髪")
			PRINTFORM < ｴｸｽﾃ >
			CALL PORTRAIT_EDIT_DRAW_THUMBS(ARG:0, "エクステ")
			PRINTFORM < ｲﾝﾅｰ >
			CALL PORTRAIT_EDIT_DRAW_THUMBS(ARG:0, "インナーヘア")
		CASE PORTRAIT_EDIT_MODE_服
			PRINTFORM < 衣服 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "服", CALL_FROM)
		CASE PORTRAIT_EDIT_MODE_帽子
			PRINTFORM < 帽子 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "帽子", CALL_FROM)
		CASE PORTRAIT_EDIT_MODE_装飾
			PRINTFORM < 装飾 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "アクセサリ1", CALL_FROM)
			PRINTFORM < 首飾 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "首飾", CALL_FROM)
		CASE PORTRAIT_EDIT_MODE_眼鏡
			PRINTFORM < 眼鏡 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "眼鏡", CALL_FROM)
			PRINTFORM < ﾏｽｸ1 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "マスク1", CALL_FROM)
			PRINTFORM < ﾏｽｸ2 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "マスク2", CALL_FROM)
			PRINTFORM < 化粧 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "化粧", CALL_FROM)
			PRINTFORM < 背面 >
			CALL PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(ARG:0, "背面", CALL_FROM)
		CASE PORTRAIT_EDIT_MODE_位置調整
			CALL PORTRAIT_EDIT_DRAW_PARTS_OFFSET(ARG:0, CALL_FROM)
	ENDSELECT
	SIF PORTRAIT_EDIT_MODE != PORTRAIT_EDIT_MODE_位置調整
		CALLF TAG_PRINT(@"@S:1@<カラー変更>@/S@", 1)
	SELECTCASE PORTRAIT_EDIT_MODE
		CASE PORTRAIT_EDIT_MODE_顔
			PRINTBUTTON "[肌の色]  ", 2000
			PRINTBUTTON "[瞳の色]  ", 2002
			CALLF TAG_PRINT(@"  @C:{カラー_注釈}@※目のパターン0番は色変更非対応@/C@", 1)
			PRINTBUTTON "[眉の色]  ", 2003
			PRINTBUTTON "[鼻の色]  ", 2004
			PRINTBUTTON "[頭部位の色]  ", 2012
		CASE PORTRAIT_EDIT_MODE_髪
			PRINTBUTTON "[髪の色]  ", 2001
			PRINTBUTTON "[エクステの色]  ", 2020
			PRINTBUTTON "[インナーヘアの色]  ", 2021
		CASE PORTRAIT_EDIT_MODE_服
			PRINTBUTTON "[衣服の色]  ", 2010
		CASE PORTRAIT_EDIT_MODE_帽子
			PRINTBUTTON "[帽子の色]  ", 2011
		CASE PORTRAIT_EDIT_MODE_装飾
			PRINTBUTTON "[装飾の色]  ", 2013
			PRINTBUTTON "[首飾の色]  ", 2016
		CASE PORTRAIT_EDIT_MODE_眼鏡
			PRINTBUTTON "[眼鏡の色]  ", 2014
			PRINTBUTTON "[マスク1の色]  ", 2017
			PRINTBUTTON "[マスク2の色]  ", 2018
			PRINTBUTTON "[化粧の色]  ", 2015
			PRINTBUTTON "[背面の色]  ", 2019
	ENDSELECT
	PRINTL
ELSEIF CFLAG:(ARG:0):ポートレイト画像タイプ == 2 && (!IS_UNIQUE_CHARA(ARG) || (ARG == MASTER))
	PRINTL
	PRINTFORML 現在のポートレイト名:%CSTR:(ARG:0):キャラ顔グラ%
	CALLF TAG_PRINT(@"@B:{4010}@[画像からポートレイトを適用する]@/B@", 5)
	PRINTL
	PRINTL
	PRINTL
	PRINTL
	PRINTL
ENDIF
;ポートレイト表示
CALL DRAW_PORTRAIT((ARG:0), @"[サイズ:200px][POS_Y:-200px][POS_X:7200]%DIC_FACE_EXPRESSION%", "PORTRAIT_EDIT")
SIF CALL_FROM == "PORTRAIT_EDIT"
	DEBUGPRINTFORML @DRAW_PORTRAIT用文字列: %DIC_FACE_EXPRESSION%

IF CALL_FROM == "PORTRAIT_EDIT" && PORTRAIT_EDIT_MODE == PORTRAIT_EDIT_MODE_位置調整
	;その他
	CALL SINGLE_DRAWLINE("―", カラー_選択不可)
	CALLF TAG_PRINT(@"@S:1@<その他>", 1)
	IF TALENT:(ARG:0):カスタムキャラ
		PRINTL
		PRINTBUTTON "[カスタムキャラ登録情報のポートレイト・口上設定を適用]  ", 5000
		PRINTL
	ENDIF
	PRINTL
	PRINTBUTTON "[キャラクターCSV用にパーツ情報を出力]  ", 5001
	PRINTL
	PRINTBUTTON "[キャラクターCSV用にキャラ情報とパーツ情報を出力]  ", 5002
	PRINTL
ELSE
	IF CALL_FROM == "CLOTH_DRAWER" && PRESET_IDX != 0
		CALL SINGLE_DRAWLINE("―", カラー_選択不可)
		CALLF TAG_PRINT("@B:[COPY:1]@[デフォルトのポートレイト設定をコピー]@/B@", 1)
	ENDIF
ENDIF
CALL SINGLE_DRAWLINE("―", カラー_選択不可)
PRINTL
PRINTBUTTON "[99] 完了", 99

REDRAW 1
ONEINPUTS
CLEARLINE 1
PRINTL

;顔グラ 輪郭
IF ISNUMERIC(RESULTS)
	RESULT = TOINT(RESULTS)
	IF RESULT == 99
		FLAG:能力表示モード = 0
		RETURN
	ELSEIF INRANGE(RESULT, 2000, 2021)
		LOCAL = RESULT
		CLEARLINE 1
		CALL SINGLE_DRAWLINE()
		SELECTCASE LOCAL
			CASE 2000
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "SKIN", PRESET_IDX)
			CASE 2001
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "HAIR", PRESET_IDX)
			CASE 2020
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "HAIR_EX", PRESET_IDX)
			CASE 2021
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "HAIR_INNER", PRESET_IDX)
			CASE 2002
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "EYE", PRESET_IDX)
			CASE 2003
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "BROW", PRESET_IDX)
			CASE 2004
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "NOSE", PRESET_IDX)
			CASE 2010
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "CLOTH", PRESET_IDX)
			CASE 2011
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "HAT", PRESET_IDX)
			CASE 2012
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "HEADSUBPARTS", PRESET_IDX)
			CASE 2013
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "ACCESSORY1", PRESET_IDX)
			CASE 2014
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "GLASSES", PRESET_IDX)
			CASE 2015
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "MAKEUP", PRESET_IDX)
			CASE 2016
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "NECKLACE", PRESET_IDX)
			CASE 2017
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "MASK1", PRESET_IDX)
			CASE 2018
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "MASK2", PRESET_IDX)
			CASE 2019
				CALL EDIT_PORTRAIT_PARTS_COLOR(ARG:0, "BACK", PRESET_IDX)
		ENDSELECT
	ELSEIF INRANGE(RESULT, 3000, 3001)
		LOCAL = RESULT
		CLEARLINE 1
		CALL SINGLE_DRAWLINE()
		SELECTCASE LOCAL
			CASE 3000
				VARSET FACE_PARTS:(ARG:0):0
				CSTR:(ARG:0):キャラ顔グラ '= "FACE_DUMMY"
			CASE 3001
				CALL RANDOM_CHARA_CREATE_PORTRAIT(ARG:0)
		ENDSELECT
	ELSEIF INRANGE(RESULT, 4000, 4002)
		CFLAG:(ARG:0):ポートレイト画像タイプ = RESULT - 4000
	ELSEIF RESULT == 4010
		CALL EDIT_PORTRAIT_SELECT_FIXED_PORTRAIT_IMAGE(ARG:0)
	ELSEIF RESULT == 5000
		CALL COPY_PORTRAIT_BY_REGISTED_CUSTOM(ARG:0)
	ELSEIF RESULT == 5001
		CALL EDIT_PORTRAIT_EXPORT_FACE_PARTS_INFO_TO_TXT(ARG:0)
	ELSEIF RESULT == 5002
		CALL EDIT_EXPORT_CHARA_INFO_TO_TXT(ARG:0)
	ENDIF
ELSE
	INPUT_VALUES = %RESULTS%
	IF DIC_CONTAINSKEY(INPUT_VALUES, "MODE")
		PORTRAIT_EDIT_MODE = DIC_GETINT(INPUT_VALUES, "MODE")
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "顔")
		FACE_PARTS:(ARG:0):IMG_顔 '= @"CC1_顔_{DIC_GETINT(INPUT_VALUES, "顔")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "身体")
		FACE_PARTS:(ARG:0):IMG_身体 '= @"CC1_身体_{DIC_GETINT(INPUT_VALUES, "身体")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "目")
		FACE_PARTS:(ARG:0):IMG_目 '= @"CC1_目_{DIC_GETINT(INPUT_VALUES, "目")}"
		FACE_PARTS:(ARG:0):IMG_瞳 '= @"CC1_瞳_{DIC_GETINT(INPUT_VALUES, "瞳")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "眉")
		FACE_PARTS:(ARG:0):IMG_眉 '= @"CC1_眉_{DIC_GETINT(INPUT_VALUES, "眉")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "鼻")
		FACE_PARTS:(ARG:0):IMG_鼻 '= @"CC1_鼻_{DIC_GETINT(INPUT_VALUES, "鼻")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "口")
		FACE_PARTS:(ARG:0):IMG_口 '= @"CC1_口_{DIC_GETINT(INPUT_VALUES, "口")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "前髪")
		FACE_PARTS:(ARG:0):IMG_前髪 '= @"CC1_前髪_{DIC_GETINT(INPUT_VALUES, "前髪")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "後髪")
		FACE_PARTS:(ARG:0):IMG_後髪 '= @"CC1_後髪_{DIC_GETINT(INPUT_VALUES, "後髪")}"
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "エクステ")
		;エクステは着脱可
		IF FACE_PARTS:(ARG:0):IMG_エクステ != @"CC1_エクステ_{DIC_GETINT(INPUT_VALUES, "エクステ")}"
			FACE_PARTS:(ARG:0):IMG_エクステ '= @"CC1_エクステ_{DIC_GETINT(INPUT_VALUES, "エクステ")}"
		ELSE
			FACE_PARTS:(ARG:0):IMG_エクステ '= ""
		ENDIF
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "インナーヘア")
		;インナーヘアは着脱可
		IF FACE_PARTS:(ARG:0):IMG_インナーヘア != @"CC1_インナーヘア_{DIC_GETINT(INPUT_VALUES, "インナーヘア")}"
			FACE_PARTS:(ARG:0):IMG_インナーヘア '= @"CC1_インナーヘア_{DIC_GETINT(INPUT_VALUES, "インナーヘア")}"
		ELSE
			FACE_PARTS:(ARG:0):IMG_インナーヘア '= ""
		ENDIF
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "服")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "服", DIC_GET(INPUT_VALUES, "服"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "帽子")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "帽子", DIC_GET(INPUT_VALUES, "帽子"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "頭部位")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "頭部位", DIC_GET(INPUT_VALUES, "頭部位"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "アクセサリ1")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "アクセサリ1", DIC_GET(INPUT_VALUES, "アクセサリ1"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "首飾")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "首飾", DIC_GET(INPUT_VALUES, "首飾"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "眼鏡")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "眼鏡", DIC_GET(INPUT_VALUES, "眼鏡"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "マスク1")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "マスク1", DIC_GET(INPUT_VALUES, "マスク1"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "マスク2")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "マスク2", DIC_GET(INPUT_VALUES, "マスク2"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "化粧")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "化粧", DIC_GET(INPUT_VALUES, "化粧"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "背面")
		CALL PORTRAIT_EDIT_SET_OUTFIT_PARTS(ARG:0, "背面", DIC_GET(INPUT_VALUES, "背面"), CALL_FROM)
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "COPY")
		PRINTFORML 現在のポートレイト設定にデフォルトのポートレイトの設定を上書きします。よろしいですか？
		CALL ASK_YN
		IF !RESULT
			CALL PORTRAIT_EDIT_COPY_PRESET(ARG:0, 0, PRESET_IDX)
		ENDIF
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "PREV_PARTS")
		LOCAL = DIC_GETINT(INPUT_VALUES, "PREV_PARTS")
		EXPRESSION_PARTS_IDX:LOCAL --
		SIF EXPRESSION_PARTS_IDX:LOCAL < 0
			EXPRESSION_PARTS_IDX:LOCAL = EXPRESSION_PARTS_NUM:LOCAL - 1
		ARRAYCOPY @"IMG_%EXPRESSION_PARTS:LOCAL%_パターン", "TEMP_ARRAY_EXPRESSION_PARTS"
		DIC_FACE_EXPRESSION = %DIC_SET(DIC_FACE_EXPRESSION, EXPRESSION_PARTS:LOCAL,TEMP_ARRAY_EXPRESSION_PARTS:(EXPRESSION_PARTS_IDX:LOCAL))%

	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "NEXT_PARTS")
		LOCAL = DIC_GETINT(INPUT_VALUES, "NEXT_PARTS")
		EXPRESSION_PARTS_IDX:LOCAL ++
		SIF EXPRESSION_PARTS_IDX:LOCAL == EXPRESSION_PARTS_NUM:LOCAL
			EXPRESSION_PARTS_IDX:LOCAL = 0
		ARRAYCOPY @"IMG_%EXPRESSION_PARTS:LOCAL%_パターン", "TEMP_ARRAY_EXPRESSION_PARTS"
		DIC_FACE_EXPRESSION = %DIC_SET(DIC_FACE_EXPRESSION, EXPRESSION_PARTS:LOCAL,TEMP_ARRAY_EXPRESSION_PARTS:(EXPRESSION_PARTS_IDX:LOCAL))%

	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "OFFSET_VALUE")
		PARTS_OFFSET_VALUE = DIC_GETINT(INPUT_VALUES, "OFFSET_VALUE")
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_OFFSET_RESET")
		LOCAL = DIC_GETINT(INPUT_VALUES, "PARTS_OFFSET_RESET")
		CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_OFFSET_X", ARG:0, LOCAL, 0, CALL_FROM)
		CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_OFFSET_Y", ARG:0, LOCAL, 0, CALL_FROM)
		IF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_OFFSET_X", ARG:0, IMG_瞳, 0, CALL_FROM)
			CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_OFFSET_Y", ARG:0, IMG_瞳, 0, CALL_FROM)
		ENDIF
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_SIZE_RESET")
		LOCAL = DIC_GETINT(INPUT_VALUES, "PARTS_SIZE_RESET")
		CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_X", ARG:0, LOCAL, 0, CALL_FROM)
		CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_Y", ARG:0, LOCAL, 0, CALL_FROM)
		IF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_X", ARG:0, IMG_瞳, 0, CALL_FROM)
			CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_Y", ARG:0, IMG_瞳, 0, CALL_FROM)
		ENDIF
	ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_ROTATION_RESET")
		LOCAL = DIC_GETINT(INPUT_VALUES, "PARTS_ROTATION_RESET")
		CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_ROTATION", ARG:0, LOCAL, 0, CALL_FROM)
		IF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_SET_PARTS_OFFSET("FACE_PARTS_ROTATION", ARG:0, IMG_瞳, 0, CALL_FROM)
		ENDIF
	ENDIF

	IF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_OFFSET_X")
		LIST_OFFSET = %DIC_GET(INPUT_VALUES, "PARTS_OFFSET_X")%
		LOCAL = LIST_GETINT(LIST_OFFSET, 0)
		CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_OFFSET_X", ARG:0, LOCAL, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
		SIF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_OFFSET_X", ARG:0, IMG_瞳, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
	ENDIF

	IF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_OFFSET_Y")
		LIST_OFFSET = %DIC_GET(INPUT_VALUES, "PARTS_OFFSET_Y")%
		LOCAL = LIST_GETINT(LIST_OFFSET, 0)
		CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_OFFSET_Y", ARG:0, LOCAL, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
		SIF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_OFFSET_Y", ARG:0, IMG_瞳, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
	ENDIF

	IF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_SIZE_X")
		LIST_OFFSET = %DIC_GET(INPUT_VALUES, "PARTS_SIZE_X")%
		LOCAL = LIST_GETINT(LIST_OFFSET, 0)
		CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_X", ARG:0, LOCAL, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
		SIF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_X", ARG:0, IMG_瞳, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
	ENDIF

	IF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_SIZE_Y")
		LIST_OFFSET = %DIC_GET(INPUT_VALUES, "PARTS_SIZE_Y")%
		LOCAL = LIST_GETINT(LIST_OFFSET, 0)
		CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_Y", ARG:0, LOCAL, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
		SIF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_SIZE_MOD_Y", ARG:0, IMG_瞳, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
	ENDIF

	IF DIC_CONTAINSKEY(INPUT_VALUES, "PARTS_ROTATION")
		LIST_OFFSET = %DIC_GET(INPUT_VALUES, "PARTS_ROTATION")%
		LOCAL = LIST_GETINT(LIST_OFFSET, 0)
		CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_ROTATION", ARG:0, LOCAL, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
		IF LOCAL == IMG_目
			CALL PORTRAIT_EDIT_ADD_PARTS_OFFSET("FACE_PARTS_ROTATION", ARG:0, IMG_瞳, LIST_GETINT(LIST_OFFSET, 1), CALL_FROM)
		ENDIF
	ENDIF
ENDIF

REDRAW 0
CLEARLINE LINECOUNT - FIRST_LINE
RESTART

@EDIT_PORTRAIT_EXPORT_FACE_PARTS_INFO_TO_TXT(CHARA_ID)
#DIM CHARA_ID
#DIMS DYNAMIC OUTPUT

PRINTFORML "sav/parts_info.txt"に現在このキャラクターに設定されているパーツ情報を出力します
PRINTFORML キャラクターCSVに貼り付けることでユニークキャラのポートレイトとして使用できます
PRINTL
PRINTFORML 同名のファイルがすでに存在する場合上書きされます。よろしいですか？
PRINTL

CALL ASK_YN()
IF RESULT == 1
	RETURN 0
ENDIF

OUTPUT += @";[ポートレイトパーツ情報]CharaN_キャラ名.csvに貼り付けて使用" + "\n"

CALL EDIT_PORTRAIT_EXPORT_FACE_PARTS_INFO_TO_TXT_MAIN(CHARA_ID)
OUTPUT += RESULTS

SAVETEXT OUTPUT, "sav/parts_info.txt"
PRINTFORMW "sav/parts_info.txt"にポートレイトパーツ情報を出力しました

@EDIT_PORTRAIT_EXPORT_FACE_PARTS_INFO_TO_TXT_MAIN(CHARA_ID)
#DIM CHARA_ID
#DIM CONST CSTR_IDX_START = CSTR_PORTRAIT_IMG_IDX
#DIMS DYNAMIC OUTPUT
#DIMS DYNAMIC STRINGS
#DIM DYNAMIC MIXER, 3, 3
#DIMS CONST MIXER_NAME = "R", "G", "B"
#DIM DYNAMIC ITER_I
#DIM DYNAMIC ITER_J

VARSET RESULTS

FOR LOCAL, 0, FACE_LAYERNUM
	SIF FACE_PARTS:CHARA_ID:LOCAL == ""
		CONTINUE
	OUTPUT += @"CSTR,{CSTR_IDX_START + LOCAL},%FACE_PARTS:CHARA_ID:LOCAL%" + "\n"
NEXT
;パーツ色情報
FOR LOCAL, 0, FACE_LAYERNUM
	SIF FACE_PARTS:CHARA_ID:LOCAL == ""
		CONTINUE
	IF COLOR_MATRIX_NAME:CHARA_ID:LOCAL == "カスタム"
		OUTPUT += @"CSTR,{CSTR_IDX_START + FACE_LAYERNUM + LOCAL},{COLOR_MATRIX_RGB:CHARA_ID:LOCAL:0}:{COLOR_MATRIX_RGB:CHARA_ID:LOCAL:1}:{COLOR_MATRIX_RGB:CHARA_ID:LOCAL:2}" + "\n"
	ELSEIF COLOR_MATRIX_NAME:CHARA_ID:LOCAL == "ミキサー"
		OUTPUT += @"CSTR,{CSTR_IDX_START + FACE_LAYERNUM + LOCAL},"
		FOR ITER_I, 0, 3
			FOR ITER_J, 0, 3
				SIF ITER_J > 0
					OUTPUT += ":"
				MIXER:ITER_I:ITER_J = GETVAR(@"COLOR_MIXER_%MIXER_NAME:ITER_J%_{ITER_I}:{CHARA_ID}:{LOCAL}:0")
				OUTPUT += @"%TOSTR(MIXER:ITER_I:ITER_J)%"
			NEXT
			OUTPUT += "#"
		NEXT
		OUTPUT += "\n"
	ELSE
		OUTPUT += @"CSTR,{CSTR_IDX_START + FACE_LAYERNUM + LOCAL},%COLOR_MATRIX_NAME:CHARA_ID:LOCAL%" + "\n"
	ENDIF
NEXT
;位置情報
FOR LOCAL, 0, FACE_LAYERNUM
	LOCALS '= ""
	SIF FACE_PARTS_OFFSET_X:CHARA_ID:LOCAL != 0
		LOCALS += @"[FACE_PARTS_OFFSET_X:{FACE_PARTS_OFFSET_X:CHARA_ID:LOCAL}]"
	SIF FACE_PARTS_OFFSET_Y:CHARA_ID:LOCAL != 0
		LOCALS += @"[FACE_PARTS_OFFSET_Y:{FACE_PARTS_OFFSET_Y:CHARA_ID:LOCAL}]"
	SIF FACE_PARTS_SIZE_MOD_X:CHARA_ID:LOCAL != 0
		LOCALS += @"[FACE_PARTS_SIZE_MOD_X:{FACE_PARTS_SIZE_MOD_X:CHARA_ID:LOCAL}]"
	SIF FACE_PARTS_SIZE_MOD_Y:CHARA_ID:LOCAL != 0
		LOCALS += @"[FACE_PARTS_SIZE_MOD_Y:{FACE_PARTS_SIZE_MOD_Y:CHARA_ID:LOCAL}]"
	SIF FACE_PARTS_ROTATION:CHARA_ID:LOCAL != 0
		LOCALS += @"[FACE_PARTS_ROTATION:{FACE_PARTS_ROTATION:CHARA_ID:LOCAL}]"

	SIF LOCALS != ""
		OUTPUT += @"CSTR,{CSTR_IDX_START + FACE_LAYERNUM * 2 + LOCAL},%LOCALS%" + "\n"

NEXT
RESULTS '= OUTPUT

@EDIT_EXPORT_CHARA_INFO_TO_TXT(CHARA_ID)
#DIM CHARA_ID
#DIMS DYNAMIC OUTPUT
#DIMS _LIST_CSTR_SKIP = "NAMEカナ,CALLNAMEカナ,"
#DIMS _LIST_BASE_SKIP = "妊娠補正,"
#DIMS _MAP_BASE_OPTION
#DIMS _LIST_ABL_SKIP = "攻撃力,防御力,軽減値,行動力,敵視,隠蔽性,脅威選定,"
#DIMS _LIST_TALENT_SKIP = "カスタムキャラ,髪色,髪の長さ,特殊勢力陥落系,デイリー系,"
#DIMS _MAP_TALENT_OPTION
#DIM CONST CSTR_CHARA_CSV_END = 300
#DIM CONST CSTR_CLOTH_START = 100

#DIMS TMP_CSTR, VARSIZE("CSTR")
#DIMS TMP_CSTRNAME, VARSIZE("CSTRNAME")
#DIM  TMP_BASE, VARSIZE("BASE")
#DIMS TMP_BASENAME, VARSIZE("BASENAME")
#DIM  TMP_ABL, VARSIZE("ABL")
#DIMS TMP_ABLNAME, VARSIZE("ABLNAME")
#DIM  TMP_TALENT, VARSIZE("TALENT")
#DIMS TMP_TALENTNAME, VARSIZE("TALENTNAME")
#DIM  TMP_EXP, VARSIZE("EXP")
#DIMS TMP_EXPNAME, VARSIZE("EXPNAME")

SIF !HAS_PENIS(CHARA_ID)
	_LIST_BASE_SKIP '= LIST_ADD(_LIST_BASE_SKIP, "ペニス")

;CSV読み込みに小数点以下は読み込まれないためコメントアウト
; _MAP_BASE_OPTION '= DIC_SET(_MAP_BASE_OPTION, "身長", "DECIMAL_1")
; _MAP_BASE_OPTION '= DIC_SET(_MAP_BASE_OPTION, "体重", "DECIMAL_1")
; _MAP_BASE_OPTION '= DIC_SET(_MAP_BASE_OPTION, "バスト", "DECIMAL_1")
; _MAP_BASE_OPTION '= DIC_SET(_MAP_BASE_OPTION, "ウェスト", "DECIMAL_1")
; _MAP_BASE_OPTION '= DIC_SET(_MAP_BASE_OPTION, "ヒップ", "DECIMAL_1")
; _MAP_BASE_OPTION '= DIC_SET(_MAP_BASE_OPTION, "ペニス", "DECIMAL_1")
;これいる？
_MAP_TALENT_OPTION '= DIC_SET(_MAP_TALENT_OPTION, "淫乱系", "BINARY")
;_MAP_TALENT_OPTION '= DIC_SET(_MAP_TALENT_OPTION, "特殊勢力陥落系", "BINARY")
;_MAP_TALENT_OPTION '= DIC_SET(_MAP_TALENT_OPTION, "デイリー系", "BINARY")

PRINTFORML "sav/chara_info.txt"に現在このキャラクターに設定されているキャラ情報を出力します
PRINTFORML キャラクターCSVに貼り付けることでユニークキャラのキャラ情報として使用できます
PRINTL
PRINTFORML 同名のファイルがすでに存在する場合上書きされます。よろしいですか？
PRINTL

CALL ASK_YN()
IF RESULT == 1
	RETURN 0
ENDIF

FOR LOCAL, 0, VARSIZE("CSTR")
	TMP_CSTR:LOCAL '= CSTR:CHARA_ID:LOCAL
	TMP_CSTRNAME:LOCAL '= CSTRNAME:LOCAL
NEXT
FOR LOCAL, 0, VARSIZE("BASE")
	TMP_BASE:LOCAL = BASE:CHARA_ID:LOCAL
	TMP_BASENAME:LOCAL '= BASENAME:LOCAL
NEXT
FOR LOCAL, 0, VARSIZE("ABL")
	TMP_ABL:LOCAL = ABL:CHARA_ID:LOCAL
	TMP_ABLNAME:LOCAL '= ABLNAME:LOCAL
NEXT
FOR LOCAL, 0, VARSIZE("TALENT")
	TMP_TALENT:LOCAL = TALENT:CHARA_ID:LOCAL
	TMP_TALENTNAME:LOCAL '= TALENTNAME:LOCAL
NEXT
FOR LOCAL, 0, VARSIZE("EXP")
	TMP_EXP:LOCAL = EXP:CHARA_ID:LOCAL
	TMP_EXPNAME:LOCAL '= EXPNAME:LOCAL
NEXT

PRINTFORML ユニークキャラ識別名(CSTR:99)を指定できます
CALL ASK_MULTI("キャラ名を使用", "入力", "空欄")
SELECTCASE RESULT
	CASE 0
		TMP_CSTR:99 '= NAME:CHARA_ID
	CASE 1
		INPUTS
		TMP_CSTR:99 '= RESULTS
	CASEELSE
		TMP_CSTR:99 '= ""
ENDSELECT

OUTPUT += @";[キャラ情報]CharaN_キャラ名.csvに貼り付けて使用" + "\n"
OUTPUT += @"番号,N," + "\n"
OUTPUT += @"名前,%NAME:CHARA_ID%," + "\n"
OUTPUT += @"呼び名,%CALLNAME:CHARA_ID%," + "\n"

CALL EDIT_EXPORT_CHARA_INFO_TO_TXT_SUB_S("CSTR", TMP_CSTR, TMP_CSTRNAME, 0, CSTR_CHARA_CSV_END, _LIST_CSTR_SKIP)
OUTPUT += RESULTS + "\n"
CALL EDIT_EXPORT_CHARA_INFO_TO_TXT_SUB("基礎", TMP_BASE, TMP_BASENAME, , ,_LIST_BASE_SKIP, _MAP_BASE_OPTION)
OUTPUT += RESULTS + "\n"
CALL EDIT_EXPORT_CHARA_INFO_TO_TXT_SUB("能力", TMP_ABL, TMP_ABLNAME, , ,_LIST_ABL_SKIP)
OUTPUT += RESULTS + "\n"
CALL EDIT_EXPORT_CHARA_INFO_TO_TXT_SUB("素質", TMP_TALENT, TMP_TALENTNAME, , ,_LIST_TALENT_SKIP, _MAP_TALENT_OPTION)
OUTPUT += RESULTS + "\n"
CALL EDIT_EXPORT_CHARA_INFO_TO_TXT_SUB("経験", TMP_EXP, TMP_EXPNAME)
OUTPUT += RESULTS + "\n"

;CFLAG
SIF CFLAG:CHARA_ID:好感度 != 0
	OUTPUT += @"CFLAG,好感度,{CFLAG:CHARA_ID:好感度}," + "\n"
SIF CFLAG:CHARA_ID:依存度 != 0
	OUTPUT += @"CFLAG,依存度,{CFLAG:CHARA_ID:依存度}," + "\n"
SIF CFLAG:CHARA_ID:従属度 != 0
	OUTPUT += @"CFLAG,従属度,{CFLAG:CHARA_ID:従属度}," + "\n"
SIF CFLAG:CHARA_ID:支配度 != 0
	OUTPUT += @"CFLAG,支配度,{CFLAG:CHARA_ID:支配度}," + "\n"
OUTPUT += @"CFLAG,口上カラーコード,0x%TOSTR(CFLAG:CHARA_ID:口上カラーコード, "X6")%," + "\n\n"
;衣装
OUTPUT += @";初期設定の衣装情報。衣装部位_頭～衣装部位_アクセサリと対応" + "\n"
FOR LOCAL, 0, VARSIZE("CLOTH_PART_NAME")
	SIF LOCAL == 衣装部位_武器
		CONTINUE
	CALL GET_CLOTH_NAME(LOCAL, CLOTH:CHARA_ID:LOCAL)
	OUTPUT += @"CSTR,{CSTR_CLOTH_START + LOCAL},%RESULTS%,;%CLOTH_PART_NAME:LOCAL%" + "\n"
NEXT
OUTPUT += "\n"

;ポートレート
OUTPUT += @";[ポートレイトパーツ情報]" + "\n"
CALL EDIT_PORTRAIT_EXPORT_FACE_PARTS_INFO_TO_TXT_MAIN(CHARA_ID)
OUTPUT += RESULTS

SAVETEXT OUTPUT, @"sav/chara_info_%NAME:CHARA_ID%.txt"
PRINTFORMW "sav/chara_info_%NAME:CHARA_ID%.txt"にキャラ情報を出力しました

@EDIT_EXPORT_CHARA_INFO_TO_TXT_SUB_S(CSV_NAME, VALUE_ARRAY, NAME_ARRAY, SCAN_START = 0, SCAN_END = -1, _LIST_SKIP = "")
#DIMS DYNAMIC OUTPUT
#DIMS CSV_NAME
#DIMS REF VALUE_ARRAY, 0
#DIMS REF NAME_ARRAY, 0
#DIMS _LIST_SKIP
#DIM SCAN_START
#DIM SCAN_END

SIF SCAN_END < 0
	SCAN_END = VARSIZE("VALUE_ARRAY")

FOR LOCAL, SCAN_START, SCAN_END
	SIF NAME_ARRAY:LOCAL == "" || VALUE_ARRAY:LOCAL == ""
		CONTINUE
	SIF LIST_INDEXOF(_LIST_SKIP, NAME_ARRAY:LOCAL) != -1
		CONTINUE
	OUTPUT += @"%CSV_NAME%,%NAME_ARRAY:LOCAL%,%VALUE_ARRAY:LOCAL%," + "\n"
NEXT
RESULTS '= OUTPUT

@EDIT_EXPORT_CHARA_INFO_TO_TXT_SUB(CSV_NAME, VALUE_ARRAY, NAME_ARRAY, SCAN_START = 0, SCAN_END = -1, _LIST_SKIP = "", _MAP_OPTION = "")
#DIMS DYNAMIC OUTPUT
#DIMS CSV_NAME
#DIM REF VALUE_ARRAY, 0
#DIMS REF NAME_ARRAY, 0
#DIMS _LIST_SKIP
#DIMS _MAP_OPTION
#DIM SCAN_START
#DIM SCAN_END

SIF SCAN_END < 0
	SCAN_END = VARSIZE("VALUE_ARRAY")

FOR LOCAL, SCAN_START, SCAN_END
	SIF NAME_ARRAY:LOCAL == "" || VALUE_ARRAY:LOCAL == 0
		CONTINUE
	SIF LIST_INDEXOF(_LIST_SKIP, NAME_ARRAY:LOCAL) != -1
		CONTINUE
	IF DIC_CONTAINSKEY(_MAP_OPTION, NAME_ARRAY:LOCAL)
		TRYCALLFORM EDIT_EXPORT_CHARA_INFO_TO_TXT_OPTION_%DIC_GET(_MAP_OPTION, NAME_ARRAY:LOCAL)%(VALUE_ARRAY:LOCAL)
		OUTPUT += @"%CSV_NAME%,%NAME_ARRAY:LOCAL%,%RESULTS%," + "\n"
	ELSE
		OUTPUT += @"%CSV_NAME%,%NAME_ARRAY:LOCAL%,{VALUE_ARRAY:LOCAL}," + "\n"
	ENDIF
NEXT
RESULTS '= OUTPUT

@EDIT_EXPORT_CHARA_INFO_TO_TXT_OPTION_DECIMAL_1(VALUE)
#DIM VALUE
RESULTS '= DECIMAL_STRING(VALUE, 1)

@EDIT_EXPORT_CHARA_INFO_TO_TXT_OPTION_BINARY(VALUE)
#DIM VALUE
RESULTS '= "0b" + TOSTR(VALUE, "B64")

@COPY_PORTRAIT_BY_REGISTED_CUSTOM(CHARA_ID)
#DIM CHARA_ID
#DIM DYNAMIC DATA_NUMBER
#DIM DYNAMIC TMP_CHARA
#DIM DYNAMIC ITER_I
#DIM DYNAMIC ITER_J

PRINTFORML カスタムキャラ登録情報のポートレイト・口上を適用しますか？
PRINTFORML ※現在の設定は上書きされます
PRINTBUTTON "0[はい]　", 0
PRINTBUTTON "9[いいえ]", 9
INPUT 9

IF RESULT == 0
	; 登録情報から名前が一致するキャラを探し、該当するならポートレイト情報をコピーする
	FOR ITER_I, 0, MAX_CUSTOM_CHARA
		DATA_NUMBER = ITER_I
		IF FIND_CHARADATA(TOSTR(DATA_NUMBER))
			CALL LOAD_CUSTOM_DATA(DATA_NUMBER)
			TMP_CHARA = CHARANUM - 1
			IF CSTR:CHARA_ID:0 == CSTR:(TMP_CHARA):0 && CSTR:CHARA_ID:1 == CSTR:(TMP_CHARA):1 && CSTR:CHARA_ID:2 == CSTR:(TMP_CHARA):2
				CSTR:CHARA_ID:キャラ顔グラ = %CSTR:(TMP_CHARA):キャラ顔グラ%
				CFLAG:CHARA_ID:ポートレイト画像タイプ = CFLAG:(TMP_CHARA):ポートレイト画像タイプ
				FOR ITER_J, 0, FACE_LAYERNUM
					FACE_PARTS:CHARA_ID:ITER_J = %FACE_PARTS:TMP_CHARA:ITER_J%
				NEXT
				FOR ITER_J, 0, FACE_LAYERNUM
					COLOR_MATRIX_NAME:CHARA_ID:ITER_J = %COLOR_MATRIX_NAME:TMP_CHARA:ITER_J%
				NEXT
				CFLAG:CHARA_ID:汎用口上パターン       = CFLAG:TMP_CHARA:汎用口上パターン
				CFLAG:CHARA_ID:口上カラーコード       = CFLAG:TMP_CHARA:口上カラーコード
				LOCAL:0 = MAX_CUSTOM_CHARA
			ENDIF
			CALL DELETE_CHARA(TMP_CHARA)
		ENDIF
	NEXT
ENDIF

RETURN

;;;ボタン付きサムネイル表示
@PORTRAIT_EDIT_DRAW_THUMBS(CHARA_ID, PARTS_NAME)
#DIM  CHARA_ID
#DIMS PARTS_NAME
#DIM  DYNAMIC COL
#DIM  DYNAMIC ROW
#DIMS DYNAMIC SPRITE_NAME
#DIMS DYNAMIC BORDER
#DIM  CONST THUMB_SIZE = 80
#DIM  CONST MAX_COL_THUMB = 10

FOR LOCAL, 0, GETVAR(@"IMG_%PARTS_NAME%パーツ数")
	IF GETVARS(@"FACE_PARTS:{CHARA_ID}:IMG_%PARTS_NAME%") == @"CC1_%PARTS_NAME%_{LOCAL}"
		BORDER '= @"border ='2px' bcolor='#%CVH(カラー_選択中)%'"
	ELSE
		BORDER '= @"border ='1px' bcolor='#%CVH(カラー_白)%'"
	ENDIF
	{
		LOCALS '=
			@"<div %BORDER% rect = '{COL * THUMB_SIZE}px,{ROW * THUMB_SIZE}px,{THUMB_SIZE}px,{THUMB_SIZE}px'>"
			+ @"<button value = '[%PARTS_NAME%:{LOCAL}]' title = 'CC1_%PARTS_NAME%_{LOCAL}'>"
			+ @"<img src = 'CC1_%PARTS_NAME%_{LOCAL}' width = '{THUMB_SIZE}px' height = '{THUMB_SIZE}px'>"
			+ "</button>"
			+ "</div>"
	}
	HTML_PRINT LOCALS, 1
	IF COL == MAX_COL_THUMB - 1
		ROW ++
		COL = 0
	ELSE
		COL ++
	ENDIF
NEXT
CALL PX_NEWLINE(THUMB_SIZE * (ROW + 1))
PRINTL

@PORTRAIT_EDIT_DRAW_THUMBS_FACE(CHARA_ID, PARTS_NAME)
#DIM  CHARA_ID
#DIMS PARTS_NAME
#DIM  DYNAMIC COL
#DIM  DYNAMIC ROW
#DIMS DYNAMIC SPRITE_NAME
#DIMS DYNAMIC BORDER
#DIM  CONST THUMB_SIZE = 80
#DIM  CONST MAX_COL_THUMB = 10

FOR LOCAL, 0, GETVAR(@"IMG_%PARTS_NAME%パーツ数")
	IF GETVARS(@"FACE_PARTS:{CHARA_ID}:IMG_%PARTS_NAME%") == @"CC1_%PARTS_NAME%_{LOCAL}"
		BORDER '= @"border ='2px' bcolor='#%CVH(カラー_選択中)%'"
	ELSE
		BORDER '= @"border ='1px' bcolor='#%CVH(カラー_白)%'"
	ENDIF
	{
		LOCALS '=
			@"<div rect = '{COL * THUMB_SIZE}px,{ROW * THUMB_SIZE}px,{THUMB_SIZE}px,{THUMB_SIZE}px'>"
			+ @"<img src = 'CC1_顔_0' width = '{THUMB_SIZE}px' height = '{THUMB_SIZE}px'>"
			+ "</div>"
	}
	;瞳は例外的に番号が1から始まるので
	IF PARTS_NAME == "目" && LOCAL > 0
		{
			LOCALS +=
				@"<div rect = '{COL * THUMB_SIZE}px,{ROW * THUMB_SIZE}px,{THUMB_SIZE}px,{THUMB_SIZE}px'>"
				+ @"<img src = 'CC1_瞳_{LOCAL}_通常' width = '{THUMB_SIZE}px' height = '{THUMB_SIZE}px'>"
				+ "</div>"
		}
	ENDIF
	IF PARTS_NAME == "鼻"
		{
			LOCALS +=
				@"<div %BORDER% rect = '{COL * THUMB_SIZE}px,{ROW * THUMB_SIZE}px,{THUMB_SIZE}px,{THUMB_SIZE}px'>"
				+ @"<button value = '[%PARTS_NAME%:{LOCAL}]' title = 'CC1_%PARTS_NAME%_{LOCAL}'>"
				+ @"<img src = 'CC1_%PARTS_NAME%_{LOCAL}' width = '{THUMB_SIZE}px' height = '{THUMB_SIZE}px'>"
				+ "</button>"
				+ "</div>"
		}
	ELSE
		{
			LOCALS +=
				@"<div %BORDER% rect = '{COL * THUMB_SIZE}px,{ROW * THUMB_SIZE}px,{THUMB_SIZE}px,{THUMB_SIZE}px'>"
				+ @"<button value = '[%PARTS_NAME%:{LOCAL}]' title = 'CC1_%PARTS_NAME%_{LOCAL}'>"
				+ @"<img src = 'CC1_%PARTS_NAME%_{LOCAL}_通常' width = '{THUMB_SIZE}px' height = '{THUMB_SIZE}px'>"
				+ "</button>"
				+ "</div>"
		}
	ENDIF

	HTML_PRINT LOCALS, 1
	IF COL == MAX_COL_THUMB - 1
		ROW ++
		COL = 0
	ELSE
		COL ++
	ENDIF
NEXT
CALL PX_NEWLINE(THUMB_SIZE * (ROW + 1))
PRINTL

@PORTRAIT_EDIT_DRAW_THUMBS_OUTFIT(CHARA_ID, PARTS_NAME, CALL_FROM)
#DIM  CHARA_ID
#DIMS PARTS_NAME
#DIMS CALL_FROM
#DIMS DYNAMIC PARTS_SUBNAME
#DIM  DYNAMIC COL
#DIM  DYNAMIC ROW
#DIMS DYNAMIC SPRITE_NAME
#DIMS DYNAMIC BORDER
#DIM  DYNAMIC PRESET_IDX
#DIM  CONST THUMB_SIZE = 80
#DIM  CONST MAX_COL_THUMB = 10
#DIM  ITER_I
#DIM  ITER_J

IF CALL_FROM == "CLOTH_DRAWER"
	PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET
ENDIF

FOR ITER_I, 0, VARSIZE(@"IMG_%PARTS_NAME%_パーツ名")
	PARTS_SUBNAME '= GETVARS(@"IMG_%PARTS_NAME%_パーツ名:{ITER_I}")
	FOR ITER_J, 0, GETVAR(@"IMG_%PARTS_NAME%_パターン数:{ITER_I}")
		{
			IF (PRESET_IDX == 0 && GETVARS(@"FACE_PARTS:{CHARA_ID}:IMG_%PARTS_NAME%") == @"CC1_%PARTS_NAME%_%PARTS_SUBNAME%_{ITER_J}")
				|| (PRESET_IDX != 0 && GETVARS(@"FACE_PARTS_PRESET:{CHARA_ID}:IMG_%PARTS_NAME%:{PRESET_IDX}") == @"CC1_%PARTS_NAME%_%PARTS_SUBNAME%_{ITER_J}")
		}
			BORDER '= @"border ='2px' bcolor='#%CVH(カラー_選択中)%'"
		ELSE
			BORDER '= @"border ='1px' bcolor='#%CVH(カラー_白)%'"
		ENDIF
		{
			LOCALS '=
				@"<div %BORDER% rect = '{COL * THUMB_SIZE}px,{ROW * THUMB_SIZE}px,{THUMB_SIZE}px,{THUMB_SIZE}px'>"
				+ @"<button value = '[%PARTS_NAME%:%PARTS_SUBNAME%_{ITER_J}]' title = 'CC1_%PARTS_NAME%_%PARTS_SUBNAME%_{ITER_J}'>"
				+ @"<img src = 'CC1_%PARTS_NAME%_%PARTS_SUBNAME%_{ITER_J}' width = '{THUMB_SIZE}px' height = '{THUMB_SIZE}px'>"
				+ "</button>"
				+ "</div>"
		}
		HTML_PRINT LOCALS, 1
		IF COL == MAX_COL_THUMB - 1
			ROW ++
			COL = 0
		ELSE
			COL ++
		ENDIF
	NEXT
NEXT
CALL PX_NEWLINE(THUMB_SIZE * (ROW + 1))
PRINTL

@PORTRAIT_EDIT_SET_OUTFIT_PARTS(CHARA_ID, PARTS_NAME, PARTS_SUBNAME, CALL_FROM)
#DIM  CHARA_ID
#DIMS PARTS_NAME
#DIMS PARTS_SUBNAME
#DIMS CALL_FROM
#DIM  DYNAMIC PRESET_IDX

IF CALL_FROM == "PORTRAIT_EDIT"
	IF GETVARS(@"FACE_PARTS:{CHARA_ID}:IMG_%PARTS_NAME%") != @"CC1_%PARTS_NAME%_%PARTS_SUBNAME%"
		SETVAR @"FACE_PARTS:{CHARA_ID}:IMG_%PARTS_NAME%", @"CC1_%PARTS_NAME%_%PARTS_SUBNAME%"
	ELSE
		SETVAR @"FACE_PARTS:{CHARA_ID}:IMG_%PARTS_NAME%", ""
	ENDIF
ELSEIF CALL_FROM == "CLOTH_DRAWER"
	PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET
	IF GETVARS(@"FACE_PARTS_PRESET:{CHARA_ID}:IMG_%PARTS_NAME%:{PRESET_IDX}") != @"CC1_%PARTS_NAME%_%PARTS_SUBNAME%"
		SETVAR @"FACE_PARTS_PRESET:{CHARA_ID}:IMG_%PARTS_NAME%:{PRESET_IDX}", @"CC1_%PARTS_NAME%_%PARTS_SUBNAME%"
	ELSE
		SETVAR @"FACE_PARTS_PRESET:{CHARA_ID}:IMG_%PARTS_NAME%:{PRESET_IDX}", ""
	ENDIF
	IF PRESET_IDX == 0
		SETVAR @"FACE_PARTS:{CHARA_ID}:IMG_%PARTS_NAME%", @"CC1_%PARTS_NAME%_%PARTS_SUBNAME%"
	ENDIF
ENDIF

@PORTRAIT_EDIT_COPY_PRESET(CHARA_ID, FROM_ID, TO_ID)
#DIM  CHARA_ID
#DIM  FROM_ID
#DIM  TO_ID
#DIM  DYNAMIC ITER_I
#DIM  DYNAMIC ITER_J

FOR ITER_I, 0, FACE_LAYERNUM
	IF FROM_ID == 0
		;衣装情報
		FACE_PARTS_PRESET:CHARA_ID:ITER_I:TO_ID = %FACE_PARTS:CHARA_ID:ITER_I%
		;カラーマトリックスプリセット情報
		COLOR_MATRIX_NAME_PRESET:CHARA_ID:ITER_I:TO_ID = %COLOR_MATRIX_NAME:CHARA_ID:ITER_I%
		;カスタムの色設定情報
		COLOR_MATRIX_RGB_PRESET_R:CHARA_ID:ITER_I:TO_ID = COLOR_MATRIX_RGB:CHARA_ID:ITER_I:0
		COLOR_MATRIX_RGB_PRESET_G:CHARA_ID:ITER_I:TO_ID = COLOR_MATRIX_RGB:CHARA_ID:ITER_I:1
		COLOR_MATRIX_RGB_PRESET_B:CHARA_ID:ITER_I:TO_ID = COLOR_MATRIX_RGB:CHARA_ID:ITER_I:2
		;オフセット情報
		FACE_PARTS_OFFSET_X_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_OFFSET_X:CHARA_ID:ITER_I
		FACE_PARTS_OFFSET_Y_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_OFFSET_Y:CHARA_ID:ITER_I
		FACE_PARTS_SIZE_MOD_X_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_SIZE_MOD_X:CHARA_ID:ITER_I
		FACE_PARTS_SIZE_MOD_Y_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_SIZE_MOD_Y:CHARA_ID:ITER_I
		FACE_PARTS_ROTATION_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_ROTATION:CHARA_ID:ITER_I
	ELSE
		;衣装情報
		FACE_PARTS_PRESET:CHARA_ID:ITER_I:TO_ID = %FACE_PARTS_PRESET:CHARA_ID:ITER_I:FROM_ID%
		;カラーマトリックスプリセット情報
		COLOR_MATRIX_NAME_PRESET:CHARA_ID:ITER_I:TO_ID = %COLOR_MATRIX_NAME_PRESET:CHARA_ID:ITER_I:FROM_ID%
		;カスタムの色設定情報
		COLOR_MATRIX_RGB_PRESET_R:CHARA_ID:ITER_I:TO_ID = COLOR_MATRIX_RGB_PRESET_R:CHARA_ID:ITER_I:FROM_ID
		COLOR_MATRIX_RGB_PRESET_G:CHARA_ID:ITER_I:TO_ID = COLOR_MATRIX_RGB_PRESET_G:CHARA_ID:ITER_I:FROM_ID
		COLOR_MATRIX_RGB_PRESET_B:CHARA_ID:ITER_I:TO_ID = COLOR_MATRIX_RGB_PRESET_B:CHARA_ID:ITER_I:FROM_ID
		;オフセット情報
		FACE_PARTS_OFFSET_X_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_OFFSET_X_PRESET:CHARA_ID:ITER_I:FROM_ID
		FACE_PARTS_OFFSET_Y_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_OFFSET_Y_PRESET:CHARA_ID:ITER_I:FROM_ID
		FACE_PARTS_SIZE_MOD_X_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_SIZE_MOD_X_PRESET:CHARA_ID:ITER_I:FROM_ID
		FACE_PARTS_SIZE_MOD_Y_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_SIZE_MOD_Y_PRESET:CHARA_ID:ITER_I:FROM_ID
		FACE_PARTS_ROTATION_PRESET:CHARA_ID:ITER_I:TO_ID = FACE_PARTS_ROTATION_PRESET:CHARA_ID:ITER_I:FROM_ID
	ENDIF
	;チャンネルミキサー情報
	COLOR_MIXER_R_0:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_R_0:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_R_1:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_R_1:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_R_2:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_R_2:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_G_0:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_G_0:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_G_1:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_G_1:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_G_2:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_G_2:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_B_0:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_B_0:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_B_1:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_B_1:CHARA_ID:ITER_I:FROM_ID
	COLOR_MIXER_B_2:CHARA_ID:ITER_I:TO_ID = COLOR_MIXER_B_2:CHARA_ID:ITER_I:FROM_ID
	IF TO_ID == 0
		FACE_PARTS:CHARA_ID:ITER_I = %FACE_PARTS_PRESET:CHARA_ID:ITER_I:FROM_ID%
		COLOR_MATRIX_NAME:CHARA_ID:ITER_I = %COLOR_MATRIX_NAME_PRESET:CHARA_ID:ITER_I:FROM_ID%
		COLOR_MATRIX_RGB:CHARA_ID:ITER_I:0 = COLOR_MATRIX_RGB_PRESET_R:CHARA_ID:ITER_I:FROM_ID
		COLOR_MATRIX_RGB:CHARA_ID:ITER_I:1 = COLOR_MATRIX_RGB_PRESET_G:CHARA_ID:ITER_I:FROM_ID
		COLOR_MATRIX_RGB:CHARA_ID:ITER_I:2 = COLOR_MATRIX_RGB_PRESET_B:CHARA_ID:ITER_I:FROM_ID
	ENDIF
NEXT

@PORTRAIT_EDIT_DRAW_PARTS_OFFSET(CHARA_ID, CALL_FROM)
#DIM  CHARA_ID
#DIM  LAYER_ID
#DIMS CALL_FROM
#DIM  PRESET_IDX

SIF CALL_FROM == "CLOTH_DRAWER"
	PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET

LOCALS '= ""
{
	LOCALS += "変化量 "
		+ @"@C:{PARTS_OFFSET_VALUE == 1 ? カラー_選択中 # カラー_白}@@B:[OFFSET_VALUE:1]@[1] @/B@@/C@"
		+ @"@C:{PARTS_OFFSET_VALUE == 5 ? カラー_選択中 # カラー_白}@@B:[OFFSET_VALUE:5]@[5] @/B@@/C@"
		+ @"@C:{PARTS_OFFSET_VALUE == 10 ? カラー_選択中 # カラー_白}@@B:[OFFSET_VALUE:10]@[10] @/B@@/C@"
		+ @"@C:{PARTS_OFFSET_VALUE == 100 ? カラー_選択中 # カラー_白}@@B:[OFFSET_VALUE:100]@[100] @/B@@/C@"
}
CALLF TAG_PRINT(LOCALS, 1)
PRINTL
FOR LOCAL, 0, VARSIZE("IMG_PARTS_ORDER")
	LAYER_ID = IMG_PARTS_ORDER:LOCAL
	SIF FACE_LAYER:CHARA_ID:LAYER_ID == ""
		CONTINUE
	SIF LAYER_ID == IMG_瞳
		CONTINUE
	;ユニークキャラの顔はいじれない
	SIF IS_UNIQUE_CHARA(CHARA_ID) && CHARA_ID != MASTER && GROUPMATCH(LAYER_ID, IMG_顔, IMG_身体, IMG_目, IMG_眉, IMG_鼻, IMG_口, IMG_頭部位, IMG_前髪, IMG_後髪, IMG_エクステ, IMG_インナーヘア)
		CONTINUE
	;ドロワからいじれるのは服飾のみ
	SIF CALL_FROM == "CLOTH_DRAWER" && !GROUPMATCH(LAYER_ID, IMG_服, IMG_帽子, IMG_アクセサリ1, IMG_アクセサリ2, IMG_眼鏡, IMG_マスク1, IMG_マスク2, IMG_化粧, IMG_首飾)
		CONTINUE

	PRINTFORM ◆%IMG_PARTS_DISP_NAME:LAYER_ID, 14, LEFT%
	IF CALL_FROM == "CLOTH_DRAWER"
		PRINTFORM %@"位置(X={FACE_PARTS_OFFSET_X_PRESET:CHARA_ID:LAYER_ID:PRESET_IDX, 4, RIGHT}, Y={FACE_PARTS_OFFSET_Y_PRESET:CHARA_ID:LAYER_ID:PRESET_IDX, 4, RIGHT})", 30, LEFT%
	ELSE
		PRINTFORM %@"位置(X={FACE_PARTS_OFFSET_X:CHARA_ID:LAYER_ID, 4, RIGHT}, Y={FACE_PARTS_OFFSET_Y:CHARA_ID:LAYER_ID, 4, RIGHT})", 24, LEFT%
	ENDIF
	LOCALS '= ""
	LOCALS += @"@B:[PARTS_OFFSET_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},]@[←]@/B@"
	LOCALS += @"@B:[PARTS_OFFSET_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},]@[→]@/B@"
	LOCALS += @"@B:[PARTS_OFFSET_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},]@[↓]@/B@"
	LOCALS += @"@B:[PARTS_OFFSET_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},]@[↑]@/B@"
	LOCALS += @"@B:[PARTS_OFFSET_RESET:%TOSTR(LAYER_ID)%]@[RESET]@/B@"
	CALLF TAG_PRINT(TAG_PRINT_SHAPE(LOCALS, 40, 1), 1)

	PRINTFORM %"", 16, LEFT%
	IF CALL_FROM == "CLOTH_DRAWER"
		PRINTFORM %@"拡縮(X={FACE_PARTS_SIZE_MOD_X_PRESET:CHARA_ID:LAYER_ID:PRESET_IDX, 4, RIGHT}, Y={FACE_PARTS_SIZE_MOD_Y_PRESET:CHARA_ID:LAYER_ID:PRESET_IDX, 4, RIGHT})", 30, LEFT%
	ELSE
		PRINTFORM %@"拡縮(X={FACE_PARTS_SIZE_MOD_X:CHARA_ID:LAYER_ID, 4, RIGHT}, Y={FACE_PARTS_SIZE_MOD_Y:CHARA_ID:LAYER_ID, 4, RIGHT})", 24, LEFT%
	ENDIF
	LOCALS '= ""
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},]@[X+]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},]@[X-]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},]@[Y+]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},]@[Y-]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},][PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},]@[XY+]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},][PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},]@[XY-]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_RESET:%TOSTR(LAYER_ID)%]@[RESET]@/B@"
[SKIPSTART]
	;中心補正
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},][PARTS_OFFSET_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2 * -1},]@[X+]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},][PARTS_OFFSET_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2},]@[X-]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},][PARTS_OFFSET_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2 * -1},]@[Y+]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},][PARTS_OFFSET_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2},]@[Y-]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},][PARTS_OFFSET_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2 * -1},][PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},][PARTS_OFFSET_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2 * -1},]@[XY+]@/B@"
	LOCALS += @"@B:[PARTS_SIZE_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},][PARTS_OFFSET_X:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2},][PARTS_SIZE_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},][PARTS_OFFSET_Y:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE/2},]@[XY-]@/B@"
[SKIPEND]
	CALLF TAG_PRINT(TAG_PRINT_SHAPE(LOCALS, 40, 1), 0)

	;実用性が低そうなので未対応
	IF GROUPMATCH(LAYER_ID, IMG_顔, IMG_身体, IMG_目, IMG_眉)
		PRINTL
		CONTINUE
	ENDIF

	IF CALL_FROM == "CLOTH_DRAWER"
		PRINTFORM %@"回転({FACE_PARTS_ROTATION_PRESET:CHARA_ID:LAYER_ID:PRESET_IDX, 4, RIGHT}°)", 14, LEFT%
	ELSE
		PRINTFORM %@"回転({FACE_PARTS_ROTATION:CHARA_ID:LAYER_ID, 4, RIGHT}°)", 14, LEFT%
	ENDIF
	LOCALS '= ""
	LOCALS += @"@B:[PARTS_ROTATION:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE},]@[+]@/B@"
	LOCALS += @"@B:[PARTS_ROTATION:%TOSTR(LAYER_ID)%,{PARTS_OFFSET_VALUE * -1},]@[-]@/B@"
	LOCALS += @"@B:[PARTS_ROTATION_RESET:%TOSTR(LAYER_ID)%]@[RESET]@/B@"
	CALLF TAG_PRINT(TAG_PRINT_SHAPE(LOCALS, 40, 1), 1)
NEXT

@PORTRAIT_EDIT_ADD_PARTS_OFFSET(TARGET_ARRAY, CHARA_ID, LAYER, VALUE, CALL_FROM)
#DIMS TARGET_ARRAY
#DIM  CHARA_ID
#DIM  LAYER
#DIM  VALUE
#DIMS CALL_FROM
#DIM  DYNAMIC PRESET_IDX
#DIMS DYNAMIC ARRAY_NAME

IF CALL_FROM == "PORTRAIT_EDIT"
	ARRAY_NAME '= @"%TARGET_ARRAY%:{CHARA_ID}:{LAYER}"
ELSEIF CALL_FROM == "CLOTH_DRAWER"
	PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET
	ARRAY_NAME '= @"%TARGET_ARRAY%_PRESET:{CHARA_ID}:{LAYER}:{PRESET_IDX}"
ENDIF

IF TARGET_ARRAY == "FACE_PARTS_ROTATION"
	SETVAR ARRAY_NAME, (GETVAR(ARRAY_NAME) + VALUE + 360) % 360
ELSE
	SETVAR ARRAY_NAME, GETVAR(ARRAY_NAME) + VALUE
ENDIF

DEBUGPRINTFORML ARRAY_NAME %ARRAY_NAME%

@PORTRAIT_EDIT_SET_PARTS_OFFSET(TARGET_ARRAY, CHARA_ID, LAYER, VALUE, CALL_FROM)
#DIMS TARGET_ARRAY
#DIM  CHARA_ID
#DIM  LAYER
#DIM  VALUE
#DIMS CALL_FROM
#DIM  DYNAMIC PRESET_IDX
#DIMS DYNAMIC ARRAY_NAME

IF CALL_FROM == "PORTRAIT_EDIT"
	ARRAY_NAME '= @"%TARGET_ARRAY%:{CHARA_ID}:{LAYER}"
ELSEIF CALL_FROM == "CLOTH_DRAWER"
	PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET
	ARRAY_NAME '= @"%TARGET_ARRAY%_PRESET:{CHARA_ID}:{LAYER}:{PRESET_IDX}"
ENDIF

IF TARGET_ARRAY == "FACE_PARTS_ROTATION"
	SETVAR ARRAY_NAME, (VALUE + 360) % 360
ELSE
	SETVAR ARRAY_NAME, VALUE
ENDIF

DEBUGPRINTFORML ARRAY_NAME %ARRAY_NAME%


code:
;--------------------------------------------
; CHARA_ID番のキャラの口上、ポートレイト編集オプション
;-------------------------------------------------
@PORTRAIT_PRESET_MENU(CHARA_ID)
#DIM CHARA_ID
#DIM DYNAMIC FIRST_LINE
#DIM DYNAMIC ITER_I
#DIM DYNAMIC ITER_J
#DIM DYNAMIC パーツ分類
#DIM DYNAMIC パーツ番号
#DIM DYNAMIC PRESET_IDX

;初期処理
FIRST_LINE = LINECOUNT
PRESET_IDX = CLOTH_DRAWER_SELECT_PRESET
IF !PRESET_IDX
	FACE_PARTS_PRESET_IS_VALID:CHARA_ID:衣装プリセット_通常 = 1
	FOR LOCAL, 0, FACE_LAYERNUM
		FACE_PARTS_PRESET:(CHARA_ID):LOCAL:PRESET_IDX = %FACE_PARTS:CHARA_ID:LOCAL%
	NEXT
ELSE
	;初回編集時に通常プリセットの内容をコピー
	IF FACE_PARTS_PRESET_IS_VALID:CHARA_ID:PRESET_IDX != 1
		FACE_PARTS_PRESET_IS_VALID:CHARA_ID:PRESET_IDX = 1
	ENDIF
ENDIF

PRINTL
CALL DRAW_LINE()
PRINTFORML %ANAME(CHARA_ID)%にこの衣装プリセットが適用されている際に適用される外見を編集出来ます
PRINTFORML ※無効の場合は通常プリセットの設定内容が適用されます
CALL DRAW_LINE()

CALL SHOW_CHARACTER_PORTRAIT_EDIT_MENU(CHARA_ID, "CLOTH_DRAWER")

; CALL DRAW_PORTRAIT(CHARA_ID, "[サイズ:200px][POS_X:7200]", "PORTRAIT_EDIT")
; ;ポートレイトプリセット編集
; PRINTFORML ・衣装プリセット適用時に外見を変更する
; CALL PRINT_SELECT_BUTTON(@"[有効] ", 10, FACE_PARTS_PRESET_IS_VALID:CHARA_ID:PRESET_IDX)
; IF PRESET_IDX
; 	CALL PRINT_SELECT_BUTTON(@"[無効]", 11, !FACE_PARTS_PRESET_IS_VALID:CHARA_ID:PRESET_IDX)
; ELSE
; 	CALL COLOR_PRINTL("[無効]", カラー_選択不可)
; ENDIF
; PRINTL
; PRINTFORM ・衣服
; PRINTL
; FOR ITER_I, 0, VARSIZE("IMG_服_パーツ名")
; 	SIF ITER_I > 0 && ITER_I % 6 == 0
; 		PRINTL
; 	PRINTFORM %IMG_服_パーツ名:ITER_I%:
; 	FOR ITER_J, 0, IMG_服_パターン数:ITER_I
; 		CALL PRINT_SELECT_BUTTON(@"\{{ITER_J}\}", 100000 + (ITER_I * IMG_MAX_CLOTH_PARTSNUM) + ITER_J, FACE_PARTS_PRESET:(CHARA_ID):IMG_服:PRESET_IDX == @"CC1_服_%IMG_服_パーツ名:ITER_I%_{ITER_J}", 1)
; 	NEXT
; 	PRINTFORM
; NEXT
; PRINTL
; PRINTFORM ・帽子
; PRINTL
; FOR ITER_I, 0, VARSIZE("IMG_帽子_パーツ名")
; 	PRINTFORM %IMG_帽子_パーツ名:ITER_I%:
; 	FOR ITER_J, 0, IMG_帽子_パターン数:ITER_I
; 		CALL PRINT_SELECT_BUTTON(@"\{{ITER_J}\}", 200000 + (ITER_I * IMG_MAX_CLOTH_PARTSNUM) + ITER_J, FACE_PARTS_PRESET:(CHARA_ID):IMG_帽子:PRESET_IDX == @"CC1_帽子_%IMG_帽子_パーツ名:ITER_I%_{ITER_J}", 1)
; 	NEXT
; 	PRINTFORM
; NEXT
; PRINTL
; PRINTFORM ・装飾
; PRINTL
; FOR ITER_I, 0, VARSIZE("IMG_アクセサリ1_パーツ名")
; 	PRINTFORM %IMG_アクセサリ1_パーツ名:ITER_I%:
; 	FOR ITER_J, 0, IMG_アクセサリ1_パターン数:ITER_I
; 		CALL PRINT_SELECT_BUTTON(@"\{{ITER_J}\}", 300000 + (ITER_I * IMG_MAX_CLOTH_PARTSNUM) + ITER_J, FACE_PARTS_PRESET:(CHARA_ID):IMG_アクセサリ1:PRESET_IDX == @"CC1_アクセサリ1_%IMG_アクセサリ1_パーツ名:ITER_I%_{ITER_J}", 1)
; 	NEXT
; 	PRINTFORM
; NEXT
; PRINTL
; PRINTFORM ・眼鏡
; PRINTL
; FOR ITER_I, 0, VARSIZE("IMG_眼鏡_パーツ名")
; 	PRINTFORM %IMG_眼鏡_パーツ名:ITER_I%:
; 	FOR ITER_J, 0, IMG_眼鏡_パターン数:ITER_I
; 		CALL PRINT_SELECT_BUTTON(@"\{{ITER_J}\}", 400000 + (ITER_I * IMG_MAX_CLOTH_PARTSNUM) + ITER_J, FACE_PARTS_PRESET:(CHARA_ID):IMG_眼鏡:PRESET_IDX == @"CC1_眼鏡_%IMG_眼鏡_パーツ名:ITER_I%_{ITER_J}", 1)
; 	NEXT
; 	PRINTFORM
; NEXT
; PRINTL
; PRINTFORM ・首飾
; PRINTL
; FOR ITER_I, 0, VARSIZE("IMG_首飾_パーツ名")
; 	PRINTFORM %IMG_首飾_パーツ名:ITER_I%:
; 	FOR ITER_J, 0, IMG_首飾_パターン数:ITER_I
; 		CALL PRINT_SELECT_BUTTON(@"\{{ITER_J}\}", 700000 + (ITER_I * IMG_MAX_CLOTH_PARTSNUM) + ITER_J, FACE_PARTS_PRESET:(CHARA_ID):IMG_首飾:PRESET_IDX == @"CC1_首飾_%IMG_首飾_パーツ名:ITER_I%_{ITER_J}", 1)
; 	NEXT
; 	PRINTFORM
; NEXT
; PRINTL
; PRINTL
; PRINTFORM ・色変更
; PRINTL
; PRINTBUTTON "[衣服色]  ", 2003
; PRINTBUTTON "[帽子色]  ", 2004
; PRINTBUTTON "[装飾色]  ", 2005
; PRINTBUTTON "[眼鏡色]  ", 2006
; PRINTBUTTON "[首飾色]  ", 2009
; PRINTL
; PRINTL
; PRINTL
; PRINTL
; CALL DRAW_LINE()
; PRINTBUTTON "[BACK]  ", 99

; REDRAW 1
; ONEINPUT
; REDRAW 0
; CLEARLINE 1
; PRINTL

; ;編集終了
; IF RESULT == 99
; 	RETURN
; ELSEIF  INRANGE(RESULT, 10, 11)
; 	INVERTBIT FACE_PARTS_PRESET_IS_VALID:CHARA_ID:PRESET_IDX, 0
; 	;顔グラ 服
; ELSEIF INRANGE(RESULT, 100000, 199999)
; 	LOCAL = RESULT - 100000
; 	パーツ分類 = LOCAL / IMG_MAX_CLOTH_PARTSNUM
; 	パーツ番号 = LOCAL % IMG_MAX_CLOTH_PARTSNUM
; 	IF FACE_PARTS_PRESET:(CHARA_ID):IMG_服:PRESET_IDX == @"CC1_服_%IMG_服_パーツ名:パーツ分類%_{パーツ番号}"
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_服:PRESET_IDX '= ""
; 	ELSEIF SPRITECREATED(@"CC1_服_%IMG_服_パーツ名:パーツ分類%_{パーツ番号}")
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_服:PRESET_IDX '= @"CC1_服_%IMG_服_パーツ名:パーツ分類%_{パーツ番号}"
; 	ENDIF
; 	;顔グラ 帽子
; ELSEIF INRANGE(RESULT, 200000, 299999)
; 	LOCAL = RESULT - 200000
; 	パーツ分類 = LOCAL / IMG_MAX_CLOTH_PARTSNUM
; 	パーツ番号 = LOCAL % IMG_MAX_CLOTH_PARTSNUM
; 	IF FACE_PARTS_PRESET:(CHARA_ID):IMG_帽子:PRESET_IDX == @"CC1_帽子_%IMG_帽子_パーツ名:パーツ分類%_{パーツ番号}"
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_帽子:PRESET_IDX '= ""
; 	ELSEIF SPRITECREATED(@"CC1_帽子_%IMG_帽子_パーツ名:パーツ分類%_{パーツ番号}")
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_帽子:PRESET_IDX '= @"CC1_帽子_%IMG_帽子_パーツ名:パーツ分類%_{パーツ番号}"
; 	ENDIF
; 	;顔グラ アクセサリ1
; ELSEIF INRANGE(RESULT, 300000, 399999)
; 	LOCAL = RESULT - 300000
; 	パーツ分類 = LOCAL / IMG_MAX_CLOTH_PARTSNUM
; 	パーツ番号 = LOCAL % IMG_MAX_CLOTH_PARTSNUM
; 	IF FACE_PARTS_PRESET:(CHARA_ID):IMG_アクセサリ1:PRESET_IDX == @"CC1_アクセサリ1_%IMG_アクセサリ1_パーツ名:パーツ分類%_{パーツ番号}"
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_アクセサリ1:PRESET_IDX '= ""
; 	ELSEIF SPRITECREATED(@"CC1_アクセサリ1_%IMG_アクセサリ1_パーツ名:パーツ分類%_{パーツ番号}")
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_アクセサリ1:PRESET_IDX '= @"CC1_アクセサリ1_%IMG_アクセサリ1_パーツ名:パーツ分類%_{パーツ番号}"
; 	ENDIF
; ELSEIF INRANGE(RESULT, 400000, 499999)
; 	LOCAL = RESULT - 400000
; 	パーツ分類 = LOCAL / IMG_MAX_CLOTH_PARTSNUM
; 	パーツ番号 = LOCAL % IMG_MAX_CLOTH_PARTSNUM
; 	IF FACE_PARTS_PRESET:(CHARA_ID):IMG_眼鏡:PRESET_IDX == @"CC1_眼鏡_%IMG_眼鏡_パーツ名:パーツ分類%_{パーツ番号}"
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_眼鏡:PRESET_IDX '= ""
; 	ELSEIF SPRITECREATED(@"CC1_眼鏡_%IMG_眼鏡_パーツ名:パーツ分類%_{パーツ番号}")
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_眼鏡:PRESET_IDX '= @"CC1_眼鏡_%IMG_眼鏡_パーツ名:パーツ分類%_{パーツ番号}"
; 	ENDIF
; 	;顔グラ 首飾
; ELSEIF INRANGE(RESULT, 700000, 799999)
; 	LOCAL = RESULT - 700000
; 	パーツ分類 = LOCAL / IMG_MAX_CLOTH_PARTSNUM
; 	パーツ番号 = LOCAL % IMG_MAX_CLOTH_PARTSNUM
; 	IF FACE_PARTS_PRESET:(CHARA_ID):IMG_首飾:PRESET_IDX == @"CC1_首飾_%IMG_首飾_パーツ名:パーツ分類%_{パーツ番号}"
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_首飾:PRESET_IDX '= ""
; 	ELSEIF SPRITECREATED(@"CC1_首飾_%IMG_首飾_パーツ名:パーツ分類%_{パーツ番号}")
; 		FACE_PARTS_PRESET:(CHARA_ID):IMG_首飾:PRESET_IDX '= @"CC1_首飾_%IMG_首飾_パーツ名:パーツ分類%_{パーツ番号}"
; 	ENDIF
; ELSEIF INRANGE(RESULT, 2003, 2009)
; 	LOCAL = RESULT
; 	CLEARLINE 1
; 	CALL SINGLE_DRAWLINE()
; 	SELECTCASE LOCAL
; 		CASE 2003
; 			CALL EDIT_PORTRAIT_PARTS_COLOR(CHARA_ID, "CLOTH", PRESET_IDX)
; 		CASE 2004
; 			CALL EDIT_PORTRAIT_PARTS_COLOR(CHARA_ID, "HAT", PRESET_IDX)
; 		CASE 2005
; 			CALL EDIT_PORTRAIT_PARTS_COLOR(CHARA_ID, "ACCESSORY1", PRESET_IDX)
; 		CASE 2006
; 			CALL EDIT_PORTRAIT_PARTS_COLOR(CHARA_ID, "GLASSES", PRESET_IDX)
; 		CASE 2009
; 			CALL EDIT_PORTRAIT_PARTS_COLOR(CHARA_ID, "NECKLACE", PRESET_IDX)
; 	ENDSELECT
; ENDIF


code:
;-------------------------------------------------
;ARG:0番の他キャラに対する好感度・敵対値を一覧表示
;-------------------------------------------------
@SHOW_RELATION_INFO(CHARA_ID)
#DIM CHARA_ID

;SHOW_INFOの入力結果に基づいて制御を変える
IF SHOW_INFO_RELATION_EVENT != ""
    IF DIC_CONTAINSKEY(SHOW_INFO_RELATION_EVENT, "CHANGE_CHARA_ID")
        SHOW_RELATION_CURRENT_CHARA_ID = DIC_GETINT(SHOW_INFO_RELATION_EVENT, "CHANGE_CHARA_ID")
    ENDIF
    IF DIC_CONTAINSKEY(SHOW_INFO_RELATION_EVENT, "DEBUG")
        CALL SHOW_RELATION_DEBUG(SHOW_INFO_RELATION_EVENT)
    ENDIF
    SHOW_INFO_RELATION_EVENT '= ""
ENDIF
IF SHOW_RELATION_CURRENT_CHARA_ID != -1 && SHOW_RELATION_CURRENT_CHARA_ID != CHARA_ID
    CHARA_ID = SHOW_RELATION_CURRENT_CHARA_ID
    SHOW_INFO_RELATION_CURRENT_PAGE = 0
ENDIF

CALL RELATION_INFO_SHOW_TABLE(CHARA_ID)

@RELATION_INFO_SHOW_TABLE(CHARA_ID)
#DIM CHARA_ID
VARI DID, 1000
VARI RELATION_NUM
VARI I
VARI J
VARS TEXT
VARS ROWS, 1000
VARI MAX_ROW = UI_MAXHEIGHT - 4 ;ヘッダー、フッター表示行分減らす
VARI R_CNT
VARS COLUMNS, 10

DT_SELECT "CHARA_RELATION", @"REL_FROM_ID = {CHARA_ID}", "REL_FROM_ID ASC", DID
RELATION_NUM = RESULT

;ページ数算出
SHOW_INFO_RELATION_PAGE_NUM = RELATION_NUM / MAX_ROW - 1

;UIコンテナの作成
VARI UIC_ID
VARI WIDTH  = UI_MAXWIDTH * 100
VARI HEIGHT = UI_MAXHEIGHT * 100
CALL UIC_INIT()
UIC_ID = RESULT

CALL UIC_ADD(UIC_ID, "UIC_PARENT", "", @"[BORDER:0PX][SIZE:{WIDTH},{HEIGHT}]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_PARENT", "[TARGET:LINE_LEFT][ANCHOR:LEFT_TOP][TARGET_PIVOT:LEFT_TOP][PADDING:50,0]")
CALL UIC_ADD(UIC_ID, "UIC_TITLE", "", @"[BORDER:1PX][SIZE:{WIDTH},200][PADDING:25][COLOR:%C2H(カラー_ダークグレー)%]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_TITLE", "[TARGET:UIC_PARENT][ANCHOR:TOP][TARGET_PIVOT:TOP]")
CALL UIC_ADD(UIC_ID, "UIC_MAIN", "", @"[BORDER:1PX][SIZE:{WIDTH},{HEIGHT - 200}][PADDING:25]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_MAIN", "[TARGET:UIC_TITLE][ANCHOR:TOP][TARGET_PIVOT:BOTTOM]")
CALL UIC_ADD(UIC_ID, "UIC_FOOTER", "", @"[BORDER:0PX][SIZE:{WIDTH},150][PADDING:0]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_FOOTER", "[TARGET:UIC_MAIN][ANCHOR:BOTTOM][TARGET_PIVOT:BOTTOM]")

;関係性レコードの許容状態のチェック
VARI 恋愛の許容_全てオン = 1
VARI 隷属の許容_全てオン = 1
VARI 支配の許容_全てオン = 1
VARI 肉体関係の許容_全てオン = 1
FOR J, SHOW_INFO_RELATION_CURRENT_PAGE * MAX_ROW, MIN(RELATION_NUM, (SHOW_INFO_RELATION_CURRENT_PAGE + 1) * MAX_ROW)
    TARGET_ID = DT_CELL_GET("CHARA_RELATION", DID:J, "REL_TO_ID", 1)
    SIF 恋愛の許容_全てオン && !DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_LOVER", 1)
        恋愛の許容_全てオン = 0
    SIF 隷属の許容_全てオン && !DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_SUBORDINATE", 1)
        隷属の許容_全てオン = 0
    SIF 支配の許容_全てオン && !DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_DOMINANCE", 1)
        支配の許容_全てオン = 0
    SIF 肉体関係の許容_全てオン && !DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_UFUFU", 1)
        肉体関係の許容_全てオン = 0
    ;各項目にいずれか一つでもオフがあることが判定できているなら、それ以上チェックする必要がないのでBREAK
    SIF !恋愛の許容_全てオン && !隷属の許容_全てオン && !支配の許容_全てオン && !肉体関係の許容_全てオン
        BREAK
NEXT

TOGGLE_ALLOW_LOVER_ALL_BUTTON = 恋愛の許容_全てオン
TOGGLE_ALLOW_SUBORDINATE_ALL_BUTTON = 隷属の許容_全てオン
TOGGLE_ALLOW_DOMINANCE_ALL_BUTTON = 支配の許容_全てオン
TOGGLE_ALLOW_UFUFU_ALL_BUTTON = 肉体関係の許容_全てオン

;関係性レコードの許可設定
VARS 恋愛の一括許容
VARS 隷属の一括許容
VARS 支配の一括許容
VARS 肉体関係の一括許容

恋愛の一括許容 = %TOGGLE_ALLOW_LOVER_ALL_BUTTON ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%
隷属の一括許容 = %TOGGLE_ALLOW_SUBORDINATE_ALL_BUTTON ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%
支配の一括許容 = %TOGGLE_ALLOW_DOMINANCE_ALL_BUTTON ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%
肉体関係の一括許容 = %TOGGLE_ALLOW_UFUFU_ALL_BUTTON ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%

;ヘッダー作成
I = 0
COLUMNS:(I++) = %TAG_PRINT_SHAPE("名前", 18, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE("関係性", 8, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE("好感度", 8, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE("依存度", 8, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE("従属度", 8, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE("支配度", 8, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"恋愛の許容@B:[TOGGLE_ALLOW_LOVER_ALL:{CHARA_ID}]$このキャラの恋愛許否を一括切替@%恋愛の一括許容%@/B@", 18, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"隷属の許容@B:[TOGGLE_ALLOW_SUBORDINATE_ALL:{CHARA_ID}]$このキャラの隷属許否を一括切替@%隷属の一括許容%@/B@", 18, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"支配の許容@B:[TOGGLE_ALLOW_DOMINANCE_ALL:{CHARA_ID}]$このキャラの支配許否を一括切替@%支配の一括許容%@/B@", 18, 1, 2)%
COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"肉体関係の許容@B:[TOGGLE_ALLOW_UFUFU_ALL:{CHARA_ID}]$このキャラの肉体関係許否を一括切替@%肉体関係の一括許容%@/B@", 18, 1, 2)%

FOR I, 0, VARSIZE("COLUMNS")
    ROWS:(R_CNT) += @"%CONV_TAG2H(COLUMNS:I)%" + "｜"
NEXT
R_CNT++
ROWS:(R_CNT) = %DRAW_LINEH(UI_MAXWIDTH - 1)%
R_CNT++

;レコードデータ取得
VARI TARGET_ID
VARS 名前
VARI 好感度
VARI 依存度
VARI 従属度
VARI 支配度
VARI 関係性
VARS 恋愛の許容
VARS 隷属の許容
VARS 支配の許容
VARS 肉体関係の許容
VARS TOOLTIP
FOR J, SHOW_INFO_RELATION_CURRENT_PAGE * MAX_ROW, MIN(RELATION_NUM, (SHOW_INFO_RELATION_CURRENT_PAGE + 1) * MAX_ROW)
    TARGET_ID = DT_CELL_GET("CHARA_RELATION", DID:J, "REL_TO_ID", 1)
    名前 = %ANAME(TARGET_ID)%
    好感度 = DT_CELL_GET("CHARA_RELATION", DID:J, "LIKE", 1)

    依存度 = DT_CELL_GET("CHARA_RELATION", DID:J, "DEPENDENCE", 1)
    従属度 = DT_CELL_GET("CHARA_RELATION", DID:J, "SUBORDINATE", 1)
    支配度 = DT_CELL_GET("CHARA_RELATION", DID:J, "DOMINANCE", 1)
    関係性 = DT_CELL_GET("CHARA_RELATION", DID:J, "RELATION", 1)

    恋愛の許容 = %DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_LOVER", 1) ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%
    隷属の許容 = %DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_SUBORDINATE", 1) ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%
    支配の許容 = %DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_DOMINANCE", 1) ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%
    肉体関係の許容 = %DT_CELL_GET("CHARA_RELATION", DID:J, "ALLOW_UFUFU", 1) ? @"@C:{カラー_白}@[☑]@/C@" # @"@C:{カラー_選択不可}@[□]@/C@"%
    VARI F_COL
    IF EXISTVAR(@"関係性カラー_%関係性_文字列:関係性%")
        F_COL = GETVAR(@"関係性カラー_%関係性_文字列:関係性%")
    ELSE
        F_COL = カラー_白
    ENDIF
    I = 0
    COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"@B:[CHANGE_CHARA_ID:{TARGET_ID}]@%名前%@/B@", 18, 1, 0)%
    IF SHOW_RELATION_DEBUG_MODE
        COLUMNS:(I++) = %@"@B:[DEBUG:関係性][DID:{DID:J}]@" + TAG_PRINT_SHAPE(@"@C:{F_COL}@%関係性_文字列:関係性%@/C", 8, 1, 2) + "@/B@"%
        COLUMNS:(I++) = %@"@B:[DEBUG:好感度][DID:{DID:J}]@" + TAG_PRINT_SHAPE(TOSTR(好感度), 8, 1, 1) + "@/B@"%
        COLUMNS:(I++) = %@"@B:[DEBUG:依存度][DID:{DID:J}]@" + TAG_PRINT_SHAPE(TOSTR(依存度), 8, 1, 1) + "@/B@"%
        COLUMNS:(I++) = %@"@B:[DEBUG:従属度][DID:{DID:J}]@" + TAG_PRINT_SHAPE(TOSTR(従属度), 8, 1, 1) + "@/B@"%
        COLUMNS:(I++) = %@"@B:[DEBUG:支配度][DID:{DID:J}]@" + TAG_PRINT_SHAPE(TOSTR(支配度), 8, 1, 1) + "@/B@"%
    ELSE
        COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"@C:{F_COL}@%関係性_文字列:関係性%@/C", 8, 1, 2)%
        COLUMNS:(I++) = %TAG_PRINT_SHAPE(TOSTR(好感度), 8, 1, 1)%
        COLUMNS:(I++) = %TAG_PRINT_SHAPE(TOSTR(依存度), 8, 1, 1)%
        COLUMNS:(I++) = %TAG_PRINT_SHAPE(TOSTR(従属度), 8, 1, 1)%
        COLUMNS:(I++) = %TAG_PRINT_SHAPE(TOSTR(支配度), 8, 1, 1)%
    ENDIF
    TOOLTIP '= @"オンの場合%ANAME(CHARA_ID)%が%ANAME(TARGET_ID)%と恋愛関係を深めることを許容します"
    COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"@B:[TOGGLE_ALLOW_LOVER:{DID:J}]$%TOOLTIP%@%恋愛の許容%@/B@", 18, 1, 2)%
    TOOLTIP '= @"オンの場合%ANAME(CHARA_ID)%が%ANAME(TARGET_ID)%に対して依存・隷属する関係を深めることを許容します"
    COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"@B:[TOGGLE_ALLOW_SUBORDINATE:{DID:J}]$%TOOLTIP%@%隷属の許容%@/B@", 18, 1, 2)%
    TOOLTIP '= @"オンの場合%ANAME(CHARA_ID)%が%ANAME(TARGET_ID)%を支配する関係を深めることを許容します"
    COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"@B:[TOGGLE_ALLOW_DOMINANCE:{DID:J}]$%TOOLTIP%@%支配の許容%@/B@", 18, 1, 2)%
    TOOLTIP '= @"オンの場合%ANAME(CHARA_ID)%が%ANAME(TARGET_ID)%と肉体関係を結ぶイベントの発生を許容します"
    COLUMNS:(I++) = %TAG_PRINT_SHAPE(@"@B:[TOGGLE_ALLOW_UFUFU:{DID:J}]$%TOOLTIP%@%肉体関係の許容%@/B@", 18, 1, 2)%

    FOR I, 0, VARSIZE("COLUMNS")
        ROWS:(R_CNT) += @"%CONV_TAG2H(COLUMNS:I)%" + "｜"
    NEXT
    R_CNT++
NEXT

FOR I, 0, R_CNT
    TEXT += @"%ROWS:I%" + "
"
NEXT

CALL UIC_SET_TEXT(UIC_ID, "UIC_MAIN", TEXT)

;ページコントロール用の領域
TEXT '= ""
TEXT += @"%SHOW_INFO_RELATION_CURRENT_PAGE > 0 ? "@B:[PREV_PAGE:1]@＜@/B@" # @"@C:{カラー_選択不可}@＜@/C@"%"
TEXT += @" {SHOW_INFO_RELATION_CURRENT_PAGE + 1} "
TEXT += @"%SHOW_INFO_RELATION_CURRENT_PAGE < SHOW_INFO_RELATION_PAGE_NUM ? "@B:[NEXT_PAGE:1]@＞@/B@" # @"@C:{カラー_選択不可}@＞@/C@"%"
TEXT = %CONV_TAG2H(TAG_PRINT_SHAPE(TEXT, UI_MAXWIDTH * 2, 1, 2))%
CALL UIC_SET_TEXT(UIC_ID, "UIC_FOOTER", TEXT)

;表示部
CALL UIC_SET_TEXT(UIC_ID, "UIC_TITLE", CONV_TAG2H(@"@S:1@◆　%ANAME(CHARA_ID)%の関係一覧@/S@"))
CALL UIC_SHOW(UIC_ID)
;表示領域分改行
CALL NEWLINE(UI_MAXHEIGHT)

;SHOW_INFOから呼ばれる入力判定
@SHOW_RELATION_INFO_INPUT(RESULTS)
VARS INPUT_VALUES
VARI DID
VARI CHARA_ID
INPUT_VALUES = %RESULTS%
SHOW_INFO_RELATION_EVENT = %INPUT_VALUES%

IF DIC_CONTAINSKEY(INPUT_VALUES, "CHANGE_CHARA_ID")
    RETURN
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_LOVER")
    DID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_LOVER")
    CALL CHARA_RELATION_TOGGLE_PERMISSION(DID, "ALLOW_LOVER")
    RETURN
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_SUBORDINATE")
    DID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_SUBORDINATE")
    CALL CHARA_RELATION_TOGGLE_PERMISSION(DID, "ALLOW_SUBORDINATE")
    RETURN
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_DOMINANCE")
    DID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_DOMINANCE")
    CALL CHARA_RELATION_TOGGLE_PERMISSION(DID, "ALLOW_DOMINANCE")
    RETURN
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_UFUFU")
    DID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_UFUFU")
    CALL CHARA_RELATION_TOGGLE_PERMISSION(DID, "ALLOW_UFUFU")
    RETURN
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_LOVER_ALL")
    CALL SHOW_RELATION_CONFIRM_TOGGLE_ALL_PERMISSION()
    IF !RESULT
        RETURN
    ENDIF
    CHARA_ID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_LOVER_ALL")
    TOGGLE_ALLOW_LOVER_ALL_BUTTON = !TOGGLE_ALLOW_LOVER_ALL_BUTTON
    CALL CHARA_RELATION_SET_PERMISSION_ALL(CHARA_ID, "ALLOW_LOVER", TOGGLE_ALLOW_LOVER_ALL_BUTTON)
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_SUBORDINATE_ALL")
    CALL SHOW_RELATION_CONFIRM_TOGGLE_ALL_PERMISSION()
    IF !RESULT
        RETURN
    ENDIF
    CHARA_ID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_SUBORDINATE_ALL")
    TOGGLE_ALLOW_SUBORDINATE_ALL_BUTTON = !TOGGLE_ALLOW_SUBORDINATE_ALL_BUTTON
    CALL CHARA_RELATION_SET_PERMISSION_ALL(CHARA_ID, "ALLOW_SUBORDINATE", TOGGLE_ALLOW_SUBORDINATE_ALL_BUTTON)
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_DOMINANCE_ALL")
    CALL SHOW_RELATION_CONFIRM_TOGGLE_ALL_PERMISSION()
    IF !RESULT
        RETURN
    ENDIF
    CHARA_ID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_DOMINANCE_ALL")
    TOGGLE_ALLOW_DOMINANCE_ALL_BUTTON = !TOGGLE_ALLOW_DOMINANCE_ALL_BUTTON
    CALL CHARA_RELATION_SET_PERMISSION_ALL(CHARA_ID, "ALLOW_DOMINANCE", TOGGLE_ALLOW_DOMINANCE_ALL_BUTTON)
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "TOGGLE_ALLOW_UFUFU_ALL")
    CALL SHOW_RELATION_CONFIRM_TOGGLE_ALL_PERMISSION()
    IF !RESULT
        RETURN
    ENDIF
    CHARA_ID = DIC_GETINT(INPUT_VALUES, "TOGGLE_ALLOW_UFUFU_ALL")
    TOGGLE_ALLOW_UFUFU_ALL_BUTTON = !TOGGLE_ALLOW_UFUFU_ALL_BUTTON
    CALL CHARA_RELATION_SET_PERMISSION_ALL(CHARA_ID, "ALLOW_UFUFU", TOGGLE_ALLOW_UFUFU_ALL_BUTTON)
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "PREV_PAGE")
    SHOW_INFO_RELATION_CURRENT_PAGE = SHOW_INFO_RELATION_CURRENT_PAGE > 0 ? SHOW_INFO_RELATION_CURRENT_PAGE - 1 # 0
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "NEXT_PAGE") && SHOW_INFO_RELATION_CURRENT_PAGE < SHOW_INFO_RELATION_PAGE_NUM
    SHOW_INFO_RELATION_CURRENT_PAGE++
ENDIF

@SHOW_RELATION_CONFIRM_TOGGLE_ALL_PERMISSION()
PRINTL
CALL COLOR_PRINTL("関係性の許容を一括して切り替えます。よろしいですか？", カラー_注意)
CALL ASK_YN()
RETURN !RESULT

;;;デバッグモードによる値操作
;;;
@SHOW_RELATION_DEBUG(DIC_OPTION)
#DIMS DIC_OPTION
#DIMS DYNAMIC CANDIDATES, 30

VARS TARGET_COLUMNSTR
VARI CANDIDATE_NUM
VARI TARGET_DID
VARI FROM_ID
VARI TO_ID
VARI I
VARS HTML
TARGET_COLUMNSTR = %DIC_GET(DIC_OPTION, "DEBUG")%
TARGET_DID = DIC_GETINT(DIC_OPTION, "DID")

CANDIDATE_NUM = VARSIZE("関係性_文字列")
FOR I, 0, CANDIDATE_NUM
    CANDIDATES:I = %関係性_文字列:I%
NEXT

FROM_ID = DT_CELL_GET("CHARA_RELATION", TARGET_DID, "REL_FROM_ID", 1)
TO_ID = DT_CELL_GET("CHARA_RELATION", TARGET_DID, "REL_TO_ID", 1)

PRINTFORML ;-------------------------------------------------
PRINTFORML ; DEBUG 関係性の変更
PRINTFORML ;-------------------------------------------------
SELECTCASE TARGET_COLUMNSTR
    CASE "関係性"
        PRINTFORML %ANAME(FROM_ID)%から%ANAME(TO_ID)%への関係性を変更します
        FOR I, 0, CANDIDATE_NUM
            HTML += @"<button value='{I}'>[%CANDIDATES:I%]</button>
"
        NEXT
        HTML += @"
<button value='-1'>[変更しない]</button>
"
        HTML_PRINT HTML, 1
        BINPUT
        IF INRANGE(RESULT, -1, CANDIDATE_NUM)
            IF RESULT != -1
                CALL CHARA_RELATION_SET_RELATION(FROM_ID, TO_ID, RESULT)
                RETURN 1
            ELSE
                RETURN 0
            ENDIF
        ENDIF
    CASE "好感度", "依存度", "従属度", "支配度"
        PRINTFORML %ANAME(FROM_ID)%から%ANAME(TO_ID)%への%TARGET_COLUMNSTR%に入力値を加算します(未入力・文字以外でキャンセル)
        INPUTS
        IF ISNUMERIC(RESULTS)
            RESULT = TOINT(RESULTS)
            SELECTCASE TARGET_COLUMNSTR
                CASE "好感度"
                    CALL REL_ADD(FROM_ID, TO_ID, RESULT)
                CASE "依存度"
                    CALL REL_ADD(FROM_ID, TO_ID,, RESULT)
                CASE "従属度"
                    CALL REL_ADD(FROM_ID, TO_ID,,, RESULT)
                CASE "支配度"
                    CALL REL_ADD(FROM_ID, TO_ID,,,, RESULT)
            ENDSELECT
            RETURN 1
        ELSE
            RETURN 0
        ENDIF
ENDSELECT

;;; デバッグモード起動用関数
;;; コンソールから投入できるよう式中関数で定義
@RELATION_DEBUG_ACTIVATE(IS_ACTIVE)
#FUNCTION
#DIM IS_ACTIVE
SHOW_RELATION_DEBUG_MODE = IS_ACTIVE

;-------------------------------------------------
;ARG:0番の他キャラに対する好感度・敵対値を一覧表示(廃止)
;-------------------------------------------------
@SHOW_RELATION_LIST(ARG:0)
; FOR LOCAL:0, 0, CHARANUM
; 	PRINTFORM %ANAME(LOCAL:0), 8, RIGHT%
; 	PRINTFORM   {REL_LIKE:(ARG:0):(LOCAL:0), 5, RIGHT}
; 	PRINTFORM   {REL_HATE:(ARG:0):(LOCAL:0), 5, RIGHT}
; 	PRINTL
; NEXT


code:
@SHOW_INFO_SHOW_SKILL(CHARA_ID)
#DIM CHARA_ID
IF SHOP_SKILL_MODE == "" || FLAG:クエストモード
    SHOP_SKILL_MODE '= "SHOW_SKILL"
    SHOP_SKILL_LEARN_MODE '= ""
ENDIF
CALL SHOW_INFO_SHOW_SKILL_LIST(CHARA_ID)

;-------------------------------------------------
;習得済スキル描画
;-------------------------------------------------
@SHOW_INFO_SHOW_SKILL_LIST(CHARA_ID)
#DIM  CHARA_ID
#DIMS MODE
#DIM  DYNAMIC GENRE
#DIM  DYNAMIC PRINT_SKILL_NUM
#DIM  DYNAMIC HIDE_SKILL_NUM
#DIMS DYNAMIC STR_GENRE
#DIMS DYNAMIC STR_TITLE
#DIMS DYNAMIC FILTER
#DIMS DYNAMIC _XML_SKILL
#DIM  DYNAMIC F_COL
#DIMS DYNAMIC HTML
#DIMS DYNAMIC ROWS_PER_ITEM, MAX_SKILLS, 3
#DIM  CONST   MAX_ROW = 12

;UIコンテナの作成
VARI UIC_ID
VARI WIDTH  = UI_MAXWIDTH * 100
VARI HEIGHT = UI_MAXHEIGHT * 100
CALL UIC_INIT()
UIC_ID = RESULT

CALL UIC_ADD(UIC_ID, "UIC_PARENT", "", @"[BORDER:0PX][SIZE:{WIDTH},{HEIGHT}]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_PARENT", "[TARGET:LINE_LEFT][ANCHOR:LEFT_TOP][TARGET_PIVOT:LEFT_TOP][PADDING:50,0]")
CALL UIC_ADD(UIC_ID, "UIC_TITLE", "", @"[BORDER:1PX][SIZE:{WIDTH},200][PADDING:25][COLOR:%C2H(カラー_ダークグレー)%]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_TITLE", "[TARGET:UIC_PARENT][ANCHOR:TOP][TARGET_PIVOT:TOP]")
CALL UIC_ADD(UIC_ID, "UIC_TAB", "", @"[BORDER:1PX][SIZE:{WIDTH},400][PADDING:25]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_TAB", "[TARGET:UIC_TITLE][ANCHOR:TOP][TARGET_PIVOT:BOTTOM]")
CALL UIC_ADD(UIC_ID, "UIC_MAIN", "", @"[BORDER:1PX][SIZE:{WIDTH},{HEIGHT - 600}][PADDING:25]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_MAIN", "[TARGET:UIC_TAB][ANCHOR:TOP][TARGET_PIVOT:BOTTOM]")
CALL UIC_ADD(UIC_ID, "UIC_FOOTER", "", @"[BORDER:0PX][SIZE:{WIDTH},150][PADDING:0]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_FOOTER", "[TARGET:UIC_MAIN][ANCHOR:BOTTOM][TARGET_PIVOT:BOTTOM]")
CALL UIC_ADD(UIC_ID, "UIC_INFO", "", @"[BORDER:1PX][SIZE:{WIDTH / 6},200][PADDING:25]")
CALL UIC_SET_LAYOUT(UIC_ID, "UIC_INFO", "[TARGET:UIC_MAIN][ANCHOR:RIGHT_BOTTOM][TARGET_PIVOT:RIGHT_BOTTOM]")

;タブとスキルジャンルの初期設定
IF SKILL_SELECT_TAB == ""
    SKILL_SELECT_TAB = %SKILL_GENRE_ENG:スキル_ジャンル_戦闘%
    SHOP_SKILL_FILTER '= "ALL"
ENDIF
GENRE = FINDELEMENT(SKILL_GENRE_ENG, SKILL_SELECT_TAB)
SIF GENRE == -1
    GENRE = 0
IF SHOP_SKILL_MODE == "LEARN_SKILL" && SHOP_SKILL_LEARN_MODE == "EDIT_SKILL_SLOT"
    GENRE = スキル_ジャンル_戦闘
ENDIF

;フィルターの設定
FILTER '= ""
IF SHOP_SKILL_FILTER != "ALL" && GENRE == スキル_ジャンル_戦闘
    FILTER '= @"[.//subcategory[(text()='%SHOP_SKILL_FILTER%')]]"
ENDIF
;タブで選択されたGENREのスキルXML定義を読み込み
IF SHOP_SKILL_MODE == "LEARN_SKILL" && SHOP_SKILL_LEARN_MODE == "EDIT_SKILL_SLOT"
    STR_GENRE = %SKILL_GENRE_ENG:GENRE%
    XML_DOCUMENT XMLID_SKILL:GENRE, RESULTS
    {
        XML_GET XMLID_SKILL:GENRE
            , @"//defname[.//category[(text()='%STR_GENRE%')]]"
            + @"[.//subcategory[(text()='ACTIVE')]]/@parentname"
            , SKILL_DEF_LIST
    }
    SKILL_NUM = RESULT
ELSE
    STR_GENRE = %SKILL_SELECT_TAB%
    XML_DOCUMENT XMLID_SKILL:GENRE, RESULTS
    {
        XML_GET XMLID_SKILL:GENRE
            , @"//defname[.//category[(text()='%STR_GENRE%')]]%FILTER%"
            + @"[.//skillrank[(text()='UNIQUE')]][.//reqchara[@name='%CSTR:(CHARA_ID):99%']]/@parentname"
            + @"| //defname[.//category[(text()='%STR_GENRE%')]]%FILTER%"
            + @"[.//skillrank[(text()='COMMON')]]/@parentname"
            , SKILL_DEF_LIST
    }
    SKILL_NUM = RESULT
ENDIF

;実際に出力可能なレコードを集計
FOR LOCAL, 0, SKILL_NUM
    ;;スキル定義のOUTER_XML取得
    XML_GET XMLID_SKILL:GENRE, @"//defname[@parentname='%SKILL_DEF_LIST:LOCAL%']", _XML_SKILL, 3
    IF SHOP_SKILL_MODE == "LEARN_SKILL" && SHOP_SKILL_LEARN_MODE == "EDIT_SKILL_SLOT"
        IF !HAS_SKILL(CHARA_ID, SKILL_DEF_LIST:LOCAL)
            CONTINUE
        ENDIF
        CALL SKILL_PRINT_LINE(GENRE, CHARA_ID, _XML_SKILL, "EDIT_SKILL_SLOT")
        SIF !RESULT
            CONTINUE
    ELSE
        CALL SKILL_PRINT_LINE(GENRE, CHARA_ID, _XML_SKILL, MODE)
        SIF !RESULT
            CONTINUE
    ENDIF
    ROWS_PER_ITEM:PRINT_SKILL_NUM:0 = %RESULTS:0%
    ROWS_PER_ITEM:PRINT_SKILL_NUM:1 = %RESULTS:1%
    ROWS_PER_ITEM:PRINT_SKILL_NUM:2 = %RESULTS:2%
    PRINT_SKILL_NUM ++
NEXT

;ページ数算出
SHOP_SKILL_PAGE_NUM = (PRINT_SKILL_NUM - 1) / MAX_ROW
SHOP_SKILL_CURRENT_PAGE = SHOP_SKILL_CURRENT_PAGE > SHOP_SKILL_PAGE_NUM ? SHOP_SKILL_PAGE_NUM # SHOP_SKILL_CURRENT_PAGE

;■ 印字処理
;タイトル
IF SHOP_SKILL_MODE == "SHOW_SKILL"
    STR_TITLE '= @"@S:1@◆　%ANAME(CHARA_ID)%の習得済スキル・習得可能スキル@/S@"
ELSEIF SHOP_SKILL_MODE == "LEARN_SKILL" && SHOP_SKILL_LEARN_MODE == "EDIT_SKILL_SLOT"
    STR_TITLE '= @"@S:1@◆　%ANAME(CHARA_ID)%のスキルスロット編集@/S@　　習得済みのアクティブスキルの中から、戦闘時に発動可能なスキルを3つまでセットできます"
ELSEIF SHOP_SKILL_MODE == "LEARN_SKILL" && SHOP_SKILL_LEARN_MODE == "RESET_SKILL"
    STR_TITLE '= @"@S:1@◆　%ANAME(CHARA_ID)%のスキルリセット@/S@"
ELSEIF SHOP_SKILL_MODE == "LEARN_SKILL"
    STR_TITLE '= @"@S:1@◆　%ANAME(CHARA_ID)%のスキル習得・リセット@/S@"
ENDIF
CALL UIC_SET_TEXT(UIC_ID, "UIC_TITLE", CONV_TAG2H(STR_TITLE))

;スキルタブ ジャンル
HTML '= ""
FOR LOCAL, 0, SKILL_GENRE_NUM
    IF SKILL_GENRE_ENG:LOCAL == SKILL_SELECT_TAB
        F_COL = カラー_選択中
    ELSE
        F_COL = カラー_白
    ENDIF
    HTML += @"@B:[SHOW_SKILL_SELECT_TAB:%SKILL_GENRE_ENG:LOCAL%]@@C:{F_COL}@[%SKILL_GENRE_JP:LOCAL%]  @/C@@/B@"
NEXT
IF FLAG:クエストモード
    HTML += @"@C:{カラー_選択不可}@[習得・リセット]  ※クエスト中は習得・リセット不可@/C@"
ELSE
    IF SHOP_SKILL_MODE == "LEARN_SKILL"
        HTML += @"@B:[SHOP_SKILL_MODE:SHOW_SKILL]@@C:{カラー_選択中}@[習得・リセット]  @/C@@/B@"
    ELSEIF SHOP_SKILL_MODE == "SHOW_SKILL"
        HTML += @"@B:[SHOP_SKILL_MODE:LEARN_SKILL]@[習得・リセット]  @/B@"
    ENDIF
ENDIF

;習得モード
IF SHOP_SKILL_MODE == "LEARN_SKILL"
    HTML += @"@B:[SHOP_SKILL_LEARN_MODE:EDIT_SKILL_SLOT]@@C:{SHOP_SKILL_LEARN_MODE == "EDIT_SKILL_SLOT" ? カラー_選択中 # カラー_白}@[スキルスロット編集]  @/C@@/B@"
    HTML += @"@B:[RESET_SKILL:1]@@C:{SHOP_SKILL_LEARN_MODE == "RESET_SKILL" ? カラー_選択中 # カラー_白}@[スキルリセット]  @/C@@/B@"
    HTML += @"@B:[SHOW_ITEM_MENU:1]@[アイテム確認]  @/B@"
    IF SHOP_SKILL_LEARN_OMIT_CONFIRM_FLAG
        HTML += @"@B:[OMIT_CONFIRM:1]@@C:{カラー_選択中}@☑　習得確認を省略  @/C@@/B@"
    ELSE
        HTML += @"@B:[OMIT_CONFIRM:0]@@C:{カラー_選択不可}@□　習得確認を省略  @/C@@/B@"
    ENDIF
ENDIF

HTML += @"
"
HTML += DRAW_LINEH(UI_MAXWIDTH - 1)
HTML += @"
"

;戦闘スキルタブ フィルター
IF GENRE == スキル_ジャンル_戦闘 && SHOP_SKILL_LEARN_MODE != "EDIT_SKILL_SLOT"
    HTML += @"@B:[FILTER:ALL]@@C:{SHOP_SKILL_FILTER == "ALL" ? カラー_選択中 # カラー_白}@[ALL]  @/C@@/B@"
    HTML += @"@B:[FILTER:ACTIVE]@@C:{SHOP_SKILL_FILTER == "ACTIVE" ? カラー_選択中 # カラー_白}@[ACTIVE]  @/C@@/B@"
    HTML += @"@B:[FILTER:PASSIVE]@@C:{SHOP_SKILL_FILTER == "PASSIVE" ? カラー_選択中 # カラー_白}@[PASSIVE]  @/C@@/B@"
ENDIF
HTML = %CONV_TAG2H(HTML)%
CALL UIC_SET_TEXT(UIC_ID, "UIC_TAB", HTML)

;スキルポイント表示
HTML '= ""
F_COL = カラー_白
SELECTCASE GENRE
    CASE スキル_ジャンル_生活
        CALL SKILL_CHECK_USED_SKILL_POINT(CHARA_ID, スキル_大分類_生活)
        USED_SKILL_POINT:CHARA_ID:スキル_大分類_生活 = RESULT
        SIF USED_SKILL_POINT:CHARA_ID:スキル_大分類_生活 == BASE_SKILL_POINT:CHARA_ID:スキル_大分類_生活
            F_COL = カラー_注意
        HTML += @"@C:{F_COL}@◆　生活SP({USED_SKILL_POINT:CHARA_ID:スキル_大分類_生活}/{BASE_SKILL_POINT:CHARA_ID:スキル_大分類_生活})@/C@"
    CASE スキル_ジャンル_戦闘, スキル_ジャンル_クエスト
        CALL SKILL_CHECK_USED_SKILL_POINT(CHARA_ID, スキル_大分類_冒険)
        USED_SKILL_POINT:CHARA_ID:スキル_大分類_冒険 = RESULT
        SIF USED_SKILL_POINT:CHARA_ID:スキル_大分類_冒険 == BASE_SKILL_POINT:CHARA_ID:スキル_大分類_冒険
            F_COL = カラー_注意
        HTML += @"@C:{F_COL}@◆　冒険SP({USED_SKILL_POINT:CHARA_ID:スキル_大分類_冒険}/{BASE_SKILL_POINT:CHARA_ID:スキル_大分類_冒険})@/C@"
    CASE スキル_ジャンル_性技
        CALL SKILL_CHECK_USED_SKILL_POINT(CHARA_ID, スキル_大分類_性技)
        USED_SKILL_POINT:CHARA_ID:スキル_大分類_性技 = RESULT
        SIF USED_SKILL_POINT:CHARA_ID:スキル_大分類_性技 == BASE_SKILL_POINT:CHARA_ID:スキル_大分類_性技
            F_COL = カラー_注意
        HTML += @"@C:{F_COL}@◆　性技SP({USED_SKILL_POINT:CHARA_ID:スキル_大分類_性技}/{BASE_SKILL_POINT:CHARA_ID:スキル_大分類_性技})@/C@"
ENDSELECT
HTML = %CONV_TAG2H(HTML)%
CALL UIC_SET_TEXT(UIC_ID, "UIC_INFO", HTML)

;スキル一覧
HTML '= ""
FOR LOCAL, SHOP_SKILL_CURRENT_PAGE * MAX_ROW, MIN(PRINT_SKILL_NUM, (SHOP_SKILL_CURRENT_PAGE + 1) * MAX_ROW)
    HTML += @"%CONV_TAG2H(HTML_ESCAPE(ROWS_PER_ITEM:LOCAL:0))%
"
    HTML += @"%CONV_TAG2H(HTML_ESCAPE(ROWS_PER_ITEM:LOCAL:1))%
"
    HTML += @"%CONV_TAG2H(HTML_ESCAPE(ROWS_PER_ITEM:LOCAL:2))%
"
NEXT
CALL UIC_SET_TEXT(UIC_ID, "UIC_MAIN", HTML)

;ページコントロール用の領域
HTML '= ""
HTML += @"%SHOP_SKILL_CURRENT_PAGE > 0 ? "@B:[PREV_PAGE:1]@＜―@/B@" # @"@C:{カラー_選択不可}@＜―@/C@"%"
HTML += @" {SHOP_SKILL_CURRENT_PAGE + 1} "
HTML += @"%SHOP_SKILL_CURRENT_PAGE < SHOP_SKILL_PAGE_NUM ? "@B:[NEXT_PAGE:1]@―＞@/B@" # @"@C:{カラー_選択不可}@―＞@/C@"%"
HTML = %CONV_TAG2H(TAG_PRINT_SHAPE(HTML, UI_MAXWIDTH * 2, 1, 2))%
CALL UIC_SET_TEXT(UIC_ID, "UIC_FOOTER", HTML)

CALL UIC_SHOW(UIC_ID)
CALL NEWLINE(UI_MAXHEIGHT)

;-------------------------------------------------
;スキル一覧入力受付
;-------------------------------------------------
@SHOW_INFO_SHOW_SKILL_INPUT(INPUT_VALUES, CHARA_ID)
#DIMS INPUT_VALUES
#DIM  CHARA_ID
#DIM DYNAMIC NOW_GENRE

IF DIC_CONTAINSKEY(INPUT_VALUES, "SHOW_SKILL_SELECT_TAB")
    INPUT_VALUES = %DIC_GET(INPUT_VALUES, "SHOW_SKILL_SELECT_TAB")%
    SKILL_SELECT_TAB = %INPUT_VALUES%
ELSEIF  DIC_CONTAINSKEY(INPUT_VALUES, "SHOW_SKILL_LIST")
    INPUT_VALUES = %DIC_GET(INPUT_VALUES, "SHOW_SKILL_LIST")%
    NOW_GENRE = FINDELEMENT(SKILL_GENRE_ENG, SKILL_SELECT_TAB)
    SIF NOW_GENRE == -1
        NOW_GENRE = 0
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "SKILL_DEF_NAME")
    IF SHOP_SKILL_MODE == "LEARN_SKILL"
        INPUT_VALUES = %DIC_GET(INPUT_VALUES, "SKILL_DEF_NAME")%
        SELECTCASE SHOP_SKILL_LEARN_MODE
                ;スキル習得・忘却
            CASE "LEARN_SKILL"
                VARI GENRE
                GENRE = FINDELEMENT(SKILL_GENRE_ENG, SKILL_SELECT_TAB)
                CALL SHOP_LEARN_SKILL(CHARA_ID, INPUT_VALUES, GENRE)
                ;アクティブスキルスロット編集
            CASE "EDIT_SKILL_SLOT"
                CALL SKILL_EDIT_ACTIVE_SKILL_SLOT(CHARA_ID, INPUT_VALUES)
        ENDSELECT
    ENDIF
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "SHOP_SKILL_MODE")
    INPUT_VALUES = %DIC_GET(INPUT_VALUES, "SHOP_SKILL_MODE")%
    SHOP_SKILL_MODE = %INPUT_VALUES%
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "SHOP_SKILL_LEARN_MODE")
    INPUT_VALUES = %DIC_GET(INPUT_VALUES, "SHOP_SKILL_LEARN_MODE")%
    IF SHOP_SKILL_LEARN_MODE != "LEARN_SKILL" && SHOP_SKILL_LEARN_MODE == INPUT_VALUES
        SHOP_SKILL_LEARN_MODE '= "LEARN_SKILL"
    ELSE
        SHOP_SKILL_LEARN_MODE = %INPUT_VALUES%
    ENDIF
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "FILTER")
    INPUT_VALUES = %DIC_GET(INPUT_VALUES, "FILTER")%
    SHOP_SKILL_FILTER = %INPUT_VALUES%
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "RESET_SKILL")
    CALL SHOP_LIFE_SKILL_RESET(CHARA_ID)
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "OMIT_CONFIRM")
    SHOP_SKILL_LEARN_OMIT_CONFIRM_FLAG = !SHOP_SKILL_LEARN_OMIT_CONFIRM_FLAG
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "PREV_PAGE")
    SHOP_SKILL_CURRENT_PAGE = SHOP_SKILL_CURRENT_PAGE > 0 ? SHOP_SKILL_CURRENT_PAGE - 1 # 0
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "NEXT_PAGE") && SHOP_SKILL_CURRENT_PAGE < SHOP_SKILL_PAGE_NUM
    SHOP_SKILL_CURRENT_PAGE++
ELSEIF DIC_CONTAINSKEY(INPUT_VALUES, "SHOW_ITEM_MENU")
    CALL HO_ITEM_MENU
ENDIF


code:
;情報表示に関わる関数
;-------------------------------------------------
;ARG:0番のキャラの情報を表示
;-------------------------------------------------
@SHOW_INFO_STATUS(CHARA_ID, 調教中 = 0)
#DIM CHARA_ID
#DIM 調教中
#DIM DYNAMIC FIRST_LINE
FIRST_LINE = LINECOUNT

CALL SHOW_HEADER(CHARA_ID)
; CALL SMALL_TITLE("基礎", 100)
; CALL SHOW_BASE(CHARA_ID)
PRINTL
CALL NEW_PRINT_BASE_INFO(CHARA_ID)
CALL NEW_PRINT_STATUS(CHARA_ID)
CALL NEW_PRINT_CLOTH(CHARA_ID)
CALL NEW_PRINT_SKILL(CHARA_ID)
CALL NEW_PRINT_EQUIP(CHARA_ID)

FOR LOCAL, 0, 42
	PRINTL
NEXT

;-------------------------------------------------
; ポートレイト、体力などの基礎情報
;-------------------------------------------------
@NEW_PRINT_BASE_INFO(CHARA_ID)
#DIM CHARA_ID
#DIMS ATR_DIV
ATR_DIV '=  @"rect = '5200, 0, 3250, 2800' border = '1px' bcolor='#%CVH(カラー_白)%' padding='2px'"
;顔グラ表示
CALL SHOW_PORTRAIT(CHARA_ID)
LOCALS '= ""
LOCALS += @"◆ %ANAME(CHARA_ID)%"
LOCALS += "
"
LOCALS += @"%DRAW_LINEH(17)%
"
LOCALS += @"体力：%COLOR_BAR_H(BASE:CHARA_ID:体力, MAXBASE:CHARA_ID:体力, 12, カラー_黄, カラー_黄緑, カラー_ダークグレー, 1, @"%UNICODE(0x2588)%")%"
LOCALS += "

"
LOCALS += @"気力：%COLOR_BAR_H(BASE:CHARA_ID:気力, MAXBASE:CHARA_ID:気力, 12, カラー_レッド, カラー_オレンジ, カラー_ダークグレー, 1, @"%UNICODE(0x2588)%")%"
LOCALS += "

"
LOCALS += @"精神：%COLOR_BAR_H(BASE:CHARA_ID:精神力, MAXBASE:CHARA_ID:精神力, 12, カラー_ブルー, カラー_シアン, カラー_ダークグレー, 1, @"%UNICODE(0x2588)%")%"
LOCALS += "

"

HTML_PRINT @"
%LOCALS%
", 1

;-------------------------------------------------
; 能力の情報
;-------------------------------------------------
@NEW_PRINT_STATUS(CHARA_ID)
#DIM CHARA_ID
#DIMS ATR_DIV

ATR_DIV '=  @"rect = '200, 0, 2600, 1600' border = '1px' bcolor='#%CVH(カラー_白)%' padding='2px'"
LOCALS '= ""
LOCALS += "・ステータス"
LOCALS += "
"
LOCALS += @"%DRAW_LINEH(25)%
"
HTML_PRINT @"
%LOCALS%
", 1
CALL NEW_PRINT_STATUS_ABL(CHARA_ID)
CALL NEW_PRINT_STATUS_COMBAT(CHARA_ID)

@NEW_PRINT_STATUS_ABL(CHARA_ID)
#DIM CHARA_ID
#DIM  DYNAMIC SHOW_LIST, 30
#DIM  DYNAMIC ABL_NUM
#DIMS DYNAMIC RANK
#DIMS ATR_DIV

ATR_DIV '=  @"rect = '400, 100, 2600, 1600' border = '0px' bcolor='#%CVH(カラー_白)%' padding='2px'"

VARSET SHOW_LIST, -1
SHOW_LIST:0 = GETNUM(ABL, "戦闘")
SHOW_LIST:1 = GETNUM(ABL, "魔術")
SHOW_LIST:2 = GETNUM(ABL, "身体")
SHOW_LIST:3 = GETNUM(ABL, "器用")
SHOW_LIST:4 = GETNUM(ABL, "知識")
SHOW_LIST:5 = GETNUM(ABL, "観察")
SHOW_LIST:6 = GETNUM(ABL, "歌唱")
SHOW_LIST:7 = GETNUM(ABL, "料理")
SHOW_LIST:8 = GETNUM(ABL, "社交")
SHOW_LIST:9 = GETNUM(ABL, "話術")

LOCALS '= ""
LOCALS += "
"
FOR LOCAL, 0, VARSIZE("SHOW_LIST")
	SIF SHOW_LIST:LOCAL < 0
		CONTINUE
	ABL_NUM = SHOW_LIST:LOCAL
	RANK = %ALPHABET_RANK(ランク_ＳＬＧ, ABL:CHARA_ID:ABL_NUM)%
	LOCALS += @"%ABLNAME:ABL_NUM, 6, LEFT%："
	LOCALS += @"{ABL:CHARA_ID:ABL_NUM, 4, RIGHT}"
	LOCALS += @" %RANK%"
	LOCALS += "
"
NEXT
HTML_PRINT @"
%LOCALS%
", 1

@NEW_PRINT_STATUS_COMBAT(CHARA_ID)
#DIM CHARA_ID
#DIM  DYNAMIC ATK
#DIM  DYNAMIC MAG
#DIM  DYNAMIC DEF
#DIM  DYNAMIC ARMOR
#DIM  DYNAMIC AGL
#DIM  DYNAMIC HATE
#DIM  DYNAMIC CRT
#DIM  DYNAMIC CRT_D
#DIM  DYNAMIC TGT

#DIMS ATR_DIV
ATR_DIV '=  @"rect = '1600, 100, 2400, 1600' border = '0px' bcolor='#%CVH(カラー_白)%' padding='2px'"

CALL CC_CALC_CHARA_STATUS(CHARA_ID)
ATK = DT_CELL_GET("CHARA_STATUS",0 , "ATTACK")
MAG = DT_CELL_GET("CHARA_STATUS",0 , "MAG")
DEF = DT_CELL_GET("CHARA_STATUS",0 , "DEFENCE")
ARMOR = DT_CELL_GET("CHARA_STATUS",0 , "ARMOR")
AGL = DT_CELL_GET("CHARA_STATUS",0 , "AGILITY")
HATE = DT_CELL_GET("CHARA_STATUS",0 , "HATE_RATE")
CRT = DT_CELL_GET("CHARA_STATUS",0 , "CRITICAL_RATE")
CRT_D = DT_CELL_GET("CHARA_STATUS",0 , "CRITICAL_DAMAGE_RATE")
TGT = DT_CELL_GET("CHARA_STATUS",0 , "TARGETING")

LOCALS '= ""
LOCALS += "
"
LOCALS += @"攻撃力　：{ATK, 6, RIGHT}
"
LOCALS += @"魔力　　：{MAG, 6, RIGHT}
"
LOCALS += @"防御力　：{DEF, 6, RIGHT}
"
LOCALS += @"軽減値　：{ARMOR, 6, RIGHT}
"
LOCALS += @"行動力　：{AGL, 6, RIGHT}
"
LOCALS += @"敵視　　：{HATE, 6, RIGHT}
"
LOCALS += @"CRT率　 ：%TOSTR(CRT)+ "%", 6, RIGHT%
"
LOCALS += @"CRT倍率 ：%TOSTR(CRT_D)+ "%", 6, RIGHT%
"
LOCALS += @"脅威選定：%WPN_脅威選定文字列:TGT, 6, RIGHT%
"
HTML_PRINT @"
%LOCALS%
", 1

;-------------------------------------------------
; 衣装の情報
;-------------------------------------------------
@NEW_PRINT_CLOTH(CHARA_ID)
#DIM CHARA_ID
#DIMS ATR_DIV

ATR_DIV '=  @"rect = '2800, 0, 2400, 1600' border = '1px' bcolor='#%CVH(カラー_白)%' padding='2px'"
LOCALS '= ""
LOCALS += "・衣装"
LOCALS += "
"
LOCALS += @"%DRAW_LINEH(23)%
"
FOR LOCAL, 0, CLOTH_PART_NUM - 1
	IF FLAG:ハウジングモード
		CALL GET_CLOTH_NAME(LOCAL, 調教用衣装:CHARA_ID:LOCAL)
	ELSE
		CALL GET_CLOTH_NAME(LOCAL, CLOTH:CHARA_ID:LOCAL)
	ENDIF
	IF RESULTS != "なし"
		LOCALS += @"%CLOTH_PART_NAME:LOCAL, 10, LEFT% - %RESULTS%
"
	ELSE
		LOCALS += @"%CLOTH_PART_NAME:LOCAL, 10, LEFT% ---
"
	ENDIF
NEXT
HTML_PRINT @"
%LOCALS%
", 1

;-------------------------------------------------
; スキルの情報
;-------------------------------------------------
@NEW_PRINT_SKILL(CHARA_ID)
#DIM CHARA_ID
#DIMS ATR_DIV

ATR_DIV '=  @"rect = '200, 1600, 5000, 1200' border = '1px' bcolor='#%CVH(カラー_白)%' padding='2px'"
LOCALS '= ""
LOCALS += "・戦闘スキル"
LOCALS += "
"
LOCALS += @"%DRAW_LINEH(49)%
"
CALL NEW_PRINT_SKILL_PASSIVE(CHARA_ID)
CALL NEW_PRINT_SKILL_ACTIVE(CHARA_ID)
HTML_PRINT @"
%LOCALS%
", 1

@NEW_PRINT_SKILL_PASSIVE(CHARA_ID)
#DIM CHARA_ID
#DIMS ATR_DIV
#DIM  DYNAMIC SKILL_LV
#DIMS DYNAMIC SKILL_STR
#DIM  CONST GENRE = スキル_ジャンル_戦闘
#DIM  CONST MAJOR_GENRE = スキル_大分類_冒険

VARI L_CNT = 1
VARSET SKILL_DEF_LIST
ATR_DIV '=  @"rect = '200, 1800, 5000, 1200' border = '0px' bcolor='#%CVH(カラー_白)%' padding='2px'"
LOCALS '= ""
LOCALS += @"・PASSIVE"
LOCALS += "
"
XML_GET XMLID_SKILL:GENRE, @"//defname[.//category[(text()='BATTLE')]][not(.//subcategory[(text()='ACTIVE')])]/@parentname", SKILL_DEF_LIST
FOR LOCAL ,0 ,RESULT
	SKILL_LV = HAS_SKILL(CHARA_ID, SKILL_DEF_LIST:LOCAL, MAJOR_GENRE)
	IF SKILL_LV
		SKILL_STR += TOHALF(@"<%GET_SKILL_NAME(SKILL_DEF_LIST:LOCAL, MAJOR_GENRE)%Lv{SKILL_LV}> ")
		IF STRLENS(SKILL_STR) > 120 * L_CNT
			SKILL_STR += "
"
			L_CNT ++
		ENDIF
	ENDIF
NEXT
LOCALS += SKILL_STR
HTML_PRINT @"
%LOCALS%
", 1

@NEW_PRINT_SKILL_ACTIVE(CHARA_ID)
#DIM CHARA_ID
#DIMS ATR_DIV
#DIM  DYNAMIC SKILL_LV
#DIMS DYNAMIC SKILL_STR
#DIM  CONST GENRE = スキル_ジャンル_戦闘
#DIM  CONST MAJOR_GENRE = スキル_大分類_冒険

VARI L_CNT = 1
VARSET SKILL_DEF_LIST
ATR_DIV '=  @"rect = '200, 2200, 5000, 1200' border = '0px' bcolor='#%CVH(カラー_白)%' padding='2px'"
LOCALS '= ""
LOCALS += @"・ACTIVE"
LOCALS += "
"
XML_GET XMLID_SKILL:GENRE, @"//defname[.//category[(text()='BATTLE')]][.//subcategory[(text()='ACTIVE')]]/@parentname", SKILL_DEF_LIST
FOR LOCAL ,0 ,RESULT
	;スキルスロットにセットされていないアクティブスキルは表示しない
	SIF LIST_INDEXOF(_LIST_ACTIVE_SKILL_SLOT:CHARA_ID:0, SKILL_DEF_LIST:LOCAL) == -1
		CONTINUE
	SKILL_LV = HAS_SKILL(CHARA_ID, SKILL_DEF_LIST:LOCAL, MAJOR_GENRE)
	IF SKILL_LV
		SKILL_STR += TOHALF(@"<%GET_SKILL_NAME(SKILL_DEF_LIST:LOCAL, MAJOR_GENRE)%Lv{SKILL_LV}> ")
		IF STRLENS(SKILL_STR) > 120 * L_CNT
			SKILL_STR += "
"
			L_CNT ++
		ENDIF
	ENDIF
NEXT
LOCALS += SKILL_STR
HTML_PRINT @"
%LOCALS%
", 1

;-------------------------------------------------
; 装備の情報
;-------------------------------------------------
@NEW_PRINT_EQUIP(CHARA_ID)
#DIM CHARA_ID
#DIMS ATR_DIV
#DIM  DYNAMIC STATUS_IDX
#DIM  DYNAMIC WEAPON_DID
#DIM  DYNAMIC SLOT_ID
#DIMS DYNAMIC WEAPON_NAME
#DIMS DYNAMIC SKILL_NAME
#DIMS DYNAMIC SKILL_DEF_NAME
#DIMS DYNAMIC WPN_SKILL_DEF_LIST, VARSIZE("SKILL_DEF_LIST")
#DIMS DYNAMIC DIC_WPN_SKILL
#DIMS DYNAMIC TOOLTIP
#DIM  DYNAMIC SKILL_LV
#DIMS CONST  WPN_STATUS_NAME_SHORT = "攻撃", "防御", "軽減", "魔力", "行動", "敵視", "選敵"
;ステータスの表示順序
{
	#DIMS CONST COLUMN_ORDER =
		"ATTACK"
		, "DEFENCE"
		, "ARMOR"
		, "MAG"
		, "AGILITY"
		, "HATE_RATE"
		, "TARGETING"
}

ATR_DIV '=  @"rect = '200, 2800, 8250, 1200' border = '1px' bcolor='#%CVH(カラー_白)%' padding='2px'"
LOCALS '= ""
LOCALS += @"・%"武器", 34, LEFT%"

;ステータスヘッダ
LOCALS += @""
FOR LOCAL, 0, WPN_MAX_STATUSNUM
	LOCALS += @"%WPN_STATUS_NAME_SHORT:LOCAL, 8, LEFT%"
NEXT
LOCALS += "スキル"
LOCALS += ""

LOCALS += "
"
LOCALS += @"%DRAW_LINEH(80)%
"
DT_SELECT "WEAPON_STOCK", @"EQUIP_CHARA_ID = {CHARA_ID} AND EQUIP_TYPE = 0"
IF RESULT
	WEAPON_DID = RESULT:1
	CALL GET_WEAPON_PRINT_NAME(WEAPON_DID)
	WEAPON_NAME = %RESULTS%
	LOCALS += @"<button value = '[CHANGE_WEAPON:{WEAPON_DID}][EDIT_SLOT_ID:0]'>・%WEAPON_NAME, 30, LEFT%</button>"
	CALL GET_WEAPON_STATUS_FROM_STOCK_TABLE(,WEAPON_DID)
	FOR LOCAL, 0, WPN_MAX_STATUSNUM
		STATUS_IDX = FINDELEMENT(WPN_STATUS_NAME_ENG, COLUMN_ORDER:LOCAL)
		IF COLUMN_ORDER:LOCAL != "TARGETING"
			LOCALS += @"{WPN_STATUS:STATUS_IDX, 8, RIGHT}"
		ELSE
			LOCALS += @"%WPN_脅威選定文字列:(WPN_STATUS:STATUS_IDX), 8, RIGHT%"
		ENDIF
	NEXT
	LOCALS += "　　"
	;武器スキル_アクティブ
	CALL GET_EQUIP_SKILL_LIST_STR(WEAPON_DID, 武器スキル_アクティブ)
	LOCALS += CONV_TAG2H(RESULTS)

	;武器スキル_パッシブ
	CALL GET_EQUIP_SKILL_LIST_STR(WEAPON_DID, 武器スキル_パッシブ)
	LOCALS += CONV_TAG2H(RESULTS)

	LOCALS += "
"
ELSE
	LOCALS += @"<button value = '[CHANGE_WEAPON:{0}][EDIT_SLOT_ID:0]'>・ ---</button>
"
ENDIF
LOCALS += "
"

;レリック
LOCALS += "・レリック"
LOCALS += "
"
LOCALS += @"%DRAW_LINEH(80)%
"
FOR SLOT_ID, 0, 2
	DT_SELECT "WEAPON_STOCK", @"EQUIP_CHARA_ID = {CHARA_ID} AND EQUIP_TYPE = 1 AND EQUIP_SLOT_ID = {衣装部位_ﾚﾘｯｸ1 + SLOT_ID}"
	IF RESULT
		WEAPON_DID = RESULT:1
		CALL GET_WEAPON_PRINT_NAME(WEAPON_DID)
		WEAPON_NAME = %RESULTS%
		LOCALS += @"・<button value = '[CHANGE_RELIC:{WEAPON_DID}][EDIT_SLOT_ID:{衣装部位_ﾚﾘｯｸ1 + SLOT_ID}]'>%WEAPON_NAME, 30, LEFT%</button>"
		CALL GET_WEAPON_STATUS_FROM_STOCK_TABLE(,WEAPON_DID)
		FOR LOCAL, 0, WPN_MAX_STATUSNUM
			STATUS_IDX = FINDELEMENT(WPN_STATUS_NAME_ENG, COLUMN_ORDER:LOCAL)
			IF COLUMN_ORDER:LOCAL != "TARGETING"
				LOCALS += @"{WPN_STATUS:STATUS_IDX, 8, RIGHT}"
			ELSE
				LOCALS += TOSTR_SPACE(8)
			ENDIF
		NEXT
		LOCALS += "　　"
		;武器スキル_アクティブ
		CALL GET_EQUIP_SKILL_LIST_STR(WEAPON_DID, 武器スキル_アクティブ)
		LOCALS += CONV_TAG2H(RESULTS)

		;武器スキル_パッシブ
		CALL GET_EQUIP_SKILL_LIST_STR(WEAPON_DID, 武器スキル_パッシブ)
		LOCALS += CONV_TAG2H(RESULTS)
		LOCALS += "
"
	ELSE
		LOCALS += @"・<button value = '[CHANGE_RELIC:{0}][EDIT_SLOT_ID:{衣装部位_ﾚﾘｯｸ1 + SLOT_ID}]'> ---</button>
"
	ENDIF
NEXT

HTML_PRINT @"
%LOCALS%
", 1