/*============================================================================*/
/*
	ww_util.c

	WonderWitchユーティリティ

	Version		Date			Design		Comment
	--------------------------------------------------------------------
	1.00		2000/08/22		Bonz

*/
/*============================================================================*/

/*==============================================================================
//	INCLUDE
//============================================================================*/
#include <sys/types.h>
#include <sys/bios.h>
#include "ww_util.h"

/*==============================================================================
//	DEFINE
//============================================================================*/
#define BIOS_INLINE

/*==============================================================================
//	TYPE DEFINE
//============================================================================*/

/*==============================================================================
//	ENUM
//============================================================================*/

/*==============================================================================
//	RESOURCE
//============================================================================*/

/*==============================================================================
//	GLOBAL
//============================================================================*/

/*==============================================================================
//	PROTTYPE
//============================================================================*/

/*==============================================================================
//	FUNCTION
//============================================================================*/
/*------------------------------------------------------------------------------
//	デフォルトパレット設定
//----------------------------------------------------------------------------*/
void WWSYS_SetDefPalette(void)
{
	/* ＬＣＤパレットデータ初期化 WWitch のデフォルト*/
	lcd_set_color(0x6420, 0xfca8);
	/* キャラクターパレットデータ初期化 WWitch のデフォルト*/
	palette_set_color(0,  0x7530);
	palette_set_color(1,  0x7532);
	palette_set_color(2,  0x7000);
	palette_set_color(3,  0x7002);
	palette_set_color(4,  0x7300);
	palette_set_color(5,  0x1000);
	palette_set_color(6,  0x0000);
	palette_set_color(7,  0x0040);
	palette_set_color(8,  0x7530);
	palette_set_color(9,  0x6406);
	palette_set_color(10, 0x4506);
	palette_set_color(11, 0x3030);
	palette_set_color(12, 0x7400);
	palette_set_color(13, 0x7000);
	palette_set_color(14, 0x4420);
	palette_set_color(15, 0x0100);
}


/*------------------------------------------------------------------------------
//	テキスト初期化
//----------------------------------------------------------------------------*/
void WWSYS_InitText(int scr, int mode, int pal, int x, int y, int w, int h, int no)
{
	text_set_screen(scr); 					/* テキストスクリーン設定 */
	text_set_mode(mode);					/* テキストモード設定 */
	text_window_init(x, y, w, h, no);		/* テキスト画面初期化 */
	text_set_palette(pal);		/* テキストパレット設定 */
}


/*------------------------------------------------------------------------------
//	スクリーン初期化
//----------------------------------------------------------------------------*/
void WWSYS_InitScreen(unsigned short no, unsigned short pal1, unsigned short pal2)
{
	/* 空白キャラ */
	static WORD	brank[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, };
	
	/* 画面クリア */
	font_set_colordata(no, 1, brank);
	screen_fill_char(SCREEN1, 0, 0, 32, 32, pal1 | no);
	screen_fill_char(SCREEN2, 0, 0, 32, 32, pal2 | no);
}


/*------------------------------------------------------------------------------
//	カメラ位置初期化
//	int		入力：スクリーン１カメラＸ座標
//	int		入力：スクリーン１カメラＹ座標
//	int		入力：スクリーン２カメラＸ座標
//	int		入力：スクリーン２カメラＹ座標
//----------------------------------------------------------------------------*/
void WWSYS_InitCamera(int x1, int y1, int x2, int y2)
{
	screen_set_scroll(SCREEN1, x1, y1);		/* スクリーン１初期位置 */
	screen_set_scroll(SCREEN2, x2, y2);		/* スクリーン２初期位置 */
}


