Index: configure =================================================================== --- configure (revision 833) +++ configure (working copy) @@ -27,7 +27,12 @@ echo " Testing $1 ($comp)" >> configure.log echo " ====================" >> configure.log echo "$2" > configure.c + + if [ "`uname`" != "FreeBSD" ]; then $comp -g configure.c -Wall -o configure.bin $3 >> configure.log 2>> configure.log + else + $comp -g configure.c -Wall -o configure.bin -I/usr/local/include -L/usr/local/lib $3 >> configure.log 2>> configure.log + fi if [ "$?" != "0" ]; then echo " build: failed" @@ -79,7 +84,7 @@ rm -rf ode fi - if [ $force_ode == "false" ]; then + if [ $force_ode = "false" ]; then if [ -e "raydium/ode/ode/src/libode.a" ]; then echo " ODE install detected. If you want to reinstall, add --force-ode-install." return 0 @@ -97,9 +102,15 @@ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/opende co -r UNSTABLE -P raydium/ode exit_if_error "$?" "CVS server error ? Try manual install (http://ode.org)" else - if [ ! -f "raydium/ode.tar.gz" ]; then + + if [ ! -f "raydium/ode-0.9.zip" ]; then echo " Downloading 'certified' version from Raydium website ..." - wget -O raydium/ode.tar.gz http://freeway.raydium.org/data/stable_mirrors/ode-0.7.tar.gz + if [ "`uname`" = "FreeBSD" ]; then + wget -O raydium/ode.zip "http://downloads.sourceforge.net/opende/ode-src-0.9.zip?modtime=1192176744&big_mirror=0" + else + wget -O raydium/ode.tar.gz http://freeway.raydium.org/data/stable_mirrors/ode-0.7.tar.gz + fi + exit_if_error "$?" "Error downloading." else echo " Using previously downloaded file. Remove raydium/ode.tar.gz before launching configure, if needed" @@ -111,7 +122,12 @@ if [ -d "ode" ]; then rm -rf ode fi - tar xzf ode.tar.gz + if [ "`uname`" = "FreeBSD" ]; then + unzip ode.zip + mv ode-0.9 ode + else + tar xzf ode.tar.gz + fi ret=$? cd - > /dev/null exit_if_error "$ret" "tar not found, or corrupted archive" @@ -121,15 +137,57 @@ echo " Configuring ..." echo "Configuring ODE" >> configure.log echo "===============" >> configure.log + + if [ "`uname`" = "FreeBSD" ]; then + # freeBSD Environment + CPPFLAGS="-I/usr/local/include" + LIBS="-L/usr/local/lib" + + # patch freebsd + sed -e '/if test/ s|==|=|' -e 's|^\( *CFLAGS=\)|#\1|;' \ + -e 's|^\( *CPPFLAGS=\)|#\1|' -e 's|^\( *CXXFLAGS=\)|#\1|' \ + -i "" raydium/ode/configure + + sed -i "" -e 's|__isnanf||g; s|__isnan||g' -e 's|-lpthread|${PTHREAD_LIBS}|g' \ + raydium/ode/configure + + + + sed -i "" -e '/^traplib_PROGRAMS / d' raydium/ode/ode/src/Makefile.in + find raydium/ode -type f -name Makefile.in -print0 | xargs -0 sed \ + -e '/^DEFAULT_INCLUDES/ s|$$| -I$$(top_builddir)/include|' \ + -e '/CFLAGS/ s|-O[12]||' -i "" + + find raydium/ode -type f -print0 | xargs -0 sed \ + -i "" -e 's|malloc.h|stdlib.h|g' + fi + + cd raydium/ode - ./configure 2>>../../configure.log >>../../configure.log + if [ "`uname`" = "FreeBSD" ]; then + ./configure --disable-shared --disable-double-precision --disable-demos 2>>../../configure.log >>../../configure.log + else + ./configure 2>>../../configure.log >>../../configure.log + fi ret=$? cd - > /dev/null exit_if_error "$?" "ODE configuration failed (see configure.log)" -# small patch - sed -i 's/\(.*define.*HAVE_STDLIB_H.*\)/#ifndef HAVE_STDLIB_H\n\1\n#endif/' raydium/ode/include/ode/config.h + if [ "`uname`" = "FreeBSD" ]; then + # small patch + + sed -i "" ' +/\(#define.*HAVE_STDLIB_H.*\)/ a\ +#endif' raydium/ode/include/ode/config.h + sed -i "" ' +/\(#define.*HAVE_STDLIB_H.*\)/ i\ +#ifndef HAVE_STDLIB_H +' raydium/ode/include/ode/config.h + else + sed -i "" 's/\(.*define.*HAVE_STDLIB_H.*\)/#ifndef HAVE_STDLIB_H\n\1\n#endif/' raydium/ode/include/ode/config.h + fi + # build echo " Building ..." echo "Building ODE" >> configure.log @@ -138,6 +196,11 @@ make 2>>../../configure.log >>../../configure.log ret=$? cd - > /dev/null + + if [ "`uname`" = "FreeBSD" ]; then + sed -e '/PACKAGE/ s|^|//|; /VERSION/ s|^|//|' -i "" raydium/ode/include/ode/config.h + fi + exit_if_error "$ret" "ODE Build failed (see configure.log)" # deleting @@ -155,14 +218,14 @@ rm -rf php fi - if [ $force_php == "false" ]; then + if [ $force_php = "false" ]; then if [ -e "raydium/php/libs/libphp5.a" ]; then echo " PHP install detected. If you want to reinstall, add --force-php-install." return 0 fi - else + else rm -rf raydium/php - fi + fi # test bison echo " Testing 'bison' ..." @@ -212,14 +275,41 @@ mv "$php" "raydium/php" exit_if_error "$?" "Is this script up to date ?" +if [ "`uname`" = "FreeBSD" ]; then +# Patches for Freebsd + #suhosin + echo " Patching ..." + wget -O raydium/php-suhosin.patch.gz http://download.suhosin.org/suhosin-patch-5.2.7-0.9.6.3.patch.gz + cd raydium + rm -f php-suhosin.patch + gunzip php-suhosin.patch.gz + cd - > /dev/null + cd raydium/php + patch -p1 < ../php-suhosin.patch + + cat acinclude.m4 build/libtool.m4 > aclocal.m4 + cd - > /dev/null + + #post-patch + cd raydium/php + touch main/php_config.h + cd - > /dev/null +fi + # configure echo " Configuring PHP ..." echo "Configuring PHP" >> configure.log echo "===============" >> configure.log cd raydium/php - ./configure --enable-embed=static --with-zlib --enable-ftp --enable-static=zlib --with-curl \ - --disable-simplexml --disable-xmlreader --disable-xmlwriter --enable-soap \ - >>../../configure.log 2>>../../configure.log + if [ "`uname`" = "FreeBSD" ]; then + ./configure --enable-embed=static --with-zlib --enable-ftp --enable-static=zlib --with-curl \ + --disable-simplexml --disable-xmlreader --disable-xmlwriter --enable-soap --without-iconv \ + >>../../configure.log 2>>../../configure.log + else + ./configure --enable-embed=static --with-zlib --enable-ftp --enable-static=zlib --with-curl \ + --disable-simplexml --disable-xmlreader --disable-xmlwriter --enable-soap \ + >>../../configure.log 2>>../../configure.log + fi ret=$? cd - > /dev/null exit_if_error "$ret" "PHP configure failed (missing libs ?). See configure.log" @@ -234,6 +324,15 @@ cd - > /dev/null exit_if_error "$ret" "PHP build failed, see configure.log" +# post-build patches + if [ "`uname`" = "FreeBSD" ]; then + cd raydium/php + echo "PHP_VER=5" > php.conf + echo "PHP_VERSION=5.2.9" >> php.conf + echo "PHP_EXT_INC=pcre" >> php.conf + cd - > /dev/null + fi + # deleting echo " Deleting tar.gz ..." rm -f raydium/php-latest.tar.gz Index: ostatcomp.sh =================================================================== --- ostatcomp.sh (revision 833) +++ ostatcomp.sh (working copy) @@ -6,16 +6,32 @@ # Warning, with GLEW 1.3.4, you must install libGLEW.a by hand, since # the official Makefile is broken and strips this file during the make install +# -lresolv +# -DNO_SOUND_DEBUG \ +# -lasound +#-Wl,-dynamic-linker=/lib/ld-linux.so.2 -Wl,-Bstatic -L/usr/X11R6/lib/ \ ulimit -c 0 rm test -gcc -g $1 -Wall -o test -static-libgcc \ --Wl,-dynamic-linker=/lib/ld-linux.so.2 -Wl,-Bstatic -L/usr/X11R6/lib/ \ --lm -lXi -ljpeg \ --Iraydium/ode/include/ raydium/ode/ode/src/libode.a \ --lGLEW -lXmu -lXinerama -lopenal -lalut -lvorbisfile -lvorbis -logg \ --Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM raydium/php/libs/libphp5.a \ --lcrypt -lssl -lcrypto -lidn -lresolv -lz -lcurl -lxml2 -lssl -lcrypto -lidn -lstdc++ -lm -lX11 -lXext \ --Wl,-Bdynamic -lGL -lGLU -lasound -lpthread + +if [ "`uname`" != "FreeBSD" ]; then + gcc -g $1 -Wall -o test -static-libgcc \ + -Wl,-dynamic-linker=/libexec/ld-elf.so.1 -Wl,-Bstatic -L/usr/X11R6/lib/ \ + -lm -lXi -ljpeg \ + -Iraydium/ode/include/ raydium/ode/ode/src/libode.a \ + -lGLEW -lXmu -lXinerama -lopenal -lalut -lvorbisfile -lvorbis -logg \ + -Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM raydium/php/libs/libphp5.a \ + -lcrypt -lssl -lcrypto -lidn -lresolv -lz -lcurl -lxml2 -lssl -lcrypto -lidn -lstdc++ -lm -lX11 -lXext \ + -Wl,-Bdynamic -lGL -lGLU -lasound -lpthread +else + gcc -g $1 -Wall -o test -static-libgcc \ + -Wl,-dynamic-linker=/libexec/ld-elf.so.1 -Wl,-Bstatic -L/usr/X11R6/lib/ -L/usr/local/lib/ -I/usr/local/include/ \ + -lm -lXi -ljpeg \ + -Iraydium/ode/include/ raydium/ode/ode/src/libode.a \ + -lGLEW -lXmu -lXinerama -lopenal -lalut -lvorbisfile -lvorbis -logg \ + -Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM raydium/php/libs/libphp5.a \ + -lcrypt -lssl -lcrypto -lidn -lz -lcurl -lxml2 -lssl -lcrypto -lidn -lstdc++ -lm -lX11 -lXext -lintl -liconv \ + -Wl,-Bdynamic -lGL -lGLU -lopenal -lpthread +fi # Strange thing above : -lssl -lcrypto must appear twice arround -lcurl ... sync shift Index: ocomp.sh =================================================================== --- ocomp.sh (revision 833) +++ ocomp.sh (working copy) @@ -5,10 +5,17 @@ ulimit -c 0 rm test -gcc -g "$1" -Wall -o test -L/usr/X11R6/lib/ -lXinerama -lGL -lGLU -lm -lopenal -lalut -ljpeg \ --Iraydium/ode/include/ raydium/ode/ode/src/libode.a -lvorbis -lvorbisfile -logg \ --Iraydium/php/ -Iraydium/php/include -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM raydium/php/libs/libphp5.a \ --lresolv -lcrypt -lz -lcurl -lxml2 -lGLEW $OCOMP_FLAGS +if [ "`uname`" != "FreeBSD" ]; then + gcc -g "$1" -Wall -o test -L/usr/X11R6/lib/ -lXinerama -lGL -lGLU -lm -lopenal -lalut -ljpeg \ + -Iraydium/ode/include/ raydium/ode/ode/src/libode.a -lvorbis -lvorbisfile -logg \ + -Iraydium/php/ -Iraydium/php/include -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM raydium/php/libs/libphp5.a \ + -lresolv -lcrypt -lz -lcurl -lxml2 -lGLEW $OCOMP_FLAGS +else + gcc -g "$1" -Wall -o test -L/usr/X11R6/lib/ -L/usr/local/lib/ -I/usr/local/include/ -lXinerama -lGL -lGLU -lm -lopenal -lalut -ljpeg \ + -Iraydium/ode/include/ raydium/ode/ode/src/libode.a -lvorbis -lvorbisfile -logg \ + -Iraydium/php/ -Iraydium/php/include -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM raydium/php/libs/libphp5.a \ + -lpthread -lcrypt -lz -lcurl -lxml2 -lGLEW $OCOMP_FLAGS +fi sync shift ./test "$@" Index: odyncomp.sh =================================================================== --- odyncomp.sh (revision 833) +++ odyncomp.sh (working copy) @@ -52,10 +52,23 @@ if [ -f test ]; then rm test fi -$CC "$1" -g -Wall -DFORCE_LIBRAYDIUM -o test libraydium.so \ --Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM \ --Iraydium/ode/include/ $AR_PATH_INCLUDE $AR_PATH_LIBS $LIBWII_PATH_INCLUDE $LIBWII_ADDS $ODYNCOMP_FLAGS +if [ "`uname`" != "FreeBSD" ]; then + $CC "$1" -g -Wall -DFORCE_LIBRAYDIUM -o test libraydium.so \ + -Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM \ + -Iraydium/ode/include/ $AR_PATH_INCLUDE $AR_PATH_LIBS $LIBWII_PATH_INCLUDE $LIBWII_ADDS $ODYNCOMP_FLAGS +else + $CC "$1" ./libraydium.so -g -pthread -Wall -DFORCE_LIBRAYDIUM -o test \ + -I/usr/local/include/ \ + -Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM \ + -Iraydium/ode/include/ $AR_PATH_INCLUDE $AR_PATH_LIBS $LIBWII_PATH_INCLUDE $LIBWII_ADDS $ODYNCOMP_FLAGS + + echo $CC "$1" ./libraydium.so -g -Wall -DFORCE_LIBRAYDIUM -o test \ + -I/usr/local/include/ \ + -Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM \ + -Iraydium/ode/include/ $AR_PATH_INCLUDE $AR_PATH_LIBS $LIBWII_PATH_INCLUDE $LIBWII_ADDS $ODYNCOMP_FLAGS +fi + ret=$? if [ $ret -ne 0 ]; then exit $ret Index: raydium/live.c =================================================================== --- raydium/live.c (revision 833) +++ raydium/live.c (working copy) @@ -175,6 +175,7 @@ int raydium_live_video_open(char *device, int sizex, int sizey) { +#ifndef __FreeBSD__ #ifndef APPLE char *default_device=RAYDIUM_LIVE_DEVICE_DEFAULT; int id; @@ -604,6 +605,7 @@ return id; #endif #endif +#endif } @@ -615,6 +617,7 @@ int raydium_live_video_read(raydium_live_Device *dev) { +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 fd_set fds; @@ -684,6 +687,7 @@ #endif #endif +#endif return 1; } @@ -704,6 +708,7 @@ void raydium_internal_live_close(void) { +#ifndef __FreeBSD__ #ifndef APPLE int i; @@ -720,6 +725,7 @@ DestroyWindow(raydium_live_device[i].hWnd_WC); #endif #endif +#endif } void raydium_live_init(void) @@ -777,6 +783,7 @@ int raydium_live_texture_video(int device_id, char *as) { +#ifndef __FreeBSD__ #ifndef APPLE //#ifndef WIN32 int id; @@ -827,6 +834,10 @@ raydium_log("live: Live API is not yet supported under Mac OS X."); return -1; #endif +#else + raydium_log("live: Live API is not yet supported under FreeBSD."); + return -1; +#endif } Index: raydium/joy.c =================================================================== --- raydium/joy.c (revision 833) +++ raydium/joy.c (working copy) @@ -58,6 +58,7 @@ //struct input_event stop; //struct ff_effect effect; int raydium_joy_event_handle; +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 struct ff_effect effect_tremble; @@ -182,6 +183,7 @@ int detectedDevices = 0; #endif #endif +#endif char effect_tremble_state=0; unsigned long last_event; @@ -210,6 +212,7 @@ #ifndef APPLE #ifndef WIN32 +#ifndef __FreeBSD__ int raydium_joy_process_event(struct js_event e) { switch(e.type) @@ -300,6 +303,7 @@ return(e.type); } #endif +#endif #else #ifdef MACOSX static void HIDReportErrorNum(char* strError, long numError) @@ -761,6 +765,7 @@ void raydium_joy_callback(void) { +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 struct js_event e; //structure for storing an event @@ -1003,11 +1008,13 @@ raydium_joy_axis[2] = raydium_joy_z = myglutGetAcceleration(2); #endif #endif +#endif //raydium_log("Joy x=%f,y=%f,z=%f",raydium_joy_x,raydium_joy_y,raydium_joy_z); } void raydium_joy_ff_autocenter(int perc) { +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 struct input_event ie; @@ -1023,6 +1030,7 @@ #endif #endif +#endif } @@ -1034,6 +1042,7 @@ int autocenter=5; /* default value. between 0 and 100 */ raydium_joy_init_vars(); +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 @@ -1362,6 +1371,7 @@ raydium_joy = 1; #endif #endif +#endif } void raydium_joy_close(void) @@ -1426,6 +1436,7 @@ void raydium_joy_ff_tremble_set(GLfloat period, GLfloat force) { +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 struct input_event play; @@ -1465,5 +1476,6 @@ //printf("ff event refreshed\n"); #endif #endif +#endif } Index: raydium/init.c =================================================================== --- raydium/init.c (revision 833) +++ raydium/init.c (working copy) @@ -287,14 +287,21 @@ raydium_mouse_init(); raydium_joy_init(); // and not init_joy, since defined in joy.c, not init.c raydium_sound=0; + +#ifndef NO_SOUND_DEBUG raydium_sound_init(); +#endif + raydium_viewport_init(); raydium_callback_set(); #ifdef PHP_SUPPORT raydium_php_init(); #endif +#ifndef NO_SOUND_DEBUG raydium_atexit(raydium_sound_close); +#endif + raydium_atexit(raydium_joy_close); raydium_atexit(raydium_network_close); raydium_atexit(raydium_internal_dump); Index: raydium/live.h =================================================================== --- raydium/live.h (revision 833) +++ raydium/live.h (working copy) @@ -15,10 +15,12 @@ #ifndef WIN32 #ifndef APPLE +#ifndef __FreeBSD__ #include #include #include #endif +#endif #else #include #include "rayvfw.h" // Extra define for vfw missing in standart ming headers @@ -42,6 +44,7 @@ { #ifndef WIN32 #ifndef APPLE +#ifndef __FreeBSD__ int fd; struct video_capability cap; struct video_window win; @@ -50,7 +53,8 @@ // for mmap captures struct video_mbuf gb_buffers; struct video_mmap gb_buf; - + +#endif #endif #else HWND hWnd_WC; Index: raydium/myglut-x11.c =================================================================== --- raydium/myglut-x11.c (revision 833) +++ raydium/myglut-x11.c (working copy) @@ -21,9 +21,11 @@ #include #endif +#ifndef __FreeBSD__ #ifdef HAVE_DPMS #include #endif +#endif #ifdef HAVE_MOTIF #include Index: raydium/timecall.c =================================================================== --- raydium/timecall.c (revision 833) +++ raydium/timecall.c (working copy) @@ -135,6 +135,7 @@ signed char raydium_timecall_devrtc_rate_change(unsigned long new) { +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 if(ioctl(raydium_timecall_devrtc_handle, RTC_IRQP_SET, new)==-1) @@ -151,10 +152,12 @@ return 0; #endif #endif +#endif } void raydium_timecall_devrtc_close(void) { +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 if(ioctl(raydium_timecall_devrtc_handle, RTC_PIE_OFF, 0) == -1) @@ -166,11 +169,13 @@ close(raydium_timecall_devrtc_handle); #endif #endif +#endif } unsigned long raydium_timecall_devrtc_init(void) { +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 unsigned long freq; @@ -225,6 +230,7 @@ return 0; #endif #endif +#endif } /* Index: raydium/video.c =================================================================== --- raydium/video.c (revision 833) +++ raydium/video.c (working copy) @@ -179,6 +179,7 @@ raydium_video_video[id].fps, raydium_video_video[id].frames_total); +#ifndef NO_SOUND_DEBUG if(ogg!=NULL && strlen(ogg)>0) { if(raydium_sound_load_music(ogg)<0) @@ -186,7 +187,7 @@ else raydium_video_current_with_sound=id; } - +#endif return id; } Index: raydium/camera.c =================================================================== --- raydium/camera.c (revision 833) +++ raydium/camera.c (working copy) @@ -99,8 +99,10 @@ if(raydium_sound && raydium_viewport_use==-1) { raydium_camera_vectors(or); // get vectors +#ifndef NO_SOUND_DEBUG raydium_sound_SetListenerPos(pos); raydium_sound_SetListenerOr(or); +#endif } if(raydium_sky_atmosphere_check()) Index: raydium/texture.c =================================================================== --- raydium/texture.c (revision 833) +++ raydium/texture.c (working copy) @@ -125,9 +125,9 @@ else flipy=0; -// It seem's that all texture are inverted, the inverted bit seem's insignifiant +// It seem's that all texture are inverted, the inverted bit seem's insignifiant //flipy=1; - + //checking if you can use NPOT textures if(!raydium_texture_use_npot_textures) { @@ -167,11 +167,11 @@ fclose(file); raydium_log("texture: ERROR ! malloc for %s failed ! (%i bytes needed)",filename,tx*ty*bpp); return 0; } + - chunkid=0; rle=0; - + //reading the image data in the file for(jj=0; jj0)raydium_texture_used[id]=TRUE; Index: raydium/ode.c =================================================================== --- raydium/ode.c (revision 833) +++ raydium/ode.c (working copy) @@ -29,7 +29,6 @@ counter++; } - void raydium_ode_init_object(int i) { raydium_ode_object[i].id=i; @@ -41,7 +40,6 @@ raydium_ode_object[i].OnDelete=NULL; } - void raydium_ode_init_element(int i) { int j; @@ -149,6 +147,9 @@ #ifdef APPLE dInitODE(); #endif +#ifdef __FreeBSD__ + dInitODE(); +#endif int i; if(sizeof(dReal) != sizeof(float)) @@ -275,7 +276,6 @@ return 0; } - void raydium_ode_ground_dTriArrayCallback ( dGeomID TriMesh, dGeomID RefObject, const int* TriIndices, int TriCount) @@ -536,7 +536,6 @@ return raydium_ode_object_rename(raydium_ode_object_find(o),newname); } - signed char raydium_ode_object_colliding(int o, signed char colliding) { if(!raydium_ode_object_isvalid(o)) @@ -722,10 +721,9 @@ signed char raydium_ode_element_material_name(char *name, dReal erp, dReal cfm) { -return raydium_ode_element_material(raydium_ode_element_find(name),erp,cfm); + return raydium_ode_element_material(raydium_ode_element_find(name),erp,cfm); } - signed char raydium_ode_element_slip(int e, dReal slip) { if(!raydium_ode_element_isvalid(e)) @@ -905,11 +903,13 @@ dBodySetGravityMode(raydium_ode_element[e].body,enable); } + void raydium_ode_element_gravity_name(char *e, signed char enable) { raydium_ode_element_gravity(raydium_ode_element_find(e),enable); } + void raydium_ode_element_ttl_set(int e, int ttl) { if(!raydium_ode_element_isvalid(e)) @@ -925,7 +925,6 @@ raydium_ode_element_ttl_set(raydium_ode_element_find(e),ttl); } - signed char raydium_ode_element_rel2world(int element,dReal *rel,dReal *world) { dBodyID body; @@ -1074,7 +1073,6 @@ raydium_ode_element_slip(e,RAYDIUM_ODE_SLIP_PLAYER); else raydium_ode_element_slip(e,RAYDIUM_ODE_SLIP_DEFAULT); - return 1; } @@ -2268,7 +2266,6 @@ raydium_ode_object_rotate_name(obj,r); } - void raydium_ode_joint_suspension(int j, dReal erp, dReal cfm) { void (*f)(dJointID,int,dReal); @@ -3010,7 +3007,9 @@ { dReal *pos; pos=raydium_ode_element_pos_get(e); +#ifndef NO_SOUND_DEBUG raydium_sound_SetSourcePos(source,pos); +#endif return; } raydium_log("ODE: Error: cannot update source: invalid index or name"); @@ -3811,7 +3810,6 @@ //////// - void raydium_ode_element_camera_inboard(int e, dReal px, dReal py, dReal pz, dReal lookx, dReal looky, dReal lookz) { //dBodyID body; @@ -3849,7 +3847,6 @@ raydium_ode_element_camera_inboard(raydium_ode_element_find(name),px,py,pz,lookx,looky,lookz); } - void raydium_ode_draw_all(signed char names) { int i,j; @@ -4249,7 +4246,6 @@ return -1; // == coredump in the caller ;) } - void raydium_ode_near_callback(void *data, dGeomID o1, dGeomID o2) { int i,n; @@ -4260,6 +4256,7 @@ dJointID c; raydium_ode_Element *e1, *e2; int ground_elem_id,distan_obj_id,ray_id; +dReal j=0; dReal erp=0; dReal cfm=0; dReal slip=0; @@ -4310,6 +4307,7 @@ return; n = dCollide (o1,o2,N,&contact[0].geom,sizeof(dContact)); + if(n>=N-1) raydium_log("ODE: WARNING ! Not enought contact points available ! (%i max)",N); if (n > 0) @@ -4320,9 +4318,11 @@ e1=dGeomGetData(contact[i].geom.g1); e2=dGeomGetData(contact[i].geom.g2); + + if(e1==NULL || e2==NULL) continue; // Deleted, or not one of our elements - + if(e1==e2) continue; // May happend with ray @@ -4464,11 +4464,17 @@ { int id1,id2; id1=id2=-1; + if(e1) id1=e1->id; if(e2) id2=e2->id; if(!f(id1,id2,&contact[i])) continue; } + j = contact[i].geom.depth; + if(j <= 0.f) + { + continue; + } if(e1) e1->_touched=1; // may use it as a counter ? if(e2) e2->_touched=1; // ... @@ -4479,7 +4485,6 @@ } } - void raydium_ode_callback(void) { int i,j; @@ -4876,7 +4881,6 @@ // Missing : shadows, forced colors, before/after callbacks, // fixed elements, ... // Some code is pasted from file.c (and this is BAD ! :) - int raydium_ode_capture_3d(char *filename) { int i,j,k; @@ -4961,7 +4965,6 @@ return 1; } - int raydium_ode_orphans_check(void) { int i,j,k,n; @@ -4992,7 +4995,6 @@ return cpt; } - int raydium_ode_mouse_pick(dReal dist,dReal pos[3],dReal *depth) { GLdouble dX, dY, dZ; @@ -5114,7 +5116,6 @@ return raydium_ode_timestep; } - void raydium_ode_capture_internal_create(int type, int id, dReal *sizes, char *mesh) { unsigned short event; Index: raydium/ode.h =================================================================== --- raydium/ode.h (revision 833) +++ raydium/ode.h (working copy) @@ -15,8 +15,12 @@ #ifdef APPLE #include "ode/include/ode/ode.h" #else +#ifdef __FreeBSD__ +#include "ode/ode.h" +#else #include "../ode/include/ode/ode.h" #endif +#endif #define RAYDIUM_ODE_MAX_OBJECTS 64 #define RAYDIUM_ODE_MAX_ELEMENTS 256 Index: raydium/sound.c =================================================================== --- raydium/sound.c (revision 833) +++ raydium/sound.c (working copy) @@ -5,6 +5,8 @@ See "license.txt" file. */ +#ifndef NO_SOUND_DEBUG + #ifndef DONT_INCLUDE_HEADERS #include "index.h" #else @@ -61,7 +63,7 @@ if(!strcasecmp("artist",part1)) strcpy(raydium_sound_music_info.artist,part2); - ++ptr; + ++ptr; } } @@ -86,7 +88,7 @@ int raydium_sound_Array3IsValid(ALfloat *a) { if( !raydium_math_isfloat(a[0]) || - !raydium_math_isfloat(a[1]) || + !raydium_math_isfloat(a[1]) || !raydium_math_isfloat(a[2]) ) { raydium_log("sound : ERROR: invalid 3xALfloat array provided"); @@ -918,3 +920,5 @@ raydium_sound_source_fade(src,len); strcpy(raydium_sound_source_fade_tofile[src],to); } + +#endif Index: raydium/reg_api.c =================================================================== --- raydium/reg_api.c (revision 833) +++ raydium/reg_api.c (working copy) @@ -36,9 +36,11 @@ // background.c PHP_v_ffff(raydium_background_color_change); +#ifndef NO_SOUND_DEBUG // sound.c PHP_i_s(raydium_sound_load_music); PHP_i_if(raydium_sound_SetSourceGain); +#endif // render.c PHP_v_v(raydium_rendering_wireframe); @@ -227,9 +229,11 @@ // background.c raydium_register_function(C2PHP(raydium_background_color_change),"raydium_background_color_change"); +#ifndef NO_SOUND_DEBUG // sound.c raydium_register_function(C2PHP(raydium_sound_load_music),"raydium_sound_load_music"); raydium_register_function(C2PHP(raydium_sound_SetSourceGain),"raydium_sound_setsourcegain"); +#endif // render.c raydium_register_function(C2PHP(raydium_rendering_wireframe),"raydium_rendering_wireframe"); Index: raydium/headers/joy.h =================================================================== --- raydium/headers/joy.h (revision 833) +++ raydium/headers/joy.h (working copy) @@ -50,11 +50,13 @@ Emulate keyboard (directional pad) with joy, if any. **/ +#ifndef __FreeBSD__ #ifndef APPLE #ifndef WIN32 __rayapi int raydium_joy_process_event (struct js_event e); #endif #endif +#endif __rayapi void raydium_joy_callback (void); __rayapi void raydium_joy_ff_autocenter (int perc); /** Index: raydium/callback.c =================================================================== --- raydium/callback.c (revision 833) +++ raydium/callback.c (working copy) @@ -43,7 +43,11 @@ raydium_console_draw(); raydium_osd_cursor_draw(); raydium_joy_callback(); + +#ifndef NO_SOUND_DEBUG raydium_sound_callback(); +#endif + #ifdef ODE_SUPPORT // 0hz ODE callback workaround raydium_ode_network_read(); Index: raydium/common.h =================================================================== --- raydium/common.h (revision 833) +++ raydium/common.h (working copy) @@ -113,12 +113,16 @@ // need to separate LINUX & others, using glut for joystick.. #ifndef WIN32 #ifndef APPLE +#ifndef __FreeBSD__ #include +#endif #endif #include #ifndef APPLE +#ifndef __FreeBSD__ #include #endif +#endif #include #include #include