diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a8799d286..3d8f64987 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20080227 +-------- +d2x-rebirth.xcodeproj, main/bmread.c, main/piggy.c: allow external sound files to be put in 'Sounds' folder, update Xcode project + 20080225 -------- include/loadgl.h, main/newmenu.c, main/titles.c: Added definitions for OpenGL fucntions which might not be included in system headers; Cleaned and declared briefings palette hacks (EMULATING_D1 needs work!); Menu right border shadow was too wide; diff --git a/d2x-rebirth.xcodeproj/project.pbxproj b/d2x-rebirth.xcodeproj/project.pbxproj index 7d4f5909b..f90ee8882 100755 --- a/d2x-rebirth.xcodeproj/project.pbxproj +++ b/d2x-rebirth.xcodeproj/project.pbxproj @@ -608,7 +608,6 @@ EB0420D10A341042002CC961 /* screens.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = screens.h; sourceTree = ""; }; EB0420D20A341042002CC961 /* scores.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = scores.h; sourceTree = ""; }; EB0420D30A341042002CC961 /* robot.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = robot.h; sourceTree = ""; }; - EB0420D40A341042002CC961 /* reorder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = reorder.h; sourceTree = ""; }; EB0420D50A341042002CC961 /* render.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = render.h; sourceTree = ""; }; EB0420D60A341042002CC961 /* powerup.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = powerup.h; sourceTree = ""; }; EB0420D70A341042002CC961 /* polyobj.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = polyobj.h; sourceTree = ""; }; @@ -1223,7 +1222,6 @@ EB0420D70A341042002CC961 /* polyobj.h */, EB0420D60A341042002CC961 /* powerup.h */, EB0420D50A341042002CC961 /* render.h */, - EB0420D40A341042002CC961 /* reorder.h */, EB0420D30A341042002CC961 /* robot.h */, EB0420D20A341042002CC961 /* scores.h */, EB0420D10A341042002CC961 /* screens.h */, diff --git a/main/bmread.c b/main/bmread.c index 69a7daef4..bd454921b 100644 --- a/main/bmread.c +++ b/main/bmread.c @@ -314,20 +314,22 @@ int ds_load(int skip, char * filename ) { } removeext(filename, fname); - sprintf(rawname, "%s.%s", fname, (GameArg.SndDigiSampleRate==SAMPLE_RATE_22K) ? "r22" : "raw"); + sprintf(rawname, "Sounds/%s.%s", fname, (GameArg.SndDigiSampleRate==SAMPLE_RATE_22K) ? "r22" : "raw"); i=piggy_find_sound( fname ); if (i!=255) { return i; } - cfp = cfopen( rawname, "rb" ); + cfp = PHYSFSX_openDataFile(rawname); if (cfp!=NULL) { new.length = cfilelength( cfp ); MALLOC( new.data, ubyte, new.length ); cfread( new.data, 1, new.length, cfp ); cfclose(cfp); + new.bits = 8; + new.freq = 11025; // -- mprintf( (0, "S" )); // -- mprintf( (0, "<%s>", rawname )); } else { @@ -408,9 +410,9 @@ int gamedata_read_tbl(int pc_shareware) // Open BITMAPS.TBL for reading. have_bin_tbl = 0; - InfoFile = cfopen( "BITMAPS.TBL", "rb" ); + InfoFile = PHYSFSX_openDataFile("BITMAPS.TBL"); if (InfoFile == NULL) { - InfoFile = cfopen("BITMAPS.BIN", "rb"); + InfoFile = PHYSFSX_openDataFile("BITMAPS.BIN"); if (InfoFile == NULL) return 0; //missing BITMAPS.TBL and BITMAPS.BIN file have_bin_tbl = 1; diff --git a/main/piggy.c b/main/piggy.c index c967595f4..683ecfa35 100644 --- a/main/piggy.c +++ b/main/piggy.c @@ -1666,6 +1666,8 @@ void piggy_dump_all() void piggy_close() { + int i; + piggy_close_file(); if (BitmapBits) @@ -1674,6 +1676,10 @@ void piggy_close() if ( SoundBits ) d_free( SoundBits ); + for (i = 0; i < Num_sound_files; i++) + if (SoundOffset[i] == 0) + d_free(GameSounds[i].data); + hashtable_free( &AllBitmapsNames ); hashtable_free( &AllDigiSndNames );