File: main.c - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <input.h>
#include <DATlib.h>
#include "externs.h"

#define FRONT_START_X 157
#define FRONT_START_Y 0
#define FRONT_MIN_X 8
#define FRONT_MAX_X 624
#define FRONT_MIN_Y 0
#define FRONT_MAX_Y 0

#define BACK_MIN_X 8
#define BACK_MAX_X 149
#define BACK_MIN_Y 5
#define BACK_MAX_Y 8

int action=0;
int choice=0;
bool button_available;
bool text_visible;

typedef struct bkp_ram_info {
        WORD debug_dips;
        BYTE stuff[254];
        //256 bytes
} bkp_ram_info;

bkp_ram_info bkp_data;

extern uint _end;
BYTE p1,p2,ps,p1e,p2e;
uint callBackCounter;

//fix palettes for text
static const ushort fixPalettes[]= {
        0x8000, 0xefb8, 0x0222, 0x5fa7, 0xde85, 0x2c74, 0x2a52, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
        0x8000, 0xebea, 0x0041, 0xa9d8, 0x57c7, 0xf6b5, 0x43a4, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
        0x8000, 0x014c, 0x9113, 0xb15e, 0x317f, 0x119f, 0x11af, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
        0x8000, 0xeb21, 0x0111, 0xee21, 0x6f31, 0x6f51, 0x6f61, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
        0x8000, 0xed31, 0xc311, 0xee51, 0x4f81, 0x4fa1, 0x4fc1, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
        0x8000, 0xbad3, 0x0111, 0x09c0, 0xe7b0, 0xc580, 0xe250, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
        0x8000, 0xefb8, 0x0111, 0xde96, 0x3c75, 0x2950, 0x4720, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
        0x8000, 0x8444, 0x0111, 0xf555, 0xf666, 0x7777, 0x8888, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 };
        
#define CLIPPING 5

void scrollerInitClipped(scroller *s, scrollerInfo *si, ushort baseSprite, ushort basePalette, short posX, short posY, ushort clipping) {
        ushort i,addr,pos;

        scrollerInit(s,si,baseSprite,basePalette,posX,posY);
        addr=VRAM_POSY_ADDR(baseSprite);
        //pos=((YSHIFT-(0-posY))<<7)|(clipping&0x3f);
        pos=VRAM_POSY(-posY,SPR_UNLINK,clipping);
        for(i=0;i<21;i++)
                SC234Put(addr++,pos);
}

void scrollerSetPosClipped(scroller *s, short toX, short toY, ushort clipping) {
        ushort i,addr,pos;

        if(s->scrlPosY!=toY) {  //Y moved ?
                scrollerSetPos(s,toX,toY);
                
                addr=VRAM_POSY_ADDR(s->baseSprite);
                //pos=((YSHIFT-(0-toY))<<7)|(clipping&0x3f);
                pos=VRAM_POSY(-toY,SPR_UNLINK,clipping);
                for(i=0;i<21;i++)
                        SC234Put(addr++,pos);
                //s->scrlPosY=toY;
        } else scrollerSetPos(s,toX,toY);
}

void sortSprites(aSprite *list[], int count) {
        //insertion sort
        int x,y;
        aSprite *tmp;
        
        for(x=1;x<count;x++) {
                y=x;
                while(y>0 && (list[y]->posY < list[y-1]->posY)) {
                        tmp=list[y];
                        list[y]=list[y-1];
                        list[y-1]=tmp;
                        y--;
                }
        }
}

#define POOL_MODE
#define LOTS

const char sinTable[]={ 32,34,35,37,38,40,41,43,44,46,47,48,50,51,52,53,
                                                55,56,57,58,59,59,60,61,62,62,63,63,63,64,64,64,
                                                64,64,64,64,63,63,63,62,62,61,60,59,59,58,57,56,
                                                55,53,52,51,50,48,47,46,44,43,41,40,38,37,35,34,
                                                32,30,29,27,26,24,23,21,20,18,17,16,14,13,12,11,
                                                9,8,7,6,5,5,4,3,2,2,1,1,1,0,0,0,
                                                0,0,0,0,1,1,1,2,2,3,4,5,5,6,7,8,
                                                9,11,12,13,14,16,17,18,20,21,23,24,26,27,29,30};

#define SCROLLSPEED 1.06
void rasterScrollDemo() {
        BYTE p1,ps;
        pictureInfo frontLayerInfo, backLayerInfo;
        picture frontLayer, backLayer;
        short posY=-192;
        ushort rasterData0[256],rasterData1[256];
        ushort *rasterData;
        float scrollAcc;
        int scrollPos[34];
        int scrollValues[34];
        ushort backAddr=0x8401;
        ushort frontAddr=0x8421;
        int x,y;
        short frontPosX[13],backPosX[13];
        ushort skipY;
        ushort firstLine;
        ushort zeroval;

        //layers were merged to save up tiles/palettes
        frontLayerInfo.stripSize=tf4layers.stripSize;
        backLayerInfo.stripSize=tf4layers.stripSize;
        frontLayerInfo.tileWidth=32;
        backLayerInfo.tileWidth=32;
        frontLayerInfo.tileHeight=tf4layers.tileHeight;
        backLayerInfo.tileHeight=tf4layers.tileHeight;
        //only using first map
        frontLayerInfo.maps[0]=tf4layers.maps[0];
        backLayerInfo.maps[0]=tf4layers.maps[0]+(tf4layers.stripSize*(32/2)); //bytesize but ushort* declaration, so /2


        clearFixLayer();
        initGfx();
        jobMeterSetup(true);
        loadTIirq(TI_MODE_DUAL_DATA);
        TInextTable=0;

        scrollValues[0]=1024;
        scrollPos[0]=0;
        scrollAcc=1024;
        for(x=1;x<34;x++) {
                scrollAcc*=SCROLLSPEED;
                scrollValues[x]=(int)(scrollAcc+0.5);
                scrollPos[x]=0;
        }

        pictureInit(&backLayer, &backLayerInfo,1,16,0,0,FLIP_NONE);
        pictureInit(&frontLayer, &frontLayerInfo,33,16,0,0,FLIP_NONE);
        palJobPut(16,tf4layers.palInfo->count,tf4layers.palInfo->data);

        backgroundColor(0x38db);
        fixPrint(0,1,0,0,"                                       ");
        fixPrint(0,30,0,0,"                                       ");
        
        fixPrint(2,3,4,3,"1P \x12\x13: Scroll Up/Down");
        fixPrint(2,4,4,3,"1P A+\x12\x13: Adjust timer (line)");
        fixPrint(2,5,4,3,"1P A+\x10\x11: Adjust timer (unit)");
        
        zeroval=TI_ZERO;

        while(1) {
                SCClose();
                waitVBlank();

                while((volMEMWORD(0x3c0006)>>7)!=0x120); //line 16
                jobMeterColor(JOB_BLUE);
                
                p1=volMEMBYTE(P1_CURRENT);
                p1e=volMEMBYTE(P1_EDGE);
                ps=volMEMBYTE(PS_CURRENT);

                if(ps&P1_START) {
                        clearSprites(1, 64);
                        TInextTable=0;
                        SCClose();
                        waitVBlank();
                        unloadTIirq();
                        return;
                }

                fixPrintf2(2,7,5,3,"TIbase: %d (0x%04x)   ",zeroval,zeroval);
                
                if(p1&JOY_A) {
                        if(p1e&JOY_UP)          zeroval-=384;
                        if(p1e&JOY_DOWN)        zeroval+=384;
                        if(p1&JOY_RIGHT)        zeroval++;
                        if(p1&JOY_LEFT)         zeroval--;
                } else {
                        if(p1&JOY_UP) if(posY<0) posY++;
                        if(p1&JOY_DOWN) if(posY>-288) posY--;
                }

                //update scroll values
                for(x=0;x<34;x++) scrollPos[x]+=scrollValues[x];
                frontPosX[0]=                                                           (short)(0-(scrollPos[32]>>3));
                frontPosX[1]=frontPosX[2]=                                      (short)(0-(scrollPos[24]>>3));
                frontPosX[3]=frontPosX[4]=                                      (short)(0-(scrollPos[16]>>3));
                frontPosX[5]=                                                           (short)(0-(scrollPos[8]>>3));
                frontPosX[6]=frontPosX[7]=frontPosX[8]=         (short)(0-(scrollPos[0]>>3));
                frontPosX[9]=frontPosX[10]=frontPosX[11]=       (short)(0-(scrollPos[1]>>3));
                frontPosX[12]=                                                          (short)(0-(scrollPos[32]>>3));

                backPosX[0]=                                                            (short)(0-(scrollPos[24]>>3));
                backPosX[1]=backPosX[2]=                                        (short)(0-(scrollPos[16]>>3));
                backPosX[3]=backPosX[4]=                                        (short)(0-(scrollPos[8]>>3));
                backPosX[5]=                                                            (short)(0-(scrollPos[0]>>3));
                backPosX[6]=backPosX[7]=backPosX[8]=            (short)(0-(scrollPos[0]>>4));
                backPosX[9]=backPosX[10]=backPosX[11]=          (short)(0-(scrollPos[0]>>3));
                backPosX[12]=                                                           (short)(0-(scrollPos[1]>>3));

                skipY=0-posY;
                x=skipY>>5;
                firstLine=32-(skipY&0x1f);

                //TIbase=TI_ZERO+(384*firstLine); //timing to first raster line
                TIbase=zeroval+(384*firstLine); //timing to first raster line
                TInextTable=(TInextTable==rasterData0)?rasterData1:rasterData0;
                rasterData=TInextTable;

                pictureSetPos(&frontLayer,frontPosX[x]>>7,posY);
                pictureSetPos(&backLayer,backPosX[x]>>7,posY);
                //might need to force the update if base scroll position didn't change
                SC234Put(frontAddr,frontPosX[x]);
                SC234Put(backAddr,backPosX[x]);

                if(skipY<164) { //can we see water?
                        TIreload=384*32;        //nope, 32px chunks
                        for(x++;x<13;x++) {
                                *rasterData++=frontAddr;
                                *rasterData++=frontPosX[x];
                                *rasterData++=backAddr;
                                *rasterData++=backPosX[x];
                                firstLine+=32;
                                if(firstLine>=224) break;
                        }
                } else {
                        TIreload=384*4;         //yup, 4px chunks
                        for(x++;x<12;x++) {
                                for(y=0;y<8;y++) {
                                        *rasterData++=frontAddr;
                                        *rasterData++=frontPosX[x];
                                        *rasterData++=backAddr;
                                        *rasterData++=backPosX[x];
                                }
                                firstLine+=32;
                        }
                        x=1;
                        while(firstLine<224) {
                                *rasterData++=frontAddr;
                                *rasterData++=frontPosX[12];
                                *rasterData++=backAddr;
                                *rasterData++=0-(scrollPos[x++]>>3);
                                firstLine+=4;
                        }
                }
                *rasterData++=0x0000;
                *rasterData++=0x0000;
                jobMeterColor(JOB_GREEN);
                SCClose();
        }
}

void tempTests() {
        int x=0;
        int y=0;
        int c;
        uint *ptr;
        scroller scroll;

        backgroundColor(0x7bbb);
        clearFixLayer();
        initGfx();
        jobMeterSetup(true);

        scrollerInit(&scroll, &wohd, 1, 16, x, y);
        palJobPut(16, wohd.palInfo->count, wohd.palInfo->data);
        
        //fixPrintf1(2,3,4,3,"0x%06x",&scroll);
        //dbg init
        scroll.config[23+4]=scroll.config[23+5]=scroll.config[23+6]=scroll.config[23+7]=scroll.config[23+8]=0;

        while(1) {
                SCClose();
                waitVBlank();

                p1=volMEMBYTE(P1_CURRENT);
                p1e=volMEMBYTE(P1_EDGE);
                ps=volMEMBYTE(PS_CURRENT);
                
                if((ps&P1_START)&&(ps&P2_START)) {
                        clearSprites(1, 21);
                        SCClose();
                        waitVBlank();
                        return;
                }

                if(p1&JOY_UP)           y--;
                if(p1&JOY_DOWN)         y++;
                if(p1&JOY_LEFT)         x--;
                if(p1&JOY_RIGHT)        x++;

                while((volMEMWORD(0x3c0006)>>7)!=0x120); //wait raster line 16
                jobMeterColor(JOB_BLUE);

                if(p1e&JOY_D)
                        scrollerInit(&scroll, &wohd, 1, 16, x, y);

                if(p1&JOY_A) scrollerSetPos(&scroll, x, y);

                jobMeterColor(JOB_GREEN);
                fixPrintf2(2,4,4,3,"%04d\xff%04d\xff\xff",x,y);

                fixPrintf2(2,6,2,3,"TileIndex:  %04d ",scroll.config[23+2]);
                fixPrintf2(2,7,2,3,"DataIndex:  %04d ",scroll.config[23+1]);
                fixPrintf2(2,8,2,3,"DataLength: %04d ",scroll.config[23+3]);
                fixPrintf2(2,9,2,3,"DataIndex2: %04d ",scroll.config[23+0]);

                fixPrintf2(2,11,2,3,"TileIndex:  %04d ",scroll.config[23+4]);
                fixPrintf2(2,12,2,3,"DataIndex:  %04d ",scroll.config[23+5]);
                fixPrintf2(2,13,2,3,"DataLength: %04d ",scroll.config[23+6]);
                fixPrintf2(2,14,2,3,"DataIndex2: %04d ",scroll.config[23+7]);
                fixPrintf2(2,15,2,3,"DataLength2:%04d ",scroll.config[23+8]);
                fixPrintf2(2,16,2,3,"RefillSize: %04d ",scroll.config[23+6]+scroll.config[23+8]);

                c=0;
                ptr=SC1;
                while(ptr!=SC1ptr) {
                        c+=(*ptr++)&0x3fc0000;
                        ptr++;
                }
                c>>=18;
                fixPrintf1(2,18,2,3,"Jobs: %04d/%04d",(SC234ptr-SC234)>>1,c);
        }
}

//misc fix maps
static const ushort fadeData0[15]={0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x03f0,0x0000};
static const ushort fadeData1[15]={0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x03f1,0x0000};
static const ushort fadeData2[15]={0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x03f2,0x0000};
static const ushort fadeData3[15]={0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x03f3,0x0000};
static const ushort fadeData4[15]={0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x03f4,0x0000};
static const ushort fadeData5[15]={0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x03f5,0x0000};
static const ushort fadeData6[15]={0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x03f6,0x0000};
static const ushort fadeData7[15]={0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x03f7,0x0000};
static const ushort fadeData8[15]={0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x03f8,0x0000};
static const ushort fadeData9[15]={0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x03f9,0x0000};
static const ushort fadeDataA[15]={0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x03fa,0x0000};
static const uint fadeData[11]={(uint)fadeData0,(uint)fadeData1,(uint)fadeData2,(uint)fadeData3,(uint)fadeData4,(uint)fadeData5,(uint)fadeData6,(uint)fadeData7,(uint)fadeData8,(uint)fadeData9,(uint)fadeDataA};
static const ushort     logo_95[78]={   0x0500,0x0501,0x0502,0x0503,0x0504,0x0505,0x0506,0x0507,0x0508,0x0509,0x050a,0x050b,0x0000,
                                                                        0x0510,0x0511,0x0512,0x0513,0x0514,0x0515,0x0516,0x0517,0x0518,0x0519,0x051a,0x051b,0x0000,
                                                                        0x0520,0x0521,0x0522,0x0523,0x0524,0x0525,0x0526,0x0527,0x0528,0x0529,0x052a,0x052b,0x0000,
                                                                        0x0530,0x0531,0x0532,0x0533,0x0534,0x0535,0x0536,0x0537,0x0538,0x0539,0x053a,0x053b,0x0000,
                                                                        0x0540,0x0541,0x0542,0x0543,0x0544,0x0545,0x0546,0x0547,0x0548,0x0549,0x054a,0x054b,0x0000,
                                                                        0x0550,0x0551,0x0552,0x0553,0x0554,0x0555,0x0556,0x0557,0x0558,0x0559,0x055a,0x055b,0x0000 };
static const ushort     logo_96[78]={   0x0560,0x0561,0x0562,0x0563,0x0564,0x0565,0x0566,0x0567,0x0568,0x0569,0x056a,0x056b,0x0000,
                                                                        0x0570,0x0571,0x0572,0x0573,0x0574,0x0575,0x0576,0x0577,0x0578,0x0579,0x057a,0x057b,0x0000,
                                                                        0x0580,0x0581,0x0582,0x0583,0x0584,0x0585,0x0586,0x0587,0x0588,0x0589,0x058a,0x058b,0x0000,
                                                                        0x0590,0x0591,0x0592,0x0593,0x0594,0x0595,0x0596,0x0597,0x0598,0x0599,0x059a,0x059b,0x0000,
                                                                        0x05a0,0x05a1,0x05a2,0x05a3,0x05a4,0x05a5,0x05a6,0x05a7,0x05a8,0x05a9,0x05aa,0x05ab,0x0000,
                                                                        0x05b0,0x05b1,0x05b2,0x05b3,0x05b4,0x05b5,0x05b6,0x05b7,0x05b8,0x05b9,0x05ba,0x05bb,0x0000 };
static const ushort     logo_97[78]={   0x0600,0x0601,0x0602,0x0603,0x0604,0x0605,0x0606,0x0607,0x0608,0x0609,0x060a,0x060b,0x0000,
                                                                        0x0610,0x0611,0x0612,0x0613,0x0614,0x0615,0x0616,0x0617,0x0618,0x0619,0x061a,0x061b,0x0000,
                                                                        0x0620,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627,0x0628,0x0629,0x062a,0x062b,0x0000,
                                                                        0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x0637,0x0638,0x0639,0x063a,0x063b,0x0000,
                                                                        0x0640,0x0641,0x0642,0x0643,0x0644,0x0645,0x0646,0x0647,0x0648,0x0649,0x064a,0x064b,0x0000,
                                                                        0x0650,0x0651,0x0652,0x0653,0x0654,0x0655,0x0656,0x0657,0x0658,0x0659,0x065a,0x065b,0x0000 };
static const ushort     logo_98[78]={   0x0660,0x0661,0x0662,0x0663,0x0664,0x0665,0x0666,0x0667,0x0668,0x0669,0x066a,0x066b,0x0000,
                                                                        0x0670,0x0671,0x0672,0x0673,0x0674,0x0675,0x0676,0x0677,0x0678,0x0679,0x067a,0x067b,0x0000,
                                                                        0x0680,0x0681,0x0682,0x0683,0x0684,0x0685,0x0686,0x0687,0x0688,0x0689,0x068a,0x068b,0x0000,
                                                                        0x0690,0x0691,0x0692,0x0693,0x0694,0x0695,0x0696,0x0697,0x0698,0x0699,0x069a,0x069b,0x0000,
                                                                        0x06a0,0x06a1,0x06a2,0x06a3,0x06a4,0x06a5,0x06a6,0x06a7,0x06a8,0x06a9,0x06aa,0x06ab,0x0000,
                                                                        0x06b0,0x06b1,0x06b2,0x06b3,0x06b4,0x06b5,0x06b6,0x06b7,0x06b8,0x06b9,0x06ba,0x06bb,0x0000 };

//#define TIME 120

void Control_Sub()
{
        p1=volMEMBYTE(P1_CURRENT);
        ps=volMEMBYTE(PS_CURRENT);
        p1e=volMEMBYTE(P1_EDGE);
        
        if(button_available==true)
        {
                if((p1e&JOY_A)||(p1e&JOY_B)||(p1e&JOY_C))
                {
                        clearFixLayer();
                        action++;
                }
        }
}

/*void Position_Cursor_2_1()
{
        
}*/


void interval(TIME)
{
        BYTE textTimer=0;
        button_available=false;
        text_visible=false;
        
        while(1)
        {
                waitVBlank();
                
                if(++textTimer==TIME)
                {
                        textTimer=0;
                        button_available=true;
                        text_visible=true;
                }
        }
}

void introducion() {
        scroller sc;
        short posX=0;
        short posY=0;
        ushort *data;
        ushort flipMode=0;
        //BYTE textTimer=0;
        button_available=true;
        
        clearFixLayer();
        scrollerInit(&sc,&streamScroll,1,16,0,0);
        palJobPut(16, streamScroll.palInfo->count, streamScroll.palInfo->data);

        while(1) {
                SCClose();
                waitVBlank();
                Control_Sub();
                
                /*if(++textTimer==TIME)
                {
                        textTimer=0;
                        fixPrintf1(1,26,3,3,"                 ");
                }*/

                
                /*if(ps&P1_START) {
                        clearSprites(1,21);
                        SCClose();
                        waitVBlank();
                        return;
                }*/

                        
                if(action==0)
                {
                        fixPrint(1,3,0,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½.");
                        fixPrint(1,4,0,1,"������ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ ï¿½ï¿½.");  
                        fixPrint(1,5,0,1,"��, ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½! ï¿½ï¿½-���������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,6,0,1,"���� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }       
                
                if(action==1)
                {
                        clearSprites(1,21);
                        scrollerInit(&sc,&BG_SS_ExtCampEntranceSunset,1,16,0,0);
                        palJobPut(16, BG_SS_ExtCampEntranceSunset.palInfo->count, BG_SS_ExtCampEntranceSunset.palInfo->data);
                        
                        fixPrint(1,3,0,1,"� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,4,0,1,"������, ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");  
                        fixPrint(1,5,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(1,6,0,1,"���������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½... ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,7,0,1,"���������.");
                        fixPrint(1,8,0,1,"��� ï¿½ï¿½ï¿½ ï¿½ï¿½-������ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ ï¿½ï¿½-");        
                        fixPrint(1,9,0,1,"������� - ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½-�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,10,0,1,"��� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,11,0,1,"�������������: ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½!");
                        fixPrint(1,12,0,1,"�� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");   
                        fixPrint(1,13,0,1,"���������� ï¿½ï¿½ï¿½ï¿½, ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,14,0,1,"�������! ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½");
                        fixPrint(1,15,0,1,"������ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,16,0,1,"����� ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                
                if(action==2)
                {
                        clearSprites(1,21);
                        scrollerInit(&sc,&BG_ExtSquareSunset,1,16,0,0);
                        palJobPut(16, BG_ExtSquareSunset.palInfo->count, BG_ExtSquareSunset.palInfo->data);
                        
                        fixPrint(1,3,0,1,"��������, ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½");
                        fixPrint(1,4,0,1,"��������� ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");     
                        fixPrint(1,5,0,1,"����������. ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½? ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,6,0,1,"��������?");
                        fixPrint(1,7,0,1,"���-�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½");
                        fixPrint(1,8,0,1,"���������� ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½ ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½");     
                        fixPrint(1,9,0,1,"�����, ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½");
                        fixPrint(1,10,0,1,"�� ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½-�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½");
                        fixPrint(1,11,0,1,"������ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(1,12,0,1,"�������, ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");      
                        fixPrint(1,13,0,1,"�� ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½-���� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,14,0,1,"������... ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,15,0,1,"������������.");
                        fixPrint(1,16,0,1,"���� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,17,0,1,"������, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½");
                        fixPrint(1,18,0,1,"������������ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,19,0,1,"������. ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½.");        
                        fixPrint(1,20,0,1,"��� ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,21,0,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½-��");
                        fixPrint(1,22,0,1,"�������? ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,23,0,1,"�����. ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½");
                        fixPrint(1,24,0,1,"��������... ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,25,0,1,"�����������. ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                
                if(action==3)
                {
                        clearSprites(1,21);
                        scrollerInit(&sc,&BG_ExtDiningHallAwaySunset,1,16,0,0);
                        palJobPut(16, BG_ExtDiningHallAwaySunset.palInfo->count, BG_ExtDiningHallAwaySunset.palInfo->data);
                        
                        fixPrint(1,3,0,1,"�� ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,4,0,1,"�������. ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½.");       
                        fixPrint(1,5,0,1,"��� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,6,0,1,"��������, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(1,7,0,1,"� ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,8,0,1,"�����, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½");      
                        fixPrint(1,9,0,1,"� ï¿½ï¿½ï¿½ï¿½ï¿½!");
                }
                
                if(action==4)
                {
                        clearSprites(1,21);
                        SCClose();
                        waitVBlank();
                        action=0;
                        Day1();
                }
                
                scrollerSetPos(&sc,posX,posY);
        }
}

void Day1() {
        scroller sc;
        picture testPict;
        short posX=0;
        short posY=0;
        ushort *data;
        ushort flipMode=0;
        //BYTE textTimer=0;
        button_available=true;
        
        clearFixLayer();
        scrollerInit(&sc,&BG_ExtHouseOfMTSunset,1,16,0,0);
        palJobPut(16, BG_ExtHouseOfMTSunset.palInfo->count, BG_ExtHouseOfMTSunset.palInfo->data);

        while(1) {
                SCClose();
                waitVBlank();
                Control_Sub();
                
////////////Control////////////
//Select Options Action=2
                if(action==14)
                {
                        if(p1e&JOY_UP)
                        {
                                if(choice>=1)   choice--;
                        }
                        if(p1e&JOY_DOWN)
                        {
                                if(choice<2)    choice++;
                        }
                }
////////////Control////////////
                
                /*if(++textTimer==TIME)
                {
                        textTimer=0;
                        fixPrintf1(1,26,3,3,"                 ");
                }*/

                
                /*if(ps&P1_START) {
                        clearSprites(1,21);
                        SCClose();
                        waitVBlank();
                        return;
                }*/

                        
                if(action==0)
                {
                        fixPrint(1,27,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½... ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"�������� ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==1)
                {
                        clearSprites(1,21);
                        scrollerInit(&sc,&BG_IntHouseOfMTDay,1,16,0,0);
                        palJobPut(16, BG_IntHouseOfMTDay.palInfo->count, BG_IntHouseOfMTDay.palInfo->data);
                        
                        fixPrint(1,26,0,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,27,0,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");        
                        fixPrint(1,28,0,1,"�����������. ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==2)
                {
                        fixPrint(1,25,0,1,"���� ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,26,0,1,"�������. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½");        
                        fixPrint(1,27,0,1,"����� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½... ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,28,0,1,"���?");
                }
                if(action==3)
                {
                        fixPrint(1,27,0,1,"���� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½...");
                }
                if(action==4)
                {
                        clearSprites(1,21);
                        scrollerInit(&sc,&CGD2_Mirror,1,16,0,0);
                        palJobPut(16, CGD2_Mirror.palInfo->count, CGD2_Mirror.palInfo->data);
                        
                        fixPrint(1,27,0,1,"����� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½! ï¿½ï¿½ ï¿½ï¿½, ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"���-��� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½... ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==5)
                {
                        clearSprites(1,21);
                        scrollerInit(&sc,&BG_IntHouseOfMTDay,1,16,0,0);
                        palJobPut(16, BG_IntHouseOfMTDay.palInfo->count, BG_IntHouseOfMTDay.palInfo->data);
                        
                        fixPrint(1,26,0,1,"������, ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,27,0,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½-������ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==6)
                {
                        fixPrint(1,27,0,1,"������� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"��������. ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==7)
                {
                        fixPrint(1,25,0,1,"� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,26,0,1,"����������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");     
                        fixPrint(1,27,0,1,"������� - ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"����������.");
                }
                if(action==8)
                {
                        fixPrint(1,27,0,1,"��� ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½");
                        fixPrint(1,28,0,1,"��������� ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==9)
                {
                        clearSprites(1,21);
                        scrollerInit(&sc,&BG_ExtHouseOfMTSunset,1,16,0,0);
                        palJobPut(16, BG_ExtHouseOfMTSunset.palInfo->count, BG_ExtHouseOfMTSunset.palInfo->data);
                        pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,28,0,1,"������ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==10)
                {
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"�����, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==11)
                {
                        fixPrint(1,26,0,1,"�����:");
                        fixPrint(1,28,0,1,"��...");
                }
                if(action==12)
                {
                        fixPrint(1,25,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,27,1,1,"������, ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,1,1,"����������?");
                }
                if(action==13)
                {
                        fixPrint(1,24,0,1,"�� ï¿½ï¿½ ï¿½ï¿½ï¿½ \"��������\". ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,25,0,1,"����! ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½.");
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(1,27,0,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,28,0,1,"�����.");
                }
                if(action==14)
                {
                        fixPrint(3,25,choice==0?2:4,1,"������-�� ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(3,27,choice==1?2:4,1,"�����-�����.");
                        fixPrint(3,28,choice==2?2:4,1,"�� ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==19)
                {
                        fixPrint(1,23,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,25,1,1,"��� ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½! ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(1,26,1,1,"� ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½... ï¿½ï¿½");
                        fixPrint(1,27,1,1,"��������!");
                        fixPrint(1,28,1,1,"�������! ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==20)
                {
                        fixPrint(1,27,0,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½... ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½,");
                        fixPrint(1,28,0,1,"�����-������ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==21)
                {
                        fixPrint(1,26,0,1,"� ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,27,0,1,"�������?");
                        fixPrint(1,28,0,1,"� ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==22)
                {
                        fixPrint(1,25,0,1,"���� ï¿½ï¿½ï¿½, ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,26,0,1,"�������������� - ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,27,0,1,"�������� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"���������.");
                }
                if(action==23)
                {
                        fixPrint(1,26,0,1,"�����:");
                        fixPrint(1,28,0,1,"���! ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==24)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTLaughPanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTLaughPanamaPioneer.palInfo->count, MTLaughPanamaPioneer.palInfo->data);
                        
                        fixPrint(1,25,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,27,1,1,"��������� - ï¿½ï¿½ï¿½! ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½!");
                        fixPrint(1,28,1,1,"� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==25)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,27,0,1,"��-��! ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½");
                        fixPrint(1,28,0,1,"������ ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==26)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTSurprisePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSurprisePanamaPioneer.palInfo->count, MTSurprisePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==27)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTNormalPanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTNormalPanamaPioneer.palInfo->count, MTNormalPanamaPioneer.palInfo->data);
                        
                        fixPrint(1,25,0,1,"�����:");
                        fixPrint(1,27,1,1,"�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½... ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(1,28,1,1,"� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½-�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½...");
                }
                if(action==28)
                {
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"��� ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==29)
                {
                        fixPrint(1,25,0,1,"�����:");
                        fixPrint(1,27,1,1,"���! ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,28,1,1,"���������.");
                }
                if(action==30)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTSurprisePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSurprisePanamaPioneer.palInfo->count, MTSurprisePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"������...");
                }
                if(action==31)
                {
                        fixPrint(1,24,0,1,"�����:");
                        fixPrint(1,26,1,1,"��������� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,27,1,1,"��������. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,1,1,"�����.");
                }
                if(action==32)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,25,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,27,1,1,"�� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,28,1,1,"�����! ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==33)
                {
                        fixPrint(1,26,0,1,"�����:");
                        fixPrint(1,28,1,1,"�, ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½...");
                }
                if(action==34)
                {
                        fixPrint(1,26,0,1,"���������, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        fixPrint(1,27,0,1,"�������� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ ï¿½ï¿½? ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==35)
                {
                        fixPrint(1,26,0,1,"� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                        fixPrint(1,27,0,1,"������� ï¿½ï¿½ï¿½ï¿½ï¿½-�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"������������ ï¿½ï¿½ï¿½ï¿½ï¿½...");
                }
                if(action==36)
                {
                        fixPrint(1,26,0,1,"���������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,27,0,1,"��� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"���������! ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==37)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTNormalPanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTNormalPanamaPioneer.palInfo->count, MTNormalPanamaPioneer.palInfo->data);
                        
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"�����, ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==38)
                {
                        fixPrint(1,20,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,22,1,1,"��� ï¿½ï¿½ï¿½. ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,23,1,1,"������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,24,1,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,25,1,1,"����������, ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,26,1,1,"��� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,27,1,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,28,1,1,"�������������?");
                }
                if(action==39)
                {
                        fixPrint(1,21,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,23,1,1,"�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,24,1,1,"������, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,25,1,1,"���������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,26,1,1,"����������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,27,1,1,"�� ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ - ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,28,1,1,"�������.");
                }
                if(action==40)
                {
                        fixPrint(1,26,0,1,"�����:");
                        fixPrint(1,28,1,1,"�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½...");
                }
                if(action==41)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,23,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,25,1,1,"���� ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½! ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,26,1,1,"������ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½! ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½");
                        fixPrint(1,27,1,1,"��������������� ï¿½ï¿½ï¿½ï¿½! ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,28,1,1,"���� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==42)
                {
                        fixPrint(1,24,0,1,"�����:");
                        fixPrint(1,26,1,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ - ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                        fixPrint(1,27,1,1,"����������. ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½");
                        fixPrint(1,28,1,1,"����� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½...");
                }
                if(action==43)
                {
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"������, ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==44)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTNormalPanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTNormalPanamaPioneer.palInfo->count, MTNormalPanamaPioneer.palInfo->data);
                        
                        fixPrint(1,25,0,1,"�����:");
                        fixPrint(1,27,1,1,"��, ï¿½ï¿½ï¿½ï¿½ï¿½... ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,1,1,"� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==45)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTAngryPanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 80, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTAngryPanamaPioneer.palInfo->count, MTAngryPanamaPioneer.palInfo->data);
                
                        fixPrint(1,25,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,27,1,1,"�� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ -");
                        fixPrint(1,28,1,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==46)
                {
                        fixPrint(1,25,0,1,"�����:");
                        fixPrint(1,27,1,1,"������� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½... ï¿½ ï¿½ï¿½");
                        fixPrint(1,28,1,1,"�������� ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==47)
                {
                        fixPrint(1,23,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,25,1,1,"���������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,26,1,1,"������ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,27,1,1,"� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ - ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,1,1,"����������� ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==48)
                {
                        fixPrint(1,26,0,1,"�����:");
                        fixPrint(1,28,1,1,"�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==49)
                {
                        clearSprites(22,10);
                        pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"���-�� ï¿½ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==50)
                {
                        clearSprites(22,7);
                        interval(12);
                        
                        if(text_visible==true)
                        {
                                fixPrint(1,26,0,1,"�����:");
                                fixPrint(1,28,1,1,"�� ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½...");
                        }
                }
                if(action==51)
                {
                        fixPrint(1,27,0,1,"������� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"������� ï¿½ï¿½ï¿½-�� ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==52)
                {
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"���, ï¿½ï¿½ï¿½ï¿½ï¿½?");
                }
                if(action==53)
                {
                        fixPrint(1,26,0,1,"�����:");
                        fixPrint(1,28,1,1,"������...");
                }
                if(action==54)
                {
                        interval(24);
                        
                        if(text_visible==true)
                        {
                                fixPrint(1,22,0,1,"� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½? ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½-��");
                                fixPrint(1,23,0,1,"������� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,24,0,1,"������� ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½-�� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,25,0,1,"�����������? ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,26,0,1,"�������� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,27,0,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,28,0,1,"�������.");
                        }
                }
                if(action==55)
                {
                        pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,25,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,27,1,1,"���� ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,1,1,"������, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==56)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTGrinPanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTGrinPanamaPioneer.palInfo->count, MTGrinPanamaPioneer.palInfo->data);
                        
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"�� ï¿½ ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                if(action==57)
                {
                        fixPrint(1,28,0,1,"� ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½?! ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½!");
                }
                if(action==58)
                {
                        clearSprites(22,7);
                        pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                        palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                        
                        fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                        fixPrint(1,28,1,1,"������!");
                }
                /*
                if(action==59)
                {
                        interval(12);
                        
                        if(text_visible==true)
                        {
                                action++;
                        }
                }
                if(action==60)
                {
                        clearSprites(22,7);
                        interval(36);
                        
                        if(text_visible==true)
                        {
                                action++;
                        }
                }
                */

                if(action==59)
                {
                        clearSprites(1,28);
                        scrollerInit(&sc,&BG_ExtNoBus,1,16,0,0);
                        palJobPut(16, BG_ExtNoBus.palInfo->count, BG_ExtNoBus.palInfo->data);
                        
                        fixPrint(1,25,0,1,"��������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,26,0,1,"� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½,");
                        fixPrint(1,27,0,1,"��� ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½");
                        fixPrint(1,28,0,1,"�������� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                }
                
                if(choice==0)
                {
                        if(action==15)
                        {
                                fixPrint(1,25,0,1,"����� ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                                fixPrint(1,26,0,1,"���������. ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,27,0,1,"������ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,28,0,1,"���������.");
                        }
                        if(action==16)
                        {
                                fixPrint(1,27,0,1,"�������, ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½");
                                fixPrint(1,28,0,1,"������� \"�������\" ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        }
                        if(action==17)
                        {
                                action=19;
                        }
                }
                if(choice==1)
                {
                        if(action==15)
                        {
                                fixPrint(1,28,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                        }
                        if(action==16)
                        {
                                choice=0;
                                action=19;
                        }
                }
                if(choice==2)
                {
                        if(action==15)
                        {
                                fixPrint(1,26,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ ï¿½ï¿½");
                                fixPrint(1,27,0,1,"��� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½");
                                fixPrint(1,28,0,1,"�������, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½-�� ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½.");
                        }
                        if(action==16)
                        {
                                clearSprites(22,7);
                                pictureInit(&testPict, &MTAngryPanamaPioneerClose,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 64, 0,FLIP_NONE);
                                palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTAngryPanamaPioneerClose.palInfo->count, MTAngryPanamaPioneerClose.palInfo->data);
                                
                                fixPrint(1,23,0,1,"����� ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½:");
                                fixPrint(1,25,1,1,"�����! ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½? ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½");
                                fixPrint(1,26,1,1,"��������� ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½.");
                                fixPrint(1,27,1,1,"������, ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½, ï¿½ ï¿½");
                                fixPrint(1,28,1,1,"������ ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½. ï¿½ï¿½?");
                        }
                        if(action==17)
                        {
                                fixPrint(1,26,0,1,"�����:");
                                fixPrint(1,28,0,1,"...� ï¿½ ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½?");
                        }
                        if(action==18)
                        {
                                clearSprites(22,12);
                                pictureInit(&testPict, &MTSmilePanamaPioneer,22, 16 + BG_ExtHouseOfMTSunset.palInfo->count, 104, 0,FLIP_NONE);
                                palJobPut(16 + BG_ExtHouseOfMTSunset.palInfo->count, MTSmilePanamaPioneer.palInfo->count, MTSmilePanamaPioneer.palInfo->data);
                                choice=0;
                                action++;
                        }
                }
                
                scrollerSetPos(&sc,posX,posY);
        }
}

void colorStreamDemoB() {
        scroller sc;
        colorStream stream;
        short posX=0;
        short posY=0;
        uint *plj;
        ushort lastJobs=0,jobs=0;

        
        clearFixLayer();
        scrollerInit(&sc,&SNKLogoStrip,1,16,0,0);
        colorStreamInit(&stream,&SNKLogoStrip_colorStream,16,COLORSTREAM_STARTCONFIG);

        fixPrint(2,3,4,3,"1P \x12\x13: scroll");
        fixPrint(2,29,6,3,"(Sequence formatted by MegaShocked)");
        
        while(1) {
                SCClose();
                
                //check palJobs load
                if(jobs!=0)     lastJobs=jobs;
                jobs=0;
                plj=PALJOBS;
                while(*plj!=0xffffffff) {
                        jobs+=((*plj++)>>16)+1;
                        plj++;
                }
                //fixPrintf1(0,2,3,3,"Jobs:%d (last:%d)   ",jobs,lastJobs);

                waitVBlank();

                p1=volMEMBYTE(P1_CURRENT);
                ps=volMEMBYTE(PS_CURRENT);
                p1e=volMEMBYTE(P1_EDGE);
                
                if(ps&P1_START) {
                        clearSprites(1,21);
                        SCClose();
                        waitVBlank();
                        return;
                }
                
                if(p1&JOY_B) {
                        if(p1e&JOY_UP)  posY-=224;
                        if(p1e&JOY_DOWN)posY+=224;
                } else {
                        if(p1&JOY_UP)   posY-=p1&JOY_A?224:1;
                        if(p1&JOY_DOWN) posY+=p1&JOY_A?224:1;
                }
                if(posY<0) posY=0;
                if(posY>(SNKLogoStrip.mapHeight-14)<<4) posY=(SNKLogoStrip.mapHeight-14)<<4;
                
                //fixPrintf1(0,1,3,3,"%d    ",posY);
                
                scrollerSetPos(&sc,posX,posY);
                colorStreamSetPos(&stream,posY);
        }
}

int main(void) {
        int scrl_x=0;
        int scrl_y=0;
        short showdebug=false;
        scroller frontScroll;
        ushort *data;
        ushort flipMode=0;
        
        clearFixLayer();
        initGfx();

        palJobPut(0,8,fixPalettes);

        //if(setup4P())
        //      fixPrint(2,4,7,3,"4P! :)");
        //else fixPrint(2,4,7,3,"no 4P :(");

        backgroundColor(0x7bbb);
        jobMeterSetup(true);

        scrollerInit(&frontScroll, &ffbg_b, 1, 16, scrl_x, scrl_y);
        //scrollerInitClipped(&frontScroll, &ffbg_b, 22, 16 + ffbg_a.palInfo->count, x, y, CLIPPING);
        palJobPut(16, ffbg_b.palInfo->count, ffbg_b.palInfo->data);

        data=dbgTags.maps[0];
        palJobPut(200,dbgTags.palInfo->count,&dbgTags.palInfo->data);
        SC234Put(VRAM_POSX_ADDR(200),VRAM_POSX(0));
        SC234Put(VRAM_POSY_ADDR(200),VRAM_POSY(224,SPR_UNLINK,0));
        SC234Put(VRAM_SPR_ADDR(200),data[4<<1]);
        SC234Put(VRAM_SPR_ADDR(200)+1,200<<8);
        SC234Put(VRAM_POSX_ADDR(201),VRAM_POSX(0));
        SC234Put(VRAM_POSY_ADDR(201),VRAM_POSY(224,SPR_UNLINK,0));
        SC234Put(VRAM_SPR_ADDR(201),data[40<<1]);
        SC234Put(VRAM_SPR_ADDR(201)+1,200<<8);
        SC234Put(VRAM_POSX_ADDR(202),VRAM_POSX(0));
        SC234Put(VRAM_POSY_ADDR(202),VRAM_POSY(224,SPR_UNLINK,0));
        SC234Put(VRAM_SPR_ADDR(202),data[40<<1]);
        SC234Put(VRAM_SPR_ADDR(202)+1,(200<<8)|FLIP_X);
        SC234Put(VRAM_POSX_ADDR(203),VRAM_POSX(0));
        SC234Put(VRAM_POSY_ADDR(203),VRAM_POSY(224,SPR_UNLINK,0));
        SC234Put(VRAM_SPR_ADDR(203),data[40<<1]);
        SC234Put(VRAM_SPR_ADDR(203)+1,(200<<8)|FLIP_Y);
        SC234Put(VRAM_POSX_ADDR(204),VRAM_POSX(0));
        SC234Put(VRAM_POSY_ADDR(204),VRAM_POSY(224,SPR_UNLINK,0));
        SC234Put(VRAM_SPR_ADDR(204),data[40<<1]);
        SC234Put(VRAM_SPR_ADDR(204)+1,(200<<8)|FLIP_XY);
        
        fixPrint(14,20,4,3,"PRESS START");
        
        while(1) {
                SCClose();
                waitVBlank();

                p1=volMEMBYTE(P1_CURRENT);
                p1e=volMEMBYTE(P1_EDGE);
                ps=volMEMBYTE(PS_EDGE);
                
                while((volMEMWORD(0x3c0006)>>7)!=0x120); //wait raster line 16
                jobMeterColor(JOB_BLUE);

                /*if((p1&JOY_UP)&&y>=176)       y--;
                if((p1&JOY_DOWN)&&y<=220)       y++;
                if((p1&JOY_LEFT)&&x>=32)
                {
                        x--;
                        flipMode|=FLIP_X;
                        aSpriteSetFlip(&demoSpr,flipMode);
                }
                if((p1&JOY_RIGHT)&&x<=288)
                {
                        x++;
                        flipMode&=~FLIP_X;
                        aSpriteSetFlip(&demoSpr,flipMode);
                }*/

                
                if(ps&P1_START) {
                        clearSprites(1, 42);
                        SCClose();
                        waitVBlank();
                        introducion();
                }
                
                if(p1e&JOY_D) {
                        if(showdebug) {
                                //move debug stuff offscreen
                                SC234Put(VRAM_POSY_ADDR(200),VRAM_POSY(224,SPR_UNLINK,0));
                                SC234Put(VRAM_POSY_ADDR(201),VRAM_POSY(224,SPR_UNLINK,0));
                                SC234Put(VRAM_POSY_ADDR(202),VRAM_POSY(224,SPR_UNLINK,0));
                                SC234Put(VRAM_POSY_ADDR(203),VRAM_POSY(224,SPR_UNLINK,0));
                                SC234Put(VRAM_POSY_ADDR(204),VRAM_POSY(224,SPR_UNLINK,0));
                                fixJobPut(0,25,FIX_LINE_WRITE,0,_fixBlankLine);
                                fixJobPut(0,26,FIX_LINE_WRITE,0,_fixBlankLine);
                                fixJobPut(0,27,FIX_LINE_WRITE,0,_fixBlankLine);
                                fixJobPut(0,28,FIX_LINE_WRITE,0,_fixBlankLine);
                        }
                        showdebug^=1;
                }

                //aSprite debug info
                /*if(showdebug) {
                        jobMeterColor(JOB_BLACK);
                        if(!(demoSpr.flags&AS_FLAG_STRICT_COORDS)) {
                                if(demoSpr.currentFlip&FLIP_X) relX=x-((demoSpr.currentFrame->tileWidth<<4)+demoSpr.currentStep->shiftX)+1;
                                        else relX=x+demoSpr.currentStep->shiftX;
                                if(demoSpr.currentFlip&FLIP_Y) relY=y-((demoSpr.currentFrame->tileHeight<<4)+demoSpr.currentStep->shiftY)+1;
                                        else relY=y+demoSpr.currentStep->shiftY;
                        } else {
                                relX=demoSpr.posX;
                                relY=demoSpr.posY;
                        }
                        SC234Put(VRAM_POSX_ADDR(200),VRAM_POSX(x-3));
                        SC234Put(VRAM_POSY_ADDR(200),VRAM_POSY(y-3,SPR_UNLINK,1));
                        SC234Put(VRAM_POSX_ADDR(201),VRAM_POSX(relX));
                        SC234Put(VRAM_POSY_ADDR(201),VRAM_POSY(relY,SPR_UNLINK,1));
                        SC234Put(VRAM_POSX_ADDR(202),VRAM_POSX(relX+((demoSpr.currentFrame->tileWidth-1)<<4)));
                        SC234Put(VRAM_POSY_ADDR(202),VRAM_POSY(relY,SPR_UNLINK,1));
                        SC234Put(VRAM_POSX_ADDR(203),VRAM_POSX(relX));
                        SC234Put(VRAM_POSY_ADDR(203),VRAM_POSY(relY+((demoSpr.currentFrame->tileHeight-1)<<4),SPR_UNLINK,1));
                        SC234Put(VRAM_POSX_ADDR(204),VRAM_POSX(relX+((demoSpr.currentFrame->tileWidth-1)<<4)));
                        SC234Put(VRAM_POSY_ADDR(204),VRAM_POSY(relY+((demoSpr.currentFrame->tileHeight-1)<<4),SPR_UNLINK,1));
                        
                        //debug live update prints = 1 frame ahead. meh.
                        jobMeterColor(JOB_GREY);
                        fixPrintf1(3,25,2,3,"Anim data: A:%02d S:%02d R:%02d   ",demoSpr.currentAnim,demoSpr.stepNum,demoSpr.repeats);
                        fixPrintf1(3,26,2,3,"Step data: Frame:0x%06x",bmary_spr.anims[demoSpr.currentAnim][demoSpr.stepNum].frame);
                        fixPrintf1(14,27,2,3,"SX:%04d SY:%04d D:%02d",
                                bmary_spr.anims[demoSpr.currentAnim][demoSpr.stepNum].shiftX,
                                bmary_spr.anims[demoSpr.currentAnim][demoSpr.stepNum].shiftY,
                                bmary_spr.anims[demoSpr.currentAnim][demoSpr.stepNum].duration
                        );
                        fixPrintf1(2,28,2,3,"Frame data: W:%02d H:%02d TMAP:0x%06x",
                                ((sprFrame*)(bmary_spr.anims[demoSpr.currentAnim][demoSpr.stepNum].frame))->tileWidth,
                                ((sprFrame*)(bmary_spr.anims[demoSpr.currentAnim][demoSpr.stepNum].frame))->tileHeight,
                                ((sprFrame*)(bmary_spr.anims[demoSpr.currentAnim][demoSpr.stepNum].frame))->maps[demoSpr.currentFlip]
                        );
                }*/

                
                scrollerSetPos(&frontScroll, scrl_x, scrl_y);
                //scrollerSetPosClipped(&frontScroll, x, y, CLIPPING);

                jobMeterColor(JOB_GREEN);
        }
}