diff -Naur RefLectBall/Makefile RefLectBall-gentoo/Makefile --- RefLectBall/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ RefLectBall-gentoo/Makefile 2007-10-11 21:35:39.000000000 +0200 @@ -0,0 +1,17 @@ +DC=gdmd +DFLAGS=-g -O -d -release -Iimport -Isrc +DOUT=-of + +DSRC=$(shell find src/ -name "*.d") +SOURCES=$(DSRC) import/SDL_video.d import/SDL_mixer.d import/SDL_image.d +OBJS=$(SOURCES:.d=.o) +EXE=reflectball + +all: $(EXE) + +$(EXE): $(OBJS) + gcc -o $@ $(OBJS) -lbulletml_d -lgphobos -lpthread -lm -lSDL -lGL -lGLU -lSDL_mixer + +$(OBJS): %.o: %.d + $(DC) -c $(DOUT)$@ $(DFLAGS) $< + diff -Naur RefLectBall/import/SDL.d RefLectBall-gentoo/import/SDL.d --- RefLectBall/import/SDL.d 2006-07-26 16:24:12.000000000 +0200 +++ RefLectBall-gentoo/import/SDL.d 2007-10-11 21:35:39.000000000 +0200 @@ -31,7 +31,7 @@ public import SDL_events; public import SDL_video; public import SDL_byteorder; -public import SDL_Version; +public import SDL_version; extern(C): @@ -73,6 +73,7 @@ */ void SDL_Quit(); +/+ void SDL_SetModuleHandle(void *hInst); //extern(Windows) void* GetModuleHandle(char*); extern(Windows) void* GetModuleHandleA(char*); @@ -90,3 +91,4 @@ { SDL_Quit(); } ++/ diff -Naur RefLectBall/import/SDL_events.d RefLectBall-gentoo/import/SDL_events.d --- RefLectBall/import/SDL_events.d 2006-07-26 16:25:46.000000000 +0200 +++ RefLectBall-gentoo/import/SDL_events.d 2007-10-11 21:35:39.000000000 +0200 @@ -105,7 +105,7 @@ Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */ Uint8 which; /* The keyboard device index */ Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ - SDL_keysym keysym; + SDL_keysym2 keysym; } /* Mouse motion event structure */ diff -Naur RefLectBall/import/SDL_keyboard.d RefLectBall-gentoo/import/SDL_keyboard.d --- RefLectBall/import/SDL_keyboard.d 2006-07-26 16:25:14.000000000 +0200 +++ RefLectBall-gentoo/import/SDL_keyboard.d 2007-10-11 21:35:39.000000000 +0200 @@ -26,7 +26,7 @@ // !!! A hack! struct SDL_keysym is defined in this module, // !!! so we need to resolve the nameclash... // !!! Definitely won't work on *NIX but for now will do. -public import SDL_Keysym; +public import SDL_keysym; extern(C): @@ -46,7 +46,7 @@ An international character.. } */ -struct SDL_keysym { +struct SDL_keysym2 { Uint8 scancode; /* hardware specific scancode */ SDLKey sym; /* SDL virtual keysym */ SDLMod mod; /* current key modifiers */ diff -Naur RefLectBall/import/SDL_syswm.d RefLectBall-gentoo/import/SDL_syswm.d --- RefLectBall/import/SDL_syswm.d 2006-07-26 16:25:32.000000000 +0200 +++ RefLectBall-gentoo/import/SDL_syswm.d 2007-10-11 21:35:39.000000000 +0200 @@ -22,7 +22,7 @@ /* Include file for SDL custom system window manager hooks */ -public import SDL_Version; +public import SDL_version; extern(C): diff -Naur RefLectBall/import/opengl.d RefLectBall-gentoo/import/opengl.d --- RefLectBall/import/opengl.d 2004-01-09 10:52:04.000000000 +0100 +++ RefLectBall-gentoo/import/opengl.d 2007-10-11 21:35:39.000000000 +0200 @@ -1,10 +1,4 @@ -version (Win32) { - private import std.c.windows.windows; - extern(Windows): -} -version (linux) { extern(C): -} alias uint GLenum; alias ubyte GLboolean; @@ -1116,7 +1110,7 @@ /*************************************************************/ void /*APIENTRY*/glAccum (GLenum op, GLfloat value); -void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref); +void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf); GLboolean /*APIENTRY*/glAreTexturesResident (GLsizei n, GLuint *textures, GLboolean *residences); void /*APIENTRY*/glArrayElement (GLint i); void /*APIENTRY*/glBegin (GLenum mode); @@ -1369,7 +1363,7 @@ void /*APIENTRY*/glScissor (GLint x, GLint y, GLsizei width, GLsizei height); void /*APIENTRY*/glSelectBuffer (GLsizei size, GLuint *buffer); void /*APIENTRY*/glShadeModel (GLenum mode); -void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref, GLuint mask); +void /*APIENTRY*/glStencilFunc (GLenum func, GLint, GLuint mask); void /*APIENTRY*/glStencilMask (GLuint mask); void /*APIENTRY*/glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); void /*APIENTRY*/glTexCoord1d (GLdouble s); diff -Naur RefLectBall/import/openglu.d RefLectBall-gentoo/import/openglu.d --- RefLectBall/import/openglu.d 2006-07-26 16:24:24.000000000 +0200 +++ RefLectBall-gentoo/import/openglu.d 2007-10-11 21:35:39.000000000 +0200 @@ -1,11 +1,6 @@ public import opengl; -version (Win32) { - extern(Windows): -} -version (linux) { extern(C): -} GLubyte* gluErrorString ( GLenum errCode); diff -Naur RefLectBall/src/bulletcommand.d RefLectBall-gentoo/src/bulletcommand.d --- RefLectBall/src/bulletcommand.d 2006-10-24 19:55:56.000000000 +0200 +++ RefLectBall-gentoo/src/bulletcommand.d 2007-10-11 21:35:39.000000000 +0200 @@ -36,7 +36,7 @@ buf.length = 256; buf = fname ~ "\0"; - parser[bank] = BulletMLParserTinyXML_new(buf); + parser[bank] = BulletMLParserTinyXML_new(buf.ptr); if(parser[bank]) BulletMLParserTinyXML_parse(parser[bank]); buf.length = 0; } @@ -169,7 +169,8 @@ if(eid != -1){ TskBuf[eid].parent = BulletCommand.now.id; d = (d <= 180.0f ? d : -(360.0f - d)); - d = d / ROTVAL; + d = d / ROTVAL; + TskBuf[eid].roll = 0; TskBuf[eid].bullet_speed = s; TskBuf[eid].bullet_direction = d; TskBuf[eid].bullet_velx = (sin(d) * (-s * VEL_SDM_SS_RATIO)); diff -Naur RefLectBall/src/gctrl.d RefLectBall-gentoo/src/gctrl.d --- RefLectBall/src/gctrl.d 2006-10-25 18:56:44.000000000 +0200 +++ RefLectBall-gentoo/src/gctrl.d 2007-10-13 10:20:40.000000000 +0200 @@ -66,6 +66,22 @@ GCTRL_RANKING_EXEC, GCTRL_RANKING_EXIT, } + +public static char[] pref_dir() +{ + char * home = getenv("HOME"); + if (home is null) + throw new Error("HOME environment variable not defined"); + char[] dir = std.string.toString(home) ~ "/.reflectball"; + char[] dir2 = std.string.toString(home) ~ "/.reflectball/replay"; + try { + mkdir(dir); + mkdir(dir2); + } catch (FileException e) { + } + return dir; +} + void TSKgctrl(int id) { @@ -78,7 +94,7 @@ replay_data.length = 8; } replay_fmax = 0; - fpath = listdir(std.path.curdir ~ "/replay"); + fpath = listdir(pref_dir() ~ "/" ~ "replay"); for(int i = 0; i < fpath.length; i++){ if(fnmatch(fpath[i], "rlb??????????????.rep")){ replay_file.length = fcnt + 1; @@ -118,7 +134,7 @@ replay_data[i] = replay[i]; } char[] fname; - fname = format("./replay/rlb%04d%02d%02d%02d%02d%02d.rep" + fname = format(pref_dir() ~ "/" ~ "/replay/rlb%04d%02d%02d%02d%02d%02d.rep" ,year ,month ,date @@ -152,8 +168,8 @@ } void init_highscore(){ - if(exists("score.dat")){ - hi_score = cast(int[])read("score.dat"); + if(exists(pref_dir() ~ "/" ~ "score.dat")){ + hi_score = cast(int[])read(pref_dir() ~ "/" ~ "score.dat"); }else{ hi_score.length = RANKING_MAX * RANKING_RECORD; for(int i = 0; i < RANKING_MAX; i++){ @@ -161,7 +177,7 @@ hi_score[i * RANKING_RECORD + RANKING_BREAK] = 0; hi_score[i * RANKING_RECORD + RANKING_DESTR] = 0; } - write("score.dat", cast(void[])hi_score); + write(pref_dir() ~ "/" ~ "score.dat", cast(void[])hi_score); } } @@ -178,7 +194,7 @@ hi_score[i * RANKING_RECORD + RANKING_SCORE] = score; hi_score[i * RANKING_RECORD + RANKING_BREAK] = brk_ship; hi_score[i * RANKING_RECORD + RANKING_DESTR] = enemy_dst; - write("score.dat", cast(void[])hi_score); + write(pref_dir() ~ "/" ~ "score.dat", cast(void[])hi_score); break; } } diff -Naur RefLectBall/src/luminous.d RefLectBall-gentoo/src/luminous.d --- RefLectBall/src/luminous.d 2006-07-08 04:49:12.000000000 +0200 +++ RefLectBall-gentoo/src/luminous.d 2007-10-11 21:35:39.000000000 +0200 @@ -7,7 +7,7 @@ */ private import std.math; -private import std.string; +private import std.c.string; private import opengl; private import util_sdl; private import task; @@ -36,7 +36,7 @@ glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); - glDisable(GL_COLOR_MATERIAL); + glDisable(GL_COLOR_MATERIAL); init(0.0f, SCREEN_X, SCREEN_Y); TskBuf[id].fp_draw = &TSKluminousDraw; TskBuf[id].step++; @@ -68,11 +68,11 @@ static void makeLuminousTexture() { - uint *data = td; + uint *data = td.ptr; int i; td[0..length] = 0; - //memset(data, 0, luminousTextureWidth * luminousTextureHeight * 4 * uint.sizeof); + memset(data, 0, luminousTextureWidth * luminousTextureHeight * 4 * uint.sizeof); glGenTextures(1, &luminousTexture); glBindTexture(GL_TEXTURE_2D, luminousTexture); glTexImage2D(GL_TEXTURE_2D, 0, 4, luminousTextureWidth, luminousTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); diff -Naur RefLectBall/src/main.d RefLectBall-gentoo/src/main.d --- RefLectBall/src/main.d 2006-10-20 20:10:16.000000000 +0200 +++ RefLectBall-gentoo/src/main.d 2007-10-11 21:35:39.000000000 +0200 @@ -4,14 +4,14 @@ 'main.d' */ -private import std.c.windows.windows; +//private import std.c.windows.windows; private import std.stdio; private import std.string; private import std.random; private import std.math; private import SDL; private import opengl; -private import reflection; +//private import reflection; private import util_sdl; private import util_glbf; private import util_pad; @@ -65,8 +65,8 @@ str_buf[i] = lpCmdLine[i]; } split_buf = split(str_buf); - if(split_buf[0].length > 1) Reflection.init(split_buf[0]); - else Reflection.init("main.exe"); + // if(split_buf[0].length > 1) Reflection.init(split_buf[0]); + // else Reflection.init("main.exe"); } try{ @@ -84,7 +84,7 @@ }else{ int main(char[][] argv) { - Reflection.init(argv[argv.length-1]); + // Reflection.init(argv[argv.length-1]); return boot(); } } diff -Naur RefLectBall/src/task.d RefLectBall-gentoo/src/task.d --- RefLectBall/src/task.d 2006-10-20 20:08:50.000000000 +0200 +++ RefLectBall-gentoo/src/task.d 2007-10-11 21:35:39.000000000 +0200 @@ -175,7 +175,9 @@ TskBuf[i].fp_draw = null; TskBuf[i].fp_exit = null; TskBuf[i].bullet_command = null; - TskBuf[i].bullet_state = null; + TskBuf[i].bullet_state = null; + TskBuf[i].bullet_accx = 0; + TskBuf[i].bullet_accy = 0; } TskBuf[i].tskid = TSKID_NONE; TskBuf[i].entry = -1; @@ -186,7 +188,7 @@ TskBuf[i].fp_draw = null; TskBuf[i].fp_exit = null; TskBuf[i].bullet_command = null; - TskBuf[i].bullet_state = null; + TskBuf[i].bullet_state = null; } int setTSK(int group,void function(int) func) diff -Naur RefLectBall/src/util_glbf.d RefLectBall-gentoo/src/util_glbf.d --- RefLectBall/src/util_glbf.d 2006-07-07 17:37:52.000000000 +0200 +++ RefLectBall-gentoo/src/util_glbf.d 2007-10-11 21:35:39.000000000 +0200 @@ -156,7 +156,7 @@ { glBindTexture(GL_TEXTURE_2D, font.texture); // Select Our Font Texture glListBase(font.base-32); // Choose The Font Set (0 or 1) - glCallLists(str.length, GL_BYTE, str); // Write The Text To The Screen + glCallLists(str.length, GL_BYTE, str.ptr); // Write The Text To The Screen } int glbfInit(GLBitmapFont* font, char* filename, GLfloat xsize, GLfloat xdots, GLfloat ydots) diff -Naur RefLectBall/src/util_rand.d RefLectBall-gentoo/src/util_rand.d --- RefLectBall/src/util_rand.d 2006-07-26 16:50:10.000000000 +0200 +++ RefLectBall-gentoo/src/util_rand.d 2007-10-11 21:35:39.000000000 +0200 @@ -112,14 +112,14 @@ void next_state() { - uint *p=state; + uint *p=state.ptr; /* if init_genrand() has not been called, */ /* a default initial seed is used */ if (initf==0) init_genrand(5489); left = N; - next = state; + next = state.ptr; for (int j=N-M+1; --j; p++) *p = p[M] ^ TWIST(p[0], p[1]); diff -Naur RefLectBall/src/util_sdl.d RefLectBall-gentoo/src/util_sdl.d --- RefLectBall/src/util_sdl.d 2006-10-19 19:04:16.000000000 +0200 +++ RefLectBall-gentoo/src/util_sdl.d 2007-10-11 21:35:39.000000000 +0200 @@ -105,7 +105,7 @@ resizedSDL(width, height); SDL_ShowCursor(SDL_DISABLE); - SDL_WM_SetCaption(PROJECT_NAME, null); + SDL_WM_SetCaption(PROJECT_NAME.ptr, null); SDL_WM_SetIcon(SDL_LoadBMP("icon.bmp"), null); return 1; @@ -142,7 +142,7 @@ { SDL_Surface* tmp; - tmp = IMG_Load(toStringz(fname)); +// tmp = IMG_Load(toStringz(fname)); if(tmp){ SDL_Surface* tmp2; int bpp = getBPP(tmp); diff -Naur RefLectBall/src/util_snd.d RefLectBall-gentoo/src/util_snd.d --- RefLectBall/src/util_snd.d 2006-10-22 21:07:36.000000000 +0200 +++ RefLectBall-gentoo/src/util_snd.d 2007-10-11 21:35:39.000000000 +0200 @@ -99,7 +99,7 @@ char[] fileName = name ~ "\0"; - music[ch] = Mix_LoadMUS(fileName); + music[ch] = Mix_LoadMUS(fileName.ptr); if(!music[ch]){ writefln("snd load error %s", name); sound_use = false; @@ -119,7 +119,7 @@ char[] fileName = name ~ "\0"; - chunk[bank] = Mix_LoadWAV(fileName); + chunk[bank] = Mix_LoadWAV(fileName.ptr); if(!chunk[bank]){ sound_use = false; }