arghh
This commit is contained in:
parent
ebceb1a60a
commit
cc7cf2bd05
10
src/maths.c
10
src/maths.c
|
@ -1,16 +1,16 @@
|
|||
#include "maths.h"
|
||||
|
||||
#define MAX_TURN 24
|
||||
#define MAX_TURN 6
|
||||
|
||||
float cos(float x)
|
||||
{
|
||||
int a = 8 * MAX_TURN - 6;
|
||||
int b = 2 * MAX_TURN * (2 * MAX_TURN - 1); // 2n(2n-1)
|
||||
unsigned int a = 8 * MAX_TURN - 6;
|
||||
unsigned int b = 2 * MAX_TURN * (2 * MAX_TURN - 1); // 2n(2n-1)
|
||||
float s = 1;
|
||||
|
||||
int i;
|
||||
unsigned short i;
|
||||
|
||||
x = x*x; // x²
|
||||
x = x * x; // x²
|
||||
|
||||
for(i = 0; i < MAX_TURN; i++)
|
||||
{
|
||||
|
|
31
src/wings.c
31
src/wings.c
|
@ -9,8 +9,8 @@
|
|||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
#define SIZE_MAP_X 512
|
||||
#define SIZE_MAP_Y 512
|
||||
#define SIZE_MAP_X 256
|
||||
#define SIZE_MAP_Y 256
|
||||
#define MAX_PLANES 3
|
||||
|
||||
Plane planes[MAX_PLANES]; // number of planes in the map (with us)
|
||||
|
@ -38,10 +38,9 @@ void init()
|
|||
for(i = 1; i < MAX_PLANES; i++)
|
||||
{
|
||||
planes[i].x = 10 + 16 * i;
|
||||
planes[i].y = 12;
|
||||
planes[i].y = 12 + i;
|
||||
planes[i].dir = i;
|
||||
planes[i].life = 100;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +79,8 @@ void menu()
|
|||
void update_frame()
|
||||
{
|
||||
static unsigned char i,j;
|
||||
static short decalx = 0, decaly = 0;
|
||||
static short decalx = 0;
|
||||
static short decaly = 0;
|
||||
|
||||
gclear();
|
||||
|
||||
|
@ -96,14 +96,25 @@ void update_frame()
|
|||
case 7 : decalx--; decaly--; break;
|
||||
}
|
||||
|
||||
gimage_part(planes[0].x, planes[0].y, &plane, 16*planes[0].dir, 0, 16, 16);
|
||||
if(decalx < - SIZE_MAP_X || decalx > SIZE_MAP_X || decaly < - SIZE_MAP_Y || decaly > SIZE_MAP_Y)
|
||||
{
|
||||
gtext(10, 10, "You are going to dead");
|
||||
}
|
||||
|
||||
gimage_part(planes[0].x, planes[0].y, &plane, 16*planes[0].dir, 0, 16, 16);
|
||||
|
||||
for(i = 1; i < MAX_PLANES; i++)
|
||||
{
|
||||
gimage_part(planes[i].x + decalx, planes[i].y + decaly, &plane, 16*planes[i].dir, 0, 16, 16);
|
||||
// print condition
|
||||
|
||||
if(planes[i].x + decalx > -16 || planes[i].x + decalx < 144 || planes[i].y + decaly > -16 || planes[i].y + decaly < 80)
|
||||
{
|
||||
gimage_part(planes[i].x + decalx, planes[i].y + decaly, &plane, 16*planes[i].dir, 0, 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
gimage(10 + decalx, 10 + decaly, &cloud);
|
||||
|
||||
for (i = 0; i < MAX_PLANES; i++)
|
||||
{
|
||||
for(j = 0; j < MAX_MISSILES; j++)
|
||||
|
@ -116,8 +127,6 @@ void update_frame()
|
|||
}
|
||||
}
|
||||
|
||||
gimage(10 + decalx, 10 + decaly, &cloud);
|
||||
|
||||
gupdate();
|
||||
}
|
||||
|
||||
|
@ -131,7 +140,7 @@ int game()
|
|||
|
||||
int keys[3];
|
||||
|
||||
unsigned char i,j;
|
||||
unsigned char i,j = 0;
|
||||
|
||||
timer_t *timer = NULL;
|
||||
|
||||
|
@ -187,7 +196,7 @@ int game()
|
|||
planes[0].missiles.dir[j] = planes[0].dir;
|
||||
planes[0].missiles.distance[j] = 12; // fire unlimited (nearly)
|
||||
j = (j < MAX_MISSILES ? j + 1 : 0);
|
||||
fire = 0; // fire disable // this code line will depend if we shoot in continue
|
||||
fire = 0; // fire disable, shoot one by one // this code line will depend if we shoot in continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue