diff --git a/AddinInfo.txt b/AddinInfo.txt new file mode 100644 index 0000000..5f3c406 --- /dev/null +++ b/AddinInfo.txt @@ -0,0 +1,12 @@ +//------------------------------------------------------------------ +// Addin-Application header control file, created with the CASIO SDK +//------------------------------------------------------------------ +[OUTPUT] : "SUPERCBR.G1A" +[BINDATA] : "FXADDINror.bin" +[DISPNAME] : "SuperCbr" +[APPNAME] : "@SUPERCB" +[VERSION] : "01.00.0000" +[APL_ICON] : "MainIcon.bmp" +[MODULE_NUM] : 0 +[MOD1_TITLE] : "SuperCbr" +[MOD1_ICON] : "eActivityIcon.bmp" diff --git a/MainIcon.bmp b/MainIcon.bmp new file mode 100644 index 0000000..3fe372c Binary files /dev/null and b/MainIcon.bmp differ diff --git a/SuperCbr.c b/SuperCbr.c new file mode 100644 index 0000000..1faaffd --- /dev/null +++ b/SuperCbr.c @@ -0,0 +1,77 @@ +/*****************************************************************/ +/* */ +/* CASIO fx-9860G SDK Library */ +/* */ +/* File name : [ProjectName].c */ +/* */ +/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ +/* */ +/*****************************************************************/ +#include "fxlib.h" + + +//**************************************************************************** +// AddIn_main (Sample program main function) +// +// param : isAppli : 1 = This application is launched by MAIN MENU. +// : 0 = This application is launched by a strip in eACT application. +// +// OptionNum : Strip number (0~3) +// (This parameter is only used when isAppli parameter is 0.) +// +// retval : 1 = No error / 0 = Error +// +//**************************************************************************** +int AddIn_main(int isAppli, unsigned short OptionNum) +{ + unsigned int key; + + Bdisp_AllClr_DDVRAM(); + + locate(1,4); + Print((unsigned char*)"This application is"); + locate(1,5); + Print((unsigned char*)" sample Add-In."); + + while(1){ + GetKey(&key); + } + + return 1; +} + + + + +//**************************************************************************** +//************** **************** +//************** Notice! **************** +//************** **************** +//************** Please do not change the following source. **************** +//************** **************** +//**************************************************************************** + + +#pragma section _BR_Size +unsigned long BR_Size; +#pragma section + + +#pragma section _TOP + +//**************************************************************************** +// InitializeSystem +// +// param : isAppli : 1 = Application / 0 = eActivity +// OptionNum : Option Number (only eActivity) +// +// retval : 1 = No error / 0 = Error +// +//**************************************************************************** +int InitializeSystem(int isAppli, unsigned short OptionNum) +{ + return INIT_ADDIN_APPLICATION(isAppli, OptionNum); +} + +#pragma section + diff --git a/SuperCbr.dlw b/SuperCbr.dlw new file mode 100644 index 0000000..b15c362 --- /dev/null +++ b/SuperCbr.dlw @@ -0,0 +1,112 @@ +[DLSimWorkSpace] + +[_1] +Type=5 +Order=5 +Top=15 +Left=2235 +Height=4740 +Width=5565 +State=0 +Flags=00000020 +OptionA=0 + +[_2] +Type=1 +Order=4 +Top=15 +Left=7800 +Height=4740 +Width=5535 +State=0 +Flags=00000001 +OptionA=15 +OptionB=15 + +[_3] +Type=6 +Order=2 +Top=4740 +Left=7800 +Height=6390 +Width=5535 +State=0 +Flags=00000001 +OptionA=0 + +[_4] +Type=7 +Order=1 +Top=4740 +Left=2220 +Height=3165 +Width=5565 +State=0 +Flags=00000000 +OptionA=0 + +[_5] +Type=8 +Order=0 +Top=7905 +Left=2220 +Height=3225 +Width=5580 +State=0 +Flags=00000000 +OptionA=0 + +[_6] +Type=3 +Order=9 +Top=0 +Left=10788 +Height=6348 +Width=2232 +State=16 +Flags=00000000 +OptionA=0 + +[_7] +Type=2 +Order=8 +Top=6348 +Left=7800 +Height=3588 +Width=5220 +State=16 +Flags=00000000 +OptionA=0 + +[_8] +Type=17 +Order=3 +Top=15 +Left=-15 +Height=11115 +Width=2235 +State=0 +Flags=00000000 +OptionA=0 + +[_9] +Type=15 +Order=6 +Top=4740 +Left=2232 +Height=6348 +Width=5592 +State=16 +Flags=00000000 +OptionA=0 + +[_32] +Type=16 +Order=7 +Top=0 +Left=2208 +Height=4584 +Width=5592 +State=16 +Flags=00000020 +OptionA=0 diff --git a/SuperCbr.g1a b/SuperCbr.g1a index 7b61658..bb02213 100644 Binary files a/SuperCbr.g1a and b/SuperCbr.g1a differ diff --git a/SuperCbr.g1w b/SuperCbr.g1w new file mode 100644 index 0000000..55f40dd --- /dev/null +++ b/SuperCbr.g1w @@ -0,0 +1,15 @@ +[DLSimProject] +Name=SuperCbr +Version=1.00.0000 +Model=:fx-9860G.dlm +SourcePath=SRC +MemoryPath=INIT +MemCardPath=SDCard + +[Program1] +Program=SUPERCBR.G1A +Debug=Debug\FXADDINror.dbg +LoadAddress=80000000:90100000 + +[Files] +SourceFile=:SuperCbr.c diff --git a/eActivityIcon.bmp b/eActivityIcon.bmp new file mode 100644 index 0000000..104a2c6 Binary files /dev/null and b/eActivityIcon.bmp differ diff --git a/include/levelchanger.h b/include/levelchanger.h index c4db6a8..f54c2f4 100644 --- a/include/levelchanger.h +++ b/include/levelchanger.h @@ -1,6 +1,6 @@ #ifndef LEVEL_CHANGE_H #define LEVEL_CHANGE_H -void launch_ui(); +void LaunchUI(); #endif \ No newline at end of file diff --git a/include/score.h b/include/score.h index a5328a0..74447cc 100644 --- a/include/score.h +++ b/include/score.h @@ -16,10 +16,14 @@ void score_display(); void score_add_coin(); void new_level(); void new_game(); -int lifes_get(); -void lifes_lose(); -void lifes_add(); + int get_time_spent(); +/* Lifes Management */ + +int LifesGet(); +void LifesSet(int); +void LifesAdd(int); + #endif diff --git a/src/bonus.c b/src/bonus.c index f33d071..b64d0f0 100644 --- a/src/bonus.c +++ b/src/bonus.c @@ -74,7 +74,7 @@ void bonus_move() //+collision { bonus_set(BONUS_NONE,0,0); score_add(1000); - lifes_add(); + LifesAdd(1); } if (bonus.type==BONUS_STAR) { diff --git a/src/ennemi.c b/src/ennemi.c index 9e0ffd4..3de369d 100644 --- a/src/ennemi.c +++ b/src/ennemi.c @@ -4,19 +4,13 @@ #include "tile.h" #include "world.h" #include "score.h" +#include #include +#include +#include #include -static int sgn(int x) -{ - if (x==0) - return 0; - else if (x>0) - return 1; - return -1; -} - const int ennemi_widths [NOMBRE_ENNEMIS] = {0, 8, 8, 8, 8 , 8}; const int ennemi_heights[NOMBRE_ENNEMIS] = {0, 8, 12, 9, 12, 9}; diff --git a/src/keyboard.c b/src/keyboard.c index 9128ddb..389fb8c 100755 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -67,8 +67,6 @@ static int menu_pause() // 1 exit, 0 continue case KEY_MENU: return 1; - case KEY_OPTN: - choice=2; // fall through case KEY_EXE: if (choice==2) @@ -142,7 +140,7 @@ void mkb_update() if(e.key==KEY_DOWN) k=MK_DOWN; - if(e.key==KEY_ALPHA) + if(e.key==KEY_OPTN) k=MK_RUN; if(keydown(KEY_EXIT)) diff --git a/src/levelchanger.c b/src/levelchanger.c index 9173a34..818f430 100644 --- a/src/levelchanger.c +++ b/src/levelchanger.c @@ -19,7 +19,7 @@ static void levelchanger(int w) { - int play_level(int w, int l); + int play_level(int w, int l); // déclaration de la fonction codée plus bas extern image_t img_levelchanger; @@ -96,19 +96,19 @@ static void levelchanger(int w) get_lvl_id(w, i, lvl); dtext(53,28, lvl, C_WHITE, C_BLACK); - sprintf(lvl, "%d", lifes_get()); + sprintf(lvl, "%d", LifesGet()); dtext(65,54, lvl, C_WHITE, C_BLACK); dupdate(); sleep_ms(3,2000); int a=play_level(w, i); if (a==0) - lifes_lose(); + LifesAdd(-1); if (a==1) i++; if (a==-1) break; - if (lifes_get()==0) + if (LifesGet()==0) { extern image_t img_game_over; dimage(0,0,&img_game_over); @@ -128,7 +128,7 @@ static void levelchanger(int w) get_lvl_id(w, choice, lvl); dtext(53,28, lvl, C_WHITE, C_BLACK); - sprintf(lvl, "%d", lifes_get()); + sprintf(lvl, "%d", LifesGet()); dtext(65,54, lvl, C_WHITE, C_BLACK); dupdate(); sleep_ms(3,2000); @@ -161,17 +161,18 @@ static void levelchanger(int w) -void launch_ui() +void LaunchUI() // Main Menu { extern image_t img_mainmenu; const int xt=17,yt=9; - int choice_x=0, choice_y=0; + unsigned int choice_x=0, choice_y=0; while (1) { mkb_clear(); dimage(0,0,&img_mainmenu); + // Draw world images, but only unlocked ones //Show unlocked worlds extern image_t img_w1, img_w2, img_w3, img_w4, img_w5; @@ -193,44 +194,60 @@ void launch_ui() dimage(xt, yt, &img_w1); } + // invert color of selected world drect(xt+24*choice_x,yt+24*choice_y, xt+24*choice_x+20,yt+24*choice_y+20, C_INVERT); dupdate(); + //int key=getkey_opt(GETKEY_REP_ARROWS,0).key; - int key=mkb_getkey(); - if (key==KEY_UP && choice_y>0) - choice_y--; - if (key==KEY_LEFT && choice_x>0) - choice_x--; - if (key==KEY_DOWN && choice_y<1) - choice_y++; - if (key==KEY_RIGHT && choice_x<3) - choice_x++; - - if (key==KEY_EXE || key==KEY_SHIFT) + switch (mkb_getkey()) { - // Determine mode - if (choice_x==3 && choice_y==1) - break; - if (choice_x==2 && choice_y==1) - { - configmenu(); - } - if (choice_y*choice_x==0) - { - int world_chosen=0; - if (choice_y==1) - world_chosen=4; - else - world_chosen=choice_x; - if (world_chosen<=get_progress_status()) - levelchanger(world_chosen); - - } - } - - if (key==KEY_EXIT || key==KEY_MENU) + case KEY_UP: + if (choice_y) // >0 + choice_y--; break; + + case KEY_LEFT: + if (choice_x) // >0 + choice_x--; + break; + + case (KEY_DOWN): + if (!choice_y) // ==0 + choice_y++; + break; + + case (KEY_RIGHT): + if (choice_x!=3) // <3 + choice_x++; + break; + + case KEY_EXE: + // fall through + case KEY_SHIFT: + switch (4*choice_y+choice_x) + { + case 5: // No idea yet ! + break; + + case 6: + configmenu(); + break; + + case 7: + return; + + default: + if (4*choice_y+choice_x<=get_progress_status()) + levelchanger(4*choice_y+choice_x); + } + break; + + case KEY_EXIT: + // fall through + case KEY_MENU: + return; + } } } diff --git a/src/main.c b/src/main.c index 47aab6c..c2b76c2 100755 --- a/src/main.c +++ b/src/main.c @@ -30,7 +30,7 @@ int main(void) ll_set_panic(); //ll_set_level(LEVEL_QUIET); - launch_ui(); + LaunchUI(); return 1; } diff --git a/src/score.c b/src/score.c index 3cee747..b161374 100644 --- a/src/score.c +++ b/src/score.c @@ -128,17 +128,8 @@ int get_time_spent() -int lifes_get() -{ - return lifes; -} +int LifesGet() { return lifes; } -void lifes_lose() -{ - lifes --; -} +void LifesSet(int l) { lifes = l; } -void lifes_add() -{ - lifes ++; -} \ No newline at end of file +void LifesAdd(int l) { lifes += l; } \ No newline at end of file