#include "AGBSW.h" int main() { Menu_Main(); // test(); return 1; } #define Draw_printCenter(s, x) Draw_printCenter((char *)s, x) void Jouer() { Level lvl("W1L1"); lvl.load((IsEmul() ? SD : ROOT)); lvl.debug((IsEmul() ? SD : ROOT)); lvl.play(); } void test() { unsigned int key; const unsigned char s[]={ 0x0, 0x7, 0xc0, 0x3, 0x0, 0x7f, 0xf0, 0x3, 0x1, 0xe0, 0xfc, 0x3, 0x3, 0x0, 0x7e, 0x3, 0x7, 0x0, 0x7f, 0x83, 0xe, 0x20, 0x1f, 0xc3, 0x18, 0x10, 0x1f, 0xe3, 0x30, 0x0, 0xf, 0xe3, 0x78, 0x0, 0x7, 0xf3, 0x78, 0x1, 0x7, 0xf3, 0x58, 0x2, 0x7, 0xfb, 0xc0, 0x0, 0xf, 0xfb, 0x80, 0x0, 0xf, 0xfb, 0x80, 0x40, 0xf, 0xfb, 0x80, 0x80, 0x1f, 0xff, 0x81, 0x40, 0x7f, 0x8f, 0x81, 0x0, 0x7f, 0xf, 0xc0, 0x0, 0x7e, 0xf, 0xc0, 0x0, 0xf8, 0xb, 0xc0, 0x0, 0xf0, 0x8b, 0x5c, 0x3, 0xf1, 0x1b, 0x71, 0xe7, 0xc0, 0x13, 0x7f, 0xff, 0xc0, 0x33, 0x3f, 0xff, 0x0, 0x23, 0x1f, 0xfe, 0x20, 0x63, 0x1f, 0xfc, 0x10, 0xc3, 0xf, 0xfc, 0x1, 0x83, 0x3, 0xfe, 0x7, 0x3, 0x1, 0xff, 0x1c, 0x3, 0x0, 0x7f, 0xf0, 0x3, 0x0, 0x7, 0x0, 0x3, }; ML_clear_vram(); ML_bmp_or_zoom(s, 0, 0, 30, 31, 2, 2); while(1) GetKey(&key); } void Menu_Main() { unsigned int key=0; char i=0; while(1) { while(key != KEY_CTRL_EXE) { ML_clear_vram(); Draw_printCenter("ANGRY BIRD STAR WARS", 0); PrintMini(10, 20, "JOUER"); PrintMini(10, 28, "STATS"); PrintMini(10, 36, "OPTIONS"); PrintMini(10, 44, "CREDITS"); PrintMini(10, 52, "QUITTER"); PrintMini(3, 20+8*i, ">"); GetKey(&key); switch(key) { case KEY_CTRL_DOWN: i++; if(i>4) i=0; break; case KEY_CTRL_UP: i--; if(i<0) i=4; break; case KEY_CTRL_EXIT: return; } } key=0; switch(i) { case 0: Jouer(); break; case 1: Menu_Stats(); break; case 2: Menu_Options(); break; case 3: Menu_Credits(); break; case 4: return; } } } void Menu_Stats() { unsigned int key=0; int i=0; while(1) { while(key!=KEY_CTRL_EXE) { ML_clear_vram(); Draw_printCenter("STATISTIQUES", 0); PrintMini(10, 20, "NB DE PIAFS"); PrintMini(10, 28, "NB DE NIVEAUX"); PrintMini(10, 36, "TEMPS DE JEU"); PrintMini(10, 44, "SUCCES"); PrintMini(10, 52, "RETOUR"); PrintMini(3, 44+8*i, ">"); GetKey(&key); switch(key) { case KEY_CTRL_DOWN: case KEY_CTRL_UP: i = (i==0 ? 1 : 0); break; case KEY_CTRL_EXIT: return; } } key=0; switch(i) { case 0: Menu_Succes(); break; case 1: return; } } } void Menu_Options() { unsigned int key=0; int i = 0; while(1) { while(key!=KEY_CTRL_EXE) { ML_clear_vram(); Draw_printCenter("OPTIONS", 0); PrintMini(10, 20, "REINITIALISER"); PrintMini(10, 28, "RETOUR"); PrintMini(3, 20+8*i, ">"); GetKey(&key); switch(key) { case KEY_CTRL_DOWN: case KEY_CTRL_UP: i = (i==0 ? 1 : 0); break; case KEY_CTRL_EXIT: return; } } key=0; switch(i) { case 0: break; case 1: return; } } } void Menu_Succes() { unsigned int key=0; while(key!=KEY_CTRL_EXE && key!=KEY_CTRL_EXIT) { ML_clear_vram(); Draw_printCenter("SUCCES", 0); Draw_printCenter("A FAIRE", 32); GetKey(&key); } } void Menu_Credits() { unsigned int key=0; ML_clear_vram(); Draw_printCenter("CREDITS", 0); Draw_printText("Ce jeu a ete developpe par TheProg avec l'aide de la communaute planete-casio", 5, 20); Draw_printCenter("PRESS [EXE]", 58); while(key!=KEY_CTRL_EXE) GetKey(&key); } bool IsEmul() { int model = *(int*)0x80000300; switch(model) { case 0 : return true; case 0x33363246: /* if ( *(int*)0x8024FEE0 == 0xB4393341) return G35; else return UNDEFINED; */ case 0x34393542: // G75 case 0x80005D7C : // G85 // if((int*)((*SysCall)(0, 0, 0, 0, 1128))) G75SD; case 0x34393342 : // G95 default : return false; } } void DEBUG(int value) { char buf[25]; unsigned int key=0; sprintf(buf, "%d", value); PrintMini(0, 0, buf); while(key!=KEY_CTRL_EXE) GetKey(&key); }