diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 64766219f..bb9447c92 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D1X-Rebirth Changelog -------- arch/sdl/digi_mixer.c, arch/sdl/digi_mixer_music.c, arch/sdl/jukebox.c, d1x-rebirth.xcodeproj/project.pbxproj, main/multi.h: On Mac OS X - no longer have to copy SDL_mixer.h to SDL framework; frameworks can now be in /Library/Frameworks; fix for obscure compile error involving u_int32_t include/ogl_init.h, 2d/font.c, arch/ogl/ogl.c, arch/ogl/gr.c: Rewrote code to control Texture Filtering a little so it's easier to apply Mipmaps for different parts of the game independently +main/gamecntl.c, main/menu.c, main/newdemo.c, main/newdemo.h: Using PHYSFSX_findFiles to make sure random demo playback will only find actual demo files and not quit autodemo; added DEMO_EXT for an universal definition of demo file extension 20100901 -------- diff --git a/main/gamecntl.c b/main/gamecntl.c index 7d89f5ae0..45e07b1a3 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -441,7 +441,7 @@ int HandleDemoKey(int key) c = newmenu_do( NULL, NULL, 2, m, NULL, NULL ); if (c == -2) break; - strcat(filename, ".dem"); + strcat(filename, DEMO_EXT); num[0] = '\0'; m[ 0].type = NM_TYPE_TEXT; m[ 0].text = "strip how many bytes"; m[ 1].type = NM_TYPE_INPUT;m[ 1].text_len = 16; m[1].text = num; diff --git a/main/menu.c b/main/menu.c index 49d2e4fef..36c02ccc1 100644 --- a/main/menu.c +++ b/main/menu.c @@ -736,7 +736,7 @@ int demo_menu_handler( listbox *lb, d_event *event, void *userdata ) int select_demo(void) { char **list; - char *types[] = { ".dem", NULL }; + char *types[] = { DEMO_EXT, NULL }; int NumItems; list = PHYSFSX_findFiles(DEMO_DIR, types); diff --git a/main/newdemo.c b/main/newdemo.c index 5f5940a3d..be80f997f 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -3252,7 +3252,7 @@ try_again: if (filename[0] != '\0') { strcpy(save_file, DEMO_DIR); strcat(save_file, filename); - strcat(save_file, ".dem"); + strcat(save_file, DEMO_EXT); } else sprintf (save_file, "%stmp%d.dem", DEMO_DIR, tmpcnt++); remove(save_file); @@ -3278,7 +3278,7 @@ try_again: strcat(fullname, m[1].text); else strcat(fullname, m[0].text); - strcat(fullname, ".dem"); + strcat(fullname, DEMO_EXT); PHYSFS_delete(fullname); PHYSFSX_rename(DEMO_FILENAME, fullname); } @@ -3287,9 +3287,10 @@ try_again: int newdemo_count_demos() { char **find, **i; + char *types[] = { DEMO_EXT, NULL }; int NumFiles=0; - find = PHYSFS_enumerateFiles(DEMO_DIR); + find = PHYSFSX_findFiles(DEMO_DIR, types); for (i = find; *i != NULL; i++) NumFiles++; @@ -3316,6 +3317,7 @@ void newdemo_start_playback(char * filename) // Randomly pick a filename int NumFiles = 0, RandFileNum; rnd_demo = 1; + char *types[] = { DEMO_EXT, NULL }; NumFiles = newdemo_count_demos(); @@ -3326,7 +3328,7 @@ void newdemo_start_playback(char * filename) RandFileNum = d_rand() % NumFiles; NumFiles = 0; - find = PHYSFS_enumerateFiles(DEMO_DIR); + find = PHYSFSX_findFiles(DEMO_DIR, types); for (i = find; *i != NULL; i++) { @@ -3345,13 +3347,6 @@ void newdemo_start_playback(char * filename) GameArg.SysAutoDemo = 0; return; } - - // if in random mode, PhysFS may look for all possible files, so check if filename actually points to be a demo file... - if (strnicmp(".dem",&filename2[strlen(filename2)-4],4)) - { - GameArg.SysAutoDemo = 0; - return; - } } infile = PHYSFSX_openReadBuffered(filename2); diff --git a/main/newdemo.h b/main/newdemo.h index 3e4f3431c..538005dcb 100644 --- a/main/newdemo.h +++ b/main/newdemo.h @@ -32,6 +32,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define ND_STATE_ONEFRAMEBACKWARD 7 #define DEMO_DIR "demos/" +#define DEMO_EXT ".dem" #if WORDS_BIGENDIAN #define DEMO_BACKUP_EXT "386" #else