neingeist
/
cscape
Archived
1
0
Fork 0

Code cleaned up

master
neingeist 22 years ago
parent 76e58be572
commit a9253c089a

@ -1,5 +1,6 @@
CC=gcc
LDFLAGS=`sdl-config --libs` LDFLAGS=`sdl-config --libs`
CFLAGS=-g `sdl-config --cflags` CFLAGS=-O3 -Wall -g `sdl-config --cflags`
all: cscape maptest all: cscape maptest

@ -1,6 +1,11 @@
#include "math.h" /* $Revision$ */
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include "SDL.h" #include "SDL.h"
#include "sdl.h" #include "sdl.h"
#include "map.h"
#define MEERESSPIEGEL 48 #define MEERESSPIEGEL 48
#define BLICKWEITE 55 #define BLICKWEITE 55
@ -15,7 +20,7 @@ void init_tabs() {
int x; int x;
for (x=0;x<360; 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++) for (x=0; x < 90; x++)
costab[x] = sintab[x+90]; costab[x] = sintab[x+90];
for (x=90; x < 360; x++) for (x=90; x < 360; x++)
@ -51,27 +56,26 @@ int main(void) {
try {Thread.sleep(100);} catch (InterruptedException e) {} try {Thread.sleep(100);} catch (InterruptedException e) {}
/* Richtung wechseln? */ Richtung wechseln?
/* if (java.lang.Math.random()<0.5) if (java.lang.Math.random()<0.5)
if (java.lang.Math.random()<1.0) if (java.lang.Math.random()<1.0)
if (richtung <= 0) richtung = 357; if (richtung <= 0) richtung = 357;
else richtung -= 3; else richtung -= 3;
else else
if (richtung >= 357) richtung = 0; if (richtung >= 357) richtung = 0;
else richtung += 3; else richtung += 3;
*/
/* Vorwärts? */ Vorwärts?
/* posy = posy + costab[richtung] / 32; posy = posy + costab[richtung] / 32;
posx = posx + sintab[richtung] / 32; posx = posx + sintab[richtung] / 32;
if (posy<=0) posy += 256; if (posy<=0) posy += 256;
if (posx<=0) posx += 256; if (posx<=0) posx += 256;
*/
/* Absolute Höhe berechnen */ Absolute Höhe berechnen
/* flughoehe = 100; flughoehe = 100;
*/
/*
for (i=0;i<320;i++) rng[i] = 200; for (i=0;i<320;i++) rng[i] = 200;
System.arraycopy(emptyscreen,0,screen,0,320*200); System.arraycopy(emptyscreen,0,screen,0,320*200);

@ -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);

@ -1,3 +1,4 @@
/* $Revision$ */
#include "SDL.h" #include "SDL.h"
char farben[] = char farben[] =

@ -1,8 +1,11 @@
/* $Revision$ */ /* $Revision$ */
#include <stdlib.h> #include <stdlib.h>
#include "SDL.h" #include <unistd.h>
#include <SDL.h>
#include "sdl.h" #include "sdl.h"
#include "map.h"
#define MAPSIZE 256 #define MAPSIZE 256
void map_show(SDL_Surface *screen, char *map, int mapsize) { void map_show(SDL_Surface *screen, char *map, int mapsize) {

@ -1,4 +1,7 @@
/* $Revision$ */
#include <SDL.h> #include <SDL.h>
#include <stdlib.h>
SDL_Surface* sdl_init() { SDL_Surface* sdl_init() {
SDL_Surface *screen; SDL_Surface *screen;

@ -1,2 +1,4 @@
/* $Revision$ */
SDL_Surface* sdl_init(); SDL_Surface* sdl_init();
void sdl_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); void sdl_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);