bugs fixed

This commit is contained in:
flo 2017-04-26 11:25:48 +02:00
parent c67fa42df4
commit 151a5cdce1
7 changed files with 39 additions and 39 deletions

Binary file not shown.

Binary file not shown.

View File

@ -4,14 +4,15 @@
float fcos(unsigned char x)
{
char n = 1;
float cos[4] = {1.0, 0.707106, 0.0, -0.707106};
while(x >= 4)
{
x-=4;
x -= 4;
n = -n;
}
return cos[x];
return (n*cos[x]);
}
float fsin(unsigned char x)

View File

@ -9,8 +9,8 @@
#include "stdio.h"
#include "stdlib.h"
#define SIZE_MAP_X 256
#define SIZE_MAP_Y 256
#define MAP_SIZE_X 256
#define MAP_SIZE_Y 256
#define MAX_PLANES 2
@ -49,16 +49,6 @@ void init()
}
}
void AI() // iA start
{
unsigned char i;
for(i = 1; i < MAX_PLANES; i++)
{
}
}
void infos()
{
unsigned int key = 0;
@ -112,34 +102,40 @@ int menu()
void *update_frame()
{
static unsigned char i,j;
static short decalx = 0;
static short decaly = 0;
static char decalx = -1;
static char decaly = 0;
dclear();
//dprint(1, 1, "s:%d l:%d", planes[0].reload, planes[0].life);
dprint(1, 1, "s:%d l:%d", planes[0].reload, planes[0].life);
dprint(1, 10, "(%d,%d)", decalx, decaly);
decalx = decaly = 0;
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;
case 0 : decalx = -1; break;
case 1 : decalx = -1; decaly = 1; break;
case 2 : decaly = 1; break;
case 3 : decalx = 1; decaly = 1; break;
case 4 : decalx = 1; break;
case 5 : decalx = 1; decaly = -1; break;
case 6 : decaly = -1; break;
case 7 : decalx = -1; decaly = -1; break;
}
dimage_part(planes[0].x, planes[0].y, &plane, 16*planes[0].dir, 0, 16, 16);
for(i = 1; i < MAX_PLANES; i++)
for(i = 0; 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);
if(i > 0)
{
planes[i].x += decalx;
planes[i].y += decaly;
}
dimage_part(planes[i].x, planes[i].y, &plane, 16*planes[i].dir, 0, 16, 16);
}
dprint(1,10, "(x,y)(%d,%d)", planes[1].x + decalx, planes[1].y + decaly);
//dprint(1,10, "(x,y)(%d,%d)", planes[1].x + decalx, planes[1].y + decaly);
dimage(10 + decalx, 10 + decaly, &cloud);
@ -151,19 +147,22 @@ void *update_frame()
planes[i].y + 4 - (planes[i].missiles[j].distance + 15) * fsin(planes[i].missiles[j].dir),
&missiles, 8 * planes[i].missiles[j].dir, 0, 8, 8);
planes[i].missiles[j].distance++;
planes[i].missiles[j].distance ++;
}
}
dupdate();
return;
}
#define MAX_KEYS 4
int game()
{
unsigned char fire = 0; // fire disable
unsigned char sum = 0;
int keys[3];
int keys[MAX_KEYS];
unsigned char i;
unsigned char j;
@ -175,16 +174,16 @@ int game()
timer_t *timer = NULL;
timer = timer_create(40, 0);
timer_attach(timer, &update_frame, NULL);
timer_attach(timer, update_frame, NULL);
timer_start(timer);
while(1)
{
multigetkey(keys, 3, 0);
multigetkey(keys, MAX_KEYS, 0);
sum = 0;
for(i = 0; i < 3; i++)
for(i = 0; i < MAX_KEYS; i++)
{
switch(keys[i])
{
@ -199,7 +198,7 @@ int game()
if(planes[0].reload > 0)
{
fire = 1;
// planes[0].reload = planes[0].reload - 1;
//planes[0].reload = planes[0].reload - 1;
}
break; // fire enable
}

BIN
wings.bin

Binary file not shown.

BIN
wings.elf

Binary file not shown.

BIN
wings.g1a

Binary file not shown.