/* FINAL DRAGON SET UP BATTLE CODE MODULE 4/25/05
JESSE HARRIS
SET VARIABLES ANS SCREEN DISPLAY FOR BATTLE
*/
#include <mygba.h>
#include <hel.h>
#include <iostream.h>
#include "stuff.hpp"
#include "drawtextbox.h"

extern u16 delay;
extern u8 sprites[127];
extern player watashi;
extern TCustomTextInfo g_TextInfo;
extern monster monsterlist[];

void myBattleInit()
{
    delay = 20;  //global delay
    char tempy[18];

    //turn off sprites
    for(int x = 0; x < 119; x++)
    {
        ham_SetObjVisible(sprites[x], 0);
    }
    
    //mathematic functions
    monsterlist[watashi.monster].hp = monsterlist[watashi.monster].maxhp;


    //monster show
    ham_LoadObjPal16(monsterlist[watashi.monster].palette, 15);
    sprites[120] = ham_CreateObj(monsterlist[watashi.monster].spritenw,OBJ_SIZE_32X32,OBJ_MODE_NORMAL,0,15,0,0,0,0,0,16 * 8,3 * 8);
    sprites[121] = ham_CreateObj(monsterlist[watashi.monster].spritesw,OBJ_SIZE_32X32,OBJ_MODE_NORMAL,0,15,0,0,0,0,0,16 * 8,7 * 8);
    sprites[122] = ham_CreateObj(monsterlist[watashi.monster].spritene,OBJ_SIZE_32X32,OBJ_MODE_NORMAL,0,15,0,0,0,0,0,20 * 8,3 * 8);
    sprites[123] = ham_CreateObj(monsterlist[watashi.monster].spritese,OBJ_SIZE_32X32,OBJ_MODE_NORMAL,0,15,0,0,0,0,0,20 * 8,7 * 8);
    //end monster show
    
    ham_SetBgVisible(2,1);
    //main border
    drawTextBox(g_TextInfo,0,0,29,19);
    //command border
    drawTextBox(g_TextInfo,1,1,12,3. );
    //enemy info border
    drawTextBox(g_TextInfo,1,6,12,5);
    //bad guy picture border
    drawTextBox(g_TextInfo,15,2,9,9);
    //stats border 1
    drawTextBox(g_TextInfo,1,15,13,3);
    //stats border 2
    drawTextBox(g_TextInfo,15,15,13,3);

    //enemy info display
    hel_CustomTextPrint(&g_TextInfo, 2, 2, monsterlist[watashi.monster].name);
    sprintf(tempy, "HP: %d/%d", monsterlist[watashi.monster].hp, monsterlist[watashi.monster].maxhp);
    hel_CustomTextPrint(&g_TextInfo, 2, 3, tempy);
    //end enemy info

    //name and level display
    hel_CustomTextPrint(&g_TextInfo, 2, 16, "Celes");
    sprintf(tempy, "Level: %d  ", watashi.level);
    hel_CustomTextPrint(&g_TextInfo, 2, 17, tempy);
    //status display
    sprintf(tempy, "HP: %d/%d  ", watashi.hp, watashi.maxhp);
    hel_CustomTextPrint(&g_TextInfo, 16, 16, tempy);
    sprintf(tempy, "MP: %d/%d  ", watashi.mp, watashi.maxmp);
    hel_CustomTextPrint(&g_TextInfo, 16, 17, tempy);
    //cursor and options display
    hel_CustomTextPrint(&g_TextInfo, 2, 7, ">");
    hel_CustomTextPrint(&g_TextInfo, 3, 7, "Attack");
    hel_CustomTextPrint(&g_TextInfo, 3, 8, "Hurt Spell");
    hel_CustomTextPrint(&g_TextInfo, 3, 9, "Heal Spell");
    hel_CustomTextPrint(&g_TextInfo, 3, 10, "Flee");
    return;
}


/* END OF FILE */
