diff --git a/obj/cloud.bmp.o b/obj/cloud.bmp.o new file mode 100644 index 0000000..0bdfb15 Binary files /dev/null and b/obj/cloud.bmp.o differ diff --git a/obj/img_menu.bmp.o b/obj/img_menu.bmp.o new file mode 100644 index 0000000..5d0e665 Binary files /dev/null and b/obj/img_menu.bmp.o differ diff --git a/obj/maths.c.o b/obj/maths.c.o new file mode 100644 index 0000000..633ee2c Binary files /dev/null and b/obj/maths.c.o differ diff --git a/obj/missiles.bmp.o b/obj/missiles.bmp.o new file mode 100644 index 0000000..1c4c170 Binary files /dev/null and b/obj/missiles.bmp.o differ diff --git a/obj/plane.bmp.o b/obj/plane.bmp.o new file mode 100644 index 0000000..cf103a5 Binary files /dev/null and b/obj/plane.bmp.o differ diff --git a/obj/wings.c.o b/obj/wings.c.o new file mode 100644 index 0000000..5cbedda Binary files /dev/null and b/obj/wings.c.o differ diff --git a/src/maths.c b/src/maths.c index f4a3bca..a20ed9d 100644 --- a/src/maths.c +++ b/src/maths.c @@ -6,7 +6,12 @@ float fcos(unsigned char x) { float cos[4] = {1.0, 0.707106, 0.0, -0.707106}; - return (x < 4 ? cos[x] : - cos[x%4]); + while(x >= 4) + { + x-=4; + } + + return cos[x]; } float fsin(unsigned char x) diff --git a/src/wings.c b/src/wings.c index 4800b42..ed08aa3 100644 --- a/src/wings.c +++ b/src/wings.c @@ -12,7 +12,7 @@ #define SIZE_MAP_X 256 #define SIZE_MAP_Y 256 -#define MAX_PLANES 3 +#define MAX_PLANES 2 Plane planes[MAX_PLANES]; // number of planes in the map (with us) //others planes are controlled by the AI @@ -59,6 +59,24 @@ void AI() // iA start } } +void infos() +{ + unsigned int key = 0; + + while(key != KEY_SHIFT) + { + dclear(); + + dtext(1, 1, "All informations"); + dprint(1, 10, "life : %d", planes[0].life); + dprint(1, 20, "shoot : %d", planes[0].reload); + dtext(1,54,"F1 to leave"); + dupdate(); + + key = getkey(); + } +} + int menu() { unsigned char menu = 0; @@ -99,27 +117,29 @@ void *update_frame() dclear(); - switch(planes[0].dir) - { - case 0 : decalx--; break; - case 1 : decalx--; decaly++; break; - case 2 : decaly++; break; - case 3 : decalx++; decaly++; break; - case 4 : decalx++; break; - case 5 : decalx++; decaly--; break; - case 6 : decaly--; break; - case 7 : decalx--; decaly--; break; - } - + //dprint(1, 1, "s:%d l:%d", planes[0].reload, planes[0].life); + switch(planes[0].dir) + { + case 0 : decalx--; break; + case 1 : decalx--; decaly++; break; + case 2 : decaly++; break; + case 3 : decalx++; decaly++; break; + case 4 : decalx++; break; + case 5 : decalx++; decaly--; break; + case 6 : decaly--; break; + case 7 : decalx--; decaly--; break; + } dimage_part(planes[0].x, planes[0].y, &plane, 16*planes[0].dir, 0, 16, 16); for(i = 1; i < MAX_PLANES; i++) { - // dimage_part(planes[i].x + decalx, planes[i].y + decaly, &plane, 16*planes[i].dir, 0, 16, 16); - dimage(planes[i].x + decalx, planes[i].y + decaly, &plane); + dimage_part(planes[i].x + decalx, planes[i].y + decaly, &plane, 16*planes[i].dir, 0, 16, 16); + //dimage(planes[i].x + decalx, planes[i].y + decaly, &plane); + } + dprint(1,10, "(x,y)(%d,%d)", planes[1].x + decalx, planes[1].y + decaly); dimage(10 + decalx, 10 + decaly, &cloud); @@ -158,8 +178,6 @@ int game() timer_attach(timer, &update_frame, NULL); timer_start(timer); - - while(1) { multigetkey(keys, 3, 0); @@ -176,12 +194,33 @@ int game() break; } - case KEY_SHIFT : fire = 1; break; // fire enable + case KEY_SHIFT : + { + if(planes[0].reload > 0) + { + fire = 1; + // planes[0].reload = planes[0].reload - 1; + } + break; // fire enable + } + case KEY_EXIT : { - timer_stop(timer); // virtual timer stopped + timer_destroy(timer); //destroy the virtual timer return 1; // good bye, see you soon } + + // case KEY_OPTN : + // { + // timer_stop(timer); // virtual timer stopped + // + // infos(); + // + // //timer = timer_create(40, 0); + // //timer_attach(timer, &update_frame, NULL); + // timer_start(timer); + // break; + // } } } diff --git a/wings.bin b/wings.bin new file mode 100755 index 0000000..69dbcb6 Binary files /dev/null and b/wings.bin differ diff --git a/wings.elf b/wings.elf new file mode 100755 index 0000000..a9eff59 Binary files /dev/null and b/wings.elf differ diff --git a/wings.g1a b/wings.g1a new file mode 100644 index 0000000..99bc7f0 Binary files /dev/null and b/wings.g1a differ