/* FINAL DRAGON STATUS DISPLAY SCREEN 4/25/05
JESSE HARRIS
READS KEYPAD INPUT FOR START KEY TO EXIT STATUS SCREEN
*/
#include <mygba.h>
#include <hel.h>
#include <iostream.h>

#include "modules.h"
#include "samples.h"
#include "stuff.hpp"

extern u16 delay;
extern u8 sprites[127];
extern player watashi;
extern TCustomTextInfo g_TextInfo;
u8 hitstart = 0;
extern u8 stepstobattle;
extern chandle g_hChannel;
u8 sampletest = 0;  // for use in sound test code

int myStatus()
{
    //if you hit start return to map
    hel_PadReadState();
    if(hel_Pad.Held.Start && !delay)
    {
        stepstobattle++;
        hitstart = 1;
        delay = 20;
    }
    
    //save code for use when troubleshooting
    //not as needed anymore but still useful in some situations
    //remove /*  */ to enable and press A on the status screen to untilize
    /*
    if(hel_Pad.Held.A && !delay)//save code
    {
        int tempint;
        tempint = watashi.x;
        ham_SaveIntToRAM("X", tempint);
        tempint = watashi.y;
        ham_SaveIntToRAM("Y", tempint);
        tempint = watashi.map;
        ham_SaveIntToRAM("Map", tempint);
        tempint = watashi.textnum;
        ham_SaveIntToRAM("Textnum", tempint);
        tempint = watashi.musicnum;
        ham_SaveIntToRAM("Musicnum", tempint);
        tempint = watashi.dir;
        ham_SaveIntToRAM("Dir", tempint);
        tempint = watashi.hp;
        ham_SaveIntToRAM("Hp", tempint);
        tempint = watashi.maxhp;
        ham_SaveIntToRAM("Maxhp", tempint);
        tempint = watashi.mp;
        ham_SaveIntToRAM("Mp", tempint);
        tempint = watashi.maxmp;
        ham_SaveIntToRAM("Maxmp", tempint);
        tempint = watashi.exp;
        ham_SaveIntToRAM("Exp", tempint);
        tempint = watashi.level;
        ham_SaveIntToRAM("Level", tempint);
        tempint = watashi.playerstate;
        ham_SaveIntToRAM("Playerstate", tempint);

        delay = 20;
    }*/
    //end save code

    //sound test code
    //Just Remove the /*  */ to enable R and L based sound effects testing
    //you can cycle through as sound effects available in the .s3m files

    //WRITE SOUND NOTES HERE \/
    //69 hit, miss 72, flee 85, cursor move 48
    /*
    if((hel_Pad.Held.L || hel_Pad.Held.R) && !delay)//save code
    {
        char tempy[18];
        if(hel_Pad.Held.L)
        {
            sampletest--;
            if(sampletest < 0)
            {
                sampletest = 0;
            }
        }
        if(hel_Pad.Held.R)
        {
            sampletest++;
        }
        sprintf(tempy, "Musin num: %d", sampletest);
        hel_CustomTextPrint(&g_TextInfo, 2, 16, tempy);
        g_hChannel = kramPlay(samples[sampletest], KRAM_QM_NORMAL, g_hChannel);
        delay = 15;
    }*/
    
    //if start is hit return to map
    if(delay == 1  && hitstart)
    {
        ham_SetBgVisible(2,0);
        hel_CustomTextClear(&g_TextInfo);
        for(int x = 0; x < 119; x++)
        {
            ham_SetObjVisible(sprites[x], 1);
        }
        delay=20;
        hitstart = 0;
        return 1;
    }
    //wait for delay to go away
    if(delay)
    {
        delay--;
        return 0;
    }

    return 0;
}


/* END OF FILE */
