//#define APPLET
/*-------------------------------------
タイトル:勇者で行こう!Ω ver 0.03
制作:ハルーポッター
HomePage: http://www.ar.wakwak.com/~harupotter/
動作機種:imode503i,504iシリーズ、Javaアプレット
[コンパイル方法]
アプレットにする場合は、一番上の行を
#define APPLET
とする。
iアプリにする場合は、
//#define APPLET
とする。
そして、PPP(Pamuow Preprocessor)を使用する。DL先・・・http://www.and.or.jp/~pamulow/ppp/ppp.html
[使い方]
ppp 入力フォルダ 出力フォルダ
例:ppp . src
[アプレットの場合にHTMLファイルに記述するタグ]
ーーーーーー---------------------------*/
#ifdef APPLET
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
#else
import com.nttdocomo.ui.*;
#endif
//セルクラス
class Cell{
int gra;//グラフィックデータ
int event;//イベント
boolean move_flag;//通過可能フラグ
Cell(int a,int b,boolean c){
gra=a;event=b;move_flag=c;
}
}
//キャラクタークラス
class Chara{
int gra;//グラフィックデータ
int x,y;//マップ上の座標
int map;//登場するマップ
String talk[];//会話
Chara(int a,int d,int b,int c,String str){
gra=a;x=b;y=c;map=d;
talk=parseString(str,'\t');
}
//文字列を任意の文字で分割
String[] parseString(String str,char sep) {
int i,j,size;
String[] result;
//最後尾に分割文字
if (str.equals("")||str.charAt(str.length()-1)!=sep) str+=sep;
//サイズを得る
size=0;
i=str.indexOf(sep);
while (i>=0) {
size++;
i=str.indexOf(sep,i+1);
}
//分割する
result=new String[size];
size=0;
j=0;
i=str.indexOf(sep);
while (i>=0) {
result[size++]=str.substring(j,i);
j=i+1;
i=str.indexOf(sep,j);
}
return result;
}
}
#ifndef APPLET
//ポイントクラス
class Point{
int x,y;
Point(int a,int b){x=a;y=b;}
};
//本体
public class Rpg extends IApplication{
//アプリの開始
public void start() {
Display.setCurrent(new RpgCanvas());
}
}
#endif
#ifdef APPLET
public class Rpg extends Applet implements KeyListener{
#else
class RpgCanvas extends Canvas{
#endif
Graphics bufferg;
Image hero;//勇者画像
#ifdef APPLET
Image buffer;//バッファ
AudioClip se[] = new AudioClip[5];//効果音
#endif
final int WIDTH=8;
final int HEIGHT=6;
final int WPIXEL=120;
final int HPIXEL=130;
final int MAPNUM=15;//マップパーツの数
final int CHARANUM=5;//キャラクターの数
final int CHARAIMAGENUM=2;//キャラクター画像の数
Image map_images[] = new Image[MAPNUM];//マップパーツ画像
Image chara_images[] = new Image[CHARAIMAGENUM];//キャラクター画像
Point map_start = new Point(0,0);//マップ開始座標
Point limit = new Point(0,0);//限界値
Cell celldata[] = {
new Cell(0,0,true),
new Cell(1,0,true),
new Cell(2,0,true),
new Cell(3,1,true),//ハウスワープ
new Cell(4,0,false),
new Cell(5,0,true),
new Cell(6,0,true),
new Cell(7,4,true),//洞窟
new Cell(8,0,false),
new Cell(10,0,false),
new Cell(9,0,true),
new Cell(1,2,true),//外ワープ
new Cell(11,3,true),//手紙
new Cell(12,0,true),//壁
new Cell(13,0,true),//地下
new Cell(14,11,true),//宝
new Cell(1,5,true),//洞窟から外へ
};
//キャラクターデータ
Chara charas[]={
new Chara(0,0,5,2,"あべし お前はもうあべし"),
new Chara(0,0,8,3,"僕はるきち"),
new Chara(1,0,6,8,"勇者って職業?"),
new Chara(0,1,5,2,"ひでぶ"),
new Chara(1,2,6,2,"冗談じゃないよ"),
};
//マップデータ(10*10)
int mapdata[][] = {
{1,1,1,1,1, 1,1,2,4,4},
{1,1,1,1,2, 1,1,2,1,1},
{1,1,1,3,1, 1,1,2,1,1},
{1,1,1,1,1, 1,5,2,1,1},
{1,4,1,1,2, 4,1,2,1,1},
{1,1,7,1,1, 1,2,2,1,1},
{1,1,2,1,1, 1,8,8,1,1},
{1,1,1,1,1, 1,8,8,1,1},
{1,1,2,1,1, 1,2,2,1,1},
{1,1,2,1,1, 1,2,2,1,1},
};
//家マップデータ(7*6)
int housemapdata[][] = {
{ 9, 9, 9, 9, 9, 9, 9},
{ 9,10,10,12,10,10, 9},
{ 9,10,10,10,10,10, 9},
{ 9,10,10,10,10,10, 9},
{ 9,10,10,10,10,10, 9},
{ 9, 9,11,11,11, 9, 9},
};
int maze_mapdata[][]={
{0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x10,0x0a,0x0a,0x0a,0x0a,0x0a,0x09,0x09,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x10,0x0a,0x0a,0x0e,0x0a,0x0a,0x0a,0x09,0x09,0x0d,0x0d,0x0d,0x0d,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x0e,0x0e,0x0a,0x0a,0x0a,0x0a,0x0a,0x09,0x0d,0x0d,0x0d,0x0d,0x0d,0x0a,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x0a,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x0a,0x0e,0x0a,0x09,0x0a,0x0a,0x0a,0x09,0x0d,0x0d,0x0d,0x0d,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x0a,0x0a,0x09,0x0a,0x09,0x0a,0x0a,0x09,0x0d,0x0d,0x0d,0x0d,0x0d,0x0a,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x0a,0x0a,0x09,0x0a,0x09,0x0a,0x0a,0x09,0x0d,0x0d,0x0d,0x0d,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x09,0x0a,0x0a,0x09,0x0a,0x0a,0x0a,0x09,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x0a,0x0a,0x0a,0x0e,0x0e,0x0e,0x0e,0x0e,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x0a,0x0e,0x0e,0x0e,0x0a,0x0e,0x0a,0x0e,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x0e,0x0e,0x09,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x09,0x09,0x09,0x09,0x09,0x0a,0x0a,0x0a,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x09,0x09,0x09,0x09,0x09,0x09,0x0a,0x0a,0x0f,0x09,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x0a,0x09,0x0a,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
};
int now_map,now_string,now_chara;//現在マップ、現在文字列、現在話中キャラ
Point My = new Point(-2,-2);//マップ開始座標
boolean PushFlag=false;//キーを押した状態であるか
//初期化
#ifdef APPLET
public void init(){
int i;
//--------ロード-----------
hero=getImage(getDocumentBase(),"hero.gif");//主人公
//キャラクター
for(i=1;i<=CHARAIMAGENUM;i++){
chara_images[i-1]=getImage(getDocumentBase(),"chara"+i+".gif");
}
//マップ
for(i=1;i<=MAPNUM;i++){
map_images[i-1]=getImage(getDocumentBase(),"map"+i+".gif");
}
se[0] = getAudioClip(getDocumentBase(),"se1.au");
se[1] = getAudioClip(getDocumentBase(),"se2.au");
addKeyListener(this);
requestFocus();//フォーカス取得
buffer = createImage(WPIXEL,HPIXEL);
#else
//コンストラクタ
RpgCanvas(){
int i;
setSoftLabel(SOFT_KEY_1,"勇者");
setSoftLabel(SOFT_KEY_2,"愛");
//ロード
try{
MediaImage m;
m=MediaManager.getImage("resource:///hero.gif");
m.use();
hero=m.getImage();
//マップ
for(i=1;i<=MAPNUM;i++){
m=MediaManager.getImage("resource:///map"+i+".gif");
m.use();
map_images[i-1]=m.getImage();
}
//キャラクター
for(i=1;i<=CHARAIMAGENUM;i++){
m=MediaManager.getImage("resource:///chara"+i+".gif");
m.use();
chara_images[i-1]=m.getImage();
}
}catch(Exception e){e.printStackTrace();}
#endif
now_map=0;
now_string=1;
}
//描画
public void paint(Graphics g){
int i,j;
int map;
String str,str2;
//描画領域のロック
#ifdef APPLET
if(bufferg==null){bufferg=buffer.getGraphics();}
#else
bufferg=g;
bufferg.lock();
#endif
//背景色の設定
#ifdef APPLET
bufferg.setColor(Color.black);
#else
bufferg.setColor(bufferg.getColorOfName(bufferg.BLACK));
#endif
bufferg.fillRect(0,0,WPIXEL,HPIXEL);
//背景(マップ)
int k,l;
switch(now_map){
case 0:limit.x=10;limit.y=10;break;
case 1:limit.x=7;limit.y=6;break;
case 2:limit.x=64;limit.y=32;break;
}
for(i=My.x,k=0;i=limit.x || j>=limit.y){map=12;}
else{
switch(now_map){
case 0:map=celldata[mapdata[j][i]].gra;break;
case 1:map=celldata[housemapdata[j][i]].gra;break;
case 2:map=celldata[maze_mapdata[j][i]].gra;break;
default:map=0;break;
}
}
#ifdef APPLET
bufferg.drawImage(map_images[map],k*16,l*16,this);
#else
bufferg.drawImage(map_images[map],k*16,l*16);
#endif
}
}
//フォント色の設定
#ifdef APPLET
bufferg.setColor(Color.white);
#else
bufferg.setColor(bufferg.getColorOfName(bufferg.WHITE));
#endif
switch(now_string){
case 1:
str="十字キー:移動";
#ifdef APPLET
str2="Zキー:会話、調べる";
#else
str2="セレクトキー:会話、調べる";
#endif
break;
case 2:
str="手紙がある。▽";
str2="";
break;
case 3:
str="「果たし状。";
str2="明日19時、駅前にて。」";
break;
case 11:
str="宝だ。中に紙切れが。";
str2="『工事中』";
break;
//キャラクター
case 32:
str=charas[now_chara].talk[0];
if(charas[now_chara].talk.length==2){
str2=charas[now_chara].talk[1];
}else{str2="";}
break;
default:str="";str2="";break;
}
bufferg.drawString(str,2,130-21);
bufferg.drawString(str2,2,130-7);
//主人公描画
#ifdef APPLET
bufferg.drawImage(hero,16*3,16*3,this);
#else
bufferg.drawImage(hero,16*3,16*3);
#endif
//キャラクター描画
for(i=0;i= My.x && charas[i].x=My.y && charas[i].y=2)return false;//会話中の時
//限界値
if(x == -1 || y == -1 || x == limit.x || y == limit.y)return false;
switch(now_map){
case 0:cell = mapdata[y][x];break;
case 1:cell = housemapdata[y][x];break;
case 2:cell = maze_mapdata[y][x];break;
default:cell=0;break;
}
if(celldata[cell].move_flag){
//キャラクターがいる場合
for(i=0;i