home *** CD-ROM | disk | FTP | other *** search
- #include "demo.h"
-
- #define PTN_CNT 30
-
- char GWork[1536];
-
- char para[128];
-
- int Myx = 1;
- int Myy = 3;
- int SpriteCnt = 22;
- int door = 0;
-
- short int PartsBuf[PARTS_MAX][16*2] = {
- 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
- 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
- 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
- 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
-
- 0x1112,0x2222,0x2112,0x2122,0x2111,0x2112,0x2212,0x2112,
- 0x1112,0x2212,0x2111,0x2122,0x2221,0x2122,0x2122,0x1122,
- 0x2211,0x2221,0x1221,0x2121,0x1222,0x1122,0x2222,0x1122,
- 0x1122,0x2121,0x1122,0x2121,0x3321,0x3311,0x3313,0x3313,
-
- 0x1113,0x1111,0x1113,0x2221,0x1313,0x2212,0x2333,0x1111,
- 0x2133,0x1211,0x3133,0x1211,0x3333,0x1112,0x3333,0x2132,
- 0x3333,0x2131,0x3333,0x2233,0x3333,0x1213,0x3333,0x1313,
- 0x3333,0x1313,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
-
- 0x2111,0x3121,0x2221,0x3211,0x2221,0x3231,0x1111,0x3133,
- 0x1121,0x3333,0x1122,0x3333,0x2111,0x3331,0x1221,0x3332,
- 0x3111,0x3332,0x3311,0x3331,0x3311,0x3333,0x3311,0x3333,
- 0x3113,0x3333,0x3133,0x3333,0x3333,0x3333,0x3333,0x3333,
-
- 0x1112,0x2222,0x2112,0x2122,0x2111,0x2112,0x2212,0x2112,
- 0x1112,0x2212,0x2111,0x2122,0x2221,0x2122,0x2122,0x1122,
- 0x2211,0x2221,0x1221,0x2121,0x1222,0x1122,0x2222,0x1122,
- 0x1122,0x2121,0x1122,0x2121,0x2121,0x1112,0x2111,0x1211,
-
- 0x6665,0x6666,0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,
- 0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,
- 0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,
- 0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,0x5555,0x6555,
-
- 0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,
- 0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,
- 0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,
- 0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,0x4445,0x6444,
-
- 0x8888,0x8888,0x8888,0x8888,0x7777,0x7777,0x7777,0x7777,
- 0x7777,0x7777,0x7777,0x7777,0x7777,0x7777,0x7777,0x7777,
- 0x7777,0x7777,0x7777,0x7777,0x7777,0x7777,0x7777,0x7777,
- 0x7777,0x7777,0x7777,0x7777,0x7777,0x7777,0xffff,0xffff,
-
- 0x1112,0x2222,0x2112,0x2122,0x2111,0x2112,0x2212,0x2112,
- 0x1112,0x2212,0x2111,0x2122,0x2221,0x2122,0x2122,0x1122,
- 0x2211,0x2221,0x1221,0x2121,0x1222,0x1122,0x2222,0x1122,
- 0x1122,0x2121,0x1122,0x2121,0x4421,0x4411,0x4414,0x4414,
-
- 0x1114,0x1111,0x1114,0x2221,0x1414,0x2212,0x2444,0x1111,
- 0x2144,0x1211,0x4144,0x1211,0x4444,0x1112,0x4444,0x2142,
- 0x4444,0x2141,0x4444,0x2244,0x4444,0x1214,0x4444,0x1414,
- 0x4444,0x1414,0x4444,0x4444,0x4444,0x4444,0x4444,0x4444,
-
- 0x2111,0x4121,0x2221,0x4211,0x2221,0x4241,0x1111,0x4144,
- 0x1121,0x4444,0x1122,0x4444,0x2111,0x4441,0x1221,0x4442,
- 0x4111,0x4442,0x4411,0x4441,0x4411,0x4444,0x4411,0x4444,
- 0x4114,0x4444,0x4144,0x4444,0x4444,0x4444,0x4444,0x4444,
-
- 0x1333,0x3311,0x1322,0x3112,0x1322,0x3211,0x2233,0x2222,
- 0x2211,0x3332,0x2112,0x3332,0x2111,0x3322,0x3222,0x2222,
- 0x2222,0x1122,0x1332,0x1111,0x1332,0x2211,0x1322,0x2221,
- 0x2222,0x2233,0x2222,0x3332,0x2111,0x1133,0x2111,0x1113,
-
- 0x5455,0x5566,0x5455,0x5566,0x5445,0x5464,0x5466,0x4464,
- 0x6666,0x6655,0x5455,0x6654,0x5445,0x6545,0x4664,0x6546,
- 0x6655,0x6565,0x4466,0x4554,0x6456,0x6455,0x4455,0x6645,
- 0x6655,0x6645,0x4665,0x5566,0x6455,0x5555,0x6455,0x5555
- };
-
- MAP regionmap[41]={
- /* 0.森の広場 */ 99,1,
- /* 1.猟師のいる家 */ 0,3,
- /* 2.猟師の部屋の中 */ 99,99,
- /* 3.屋根裏部屋のある家 */ 1,6,
- /* 4.その家の中 */ 99,99,
- /* 5.屋根裏部屋 */ 99,99,
- /* 6.美術館 */ 3,8,
- /* 7.美術館の中 */ 99,99,
- /* 8.地下迷宮の入口(井戸) */ 6,9,
- /* 9.長老の家 */ 8,11,
- /* 10.長老の家の中 */ 99,99,
- /* 11.真実の石を持った人がいる家 */ 9,13,
- /* 12.その家の中 */ 99,99,
- /* 13.道具屋 */ 11,15,
- /* 14.道具屋の中 */ 99,99,
- /* 15.神殿の入口 */ 13,17,
- /* 16.神殿 */ 99,99,
- /* 17.工場 */ 15,19,
- /* 18.工場の中 */ 99,99,
- /* 19.洞窟の入口 */ 17,99,
-
- /* 20.地下迷宮 */ 21,22,
- /* 21.地下迷宮 */ 99,20,
- /* 22.地下迷宮 */ 20,99,
- /* 23.地下迷宮 */ 99,24,
- /* 24.地下迷宮 */ 23,99,
- /* 25.地下迷宮 */ 26,99,
- /* 26.地下迷宮 */ 99,25,
- /* 27.地下迷宮 */ 28,99,
- /* 28.地下迷宮 */ 29,27,
- /* 29.地下迷宮 */ 99,28,
-
- /* 30.洞窟 */ 99,31,
- /* 31.洞窟 */ 30,99,
- /* 32.洞窟 */ 99,99,
- /* 33.洞窟 */ 99,99,
- /* 34.洞窟 */ 99,99,
- /* 35.洞窟 */ 99,99,
- /* 36.洞窟 */ 99,99,
- /* 37.洞窟 */ 99,38,
- /* 38.洞窟 */ 37,39,
- /* 39.洞窟 */ 38,99
- };
-
- PTNINFO PtnInfo[PTN_CNT] = {
- /* 0 */ "door1.esp",1,2,128+22,256+0,
- /* 1 */ "door2.esp",1,2,128+24,256+0,
- /* 2 */ "cdoor1.esp",1,2,128+26,256+1,
- /* 3 */ "cdoor2.esp",1,2,128+28,256+1,
- /* 4 */ "takara.esp",1,2,128+30,256+0,
- /* 5 */ "ido.esp",1,2,128+32,256+2,
- /* 6 */ "saidan.esp",1,2,128+34,256+4,
- /* 7 */ "man1.esp",1,2,128+36,256+2,
- /* 8 */ "man2.esp",1,2,128+38,256+2,
- /* 9 */ "man3.esp",1,2,128+40,256+5,
- /* 10 */ "man4.esp",1,2,128+42,256+6,
- /* 11 */ "man5.esp",1,2,128+44,256+7,
- /* 12 */ "man6.esp",1,2,128+46,256+8,
- /* 13 */ "man7.esp",1,2,128+48,256+9,
- /* 14 */ "man8.esp",1,2,128+50,256+10,
- /* 15 */ "man9.esp",1,2,128+52,256+11,
- /* 16 */ "man10.esp",1,2,128+54,256+12,
- /* 17 */ "man11.esp",1,2,128+56,256+13,
-
- /* 18 */ "end3.esp",6,3,128+58,256+0,
- /* 19 */ "end4.esp",6,3,128+76,256+0,
- /* 20 */ "end1.esp",6,3,128+94,256+0,
- /* 21 */ "end2.esp",6,3,128+112,256+0,
- /* 22 */ "end5.esp",6,3,128+130,256+0,
- /* 23 */ "end6.esp",6,3,128+148,256+0,
- /* 26 */ "end11.esp",6,3,128+166,256+0,
- /* 27 */ "end12.esp",6,3,128+184,256+0,
- /* 24 */ "end7.esp",6,3,128+202,256+0,
- /* 25 */ "end8.esp",6,3,128+220,256+0,
- /* 28 */ "end9.esp",6,3,128+238,256+0,
- /* 29 */ "end10.esp",6,3,128+256,256+0,
- };
-
- int MusicTable[42] = {
- MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,
- MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,MUS_TOWN,
- MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,
- MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,MUS_CAVE,
- MUS_OPEN,MUS_END
- };
-
- int NowMusic = MUS_OPEN;
-
- INFO CharInfo[2][6];
-
- OBJECT objlist[LEVELMAX][OBJMAX];
-
- int region = 0;
- int level = 0;
-
- int WaitCnt;
-
- void
- DrawFrame(mode)
- int mode;
- {
- FILE *fp;
- static char *buf;
- GETPUT put;
-
- if (mode) {
- buf=malloc(153734);
- fp=fopen("frame.p16","rb");
- fread(buf,1,153734,fp);
- fclose(fp);
- } else {
- put.addr = buf+134;
- put.select = 0x14;
- put.x1 = 0;
- put.y1 = 0;
- put.x2 = 639;
- put.y2 = 479;
- EGB_putBlock(GWork,0,(char *)&put);
-
- free(buf);
- }
-
- }
- void
- PalLoad(from,to)
- int from,to;
- {
- int cnt;
- PALETTE pal;
-
- pal.no = to-from+1;
- for (cnt=from;cnt<=to;cnt++) {
- pal.color[cnt-from].seqno = cnt;
- pal.color[cnt-from].blue = (PalBuf[region][cnt] & 0xf00) >> 4;
- pal.color[cnt-from].red = (PalBuf[region][cnt] & 0x0f0);
- pal.color[cnt-from].green = (PalBuf[region][cnt] & 0x00f) << 4;
- pal.color[cnt-from].dummy = 0;
- }
- EGB_palette(GWork,1,(char *)&pal);
- }
- void
- PalSave(from,to)
- int from,to;
- {
- int cnt;
- PALETTE pal;
-
- pal.no = to-from+1;
- for (cnt=from;cnt<=to;cnt++) {
- pal.color[cnt-from].seqno = cnt;
- pal.color[cnt-from].blue = 0;
- pal.color[cnt-from].red = 0;
- pal.color[cnt-from].green = 0;
- pal.color[cnt-from].dummy = 0;
- }
- EGB_palette(GWork,1,(char *)&pal);
- }
-
- void
- mapedit()
- {
- int cnt1,cnt2;
-
- BOX para;
-
- para.x1 = 64;
- para.y1 = 64;
- para.x2 = 512+64-1;
- para.y2 = 480-64;
- EGB_color(GWork,0,0);
- EGB_color(GWork,2,0);
- EGB_paintMode(GWork,0x22);
- EGB_rectangle(GWork,(char *)¶);
-
- PalSave(1,8);
-
- EGB_writeMode(GWork,6);
- EGB_color(GWork,3,0);
-
-
- for (cnt1=0;cnt1<22;cnt1++) {
- for (cnt2=0;cnt2<64;cnt2++) {
- if ((*(ScreenMap[region]+64 * cnt1 + cnt2)) != 0xff) {
- TransData(64+cnt2*8,416-(cnt1+1)*16,(char *)PartsBuf[((*(ScreenMap[region]+64 * cnt1 + cnt2)) & 0x7f)]);
- }
- }
- }
-
- PalLoad(1,8);
-
- EGB_writeMode(GWork,0);
- }
-
- void
- ReadData(mode)
- int mode;
- {
- FILE *fp;
- static char *temp[PTN_CNT+2];
- int ptn_cnt,cnt;
-
- if (mode) {
- fp = fopen("palette.32k","rb");
- fread((char *)Palette,8192,1,fp);
- fclose(fp);
-
- for (cnt=0;cnt<PTN_CNT+2;cnt++) {
- temp[cnt] = malloc(128*6*4);
- }
-
- fp = fopen("man1.esp","rb");
- fread(temp[0],128*11+18,1,fp);
- fclose(fp);
-
- fp = fopen("man2.esp","rb");
- fread(temp[1],128*11+18,1,fp);
- fclose(fp);
-
- for(cnt=0;cnt<PTN_CNT;cnt++) {
- fp = fopen(PtnInfo[cnt].fname,"rb");
- fread(temp[cnt+2],128*PtnInfo[cnt].xsize*PtnInfo[cnt].ysize+18,1,fp);
- fclose(fp);
- }
-
- } else {
- SPR_init();
- SPR_setPaletteBlock(256,256,(char *)Palette);
-
- /* マイキャラの読み込み・定義 */
-
- SPR_define(0,128,1,11,temp[0]+18);
- SPR_define(0,128+11,1,11,temp[1]+18);
- free(temp[0]);
- free(temp[1]);
-
- ptn_cnt = 22;
-
- /* オブジェクトの読み込み・定義 */
- for(cnt=0;cnt<PTN_CNT;cnt++) {
- SPR_define(0,128+ptn_cnt,PtnInfo[cnt].xsize,PtnInfo[cnt].ysize,temp[cnt+2]+18);
- ptn_cnt += PtnInfo[cnt].xsize*PtnInfo[cnt].ysize;
- free(temp[cnt+2]);
- }
- }
- }
-
- void
- GInit()
- {
- EGB_init(GWork,1536);
- EGB_resolution(GWork,1,5);
- EGB_resolution(GWork,0,3);
-
- EGB_writePage(GWork,1);
- EGB_displayStart(GWork,0,64,0);
- EGB_displayStart(GWork,1,0,0);
- EGB_displayStart(GWork,2,2,2);
- EGB_displayStart(GWork,3,256,256);
- EGB_displayPage(GWork,1,3);
-
- EGB_writePage(GWork,0);
- EGB_paintMode(GWork,0x22);
- EGB_color(GWork,0,7);
- EGB_color(GWork,1,0);
- EGB_color(GWork,2,8);
-
- EGB_writePage(GWork,1);
- ReadData(0);
-
- EGB_writePage(GWork,0);
-
- PalSave(0,15);
- DrawFrame(0);
- PalLoad(0,15);
-
- mapedit();
- }
-
- void
- CharSet()
- {
- int cnt0,cnt1,pat,spr;
-
- pat = 128;
- spr = 1024;
-
- for (cnt0=0;cnt0<2;cnt0++) {
- for (cnt1=0;cnt1<6;cnt1++) {
- CharInfo[cnt0][cnt1].xsize = 1;
- if (cnt1 == 5) {
- CharInfo[cnt0][cnt1].ysize = 1;
- } else {
- CharInfo[cnt0][cnt1].ysize = 2;
- }
- spr -= CharInfo[cnt0][cnt1].xsize*CharInfo[cnt0][cnt1].ysize;
- CharInfo[cnt0][cnt1].pattern = pat;
- CharInfo[cnt0][cnt1].sprite = spr;
- pat += CharInfo[cnt0][cnt1].xsize*CharInfo[cnt0][cnt1].ysize;
-
- SPR_setAttribute(CharInfo[cnt0][cnt1].sprite,CharInfo[cnt0][cnt1].xsize,CharInfo[cnt0][cnt1].ysize,CharInfo[cnt0][cnt1].pattern,257 | 0x8000 | 0x2000);
- }
- }
-
- SPR_display(1,SpriteCnt);
- }
-
- void
- ClrObject()
- {
- int cnt;
-
- SPR_display(2,SpriteCnt);
- for (cnt=23;cnt<=SpriteCnt;cnt++) {
- SPR_setAttribute(1024-cnt,1,1,128,256 | 0x8000 | 0x2000);
- }
- SPR_display(1,SpriteCnt);
- }
-
- void
- DispObject()
- {
- int cnt,x,y,pat;
-
- SpriteCnt = 22;
-
- SPR_display(2,SpriteCnt);
- for (cnt=0;cnt<OBJMAX;cnt++) {
- if (objlist[level][cnt].region == region && region != 0) {
- pat = objlist[level][cnt].ptn_no;
- SpriteCnt += PtnInfo[pat].xsize*PtnInfo[pat].ysize;
- SPR_setAttribute(1024-SpriteCnt,PtnInfo[pat].xsize,PtnInfo[pat].ysize,PtnInfo[pat].ptn_no,PtnInfo[pat].pal | 0x8000 );
- x = objlist[level][cnt].x*4-PtnInfo[pat].xsize*8;
- y = 207-(PtnInfo[pat].ysize*16-1)-objlist[level][cnt].y*8;
- SPR_setPosition(0,1024-SpriteCnt,PtnInfo[pat].xsize,PtnInfo[pat].ysize,x,y);
- }
- }
- SPR_display(1,SpriteCnt);
- }
-
- void
- EndProc()
- {
- if (MusicFlag) {
- MusicStop();
- }
- SPR_display(0,8);
- }
-
- int
- JoyStatus(joy,button)
- int joy,button;
- {
- if ((joy & (0x01 << button)) == 0) {
- return(1);
- }
- return(0);
- }
-
- void
- MoveChar(dir,phase,x,y)
- int dir,phase,x,y;
- {
- static int dirb = -1;
- static int phaseb = -1;
-
- x = x*4-8;
- y = 207-(CharInfo[dir][phase].ysize*16-1)-y*8;
-
- SPR_display(2,SpriteCnt);
- SPR_setPosition(0,CharInfo[dir][phase].sprite,CharInfo[dir][phase].xsize,CharInfo[dir][phase].ysize,x,y);
-
- if (dirb == dir && phaseb == phase) {
- SPR_display(1,SpriteCnt);
- return;
- }
-
- SPR_setAttribute(CharInfo[dirb][phaseb].sprite,CharInfo[dirb][phaseb].xsize,CharInfo[dirb][phaseb].ysize,CharInfo[dirb][phaseb].pattern,259 | 0x8000 | 0x2000);
- SPR_setAttribute(CharInfo[dir][phase].sprite,CharInfo[dir][phase].xsize,CharInfo[dir][phase].ysize,CharInfo[dir][phase].pattern,259 | 0x8000);
-
- SPR_display(1,SpriteCnt);
-
- dirb = dir;
- phaseb = phase;
- }
-
- int
- LowerY(x,y)
- int x,y;
- {
- int ret,cnt1,cnt2;
-
- ret = 0;
- for (cnt1=x-2;cnt1<x+2;cnt1++) {
- if (0 <= cnt1 && cnt1 < 64) {
- for (cnt2=y+2;cnt2!=0;cnt2--) {
- if (((int)(*(ScreenMap[region]+64*cnt2+cnt1))) & 0x80) {
- break;
- }
- }
- if (((int)(*(ScreenMap[region]+64*cnt2+cnt1))) & 0x80) {
- if (ret < cnt2+1) {
- ret = cnt2+1;
- }
- }
- }
- }
- return(ret);
- }
- int
- UpperY(x,y)
- int x,y;
- {
- int ret,cnt1,cnt2;
-
- ret = 22;
- for (cnt1=x-2;cnt1<x+2;cnt1++) {
- if (0 <= cnt1 && cnt1 < 64) {
- for (cnt2=y+2;cnt2!=22;cnt2++) {
- if (((int)(*(ScreenMap[region]+64 * cnt2 + cnt1))) & 0x80) {
- break;
- }
- }
- if (((int)(*(ScreenMap[region]+64 * cnt2 + cnt1))) & 0x80) {
- if (ret > cnt2) {
- ret = cnt2;
- }
- }
- }
- }
- return(ret);
- }
-
- void
- UpdateStatus(joy)
- int joy;
- {
- static int wait = 100;
- static int jump_phase = 0;
- static int phase = WALK1;
- static int dir = DIR_RIGHT;
- static int chartall = HIGH_TALL;
- int landy,wally;
-
- if (JoyStatus(joy,DOWN)) {
- chartall = LOW_TALL;
- } else {
- chartall = HIGH_TALL;
- }
-
- if (JoyStatus(joy,LEFT)) {
- dir = DIR_LEFT;
-
- landy = LowerY(Myx-1,Myy);
- wally = UpperY(Myx-1,Myy)-landy;
- if ((landy <= Myy+1) && (chartall <= wally) && (Myy <= landy+wally-chartall)) {
- Myx --;
- if (Myx < 0) {
- Myx = 0;
- } else if (phase != LOW){
- phase++;
- }
- }
- }
- if (JoyStatus(joy,RIGHT)) {
- dir = DIR_RIGHT;
-
- landy = LowerY(Myx+1,Myy);
- wally = UpperY(Myx+1,Myy)-landy;
- if ((landy <= Myy+1) && (chartall <= wally) && (Myy <= landy+wally-chartall)) {
- Myx ++;
- if (Myx > 64) {
- Myx = 64;
- } else if (phase != LOW){
- phase++;
- }
- }
- }
- if (phase > 3) {
- phase = 0;
- }
- landy = LowerY(Myx,Myy);
- wally = UpperY(Myx,Myy)-landy;
- if (JoyStatus(joy,TR_A) && wally > chartall) {
- chartall = HIGH_TALL;
- if (jump_phase < 4) {
- jump_phase++;
- Myy += JUMP_HIGHT;
- if (Myy > wally+landy-chartall) {
- Myy = wally+landy-chartall;
- jump_phase = 10;
- }
- if (landy > Myy) {
- Myy = landy;
- jump_phase = 0;
- }
- } else if (jump_phase < 6) {
- jump_phase++;
- } else if (jump_phase >= 6) {
- jump_phase++;
- Myy -= JUMP_HIGHT;
- if (landy > Myy) {
- Myy = landy;
- jump_phase = 0;
- }
- }
- } else {
- Myy -= JUMP_HIGHT;
- jump_phase = 10;
- if (landy >= Myy) {
- Myy = landy;
- jump_phase = 0;
- }
- }
- if(jump_phase) {
- phase = JUMP;
- chartall = HIGH_TALL;
- } else if (phase > LOW) {
- phase = WALK1;
- }
- if (chartall == LOW_TALL) {
- phase = LOW;
- }
-
- MoveChar(dir,phase,Myx,Myy);
-
- }
- void
- regionchg()
- {
- int joy;
-
- if (NowMusic != MusicTable[region]) {
- MusicStart(MusicTable[region]);
- }
- ClrObject();
- mapedit();
- DispObject();
- do {
- SND_joy_in_2(0,&joy);
- }while(JoyStatus(joy,TR_B));
-
- }
- void
- MessageBox(len)
- int len;
- {
- CIRCLE circle;
- BOX box;
- LINE line;
- ARC arc;
-
- EGB_color(GWork,0,MES_FRAME);
- EGB_color(GWork,2,MES_BACK);
- EGB_paintMode(GWork,0x20);
-
- circle.x = 75+9;
- circle.y = 25+9;
- circle.r = 9;
- EGB_circle(GWork,(char *)&circle);
- circle.x = 565-9;
- circle.y = 25+9;
- EGB_circle(GWork,(char *)&circle);
-
- box.x1 = 75+9;
- box.y1 = 25;
- box.x2 = 565-9;
- box.y2 = 25+9;
- EGB_rectangle(GWork,(char *)&box);
-
- circle.x = 75+9;
- circle.y = 25+9+16*(len+1);
- circle.r = 9;
- EGB_circle(GWork,(char *)&circle);
- circle.x = 565-9;
- circle.y = 25+9+16*(len+1);
- EGB_circle(GWork,(char *)&circle);
-
- box.x1 = 75+9;
- box.y1 = 25+9+16*(len+1);
- box.x2 = 565-9;
- box.y2 = 25+9+16*(len+1)+9;
- EGB_rectangle(GWork,(char *)&box);
-
- box.x1 = 75;
- box.y1 = 25+9;
- box.x2 = 565;
- box.y2 = 25+9+16*(len+1);
- EGB_rectangle(GWork,(char *)&box);
-
- EGB_paintMode(GWork,0x02);
-
- line.no = 2;
- line.x1 = 75+9;
- line.y1 = 25;
- line.x2 = 565-9;
- line.y2 = 25;
- EGB_unConnect(GWork,(char *)&line);
-
- arc.x = 75+9;
- arc.y = 25+9;
- arc.x1 = -9;
- arc.y1 = 0;
- arc.x2 = 0;
- arc.y2 = -9;
- arc.r = 9;
- EGB_arc(GWork,(char *)&arc);
-
- arc.x = 565-9;
- arc.y = 25+9;
- arc.x1 = 0;
- arc.y1 = -9;
- arc.x2 = 9;
- arc.y2 = 0;
- EGB_arc(GWork,(char *)&arc);
-
- line.x1 = 75;
- line.y1 = 25+9;
- line.x2 = 75;
- line.y2 = 25+9+(len+1)*16;
- EGB_unConnect(GWork,(char *)&line);
-
- line.x1 = 565;
- line.x2 = 565;
- EGB_unConnect(GWork,(char *)&line);
-
- arc.x = 75+9;
- arc.y = 25+9+(len+1)*16;
- arc.x1 = 0;
- arc.y1 = 9;
- arc.x2 = -9;
- arc.y2 = 0;
- EGB_arc(GWork,(char *)&arc);
-
- arc.x = 565-9;
- arc.y = 25+9+(len+1)*16;
- arc.x1 = 9;
- arc.y1 = 0;
- arc.x2 = 0;
- arc.y2 = 9;
- EGB_arc(GWork,(char *)&arc);
-
- line.no = 2;
- line.x1 = 75+9;
- line.y1 = 25+9+(len+1)*16+9;
- line.x2 = 565-9;
- line.y2 = 25+9+(len+1)*16+9;
- EGB_unConnect(GWork,(char *)&line);
-
- }
- void
- window(object)
- int object;
- {
- int len; /* 文字列の長さ */
- int loop; /* ウィンドウ中での行数 */
- int cpylen; /* 1行でコピーする長さ */
- int i,j,k;
- int stat;
- int *windbuf;
-
- /* windowサイズの背景のget */
- windbuf=malloc(Windowbuf);
- DWORD(para+0) = (unsigned int)windbuf;
- WORD(para+4) = 0x14;
- WORD(para+6) = 75;
- WORD(para+8) = 25;
- WORD(para+10) = 565;
- WORD(para+12) = 130;
- EGB_getBlock(GWork,para);
-
- do {
- SND_joy_in_2(0,&stat);
- } while((stat & 0x20) == 0);
-
- for(k=0;k<objlist[level][object].mes_no;k++) {
- EGB_color(GWork,0,0);
- len = strlen(objlist[level][object].message[k]);
- loop = len/60;
- if (len % 60) {
- loop++;
- }
- MessageBox(loop-1);
- EGB_color(GWork,0,objlist[level][object].mes_col[k]);
- for(i=0;i<loop;i++) {
- if(((len % 60) != 0) && (i == loop-1)) {
- cpylen=len % 60;
- } else {
- cpylen=60;
- }
- WORD(para+0)=80;
- WORD(para+2)=i*16+50;
- WORD(para+4)=cpylen;
- for(j=0;j<cpylen;j++)
- BYTE(para+6+j)=*(objlist[level][object].message[k]+i*60+j);
- EGB_sjisString(GWork,para);
- }
- SND_joy_in_2(0,&stat);
- while((stat & 0x20) != 0)
- SND_joy_in_2(0,&stat);
- while((stat & 0x20) == 0)
- SND_joy_in_2(0,&stat);
- }
- DWORD(para+0) = (unsigned int)windbuf;
- WORD(para+4) = 0x14;
- WORD(para+6) = 75;
- WORD(para+8) = 25;
- WORD(para+10) = 565;
- WORD(para+12) = 130;
- EGB_putBlock(GWork,0,para);
- free(windbuf);
- }
- void
- LevelUp()
- {
- int joy;
-
- /*
- ClrObject();
- */
- level++;
- if (level == 20) {
- if (MusicFlag) {
- MusicStart(MUS_END);
- }
- Ending();
- return;
- }
-
- DispObject();
- do {
- SND_joy_in_2(0,&joy);
- }while(JoyStatus(joy,TR_B));
- }
-
- int
- Event(joy)
- int joy;
- {
- int cnt,change;
-
- change = 0;
- if (JoyStatus(joy,TR_B)) {
- /* オブジェクトの数だけチェック */
- for(cnt=0;cnt<OBJMAX;cnt++) {
- /* オブジェクトとマイキャラのX座標,Y座標が同じか */
- if((region == objlist[level][cnt].region) && (Myx > ((objlist[level][cnt].x)-5)) && (Myx < (objlist[level][cnt].x)+5) && (Myy > (objlist[level][cnt].y)-5) && (Myy < (objlist[level][cnt].y)+5) && region != 0) {
- window(cnt);
- if (objlist[level][cnt].level_up != 0) {
- LevelUp();
- if (level >= 20) {
- return(1);
- }
- change = 1;
- }
- /* リージョンチェンジが発生したか */
- if( objlist[level][cnt].reg_chg != 99 ) {
- /* マイキャラの移動 */
- if((cnt==12)&&(level<11)) {
- Myx=25;
- Myy=13;
- }
- if((cnt==32)&&(level<11)) {
- Myx=30;
- Myy=1;
- }
-
- if((level==17)&&(cnt==36)) {
- if(door==0) door=1;
- else door=0;
- }
- if((level==17)&&(cnt==38)) {
- if(door==1) door=2;
- else door=0;
- }
- if((level==17)&&(cnt==35)) {
- if(door==2) door=3;
- else door=0;
- }
- if((level==17)&&(cnt==37)) {
- if(door==3) door=4;
- else door=0;
- }
- if(door==4) objlist[17][36].reg_chg=37;
-
-
- region=objlist[level][cnt].reg_chg;
- regionchg();
- change = 1;
- }
- if (change) {
- return(0);
- }
- }
- }
- }
-
- /* 画面左端からのリージョンチェンジ */
- if((JoyStatus(joy,LEFT)) && (Myx == 0) && (regionmap[region].LeftRegion != 99)) {
- region=regionmap[region].LeftRegion;
- regionchg();
- Myx=63;
- }
-
- /* 画面右端からのリージョンチェンジ */
- if((JoyStatus(joy,RIGHT)) && (Myx == 64) && (regionmap[region].RightRegion != 99)) {
- region=regionmap[region].RightRegion;
- regionchg();
- Myx=1;
- }
- return(0);
- }
-
- void
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int joy,wait,end;
- wait=0;
-
- if (argc == 1) {
- WaitCnt = 0;
- } else if (argc == 2) {
- WaitCnt = atoi(argv[1]);
- } else {
- WaitCnt = atoi(argv[1]);
- level = atoi(argv[2]);
- }
-
- mesinit1();
- mesinit2();
- mesinit3();
- mesinit4();
- mapset00();
- mapset01();
- mapset02();
- mapset03();
- mapset04();
- mapset05();
- mapset06();
- mapset07();
- mapset08();
- mapset09();
- mapset10();
- mapset11();
- mapset12();
- mapset13();
- mapset14();
- mapset15();
- mapset16();
- mapset17();
- mapset18();
- mapset19();
- mapset20();
- mapset21();
- mapset22();
- mapset23();
- mapset24();
- mapset25();
- mapset26();
- mapset27();
- mapset28();
- mapset29();
- mapset30();
- mapset31();
- mapset32();
- mapset33();
- mapset34();
- mapset35();
- mapset36();
- mapset37();
- mapset38();
- mapset39();
-
-
- ReadData(1);
- DrawFrame(1);
-
- MusicInit();
- if (level == 0) {
- MusicStart(MUS_OPEN);
- Opening();
- }
-
- if (MusicFlag) {
- MusicStart(MUS_TOWN);
- }
-
- GInit();
-
- CharSet();
- DispObject();
-
- joy = 0xff;
- end = 0;
-
- do {
-
- SND_joy_in_2(0,&joy);
-
- if (JoyStatus(joy,SELECT)) {
- end = Help();
- }
- if (wait >= WaitCnt) {
-
- UpdateStatus(joy);
-
- if (Event(joy)) {
- end++;
- }
- wait = 0;
- } else {
- wait++;
- }
- } while(!end);
-
- EndProc();
-
- }