/*============================================================================
	アクションゲーム ACTION.FX
------------------------------------------------------------------------------
									Program TAGOCHAN, Graphic Kazushi.T.
============================================================================*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/bios.h>
#include <sys/fcntl.h>
#include <sys/key.h>
#include <sys/disp.h>
#include "wsSprite.h"
#include "wsBg.h"
#include "Evil.h"
#include "System.h"
#include "Title.h"
#include "Option.h"
#include "Game.h"
#include "Define.h"

int main( int argc, char *args[] )
{
	/* 変数初期化 */
	memset( &SystemInf, 0, sizeof( SYSTEMINF ) );
	SystemInf.nPhase = PHASE_TITLE;
	SystemInf.nInvincibility = 0;
	/* サウンド初期化 */
	wsSndInit();
	wsSndSetSeFile( "/rom0/SE.FR" );
	/* 横モードマーク表示 */
	lcd_set_segments( LCDSEG_HORIZONTAL );
	/* 画面表示 */
	lcd_set_sleep( 1 );
	/* メインルーチン */
	while( 1 ) {
		switch( SystemInf.nPhase ) {
			case PHASE_TITLE:
				/* タイトル */
				Title();
				break;
			case PHASE_TITLEMENU:
				/* タイトル */
				TitleMenu();
				break;
			case PHASE_OPTION:
				/* オプション */
				/* Option(); 未完成 */
				break;
			case PHASE_SELECT:
				/* キャラクタ選択 */
				SystemInf.nPhase = PHASE_GAME;	/* ゲーム */
				break;
			case PHASE_GAME:
				/* ゲーム */
				Game();
				break;
			case PHASE_EXIT:
				/* ゲーム終了 */
				break;
		}
		if ( SystemInf.nPhase == PHASE_EXIT ) {
			break;
		}
	}
	/* サウンド開放 */
	wsSndRelease();
	/* グラフィックモードを白黒モードに設定 */
	wsBgInit( 0 );
	return( 0 );
}
