diff --git a/Makefile b/Makefile index 6db5e87a7..1e1860a63 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SOURCES := *.c -HEADERS := *.h +HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.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 := clang +COMPILER := gcc 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 e06122bad..a6f83f3dc 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, const char *s, int r, int g, int b, int a) +int drawtext(pixel *vid, int x, int y, 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 +#endif \ No newline at end of file diff --git a/graphics.h b/graphics.h index 7f1c744a3..edeab389b 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, const char *s, int r, int g, int b, int a); +int drawtext(pixel *vid, int x, int y, 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 +#endif \ No newline at end of file diff --git a/interface.c b/interface.c index bb9c37c98..f6ef74901 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 5fc9ac161..9b9b4d240 100644 --- a/main.c +++ b/main.c @@ -49,7 +49,7 @@ #include "hmap.h" #include "air.h" -static const char *it_msg = +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 = 0, mousey = 0; //They contain mouse position +int mousex, mousey = 0; //They contain mouse position void sdl_seticon(void) { @@ -140,12 +140,10 @@ 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*/); -/* Does currently not work #else +#else SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULLapp_icon_mask)//app_icon mask; -*/ + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); #endif - #endif } diff --git a/powder.c b/powder.c index 78906f65d..706c9622a 100644 --- a/powder.c +++ b/powder.c @@ -4,6 +4,22 @@ #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) { @@ -2855,4 +2871,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 b2e70a9db..7bd2a9c64 100644 --- a/powder.h +++ b/powder.h @@ -174,7 +174,7 @@ struct part_state }; typedef struct part_state part_state; -static const part_type ptypes[PT_NUM] = +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 {"", 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 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 }; -static const part_state pstates[PT_NUM] = +static 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 const 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 const unsigned char can_move[PT_NUM][PT_NUM] = +static unsigned char can_move[PT_NUM][PT_NUM] = { /* A B */ /* A 0 1 | B ligher than A */ @@ -398,21 +398,21 @@ static const 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*/ }; -int isplayer; -float player[20]; +extern int isplayer; +extern float player[20]; -particle *parts; -particle *cb_parts; +extern particle *parts; +extern particle *cb_parts; -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; +extern unsigned char bmap[YRES/CELL][XRES/CELL]; +extern unsigned char emap[YRES/CELL][XRES/CELL]; -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; +extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; -int pfree; +extern int pfree; -unsigned pmap[YRES][XRES]; +extern 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 +#endif \ No newline at end of file