diff --git a/Makefile b/Makefile index 0eadb2d..0a3a396 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ +CC=gcc LDFLAGS=`sdl-config --libs` -CFLAGS=-g `sdl-config --cflags` +CFLAGS=-O3 -Wall -g `sdl-config --cflags` all: cscape maptest diff --git a/cscape.c b/cscape.c index eb6fac2..d5a132e 100644 --- a/cscape.c +++ b/cscape.c @@ -1,6 +1,11 @@ -#include "math.h" +/* $Revision$ */ + +#include +#include +#include #include "SDL.h" #include "sdl.h" +#include "map.h" #define MEERESSPIEGEL 48 #define BLICKWEITE 55 @@ -15,7 +20,7 @@ void init_tabs() { int x; for (x=0;x<360; x++) - sintab[x] = trunc(127 * sin(x*M_PI/180)); + sintab[x] = (int) (127.0 * sin(x*M_PI/180)); for (x=0; x < 90; x++) costab[x] = sintab[x+90]; for (x=90; x < 360; x++) @@ -51,27 +56,26 @@ int main(void) { try {Thread.sleep(100);} catch (InterruptedException e) {} - /* Richtung wechseln? */ - /* if (java.lang.Math.random()<0.5) + Richtung wechseln? + if (java.lang.Math.random()<0.5) if (java.lang.Math.random()<1.0) if (richtung <= 0) richtung = 357; else richtung -= 3; else if (richtung >= 357) richtung = 0; else richtung += 3; - */ + - /* Vorwärts? */ -/* posy = posy + costab[richtung] / 32; + Vorwärts? + posy = posy + costab[richtung] / 32; posx = posx + sintab[richtung] / 32; if (posy<=0) posy += 256; if (posx<=0) posx += 256; -*/ - /* Absolute Höhe berechnen */ - /* flughoehe = 100; -*/ - /* + + Absolute Höhe berechnen + flughoehe = 100; + for (i=0;i<320;i++) rng[i] = 200; System.arraycopy(emptyscreen,0,screen,0,320*200); diff --git a/map.h b/map.h new file mode 100644 index 0000000..a357543 --- /dev/null +++ b/map.h @@ -0,0 +1,3 @@ +void map_init (char *map, int x, int y); +void map_generate (char *map, int x1,int y1,int x2,int y2); +void map_setpalette(SDL_Surface *screen); diff --git a/mapcolors.c b/mapcolors.c index 40f1c48..eb33dcf 100644 --- a/mapcolors.c +++ b/mapcolors.c @@ -1,3 +1,4 @@ +/* $Revision$ */ #include "SDL.h" char farben[] = diff --git a/maptest.c b/maptest.c index 086be0d..eac3bb5 100644 --- a/maptest.c +++ b/maptest.c @@ -1,8 +1,11 @@ /* $Revision$ */ #include -#include "SDL.h" +#include +#include #include "sdl.h" +#include "map.h" + #define MAPSIZE 256 void map_show(SDL_Surface *screen, char *map, int mapsize) { diff --git a/sdl.c b/sdl.c index f6322ff..eeeaa8c 100644 --- a/sdl.c +++ b/sdl.c @@ -1,4 +1,7 @@ +/* $Revision$ */ + #include +#include SDL_Surface* sdl_init() { SDL_Surface *screen; diff --git a/sdl.h b/sdl.h index 8f8d482..ed3e06f 100644 --- a/sdl.h +++ b/sdl.h @@ -1,2 +1,4 @@ +/* $Revision$ */ + SDL_Surface* sdl_init(); void sdl_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);