From 32b1a2c3ab928bec980601f257487db39b0b8e33 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Thu, 2 Sep 2010 22:59:48 +0200 Subject: [PATCH] does not compile at the moment, cause unknown, also. always use // for one line comments --- Makefile | 4 ++-- graphics.c | 10 +++++----- graphics.h | 4 ++-- interface.c | 4 ++-- main.c | 10 ++++++---- powder.c | 18 +----------------- powder.h | 28 ++++++++++++++-------------- 7 files changed, 32 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 1e1860a63..6db5e87a7 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SOURCES := *.c -HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h +HEADERS := *.h CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations @@ -11,7 +11,7 @@ MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 -msse2 MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lpthread -lbz2 -COMPILER := gcc +COMPILER := clang LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe diff --git a/graphics.c b/graphics.c index a6f83f3dc..e06122bad 100644 --- a/graphics.c +++ b/graphics.c @@ -756,11 +756,11 @@ void draw_menu(pixel *vid_buf, int i, int hover) } } -#ifdef WIN32 +/*#ifdef WIN32 _inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#else +#else*/ inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#endif +//#endif { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -799,7 +799,7 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) return x + w; } -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a) { #ifdef OpenGL #else @@ -2352,4 +2352,4 @@ void ClearScreen() { glClear(GL_COLOR_BUFFER_BIT); } -#endif \ No newline at end of file +#endif diff --git a/graphics.h b/graphics.h index edeab389b..7f1c744a3 100644 --- a/graphics.h +++ b/graphics.h @@ -75,7 +75,7 @@ _inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); #endif -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a); void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); @@ -141,4 +141,4 @@ void RenderScene (); void ClearScreen(); #endif -#endif \ No newline at end of file +#endif diff --git a/interface.c b/interface.c index f6ef74901..bb9c37c98 100644 --- a/interface.c +++ b/interface.c @@ -11,7 +11,7 @@ #include "powder.h" #include "interface.h" #include "misc.h" - +#include "graphics.h" SDLMod sdl_mod; int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; @@ -2819,4 +2819,4 @@ int execute_vote(pixel *vid_buf, char *id, char *action) if(result) free(result); return 1; -} \ No newline at end of file +} diff --git a/main.c b/main.c index 9b9b4d240..5fc9ac161 100644 --- a/main.c +++ b/main.c @@ -49,7 +49,7 @@ #include "hmap.h" #include "air.h" -char *it_msg = +static const char *it_msg = "\brThe Powder Toy\n" "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" "\n" @@ -129,7 +129,7 @@ int core_count() return numCPU; } -int mousex, mousey = 0; //They contain mouse position +int mousex = 0, mousey = 0; //They contain mouse position void sdl_seticon(void) { @@ -140,10 +140,12 @@ void sdl_seticon(void) #ifdef MACOSX //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else +/* Does currently not work #else SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); + SDL_WM_SetIcon(icon, NULLapp_icon_mask)//app_icon mask; +*/ #endif + #endif } diff --git a/powder.c b/powder.c index 706c9622a..78906f65d 100644 --- a/powder.c +++ b/powder.c @@ -4,22 +4,6 @@ #include "air.h" #include "misc.h" -int isplayer = 0; -float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index - -particle *parts; -particle *cb_parts; - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; - -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -int pfree; - -unsigned pmap[YRES][XRES]; -unsigned cb_pmap[YRES][XRES]; int try_move(int i, int x, int y, int nx, int ny) { @@ -2871,4 +2855,4 @@ void create_line(int x1, int y1, int x2, int y2, int r, int c) e -= 1.0f; } } -} \ No newline at end of file +} diff --git a/powder.h b/powder.h index 7bd2a9c64..b2e70a9db 100644 --- a/powder.h +++ b/powder.h @@ -174,7 +174,7 @@ struct part_state }; typedef struct part_state part_state; -static part_type ptypes[PT_NUM] = +static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, @@ -246,7 +246,7 @@ static part_type ptypes[PT_NUM] = //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; -static part_state pstates[PT_NUM] = +static const part_state pstates[PT_NUM] = { // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -316,7 +316,7 @@ static part_state pstates[PT_NUM] = /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -static unsigned char can_move[PT_NUM][PT_NUM] = +static const unsigned char can_move[PT_NUM][PT_NUM] = { /* A B */ /* A 0 1 | B ligher than A */ @@ -398,21 +398,21 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ }; -extern int isplayer; -extern float player[20]; +int isplayer; +float player[20]; -extern particle *parts; -extern particle *cb_parts; +particle *parts; +particle *cb_parts; -extern unsigned char bmap[YRES/CELL][XRES/CELL]; -extern unsigned char emap[YRES/CELL][XRES/CELL]; +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; -extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; -extern int pfree; +int pfree; -extern unsigned pmap[YRES][XRES]; +unsigned pmap[YRES][XRES]; unsigned cb_pmap[YRES][XRES]; int try_move(int i, int x, int y, int nx, int ny); @@ -467,4 +467,4 @@ int create_parts(int x, int y, int r, int c); void create_line(int x1, int y1, int x2, int y2, int r, int c); -#endif \ No newline at end of file +#endif