/*
	ネームチェンジ時に転送  
*/
#include	<ultra64.h>

#include "../../ot_system.h"
#include "../../sot_world.h"
#include "select1p.tex"
#include "../../tex_data/cfgname/f_waku3.tex"

/* 日本語メッセージ */
#include "jf_rename18.tex"
#include "jf_turn8.tex"
#include "jf_space8.tex"
#include "jf_original8.tex"
#include "jf_end8.tex"

#define	KZ_RM_CLEAR_CVG(clk)					\
	FORCE_BL | CVG_X_ALPHA | IM_RD | CVG_DST_FULL |	 	\
	GBL_c##clk(G_BL_CLR_MEM, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)
/* ======================================================================= */
/* View Port */
static Vp vp = {
	SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0,	/* scale */
	SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0,	/* translate */
};
static Vp vpMachine0 = {
	SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0,	/* scale */
	(DISPLAY_X1_1P+19+63/2)<<2, (DISPLAY_Y1_1P+38+40/2)<<2, G_MAXZ/2, 0,	/* translate */
} ;
static Vp vpMachine1 = {
	SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0,	/* scale */
	(DISPLAY_X1_1P+86+63/2)<<2, (DISPLAY_Y1_1P+38+40/2)<<2, G_MAXZ/2, 0,	/* translate */
} ;
static Vp vpMachine2 = {
	SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0,	/* scale */
	(DISPLAY_X1_1P+153+63/2)<<2, (DISPLAY_Y1_1P+38+40/2)<<2, G_MAXZ/2, 0,	/* translate */
} ;
static Vp vpMachine3 = {
	SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0,	/* scale */
	(DISPLAY_X1_1P+220+63/2)<<2, (DISPLAY_Y1_1P+38+40/2)<<2, G_MAXZ/2, 0,	/* translate */
} ;
/* ======================================================================= */
/*
	ＢＧ
*/
Gfx dlCfgNameBG[] = {
	/***********************************************************************
	 	Setting RSP
	************************************************************************/
	gsSPClearGeometryMode( 0xffffffff ),
	gsSPViewport( &vp ),
	gsSPTexture( 0, 0, 0, 0, G_OFF ),
	/***********************************************************************
	 	Setting RDP
	************************************************************************/
	gsDPPipeSync(),
	gsDPSetCycleType( G_CYC_1CYCLE ),
	gsDPSetPrimColor( 0, 0, 0, 0, 0, 255 ),
	gsDPSetCombineMode( G_CC_PRIMITIVE, G_CC_PRIMITIVE ),
	gsDPSetRenderMode( G_RM_OPA_SURF, G_RM_OPA_SURF2 ),
	gsDPSetAlphaCompare( G_AC_NONE ),

	/***********************************************************************
	 	Draw Black Box
	************************************************************************/
    gsDPFillRectangle( DISPLAY_X1 +  19, DISPLAY_Y1 + 28,
					   DISPLAY_X1 +  19 + 63 - 1, DISPLAY_Y1 + 28 + 40 - 1 ),
    gsDPFillRectangle( DISPLAY_X1 +  86, DISPLAY_Y1 + 28,
					   DISPLAY_X1 +  86 + 63 - 1, DISPLAY_Y1 + 28 + 40 - 1 ),
    gsDPFillRectangle( DISPLAY_X1 + 153, DISPLAY_Y1 + 28,
					   DISPLAY_X1 + 153 + 63 - 1, DISPLAY_Y1 + 28 + 40 - 1 ),
    gsDPFillRectangle( DISPLAY_X1 + 220, DISPLAY_Y1 + 28,
					   DISPLAY_X1 + 220 + 63 - 1, DISPLAY_Y1 + 28 + 40 - 1 ),

	gsSPEndDisplayList()
};

/* ======================================================================= */
/*
	カーソルの初期化
*/
Gfx dlCfgNameLoadMCur[] = {
	/***********************************************************************
	 	Setting RSP
	************************************************************************/
	gsSPClearGeometryMode( 0xffffffff ),
	gsSPViewport( &vp ),
	gsSPTexture( 0x8000, 0x8000, G_TX_RENDERTILE, 0, G_ON ),
	/***********************************************************************
	 	Setting RDP
	************************************************************************/
	gsDPPipeSync(),
	gsDPSetCycleType( G_CYC_1CYCLE ),
	gsDPSetRenderMode( G_RM_XLU_SURF, G_RM_XLU_SURF2 ),
	gsDPSetCombineMode( G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM ),
	gsDPSetAlphaCompare( G_AC_NONE ),

	gsDPSetTextureLOD( G_TL_TILE ),
	gsDPSetTextureLUT( G_TT_NONE ),
	gsDPSetTextureDetail( G_TD_CLAMP ),
	gsDPSetTexturePersp( G_TP_NONE ),
	gsDPSetTextureFilter( G_TF_POINT ),
	gsDPSetTextureConvert( G_TC_FILT ),
	/***********************************************************************
	 	Setting RDP
	************************************************************************/
	gsDPLoadTextureTile( texSelect1p_CfgName, G_IM_FMT_IA, G_IM_SIZ_8b,
		63, 40,
		0, 0,
		62, 39,
		0,
		G_TX_CLAMP, G_TX_CLAMP,
		G_TX_NOMASK, G_TX_NOMASK,
		G_TX_NOLOD, G_TX_NOLOD ),

	gsSPEndDisplayList()
};
/* ======================================================================= */
/*
	ジェットのビューポート設定
*/
Gfx dlCfgNameSetMachineView0[] = {
	gsSPViewport( &vpMachine0 ),

	gsSPEndDisplayList()
};
Gfx dlCfgNameSetMachineView1[] = {
	gsSPViewport( &vpMachine1 ),

	gsSPEndDisplayList()
};
Gfx dlCfgNameSetMachineView2[] = {
	gsSPViewport( &vpMachine2 ),

	gsSPEndDisplayList()
};
Gfx dlCfgNameSetMachineView3[] = {
	gsSPViewport( &vpMachine3 ),

	gsSPEndDisplayList()
};
/* ======================================================================= */
/*
	枠ロード
*/
Gfx dlCfgNameLoadWaku[] = {
	gsDPLoadTextureBlock( texWakuSmall,
		G_IM_FMT_RGBA, G_IM_SIZ_16b,
		16, 14,	0,
		G_TX_CLAMP, G_TX_CLAMP,
		G_TX_NOMASK, G_TX_NOMASK,
		G_TX_NOLOD, G_TX_NOLOD ),

	/* 文字入力 */
	/* Line 0 */
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 0) << 2, (DISPLAY_Y1 + 96 + 15 * 0) << 2,
		(DISPLAY_X1 + 25 + 17 * 0 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 0 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 1) << 2, (DISPLAY_Y1 + 96 + 15 * 0) << 2,
		(DISPLAY_X1 + 25 + 17 * 1 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 0 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 2) << 2, (DISPLAY_Y1 + 96 + 15 * 0) << 2,
		(DISPLAY_X1 + 25 + 17 * 2 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 0 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 3) << 2, (DISPLAY_Y1 + 96 + 15 * 0) << 2,
		(DISPLAY_X1 + 25 + 17 * 3 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 0 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 4) << 2, (DISPLAY_Y1 + 96 + 15 * 0) << 2,
		(DISPLAY_X1 + 25 + 17 * 4 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 0 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 5) << 2, (DISPLAY_Y1 + 96 + 15 * 0) << 2,
		(DISPLAY_X1 + 25 + 17 * 5 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 0 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 6) << 2, (DISPLAY_Y1 + 96 + 15 * 0) << 2,
		(DISPLAY_X1 + 25 + 17 * 6 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 0 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),

	/* Line 1 */
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 0) << 2, (DISPLAY_Y1 + 96 + 15 * 1) << 2,
		(DISPLAY_X1 + 25 + 17 * 0 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 1 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 1) << 2, (DISPLAY_Y1 + 96 + 15 * 1) << 2,
		(DISPLAY_X1 + 25 + 17 * 1 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 1 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 2) << 2, (DISPLAY_Y1 + 96 + 15 * 1) << 2,
		(DISPLAY_X1 + 25 + 17 * 2 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 1 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 3) << 2, (DISPLAY_Y1 + 96 + 15 * 1) << 2,
		(DISPLAY_X1 + 25 + 17 * 3 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 1 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 4) << 2, (DISPLAY_Y1 + 96 + 15 * 1) << 2,
		(DISPLAY_X1 + 25 + 17 * 4 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 1 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 5) << 2, (DISPLAY_Y1 + 96 + 15 * 1) << 2,
		(DISPLAY_X1 + 25 + 17 * 5 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 1 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 6) << 2, (DISPLAY_Y1 + 96 + 15 * 1) << 2,
		(DISPLAY_X1 + 25 + 17 * 6 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 1 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),

	/* Line 2 */
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 0) << 2, (DISPLAY_Y1 + 96 + 15 * 2) << 2,
		(DISPLAY_X1 + 25 + 17 * 0 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 2 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 1) << 2, (DISPLAY_Y1 + 96 + 15 * 2) << 2,
		(DISPLAY_X1 + 25 + 17 * 1 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 2 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 2) << 2, (DISPLAY_Y1 + 96 + 15 * 2) << 2,
		(DISPLAY_X1 + 25 + 17 * 2 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 2 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 3) << 2, (DISPLAY_Y1 + 96 + 15 * 2) << 2,
		(DISPLAY_X1 + 25 + 17 * 3 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 2 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 4) << 2, (DISPLAY_Y1 + 96 + 15 * 2) << 2,
		(DISPLAY_X1 + 25 + 17 * 4 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 2 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 5) << 2, (DISPLAY_Y1 + 96 + 15 * 2) << 2,
		(DISPLAY_X1 + 25 + 17 * 5 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 2 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 6) << 2, (DISPLAY_Y1 + 96 + 15 * 2) << 2,
		(DISPLAY_X1 + 25 + 17 * 6 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 2 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),

	/* Line 3 */
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 0) << 2, (DISPLAY_Y1 + 96 + 15 * 3) << 2,
		(DISPLAY_X1 + 25 + 17 * 0 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 3 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 1) << 2, (DISPLAY_Y1 + 96 + 15 * 3) << 2,
		(DISPLAY_X1 + 25 + 17 * 1 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 3 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 2) << 2, (DISPLAY_Y1 + 96 + 15 * 3) << 2,
		(DISPLAY_X1 + 25 + 17 * 2 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 3 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 3) << 2, (DISPLAY_Y1 + 96 + 15 * 3) << 2,
		(DISPLAY_X1 + 25 + 17 * 3 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 3 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 4) << 2, (DISPLAY_Y1 + 96 + 15 * 3) << 2,
		(DISPLAY_X1 + 25 + 17 * 4 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 3 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 5) << 2, (DISPLAY_Y1 + 96 + 15 * 3) << 2,
		(DISPLAY_X1 + 25 + 17 * 5 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 3 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),
	gsSPTextureRectangle(
		(DISPLAY_X1 + 25 + 17 * 6) << 2, (DISPLAY_Y1 + 96 + 15 * 3) << 2,
		(DISPLAY_X1 + 25 + 17 * 6 + 16) << 2, (DISPLAY_Y1 + 96 + 15 * 3 + 14) << 2,
		G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10 ),

	gsSPEndDisplayList()
};

/* ======================================================================= */
/*
	カバレッジのクリア
*/
Gfx dlCfgNameClearCvg[] = {
	gsDPPipeSync(),
	gsDPSetCycleType( G_CYC_1CYCLE ),
	gsDPPipelineMode( G_PM_NPRIMITIVE ),
	gsDPSetRenderMode( KZ_RM_CLEAR_CVG(1), KZ_RM_CLEAR_CVG(2) ),
	gsDPSetCombineMode( G_CC_SHADE, G_CC_SHADE ),
	gsDPSetAlphaCompare( G_AC_NONE ),
	gsDPSetFillColor( 0xFFFFFFFF ),

	gsDPFillRectangle( DISPLAY_X1 + 152, DISPLAY_Y1 + 76, DISPLAY_X1 + 154, DISPLAY_Y1 + 196 ),
	gsDPFillRectangle( DISPLAY_X1 + 281, DISPLAY_Y1 + 76, DISPLAY_X1 + 283, DISPLAY_Y1 + 196 ),
	gsDPFillRectangle( DISPLAY_X1 + 153, DISPLAY_Y1 + 194, DISPLAY_X1 + 283, DISPLAY_Y1 + 196 ),

	gsSPEndDisplayList()
};

/* ======================================================================= */
