#define APPLET
/*-------------------------------------
タイトル:勇者で行こう!Ω ver 0.04
制作:ハルーポッター
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;//登場するマップ
boolean move_flag;//通過可能か
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
#ifdef APPLET
Image buffer;//バッファ
AudioClip se[] = new AudioClip[5];//効果音
#endif
final int WIDTH=8;
final int HEIGHT=5;
final int WPIXEL=120;
final int HPIXEL=130;
final int MAPNUM=15;//マップパーツの数
final int CHARANUM=12;//キャラクターの数
final int CHARAIMAGENUM=5;//キャラクター画像の数
final int INIT_X=3,INIT_Y=2;//勇者の位置
final int UP=0,DOWN=1,LEFT=2,RIGHT=3;//方向定義
int move_dir;//向いている方向(0123)
Image map_images[] = new Image[MAPNUM];//マップパーツ画像
Image chara_images[] = new Image[CHARAIMAGENUM];//キャラクター画像
Graphics bufferg;
Image hero[]=new Image[4];//勇者画像
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,8,2,"僕はるきち。 ねえ、最近思うんだ けどさ 年を取るにつれて 時間が経つのが 早く感じるんだよね"),
new Chara(0,2,6,2,"冗談じゃないよ"),
new Chara(1,0,5,2,"あべし お前はもうあべし"),
new Chara(1,0,6,8,"勇者って職業?"),
new Chara(1,1,5,2,"ひでぶ お前はもうひでぶ"),
new Chara(1,0,5,6,"僕、数学博士。 早速問題! 赤・赤・黒・黒の 4枚のトランプを 裏返して置いてあ ります。 この中から2枚を 同時に開いて、そ れが同じ色(黒黒 か赤赤)である確 率は? 答えは三分の一。 2つ同時というのが 注意点。結局は、1 回目、2回目という 順番で開くのと同じ。 1回目に赤だった場 合は、2回目は「黒 ・黒・赤」の中から 赤を選ぶから。 "),
new Chara(2,0,10,2,"話しかけないで ウゼエ"),
new Chara(2,0,11,2,"うるせえ"),
new Chara(2,2,8,8,"こんにちは ヒカル17歳女子高生"),
new Chara(2,0,30,20,"彼と待ち合わせ中 なの"),
new Chara(3,1,3,1,"手紙がある。 「果たし状。明日19時、 駅前にて。」"),
new Chara(4,2,8,12,"宝だ。中に紙切れが。 『工事中』"),
};
//マップデータ(32*24)
int mapdata[][] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x04,0x00,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x01,0x00,0x00,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x04,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x08,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x01,0x01,0x04,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x01,0x01,0x00,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x04,0x07,0x04,0x00,0x05,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
};
//家マップデータ(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;//現在マップ、現在文字列、現在話中キャラ
int now_talk_index;//話中のキャラクター添字
Point My = new Point(1-INIT_X,1-INIT_Y);//マップ開始座標
boolean PushFlag=false;//キーを押した状態であるか
//初期化
#ifdef APPLET
public void init(){
int i;
//--------ロード-----------
for(i=1;i<=4;i++){
hero[i-1]=getImage(getDocumentBase(),"hero"+i+".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);
move_dir=DOWN;
#else
//コンストラクタ
RpgCanvas(){
int i;
setSoftLabel(SOFT_KEY_1,"勇者");
setSoftLabel(SOFT_KEY_2,"愛");
//ロード
try{
MediaImage m;
for(i=1;i<=4;i++){
m=MediaManager.getImage("resource:///hero"+i+".gif");
m.use();
hero[i-1]=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;
move_dir=1;
}
//描画
public void paint(Graphics g){
int i,j;
int map;
String str,str2,str3;
//描画領域のロック
#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=32;limit.y=24;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="エンターキー:会話、調べる、決定";
#else
str2="セレクトキー:会話、調べる、決定";
#endif
str3="";
break;
//キャラクター
case 32:
str=charas[now_chara].talk[now_talk_index];//一行目
//二行目
if(charas[now_chara].talk.length>=now_talk_index+1+1){
str2=charas[now_chara].talk[now_talk_index+1];
}else{str2="";}
//三行目
if(charas[now_chara].talk.length>=now_talk_index+2+1){
str3=charas[now_chara].talk[now_talk_index+2];
}else{str3="";}
//続きがある場合
if(charas[now_chara].talk.length>=now_talk_index+4){
str3+="▽";
}
break;
default:str="";str2="";str3="";
}
bufferg.drawString(str,2,130-21-14);
bufferg.drawString(str2,2,130-7-14);
bufferg.drawString(str3,2,130-7);
//主人公描画
#ifdef APPLET
bufferg.drawImage(hero[move_dir],16*INIT_X,16*INIT_Y,this);
#else
bufferg.drawImage(hero[move_dir],16*INIT_X,16*INIT_Y);
#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=now_talk_index+4){
now_talk_index+=3;
}else{now_string=0;}
return;
}
#ifdef APPLET
if(move_flag){se[0].play();}
#endif
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;
}
switch(celldata[cell].event){
case 11:now_string=11;break;
default:now_string=0;break;
}
//向いている方向にキャラクターがいる場合
for(i=0;i