Code cleaned up
This commit is contained in:
		
							parent
							
								
									76e58be572
								
							
						
					
					
						commit
						a9253c089a
					
				
					 7 changed files with 31 additions and 14 deletions
				
			
		
							
								
								
									
										3
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										28
									
								
								cscape.c
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								cscape.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,6 +1,11 @@
 | 
			
		|||
#include "math.h"
 | 
			
		||||
/* $Revision$ */
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
#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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								map.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								map.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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"
 | 
			
		||||
 | 
			
		||||
char farben[] =
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,11 @@
 | 
			
		|||
/* $Revision$ */
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include "SDL.h"
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <SDL.h>
 | 
			
		||||
#include "sdl.h"
 | 
			
		||||
#include "map.h"
 | 
			
		||||
 | 
			
		||||
#define MAPSIZE 256
 | 
			
		||||
 | 
			
		||||
void map_show(SDL_Surface *screen, char *map, int mapsize) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								sdl.c
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								sdl.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,4 +1,7 @@
 | 
			
		|||
/* $Revision$ */
 | 
			
		||||
 | 
			
		||||
#include <SDL.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
SDL_Surface* sdl_init() {
 | 
			
		||||
	SDL_Surface *screen;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								sdl.h
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								sdl.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,2 +1,4 @@
 | 
			
		|||
/* $Revision$ */
 | 
			
		||||
 | 
			
		||||
SDL_Surface* sdl_init();
 | 
			
		||||
void sdl_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue